Get Collection
Get Collection by Contract address
Overview
This section details how to retrieve a collection using a contract address through the Assets API.
Properties
addresses
addresses
A list of addresses used to query assets.
eg.
[
"0x2D2438C6281B5115733287fC279f854c868D3ee2",
"0xFFFFFfFF00000000000000000000000000000417"
]
collectionIds
collectionIds
A list of collection IDs to filter assets on the addresses provided.
eg.
[
"7672:root:1234",
"7672:root:2341",
]
import React from 'react'
import { useAccount } from 'wagmi'
import { ChainAddress } from '@fv-asset-registry/common'
import { useAssets } from '@futureverse/asset-register-react'
import { useFuturePassAccountAddress } from '@futureverse/react'
// React component to render all collectibles owned by a FuturePass user logged in.
export const AssetList = () => {
// Get EOA address
const { address } = useAccount()
// Get FV address
const { data: fpAccount } = useFuturePassAccountAddress()
const collectionIds = [
"7672:root:1234",
"7672:root:2341",
]
const {
assets
} = useAssets(
{
first: 1000,
addresses: [address as ChainAddress, fpAccount as ChainAddress],
collectionIds
},
{ enabled: !!fpAccount && !!address },
)
if (!assets) {
return null
}
return (
<div>
{assets.map((asset) => <Asset key={asset.id} asset={asset} />)}
</div>
)
}
import { AssetRegister } from '@futureverse/asset-register'
const ar = new AssetRegister({
...
})
const addresses = [
"0x2D2438C6281B5115733287fC279f854c868D3ee2",
"0xFFFFFfFF00000000000000000000000000000417"
]
const collectionIds = [
"7672:root:1234",
"7672:root:2341",
]
const assets = await ar.assets({
addresses,
collectionIds
})
query GetAssets(
$addresses: [ChainAddress!]!
$collectionIds: [CollectionId!]
$after: String
$first: Float
) {
assets(
addresses: $addresses
collectionIds: $collectionIds
after: $after
first: $first
) {
pageInfo {
endCursor
hasNextPage
}
edges {
node {
id
collectionId
tokenId
assetType
assetTree {
data
nodeId
}
schema {
name
namespace
schema
version
}
ownership {
__typename
... on SFTAssetOwnership {
id
balancesOf(addresses: $addresses) {
balance
owner {
address
}
}
}
... on NFTAssetOwnership {
owner {
address
}
}
}
metadata {
attributes
properties
uri
}
links {
__typename
... on SFTAssetLink {
parentLinks(addresses: $addresses) {
collectionId
tokenId
}
}
... on NFTAssetLink {
parentLink {
collectionId
tokenId
}
}
}
collection {
id
chainId
chainType
location
name
}
}
}
}
}
{
"data": {
"assets": {
"pageInfo": {
"endCursor": null,
"hasNextPage": true
},
"edges": [
{
"node": {
"id": "QXNzZXQ6NTpldm06MHg1MDg1Y2MwMjM2YWUxMDg4MTI1NzFlYWRmMjRiZWVlNGZlOGUwYzUwOjg4OQ==",
"collectionId": "5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50",
"tokenId": "889",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50:889"
},
"schema": null,
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": {
"Eye Color": "Hazel",
"Status": "Pro",
"Hair Color": "Bronze",
"Gloves": "Brown",
"Clothing": "Pro Standard",
"Boots": "White",
"Hair Style": "Gymbunny",
"Facial Hair": "None",
"Skin Features": "Freckles",
"Skin Tone": "Midnight"
},
"properties": {
"image": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/889/jpg/889.jpg",
"models": {
"png": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/889/png/889.png",
"jpg": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/889/jpg/889.jpg",
"glb": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/889/glb/889.glb",
"fbx": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/889/fbx/889.fbx",
"gltf": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/889/gltf/889.gltf"
},
"animation_url": "https://boxer-viewer.thenextlegends.xyz?tokenId=889",
"name": "Pro 889",
"last_name": "889",
"description": null,
"first_name": "Pro"
},
"uri": "https://api-locker-room.thenextlegends.xyz/meta/token/889"
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo1OmV2bToweDUwODVjYzAyMzZhZTEwODgxMjU3MWVhZGYyNGJlZWU0ZmU4ZTBjNTA=",
"chainId": 5,
"chainType": "evm",
"location": "0x5085cc0236ae108812571eadf24beee4fe8e0c50",
"name": "TNL Boxers"
}
}
},
{
"node": {
"id": "QXNzZXQ6NTpldm06MHg1MDg1Y2MwMjM2YWUxMDg4MTI1NzFlYWRmMjRiZWVlNGZlOGUwYzUwOjg4OA==",
"collectionId": "5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50",
"tokenId": "888",
"assetType": "ERC721",
"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:5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50:888",
"path:equipWith_asmBrain": {
"@id": "did:fv-asset:5:evm:0x51cea47135c93eee33a6c15c22ea3532aec0540a:63"
}
}
]
},
"nodeId": "did:fv-asset:5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50:888"
},
"schema": null,
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": {
"Eye Color": "Blue",
"Status": "Pro",
"Hair Color": "Gray",
"Gloves": "Brown",
"Clothing": "Pro Standard",
"Boots": "Grey",
"Hair Style": "Supe",
"Facial Hair": "None",
"Skin Features": "Scars",
"Skin Tone": "Mellow"
},
"properties": {
"image": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/888/jpg/888.jpg",
"models": {
"png": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/888/png/888.png",
"jpg": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/888/jpg/888.jpg",
"glb": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/888/glb/888.glb",
"fbx": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/888/fbx/888.fbx",
"gltf": "https://d2zg32cm5x1o6j.cloudfront.net/boxers/888/gltf/888.gltf"
},
"animation_url": "https://boxer-viewer.thenextlegends.xyz?tokenId=888",
"name": "Pro 888",
"last_name": "888",
"description": null,
"first_name": "Pro"
},
"uri": "https://api-locker-room.thenextlegends.xyz/meta/token/888"
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo1OmV2bToweDUwODVjYzAyMzZhZTEwODgxMjU3MWVhZGYyNGJlZWU0ZmU4ZTBjNTA=",
"chainId": 5,
"chainType": "evm",
"location": "0x5085cc0236ae108812571eadf24beee4fe8e0c50",
"name": "TNL Boxers"
}
}
},
{
"node": {
"id": "QXNzZXQ6NTpldm06MHg1MWNlYTQ3MTM1YzkzZWVlMzNhNmMxNWMyMmVhMzUzMmFlYzA1NDBhOjYz",
"collectionId": "5:evm:0x51cea47135c93eee33a6c15c22ea3532aec0540a",
"tokenId": "63",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:5:evm:0x51cea47135c93eee33a6c15c22ea3532aec0540a:63"
},
"schema": null,
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": {
"collectionId": "5:evm:0x5085cc0236ae108812571eadf24beee4fe8e0c50",
"tokenId": "888"
}
},
"collection": {
"id": "Q29sbGVjdGlvbjo1OmV2bToweDUxY2VhNDcxMzVjOTNlZWUzM2E2YzE1YzIyZWEzNTMyYWVjMDU0MGE=",
"chainId": 5,
"chainType": "evm",
"location": "0x51cea47135c93eee33a6c15c22ea3532aec0540a",
"name": "ASMBrainGenII"
}
}
},
{
"node": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI1ODE0ODo1",
"collectionId": "7672:root:258148",
"tokenId": "5",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:7672:root:258148:5"
},
"schema": {
"name": "hkschema",
"namespace": "http://schema.futureverse.dev/kaur",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#>.\n@prefix schema: <http://schema.org/>.\n@prefix fvp: <http://schema.futureverse.dev/fv#Asset>.\n@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix xml: <http://www.w3.org/2001/XMLSchema#>.\n@prefix fv: <http://schema.futureverse.dev#>.\n@prefix hk1: <http://schema.futureverse.dev/kaur#>.\n@prefix path: <http://schema.futureverse.com/path#>.\n\nfvp:Asset a rdf:Class, sh:NodeShape;\n sh:property [\n sh:class hk1:hkschema1;\n sh:maxCount 1;\n sh:minCount 1;\n sh:path path:equipWith_sftTest\n].\n",
"version": 8
},
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo3NjcyOnJvb3Q6MjU4MTQ4",
"chainId": 7672,
"chainType": "root",
"location": "258148",
"name": "KenBrain"
}
}
},
{
"node": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI1ODE0ODow",
"collectionId": "7672:root:258148",
"tokenId": "0",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:7672:root:258148:0"
},
"schema": {
"name": "hkschema",
"namespace": "http://schema.futureverse.dev/kaur",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#>.\n@prefix schema: <http://schema.org/>.\n@prefix fvp: <http://schema.futureverse.dev/fv#Asset>.\n@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix xml: <http://www.w3.org/2001/XMLSchema#>.\n@prefix fv: <http://schema.futureverse.dev#>.\n@prefix hk1: <http://schema.futureverse.dev/kaur#>.\n@prefix path: <http://schema.futureverse.com/path#>.\n\nfvp:Asset a rdf:Class, sh:NodeShape;\n sh:property [\n sh:class hk1:hkschema1;\n sh:maxCount 1;\n sh:minCount 1;\n sh:path path:equipWith_sftTest\n].\n",
"version": 8
},
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo3NjcyOnJvb3Q6MjU4MTQ4",
"chainId": 7672,
"chainType": "root",
"location": "258148",
"name": "KenBrain"
}
}
},
{
"node": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI1ODE0ODo3",
"collectionId": "7672:root:258148",
"tokenId": "7",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:7672:root:258148:7"
},
"schema": {
"name": "hkschema",
"namespace": "http://schema.futureverse.dev/kaur",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#>.\n@prefix schema: <http://schema.org/>.\n@prefix fvp: <http://schema.futureverse.dev/fv#Asset>.\n@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix xml: <http://www.w3.org/2001/XMLSchema#>.\n@prefix fv: <http://schema.futureverse.dev#>.\n@prefix hk1: <http://schema.futureverse.dev/kaur#>.\n@prefix path: <http://schema.futureverse.com/path#>.\n\nfvp:Asset a rdf:Class, sh:NodeShape;\n sh:property [\n sh:class hk1:hkschema1;\n sh:maxCount 1;\n sh:minCount 1;\n sh:path path:equipWith_sftTest\n].\n",
"version": 8
},
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo3NjcyOnJvb3Q6MjU4MTQ4",
"chainId": 7672,
"chainType": "root",
"location": "258148",
"name": "KenBrain"
}
}
},
{
"node": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI1ODE0ODoz",
"collectionId": "7672:root:258148",
"tokenId": "3",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:7672:root:258148:3"
},
"schema": {
"name": "hkschema",
"namespace": "http://schema.futureverse.dev/kaur",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#>.\n@prefix schema: <http://schema.org/>.\n@prefix fvp: <http://schema.futureverse.dev/fv#Asset>.\n@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix xml: <http://www.w3.org/2001/XMLSchema#>.\n@prefix fv: <http://schema.futureverse.dev#>.\n@prefix hk1: <http://schema.futureverse.dev/kaur#>.\n@prefix path: <http://schema.futureverse.com/path#>.\n\nfvp:Asset a rdf:Class, sh:NodeShape;\n sh:property [\n sh:class hk1:hkschema1;\n sh:maxCount 1;\n sh:minCount 1;\n sh:path path:equipWith_sftTest\n].\n",
"version": 8
},
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo3NjcyOnJvb3Q6MjU4MTQ4",
"chainId": 7672,
"chainType": "root",
"location": "258148",
"name": "KenBrain"
}
}
},
{
"node": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI1ODE0ODo2",
"collectionId": "7672:root:258148",
"tokenId": "6",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:7672:root:258148:6"
},
"schema": {
"name": "hkschema",
"namespace": "http://schema.futureverse.dev/kaur",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#>.\n@prefix schema: <http://schema.org/>.\n@prefix fvp: <http://schema.futureverse.dev/fv#Asset>.\n@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix xml: <http://www.w3.org/2001/XMLSchema#>.\n@prefix fv: <http://schema.futureverse.dev#>.\n@prefix hk1: <http://schema.futureverse.dev/kaur#>.\n@prefix path: <http://schema.futureverse.com/path#>.\n\nfvp:Asset a rdf:Class, sh:NodeShape;\n sh:property [\n sh:class hk1:hkschema1;\n sh:maxCount 1;\n sh:minCount 1;\n sh:path path:equipWith_sftTest\n].\n",
"version": 8
},
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo3NjcyOnJvb3Q6MjU4MTQ4",
"chainId": 7672,
"chainType": "root",
"location": "258148",
"name": "KenBrain"
}
}
},
{
"node": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI1ODE0ODoy",
"collectionId": "7672:root:258148",
"tokenId": "2",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:7672:root:258148:2"
},
"schema": {
"name": "hkschema",
"namespace": "http://schema.futureverse.dev/kaur",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#>.\n@prefix schema: <http://schema.org/>.\n@prefix fvp: <http://schema.futureverse.dev/fv#Asset>.\n@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix xml: <http://www.w3.org/2001/XMLSchema#>.\n@prefix fv: <http://schema.futureverse.dev#>.\n@prefix hk1: <http://schema.futureverse.dev/kaur#>.\n@prefix path: <http://schema.futureverse.com/path#>.\n\nfvp:Asset a rdf:Class, sh:NodeShape;\n sh:property [\n sh:class hk1:hkschema1;\n sh:maxCount 1;\n sh:minCount 1;\n sh:path path:equipWith_sftTest\n].\n",
"version": 8
},
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo3NjcyOnJvb3Q6MjU4MTQ4",
"chainId": 7672,
"chainType": "root",
"location": "258148",
"name": "KenBrain"
}
}
},
{
"node": {
"id": "QXNzZXQ6NzY3Mjpyb290OjI1ODE0ODoxMA==",
"collectionId": "7672:root:258148",
"tokenId": "10",
"assetType": "ERC721",
"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": []
},
"nodeId": "did:fv-asset:7672:root:258148:10"
},
"schema": {
"name": "hkschema",
"namespace": "http://schema.futureverse.dev/kaur",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#>.\n@prefix schema: <http://schema.org/>.\n@prefix fvp: <http://schema.futureverse.dev/fv#Asset>.\n@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix xml: <http://www.w3.org/2001/XMLSchema#>.\n@prefix fv: <http://schema.futureverse.dev#>.\n@prefix hk1: <http://schema.futureverse.dev/kaur#>.\n@prefix path: <http://schema.futureverse.com/path#>.\n\nfvp:Asset a rdf:Class, sh:NodeShape;\n sh:property [\n sh:class hk1:hkschema1;\n sh:maxCount 1;\n sh:minCount 1;\n sh:path path:equipWith_sftTest\n].\n",
"version": 8
},
"ownership": {
"__typename": "NFTAssetOwnership",
"owner": {
"address": "0x2d2438c6281b5115733287fc279f854c868d3ee2"
}
},
"metadata": {
"attributes": null,
"properties": null,
"uri": null
},
"links": {
"__typename": "NFTAssetLink",
"parentLink": null
},
"collection": {
"id": "Q29sbGVjdGlvbjo3NjcyOnJvb3Q6MjU4MTQ4",
"chainId": 7672,
"chainType": "root",
"location": "258148",
"name": "KenBrain"
}
}
}
]
}
}
}
Last updated