Skip to main content
Important: All other methods in the JavaScript SDK require a Dynamic client to be created first.

Installation

npm install @dynamic-labs-sdk/client

Usage

import { createDynamicClient } from '@dynamic-labs-sdk/client';

const dynamicClient = createDynamicClient({
  environmentId: 'YOUR_ENVIRONMENT_ID',
  metadata: {
    name: 'YOUR_APP_NAME',
    universalLink: 'https://yourapp.com',
    iconUrl: 'YOUR_APP_ICON_URL',
  },
});

You can get your environment ID from the Dynamic dashboard.

Configuration Options

Basic Options

  • environmentId (required): Your Dynamic environment ID
  • autoInitialize (optional): Whether to automatically initialize the client (default: true)
  • metadata (optional): Your app’s metadata
    • name: The name of your app
    • universalLink: The official domain/URL of your app (e.g., https://yourapp.com). Used for deep link redirects and as the domain in sign-in message signatures.
    • iconUrl: The URL of the icon of your app
    • nativeLink: Native deep link for your app (e.g., myapp://). Used for app-to-app communication on mobile devices.
  • logLevel (optional): Logging level for the SDK

Advanced Options

Transformers

Customize SDK data before it’s used throughout your application:
const dynamicClient = createDynamicClient({
  environmentId: 'YOUR_ENVIRONMENT_ID',
  transformers: {
    networkData: (network) => {
      // Override RPC URLs
      if (network.networkId === '1') {
        return {
          ...network,
          rpcUrls: {
            http: ['https://eth-mainnet.g.alchemy.com/v2/YOUR-KEY'],
          },
        };
      }
      return network;
    },
  },
});
See Network Transformers for more details.