Closed CharikovAI closed 3 years ago
Please use Ethereum.walletSwitchChain
to use Metamask's wallet_switchEthereumChain
request.
Or if you want to use primitive request, Dart map object do not automatically translate to JS object. Wrap them with jsify
first.
For example,
await ethereum!.request(
'wallet_switchEthereumChain',
[
jsify({"chainId": '0x38'}) // 56 in decimal, Binance smart chain.
],
);
I'd like to call rpc methods with object parameters but always get an error that object fields are undefined. I'm playing with
wallet_switchEthereumChain
metamask method ( https://docs.metamask.io/guide/rpc-api.html#usage-with-wallet-switchethereumchain )I tried:
Still none is working. Can you explain how to do it?