Base SDK class

This function is meant to be intiialized with the init() method. Then the instance can be used to create wallets, send transactions, etc.

const crossmint = CrossmintAASDK.init({
projectId: xxxx,
clientSecret: xxx,
});

const wallet = await crossmint.getOrCreateWallet({...}, {...});

Hierarchy

  • CrossmintAASDK

Methods

  • Retrieves a wallet for the user. If the wallet does not exist, it will be created.

    Notes:

    1. The user identifier is used to ensure the same wallet can be retrieved across devices.
    2. To interact with different chains, obtain a wallet instance for each chain by invoking this class multiple times.

    Sample code if using the default Fireblocks NCW signer:


    const wallet = await crossmint.getOrCreateWallet({
    email: " ",
    }, {
    chain: "ethereum",
    signer: {
    type: "FIREBLOCKS_NCW",
    passphrase: "xxxx",
    },
    }).catch((e) => {
    if (e instanceof PassphraseRequiredError) {
    // Ask user for passphrase and call again
    return;
    }

    console.error("Failed to get or create wallet", e);
    });

    @param user Identifier for the user whose wallet to retrieve
    @param chain The blockchain for which to retrieve the wallet. A wallet instance can on one chain only, but you can retrieve multiple wallet instances for different chains.
    @param walletConfig Configuration related to wallet initialization.
    @returns A Wallet instance corresponding to the given user and chain.
    @throws PassphraseRequiredError if a passphrase is needed to create a wallet, or to recover it

    Type Parameters

    Parameters

    Returns Promise<ChainMap[B]["Wallet"]>

  • Clears all key material and state from device storage, related to all wallets stored. Call this method when the user signs out of your app, if you don't have a user identifier.

    Returns Promise<void>

  • Clears all key material and state from device storage, related to the user's wallet. Call this method when the user signs out of your app.

    Parameters

    • user: UserIdentifier

      The user for which to clear the wallet data

    Returns Promise<void>

  • Initializes the SDK with the project ID and API key obtained from the Crossmint console.

    Parameters

    Returns CrossmintAASDK

    Throws

    error if the project ID or API key are not properly formatted

Generated using TypeDoc