How to listen to all NFT transfers sent from a specific address
Lets create a stream that monitors all the NFT contract transfers from a specific sender address.
Note: This stream uses listen to all addresses feature that is available only on Business and Enterprise plans.
Note: There will be few NFT contracts that don't follow the standards like CryptoPunks that have a different ABI and you will not receive webhook requests from those non standard NFT contracts.
Note: You will use the ABI specific to NFT transfers, the one that has indexed for tokenId
Programmatically
const NFT_transfer_ABI = [{
"anonymous": false,
"inputs": [
{ "indexed": true, "name": "from", "type": "address" },
{ "indexed": true, "name": "to", "type": "address" },
{ "indexed": true, "name": "tokenId", "type": "uint256" },
],
"name": "transfer",
"type": "event",
}]; // valid abi of the event
const options = {
chains: [EvmChain.ETHEREUM], // list of blockchains to monitor
description: "monitor all NFT transfers", // your description
tag: "NFT_transfers", // give it a tag
abi: NFT_transfer_ABI,
includeContractLogs: true,
allAddresses: true,
topic0: ["transfer(address,address,uint256)"], // topic of the event
advancedOptions: [
{
topic0: "transfer(address,address,uint256)",
filter: { "eq": ["from", "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5"] }, // only receive NFT transfer events from this address
},
webhookUrl: "https://YOUR_WEBHOOK_URL", // webhook url to receive events,
};
const stream = await Moralis.Streams.add(options);
Via WebUI
- Create a new Stream
- Fill out the form
- Switch on Event Emittance and Add the Abi and select the topic
- Select
Listen to all addresses
andContract interactions (logs)
- Add below value to advanced options
[{
"topic0": "transfer(address,address,uint256)",
"filter": { "eq": ["from", "0x283af0b28c62c092c9727f1ee09c02ca627eb7f5"] }
}]- Click on create stream button.