[Cashtab] Add functions to build and broadcast NFT1 parent fan-out txs
Summary:
Minting NFTs requires spending a qty of exactly 1 "NFT Parent" tokens. Most collections are expected to be minted with size > 1. This means Cashtab will need to "fan out" this NFT parent to create token utxos with qty of exactly 1, which can be used to mint NFTs.
Add
- function to collect SLP1 NFT parent utxos that need to be split out.
- function to create targetOutputs for a fan-out tx
- unit tests to create these txs and confirm practicality of input/output collection functions
When NFTs go live in Cashtab, we will probably do this manually. For example, if Cashtab detects that the user has no NFT 1 parent utxos with qty = 1, the "Mint NFT" option will be disabled, and there will be an option "Enable NFT Mints" or something like this. Then the user will click this button and Cashtab will broadcast a tx that creates up to 19 qty 1 utxos.
Will probably be manual because it is challenging to handle the "what if the user goes offline" condition, and very easy to click a button that instantly enables minting. We could do this in the background, for example on app startup or in the useWallet hook, but I don't really want to get in the habit of sending txs without the user's explicit OK. The logic of "does the user need more minting ammo" will be fairly straightforward to hook up with the UI (disable minting if no qty 1 utxos available, enable fan-out tx; disable fan-out tx if no inputs available).
Test Plan: npm test
Reviewers: #bitcoin_abc, emack
Reviewed By: #bitcoin_abc, emack
Subscribers: emack
Differential Revision: https://reviews.bitcoinabc.org/D15993