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

Switched chain is not reflected in the address and balance #7859

Open
mahnunchik opened this issue Mar 12, 2025 · 5 comments
Open

Switched chain is not reflected in the address and balance #7859

mahnunchik opened this issue Mar 12, 2025 · 5 comments

Comments

@mahnunchik
Copy link

If the wallet uses different addresses for different chains, switching the cryptocurrency for exchange does not update the address and balance.

Image

Page reload updates the address and balance to the correct values.

Image

WalletConnect approved session namespace:

{
    "eip155": {
        "chains": [
            "eip155:1",
            "eip155:42161",
            "eip155:56"
        ],
        "methods": [
            "eth_accounts",
            "eth_requestAccounts",
            "eth_sendRawTransaction",
            "eth_sign",
            "eth_signTransaction",
            "eth_signTypedData",
            "eth_signTypedData_v3",
            "eth_signTypedData_v4",
            "eth_sendTransaction",
            "personal_sign",
            "wallet_switchEthereumChain",
            "wallet_addEthereumChain",
            "wallet_getPermissions",
            "wallet_requestPermissions",
            "wallet_registerOnboarding",
            "wallet_watchAsset",
            "wallet_scanQRCode",
            "wallet_sendCalls",
            "wallet_getCapabilities",
            "wallet_getCallsStatus",
            "wallet_showCallsStatus"
        ],
        "events": [
            "chainChanged",
            "accountsChanged",
            "message",
            "disconnect",
            "connect"
        ],
        "accounts": [
            "eip155:1:0xB6bB59b3aC844e8e4A98A281D57E3E0628bcb471",
            "eip155:42161:0xAd8eDE8697aF92AF31Fe66EDAD9A52A74F74464E",
            "eip155:56:0x9B0d038121EB94CeA52FD08B416056B2824524dd"
        ]
    }
}
@plondon
Copy link

plondon commented Mar 13, 2025

Thanks for the report, what wallet was used for wallet connect?

@mahnunchik
Copy link
Author

Wallet https://coin.space/wallet/

@plondon Most likely, all wallets that use different addresses for different chains are affected.

Switching the chain on the wallet side correctly switches the chain on the app side:

await web3wallet.emitSessionEvent({
  topic: session.topic,
  event: {
    name: 'chainChanged',
    data: chain,
  },
  chainId: `${prefix}:${chain}`,
});

await await web3wallet.emitSessionEvent({
  topic: session.topic,
  event: {
    name: 'accountsChanged',
    data: [address],
  },
  chainId: `${prefix}:${chain}`,
});

@ktarun1419
Copy link

hey @plondon can i take this issue?

@mahnunchik
Copy link
Author

@ktarun1419 @plondon for your information, this issue is a bug in the underlying library: WalletConnect/walletconnect-monorepo#5706 and PR WalletConnect/walletconnect-monorepo#5713

The following issue is a bit related #7864

@mahnunchik
Copy link
Author

Similar issue has been fixed in PancakeSwap pancakeswap/pancake-frontend#11325 PR: pancakeswap/pancake-frontend#11338

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

3 participants