It seems that, to listen to the transfers of all tokens of a specific account, right now the only way is for the API to add all the token contract accounts in the list. Is there a better way?
1 Answer
The requirement for accounts
to be required could be relaxed, it would then search for all accounts (thus tokens), and you'd need to filter out what is junk and what isn't: your only "key" to knowing if it's an actual token transfer would be action
being transfer
. But people are free to use transfer
for things that aren't token transfers. That's why filtering a list of known accounts makes a lot of sense.
Another option would be to track changes to the database. Token transfers generally affect the scope
equal to your account name (like eoscanadacom
), and the name of the table is accounts
. If you were able to listen for such changes (here again, the code
's "required"-ness would need to be relaxed), you would get block-level information about when your token were transfered.. but you wouldn't get the actual transaction ID responsible for the exchange (nor would you get multiple messages if your balance changed 77 times within a block).
Otherwise, using dfuse Search
, you can do ad-hoc searches and get those results pretty easily. That wouldn't (yet) be streaming results though.
Does that help? I guess my question would be: what's your use case, perhaps we can see how we can adapt to it.
See more on https://docs.dfuse.io