IWalletConnectConnector is available in SDK v2.0.0+.
Field | Description |
---|
getSupportedNetworks: Promise<string[]> | A method to retrieve the supported/approved networks for the WalletConnect wallet. Some wallets will only allow approve a network if the user manually switches in the wallet app first. |
Interface definition
interface IWalletConnectConnector {
getSupportedNetworks: Promise<string[]>
};
How to use it
In this example, we are going to return all supported networks for the wallet connector.
import { useDynamicContext } from '@dynamic-labs/sdk-react-core';
import { isWalletConnectConnector } from '@dynamic-labs/wallet-connector-core';
const MyComponent = () => {
const { primaryWallet } = useDynamicContext();
const getWCSupportedNetworks = async () => {
if (!isWalletConnectConnector(primaryWallet?.connector)) {
return;
}
const supportedNetworks = await primaryWallet.connector.getSupportedNetworks();
console.log('supportedNetworks', supportedNetworks);
return supportedNetworks;
};
...
};