Skip to content

Instantly share code, notes, and snippets.

@slavafomin
Last active June 14, 2022 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slavafomin/e09e569fd8a89e9eb544b981e35e3181 to your computer and use it in GitHub Desktop.
Save slavafomin/e09e569fd8a89e9eb544b981e35e3181 to your computer and use it in GitHub Desktop.
Get TON NFT item content
import TonWeb from 'tonweb';
(async () => {
const tonweb = new TonWeb(
new TonWeb.HttpProvider()
);
const nftCollection = new TonWeb.token.nft.NftCollection(tonweb.provider, {
address: 'EQCvYf5W36a0zQrS_wc6PMKg6JnyTcFU56NPx1PrAW63qpvt',
royaltyFactor: 0,
royaltyBase: 0,
});
const itemAddress = await nftCollection.getNftItemAddressByIndex(0);
const nftItem = new TonWeb.token.nft.NftItem(tonweb.provider, {
address: itemAddress,
});
const content = (await nftCollection
.getNftItemContent(nftItem)
);
console.log(content.contentUri);
// https://richcats.app/api/cat/bg0026:bd0026:ey0060:te0001:wh0002/json
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment