tokensByAttributes

Returns a list of token items (metadata) which match the contract id and passed filters.

tokensByAttributes(contractId: string, filters: string): Promise<FilteredMetadataResult[]>

Example:

filteredQuery.ts
import { tokensByAttributes } from "@mintbase-js/data";

const query = {
  filters: {
    'eyes': ['blue', 'green'], // blue or green eyes
    'face': ['pretty'], // with a pretty face
  },
  limit: 10,
  offset: 0,
};

const props = {
  contractId: 'some-nfts.contract.near',
  filters: query,
  network: 'mainnet',
}

const { data, error } = await tokensByAttributes(props);

if (error) {
  console.log("error", error);
}

console.log(data); // => "[{ title: 'Woah betty', ...}]"

Last updated