📌transfer

Description

The transfer function transfers a specified ERC721 token with the given token ID from the caller's wallet to the specified receiver address and returns the transaction receipt.

Parameters

Parameter
Type
Description

blockchain

string

Specifies the name of the blockchain network (e.g. eth, bsc, polygon, ava, gnosis, moonbeam)

contractAddress

string

The address of the deployed ERC721 contract

tokenId

string

The ID of the ERC721 token to be transferred

receiver

string

The receiving address for the token transfer

privateKey

string

The private key of the account used to sign the transaction

Response

Property
Type
Description

Promise<Object>

object

Returns the transaction receipt object for the transfer of ERC721 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 transfer request using the NEST® SDK:

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

// create a new instance of the ERC721 class
const erc721 = new ERC721();

// define the main function
const main = async () => {
    // call the transfer function
    const receipt = await erc721.transfer(
        'klay',
        '0xe668c72d4c67236a712ce69a91c74358586f31ed',
        '0',
        '0x5aAB360f4eEC9C823175711d22D7D0C920D4481a',
        'your-private-key',
    );

    // print the receipt
    console.log({receipt});
};
// call the main function
main();

Response

{
  receipt: {
    type: 2,
    chainId: 1001,
    nonce: 243,
    maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
    maxFeePerGas: BigNumber { _hex: '0x0bdfd63e00', _isBigNumber: true },
    gasPrice: null,
    gasLimit: BigNumber { _hex: '0x7918', _isBigNumber: true },
    to: '0xE668C72D4C67236A712Ce69A91C74358586f31ed',
    value: BigNumber { _hex: '0x00', _isBigNumber: true },
    data: '0x23b872dd000000000000000000000000e668c72d4c67236a712ce69a91c74358586f31ed0000000000000000000000005aab360f4eec9c823175711d22d7d0c920d4481a0000000000000000000000000000000000000000000000000000000000000000',
    accessList: [],
    hash: '0x92ee1f4fc09bc4a8339d229cb744195096769825a221cb56ae6d8539ff64870e',
    v: 1,
    r: '0x63e80e4d17176063699cb6fd63654bb12ed0eafabc6a984d0c4d88d383199190',
    s: '0x650d0ae0d9f59dce63bb4539e27d0b999f94da3f11e906ab5b1d71fb539b7764',
    from: '0xE668C72D4C67236A712Ce69A91C74358586f31ed',
    wait: [Function (anonymous)]
  }
}

Use Cases

  • NFT transfer: The transfer function can be used to transfer a specific ERC721 NFT from one address to another on a given blockchain network.

  • Marketplace transactions: The transfer function can be used in NFT marketplaces to transfer ownership of ERC721 tokens between different users.

  • Auction bidding: The transfer function can be used to transfer ERC721 tokens as part of auction bidding in a decentralized manner.

Last updated