Basic Filtering

Filter Collectibles owned by a user and collection

Retrieve collectibles owned by a user

Properties

addresses (optional)

A list of addresses used to query assets.

e.g.

[
    "0x1213486Ea42bB6EA45bC7434389dA3239738B0E2",
    "0xFffFffff00000000000000000000000000000226"
]

collectionIds (optional)

A list of collection IDs to filter assets on the addresses provided.

e.g.

[
    "7672:root:1234",
    "7672:root:2341",
]

Since both the above properties are optional you can use the independently or together based on the use case. For example filtering using addresses and collectionIds will return all the collectibles in the specified collections owned by the addresses.

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 {
    assets
  } = useAssets(
    {
      first: 1000,
      addresses: [address as ChainAddress, fpAccount as ChainAddress],
    },
    { enabled: !!fpAccount && !!address },
  )
  if (!assets) {
    return null
  }

  return (
    <div>
      {assets.map((asset) => <Asset key={asset.id} asset={asset} />)}
    </div>
  )
}

Last updated

Feedback

Docs

© 2023 -> ♾️