Asset Tree
Asset Tree
Example
{
"@context": {
"@vocab": "http://schema.futureverse.com#",
"schema": "http://schema.org/",
"fvp": "http://schema.futureverse.com/fvp#",
"fv": "http://schema.futureverse.com/fv#",
"tnl": "http://schema.futureverse.com/tnl#"
},
"@graph": [
{
"@id": "did:fv-asset:1:evm:0x6bca6de2dbdc4e0d41f7273011785ea16ba47182:1211",
"@type": "tnl:Boxer",
"fv:equippedWith_brain": {
"@id": "did:fv-asset:1:evm:0xd0318da435dbce0b347cc6faa330b5a9889e3585:1211"
},
"fv:equippedWith_hairStyle": {
"@id": "did:fv-asset:off-chain:60163ecf-ae7b-4eb5-a78c-31d825322613:2:2"
},
"tnl:equippedWith_leftGlove": {
"@id": "did:fv-asset:7668:10420:2"
},
"tnl:equippedWith_rightGlove": {
"@id": "did:fv-asset:7668:10420:1"
}
},
{
"@id": "did:fv-asset:1:evm:0xd0318da435dbce0b347cc6faa330b5a9889e3585:1211",
"@type": "fv:ASMBrain",
"fv:equippedWith_memory": {
"@id": "did:fv-asset:off-chain:60163ecf-ae7b-4eb5-a78c-31d825322613:1:10"
}
},
{
"@id": "did:fv-asset:off-chain:60163ecf-ae7b-4eb5-a78c-31d825322613:1:10",
"@type": "fv:ASMMemory"
},
{
"@id": "did:fv-asset:off-chain:60163ecf-ae7b-4eb5-a78c-31d825322613:2:2",
"@type": "tnl:HairStyle"
},
{
"@id": "did:fv-asset:7668:10420:1",
"@type": "tnl:Glove",
},
{
"@id": "did:fv-asset:7668:10420:2",
"@type": "tnl:Glove",
}
]
}
Visualization
NFT Links object
Each NFT token is unique and indivisible, representing a one-of-a-kind digital asset like artwork, collectibles, or in-game items. the asset type of the NFT is ERC721
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODo1",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2h0dHA6Ly9zY2hlbWEuZnV0dXJldmVyc2UuZGV2L3RubCNlcXVpcFdpdGhfYXNtQnJhaW46NzY3Mjpyb290OjI4Mzc0ODo1",
"path": "http://schema.futureverse.com/path#http://schema.futureverse.dev/tnl#equipWith_asmBrain"
}
SFT Links object
This SFT is an extension of NFT, offering more flexibility. It allows for the creation of both fungible and non-fungible tokens within a single smart contract. Fungible tokens are like regular currency; they can be divided and are interchangeable. The asset type of the SFT is ERC1155
eg.
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI5MTk0MDow",
"assetType": "ERC1155"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2VxdWlwV2l0aF9zaG91bGRlcnM6NzY3Mjpyb290OjI5MTk0MDow",
"path": "http://schema.futureverse.com/path#equipWith_shoulders"
}
Properties
addresses
addresses
A list of addresses used to query the linked SFT Assets.
eg.
[
"0x2D2438C6281B5115733287fC279f854c868D3ee2",
"0xFFFFFfFF00000000000000000000000000000417"
]
collectionId
collectionId
A collection ID to query the asset.
e.g. 7672:root:303204
tokenId
tokenId
A token ID to query the asset.
eg. 232
import { AssetModel } from '@futureverse/asset-register'
import { useGetAssetTree } from '@futureverse/asset-register-react/v2'
import { CollectionId } from '@futureverse/asset-register/types/collection'
import { AssetTreePath } from '@futureverse/asset-register/v2/lib/AssetTreePath'
const collectionId = '7672:root:303204' as CollectionId
const tokenId = '232'
export const AssetTree = async () => {
const { assetTrees: assetTree } = useGetAssetTree({ tokenId, collectionId })
// you should get some paths from the assetTree
// [
// 'http://schema.futureverse.com#equippedWith_accessoryClothing',
// 'http://schema.futureverse.com#equippedWith_accessoryEyewear',
// 'http://schema.futureverse.com#equippedWith_accessoryHead',
// 'http://schema.futureverse.com#equippedWith_accessoryMouth',
// 'http://schema.futureverse.com#equippedWith_accessoryNose',
// 'http://schema.futureverse.com/fvp#sft_link_owner_0x225b5333c2d8ec41f40d6463d44141786c2c4463',
// ]
const paths = assetTree?.paths
const assetTreePath = (await assetTree?.getPath(
'http://schema.futureverse.com#equippedWith_accessoryClothing',
)) as AssetTreePath
// get the asset from the path
const asset = (await assetTreePath.getAsset()) as AssetModel
return <Asset asset={asset} />
}
import { AssetRegister, AssetTreeClass } from '@futureverse/asset-register/v2'
import {
CollectionId,
} from '@futureverse/asset-register/types'
import { AssetModel } from '@futureverse/asset-register'
import { AssetTreePath } from '@futureverse/asset-register/v2/lib/AssetTreePath'
const collectionId = '7672:root:303204' as CollectionId
const tokenId = '51'
const ar = new AssetRegister({
...
})
const result = await ar
.assetTree({
tokenId
collectionId
})
.execute()
const assetTree = (await result[0]) as AssetTreeClass
// you should get some paths from the assetTree
// [
// 'http://schema.futureverse.com#equippedWith_accessoryClothing',
// 'http://schema.futureverse.com#equippedWith_accessoryEyewear',
// 'http://schema.futureverse.com#equippedWith_accessoryHead',
// 'http://schema.futureverse.com#equippedWith_accessoryMouth',
// 'http://schema.futureverse.com#equippedWith_accessoryNose',
// 'http://schema.futureverse.com/fvp#sft_link_owner_0x225b5333c2d8ec41f40d6463d44141786c2c4463',
// ]
const paths = assetTree?.paths
const assetTreePath = (await assetTree?.getPath(
'http://schema.futureverse.com#equippedWith_accessoryClothing',
)) as AssetTreePath
// get the asset from the path
const asset = (await assetTreePath.getAsset()) as AssetModel
console.log(asset)
query AssetTreeQuery($tokenId: String!, $collectionId: CollectionId!, $addresses: [ChainAddress!]!) {
asset(tokenId: $tokenId, collectionId: $collectionId) {
assetTree {
data
id
nodeId
}
assetType
metadata {
id
uri
properties
attributes
rawAttributes
}
links {
... on SFTAssetLink {
id
parentLinks(addresses: $addresses) {
id
metadata {
id
uri
properties
attributes
rawAttributes
}
}
}
... on NFTAssetLink {
id
parentLink {
metadata {
id
uri
properties
attributes
rawAttributes
}
id
}
childLinks {
asset {
id
assetType
}
id
path
}
}
}
}
}
{
"tokenId": "11112",
"collectionId": "5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50",
"addresses": ["0x8f10f8b20285119a8d89e7a5daf35d9ad71688fa"]
}
{
"data": {
"asset": {
"assetTree": {
"data": {
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"fv": "http://schema.futureverse.com#",
"schema": "http://schema.org/",
"path": "http://schema.futureverse.com/path#"
},
"@graph": [
{
"@id": "did:fv-asset:7672:root:291940:0",
"rdf:type": {
"@id": "http://schema.futureverse.com#None"
}
},
{
"@id": "did:fv-asset:7672:root:283748:6",
"rdf:type": {
"@id": "http://schema.futureverse.com#None"
}
},
{
"@id": "did:fv-asset:5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50:1111",
"rdf:type": {
"@id": "http://schema.futureverse.dev/tnl#Boxer"
},
"path:equipWith_asmBrain": {
"@id": "did:fv-asset:7672:root:283748:6"
},
"path:futurepass_owner_link_0xffffffff000000000000000000000000000004fc_0x2c49f7845620faf5ea015745b1bb1f569970f867": {
"@id": "did:fv-asset:7672:root:283748:6"
}
},
{
"@id": "did:fv-asset:5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50:11112",
"http://schema.futureverse.com/fvp#sft_link_owner_0x2c49f7845620faf5ea015745b1bb1f569970f867": {
"@id": "did:fv-asset:7672:root:291940:0"
},
"path:equipWith_asmBrain": {
"@id": "did:fv-asset:7672:root:283748:5"
},
"path:equippedWith_head": {
"@id": "did:fv-asset:7672:root:283748:18"
},
"path:http://schema.futureverse.dev/tnl#equipWith_asmBrain": {
"@id": "did:fv-asset:7672:root:283748:5"
},
"path:http://schema.futureverse.dev/tnl#http://schema.futureverse.dev/tnl#equipWith_asmBrain": {
"@id": "did:fv-asset:7672:root:283748:5"
},
"path:equippedWith_bag": {
"@id": "did:fv-asset:7672:root:283748:19"
},
"path:equipWith_shoulders": {
"@id": "did:fv-asset:7672:root:291940:0"
},
"path:balance": "6",
"path:index": "1",
"path:equipWith_braces": {
"@id": "did:fv-asset:5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50:1111"
}
},
{
"@id": "did:fv-asset:7672:root:283748:5",
"rdf:type": {
"@id": "http://schema.futureverse.com#None"
}
}
]
},
"id": "QXNzZXRUcmVlOmRpZDpmdi1hc3NldDo1OmV2bToweDUwODVjYzAyMzZhZTEwODgxMjU3MWVhZGYyNGJlZWU0ZmU4ZTBjNTA6MTExMTI=",
"nodeId": "did:fv-asset:5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50:11112"
},
"assetType": "ERC721",
"metadata": {
"id": "TWV0YWRhdGE6NTpldm06MHg1MDg1Y2MwMjM2YWUxMDg4MTI1NzFlYWRmMjRiZWVlNGZlOGUwYzUwOjExMTEy",
"uri": null,
"properties": null,
"attributes": null,
"rawAttributes": null
},
"links": {
"id": "TkZUQXNzZXRPd25lcnNoaXA6NTpldm06MHg1MDg1Y2MwMjM2YWUxMDg4MTI1NzFlYWRmMjRiZWVlNGZlOGUwYzUwOjExMTEy",
"parentLink": null,
"childLinks": [
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODo2",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2VxdWlwV2l0aF9hc21CcmFpbjo3NjcyOnJvb3Q6MjgzNzQ4OjY=",
"path": "http://schema.futureverse.com/path#equipWith_asmBrain"
},
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODo2",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2Z1dHVyZXBhc3Nfb3duZXJfbGlua18weGZmZmZmZmZmMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA0ZmNfMHgyYzQ5Zjc4NDU2MjBmYWY1ZWEwMTU3NDViMWJiMWY1Njk5NzBmODY3Ojc2NzI6cm9vdDoyODM3NDg6Ng==",
"path": "http://schema.futureverse.com/path#futurepass_owner_link_0xffffffff000000000000000000000000000004fc_0x2c49f7845620faf5ea015745b1bb1f569970f867"
},
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODo1",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2VxdWlwV2l0aF9hc21CcmFpbjo3NjcyOnJvb3Q6MjgzNzQ4OjU=",
"path": "http://schema.futureverse.com/path#equipWith_asmBrain"
},
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODoxOA==",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2VxdWlwcGVkV2l0aF9oZWFkOjc2NzI6cm9vdDoyODM3NDg6MTg=",
"path": "http://schema.futureverse.com/path#equippedWith_head"
},
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODo1",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2h0dHA6Ly9zY2hlbWEuZnV0dXJldmVyc2UuZGV2L3RubCNlcXVpcFdpdGhfYXNtQnJhaW46NzY3Mjpyb290OjI4Mzc0ODo1",
"path": "http://schema.futureverse.com/path#http://schema.futureverse.dev/tnl#equipWith_asmBrain"
},
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODo1",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2h0dHA6Ly9zY2hlbWEuZnV0dXJldmVyc2UuZGV2L3RubCNodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmRldi90bmwjZXF1aXBXaXRoX2FzbUJyYWluOjc2NzI6cm9vdDoyODM3NDg6NQ==",
"path": "http://schema.futureverse.com/path#http://schema.futureverse.dev/tnl#http://schema.futureverse.dev/tnl#equipWith_asmBrain"
},
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI4Mzc0ODoxOQ==",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2VxdWlwcGVkV2l0aF9iYWc6NzY3Mjpyb290OjI4Mzc0ODoxOQ==",
"path": "http://schema.futureverse.com/path#equippedWith_bag"
},
{
"asset": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI5MTk0MDow",
"assetType": "ERC1155"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2VxdWlwV2l0aF9zaG91bGRlcnM6NzY3Mjpyb290OjI5MTk0MDow",
"path": "http://schema.futureverse.com/path#equipWith_shoulders"
},
{
"asset": {
"id": "QXNzZXQ6NTp1bmRlZmluZWQ=",
"assetType": null
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2JhbGFuY2U6NTp1bmRlZmluZWQ=",
"path": "http://schema.futureverse.com/path#balance"
},
{
"asset": {
"id": "QXNzZXQ6Njp1bmRlZmluZWQ=",
"assetType": null
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2JhbGFuY2U6Njp1bmRlZmluZWQ=",
"path": "http://schema.futureverse.com/path#balance"
},
{
"asset": {
"id": "QXNzZXQ6MDp1bmRlZmluZWQ=",
"assetType": null
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2luZGV4OjA6dW5kZWZpbmVk",
"path": "http://schema.futureverse.com/path#index"
},
{
"asset": {
"id": "QXNzZXQ6MTp1bmRlZmluZWQ=",
"assetType": null
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2luZGV4OjE6dW5kZWZpbmVk",
"path": "http://schema.futureverse.com/path#index"
},
{
"asset": {
"id": "QXNzZXQ6NTpldm06MHg1MDg1Y2MwMjM2YWUxMDg4MTI1NzFlYWRmMjRiZWVlNGZlOGUwYzUwOjExMTE=",
"assetType": "ERC721"
},
"id": "TGluazpodHRwOi8vc2NoZW1hLmZ1dHVyZXZlcnNlLmNvbS9wYXRoI2VxdWlwV2l0aF9icmFjZXM6NTpldm06MHg1MDg1Y2MwMjM2YWUxMDg4MTI1NzFlYWRmMjRiZWVlNGZlOGUwYzUwOjExMTE=",
"path": "http://schema.futureverse.com/path#equipWith_braces"
}
]
}
}
}
}
Last updated