Getting Started

The following instruction helps you get started with Nifty-toolkit npm quickly.

Hello world

First, make sure you installed Nifty-toolkit and have the latest version of Node.js running (version 12 and up are recommended)

npm i -s nifty-toolkit

Second, create a file named hello-world.js, open it in your favorite editor, and add the following lines:

var npmMintNft = require('nifty-toolkit');
var nft = new npmMintNft.Nft({
    networkName: 'mumbai', // or cronos-testnet
    rpcUrl: 'https://rpc-mumbai.maticvigil.com', // optional
});

nft.mint("recipient_address", "ipfs_hash", "account_private_key").then(res => {
    console.log(res);
});

Note where we config the EVM-RPC. You can choose either "mumbai" for Polygon or "cronos-testnet" for Cronos.

Change the following 3 parameters:

  1. recipient_address: public key the account that wishes to receive the NFT.

  2. ipfs_hash: the hash value on IPFS, which contains the resource file you uploaded.

  3. account_private_key: the account that pays for the gas fee and initiates the transaction on-chain.

Run your code

After a bit, you will get a response of hash transaction value, and you can easily check on Polygon's blockchain browser.

node hello-world.js

You will get a response hash, which is the transaction value on the blockchain.

You can easily check your transaction on the blockchain explorer, for example:

Last updated