I have a list of Eth user deposit addresses. They can make External USDT transfers to these addresses. How do I subscribe to the USDT contract and filter for all the User Addresses I have for deposits. My user numbers would keep growing.
I understand I can filter Transfer events on 1 to address. But how do I filter on a addresses in the order of thousands?
CodePudding user response:
You can use the web3 event handler options
object (docs) to subscribe to transfers to only specified recipients.
Example:
usdtContract.events.Transfer({
filter: {
// `to` is the name of the indexed Solidity event topic, as in
// `event Transfer(address indexed from, address indexed to, uint value)`
to: ["0x123", "0x456", "0x789"]
}
}, (err, data) => {
// ...
});