async event callback
rikublock opened this issue · comments
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.
Hi @rikublock ,
We are gonna have a look at it, thank you so much