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

How to access connectResponse in the latest release 3.1.0? #91

Closed DhavalRKansara closed 3 months ago

DhavalRKansara commented 3 months ago

Hi Team,

I have upgraded the package to the latest release 3.1.0 where I found we removed the public parameter connectResponse and we have done other changes as well...

I found we do assign the value to connectResponse in the buildConnectionUri and then we are calling _awaitConnectionCallback method but over here we are not storing the 'await connectResponse.session.futureanywhere which is needed to me. If we done changes related to to_currentSessionthen we should assign the value to it in the_awaitConnectionCallback`.

I am stuck here in the production release please let me know the solution for the same using which I can fix the issues.

quetool commented 3 months ago

Hello @DhavalRKansara, I don't understand your issue, could you elaborate a bit more, maybe with some reproducible code? I understand that you were using the connectResponse parameter which is not available anymore but that parameter has no point to be public. What do you need to do exactly?

DhavalRKansara commented 3 months ago

Hi @quetool I do use the connectResponse parameter earlier as show below in code sample. Could you please guide me how I can replace it with latest changes?

 SessionData?  session =
    await (await service).connectResponse?.session.future.timeout(
             _mediumRequestWaitingTime,
             onTimeout: () => throw TimeoutException('Timed out'),
      ); 
quetool commented 3 months ago

I would first need to know what are you using that method for, it's wasn't supposed to be used from outside that is why it got removed. The only thing that method was used for is to wait for the wallet to respond to the connection request. Can I know what are you using for and which version were you using before?

DhavalRKansara commented 3 months ago

Hi @quetool I need a SessionData which we go in the response of _web3App!.connect sharing the ss of code below from version 3.0.1.

As per the latest update, the connectResponse is not available to access directly How can I get the session data, which stores the result of _web3App!.connect?

Screenshot 2024-02-02 at 8 03 15 PM
quetool commented 3 months ago

Oh I get it now. Simply, you just use w3mService.session?.sessionData

DhavalRKansara commented 3 months ago

Oh I get it now. Simply, you just use w3mService.session?.sessionData

Yes, But where are you setting the response of _web3App!.connect to session.sessionData?

quetool commented 3 months ago

You can also subscribe to w3mService.onSessionConnectEvent like this:

_w3mService.onSessionConnectEvent.subscribe(_onSessionConnect);

void _onSessionConnect(SessionConnect? args) {
  // args?.session is what you are looking for
}

This will be triggered once you approve the connection on your wallet.

quetool commented 3 months ago

Have you checked the example app in the repo?

DhavalRKansara commented 3 months ago

Oh I get it now. Simply, you just use w3mService.session?.sessionData

Does this will return the same object which we do get from connectResponse?.session?

quetool commented 3 months ago

Yes!

crypblizz8 commented 3 months ago

Need any more help @DhavalRKansara ?

quetool commented 3 months ago

Closing for now. Feel free to re-open if needed!