@interlay/interbtc-api / Exports / TokensAPI
▸ balance(currency, id): Promise<ChainBalance>
| Name | Type | Description |
|---|---|---|
currency |
CurrencyExt |
The currency specification, Monetary.js object or ForeignAsset |
id |
AccountId |
The AccountId of a user |
Promise<ChainBalance>
The user’s balance
▸ buildTransferExtrinsic(destination, amount): SubmittableExtrinsic<"promise", ISubmittableResult>
Build a transfer extrinsic without sending it.
| Name | Type | Description |
|---|---|---|
destination |
string |
The address of a user |
amount |
MonetaryAmount<CurrencyExt> |
The amount to transfer, as Monetary.js object or ForeignAsset |
SubmittableExtrinsic<"promise", ISubmittableResult>
A transfer submittable extrinsic.
▸ setBalance(accountId, freeBalance, lockedBalance?): ExtrinsicData
| 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 |
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
▸ subscribeToBalance(currency, account, callback): Promise<() => void>
Subscribe to balance updates
| 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) |
Promise<() => void>
▸ total<CurrencyT>(currency): Promise<MonetaryAmount<CurrencyT>>
| Name | Type |
|---|---|
CurrencyT |
extends CurrencyExt |
| Name | Type | Description |
|---|---|---|
currency |
CurrencyT |
The currency specification, a Monetary.js object or ForeignAsset |
Promise<MonetaryAmount<CurrencyT>>
The total amount in the system
▸ transfer(destination, amount): ExtrinsicData
| Name | Type | Description |
|---|---|---|
destination |
string |
The address of a user |
amount |
MonetaryAmount<CurrencyExt> |
The amount to transfer, as Monetary.js object or ForeignAsset |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.