Skip to content

Tokens ​

Methods for creating and managing tokens.

Quick Reference ​

MethodDescription
createTokenCreate a new Token in the system which can then be transferred between wallets
findTokensSearch for Tokens using either a simple filter or queryBuilder
getTokenGet information about token
updateTokenUpdate a Token

createToken ​

Create a new Token in the system which can then be transferred between wallets

ts
await client.createToken(
  {
    foreign: 'EURO',
    divisor: 10,
    limit: 10,
    public: true,
    metadata: {
      customMetadata: true,
    },
    // belongs_to: 'EURO-wallet'
  },
  {
    // GENERALOPTIONS
  },
);
ts
{
  wallet: {
    id: 5,
    foreign: 'EURO',
    name: 'EURO',
    metadata: null,
    type: 'token',
    default_allow_negative: true,
    default_allow_positive: false,
    created_at: '2026-01-01T10:00:00.000Z',
    updated_at: '2026-01-01T10:00:00.000Z',
    status: 'active',
    default_dtw_to: '000',
    default_dtw_from: '000'
  },
  token: {
    id: 5,
    foreign: 'EURO',
    public: true,
    belongs_to: 5,
    created_at: '2026-01-01T10:00:00.000Z',
    updated_at: '2026-01-01T10:00:00.000Z',
    metadata: {
      customMetadata: true
    },
    divisor: 10,
    limit: 10,
    type: 'value',
    status: 'active'
  }
};

createTokenFnInput ​

Input for createToken

AttributeTypeRequiredDescription
foreignstring✓Name of the token, used for name based token transfers. Must be unique
publicbooleanBoolean indicating if token can be traded with outside seed wallet
metadata Metadata ▶Key/value object describing the token
divisornumberMinimum amount of token that can be transferred
limitnumberMaximum amount of token that can be issued
belongs_tostring | numberId of the wallet this token belongs_to
▶options{}Optional flags for input

createTokenFnOutput ​

Output of createToken

AttributeTypeAlwaysDescription
▶token{}✓Units of value which can be transferred in this system
▶wallet{}✓Wallet|Entities who can make transfers in this system

findTokens ​

Search for Tokens using either a simple filter or queryBuilder

ts
await client
  .findTokens()
  .where({
    metadata: {
      even: true,
      example: 'test',
    },
  })
  .orWhere({
    foreign: 'token-example1',
  })
  .limit(5)
  .offset(0)
  .orderBy(['foreign', { column: 'id', order: 'desc' }])
  .options({
    tracking_id: 'hello',
    return_metadata_total: true,
    include_balance: true,
  });
ts
{
  tokens: [
    {
      id: 15,
      foreign: 'token-example0',
      public: true,
      belongs_to: 4,
      created_at: '2026-01-01T10:00:00.000Z',
      updated_at: '2026-01-01T10:00:00.000Z',
      metadata: {
        cool: true,
        even: true,
        example: 'test'
      },
      divisor: null,
      limit: null,
      type: 'value',
      status: 'active',
      belongs_to_foreign: 'VALID0',
      balance_transfer_id: null,
      balance_pending_amount: null,
      balance_pending_amount_from: null,
      balance_pending_amount_to: null,
      balance_available_balance: null,
      balance_finished_amount: null,
      balance_latest_control_hash: null,
      balance_amount: null,
      balance_updated_at: null
    },
    {
      id: 16,
      foreign: 'token-example1',
      public: true,
      belongs_to: 5,
      created_at: '2026-01-01T10:00:00.000Z',
      updated_at: '2026-01-01T10:00:00.000Z',
      metadata: {
        cool: true,
        even: false,
        example: 'test'
      },
      divisor: null,
      limit: null,
      type: 'value',
      status: 'active',
      belongs_to_foreign: 'VALID1',
      balance_transfer_id: 4,
      balance_pending_amount: 0,
      balance_pending_amount_from: 0,
      balance_pending_amount_to: 0,
      balance_available_balance: -999,
      balance_finished_amount: -999,
      balance_latest_control_hash: null,
      balance_amount: -999,
      balance_updated_at: '2026-01-01T10:00:00.000Z'
    },
    {
      id: 17,
      foreign: 'token-example2',
      public: true,
      belongs_to: 6,
      created_at: '2026-01-01T10:00:00.000Z',
      updated_at: '2026-01-01T10:00:00.000Z',
      metadata: {
        cool: true,
        even: true,
        example: 'test'
      },
      divisor: null,
      limit: null,
      type: 'value',
      status: 'active',
      belongs_to_foreign: 'VALID2',
      balance_transfer_id: null,
      balance_pending_amount: null,
      balance_pending_amount_from: null,
      balance_pending_amount_to: null,
      balance_available_balance: null,
      balance_finished_amount: null,
      balance_latest_control_hash: null,
      balance_amount: null,
      balance_updated_at: null
    },
    {
      id: 19,
      foreign: 'token-example4',
      public: true,
      belongs_to: 8,
      created_at: '2026-01-01T10:00:00.000Z',
      updated_at: '2026-01-01T10:00:00.000Z',
      metadata: {
        cool: true,
        even: true,
        example: 'test'
      },
      divisor: null,
      limit: null,
      type: 'value',
      status: 'active',
      belongs_to_foreign: 'VALID4',
      balance_transfer_id: null,
      balance_pending_amount: null,
      balance_pending_amount_from: null,
      balance_pending_amount_to: null,
      balance_available_balance: null,
      balance_finished_amount: null,
      balance_latest_control_hash: null,
      balance_amount: null,
      balance_updated_at: null
    },
    {
      id: 21,
      foreign: 'token-example6',
      public: true,
      belongs_to: 10,
      created_at: '2026-01-01T10:00:00.000Z',
      updated_at: '2026-01-01T10:00:00.000Z',
      metadata: {
        cool: true,
        even: true,
        example: 'test'
      },
      divisor: null,
      limit: null,
      type: 'value',
      status: 'active',
      belongs_to_foreign: 'VALID6',
      balance_transfer_id: null,
      balance_pending_amount: null,
      balance_pending_amount_from: null,
      balance_pending_amount_to: null,
      balance_available_balance: null,
      balance_finished_amount: null,
      balance_latest_control_hash: null,
      balance_amount: null,
      balance_updated_at: null
    }
  ],
  metadata: {
    limit: 5,
    offset: 0,
    total: 6,
    more_rows: true,
    order: [
      {
        field: 'foreign',
        direction: 'asc'
      },
      {
        field: 'id',
        direction: 'desc'
      }
    ]
  }
};

