walletconnect-monorepo
walletconnect-monorepo copied to clipboard
[Spec] No documented way to get the address of a non-active chain
Is your feature request related to a problem? Please describe.
There is no documented way in WalletConnect providers to obtain the address of a non-active chain. As a result, swap services assume that the second chain uses the same address as the currently active one...
This issue affects wallets that use different addresses for different chains.
Example of a confirmed WalletConnect session namespaces:
{
"eip155": {
"chains": [
"eip155:1",
"eip155:42161",
"eip155:56"
],
"methods": [
...
],
"events": [
...
],
"accounts": [
"eip155:1:0xB6bB59b3aC844e8e4A98A281D57E3E0628bcb471",
"eip155:42161:0xAd8eDE8697aF92AF31Fe66EDAD9A52A74F74464E",
"eip155:56:0x9B0d038121EB94CeA52FD08B416056B2824524dd"
]
}
}
As you can see, different chains use different addresses.
Describe the solution you'd like
Document for dApp developers how to get the address of a second (currently inactive) chain.
Additional context
- It all started when I noticed that WalletConnect doesn't switch addresses when switching chains https://github.com/WalletConnect/walletconnect-monorepo/issues/5706
- This is how the issue appears in the dApp https://github.com/Uniswap/interface/issues/7864
The issue affects all dApps that use any of the WalletConnect providers.
hey @mahnunchik, recommended way is to actually parse and check the current session data https://docs.reown.com/advanced/providers/ethereum#session-data it contains all details about chains/accounts/methods etc that can be used in the current session In the providers we've tried to abstract manual work/parsing as much as possible but still session data is main source of truth and is available for devs to access and parse
Hi @ganchoradkov, I'm a wallet developer, so I don't have control over how these dApps use the session data.
I can open an issue with each of the popular exchange services that support cross-chain swaps. But the problem is, I can't tell them how they should work with the session data — there is nothing about that in the documentation or specification. Should I include a link to your comment?
As you can see, everything on the wallet side is done according to the spec: an array of accounts with different addresses is being passed.