⛏️deployNFTContract

Description

The deployNFTContract function is a JavaScript function that facilitates the deployment of a new NFT contract on the Casper blockchain. The function uses the CasperClient and CEP47Client libraries to create and deploy the contract on the blockchain.

Parameters

Name
Type
Description

RPC_API

string

The URL of the RPC API for the Casper network

privateKey

string

The user's private key for the Casper network

contractName

string

The name of the NFT contract to be deployed

tokenName

string

The name of the NFT token

symbol

string

The symbol of the NFT token

metadata

string

The metadata for the NFT token

Response

Name
Type
Description

contractDeployResult

object

The contract deployment result containing the hash, contract, and other relevant information

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/casper-lib
OR
yarn add @nest25/casper-lib

Request

Here is an example of how to make a deployNFTContract request using the Nest SDK:

// import Nest25 Casper library
const { Casper } = require('@nest25/casper-lib');
// create a new Casper instance
const casper = new Casper();

// set testnet variables
const privateKey = 'your-private-key';
const RPC_API = 'https://rpc.testnet.casperlabs.io/rpc';

async function main() {
  // contract name for nft contract
  const contractName = 'RWSCT NFT Contract';
  // token name for nft contract
  const tokenName = 'Real World Smart Contract Token';
  // token symbol for nft contract
  const symbol = 'RWSCT';
  // metadata for nft contract
  const metadata = 'name RWSCT, description NFT_Contract, image img, royalty null, royaltyReceiver null';
  // deploy nft contract
  const txHash = await casper.deployNFTContract(RPC_API, privateKey, contractName, tokenName, symbol, metadata);
  // print txHash
  console.log(`Contract hash: ${txHash.hash}`);
}
// call main function
main();

Response

    {
        hash: '20366757cf99cd8bb3db1ff2bb3b515dbb1a603bfba1e8633eab7b5cd310d4e0'
    }

Use Cases

  • NFT Marketplaces: The function can be used by NFT marketplaces to deploy new NFT contracts on the Casper blockchain.

  • Individual Creators: The function can be used by individual creators to deploy their own NFT contracts and tokens on the Casper blockchain.

  • Businesses: The function can be used by businesses to deploy their own branded NFT contracts and tokens on the Casper blockchain for promotional and marketing purposes.

Last updated