Skip to main content

Wallet

The Wallet module provides a way to get the amount of gems the user has, as well has consuming an amount of gems from the user's wallet.

Setup

To use the Wallet module, initialize the SDK and access the wallet component:

import * as ArkadiumSdk from '@arkadiuminc/sdk';

const sdk = await ArkadiumSdk.getInstance();

sdk.wallet;
info

An error will be thrown if these APIs are used in the context of a non-authenticated user. You can use the Auth module to check if the user is properly authenticated before using the Wallet APIs.

Get Gems

const gemsAmount = await sdk.wallet.getGems();

Consume Gems

const result = await inst.wallet.consumeGems(1); // consumes 1 gem from the user wallet
if(result) {
console.log('gems consumed successfully')
}