alchemy_getAssetTransfers
) to query all NFT transfers by an address.alchemy_getAssetTransfers
request:fromAddress
: where the NFT transaction originated from
*when fetching NFT transaction history originating from
an address we use this*toAddress
: the NFT recipient address
*when fetching NFT transaction history by recipient address we use this*fromBlock
: the starting time range we want to fetch NFT transactions over (defaults to latest
)toBlock
: the ending time range we want to fetch NFT transactions over (defaults to latest
)category
: the type of transfer events we care about, in our case we want to see NFTs which are ERC721 and ERC1155 events From
An Addressalchemy-web3
module to easily interact with Alchemy APIs. We highly recommend using the alchemy-web3
sdk because you also get websocket support, retries, and other benefits without the complexity!nft-tx-history-from-alchemyweb3.js
touch
command like this:nft-tx-history-from-alchemyweb3.js
node-fetch
a lightweight, common module that brings the Fetch API to Node.js and allows us to make our HTTP requests, here's a code snipper for the request you'd make!nft-tx-history-from-fetch.js
using your favorite file browser, code editor, or just directly in the terminal using the touch
command like this:nft-tx-history-from-fetch.js
axios
, a promise-based HTTP client for the browser and Node.js which allows us to make a raw request to the Alchemy API, here's a code snipper for the request you'd make!nft-tx-history-from-axios.js
using your favorite file browser, code editor, or just directly in the terminal using the touch
command. nft-tx-history-from-axios.js
blockNum
: the block number where an NFT transaction occurred, in hex
hash
: the transaction hash of NFT transactionfrom
: where the transaction originated fromto
: where the NFT was receivedvalue
: the amount of ETH transferred, should always be null
in our case since we're only looking at NFT transfer events which typically only transfer the NFT and not ETHerc721TokenId
: the ERC721 token ID. null
if not an ERC721 token transfer.erc1155Metadata
: a list of objects containing the ERC1155 tokenId
and value
. null
if not an ERC1155 transfertokenId
: the token ID for ERC721 tokens or other NFT token standards asset
: ETH
or the token's symbol. null
if not defined in the contract and not available from other sources.rawContract
value
: null
since we're looking at ERC721 & ERC1155 transferaddress
: NFT contract addressdecimal
: null
type
, tokenId
and contract address
ERC721
or ERC1155
), contractAddress
, and tokenId
erc1155Metadata
, tokenId
, and rawContract
. tokenId
and address
for eachtokenID
of contract and address