HomePhabricator

[ecash-coinselect] Support specified input utxos

Description

[ecash-coinselect] Support specified input utxos

Summary:
SLP v1 send txs require token utxos as inputs (they can be in any order).

ecash-coinselect can accept targetOutputs, which makes it flexible and robust for many use cases. However it cannot accept specified inputs.

Add an optional param to specify inputs. While this could have more use cases in the future, for now it extends ecash-coinselect applicability to constructing slpv1 send txs in Cashtab.

Because the input tokens required for an slp send tx depend on how targetOutputs are calculated, I think it is the best API to leave determination of these inputs outside the scope of ecash-coinselect. We could include very simple helper functions in ecash-coinselect to get these, but an app developer would still need to call other functions outside of ecash-coinselect to build the tx. imo there is not a great need for an optimal lib algorithm to accept these inputs. (1) it is very simple and (2) It is hard to make assumptions about the kind of token send txs an app dev would want to make.

Test Plan: npm test, review D15519 which has this version of ecash-coinselect installed

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D15520

Details

Provenance
bytesofmanAuthored on Feb 23 2024, 00:09
bytesofmanPushed on Feb 23 2024, 19:33
Reviewer
Restricted Project
Differential Revision
D15520: [ecash-coinselect] Support specified input utxos
Parents
rABC64791fc2280f: [Cashtab] Upgrade some dev dependencies used in testing
Branches
Unknown
Tags
Unknown