Assets search engine

Search route

To explore the different assets available in a collection the search assets operation allows complex filtering based on different criteria. The search is paginated and different fields can be used to sort results.

const assetsSearch = await marketplaceSdk.asset.searchAssets({
  contractAddress: MY_COLLECTION_ADDRESS,
  isOnSale: true,
  attributes: [
    {
      color: ['red'],
      rarity: ['rare', 'legendary']
    },
    {
      color: ['blue'],
      rarity: ['common']
    }
  ],
  orderBy: FilterOrderBy.PRICE,
  direction: FilterDirection.DESC,
  skip: 0,
  limit: 100
})

For example, in this call, we get assets that are on sale sorted by decreasing price. The attributes filter will filter in assets with attributes that are either:

  • red and of rarity 'rare' or 'legendary'

  • blue and of rarity 'common'

You can also filter by owner for user-specific searches.

All our API routes are also available without the SDK. See the search assets route.

Cached images

You will notice in the asset two different fields for the asset image URLs:

  • asset.metadata.image : This is the image URL extracted from your asset's metadata. Once the metadata of an asset is indexed then this will be defined and usable.

  • asset.cachedImageUrl : This is the URL of a cached and optimized version of your asset's image. It should offer better performance when displaying it to users. However, it might not always be defined or fully ready, therefore we strongly advise always using the core metadata field as a backup in case this cached image is unusable.

Asset attributes & mint

If you need the full list of asset attributes or the mint transfer, you will need to use the route that gets a single asset which gives a more detailed version of the asset.

const asset = await marketplaceSdk.asset.getAsset(
    MY_COLLECTION_ADDRESS,
    'token_id'
  )

  const { attributes } = asset.metadata

All our API routes are also available without the SDK. See the get asset route.

Last updated