Get Collections Owned by a User
Properties
addresses
A list of addresses used to query assets.
e.g.
[
"0x1213486Ea42bB6EA45bC7434389dA3239738B0E2",
"0xFffFffff00000000000000000000000000000226"
]
import React from 'react'
import { useAccount } from 'wagmi'
import { ChainAddress } from '@fv-asset-registry/common'
import { useCollections } from '@futureverse/asset-register-react/v2'
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 {
collections
} = useCollections(
{
first: 1000,
addresses: [address as ChainAddress, fpAccount as ChainAddress],
},
{ enabled: !!fpAccount && !!address },
)
if (!collections) {
return null
}
return (
<div>
{collections.map((collection) => <Collection key={collection.id} collection={collection} />)}
</div>
)
}
import { AssetRegister } from '@futureverse/asset-register/v2'
const ar = new AssetRegister({
...
})
const collections = await ar.collections({
first: 1000,
addresses: [
"0x2D2438C6281B5115733287fC279f854c868D3ee2",
"0xFFFFFfFF00000000000000000000000000000417"
]
}).execute()
query Collections($addresses: [ChainAddress!]!, $first: Float, $after: String) {
collections(addresses: $addresses, first: $first, after: $after) {
edges {
node {
chainId
chainType
id
location
name
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
{
"addresses": [
"0x2D2438C6281B5115733287fC279f854c868D3ee2",
"0xFFFFFfFF00000000000000000000000000000417"
],
"first": 1000,
}
Last updated