Safe Haskell | None |
---|---|
Language | Haskell2010 |
Calculating transaction fees in the emulator.
Synopsis
- estimateCardanoBuildTxFee :: Params -> UTxO EmulatorEra -> CardanoBuildTx -> Either CardanoLedgerError Lovelace
- makeAutoBalancedTransaction :: Params -> UTxO EmulatorEra -> CardanoBuildTx -> CardanoAddress -> Either CardanoLedgerError ( Tx BabbageEra )
- makeAutoBalancedTransactionWithUtxoProvider :: Monad m => Params -> UtxoIndex -> CardanoAddress -> UtxoProvider m -> ( forall a. CardanoLedgerError -> m a) -> CardanoBuildTx -> m ( Tx BabbageEra )
- utxoProviderFromWalletOutputs :: Map TxOutRef TxOut -> UtxoProvider ( Either BalancingError )
- data BalancingError
- selectCoin :: Eq a => [(a, Value )] -> Value -> Either BalancingError ([a], Value )
Documentation
estimateCardanoBuildTxFee :: Params -> UTxO EmulatorEra -> CardanoBuildTx -> Either CardanoLedgerError Lovelace Source #
makeAutoBalancedTransaction Source #
:: 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 #
:: Monad m | |
=> Params | |
-> UtxoIndex |
Just the transaction inputs, not the entire
|
-> CardanoAddress |
Change address |
-> UtxoProvider m | |
-> ( 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.
utxoProviderFromWalletOutputs Source #
:: Map TxOutRef TxOut |
The unspent transaction outputs. Make sure that this doesn't contain any inputs from the transaction being balanced. |
-> UtxoProvider ( Either BalancingError ) |
data BalancingError Source #
InsufficientFunds |
Not enough extra inputs available to balance a transaction. |
CardanoLedgerError CardanoLedgerError |