WalletConnect / Web3ModalFlutter

The Web3Modal for WalletConnect built using Flutter.
https://pub.dev/packages/web3modal_flutter
Apache License 2.0
27 stars 30 forks source link

Wallet connect popup and redirecting back to app. #105

Closed chetu-ko closed 1 month ago

chetu-ko commented 1 month ago

Hi,

There are three minor issues that I have faced with SDK,

  1. Not getting the connect wallet popup in the wallet application when the user tries to connect for the first time and needs to go back and press on try again, this happens whenever the user starts connecting for the first time.
  2. The next issue is sometimes not redirecting back to the app even if the wallet is connected to the wallet successfully, if we force back the wallet app the wallet is not connected.
  3. Lastly, even when the wallet is successfully connected and redirected to the app bottom sheet window is still not closed automatically,

Behaviour for 2nd and 3rd issue.

Screenshot 2024-03-26 at 12 08 40 PM

The above issue only happens for the first time when the user opens the app and tries to connect the app to the wallet. This not exactly cause the issue making the user confused with the process.

Logs when the above 1. issue happens.

Pairing _onMessageEvent, Received data: {id: 1711433061125029, jsonrpc: 2.0, method: wc_pairingDelete, params: {message: User disconnected., code: 6000}}

Logs when the above 3. issue happens.

I/flutter ( 9438): [W3MService] _onRelayClientConnect: null

Usage code: W3MNetworkSelectButton( service: controller.w3mService!, )

I am using the latest sdk of 13.1.2,

quetool commented 1 month ago

Hello @chetu-ko, is this happening with every wallet? (Like Rainbow, Trust, Zerion, etc...)

Also, you say

I am using the latest sdk of 13.1.2

I suppose you are referring to MetasMask app version, right? Because we don't have such version for Web3Modal SDK

chetu-ko commented 1 month ago

Thanks for your reply @quetool, sorry it's my bad.

version is 3.1.2,

Yes, I only tried this with the metamask wallet app. Is there any issue with metamask.

quetool commented 1 month ago

Could you please try the same with other wallets?

chetu-ko commented 1 month ago

Yes, tried with trust after you saying, got the same error, you can see in the below attached image, I have connected with trust wallet and it's connected successfully, but pop up is still loading, waited for 5min.

Screenshot 2024-03-26 at 4 00 38 PM
chetu-ko commented 1 month ago

Hi @quetool any update on this?

quetool commented 1 month ago

Hello @chetu-ko ! Can you provide a reproducible code? Everything is working well on my side.

chetu-ko commented 1 month ago
 w3mService = W3MService(
      projectId: projectID
      metadata: PairingMetadata(
        name: AppName,
        description: AppDescription,
        url: AppURl
        icons: [AppIcon],
        redirect: const Redirect(
          native: 'flutterdapp://', // your own custom scheme
          universal: 'https://www.walletconnect.com',
        ),
      ),
    );

await w3mService!.init().then((value) {
      initdone.value = true;
      walletConnectionListner();
    });

///This I am using in the UI top show the button
 W3MNetworkSelectButton(
     service: controller.w3mService!,
  )

 walletConnectionListner() async {
    w3mService!.onModalConnect.subscribe((args) async {}

 w3mService!.onModalDisconnect.subscribe((args) async {}
}

@quetool I am just using the above code to get wallet connection data not more than that, and I am making the necessary changes in the listener.

chetu-ko commented 1 month ago

In the issues list 3rd one is fixed by adding a few lines of code below, I have added force close for bottom sheet model.

w3mService!.onModalConnect.subscribe((args) async {
   if (w3mService!.isOpen) {
       w3mService!.closeModal();
    }
}

And issue 2nd in the list getting below line error in the log

I/flutter ( 7161): [W3MService] _onRelayClientConnect: null I/flutter ( 7161): Handling relay close, code: 4010, reason: Disconnecting for load balancing reasons

quetool commented 1 month ago

Hello @chetu-ko, without a complete reproducible code I can not help. A reproducible code doesn't have to be your very own code, you can write a new minimal reproducible code where I can reproduce the wrong behavior. For instance, if you clone this repo and run the example app, does it reproduces the issue?

quetool commented 1 month ago

Hello @chetu-ko, I'll close this for now, please feel free to reopen if needed.