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)
1
npm i -s nifty-toolkit
Copied!
Second, create a file named hello-world.js, open it in your favorite editor, and add the following lines:
1
var npmMintNft = require('nifty-toolkit');
2
var nft = new npmMintNft.Nft({
3
networkName: 'mumbai', // or cronos-testnet
4
rpcUrl: 'https://rpc-mumbai.maticvigil.com', // optional
5
});
6
7
nft.mint("recipient_address", "ipfs_hash", "account_private_key").then(res => {
8
console.log(res);
9
});
Copied!
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. 1.
    recipient_address: public key the account that wishes to receive the NFT.
  2. 2.
    ipfs_hash: the hash value on IPFS, which contains the resource file you uploaded.
  3. 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.
1
node hello-world.js
Copied!
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:
Polygon Transaction Hash (Txhash) Details | PolygonScan
Polygon (MATIC) Blockchain Explorer
Polygon transaction on mumbai testnet
Last modified 2mo ago
Copy link