Asset Tree

This guide will go into detail about querying the 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

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"
}

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

A list of addresses used to query the linked SFT Assets.

eg.

[
    "0x2D2438C6281B5115733287fC279f854c868D3ee2",
    "0xFFFFFfFF00000000000000000000000000000417"
]

collectionId

A collection ID to query the asset.

e.g. 7672:root:303204

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} />
}

Last updated

Feedback

Docs

© 2023 -> ♾️