interbtc-api

@interlay/interbtc-api / Exports / TokensAPI

Interface: TokensAPI

Implemented by

Table of contents

Methods

Methods

balance

balance(currency, id): Promise<ChainBalance>

Parameters

Name Type Description
currency CurrencyExt The currency specification, Monetary.js object or ForeignAsset
id AccountId The AccountId of a user

Returns

Promise<ChainBalance>

The user’s balance

Defined in

src/parachain/tokens.ts:25


buildTransferExtrinsic

buildTransferExtrinsic(destination, amount): SubmittableExtrinsic<"promise", ISubmittableResult>

Build a transfer extrinsic without sending it.

Parameters

Name Type Description
destination string The address of a user
amount MonetaryAmount<CurrencyExt> The amount to transfer, as Monetary.js object or ForeignAsset

Returns

SubmittableExtrinsic<"promise", ISubmittableResult>

A transfer submittable extrinsic.

Defined in

src/parachain/tokens.ts:33


setBalance

setBalance(accountId, freeBalance, lockedBalance?): ExtrinsicData

Parameters

Name Type Description
accountId AccountId Account whose balance to set
freeBalance MonetaryAmount<CurrencyExt> Free balance to set, as a Monetary.js object
lockedBalance? MonetaryAmount<CurrencyExt> Locked balance to set, as a Monetary.js object

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Remarks

This extrinsic is only valid if submitted by a sudo account

Defined in

src/parachain/tokens.ts:62


subscribeToBalance

subscribeToBalance(currency, account, callback): Promise<() => void>

Subscribe to balance updates

Parameters

Name Type Description
currency CurrencyExt The currency specification, Monetary.js object or ForeignAsset
account string AccountId string
callback (account: string, balance: ChainBalance) => void Function to be called whenever the balance of an account is updated. Its parameters are (accountIdString, freeBalance)

Returns

Promise<() => void>

Defined in

src/parachain/tokens.ts:50


total

total<CurrencyT>(currency): Promise<MonetaryAmount<CurrencyT>>

Type parameters

Name Type
CurrencyT extends CurrencyExt

Parameters

Name Type Description
currency CurrencyT The currency specification, a Monetary.js object or ForeignAsset

Returns

Promise<MonetaryAmount<CurrencyT>>

The total amount in the system

Defined in

src/parachain/tokens.ts:19


transfer

transfer(destination, amount): ExtrinsicData

Parameters

Name Type Description
destination string The address of a user
amount MonetaryAmount<CurrencyExt> The amount to transfer, as Monetary.js object or ForeignAsset

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Defined in

src/parachain/tokens.ts:42