Skip to content
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

Web3Wallet onAuthRequest subscribe callback does not fire #190

Open
DarksightKellar opened this issue Sep 21, 2023 · 3 comments
Open

Web3Wallet onAuthRequest subscribe callback does not fire #190

DarksightKellar opened this issue Sep 21, 2023 · 3 comments

Comments

@DarksightKellar
Copy link

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
Copy link
Collaborator

quetool commented Sep 28, 2023

Hello @DarksightKellar! Apologize for the late response!
Looks like you are having the same issue as this one here, do you mind checking it? #192 (comment)

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
Copy link
Author

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
Copy link
Collaborator

quetool commented Sep 29, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants