Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 806 Bytes

File metadata and controls

39 lines (27 loc) · 806 Bytes

tokensByAttributes

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

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

Example:

{% code title="filteredQuery.ts" overflow="wrap" lineNumbers="true" %}

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', ...}]"

{% endcode %}