Page MenuHomePhabricator

[Cashtab] [Chronik] [Tx Gen] Generate Tx Output
ClosedPublic

Authored by emack on Jul 6 2022, 02:37.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABCb6296d53412e: [Cashtab] [Chronik] [Tx Gen] Generate Tx Output
Summary

As per T2503, this is part of a series of diffs to refactor the transaction generation process within useBCH.

This diff is a standalone utility function which adds tx outputs to the existing transaction builder instance, catering for both one to one and one to many send XEC txs.

The function returns an object containing the transaction builder instance.

Test Plan

npm test
observe successful execution of generateTxOutput() unit tests

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emack requested review of this revision.Jul 6 2022, 02:37

Moving forward with this one and closing D11709 due to phab for some reason creating a fresh diff upon a 'git commit --amend --no-edit'. Refer to resposnes to earlier comments in D11709.

bytesofman requested changes to this revision.Jul 6 2022, 22:53

See comments in D11709

This revision now requires changes to proceed.Jul 6 2022, 22:53
  • data from actual one to one and one to many transactions now used in unit tests and in the mockTxBuilderObj.js objects
  • whilst some of the existing mocks can be used to derive the totalInputUtxoValue, txFee and satoshisToSend values, the effort to reconstruct the corresponding txBuilder object matching those existing mocks were not worth the effort. Hence the txBuilder object mocks in mockTxBuilderObj.js reflects new transactions I just executed
  • removed error code usage within generateTxOutput and error code values in Ticker.js
bytesofman requested changes to this revision.Jul 8 2022, 16:47
bytesofman added inline comments.
web/cashtab/src/utils/__tests__/cashMethods.test.js
189 ↗(On Diff #34312)

It looks like these values are inextricably linked to `mockTxBuilderObj? It's hard to see where they are coming from if they are simply hardcoded here with no comments.

Either include comments explaining where these values come from, or import them from an object in the mock that explains the basis for these values.

singleSendValue, totalInputUtxoValue, and txFee

222 ↗(On Diff #34312)

Same situation as above

254 ↗(On Diff #34312)

Ditto

289 ↗(On Diff #34312)

Ditto

This revision now requires changes to proceed.Jul 8 2022, 16:47
emack marked 4 inline comments as done.

singleSendValue, totalInputUtxoValue, and txFee unit test params are now imported directly from objects in the mockTxBuilderObj mock across all tests.

This revision is now accepted and ready to land.Jul 11 2022, 23:51