-
Notifications
You must be signed in to change notification settings - Fork 736
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
Unable to Choose Chain on Trust Wallet - Standalone #1871
Comments
hey @glitch-txs, I'm seeing you have configured chains If you'd like to listen for a chain switch on the dapp side, you should subscribe to
|
Thanks for your comment, unfortunately I'm not hable to choose/switch chain using Trust Wallet and it picks up the first chain I configured. I'm also not able to choose the chain Id in ethers js as it depends on the wallets currently chain connection. So basically my issue is, I'm not able to choose chain we I'm connected to Trust Wallet. |
I just tested with Trust Wallet, using our example dapp at https://react-app.walletconnect.com/ and I'm able to connect and use/sign transactions with multiple chains without having to switch. I'm not able to find/see the |
The arrow appears on v1 that it allows to switch, not on v2. Right, the thing is, when I send a transaction to the wallet it will pick up the first chain, but if I want to sign that tx using other chain I'm not able to switch |
Could you test with our example dapp if that's the case too? As I'm able to sign transactions with any of the chains connected |
I see you can choose the chain from the dapp on the example you mentioned, I assume this is using the request function from SignClient where you can set the chain Id. But this is not possible on ethers js at least not that I'm aware of When you instantiate a Contract you add the abi, the contract address and the signer. The chain Id is implicit in the signer. |
Seeing the examples above, while in |
Yes, but I don't want to use the signClient to make the request, I'm instead using ethers.js which doesn't allows you to choose chain Id when creating a request. If I use the signClient then I need to do some hex conversions which ethers.js simplifies. |
This is how I can call a contract with ethers (here I'm calling the read-only function "name" of an ERC20), as you can see there's no parameter for chain Id. const erc20Contract = new ethers.Contract(contractAddress, ERC20Abi, signer)
const name = await erc20Contract.name() |
Unfortunately, that is a shortcoming of |
It seems so, they are landing v6 soon, I'll check on that or request this feature. Thanks for your time, I'll try a work around with that function 🙂 |
I'm not able to choose a specific chain in Trust wallet.
I'm using the standalone version with the universal-provider and ethers.js
My code:
This is what I get when I connect with Trust Wallet:
![1673887075875](https://user-images.githubusercontent.com/66949816/212729527-cd07ffb6-51e7-4fca-aa04-616b7e62b536.jpg)
So I'm not able to choose the chain I want to connect like this where as you can see there's an arrow that allows me to select different chains:
My question:
Does this mean that I'm connecting myself to both chains at the same time? If so is the case, how do I handle this on the dapp with universal-provider?
How do I select the chain that will be used to trigger the smart contract function request to the user's wallet?
And what if I want the user to choose the chain before connecting?
The text was updated successfully, but these errors were encountered: