🔗transfer

Description

The transfer function is an asynchronous function that facilitates the transfer of assets or tokens for a given contract on a specified blockchain.

Parameters

ParameterData TypeDescription

contract

string

The type of contract ('ERC721', 'ERC1155', 'ERC20').

blockchain

string

The name or symbol of the blockchain.

contractAddress

string

The address of the contract on the blockchain.

privateKey

string

The private key of the sender's account.

params

object

The transfer parameters containing information such as the receiver's address, amount, token ID, and additional data. The structure of the transferParams object may vary depending on the contract type and implementation.

env

string

The environment or network where the contract exists (e.g., 'mainnet', 'testnet').

Response

FieldData TypeDescription

code

number

A numeric value indicating the execution status (1 for success, 0 for error).

error

any

The error object containing details about the encountered error, if applicable.

deployedContract

any

The result object containing the outcome of the transfer operation. The structure of the deployedContract object may vary depending on the contract type and implementation.

tokenId

any

The token ID associated with the transferred asset or token.

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 bulkMint request using the NEST® SDK:

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

const nft = new Nft('testnet');
const privateKey = "your private key"

async function main() {
    const params = {
        receiver:"0x3624AcFD985d984Be37f448a49dfCC0F014A1EeF",
        tokenId:"0"
    };
    const result = await nft.transfer(
        "erc721",
        "klay",
        "0x7a0f416cae7bd4d4f9112a6bb609423290d2945e",
        privateKey,
        params,
    );
    console.log(result);
}

main();

Response

{
  receipt: {
    type: 2,
    chainId: 1001,
    nonce: 230,
    maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
    maxFeePerGas: BigNumber { _hex: '0x0bdfd63e00', _isBigNumber: true },
    gasPrice: null,
    gasLimit: BigNumber { _hex: '0x281d66', _isBigNumber: true },
    to: '0x83F1ceC2f0526427330775A6CD2FC15B52eaA0cE',
    value: BigNumber { _hex: '0x00', _isBigNumber: true },
    data: '0x9d2450a6000000000000000000000000000000000000000000000000000000000000006400000000000000000000000013cc66d6611bb754647bf2977881ea0e35a48fb4',
    accessList: [],
    hash: '0x4954973368c1ded4b90ae336b9f5168e9cc2be6e57396eb68f45f1338cc92546',
    v: 1,
    r: '0x8425bb110cf1b321b8bc73f87178cbbef92a2e9fec696035084f5f83a41e017e',
    s: '0x2ed9bbbbe486d2c0dc286692155725b488c1b4462f485c98e096b973e7bfeba8',
    from: '0xE668C72D4C67236A712Ce69A91C74358586f31ed',
    wait: [Function (anonymous)]
  }
}

Use Cases

  • The transfer function can be used to transfer assets or tokens from one account to another on a specified blockchain. It supports different contract types such as ERC721, ERC1155, and ERC20. By providing the necessary parameters, such as the contract type, blockchain, contract address, private key, transfer parameters (e.g., receiver's address, amount, token ID, additional data), and environment, the function performs the transfer operation and returns the result.

Last updated