When withdrawing a NFT from sale, a request will be sent to the end user
/* Update the fields with your informations */consttokenId='0.0.123456'; /* token Id of the NFT */constnftIds= ['1@0.0.123456']; /* array of the nftIds to withdraw */awaitclient.deleteNFTFromSale({tokenId, nftIds});
Step 3: Listen for the NFT's removal
Finally get notified when your NFT has been successfully withdrawn from sale!
/* Subscribe to new sale NFT Validation */client.deleteSellNFTValidation().subscribe(nft => {console.log('NFT successfully removed from sale', nft);});
Code Check ✅
Your index.js file should look like this:
const { Client,CategoryNFT } =require("@xact-wallet-sdk/client");require("dotenv").config();asyncfunctionremoveNFTFromSale() {//Grab your api key from your .env fileconstapiKey=process.env.API_KEY;// If we weren't able to grab it, we should throw a new errorif (apiKey ==null) {thrownewError("Environment variables API_KEY must be present"); }/* Create a new instance of Client */constclient=newClient({apiKey});/* Init the connexion */awaitclient.initConnexion();/* Update the fields with your informations */consttokenId='0.0.123456'; /* token Id of the NFT */constnftIds= ['1@0.0.123456']; /* array of the nftIds to withdraw */awaitclient.deleteNFTFromSale({tokenId, nftIds});/* Subscribe to new sale NFT Validation */client.deleteSellNFTValidation().subscribe(nft => {console.log('NFT successfully removed from sale', nft); });}removeNFTFromSale();