| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Node.Emulator.Fee
Contents
Description
Calculating transaction fees in the emulator.
Synopsis
- estimateTransactionFee :: Params -> UTxO EmulatorEra -> [PaymentPubKeyHash] -> Tx -> Either CardanoLedgerError Value
- estimateCardanoBuildTxFee :: Params -> UTxO EmulatorEra -> CardanoBuildTx -> Either CardanoLedgerError Value
- makeAutoBalancedTransaction :: Params -> UTxO EmulatorEra -> CardanoBuildTx -> CardanoAddress -> Either CardanoLedgerError (Tx BabbageEra)
- makeAutoBalancedTransactionWithUtxoProvider :: Monad m => Params -> UtxoIndex -> CardanoAddress -> (Value -> m ([(TxOutRef, TxOut)], Value)) -> (forall a. CardanoLedgerError -> m a) -> CardanoBuildTx -> m (Tx BabbageEra)
- utxoProviderFromWalletOutputs :: Map TxOutRef TxOut -> Value -> Either BalancingError ([(TxOutRef, TxOut)], Value)
- data BalancingError
- selectCoin :: Eq a => [(a, Value)] -> Value -> Either BalancingError ([a], Value)
Documentation
estimateTransactionFee :: Params -> UTxO EmulatorEra -> [PaymentPubKeyHash] -> Tx -> Either CardanoLedgerError Value Source #
estimateCardanoBuildTxFee :: Params -> UTxO EmulatorEra -> CardanoBuildTx -> Either CardanoLedgerError Value Source #
makeAutoBalancedTransaction Source #
Arguments
| :: Params | |
| -> UTxO EmulatorEra | Just the transaction inputs, not the entire |
| -> CardanoBuildTx | |
| -> CardanoAddress | Change address |
| -> Either CardanoLedgerError (Tx BabbageEra) |
Creates a balanced transaction by calculating the execution units, the fees and the change, which is assigned to the given address. Only balances Ada.
makeAutoBalancedTransactionWithUtxoProvider Source #
Arguments
| :: Monad m | |
| => Params | |
| -> UtxoIndex | Just the transaction inputs, not the entire |
| -> CardanoAddress | Change address |
| -> (Value -> m ([(TxOutRef, TxOut)], Value)) | The utxo provider, it return outputs that cover at least the given value, and return the change, i.e. how much the outputs overshoot the given value. |
| -> (forall a. CardanoLedgerError -> m a) | How to handle errors |
| -> CardanoBuildTx | |
| -> m (Tx BabbageEra) |
Creates a balanced transaction by calculating the execution units, the fees and then the balance.
If the balance is negative the utxo provider is asked to pick extra inputs to make the balance is positive,
which is then assigned to the change address.
The collateral is similarly balanced.
Unlike makeAutoBalancedTransaction this function also balances non-Ada.
data BalancingError Source #
Constructors
| InsufficientFunds | Not enough extra inputs available to balance a transaction. |
| CardanoLedgerError CardanoLedgerError | |