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',
    url: 'YOUR_APP_URL',
    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, URL, icon)
  • 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 Data Transformers for more details.