Sometimes, there are pubkey UTxOs that we don't want to spend until we need them as inputs or reference inputs later.
Currently, balancing does not care which UTxOs of the balancing wallet it spends.
Example situation: information stored on a pubkey UTxO made official with an NFT
Remediation
A new option in TxOpts to control which UTxOs are safe to spend for balancing.
The ideal and conceptually elegant solution
Use a UtxoSearch as the option.
Why it is inconvenient
Module dependency cycle involving UtxoSearch, Skeleton, and BlockChain. This seems solvable, we only need the definition of the UtxoSearch synonym in Skeleton.
TxOpts is data, it has Eq and Show instances that it would not be able to implement anymore. A UtxoSearch is indeed at heart a function.
Tackling these would have a significant impact on the existing codebase for a small convenience feature.
The pragmatic proposed solution
A BalancingUtxos option which can be set to:
Use all UTxOs like before
Allow to use UTxOs in a whitelist of TxOutRef
Forbid to use UTxOs in a blacklist of TxOutRef
Use UTxOs without datum
Integrates well in the existing codebase
No module reorganization
TxOpts remains Eq and Show-able as usual
It is still possible to use filters (UtxoSearch) right before the transaction and provide the obtained list of TxOutRef as a whitelist or blacklist
Almost all the time, in practice, the BalancingUtxosDatumless will be what we want. UTxOs we want to protect against premature spending are UTxOs that carry info in a datum.
Problem
Sometimes, there are pubkey UTxOs that we don't want to spend until we need them as inputs or reference inputs later. Currently, balancing does not care which UTxOs of the balancing wallet it spends. Example situation: information stored on a pubkey UTxO made official with an NFT
Remediation
A new option in
TxOpts
to control which UTxOs are safe to spend for balancing.The ideal and conceptually elegant solution
Use a
UtxoSearch
as the option.Why it is inconvenient
UtxoSearch
,Skeleton
, andBlockChain
. This seems solvable, we only need the definition of theUtxoSearch
synonym inSkeleton
.TxOpts
is data, it hasEq
andShow
instances that it would not be able to implement anymore. AUtxoSearch
is indeed at heart a function.Tackling these would have a significant impact on the existing codebase for a small convenience feature.
The pragmatic proposed solution
BalancingUtxos
option which can be set to:TxOutRef
TxOutRef
TxOpts
remainsEq
andShow
-able as usualUtxoSearch
) right before the transaction and provide the obtained list ofTxOutRef
as a whitelist or blacklistBalancingUtxosDatumless
will be what we want. UTxOs we want to protect against premature spending are UTxOs that carry info in a datum.