const Moralis = require("moralis").default;
Moralis.start({
apiKey: "your_key",
});
const filter = {
eq: [
"moralis_streams_contract_address",
"0x55d398326f99059ff775485246999027b3197955", // your contract address
],
};
async function run(webhook_url) {
const ERC20_ONLY = await Moralis.Streams.add({
webhookUrl: webhook_url,
description: "BUSD transfers monitor",
tag: "busd-transfers",
chains: ["0x38"],
allAddresses: false,
includeNativeTxs: false,
includeContractLogs: true,
includeInternalTxs: false,
includeAllTxLogs: false,
topic0: ["Transfer(address,address,uint256)"],
advancedOptions: [
{
topic0: "Transfer(address,address,uint256)",
filter: filter,
},
],
abi: [
{
anonymous: false,
inputs: [
{
indexed: true,
name: "from",
type: "address",
},
{
indexed: true,
name: "to",
type: "address",
},
{
indexed: false,
name: "value",
type: "uint256",
},
],
name: "Transfer",
type: "event",
},
],
});
const ID = ERC20_ONLY.result.id;
const addAddress = Moralis.Streams.addAddress({
id: ID,
address: "0x8894e0a0c962cb723c1976a4421c95949be2d4e3", // your address / addresses []
});
}
run("https://webhook.site/62b5c870-a5ed-4eab-8743-0558b3d763f8");