AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.
Start building today!The API credit value for this method is 4 . To learn more about API credits and each method's value, visit the API Credits page.
Please note that this RPC method requires the NFT Fetch Tool add-on enabled on your QuickNode endpoint. Also, it currently supports ERC-721and ERC-1155 compliant contracts (on Ethereum mainnet).
Parameters:
wallet - string - The wallet address to check for NFTs
contracts -
string - (optional) An array of strings with the list of NFT contract addresses you'd like to get ownership data from. The contract addresses may be optionally suffixed with :tokenId
to specify a specific NFT id to filter on. For example, 0x2106c...7aeaa:1234
will filter Loopy Donuts on the NFT token with id
1234
only. You may include up to 20 contract addresses per request
page - integer - (optional) The page number you would like to get returned. The page numbers start at 1 and end at totalPages. If omitted, defaults to the first page (page 1). If the page number requested is less than 1 or higher than totalPages, an empty assets array will be returned
perPage - integer - (optional) The maximum amount of NFT assets to return on each page. You can request up to 40 items per page. If omitted, this will default to 20 items per page
Returns:
owner - The wallet address we checked for NFTs
assets - An array of objects representing NFTs with the following shape:
name - The name of this specific NFT
collectionTokenId - The token id of this NFT in its collection
collectionName - The name of this NFT's collection
imageUrl - The URL where the image for this NFT can be seen
collectionAddress - The contract address that this NFT lives in
traits - The traits refer to the different attributes of NFTs
value - The specific value associated with each trait of the NFT which can be present in the form of text, numbers, or even images, depending on the type of NFT
trait_type - The type of trait associated with each NFT. It includes attributes like the color, rarity, or any other defining characteristic that sets the NFT apart from others in its collection
chain - It states on which chain this aggregation happened on
network - It states on which network this aggregation happened on
description - The description of the asset
provenance - The provenance refers to the record of ownership and history of transactions for a particular NFT
blockNumber - The block number where this transaction was in
date - The date on which this transaction occured
from - The address for the sender of this transfer
to - The address for the receiver of this transfer
txHash - The transaction hash
currentOwner - The current owner of the asset
totalItems - The total number of results
totalPages - The total number of results pages available
pageNumber - The page number of results that were returned with this response
Code Examples:
require "uri" require "json" require "net/http" url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request["x-qn-api-version"] = "1" request.body = JSON.dump({ "id": 67, "jsonrpc": "2.0", "method": "qn_fetchNFTs", "params": { "wallet": "0x91b51c173a4bdaa1a60e234fc3f705a16d228740", "omitFields": [ "provenance", "traits" ], "page": 1, "perPage": 10, "contracts": [ "0x2106c00ac7da0a3430ae667879139e832307aeaa", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" ] } }) response = https.request(request) puts response.read_body
var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); myHeaders.append("x-qn-api-version", "1"); var raw = JSON.stringify({ "id": 67, "jsonrpc": "2.0", "method": "qn_fetchNFTs", "params": { "wallet": "0x91b51c173a4bdaa1a60e234fc3f705a16d228740", "omitFields": [ "provenance", "traits" ], "page": 1, "perPage": 10, "contracts": [ "0x2106c00ac7da0a3430ae667879139e832307aeaa", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" ] } }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
import requests import json url = "http://sample-endpoint-name.network.quiknode.pro/token-goes-here/" payload = json.dumps({ "id": 67, "jsonrpc": "2.0", "method": "qn_fetchNFTs", "params": { "wallet": "0x91b51c173a4bdaa1a60e234fc3f705a16d228740", "omitFields": [ "provenance", "traits" ], "page": 1, "perPage": 10, "contracts": [ "0x2106c00ac7da0a3430ae667879139e832307aeaa", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" ] } }) headers = { 'Content-Type': 'application/json', 'x-qn-api-version': '1' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
curl http://sample-endpoint-name.network.quiknode.pro/token-goes-here/ \ -X POST \ -H "Content-Type: application/json" \ -H "x-qn-api-version: 1" \ --data '{ "id":67, "jsonrpc":"2.0", "method":"qn_fetchNFTs", "params":{ "wallet": "0x91b51c173a4bdaa1a60e234fc3f705a16d228740", "omitFields": [ "provenance", "traits" ], "page": 1, "perPage": 10, "contracts": [ "0x2106c00ac7da0a3430ae667879139e832307aeaa", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" ] } }'
from web3 import Web3, HTTPProvider OPTIONS = { 'headers': { 'x-qn-api-version': '1' } } w3 = Web3(HTTPProvider('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/', request_kwargs=OPTIONS)) resp = w3.provider.make_request('qn_fetchNFTs', { "wallet": "0x91b51c173a4bdaa1a60e234fc3f705a16d228740", "omitFields": [ "provenance", "traits" ], "page": 1, "perPage": 10, "contracts": [ "0x2106c00ac7da0a3430ae667879139e832307aeaa", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" ] }) print(resp)
# The eth.rb library does not support including additional request headers, so you won't be able to add the x-qn-api-version header. require 'eth' client = Eth::Client.create 'http://sample-endpoint-name.network.quiknode.pro/token-goes-here/' payload = { "jsonrpc": "2.0", "method": "qn_fetchNFTs", "params": [ "wallet": "0x91b51c173a4bdaa1a60e234fc3f705a16d228740", "omitFields": [ "provenance", "traits" ], "page": 1, "perPage": 10, "contracts": [ "0x2106c00ac7da0a3430ae667879139e832307aeaa", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D" ] ], "id": "1" } response = client.send(payload.to_json) puts response
const ethers = require("ethers"); (async () => { const provider = new ethers.providers.JsonRpcProvider("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/"); provider.connection.headers = { "x-qn-api-version": 1 }; const heads = await provider.send("qn_fetchNFTs", { wallet: "0x91b51c173a4bdaa1a60e234fc3f705a16d228740", omitFields: ["provenance", "traits"], page: 1, perPage: 10, contracts: [ "0x2106c00ac7da0a3430ae667879139e832307aeaa", "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D", ], }); console.log(heads); })();