Skip to content

Usage ​

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

Contents ​

NameDescription
1. Token.createTokenCreate tokens.
2. Token.mintMint tokens.
3. Token.burnBurn tokens.
4. Token.updateTokenURIModify the meta data of the token.
5. Bank.sendTokenTransfer tokens to a different wallet.
6. Parameter DescriptionParameters 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
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
tokenNameStringFIRMA TOKEN
tokenSymbolStringFIRMA
tokenURIString"https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"
totalSupplyNumber10000000
decimalNumber6
isMintableBooleantrue
isBurnableBooleantrue
txMisc
(Not required)
Object (TxMisc){fee:200000,gas:86840,memo:"custom message"}

Return value ​

bash
{
  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
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
tokenIDString"ufirma"
amountNumber10000000
decimalNumber6
toAddressString"firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u"
txMisc
(Not required)
Object (TxMisc){fee:200000,gas:87084,memo:"custom message"}

Return value ​

bash
{
  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
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
tokenIDString"ufirma"
amountNumber10000000
decimalNumber6
txMisc
(Not required)
Object (TxMisc){fee:200000,gas:90787,memo:"custom message"}

Return value ​

bash
{
  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
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
tokenIDString"ufirma"
tokenURIString"https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"
txMisc
(Not required)
Object (TxMisc){fee:200000,gas:66822,memo:"custom message"}

Return value ​

bash
{
  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
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
targetAddressString"firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u"
tokenIDString"ufirma"
amountNumber10
decimalNumber6
txMisc
(Not required)
Object (TxMisc){fee:200000,gas:68902,memo:"custom message"}

Return value ​

bash
{
  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
walletUnique wallet parameter created from the user’s Mnemonic.
This parameter can be called by using the Wallet.fromMnemonic function from the FirmaSDK module.
tokenNameThis parameter refers to the buffer data of a file or a text.
tokenIDThis is the ID generated at the time of token creation.
tokenSymbolThis is the symbol of the token being created.
tokenURIThis is the URL for the meta data of the token.
totalSupplyThis is the total supply of the token being issued.
amountThis refers to the amount of tokens.
decimalThis refers to the decimal points.
isMintableUsers 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.
isBurnableUsers 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.