Usage

This is a description of the features that the token module offers.

Contents

NameDescription

Create tokens.

Mint tokens.

Burn tokens.

Modify the meta data of the token.

Transfer tokens to a different wallet.

Parameters required to call API.

1. Token.createToken

Create tokens. Created tokens are recorded on the network and the transaction record detailing the success/failure of token creation is also generated.

Parameters

NameTypeExample

wallet

Object (FirmaWalletService)

You can check how to use your wallet in the "firma-js of the Github repository".

tokenName

String

FIRMA TOKEN

tokenSymbol

String

FIRMA

tokenURI

String

"https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"

totalSupply

Number

10000000

decimal

Number

6

isMintable

Boolean

true

isBurnable

Boolean

true

txMisc

(Not required)

Object (TxMisc)

{fee:200000,gas:86840,memo:"custom message"}

Return value

{
  code: 0,
  height: 1191778,
  rawLog: '[{
    "events": [
    ...
    {
      "type":"message",
      "attributes":[
        {"key":"action","value":"CreateToken"},
        {"key":"sender","value":"firma183rfa8tvtp6ax7jr7dfaf7ywv870sykxa47lp2"},
        {"key":"Owner","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"TokenID","value":"ufirma"},
        {"key":"TokenName","value":"FIRMA TOKEN"},
        {"key":"TokenSymbol","value":"FIRMA"}
      ]
    },
    ...]
  }]',
  transactionHash: '4AA07BBF6D5C83C2746636E0F3A262E2ED34644BFE95C8151E12C5F7802E92D2',
  gasUsed: 86840,
  gasWanted: 200000
}

2. Token.mint

Users can mint additional tokens aside from the one initially created. If the “isMintable” value is false, you cannot mint additional tokens.

Parameters

NameTypeExample

wallet

Object (FirmaWalletService)

You can check how to use your wallet in the "firma-js of the Github repository".

tokenID

String

"ufirma"

amount

Number

10000000

decimal

Number

6

toAddress

String

"firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u"

txMisc

(Not required)

Object (TxMisc)

{fee:200000,gas:87084,memo:"custom message"}

Return value

{
  code: 0,
  height: 1191972,
  rawLog: '[{
    "events": [
    ...
    {
      "type":"message",
      "attributes": [
        {"key":"action","value":"Mint"},
        {"key":"sender","value":"firma183rfa8tvtp6ax7jr7dfaf7ywv870sykxa47lp2"},
        {"key":"Owner","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"TokenID","value":ufirma"},
        {"key":"MintAmount","value":"100000000000"},
        {"key":"TotalSupply","value":"10100000000000"}
      ]
    }, 
    ...
    ]
  }]',
  transactionHash: '8CA536E94D71B6997027453A7275500A94CEBB41C7ABE79203CA937333C51DAA',
  gasUsed: 87084,
  gasWanted: 200000
}

3. Token.burn

Burn tokens. If the “isBurnable” value is false, you cannot burn tokens.

Parameters

NameTypeExample

wallet

Object (FirmaWalletService)

You can check how to use your wallet in the "firma-js of the Github repository".

tokenID

String

"ufirma"

amount

Number

10000000

decimal

Number

6

txMisc

(Not required)

Object (TxMisc)

{fee:200000,gas:90787,memo:"custom message"}

Return value

{
  code: 0,
  height: 1192095,
  rawLog: '[{
    "events": [
    ...
    {
      "type":"message",
      "attributes": [
        {"key":"action","value":"Burn"},
        {"key":"sender","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"Owner","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"TokenID","value":"ufirma"},
        {"key":"BurnAmount","value":"10000000"},
        {"key":"TotalSupply","value":"10099990000000"}
      ]
    },
    ... 
    ]
  }]',
  transactionHash: '159B2780F8651A675B1E81624D3D9A3882CD072754086B2F5EF08DFC4921F172',
  gasUsed: 90787,
  gasWanted: 200000
}

4. Token.updateTokenURI

Update the URL that points to the token’s meta data.

Parameters

NameTypeExample

wallet

Object (FirmaWalletService)

You can check how to use your wallet in the "firma-js of the Github repository".

tokenID

String

"ufirma"

tokenURI

String

"https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"

txMisc

(Not required)

Object (TxMisc)

{fee:200000,gas:66822,memo:"custom message"}

Return value

{
  code: 0,
  height: 1192288,
  rawLog: '[{
    "events":[{
      "type":"message",
      "attributes":[
        {"key":"action","value":"UpdateTokenURI"},
        {"key":"Owner","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"TokenID","value":"ufirma"},
        {"key":"TokenURI","value":"https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"}
      ]
    }]
  }]',
  transactionHash: '5A42EAD6C3210234F8F23B7CB6E6489D99C6E1D0ABBA1EBDFEA3668AF397E24E',
  gasUsed: 66822,
  gasWanted: 200000
}

5. Bank.sendToken

Transfer tokens to a different wallet.

Parameters

NameTypeExample

wallet

Object (FirmaWalletService)

You can check how to use your wallet in the "firma-js of the Github repository".

targetAddress

String

"firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u"

tokenID

String

"ufirma"

amount

Number

10

decimal

Number

6

txMisc

(Not required)

Object (TxMisc)

{fee:200000,gas:68902,memo:"custom message"}

Return value

{
  code: 0,
  height: 1192536,
  rawLog: '[{
    "events":[
    ...
    {
      "type":"message",
      "attributes":[
        {"key":"action","value":"/cosmos.bank.v1beta1.MsgSend"},
        {"key":"sender","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"module","value":"bank"}
      ]
    }, {
      "type":"transfer",
      "attributes":[
        {"key":"recipient","value":"firma10ne3nw4kcfj6vjz84l2m3gj8vyaczfhma5ff69"},
        {"key":"sender","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"amount","value":"100000000ufirma"}
      ]
    }]
  }]',
  transactionHash: '0ECA7D7E78964B08A03521D79A04161FC2CCE807E4922748BFAED904573EE6A9',
  gasUsed: 68902,
  gasWanted: 200000
}

6. Parameter Description

NameDescription

wallet

Unique wallet parameter created from the user’s Mnemonic. This parameter can be called by using the Wallet.fromMnemonic function from the FirmaSDK module.

tokenName

This parameter refers to the buffer data of a file or a text.

tokenID

This is the ID generated at the time of token creation.

tokenSymbol

This is the symbol of the token being created.

tokenURI

This is the URL for the meta data of the token.

totalSupply

This is the total supply of the token being issued.

amount

This refers to the amount of tokens.

decimal

This refers to the decimal points.

isMintable

Users can decide whether to allow additional issuing of tokens at the time of token creation. If this value is false, you will not be able to mint additional tokens.

isBurnable

Users can decide whether to allow burning of tokens at the time of token creation. If this value is false, you will not be able to burn tokens.

toAddress (targetAddress)

For this parameter, please enter your FirmaChain wallet address.

txMisc

(Not required)

This object contains the gas fee that is deducted when a transaction is called upon.

* The default gas fee is set at 0.02fct.

Last updated