🔗deployContract

Description

The deployContract function is an asynchronous function that deploys a contract on a specified blockchain.

It deploys different types of contracts based on the provided contract type, blockchain, and other parameters. The function utilizes other contract-specific deployment functions to handle the deployment process.

Parameters

Response

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:

const { Nft } = require('@nest25/evm-chains-lib');

const nft = new Nft('testnet');
const privateKey = '0xYOUR_PRIVATE_KEY';

async function main() {
    const params = {
        name: 'TEST',
        symbol: 'TST',
    };
    const result = await nft.deployContract('erc721', 'klay', privateKey, params);
    console.log('result', result.hash);
}

main();

Response

0xd56417a007ee79523c26ef47175104be43afd3f460a4c78938f2804ecd8fb069

Use Cases

  • Deploying an ERC721 contract: This function deploys an ERC721 contract on the specified blockchain, using the provided private key and deployment environment.

  • Deploying an ERC1155 contract: If the contract type is ERC1155, this function deploys an ERC1155 contract on the target blockchain.

  • Deploying an ERC20 contract: For the ERC20 contract type, this function deploys an ERC20 contract with the specified maximum cap, name, symbol, private key, and deployment environment.

  • Deploying a SoulBound contract: If the contract type is SoulBound, this function deploys a SoulBound contract with the specified name, symbol, private key, and deployment environment.

  • Handling unsupported contract types: If the provided contract type is not supported, the function returns an error indicating that the contract type is not supported.

Last updated