Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing or invalid. request() method: wallet_addEthereumChain #4960

Closed
dingcxx opened this issue Jul 24, 2023 · 1 comment
Closed

Missing or invalid. request() method: wallet_addEthereumChain #4960

dingcxx opened this issue Jul 24, 2023 · 1 comment

Comments

@dingcxx
Copy link

dingcxx commented Jul 24, 2023

I use modal-react-native in my app

this is my sessionParams :

export const MethodName = {
    addNet: 'wallet_addEthereumChain',
    switchNet: 'wallet_switchEthereumChain',
    sign: 'eth_sign',
    getChain: 'eth_chainId',
    sendTransaction: 'eth_sendTransaction',
    // signTransaction: 'eth_signTransaction',
    // signTypedData: 'eth_signTypedData',
    personalSign: 'personal_sign',
}

export const SUPPORT_NETs = [BSC, ETH, Goerli, TESTNET_BSC, zkSync_testnet, zkSync_mainnet]

    const OPTION_CHAINS = SUPPORT_NETs.filter((value) => value.networkId !== 1).map(
        (value) => `eip155:${value.networkId}`,
    )

    const OPTION_METHODS = [...Object.values(MethodName)]
    const REQUIRED_METHODS = ['eth_sendTransaction', 'personal_sign']
    const REQUIRED_EVENTS = ['chainChanged', 'accountsChanged']
    const sessionParams = {
        namespaces: {
            eip155: {
                methods: REQUIRED_METHODS,
                chains: ['eip155:1'],
                events: REQUIRED_EVENTS,
                rpcMap:{},
            },
        },
        optionalNamespaces: {
            eip155: {
                methods: OPTION_METHODS,
                chains: OPTION_CHAINS,
                events: REQUIRED_EVENTS,
                rpcMap: PRC_LISTs,
            },
        },
    }

rainbow wallet connected success

but when I request wallet_addEthereumChain receive error:

 {"context": "client"} Missing or invalid. request() method: wallet_addEthereumChain.

the session.namespaces maybe not include wallet_addEthereumChain , optionalNamespaces not useful.

Originally posted by @dingcxx in #4924 (comment)

@skylarbarrera
Copy link
Contributor

hey @dingcxx

rainbow does not support adding custom networks & rpcs, which is the issue here. wallet_switchEthereumChain should have what you need

that being said we are updating our WC integration to better handle this case. should be live end of next week

thanks,

🌈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants