How to Create a Non-Fungible Token?

  • create

This function is used to Create a new NFT token.

import { L1XProvider, NFTTokenCreateArg } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
  endpoint: "https://v2-mainnet-rpc.l1x.foundation"
});

let params: NFTTokenCreateArg = {
  private_key: "YOUR_PRIVATE_KEY",
  attrib: {
      baseContract: "e0fb1d19187bb01363b46edc4b9a123ca45e3fb1",
      name: "My NFT Token",
      symbol: "NFT",
      icon:"ipfs://iconpath",
      uri:"ipfs://urlpath"
    },
    fee_limit: 100000000000000000
    
};

l1xProvider.tokens.NFT.create(params)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err)); // log error

Parameters:

The transfer details object

{
  private_key: "YOUR_PRIVATE_KEY",
  attrib: {
      baseContract: "e0fb1d19187bb01363b46edc4b9a123ca45e3fb1",
      name: "My NFT Token",
      symbol: "NFT",
      icon:"ipfs://iconpath",
      uri:"ipfs://urlpath"
    },
    fee_limit: 100000000000000000
    
};

Returns:

A promise that resolves when the transaction is submitted.

{
     "hash": "dc224ba854d5fbd3371f6d509b9a0b5451fff78a70ad3a209b5c273f8da0abfb",
     "address": "cf0289e86714d97979d726eeb2fa3a23b9c007c1"
}

Last updated