📌deployContract

Description

The deployContract function deploys an ERC-1155 token contract on a specified blockchain network with a specified baseUri and returns the deployed contract.

Parameters

ParameterTypeDescription

blockchain

string

Specifies the name of the blockchain network on which the contract will be deployed (For eg. bsc, polygon, eth, ava, gnosis, moonbeam)

privateKey

string

The private key of the account used to deploy the contract

baseUri

string

The base URI for the contract metadata. This is used to retrieve additional information about the contract such as the name, symbol, and description.

Response

PropertyTypeDescription

Promise<Object>

object

Returns the deployed contract object.

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

Request

Here is an example of how to make a deployContract request using the NEST® SDK:

// import the Nest SDK
const { ERC1155 } = require('@nest25/evm-chains-lib');

// create a new instance of the ERC1155 class
const erc1155 = new ERC1155();

// define the main function
const main = async () => {
    // deploy the contract
    const contract = await erc1155.deployContract(
        'klay',
        'your-private-key',
        'baseUri',
    );

    // print the contract address and transaction hash
    console.log(`Contract deployed at ${contract.address}. Transaction hash: ${contract.deployTransaction.hash}`);
};
// call the main function
main();

Response

Contract deployed at 0xe6811ffc22D567A0267B5260211C34074e091022. Transaction hash: 0x99916877816ce81f0091a5107282b077d9f637824bf9291c355762bee4b13713

Use Cases

  • Contract deployment: The primary use case for the deployContract function is to deploy a new smart contract on a specified blockchain network, using the provided erc11155Abi and erc11155ByteCode to generate the contract code.

  • Token issuance: The deployed contract can be used to issue new tokens on the specified blockchain network, which can be used for various purposes such as rewards, governance, or utility tokens.

Last updated