Logos Kit

Tokens

Fungible tokens on LEZ: balances, transfers, and creating a test token.

LEZ tokens live in the built-in token program. A token is identified by its definition account.

Balance and transfer

kit.api.getWalletBalance(account, definition).then(function (b) { root.tokens = b.amount })

kit.api.transfer(from, to, "250", definition).then(function (r) { root.follow(r.handle) })

Public and private accounts both hold tokens; private token transfers prove like native ones. The approval sheet shows the token, the amount and the destination.

A public token send is confirmed from the sender's token balance (it drops by exactly the amount; fees are paid in LGO, the native token).

Build the call yourself

var call = kit.sdk.tokenTransfer(from, to, definition, "250")   // kind defaults to "fungible"
kit.api.sendCall(from, call)

Create a test token

From the CLI (the whole supply goes to --holder):

logos-kit token create --name KIT --supply 1000000 --holder <public account>
logos-kit token list

Amounts are raw integers, as strings: a token's base units (the CLI's --amount with --token takes a whole number of them). If your token defines decimals for display, kit.sdk.formatUnits(amount, decimals) formats them. The native token is different: its amounts are lepta, shown as LGO with kit.sdk.formatUnits(amount, 9) (1 LGO = 10^9 lepta).

On this page