Fungible Token

Create fungible token required approval from authorities.


Creating Instances

FungibleToken . create ( properties, signerOrProvider )   => Promise<FungibleToken>

Creates a new instance reference from signerOrProvider and send fungible token creation transaction to network and returns a Promise that resolves to a FungibleToken instance.

The valid fungible token properties are:

  • name — the unique fungible token name
  • symbol — the unique fungible token symbol
  • decimals — the number of decimals for balance
  • fixedSupply — the supply mechanisms type (true: fixed, false: dynamic)
  • totalSupply — the total supply is only applied to fixedSupply = true, otherwise should set to 0
  • fee — the application fee
  • owner — the owner for the fungible token (default to wallet creator)
  • metadata — optional
FungibleToken . fromSymbol ( symbol, signerOrProvider )   => Promise<FungibleToken>
Query fungible token by symbol from network and returns a Promise that resolves to a FungibleToken instance.

Prototype

prototype . state   => TokenState

The valid token state are:

  • type — the token type (fungible, or non-fungible)
  • name — the unique token name
  • symbol — the unique token symbol
  • decimals — the number of decimals for balance
  • fixedSupply — the supply mechanisms type (true: fixed, false: dynamic)
  • totalSupply — the total supply for the token
  • approved — the approval status
  • frozen — the frozen status
  • owner — the token owner address
  • metadata — optional
  • transferFee — the transfer fee that should be deduct from sender (in cin)
  • burnable — the token balance allow to be burn or not. This will be always true for dynamic supply token.
prototype . getBalance ( )   => Promise<BigNumber>
Returns a Promise that resolves to the fungible token balance (as a BigNumber) of the wallet. Be aware of the number of decimals applied for the token. The balance can be convert to a human readable format by formatUnits, versa parseUnits.
prototype . transfer ( addressOrName, value )   => Promise<TransactionReceipt>

Sends the transfer fungible token transaction to the network and returns a Promise that resolves to a Transaction Receipt.

The addressOrName can be set to recipient alias or wallet address. The value is the number of fungible token (as a BigNumber) that transfers to recipient. Be aware of the number of decimals applied for the token.

prototype . mint ( addressOrName, value )   => Promise<TransactionReceipt>

Sends the mint fungible token transaction to the network and returns a Promise that resolves to a Transaction Receipt.

The addressOrName can be set to recipient alias or wallet address. The value is the number of fungible token (as a BigNumber) that mint to recipient. Be aware of the number of decimals applied for the token.

Note

Only fungible token owner is allowed to sign mint transaction.

prototype . burn ( value )   => Promise<TransactionReceipt>

Sends the burn fungible token transaction to the network and returns a Promise that resolves to a Transaction Receipt.

The value is the number of fungible token (as a BigNumber) that to be burned. Be aware of the number of decimals applied for the token.

prototype . freeze ( addressOrName )   => Promise<TransactionReceipt>

Sends the freeze fungible token transaction to the network and returns a Promise that resolves to a Transaction Receipt.

The addressOrName can be set to target holder alias or wallet address that to be freeze.

Note

Only fungible token owner is allowed to sign freeze transaction.

prototype . unfreeze ( addressOrName )   => Promise<TransactionReceipt>

Sends the unfreeze fungible token transaction to the network and returns a Promise that resolves to a Transaction Receipt.

The addressOrName can be set to target holder alias or wallet address that to be unfreeze.

Note

Only fungible token owner is allowed to sign unfreeze transaction.