RPC URL Error in coinbase wallet app (ios)

Hi. I’m trying to add coinbase wallet connection to out dapp project.
For mobile app, my project’s custom rpc url is not available.
We have own en node, so i want to add custom network by our en node rpc url.
Can i handle it? our rpc url is https://en.kronosdao.finance (KLAYTN network, chain id : 8217)

Hi @keoneokeoneo, welcome to the forum! May I ask if you have already tried the example given in Integrating with Web3Modal (Switch Networks or Add Custom Networks) under the Coinbase Wallet documentation?
Please let us know if this helps, thank you!

3 Likes

Yes. I already tried as noted in docs. It’s working in chrome browser exension.
Here is the image.


But in mobile app, it says invalid url. How can i handle this?

1 Like


This is the result of adding network by manually.


And this is the result of adding network by code (using json rpc method - wallet_addEthereumChain)

Hi @keoneokeoneo! Apologies for the delayed response. Upon checking this issue with our engineering team, this turned out to be a bug where we are apparently requiring that the RPC word is included in the URL for adding a Custom Network on Coinbase Wallet, otherwise we consider it invalid.

So for this URL: https://en.kronosdao.finance,
would need to be like this: https://rpc.en.kronosdao.finance

Rest assured that this issue has already been escalated to our engineering team. Thank you!

3 Likes

Sorry… I forgot to keep watching this post…
I understood the exact problem about my situation.
Still I have 2 questions. I hope you check these questions and reply…

First, you said without “rpc” word it considers wrong. Do you have any plan to fix this bug?

Second question is about web3 tech, so i want you to pass this question.
When I try to add custom network manually with the url (https://en.kronosdao.finance), it din’t work in chrome extension nor ios app. But when i try to add by javascript code, it worked in chrome extension. (Unfortunately it didn’t work in ios app and this is why i posted this question).

Here is the code I used for add custom network.

export const switchNetwork = async (provider: JsonRpcProvider, networkID: Networks) => {
    const walletUserName = localStorage.getItem("-walletlink:https://www.walletlink.org:walletUsername");
    const unsedDefaultChainId = localStorage.getItem("unused:DefaultChainId");
    const cachedProvider = localStorage.getItem("WEB3_CONNECT_CACHED_PROVIDER");

    // coinbase wallet app에선 kronos node 사용 불가능 -> 클레이튼 전환 막기
    if (networkID === Networks.KLAYTN && ((walletUserName && cachedProvider === `"walletlink"`) || (cachedProvider === `"injected"` && unsedDefaultChainId))) {
        window.alert(messages.mobile_coinbase_klaytn);
        return;
    }

    try {
        const requestResult = await provider.send("wallet_switchEthereumChain", [{ chainId: chainData[networkID].chainID }]);
        return requestResult;
    } catch (error: any) {
        // 메타마스크 앱의 경우 error code는 -32603이지만 내부 에러 객체가 또 있음
        const mobileErrorCode = error?.data?.originalError?.code;

        if (error?.code === 4902 || mobileErrorCode === 4902) {
            const network = chainData[networkID];
            await provider.send("wallet_addEthereumChain", [
                {
                    chainId: network.chainID,
                    chainName: network.chainName,
                    nativeCurrency: network.nativeCurrency,
                    rpcUrls: network.rpcUrls,
                    blockExplorerUrls: network.blockExplorerUrls,
                },
            ]);

            try {
                const requestResult = await provider.send("wallet_switchEthereumChain", [{ chainId: chainData[networkID].chainID }]);
                return requestResult;
            } catch (error: any) {
                console.warn("Error switching to network", error);
            }
        }
    }
};

Can you explain me why that code is working in chrome extension but not in ios app?
We looked forward to support coinbase wallet connection to our service, but we can’t serve because of this issue… I hope that we can use your service as soon as possible. Thank you!

Hello @keoneokeoneo, thank you for following up and providing additional details. The issue you’ve reported has already been escalated to our engineering team. They will be investigating and working towards a fix for this. We will also be including the information and the code snippet you’ve provided so they can look into this further. We will update this thread as soon as we have heard back from the engineering team. Keep in touch!

1 Like