🔗listNFT

Description

The listNFT function is used to list a non-fungible token (NFT) for sale on a decentralized marketplace.

It takes in various parameters, including the blockchain on which the NFT exists, the user's private key for that blockchain, the ID of the token, the price at which it is to be sold, the duration of any bidding period (if applicable), whether it is being listed for auction, and the address of the NFT contract.

Parameters

NameTypeDescription

blockchain

string

The blockchain on which the NFT exists.

privateKey

string

The private key of the user making the listing.

tokenId

string

The ID of the NFT to be listed.

price

string

The price at which the NFT is to be listed.

biddingDuration

string

The duration of any bidding period (if applicable), in seconds.

forAuction

boolean

Whether the NFT is being listed for auction.

nftAddress

string

The address of the NFT contract.

Response

NameTypeDescription

code

number

The status code of the response (1 for success, 0 for failure).

receipt

string

The transaction hash of the listing transaction on the blockchain.

error

string

The error message if the operation fails.

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 listNFT request using the Nest SDK:

const {NftMarketPlace} = require('@nest25/evm-chains-lib')
// create instance of SOULBOUND
const nftMarketPlace = new NftMarketPlace();
const privateKey = "your private key here"
// nft contract address
let nftContract = '0xaa223c2379daf21526925a07fe466fad7269103a';

const main = async () => {
    // list nft
    const contract = await nftMarketPlace.listNFT(
        'klay', 
        privateKey,
        "1",
        "1",
        "0",
        false,
        nftContract
    );
    // print result
    console.log(contract);
}
main()

Response

 

Use Cases

  • Crypto Wallets: The function can be used by crypto wallets to allow their users to list their NFTs for sale on decentralized marketplaces.

  • Online Marketplaces: The function can be used by online marketplaces to create a decentralized marketplace for NFTs.

  • NFT Platforms: The function can be used by NFT platforms to allow their users to sell their NFTs on third-party marketplaces.

Last updated