walletconnect-dart-sdk
walletconnect-dart-sdk copied to clipboard
I just want to know how to switch the network in MetaMask mobile using code
I just want to know how to switch the network in MetaMask mobile using code
You can try "wallet_switchEthereumChain" or "wallet_addEthereumChain"
You can try "wallet_switchEthereumChain" or "wallet_addEthereumChain"
Can you please Give me any example how can i use this?
await connector.sendCustomRequest(
method: 'wallet_switchEthereumChain',
params: [
{'chainId': '0x${chainId.toRadixString(16)}'}
],
)
or
await connector.sendCustomRequest(
method: 'wallet_addEthereumChain',
params: [
{
'chainId': '0x${chainId.toRadixString(16)}',
'chainName': "xxx",
'nativeCurrency': {
"name": "xxx",
"symbol": "xxx",
"decimals": xxx
},
'rpcUrls': [url,xxx],
'blockExplorerUrls': [url,xxx]
}
],
)
chain_info: https://chainid.network/chains.json