NFT Series

Alchemy SDK — NFT APIs

An overview of NFT APIs supported by Alchemy SDK

Chikku George
BLOCK6

--

In the context of this article, we will walk through the NFT APIs provided by the Alchemy SDK.

Alchemy

Alchemy is a web3 development platform used to build decentralized applications.

Alchemy SDK

Alchemy SDK is one of the most popular tools provided by Alchemy to make the process of interfacing Blockchain with ease. It allows us to create and deploy smart contracts also offers APIs for fetching information about NFTs.

Step 1: Create an Alchemy account

Alchemy provides a free trail account that developers can use to develop and test their applications. Create a demo app in Alchemy on your preferred network and copy your API key.

Credit: Author
Credit: Author

Step 2: Set Alchemy API key in .env file

ALCHEMY_API_KEY = “Alchemy API Key”

Step 3: Setup Your NodeJS Server

Credit: Author

Step 4: Install “alchemy-sdk” dependency

npm install alchemy-sdk

Step 5: Configure Alchemy SDK

const { Alchemy, Network } = require(“alchemy-sdk”)
const { ALCHEMY_API_KEY } = process.env;
const settings = {
apiKey: ALCHEMY_API_KEY,
network: Network.MATIC_MUMBAI
};
const alchemy = new Alchemy(settings);
Credit: Author

NFT API Endpoints

1. getNftsForOwner()

This method is used to get all NFTs owned by a given address.

Credit: Author
Credit: Author

2. getOwnersForContract()

This method is used to get all owners of a given NFT contract address.

Credit: Author
Credit: Author

3. getNFTMetadata

This method is used to get all the metadata associated with an NFT. We need to pass the contract address and token Id of the NFT.

Credit: Author
Credit: Author

4. getContractMetadata

This method is used to get information about a collection/contract.

Credit: Author
Credit: Author

5. getNFTsForContract

This method is used to get all the NFTs of a given contract.

Credit: Author
Credit: Author

6. getOwnersForContract

This method is used to get all owners of a given NFT contract.

Credit: Author
Credit: Author

Thank You:)

JOIN DISCORD

Contents distributed by Learn.Block6.tech

👉 Discord — Live Talks

👉 Twitter — Latest articles

👉 LinkTr.ee

--

--

Chikku George
BLOCK6
Writer for

Software Engineer | ReactJs | NodeJs | Blockchain Enthusiast