# Bulk Insert (minting)

This feature is used to issue more than 2 NFTs.

## Contents

<table><thead><tr><th width="346">Name</th><th>Description</th></tr></thead><tbody><tr><td>1<a href="#1.-nfttxclient.msgmint">. NftTxClient.msgMint</a></td><td>This feature generates the mint transaction message.</td></tr><tr><td><a href="#2.-getgasestimationfromencodeobject">2. getGasEstimationFromEncodeObject</a></td><td>This feature estimates the gas fee required for lining up transaction messages.</td></tr><tr><td><a href="#3.-signandbroadcast">3. signAndBroadcast</a></td><td>This feature executes multiple transactions at once.</td></tr><tr><td><a href="#4.-parameter-description">4. Parameter Description</a></td><td>Parameters required to call API.</td></tr></tbody></table>

### 1. NftTxClient.msgMint

This function generates mint transactions as messages. Once the gas fee for generating a message is calculated, the transaction is created by the function that executes messages.\
\&#xNAN;*\* For a more detailed guide on calculating the gas fee and executing messages, please refer to functions 2 and 3.*

#### Parameters

<table><thead><tr><th width="144.33333333333331">Name</th><th width="133">Type</th><th>Example</th></tr></thead><tbody><tr><td>data</td><td><mark style="color:blue;">MsgMint</mark></td><td><p>{</p><p>  owner: address,</p><p>  tokenURI: "https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"</p><p>}</p></td></tr></tbody></table>

#### Return value

```bash
{
  typeUrl: '/firmachain.firmachain.nft.MsgMint',
  value: {
    owner: 'firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr',
    tokenURI: 'https://naver3.com'
  }
}
```

### 2. getGasEstimationFromEncodeObject

This function estimates the gas fee required when generating transactions of the message list created by function 1. When using Bulk Insert, there is a high chance where the gas fee could exceed the default gas fee(0.02fct). Therefore, prior to the execution of the transaction, the gas fee must be estimated properly.

#### Parameters

<table><thead><tr><th width="144.33333333333331">Name</th><th width="245">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>msgList</td><td><mark style="color:blue;">Array</mark>(<mark style="color:green;">NftTxClient.msgMint</mark>)</td><td>[ data1, data2, data3 ]</td></tr></tbody></table>

#### Return value

```
334715
```

#### Example Run Image

<figure><img src="https://1593777863-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe2XZ7GS3nYBec5LCbrmQ%2Fuploads%2F3om85F1wS0wffDLsyxNZ%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202023-03-02%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%206.33.17.png?alt=media&#x26;token=af1ff81e-9f78-4685-bc29-aba8adc5a913" alt=""><figcaption></figcaption></figure>

### 3. signAndBroadcast

This function lists the messages generated from function 1 and then generates the message list as transactions.

#### Parameters

<table><thead><tr><th width="156.33333333333331">Name</th><th width="248">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>msgList</td><td><mark style="color:blue;">msgList</mark> (<mark style="color:green;">EncodeObject[]</mark>)</td><td><strong>1</strong> "Return value" Array value.</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:163821,memo:"custom message"}</td></tr></tbody></table>

#### Return value

```bash
{
  code: 0,
  height: 1176462,
  rawLog: '[
  {
    "events": [{
      "type": "message",
      "attributes": [
        {"key":"action","value":"Mint"},
        {"key":"Owner","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"nftID","value":"79"}
      ]
    }]
  }, {
    "msg_index": 1,
    "events": [{
      "type": "message",
      "attributes": [
        {"key":"action","value":"Mint"},
        {"key":"Owner","value":"firma1trqyle9m2nvyafc2n25frkpwed2504y6avgfzr"},
        {"key":"nftID","value":"80"}
      ]
    }]
  },
  ...
  transactionHash: '8CEAE0126E8B67586D776CAB359953FAB3637C8722D7ADB6E1DC34B48306B6C8',
  gasUsed: 291056,
  gasWanted: 334715
}
```

### 4. Parameter Description

<table><thead><tr><th width="182">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>data</td><td>For this parameter, please enter your FirmaChain wallet address.</td></tr><tr><td>msgList</td><td>This parameter contains the list of messages that is used to execute transactions.</td></tr><tr><td>txMisc</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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.firmachain.org/master/developer/modules/nft/bulk-insert-minting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
