Commit fae30fca authored by tom goriunov's avatar tom goriunov Committed by GitHub

Merge pull request #1138 from jasonzysun/main

fix error in args of wallet_addEthereumChain request
parents e9a45f37 3eca473f
...@@ -27,9 +27,7 @@ export default function useAddOrSwitchChain() { ...@@ -27,9 +27,7 @@ export default function useAddOrSwitchChain() {
// This error code indicates that the chain has not been added to Wallet. // This error code indicates that the chain has not been added to Wallet.
if (code === 4902) { if (code === 4902) {
const params = { const params = [ {
method: 'wallet_addEthereumChain',
params: [ {
chainId: hexadecimalChainId, chainId: hexadecimalChainId,
chainName: config.chain.name, chainName: config.chain.name,
nativeCurrency: { nativeCurrency: {
...@@ -39,14 +37,13 @@ export default function useAddOrSwitchChain() { ...@@ -39,14 +37,13 @@ export default function useAddOrSwitchChain() {
}, },
rpcUrls: [ config.chain.rpcUrl ], rpcUrls: [ config.chain.rpcUrl ],
blockExplorerUrls: [ config.app.baseUrl ], blockExplorerUrls: [ config.app.baseUrl ],
} ], } ] as never;
// in wagmi types for wallet_addEthereumChain method is not provided // in wagmi types for wallet_addEthereumChain method is not provided
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any;
return await provider.request({ return await provider.request({
method: 'wallet_addEthereumChain', method: 'wallet_addEthereumChain',
params, params: params,
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment