Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Building cardano transactions from tx bodies
Synopsis
- data CoinSelectionError
- bodyError ∷ TxBodyError → CoinSelectionError
- data CSInputs = CSInputs {}
- type ERA = BabbageEra
- utxo ∷ Lens' CSInputs (UTxO ERA)
- txBody ∷ Lens' CSInputs (TxBodyContent BuildTx ERA)
- changeOutput ∷ Lens' CSInputs (TxOut CtxTx BabbageEra)
- numWitnesses ∷ Lens' CSInputs Word
- data BalancingError
- balanceTransactionBody ∷ SystemStart → EraHistory CardanoMode → BundledProtocolParameters BabbageEra → Set PoolId → CSInputs → Either BalancingError (BalancedTxBody ERA, BalanceChanges)
- balanceForWallet ∷ (MonadBlockchain m, MonadFail m) ⇒ Wallet → UtxoSet CtxUTxO a → TxBodyContent BuildTx ERA → m (Tx ERA, BalanceChanges)
- balanceForWalletReturn ∷ (MonadBlockchain m, MonadFail m) ⇒ Wallet → UtxoSet CtxUTxO a → TxOut CtxTx BabbageEra → TxBodyContent BuildTx ERA → m (Tx ERA, BalanceChanges)
- balanceTx ∷ (MonadBlockchain m, MonadFail m) ⇒ TxOut CtxTx BabbageEra → UtxoSet CtxUTxO a → TxBodyContent BuildTx ERA → m (BalancedTxBody ERA, BalanceChanges)
- signForWallet ∷ Wallet → BalancedTxBody ERA → Tx ERA
- balanceChanges ∷ UTxO ERA → TxBodyContent BuildTx ERA → Maybe BalanceChanges
- requiredTxIns ∷ TxBodyContent v BabbageEra → Set TxIn
- spentTxIns ∷ TxBodyContent v BabbageEra → Set TxIn
- prepCSInputs ∷ MonadBlockchain m ⇒ TxOut CtxTx BabbageEra → UTxO ERA → TxBodyContent BuildTx BabbageEra → m CSInputs
Data types
data CoinSelectionError Source #
Instances
Inputs needed for coin selection
CSInputs | |
|
type ERA = BabbageEra Source #
Balancing
data BalancingError Source #
BalancingError Text | |
CheckMinUtxoValueError (TxOut CtxTx BabbageEra) Lovelace | |
BalanceCheckError BalancingError | |
ComputeBalanceChangeError |
Instances
balanceTransactionBody ∷ SystemStart → EraHistory CardanoMode → BundledProtocolParameters BabbageEra → Set PoolId → CSInputs → Either BalancingError (BalancedTxBody ERA, BalanceChanges) Source #
Perform transaction balancing
balanceForWallet ∷ (MonadBlockchain m, MonadFail m) ⇒ Wallet → UtxoSet CtxUTxO a → TxBodyContent BuildTx ERA → m (Tx ERA, BalanceChanges) Source #
Balance the transaction using the wallet's funds, then sign it.
balanceForWalletReturn ∷ (MonadBlockchain m, MonadFail m) ⇒ Wallet → UtxoSet CtxUTxO a → TxOut CtxTx BabbageEra → TxBodyContent BuildTx ERA → m (Tx ERA, BalanceChanges) Source #
Balance the transaction using the wallet's funds and the provided return output, then sign it.
∷ (MonadBlockchain m, MonadFail m) | |
⇒ TxOut CtxTx BabbageEra | Return output used for leftover funds. This output will be used for balancing, and it will be added to the transaction IF the funds locked in it (after balancing) are non zero. |
→ UtxoSet CtxUTxO a | Set of UTxOs that can be used to supply missing funds |
→ TxBodyContent BuildTx ERA | The unbalanced transaction body |
→ m (BalancedTxBody ERA, BalanceChanges) | The balanced transaction body and the balance changes (per address) |
Balance the transaction using the given UTXOs and return address. This
calls balanceTransactionBody
after preparing all the required inputs.
signForWallet ∷ Wallet → BalancedTxBody ERA → Tx ERA Source #
Sign a transaction with the wallet's key
Balance changes
balanceChanges ∷ UTxO ERA → TxBodyContent BuildTx ERA → Maybe BalanceChanges Source #
Get the BalanceChanges
for a tx body. Returns Nothing
if
a UTXO couldnt be found
spentTxIns ∷ TxBodyContent v BabbageEra → Set TxIn Source #
Etc.
∷ MonadBlockchain m | |
⇒ TxOut CtxTx BabbageEra | Change address |
→ UTxO ERA | UTxOs that may be used for balancing |
→ TxBodyContent BuildTx BabbageEra | Unbalanced transaction body |
→ m CSInputs | Inputs for coin balancing |
Take the tx body and produce a CSInputs
value for coin selection,
using the MonadBlockchain
effect to query any missing UTxO information.