Buy an NFT from a marketplace
Prerequisites
Buy an NFT on a marketplace using Ternoa-JS
import {
buyNft,
initializeApi,
getKeyringFromSeed,
WaitUntil,
} from "ternoa-js";
const buyNft = async () => {
try {
await initializeApi();
const keyring = await getKeyringFromSeed("//TernoaTestAccount");
const NFT_ID = // update with the nft id you want to buy.
const res = await buyNft(
NFT_ID,
keyring,
WaitUntil.BlockInclusion
);
console.log(`NFT id: ${res.nftId} bought for ${res.listedPriceRounded}CAPS on marketplace ${res.marketplaceId}.`);
} catch (e) {
console.error(e);
}
};The expected params
Response
Support
Last updated