# Usage

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

## Contents

<table><thead><tr><th width="277">Name</th><th>Description</th></tr></thead><tbody><tr><td><a href="#1.-token.createtoken">1. Token.createToken</a></td><td>Create tokens.</td></tr><tr><td><a href="#2.-token.mint">2. Token.mint</a></td><td>Mint tokens.</td></tr><tr><td><a href="#3.-token.burn">3. Token.burn</a></td><td>Burn tokens.</td></tr><tr><td><a href="#4.-token.updatetokenuri">4. Token.updateTokenURI</a></td><td>Modify the meta data of the token.</td></tr><tr><td><a href="#5.-bank.sendtoken">5. Bank.sendToken</a></td><td>Transfer tokens to a different wallet.</td></tr><tr><td><a href="#6.-parameter-description">6. Parameter Description</a></td><td>Parameters required to call API.</td></tr></tbody></table>

### 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

<table><thead><tr><th width="156">Name</th><th width="253">Type</th><th>Example</th></tr></thead><tbody><tr><td>wallet</td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">FirmaWalletService</mark>)</td><td>You can check how to use your wallet in the "<a href="https://github.com/FirmaChain/firma-js#create-wallet-account">firma-js of the Github repository</a>".</td></tr><tr><td>tokenName</td><td><mark style="color:blue;">String</mark></td><td>FIRMA TOKEN</td></tr><tr><td>tokenSymbol</td><td><mark style="color:blue;">String</mark></td><td>FIRMA</td></tr><tr><td>tokenURI</td><td><mark style="color:blue;">String</mark></td><td>"https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"</td></tr><tr><td>totalSupply</td><td><mark style="color:blue;">Number</mark></td><td>10000000</td></tr><tr><td>decimal</td><td><mark style="color:blue;">Number</mark></td><td>6</td></tr><tr><td>isMintable</td><td><mark style="color:blue;">Boolean</mark></td><td>true</td></tr><tr><td>isBurnable</td><td><mark style="color:blue;">Boolean</mark></td><td>true</td></tr><tr><td><p>txMisc</p><p>(Not required)</p></td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">TxMisc</mark>)</td><td>{fee:200000,gas:86840,memo:"custom message"}</td></tr></tbody></table>

#### 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

<table><thead><tr><th width="156">Name</th><th width="253">Type</th><th>Example</th></tr></thead><tbody><tr><td>wallet</td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">FirmaWalletService</mark>)</td><td>You can check how to use your wallet in the "<a href="https://github.com/FirmaChain/firma-js#create-wallet-account">firma-js of the Github repository</a>".</td></tr><tr><td>tokenID</td><td><mark style="color:blue;">String</mark></td><td>"ufirma"</td></tr><tr><td>amount</td><td><mark style="color:blue;">Number</mark></td><td>10000000</td></tr><tr><td>decimal</td><td><mark style="color:blue;">Number</mark></td><td>6</td></tr><tr><td>toAddress</td><td><mark style="color:blue;">String</mark></td><td>"firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u"</td></tr><tr><td><p>txMisc</p><p>(Not required)</p></td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">TxMisc</mark>)</td><td>{fee:200000,gas:87084,memo:"custom message"}</td></tr></tbody></table>

#### 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

<table><thead><tr><th width="156">Name</th><th width="253">Type</th><th>Example</th></tr></thead><tbody><tr><td>wallet</td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">FirmaWalletService</mark>)</td><td>You can check how to use your wallet in the "<a href="https://github.com/FirmaChain/firma-js#create-wallet-account">firma-js of the Github repository</a>".</td></tr><tr><td>tokenID</td><td><mark style="color:blue;">String</mark></td><td>"ufirma"</td></tr><tr><td>amount</td><td><mark style="color:blue;">Number</mark></td><td>10000000</td></tr><tr><td>decimal</td><td><mark style="color:blue;">Number</mark></td><td>6</td></tr><tr><td><p>txMisc</p><p>(Not required)</p></td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">TxMisc</mark>)</td><td>{fee:200000,gas:90787,memo:"custom message"}</td></tr></tbody></table>

#### 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

<table><thead><tr><th width="156">Name</th><th width="253">Type</th><th>Example</th></tr></thead><tbody><tr><td>wallet</td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">FirmaWalletService</mark>)</td><td>You can check how to use your wallet in the "<a href="https://github.com/FirmaChain/firma-js#create-wallet-account">firma-js of the Github repository</a>".</td></tr><tr><td>tokenID</td><td><mark style="color:blue;">String</mark></td><td>"ufirma"</td></tr><tr><td>tokenURI</td><td><mark style="color:blue;">String</mark></td><td>"https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"</td></tr><tr><td><p>txMisc</p><p>(Not required)</p></td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">TxMisc</mark>)</td><td>{fee:200000,gas:66822,memo:"custom message"}</td></tr></tbody></table>

#### 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

<table><thead><tr><th width="156">Name</th><th width="253">Type</th><th>Example</th></tr></thead><tbody><tr><td>wallet</td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">FirmaWalletService</mark>)</td><td>You can check how to use your wallet in the "<a href="https://github.com/FirmaChain/firma-js#create-wallet-account">firma-js of the Github repository</a>".</td></tr><tr><td>targetAddress</td><td><mark style="color:blue;">String</mark></td><td>"firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u"</td></tr><tr><td>tokenID</td><td><mark style="color:blue;">String</mark></td><td>"ufirma"</td></tr><tr><td>amount</td><td><mark style="color:blue;">Number</mark></td><td>10</td></tr><tr><td>decimal</td><td><mark style="color:blue;">Number</mark></td><td>6</td></tr><tr><td><p>txMisc</p><p>(Not required)</p></td><td><mark style="color:blue;">Object</mark> (<mark style="color:green;">TxMisc</mark>)</td><td>{fee:200000,gas:68902,memo:"custom message"}</td></tr></tbody></table>

#### 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

<table><thead><tr><th width="191">Name</th><th>Description</th></tr></thead><tbody><tr><td>wallet</td><td>Unique wallet parameter created from the user’s Mnemonic.<br>This parameter can be called by using the Wallet.fromMnemonic function from the FirmaSDK module.</td></tr><tr><td>tokenName</td><td>This parameter refers to the buffer data of a file or a text.</td></tr><tr><td>tokenID</td><td>This is the ID generated at the time of token creation.</td></tr><tr><td>tokenSymbol</td><td>This is the symbol of the token being created.</td></tr><tr><td>tokenURI</td><td>This is the URL for the meta data of the token.</td></tr><tr><td>totalSupply</td><td>This is the total supply of the token being issued.</td></tr><tr><td>amount</td><td>This refers to the amount of tokens.</td></tr><tr><td>decimal</td><td>This refers to the decimal points.</td></tr><tr><td>isMintable</td><td>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.</td></tr><tr><td>isBurnable</td><td>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.</td></tr><tr><td>toAddress<br>(targetAddress)</td><td>For this parameter, please enter your FirmaChain wallet address.</td></tr><tr><td><p>txMisc</p><p>(Not required)</p></td><td><p>This object contains the gas fee that is deducted when a transaction is called upon.</p><p><em>* The default gas fee is set at 0.02fct.</em></p></td></tr></tbody></table>
