Comments (6)
Hi @siosio34 .
As we've said before in those other issues, MetaMask only supports a subset of the WalletConnect protocol.
In fact, there are two parts for it.
The first is that wallet_switchEthereumChain
will work the first time the user tries to change chain programatically but in all subsequent requests the wallet gets no request whatsoever. Without a request there is no possibility of acting upon.
Here's an example:
ethersProvider.provider.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0xa4b1' }]
})
Here's the video:
chainRequest.mov
Details about the video:
- Wallet logs on the left, dapp in the middle and screen recording of the wallet on the right
- At 0:16, right after connecting you can see me tap the "Switch chain" button and that prompts a chain request on the wallet
- This first chain change request was manually denied on the wallet
- At 0:26 you can see my prompting the second chain switch (keep in mind that the first request was denied so there hasn't been an approved chain switch request yet)
- At 0:40 I manually switch chains on the wallet side and that gets synced on the dapp side
- At 0:52 you can see that no matter how many times I try to prompt a chain switch there are no logs coming in, meaning that there is no request being sent to the wallet.
The second part to it is that if the dapp is on a different chain that the wallet has active and the user tries to sign he should get a request asking to switch to the Chain on the dapp side:
askbefore.mov
I hope to have clarified this issue.
from metamask-mobile.
The first thing you said is that you think this issue is caused by WalletConnect not sending any requests to the Metamask wallet?
If no logs are received, I think the opinion is valid and I think I will have to ask WalletConnect about the issue again.
from metamask-mobile.
Hey @siosio34 @christopherferreira9, chiming in from WalletConnect team.
I think there is misunderstanding in the expectations how chain switching should work and how its actually working.
In WalletConnect v2, chain switching is done locally on the dapp side on all chains that were approved in the session.
This means that users can switch between all approved chains without being required to approve the switch in their wallets.
If user tries to switch to chain that is not yet approved, the switch chain is sent to the wallet for approval. This allows the wallet to switch to that chain but also update the current session with appropriate address for that new chain.
This behaviour is consistent with @christopherferreira9 explanation above where only the first chain switch is sent to the wallet and all after are done locally without any request to the wallet.The chains were already approved for the session after all.
I hope this clarifies how chain switching works and why sometimes you're not receiving any prompt in the wallet
from metamask-mobile.
@ganchoradkov
I understand what you are saying. However, although it also depends on the issue link in the text, the two issues below do not seem to be a normal flow for the average user. If this was intentional, please let me know.
first Unlike desktops, chain change requests do not work smoothly on mobile devices.
second If it is connected to a chain different from Ethereum, the chain is unnecessarily switched to the Ethereum chain when calling the sign function.
from metamask-mobile.
In WalletConnect v2, chain switching is done locally on the dapp side on all chains that were approved in the session.
This means that users can switch between all approved chains without being required to approve the switch in their wallets.
I'm currently struggling with this, in combination with the limitation of metamask only supporting 1 network for the requiredNamespace. WalletConnect/WalletConnectKotlinV2#1325
If we can only request 1 network, the user can never switch between all approved chains, because they can only request 1.
from metamask-mobile.
Hi all. I'm closing this issue but I'll be sure to reference it if we ever change this behaviour when interacting with WalletConnect.
from metamask-mobile.
Related Issues (20)
- [BUG] Differences from Searches between extension and mobile
- Slight inconvenience with the WalletConnect sendTransaction process. HOT 2
- [Sentry] Error: {"code":-32602,"message":"Invalid parameters: must provide an Ethereum address."}
- [Bug]: Characters cannot be displayed correctly on some web pages HOT 5
- [Sentry] Error: Must specify a valid combination of id, origin, and type.
- [Sentry] Error: Trouble initializing Branch. Branch API Error: poor network connectivity. Please try again later. HOT 1
- [Sentry] Error: [ethjs-rpc] rpc error with payload {"id":2109144632762,"jsonrpc":"2.0","params":[{"to":"**","data... HOT 4
- [Bug]: Transaction activity hangs indefinitely if Swap is initiated right before estimated gas fee starts flashing
- [Sentry] Error: {"code":-32603,"message":"Non-200 status code: '413'","data":{"jsonrpc":"2.0","id":592290256,"err...
- [Sentry] Error: {"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":-32000,"message":"err: insuffi... HOT 1
- Abstract WC/SDK logic outside of BackgroundBridge and RPCMethodMiddleware
- [Bug]: NFTs displayed during the Send flow does not align with the NFT assets visible in the account's NFT tab
- [Bug]: The 'Transaction details' screen closes on its own, sometimes not providing users with sufficient time to interact with it.
- [Bug]: After attempting to send a transaction with a low nonce, any subsequent transactions with the correct nonce or a higher nonce result in an error message stating 'Approval request with id ****** not found'
- [Sentry] Error: Level: Error HD keyring missing while saving keyrings HOT 2
- [Sentry] Error: JsonRpcEngine: Response has no error or result for request: HOT 1
- [Sentry] TypeError: undefined is not an object (evaluating 'e.toUpperCase')
- [Bug]: Signed Swaps Transactions in Transactions History
- Upgrade design tokens to version 3.0
- [Bug]: Root error selectSelectedInternalAccount being displayed after recovering from SRP HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metamask-mobile.