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

Resolve promise when qr modal is closed #1957

Closed
GabrielBuragev opened this issue Feb 9, 2023 · 1 comment · Fixed by #2020
Closed

Resolve promise when qr modal is closed #1957

GabrielBuragev opened this issue Feb 9, 2023 · 1 comment · Fixed by #2020
Labels
type: bug Something isn't working

Comments

@GabrielBuragev
Copy link

Describe the bug

Using package @walletconnect/ethereum-provider": "^2.3.2

I do this...

const provider = await WalletConnectV2.init({
        chains,
        projectId: '<project_id>',
        rpcMap,
      });
const result = await provider.enable();

// If the user closes the modal, the code below is never reached
// ...

return result

Calling enable() triggers the modal. But if the user closes the modal without scanning the qr code, this promise never resolves.

It would be very helpful to either have a rejection of the promise to indicate that the modal was closed, or resolve with a boolean indicating the state of the action.

SDK Version (if relevant)

  • Package: @walletconnect/ethereum-provider
  • Version 2.3.2

To Reproduce
https://codesandbox.io/s/crazy-hypatia-9p1g28?file=/src/App.vue

Steps to reproduce the behavior:

  1. Click on connect
  2. connecting flag should be set to true
  3. Wait a couple of seconds until the QR code modal pops up
  4. close it
  5. connecting flag is not set to false

Expected behavior
On modal close, the call to provider.enable() should either resolve with a falsy value or throw an error.

@GabrielBuragev GabrielBuragev added the type: bug Something isn't working label Feb 9, 2023
@ganchoradkov ganchoradkov linked a pull request Feb 20, 2023 that will close this issue
4 tasks
@GabrielBuragev
Copy link
Author

Thanks for fixing this @ganchoradkov !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant