Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt

Use this file to discover all available pages before exploring further.

You can listen to events emitted by the wallet provider by using the onWalletProviderEvent. It will return an unsubscribe function that you can call to stop listening to the event.

Usage

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

const unsubscribe = onWalletProviderEvent({
  callback: ({ addresses }) => {
    console.log('Accounts changed event was called with', addresses);
  },
  event: 'accountsChanged',
  walletProviderKey: 'metamaskevm',
});

// Call unsubscribe() when you no longer need the listener

Available events

  • accountsChanged: (params: { addresses: string[] }) => void;
  • disconnected: () => void;
  • networkChanged: (params: { networkId: string }) => void;