Sell a NFT
Prerequisites:
Getting startedStep 1: Import the following modules
const { Client, CategoryNFT } = require("@xact-wallet-sdk/client");
require("dotenv").config();Step 2: Initializing
/* Update the fields with your informations */
const fromAccountId = '' /* Account Id of the Seller */
const hbarAmount = 10 /* Unit Price per NFT in Hbar */
const nftIds = ['1@0.0.123456'] /* Array of nftIds to sell */
/* You can specify a quantity if you prefer to let us choose randomly for you */
/* But nftIds field cannot be set with quantity */
const tokenId = ''; /* token Id of the NFT */
const isCollection = ''; /* Sell the nftIds under one QR Code */
/* Optional NOT YET AVAILABLE - The NFT could only be sell to accountId present on that list */
const accountIds = ['', ''];
/* Optional - Add a middle men in order to collect fees */
const middleMen = {
middleManAccountId,
middleManTypeOfFees: MiddleManFeesType.HBAR,
middleManFees: 10
};
/* If you're selling by nftIds replace quantity by ndtIds */
await client.sellNFT({fromAccountId, nftIds, hbarAmount, tokenId, accountIds, isCollection, middleMen});Step 3: Listen for the NFT's sell
Code Check ✅
Last updated