Update sendXec example to use the new API in ecash-coinselect v2.0.1.
Details
- Reviewers
bytesofman - Group Reviewers
Restricted Project - Commits
- rABCd23611c7e634: [Apps][Examples] Refactor sendXec demo to use updated API in ecash-coinselect…
npm test
Fill in sender mnemonic and address and execute npm run sendXec <address> <amountInXec> and ensure it is broadcasted successfully via explorer.
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
apps/examples/scripts/sendXec.js | ||
---|---|---|
91 ↗ | (On Diff #42478) | add a comment about why we need this legacy address |
apps/examples/scripts/sendXec.js | ||
---|---|---|
70 ↗ | (On Diff #42499) | since the point of the example is readability / followability, go ahead and pull the utxos out on their own line with their own comment |
71 ↗ | (On Diff #42499) | same here. define a targetOutputs variable. the targetOutput should also have a address: destinationAddress key/value |
135 ↗ | (On Diff #42499) | like the refactored cashtab tx function -- return {txid, hex} -- then your unit test can test if you are actually getting the tx that you want. In this case, the unit test is "passing" because it gets the same mock txid you ask it for. But we miss that the tx is sending xec to its own change address. To check the rawtx response, you can load it into electrum and confirm you have the expected inputs, outputs, and fee. |
.... i dunno why this is the example tx (a self-send tx with no change output that some crazy how ends up with a fee well below 1 sat per byte) but
- it shouldn't be, we should use a 'normal' tx like sending ecash from one address to a different address
- We should have tests for doing this with and without a change output
- on the plus side, the presence of this tx seems to present a bug with coinselect ... should be throwing an error here, need to look into this