butaneprotocol / translucent-compat

Deprecated in favour of blaze https://github.com/butaneprotocol/blaze-cardano
https://github.com/butaneprotocol/blaze-cardano
Other
15 stars 8 forks source link

SelectWalletFrom should have a collateral field to allow consuming it #19

Open joacohoyos opened 7 months ago

joacohoyos commented 7 months ago

When using selectWalletFrom, besides setting teh utxos you should be able to set the collateral, that way you can enforce the users/wallet collateral lock and avoid consuming that utxo.

Otherwise, you could potentially get collateral issues when excluding this utxos as the rest of the utxos might be to big/small and

micahkendall commented 7 months ago

Yeah we can generally make selection of utxos more programmable. We could consider "Wallet UTxOs" as utxos available for balancing or spending, then "Available UTxOs" as utxos brought into context by the wallet as a provider but not actually selected to be spent (but can be manually spent). I already have to do something along these lines for the ExUnits calculations to track which UTxOs might be in the transaction. We could achieve similar goals to this PR to lucid https://github.com/spacebudz/lucid/pull/231 at the same time, maybe in a more elegant fashion. In practice this api might look like: lucid.useWallet(new CustomWallet(cip30api, {collateralUTxO})), and during tx completion stage the wallet is invoked for the purposes of deciding how to balance.