Example using chronik to retrieve the XEC and eToken UTXOs of a given address
Details
- Reviewers
bytesofman - Group Reviewers
Restricted Project - Commits
- rABC5e76d4421a08: [Apps][Examples] Get Utxos from address
npm test
npm run getUtxosFromAddress <address>
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- getUtxo
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 24289 Build 48188: Build Diff app-dev-examples Build 48187: arc lint + arc unit
Event Timeline
apps/examples/package.json | ||
---|---|---|
17 ↗ | (On Diff #41127) | |
apps/examples/scripts/getUtxosFromAddress.js | ||
24–25 ↗ | (On Diff #41127) | |
28 ↗ | (On Diff #41127) | |
apps/examples/test/getUtxosFromAddress.test.js | ||
13 ↗ | (On Diff #41127) | Add a unit test for an address with no utxos chronik's response shape needs special handling by app devs, since chronik.script(type,hash).utxos() returns
So, typically, the dev is interested in response.utxos -- but this is undefined if there are no utxos (not an empty array). Also include a comment about this in the function. Only way for new devs to learn this at the moment is run into the case and work through the errors. |
updated address decoding call, new unit test for an address with no utxos and added contextual comments
apps/examples/scripts/getUtxosFromAddress.js | ||
---|---|---|
43 | We'll be using this in many scripts, so it should be kept in its own file. e.g. create a config.js and export this here |
We'll be using this in many scripts, so it should be kept in its own file. e.g. create a config.js and export this here
Keeping it in the same fike as discussed