Token

What is it?

Tokens are denoted by standards such as ERC20 on Ethereum, SPL on Solana, TRC20 on Tron. But almost all of them have the same basic features. With this class, we can easily manage all token transactions.

Methods

import { assets } from '@multiplechain/evm-chains'

const token = new assets.Token('0x')

const name = token.getName()
const symbol = token.getSymbol()
const decimals = await token.getDecimals()
const balance = await token.getBalance('0x')
const totalSupply = await token.getTotalSupply()
const allowance = await token.getAllowance('0x', '0x')

const transfer = await token.transfer('0x', '0x', 1)
const approve = await token.approve('0x', '0x', 1)
const transferFrom = await token.transferFrom('0x', '0x', '0x', 1)

const txId = await (await transfer.sign('0x')).send()
const txId2 = await (await approve.sign('0x')).send()
const txId3 = await (await transferFrom.sign('0x')).send()

Last updated