Skip to content

async event callback  #258

@rikublock

Description

@rikublock

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions