Objects
WalletConnectConnector
This is Dynamic’s WalletConnect connector over the basic wallet interface. This can be used to interact with the users WalletConnect wallets. It has all methods available in the WalletConnector and some additional method specific to WalletConnect wallets.
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;
};
...
};
Was this page helpful?