Add tested function addressReceivedToken, returning true if any output in a tx has a given tokenId at a given address
Details
- Reviewers
emack - Group Reviewers
Restricted Project - Commits
- rABC30657fdaf7aa: [token-server] Add new function to determine if a given tx involves an address…
npm test
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Just so I'm clear on the underlying use case here, will this be used to parse through all tx history of the address to figure out whether the address has received this token at least once in its entire history, or is it to determine the user is currently holding a balance of this tokenId? If it's the latter then you can just use the etoken-list lib can't you?
Overall goal here will be MVP for token rewards every 24 hrs for Cashtab users
You can see the "eligibility check" function these build up to here: D15599
So, for this case, we will only be interested in the tx history for a certain time window. Getting txs from "only this window" is the most complicated part of the function.
I can see the helper functions introduced here being used in other applications as well.
in-node chronik-client has much better methods than etoken-list for getting a list of token holders and balance. will be implementing these in cashtab and deprecating etoken-list after in-node chronik-client is implemented.