GemWallet / gemwallet-extension

GemWallet is a cutting-edge crypto wallet and Web3 layer for the XRP Ledger. Our browser extension enables you to interact with the XRP Ledger directly from your browser (Metamask for the XRPL). - https://gemwallet.app

Home Page:https://gemwallet.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

async event callback

rikublock opened this issue · comments

commented

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