Page MenuHomePhabricator

[Cashtab] [BCH deprecation] [TxBuilder] Pt 1/8 - Localize Transaction Building module
ClosedPublic

Authored by emack on Nov 20 2022, 04:56.

Details

Summary

T2730

This diff creates a local transaction builder module to localize the bch-js portion of the transaction building process.

Temporary comparison checks have been added to sendXec which verifies that the txBuilder object matches after each stage of adding input, output and signing/building tx.

Relies on bitcoincashjs-lib for the eventual transaction building, and bip66 and bc-bip68 as per bch-js.

Pt 1/8 - Localize Transaction Builder module
Pt 2/8 - Deprecate BCH.TransactionBuilder in sendXec
Pt 3/8 - Add local TxBuilder to createToken
Pt 4/8 - Deprecate BCH.TransactionBuilder in createToken
Pt 5/8 - Add local TxBuilder to sendToken
Pt 6/8 - Deprecate BCH.TransactionBuilder in sendToken
Pt 7/8 - Add local TxBuilder to burnToken
Pt 8/8 - Deprecate BCH.TransactionBuilder in burnToken

Test Plan
  • npm ci
  • npm test and ensure no errors with txBuilder.test.js
  • npm start
  • send a one to one XEC tx and ensure the post-generateTxInput() output matches, post-generateTxOutput() output matches & post-signAndBuildTx() output matches console log messages are displayed
  • send a one to one XEC tx with an unencrypted message and ensure the same 3 console logs from above are displayed
  • send a one to one XEC tx with an encrypted message and ensure the same 3 console logs are displayed, and the message is decrypted on the receiver side
  • send a one to many XEC tx and ensure the same 3 console logs are displayed
  • send a one to many XEC tx with an unencrypted message and ensure the same 3 console logs are displayed
  • send an airdrop one to many XEC tx and ensure the same 3 console logs are displayed
  • send an airdrop one to many XEC tx with an unencrypted message and ensure the same 3 console logs are displayed
  • do a sanity check on the above transactions via the explorer (fee, inputs, outputs)

Diff Detail

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

Event Timeline

emack requested review of this revision.Nov 20 2022, 04:56

Note, reviewer should use npm ci instead of npm i, to ensure that package-lock.json is not overwritten

At some point in the future we will want to move coininfo and this new TransactionBuilder out of cashtab utils and into its own module. However, I think it's okay for them to live here now, since Cashtab is the workshop for determining what needs to be adjusted / improved for these libraries to make more sense in XEC development.

This revision is now accepted and ready to land.Nov 21 2022, 08:25