web-examples
web-examples copied to clipboard
[react-dapp-v2] Require unused namespaces while sending session proposal.
Describe the bug
Wallet got error chains don't satisfy required namespaces. while approving session proposal under certain circumstances.
SDK Version
- sign-client 2.4.9 for wallet.
To Reproduce Steps to reproduce the behavior:
- Connected to DApp demo https://react-app.walletconnect.com/ with namespaces below:
{
eip155: {
accounts: ["eip155:5:0x17527f938E471C987bBA3Cc9D8a6218045E52790"],
chains: ["eip155:5"],
events: ["chainChanged", "accountsChanged"],
methods: ["eth_sendTransaction", "eth_signTransaction", "eth_sign", "personal_sign", "eth_signTypedData"],
},
}
- Disconnect the session and reconnect with Polkadot mainnet from the DApp demo. And it send a session proposal with requiredNamespaces like this:
{
"eip155": {
"methods": ["eth_sendTransaction", "eth_signTransaction", "eth_sign", "personal_sign", "eth_signTypedData"],
"chains": ["eip155:5"],
"events": ["chainChanged", "accountsChanged"]
},
"polkadot": {
"methods": ["polkadot_signTransaction", "polkadot_signMessage"],
"chains": ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
"events": []
}
}
- User is using Polkadot account and just
DELETED the eip155 accountin the wallet, so the wallet can only send approve response with namespaces like:
{
"eip155": {
"accounts": [],
"methods": ["eth_sendTransaction", "eth_signTransaction", "eth_sign", "personal_sign", "eth_signTypedData"],
"chains": ["eip155:5"],
"events": ["chainChanged", "accountsChanged"]
},
"polkadot": {
"accounts": ["polkadot:91b171bb158e2d3848fa23a9f1c25182:72oqryr2N4GQS1L3LCWFZCXhjMx2SE1L18k5kaVq3hvS6jf"],
"methods": ["polkadot_signTransaction", "polkadot_signMessage"],
"chains": ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
"events": []
}
}
// or
{
"polkadot": {
"accounts": ["polkadot:91b171bb158e2d3848fa23a9f1c25182:72oqryr2N4GQS1L3LCWFZCXhjMx2SE1L18k5kaVq3hvS6jf"],
"methods": ["polkadot_signTransaction", "polkadot_signMessage"],
"chains": ["polkadot:91b171bb158e2d3848fa23a9f1c25182"],
"events": []
}
}
- See the
chains don't satisfy required namespaces.error.
Suggestion In this case, the wallet has No EIP155 accounts available, but the DApp demo send session proposal with unnecessary requiredNamespaces. Maybe the DApp should not use the namespaces of history sessions for existing pairings.