Proposal: HTLC claim / refund
We want rgb-lib to support RGB locked on a Bitcoin HTLC, then claimed or refunded into a normal wallet output.
The asset is locked on a normal Bitcoin HTLC outpoint, not on one of our UTXOs. rgb-lib should not treat that as a balance.
Later that outpoint is spent — claim, or refund after timeout — into a normal witness_receive destination. rgb-lib colors that spend and then accepts RGB on our output.
We cannot color and consume fascia in one shot. Consume is not reversible: if the tx never hits the network, we cannot undo the stash.
Before claiming we check the lock with contract_assignments_for_outpoints (right asset and amount on that outpoint). Then psbt_op_prepare: color the spend from the lock, store consignments under the operation dir, return operation_id and colored_psbt. We sign and broadcast. Once the indexer sees the tx we call psbt_op_apply; if not, psbt_op_abort.
Then we put the consignment on the proxy under the invoice recipient_id / proxy_recipient_id. The receiver downloads it with fetch_and_accept_transfer_by_recipient_id: pin output[vout] to the witness_receive script, then accept.
witness_receive already exists. We just need the lock to stay a foreign UTXO, and a way to color that spend without consuming fascia until the tx is actually on the network.
What we need in rgb-lib
These should be on Uniffi as well (we call them from Go).
contract_assignments_for_outpoints — read RGB on that outpoint.
psbt_op_prepare — color a spend of a UTXO the wallet does not own, write the consignment to the operation dir, return operation_id and colored_psbt. Do not consume fascia yet.
psbt_op_apply — consume fascia after the indexer sees the tx.
psbt_op_abort — if the tx never shows up.
fetch_and_accept_transfer_by_recipient_id — download the consignment from the proxy by recipient_id or proxy_recipient_id, pin output[vout] to the witness_receive script, then accept.
Proposal: HTLC claim / refund
We want rgb-lib to support RGB locked on a Bitcoin HTLC, then claimed or refunded into a normal wallet output.
The asset is locked on a normal Bitcoin HTLC outpoint, not on one of our UTXOs. rgb-lib should not treat that as a balance.
Later that outpoint is spent — claim, or refund after timeout — into a normal
witness_receivedestination. rgb-lib colors that spend and then accepts RGB on our output.We cannot color and consume fascia in one shot. Consume is not reversible: if the tx never hits the network, we cannot undo the stash.
Before claiming we check the lock with
contract_assignments_for_outpoints(right asset and amount on that outpoint). Thenpsbt_op_prepare: color the spend from the lock, store consignments under the operation dir, returnoperation_idandcolored_psbt. We sign and broadcast. Once the indexer sees the tx we callpsbt_op_apply; if not,psbt_op_abort.Then we put the consignment on the proxy under the invoice
recipient_id/proxy_recipient_id. The receiver downloads it withfetch_and_accept_transfer_by_recipient_id: pinoutput[vout]to thewitness_receivescript, then accept.witness_receivealready exists. We just need the lock to stay a foreign UTXO, and a way to color that spend without consuming fascia until the tx is actually on the network.What we need in rgb-lib
These should be on Uniffi as well (we call them from Go).
contract_assignments_for_outpoints— read RGB on that outpoint.psbt_op_prepare— color a spend of a UTXO the wallet does not own, write the consignment to the operation dir, returnoperation_idandcolored_psbt. Do not consume fascia yet.psbt_op_apply— consume fascia after the indexer sees the tx.psbt_op_abort— if the tx never shows up.fetch_and_accept_transfer_by_recipient_id— download the consignment from the proxy byrecipient_idorproxy_recipient_id, pinoutput[vout]to thewitness_receivescript, then accept.