This section explains how to retrieve detailed information about a specific collectible asset using the Asset API. Collectibles are digital assets stored on the blockchain, and this functionality allows you to fetch comprehensive data about individual assets within a collection.
Properties
collectionId
Collection ID for the asset.
-
A root collection id:
7672:root:303204
-
An xrpl collection id, where rhMF5EWPpv6tn29fYF9x5Ny7Srs6x8x4iR
is the collection creator’s address
99992:xrpl:rhMF5EWPpv6tn29fYF9x5Ny7Srs6x8x4iR
tokenId
Token ID for the asset.
- A root collection token id:
232
- An xrpl collection token id:
0008000024D8861E377F08A0317E4D6538C72759CABF2BFF7136881E00218B83
import React from 'react'
import { useGetAsset } from '@futureverse/asset-register-react/v2'
const collectionId = "7672:root:303204"
const tokenId = "232"
export const AssetList = () => {
const { asset } = useGetAsset(
{ collectionId, tokenId },
{
enabled: !!address,
refetchOnWindowFocus: false,
},
)
if (!asset) {
return null
}
return (
<Asset asset={asset} />
)
}
import React from 'react'
import { useGetAsset } from '@futureverse/asset-register-react/v2'
const collectionId = "7672:root:303204"
const tokenId = "232"
export const AssetList = () => {
const { asset } = useGetAsset(
{ collectionId, tokenId },
{
enabled: !!address,
refetchOnWindowFocus: false,
},
)
if (!asset) {
return null
}
return (
<Asset asset={asset} />
)
}
import { AssetRegister } from '@futureverse/asset-register/v2'
import { AssetModel } from '@futureverse/asset-register/models';
const ar = new AssetRegister({
...
})
const collectionId = "7672:root:303204"
const tokenId = "232"
const asset = await ar.asset({
collectionId,
tokenId
}).execute()[0] as AssetModel
<pre class="language-graphql">
<code class="lang-graphql">
query GetAsset($tokenId: String!, collectionId: CollectionId!) {
asset(tokenId: tokenId, collectionId: collectionId) {
metadata {
id
uri
properties
attributes
rawAttributes
}
collectionId
id
tokenId
schema {
id
namespace
version
name
schema
}
assetType
assetTree {
id
data
nodeId
}
collection {
id
chainId
chainType
location
name
}
}
}
</code>
</pre>
{
"tokenId": "232",
"collectionId": "7672:root:303204"
}