Get Owners by Contract
GET
owners of NFTs for a given contract.
- Requests for contract addresses not yet indexed will automatically start the indexing process for that NFT collection.
Query Params | Description |
---|---|
chain | The chain to query |
address (required) | The address of the wallet |
const Moralis = require("moralis").default;const { EvmChain } = require("@moralisweb3/common-evm-utils");const { config } = require("dotenv");
// Inject environment variablesconfig();
const runApp = async () => { await Moralis.start({ apiKey: process.env.MORALIS_API_KEY, // ...and any other configuration });
const address = "0xCAFFA4b5F72a44C75F796E94F22dEBd6369F04FC";
const chain = EvmChain.PALM;
const response = await Moralis.EvmApi.nft.getNFTOwners({ address, chain, });
console.log(response.toJSON());};
runApp();
import Moralis from "moralis";import { EvmChain, GetNFTOwnersResponseAdapter,} from "@moralisweb3/common-evm-utils";import { config } from "dotenv";
// Inject environment variablesconfig();
const runApp = async () => { await Moralis.start({ apiKey: process.env.MORALIS_API_KEY, // ...and any other configuration });
const address: string = "0xCAFFA4b5F72a44C75F796E94F22dEBd6369F04FC";
const chain: EvmChain = EvmChain.PALM;
const response: GetNFTOwnersResponseAdapter = await Moralis.EvmApi.nft.getNFTOwners({ address, chain, });
console.log(response.toJSON());};
runApp();
{total: 1,page: 1,page_size: 100,cursor: null,result: [ { token_address: '0xcaffa4b5f72a44c75f796e94f22debd6369f04fc', token_id: '337459032062404130888958965050657186814', owner_of: '0xcf8b5c33584f00ec12ca257ae5b74d080f9a432b', block_number: '7336008', block_number_minted: '2757718', token_hash: '391b72d5191fbe8a67938c9d8d76436a', amount: '1', contract_type: 'ERC721', name: 'CandyDigitalNFT', symbol: 'CNDY', token_uri: 'https://tokens.candy.com/337459032062404130888958965050657186814', metadata: '{"name":"Earth Anew","description":"Bank of America commissioned brand agency Superunion and 3D artist João Seabra to create its first-ever, limited-edition NFT. Built on PALM, a sustainable and energy-efficient ecosystem, this unique digital rendering of a rainforest reflects our commitment to helping preserve the planet we share.","external_url":"https://www.candy.com/mlb/collectibles/fde03ed8-1fc3-414a-afe5-bd51f08fa3fe","image":"https://assets.candy.com/VIDEO/34599b72-58e7-4700-ac25-d34bacdd3f9d/BofA_NFT_2021_NoLogo.mp4","animation_url":"https://assets.candy.com/VIDEO/34599b72-58e7-4700-ac25-d34bacdd3f9d/BofA_NFT_2021_NoLogo.mp4","attributes":[{"display_type":"number","trait_type":"Serial Number","value":7}]}', last_token_uri_sync: '2022-11-12T21:31:07.385Z', last_metadata_sync: '2022-11-12T21:31:12.653Z', minter_address: '0xf00dc91588ac40b5c886aec93b24ec92d7f737dd' }],status: 'SYNCED'}