Page MenuHomePhabricator

[Cashtab] [p1 match wif to address] Align sendXec()s XEC utxo signing approach
ClosedPublic

Authored by emack on Aug 15 2022, 14:17.

Details

Summary

As per T2599, this is part of a stacked diff to sign utxos for non-eToken txs by matching wif to address.
This diff aligns the approach in the sendXec() function.

Test Plan

npm test
send a 1 to 1 XEC tx and validate outputs in explorer
send a 1 to many XEC tx and validate outputs in explorer

Diff Detail

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

Event Timeline

emack requested review of this revision.Aug 15 2022, 14:17
bytesofman added inline comments.
web/cashtab/src/hooks/useBCH.js
1660 ↗(On Diff #34652)

Because the code from const accounts = through defining const utxoEcPair is the same for the sendToken(), createToken(), and sendXec() functions -- define it as a new helper function.

const utxoEcPair = (wallet, address)

Then part 2 of this diff will be adding this function into createToken(), part 3 will be replacing the code in sendToken() with this new function

This revision now requires changes to proceed.Aug 15 2022, 23:29
emack marked an inline comment as done.

Moved ECPair and signing logic into a separate utility function in cashMethods
Added unit tests
Also just a note that the ECPair and signing logic are inside the same function otherwise it's fairly inefficient duplicating the for loop once for the ECPair matching and then once for the signing.

This revision is now accepted and ready to land.Aug 17 2022, 18:18