WalletConnect / WalletConnectFlutterV2

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

Web3Wallet `onAuthRequest` subscribe callback does not fire #190

Open DarksightKellar opened 12 months ago

DarksightKellar commented 12 months ago

I have an instance of Web3Wallet created and I can connect to a dApp by listening to wcClient.onSessionProposal.subscribe.

I have also configured walletNamespaces with methods: ['eth_signTransaction', 'eth_sendTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4' ].

I have also setup wcClient.registerRequestHandler for each of those methods.

Next, I am pairing with the dApp using await wcClient.core.pairing.pair(uri: uri, activatePairing: true);.

Finally,

wcClient.onAuthRequest.subscribe((args) async {
    // code here never runs when initiating a sign request from the dApp
});

Additional context: The callbacks registered under registerRequestHandler do fire, but on their own, they cannot seem to authorise sign requests. I get an error saying that there are no pending requests. This is the function I attempt to use to respond to such requests:

await wcClient.respondAuthRequest(
          id: sessionId,
          iss: 'did:pkh:eip155:${chainId}:${address}',
          signature: CacaoSignature(t: CacaoSignature.EIP191, s: signedDataHex),
);
quetool commented 11 months ago

Hello @DarksightKellar! Apologize for the late response! Looks like you are having the same issue as this one here, do you mind checking it? https://github.com/WalletConnect/WalletConnectFlutterV2/issues/192#issuecomment-1738803095

TL;DR: onAuthRequest is not called during a sign/send transaction request and that's ok, onAuthRequest is called when creating a authentication request between dApp and wallet.

DarksightKellar commented 11 months ago

That's right, yes. That's the original issue I faced, which led me to dig deeper into the codebase, from where I tried to emulate usage of onAuthRequest. I was under the impression from the docs that onSessionProposal is where the connection is established, with wcClient.approveSession to be called in its callback.

I suppose there's still quite a bit lacking WRT to the presentation of the docs, outside whatever bug this issue is, but thanks for getting back to me.

Fingers crossed for a fix (+clarification on setup) soon.

Cheers!

quetool commented 11 months ago

I totally understand! We are doing our best to get everything in sync as faster as possible! Let me know if you solve your concern!