📌mint

Description

The mint function is an asynchronous function that mints a specified amount of ERC20 tokens to the specified receiver address and returns the transaction receipt.

Parameters

Parameter
Type
Description

blockchain

string

Takes a string parameter specifying the name of the blockchain network (For eg. bsc, polygon, eth, ava, gnosis, moonbeam)

contractAddress

string

Requires a contract address of the token (ERC20) that is already deployed

receiver

string

Expects the receiving account address for the mint of the token (ERC20)

amount

string

Expects the receiving account address for the mint of the token (ERC20)

privateKey

string

Expects the receiving account address for the mint of the token (ERC20)

Response

Property
Type
Description

Promise<Object>

object

Returns the transaction receipt object

Example Request and Response

Prerequisites

Before making requests with NEST® SDK, you must have it installed.

You can install NEST® SDK using either npm or yarn. Use the following commands to install NEST® SDK:

npm install @nest25/evm-chains-lib
OR
yarn add @nest25/evm-chains-lib

Request

Here is an example of how to make a mint request using the NEST® SDK:

// import the Nest SDK
const { ERC20 } = require('@nest25/evm-chains-lib');

// create a new instance of the ERC20 class
const erc20 = new ERC20();

// define the main function
const main = async () => {
    // call the mint function
    const receipt = await erc20.mint(
        'klay',
        '0x3c40d011838f0ecd5b601104eeb5e27172c92231',
        '0x13CC66D6611bb754647Bf2977881eA0e35A48FB4',
        '100',
        'your-private-key',
    );

    // print the receipt
    console.log({ receipt });
};
// call the main function
main();

Response

 {
  receipt: {
    type: 2,
    chainId: 1001,
    nonce: 237,
    maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
    maxFeePerGas: BigNumber { _hex: '0x0bdfd63e00', _isBigNumber: true },
    gasPrice: null,
    gasLimit: BigNumber { _hex: '0xa822', _isBigNumber: true },
    to: '0x3c40d011838F0EcD5B601104EEb5E27172C92231',
    value: BigNumber { _hex: '0x00', _isBigNumber: true },
    data: '0x40c10f1900000000000000000000000013cc66d6611bb754647bf2977881ea0e35a48fb40000000000000000000000000000000000000000000000000000000000000064',
    accessList: [],
    hash: '0xadbd2e3e340fa378b87b8d40225c3e9e17daf0f3bb86e2316398549504759562',
    v: 1,
    r: '0xe377d367c0f892d67884b1134ff5c35dfb9e9ecec15d2409843c560a19a9168c',
    s: '0x1477b80e71f3fda2096006fcffd0bb48c7bbe455c73ba8a9f7e8bbaca84c2478',
    from: '0xE668C72D4C67236A712Ce69A91C74358586f31ed',
    wait: [Function (anonymous)]
  }
}

Use Cases

  • Bulk token distribution: The primary use case for the mint function is to distribute multiple ERC20 tokens to a specified receiver address in bulk.

  • Automated token distribution: The mint function can be integrated into automated workflows for token distribution, allowing developers to automatically distribute tokens as part of their continuous integration and deployment process.

Last updated