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

Adding outputs does not consider minUtxo requirements #16

Closed joacohoyos closed 7 months ago

joacohoyos commented 7 months ago

When adding an output to a transaction Translucent doesn't handle the MinUTxO requirements. Right now you could add an output without lovelace or with ada < MinUTxO and it will allow you to, basically creating an invalid transaction that will fail later on.

We have a couple ways to handle this

Option 1

Option 2

Option 3

I already had implemented Option 1 in our private fork, but I want to open the discussion to see what's best thinking more peolpe would eventually use the library.

For something of more massive use I would incline to either 2 or 3. Personally I like option 1 but I also understand that it means doing some black magic on the background that goes against what the user explicitely indicated that might lead to misunderstandings

micahkendall commented 7 months ago

https://github.com/txpipe/translucent/blob/fac68944f8e95047e67a1796cdd37b49b5f58918/src/translucent/tx.ts#L322 supposed to be handled here but I might have missed places (and we can clean it up with a util to transform an output into a min-ada output)

joacohoyos commented 7 months ago

Cool will double check to confirm it's working