WalletConnect / WalletConnectFlutterV2

WalletConnect v2 client made in Dart for Flutter.
https://pub.dev/packages/walletconnect_flutter_v2
Apache License 2.0
101 stars 52 forks source link

In the wallet side, is it possible to specify the chain that will be chosen on Dapp side? #250

Closed SametSahin10 closed 4 months ago

SametSahin10 commented 5 months ago

I've integrated this package into my Flutter app and it's working well. However, I just have a question about specifying the chain to use. In our mobile app, we connect to a Dapp that supports three chains: Fuse, Ethereum, Binance. When the wallet is connected to the Dapp via WalletConnect, Ethereum is chosen by default. Is there a way to specify which chain to choose after connecting?

quetool commented 5 months ago

Hello! I don't quite understand, are you developing a Wallet or a dApp? A bit more of clarification would be helpful.

In any case, the way a dApp "specifies the network" is by calling wallet_switchEthereumChain (or wallet_addEthereumChain if the current connected wallet has not approved the network). This request will make the wallet to change the "current working network"

Mash-Woo commented 5 months ago

Could you teach me how to make transactions with a Metamask in Flutter? I need help when I try to interact with the smart contract between Metamask and my app. I am using the package 'web3modal_flutter/web3modal_flutter.dart'. After approving my app, how can I interact with user's metamask, for ex: I want the user click on my send button, and they can send 0.001 eth to the address that they chose

My code:

final w3mService = W3MService( projectId: '123', metadata: const PairingMetadata( name: 'New App', description: 'WalletConnect', url: 'https://www.walletconnect.com/', icons: [ 'https://avatars.githubusercontent.com/u/37784886' ], redirect: Redirect( native: 'flutterdapp://', universal: 'https://www.walletconnect.com', ), ), );

await w3mService.init();

await w3mService .openModal(context);

quetool commented 5 months ago

Please @Mash-Woo open a discussion or refer to docs. Also you are commenting in the wrong repo.

SametSahin10 commented 5 months ago

I'm working on a wallet app @quetool but the Dapp is also our product. So, we're able to make changes on both sides. What we need is to choose Fuse network on Dapp when the wallet is connected via WC. Which side should take care of this? Dapp or Wallet?

quetool commented 5 months ago

When the wallet is connected to the Dapp via WalletConnect, Ethereum is chosen by default. Is there a way to specify which chain to choose after connecting?

Hello @SametSahin10, sorry for the delay. After connection you can call wallet_switchEthereumChain from your dApp so your Wallet can change to your desired chain, right? Maybe I misunderstood your issue?

quetool commented 5 months ago

You can follow this thread to get more context, maybe it helps, otherwise let me know https://github.com/WalletConnect/WalletConnectFlutterV2/issues/235#issuecomment-1882873694

quetool commented 4 months ago

I'll close this for now, please refer to this comment for clarity https://github.com/WalletConnect/WalletConnectFlutterV2/issues/235#issuecomment-1882873694 and feel free to re-open if needed!