findTokensFnInput ​

Input for findTokens

AttributeTypeRequiredDescription
foreignstring | numberForeign of the token
typeTokenType ▶Type of the token
belongs_tostring | numberForeign of the wallet connected to token
metadata MetadataSearch ▶Metadata filter for custom properties
▶options{}Optional flags for input

findTokensFnOutput ​

Output of findTokens

AttributeTypeAlwaysDescription
▶tokens({})[]✓Found tokens
▶metadata{}✓Metadata about the search

getToken ​

Get information about token

ts
await client.getToken(
  {
    token: 'EURO',
  },
  {
    create_if_not_exists: true,
    // return_only_id: true, // for example purposes we want more than id
    ignore_cache: true,
    include_balance: true,
    // GENERALOPTIONS
  },
);
ts
{
  token: {
    balance_transfer_id: null,
    balance_pending_amount: null,
    balance_pending_amount_from: null,
    balance_pending_amount_to: null,
    balance_available_balance: null,
    balance_finished_amount: null,
    balance_latest_control_hash: null,
    balance_amount: null,
    balance_updated_at: null,
    id: 2,
    foreign: 'EURO',
    public: true,
    belongs_to: 2,
    created_at: '2026-01-01T10:00:00.000Z',
    updated_at: '2026-01-01T10:00:00.000Z',
    metadata: null,
    divisor: null,
    limit: null,
    type: 'value',
    status: 'active',
    belongs_to_foreign: null
  }
};

getTokenFnInput ​

Input for getToken

AttributeTypeRequiredDescription
foreignstring | numberForeign of the token
tokenstring | numberForeign of the token
▶options{}Optional flags for input

getTokenFnOutput ​

Output of getToken

AttributeTypeAlwaysDescription
▶token{}

updateToken ​

Update a Token

ts
await client.updateToken(
  {
    token: TEST.INFO.TOKENS.EUR.foreign,
    public: false,
    metadata: {
      metadata_field: 2,
    },
    status: 'disabled',
  },
  {
    return_when_not_updated: true,
    metadata_action: 'extend'
    // GENERALOPTIONS
  },
);
ts
{
  token: {
    id: 1,
    foreign: 'EUR',
    public: false,
    belongs_to: 1,
    created_at: '2026-01-01T10:00:00.000Z',
    updated_at: '2026-01-01T10:00:00.000Z',
    metadata: {
      metadata_field: 2,
      metadata_number: 1,
      metadata_string: 'TT2'
    },
    divisor: null,
    limit: null,
    type: 'value',
    status: 'disabled'
  },
  updated: true
};

updateTokenFnInput ​

Input for updateToken

AttributeTypeRequiredDescription
tokenstring | number✓Token foreign
metadata Metadata ▶Key/value object describing the token
publicbooleanBoolean indicating if token can be traded with outside seed wallet
statusTokenStatus ▶Current status for the token
▶options{}Optional flags for input

updateTokenFnOutput ​

Output of updateToken

AttributeTypeAlwaysDescription
▶token{}Units of value which can be transferred in this system
updatedbooleanBoolean showing if the token was updated