import Cardano.Wallet.Write.ProtocolParameters
( ProtocolParameters (..) )
import Cardano.Wallet.Write.Tx
ErrBalanceTxInsufficientCollateralError
{ largestCombinationAvailable :: W.UTxO
-- ^ The largest available combination of pure ada UTxOs.
-
, minimumCollateralAmount :: W.Coin
+
, minimumCollateralAmount :: Coin
-- ^ The minimum quantity of ada necessary for collateral.
deriving (Eq, Generic, Show)
data ErrBalanceTxUnableToCreateChangeError =
ErrBalanceTxUnableToCreateChangeError
-
{ requiredCost :: !W.Coin
+
{ requiredCost :: !Coin
-- ^ An estimate of the minimal fee required for this transaction to
-- Investigate whether this field is really appropriate and necessary,
-- and if not, remove it.
-- ^ The total additional quantity of ada required to pay for the
-- minimum ada quantities of all change outputs as well as the
-- marginal fee for including these outputs in the transaction.
deriving (Eq, Generic, Show)
data ErrBalanceTxInternalError
-
= ErrUnderestimatedFee W.Coin SealedTx KeyWitnessCount
+
= ErrUnderestimatedFee Coin SealedTx KeyWitnessCount
| ErrFailedBalancing Cardano.Value
throwE . ErrBalanceTxInternalError $
-
(W.Coin.unsafeFromIntegral (-c))
TxFeeAndChange updatedFee updatedChange <- withExceptT
(\(ErrMoreSurplusNeeded c) ->
ErrBalanceTxInternalError $
-
ErrUnderestimatedFee c (toSealed candidateTx) witCount)
+
(W.toLedgerCoin c) (toSealed candidateTx) witCount
distributeSurplus feePerByte surplus feeAndChange)
UnableToConstructChangeError {shortfall, requiredCost} ->
ErrBalanceTxUnableToCreateChange
ErrBalanceTxUnableToCreateChangeError
-
{shortfall, requiredCost}
+
{ shortfall = W.toLedgerCoin shortfall
+
, requiredCost = W.toLedgerCoin requiredCost
ErrBalanceTxUnableToCreateInput
SelectionCollateralErrorOf SelectionCollateralError
& fmap W.TokenBundle.fromCoin
, minimumCollateralAmount
-
= minimumSelectionAmount
+
= W.toLedgerCoin minimumSelectionAmount
--------------------------------------------------------------------------------