ergoplatform / ergo-appkit

Appkit: A Library for Java/Scala/Kotlin Development of Ergo Applications
MIT License
38 stars 27 forks source link

UnsignedTransactionBuilderImpl move away from using DefaultBoxSelector #182

Closed MrStahlfelge closed 2 years ago

MrStahlfelge commented 2 years ago

Currently, UnsignedTransactionBuilderImpl uses DefaultBoxSelector internally. The implementation has some major and some minor drawbacks that should be solved by changing the implementation:

The second issue is especially restricting client code. For example, building the following transaction fails:

=> Fails because second input is not needed. This is true, but when client code wants to build a transaction in this way, this should be accepted by the transaction builder and the unnecessary amount shoud be added to the changebox.

To add up to the confusion, it is even possible to add unnecessary boxes to the input list, some are accepted:

That means that every client code must all DefaultBoxSelector manually on an input box list to make sure the input boxes list satisfies the needs. This is done in appkit's BoxOperations loadTop method as well, which calls BoxSelectorsJavaHelpers.selectBoxes which is using DefaultBoxSelector internally, and must be done by client code on every transaction build.

MrStahlfelge commented 2 years ago

199 another reason to move away