Unanswered
First, pick an endpoint for the http-api. There are many places you can get this:
https://ton.org/docs/develop/dapps/apis/
Then, you can query the specific API of the NFT's metadata in accordance to the TEP-0062 standard:
https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md#get-methods-1
From your question, I'm assuming you want to do this on the web. To do this, the TONWeb SDK has some options for you.
const NftCollection = TonWeb.token.nft.NftCollection;
const NftItem = TonWeb.token.nft.NftItem;
const nftCollection = new NftCollection(provider, {
ownerAddress: walletAddress,
nftItemCodeHex: NftItem.codeHex
})
const nftCollectionAddress = await nftCollection.getAddress()
const getNftCollectionInfo = async () => {
const data = await nftCollection.getCollectionData()
console.log(data)
}
Here's the testing script for NFTs in the TonWeb package:
https://github.com/toncenter/tonweb/blob/master/src/test-nft.js
103 Views
0
Answers
one year ago
one year ago
Hi, thanks, but shouldn't it be:
tonweb.provider
instead of justprovider
? Since it gives "provider not defined".const nftCollection = new NftCollection(tonweb.provider, { ownerAddress: walletAddress, nftItemCodeHex: NftItem.codeHex })
Also, this
const nftCollectionAddress = await nftCollection.getAddress();
gives thisTypeError: Cannot read properties of undefined (reading 'length')
why so?