-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make internal
Selection
type monomorphic in the type of change.
The original `Selection` type was polymorphic in the type of change outputs. The intention behind this was to allow the wallet to reuse the `Selection` type in different contexts, both before and after assigning change outputs with addresses. However, the internal coin selection library is not concerned with assigning addresses to change outputs. Assigning change addresses is a function of the wallet, rather than the coin selection library, and the coin selection library should not have to be concerned with this detail. Moreover, requiring the internal coin selection library's `Selection` type to be polymorphic in the type of change outputs makes the internal library functions and types more complicated than necessary. This change forks the `Selection` type into two separate types: - A wallet-specific type, located in `Cardano.Wallet.CoinSelection`, where the type of `change` is kept polymorphic (as it currently is). - An internal type, located in `Cardano.Wallet.CoinSelection.Internal`, where the type of `change` is simply `TokenBundle`. We also provide a pair of functions `selection{To,From}InternalSelection` located in `Cardano.Wallet.CoinSelection` to handle conversion between these two types. The forking of this type into two will make it easier to make further simplifications to the internal type, as we can restrict any breakage to the `selection{To,From}InternalSelection` functions.
- Loading branch information
1 parent
8d22a6c
commit 2d92cd9
Showing
2 changed files
with
110 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters