NFT & Collectibles Module

Non-fungible tokens (NFTs) are used for unique, indivisible digital assets on the blockchain, enabling ownership and tracking of distinct items like collectibles.

There are two options to follow here, you can deploy your own NFT Contract or use Paras NFT Contract. With using Paras NFT Contract, your collectibles will be automatically indexed on Paras' marketplace.

Deploy your own NFT contract on NEAR

const { client } = useEastSDK();
...
const deployNFTContract = async () => {
    // Deploying NFT Contract
    await client.client.nft.nftDeploy((user as any)?.account_id, {
    spec: "nft-1.0.0",
    name: "NFT Tutorial Contract",
    symbol: "GOTEAM",
    icon: null,
    base_uri: null,
    reference: null,
    reference_hash: null,
  });
  
}

Minting NFT to deployed contract

 // mint NFT 
  const mintNFT = async () => {
    const res = await client.client.nft.nftMint(
      (user as any)?.account_id,
      "1",
      (user as any)?.account_id,
      {
        title: "Dark",
        media: "bafybeifdbvb6yzajogbe4dbn3bgxoli3sp7ol7upfmu2givpvbwufydthu",
        reference:
          "bafybeifvzitvju4ftwnkf7w7yakz7i5colcey223uk2ui4t5z3ss7l2od4",
        copies: 100,
        description: null,
        media_hash: null,
        issued_at: null,
        expires_at: null,
        starts_at: null,
        updated_at: null,
        extra: null,
        reference_hash: null,
      },
      null
    );
  };

Use Paras NFT Contract Series

Note: For more details regarding Paras' series, nft usage, and metadata, you can visit https://docs.paras.id/

Create NFT series

const createNFTSeries = async () => {
    await client.client.nft.nftCreateSeries(
      {
        title: "Dark",
        media: "bafybeifdbvb6yzajogbe4dbn3bgxoli3sp7ol7upfmu2givpvbwufydthu",
        reference:
          "bafybeifvzitvju4ftwnkf7w7yakz7i5colcey223uk2ui4t5z3ss7l2od4",
        copies: 100,
        description: null,
        media_hash: null,
        issued_at: null,
        expires_at: null,
        starts_at: null,
        updated_at: null,
        extra: null,
        reference_hash: null,
      },
      "0",
      {}
    );
  };

Mint NFT Series

const onMintNFTSeries = async () => {
    await client.client.nft.nftMintSeries("1363", null);
};

Standard functions

Transfer NFT

const transferNFT = async () => {
  const res = await client.client.nft.nftTransfer(
    "paras-token-v1.testnet",
    "1363:1",
    "orang.testnet"
  );
  console.log("res", res);
};

View NFT Metadata

const viewNFTMetadata = async () => {
  const res = await client.client.nft.nftToken(
    "paras-token-v1.testnet",
    "1363:1",
  );
  console.log("tokenDetails", res);
};

Last updated