nft_uri
Get the URI of the token ID.
Through nft_uri, you can fetch the original URI information,
contractAddress
and tokenId
are necessary. Supported on Ethereum, BNB Chain, Optimism, and Arbitrum.
Object
- An object with the following fields (required):contractAddress(hex string, required)
- the contract address of the collection. BlockVision currently support both ERC721 and ERC1155.tokenId(string, required)
- id of the NFT.blockNumber(integer number, optional)
- specify the blockNumber for snapshot query (default latest). BlockVision can not only support users to query the current position, but also support users to query the historical information at any time.
Object
- An object with the following fields:id(integer number)
- json-rpc id.jsonrpc(string)
- json-rpc versionresult(object)
- an object with the following fields:URI(string)
- the token uri of the nft token.
curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "nft_uri",
"params": {
"contractAddress": "0x495f947276749Ce646f68AC8c248420045cb7b5e",
"tokenId": "49130440647659772150626580756595337563119039889199175888700692953658833240065",
"blockNumber": 0
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ETH_MAINNET)
// Access the BlockVision NFT API
bv.getNFTUri({
contractAddress: '0x495f947276749Ce646f68AC8c248420045cb7b5e',
tokenId: '49130440647659772150626580756595337563119039889199175888700692953658833240065',
blockNumber: 0
}).then(console.log)
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"URI": "ipfs://QmSnQ4CKfkmUx9bs8yTymmU1nDBkboCWCV2LN33UdDR2XT/1"
}
}
Last modified 1mo ago