NFT Balances

Get NFTs from any address

getNFTs

Get all NFTs of the current user or address. Supports both ERC721 and ERC1155. Returns an array of NFT objects (asynchronous).

Options

  • chain(optional): The blockchain to get data from. Valid values listed above. Default value Eth.

  • address (optional): A user address (i.e. 0x1a2b3x...). If specified the user attached to the query is ignored and the address is used instead.

// get NFTs for current user on Mainnet
const userEthNFTs = await Moralis.Web3.getNFTs();
// get testnet NFTs for user
const testnetNFTs = await Moralis.Web3.getNFTs({ chain: 'ropsten' });
// get polygon NFTs for address
const options = { chain: 'matic', address: '0x...' };
const polygonNFTs = await Moralis.Web3.getNFTs(options);

getNFTsCount

Get the total number NFTs owned by the current user or address. Returns a number (asynchronous).

Options

  • chain(optional): The blockchain to get data from. Valid values listed above. Default value Eth.

  • address (optional): A user address (i.e. 0x1a2b3x...). If specified the user attached to the query is ignored and the address is used instead.

const nftCount = await Moralis.Web3.getNFTsCount();

Can use the options in the same way as above for getNFTs.