Dashboard
Tutorials
Community
Support
Search…
Welcome to Infura docs
Getting started
Dashboard stats
Networks
Ethereum (execution layer)
ETH2 (consensus layer)
IPFS
Filecoin
Polygon PoS
Palm
Optimism
Arbitrum
NEAR
Aurora
Avalanche (C-Chain)
StarkNet
INFURA CUSTOM APIs
NFT SDK
Installation and set up
Authentication
Supported networks
How to
Deploy a contract
Mint an NFT
Get NFT information
Transfer an NFT
APIs
Features
Archive data
Project sharing
Infura transactions (ITX)
Tutorials
Ethereum
NFT SDK
Filecoin
NEAR
Layer 2 networks
Developer tools
Avalanche (C-Chain)
LEARN
The Merge
curl
JSON Web Token (JWT)
Web3 libraries
Powered By
GitBook
Get NFT information
This document assumes you have followed the
deploy a contract
and the
mint an NFT
instructions.
Repeat the
mint NFT instructions
again to have a collection of NFTs for testing the following SDK methods.
Get NFTs
Call the
getNFTs
method to list the NFTs per user address.
const
myNFTs
=
await
sdk
.
getNFTs
({
publicAddress
:
process
.
env
.
WALLET_PUBLIC_ADDRESS
,
includeMetadata
:
true
});
console
.
log
(
'My NFTs: \n'
,
myNFTs
);
Example output:
My NFTs:
{
pageNumber:
1
,
network:
'GOERLI'
,
total:
2
,
account:
'0xeF8692168D0C165488ae3F0105Fe096f5E81820b'
,
type:
'NFT'
,
assets:
[
{
contract:
'0x675e75a15940247220a980de81a4b7de7feb9f76'
,
tokenId:
'0'
,
supply:
'1'
,
type:
'ERC721'
,
metadata:
[
Object
]
}
,
{
contract:
'0x0300f3f929b558e84107b67e3fbbe9e897dadb5a'
,
tokenId:
'0'
,
supply:
'1'
,
type:
'ERC721'
,
metadata:
[
Object
]
}
]
}
Get NFTs per contract address
Call the
getNFTsForCollection
method to list the NFT collections and metadata per contract address.
const
collectionNFT
=
await
sdk
.
getNFTsForCollection
({
contractAddress
:
"<CONTRACT_ADDRESS>"
,
});
console
.
log
(
'NFT Collection: \n'
,
collectionNFT
);
console
.
log
(
'NFT Metadata: \n'
,
collectionNFT
.
assets
[
0
].
metadata
);
Example output:
NFT Collection:
{
pageNumber:
1
,
network:
'GOERLI'
,
total:
1
,
account:
'0x0300F3F929B558e84107B67e3FbBe9e897daDB5a'
,
type:
'NFT'
,
assets:
[
{
contract:
'0x0300f3f929b558e84107b67e3fbbe9e897dadb5a'
,
tokenId:
'0'
,
supply:
'1'
,
type:
'ERC721'
,
metadata:
[
Object
]
}
]
}
NFT Metadata:
{
attributes:
[
{
traitType:
'Background'
, value:
'White'
}
]
,
description:
'Hello world.'
,
image:
'https://ipfs.io/ipfs/QmbxwZsUSBT3sGUuWCMLeuMzHcgq5eK2zjxFrYnUcoV1Du'
,
name:
'Hello world.'
}
Get token metadata
Call the
getTokenMetaData
method in the same way for more information about the contract.
const
tokenMetadata
=
await
sdk
.
getTokenMetadata
({
contractAddress
:
"<CONTRACT_ADDRESS>"
,
tokenId
:
0
});
console
.
log
(
'Token Metadata: \n'
,
tokenMetadata
);
Example output:
Token Metadata:
{
contract:
'0x675e75a15940247220a980de81a4b7de7feb9f76'
,
tokenId:
'0'
,
name:
"ConsenSys NFT SDK contract demo"
,
description:
"This is part of the ConsenSys NFT SDK demo."
,
image:
"https://cdn.consensys.net/uploads/consensys-2020-featured-image.jpg"
,
external_link:
"https://consensys.net/"
}
Previous
Mint an NFT
Next
Transfer an NFT
Last modified
1mo ago
Copy link
Outline
Get NFTs
Get NFTs per contract address
Get token metadata