Skip to content

Commit

Permalink
Add top-level ErrBalanceTxBalanceInsufficient error.
Browse files Browse the repository at this point in the history
This record type is a copy of the coin selection `BalanceInsufficient`
error, but is specific to the `balanceTransaction` function.

Once all wallet endpoints have been rewritten to use
`balanceTransaction` as their main point of entry for balancing
transactions, we will be free to vary the internal API between
`balanceTransaction` and coin selection modules.
  • Loading branch information
jonathanknowles committed Feb 6, 2023
1 parent d5f96e5 commit 8d80dfc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/wallet/src/Cardano/Wallet/Write/Tx/Balance.hs
Expand Up @@ -228,6 +228,27 @@ data ErrBalanceTxInternalError
| ErrFailedBalancing Cardano.Value
deriving (Show, Eq)

-- | Indicates that the balance of one or more assets in the provided UTxO set
-- is insufficient to make a balanced transaction.
--
data ErrBalanceTxBalanceInsufficientInfo = ErrBalanceTxBalanceInsufficientInfo
{ utxoBalanceAvailable
:: !TokenBundle
-- ^ The /available/ balance of UTxOs provided to 'balanceTransaction'.
, utxoBalanceRequired
:: !TokenBundle
-- ^ The /minimum/ balance of UTxOs that would be required to make a
-- balanced transaction.
, utxoBalanceShortfall
:: !TokenBundle
-- ^ The /additional/ balance of UTxOs that would be required to make a
-- balanced transaction.
--
-- Equal to the /truncated subtraction/ of 'utxoBalanceAvailable' from
-- 'utxoBalanceRequired'.
}
deriving (Eq, Generic, Show)

-- | Errors that can occur when balancing transaction.
data ErrBalanceTx
= ErrBalanceTxUpdateError ErrUpdateSealedTx
Expand Down

0 comments on commit 8d80dfc

Please sign in to comment.