getNftsForContractIterator - SDK
Fetches all NFTs for a given contract address and yields them in an async iterable. This method returns the full NFTs in the contract and pages through all page keys until all NFTs have been fetched.
Don’t have an API key?
Start using this method in your app today. Get started for free
Description
Fetches all NFTs for a given contract address and yields them in an async iterable.
This method returns the full NFTs in the contract and pages through all page keys until all NFTs have been fetched. To get all NFTs without their associated metadata, use the options
parameter by setting omitMetadata
to true
in the body of the request.
Parameters
options
parameters
Response
Nft
response properties
BaseNft
response properties
Alchemy’s representation of an NFT that doesn’t contain metadata. The BaseNft
object does not hold any metadata information and only contains the NFT contract and token ID. This is gotten by setting the options
omitMetadata parameter to true
.
Example Request and Response
Prerequisite: You will need to install the Alchemy SDK before making requests with it.
The commands for installing it using npm or yarn are given below:
Request
Response
Use Cases
Here are some potential use cases for the getNftsForContractIterator
method:
-
Marketplace platforms: Marketplace platforms that enable buying and selling of NFTs often require the ability to search for specific NFTs based on contract addresses. The
getNftsForContractIterator
method can be used to retrieve all NFTs associated with a given contract, allowing users to browse and search for NFTs from a particular collection. -
Wallet applications: Wallet applications that support NFTs may need to display all the NFTs owned by a user for a particular contract. The
getNftsForContractIterator
method can be used to retrieve all NFTs associated with a specific contract that is owned by a given address. -
NFT explorer tools: NFT explorer tools allow users to browse and search for NFTs on the blockchain. These tools often require the ability to query the blockchain for NFTs associated with a specific contract. The
getNftsForContractIterator
method can be used to retrieve all NFTs associated with a given contract, which can then be displayed and searched through an explorer tool.
Related Methods
-
getNftsForOwnerIterator: Fetches all NFTs for a given owner and yields them in an async iterable.
-
getNftMetadata: Get the NFT metadata associated with the provided parameters.