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

async event callback #258

Open
rikublock opened this issue Aug 29, 2023 · 1 comment
Open

async event callback #258

rikublock opened this issue Aug 29, 2023 · 1 comment

Comments

@rikublock
Copy link

rikublock commented Aug 29, 2023

Was playing around with the recently added events (version: ^3.4.0). Ran into some troubles trying to do the following (the user has previously accepted to share both address and pubkey with the app):

import * as Gem from "@gemwallet/api";

Gem.on("walletChanged", async (event) => {
      await Gem.isInstalled();
      await Gem.getAddress();
      await Gem.getNetwork();
      await Gem.getPublicKey(); // <- fails with { "type": "reject", result: undefined }
});

Seems to work when doing the same series of calls outside of an event handler. Not sure whether this is related to the async callback or the getPublicKey function. Feels like something is racing somewhere.

Are async callback functions even supported currently? (If not, they probably should be)

In case you need more details, let me know.

@FlorianBouron
Copy link
Collaborator

Hi @rikublock ,
We are gonna have a look at it, thank you so much

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