Last active
June 14, 2022 17:58
-
-
Save slavafomin/e09e569fd8a89e9eb544b981e35e3181 to your computer and use it in GitHub Desktop.
Get TON NFT item content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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