Skip to content

Bulk Insert (minting) ​

This feature is used to issue more than 2 NFTs.

Contents ​

NameDescription
1. NftTxClient.msgMintThis feature generates the mint transaction message.
2. getGasEstimationFromEncodeObjectThis feature estimates the gas fee required for lining up transaction messages.
3. signAndBroadcastThis feature executes multiple transactions at once.
4. Parameter DescriptionParameters required to call API.

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 ​

NameTypeExample
dataMsgMint{
owner: address,
tokenURI: "https://firmachain.org/nft/metadata/bcf5cdajs-ff12...-d2han89nnha1"
}

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 ​

NameTypeExample
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
msgListArray(NftTxClient.msgMint)[ data1, data2, data3 ]

Return value ​

334715

Example Run Image ​

FirmaChain guide screenshot

3. signAndBroadcast ​

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

Parameters ​

NameTypeExample
walletObject (FirmaWalletService)You can check how to use your wallet in the "firma-js of the Github repository".
msgListmsgList (EncodeObject[])1 "Return value" Array value.
txMisc
(Not required)
Object (TxMisc){fee:200000,gas:163821,memo:"custom message"}

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 ​

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.
dataFor this parameter, please enter your FirmaChain wallet address.
msgListThis parameter contains the list of messages that is used to execute transactions.
txMiscThis object contains the gas fee that is deducted when a transaction is called upon.
* The default gas fee is set at 0.02fct.