getNFTs

The following set of functions will be used to showcase nfts on your marketplace

Getting list of tokens

Getting a list of tokens, filtered and sorted

import NiftySDK from 'nifty-protocol';

const niftySDK = new NiftySDK({ key: 'key', env: Nifty.envs.TESTNET });

const options = {
    chains: [1, 56],
    sort: 'listed_desc',
    search: '',
    contracts: [],    
}

niftySDK.getNFTs(options)
  .then((res) => {
    setTokens(res.data);
  })
  .catch((e) => {
    console.log('e', e);
  });
  
  
  
const chains = [
  { chainId: '', name: 'All' },
  { chainId: 1, name: 'Ethereum' },
  { chainId: 137, name: 'Polygon' },
  { chainId: 56, name: 'BNB' },
  { chainId: 43114, name: 'Avalanche' },
  { chainId: 1285, name: 'Moonriver' },
  { chainId: 4, name: 'rinkeby' },
];

const sortOptions = [
  { value: 'listed_desc', label: 'Recently Listed' },
  { value: 'created_desc', label: 'Recently Minted' },
  { value: 'sold_desc', label: 'Recently Sold' },
  { value: 'price_asc', label: 'Price (Lowest to highest)' },
  { value: 'price_desc', label: 'Price (Highest to lowest)' },
  { value: 'last_sell_desc', label: 'Highest Last Sale' },
];

Options

All params are optional

To get users NFTs need to send address and connectedChainId

Param
Value / Explanation
Type

contracts

hex contract addresses

array

search

any string

string

order

has order attached (listed / on sale) - true / false

boolean

verified

only verified collections - true / false

boolean

priceRange

min to max price

array

chains

1, 4, 56, 137, 1284, 1285, 43113, 43114

array

address

user address

string

connectedChainId

chain id of the user address

number

traits

array of trait ids to filter by tokens' traits

array

sort

'listed_desc' - Recently Listed 'created_desc' - Recently Minted 'sold_desc' - Recently Sold 'price_asc' - Price (Lowest to highest) 'price_desc' - Price (Highest to lowest) 'last_sell_desc' - Highest Last Sale

string

limit

num of results

number

skip

skip results (min-30 max-100)

number

Response

Last updated