Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- getSTSLedgerEnv ∷ Reflect era ⇒ Proof era → TxIx → Env era → Typed (LedgerEnv era, LedgerState era)
- plutusFree ∷ ∀ era a. Reflect era ⇒ Map (ScriptHash (EraCrypto era)) a → TxOut era → Bool
- plutusFreeAddr ∷ Map (ScriptHash c) a → Addr c → Bool
- plutusFreeValue ∷ Proof era → Map (ScriptHash (EraCrypto era)) a → Value era → Bool
- plutusFreePolicyID ∷ Map (ScriptHash c) a → PolicyID c → Bool
- plutusFreeCredential ∷ Map (ScriptHash c) a → Credential kr c → Bool
- simpleTxBody ∷ Reflect era ⇒ Proof era → Coin → TraceM era [TxBodyField era]
- simpleTx ∷ Reflect era ⇒ Proof era → Coin → TraceM era (Tx era)
- completeTxBody ∷ Reflect era ⇒ Proof era → Coin → TxBody era → TraceM era (Tx era)
- addWitnesses ∷ ∀ era. Reflect era ⇒ Proof era → Map (ScriptHash (EraCrypto era)) (Script era) → Map (ScriptHash (EraCrypto era)) (IsValid, ScriptF era) → Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey) → Map (KeyHash 'Witness (EraCrypto era)) (KeyPair 'Witness (EraCrypto era)) → Map (DataHash (EraCrypto era)) (Data era) → TxBody era → UTxO era → GenDelegs (EraCrypto era) → Tx era
- adjustTxForFee ∷ EraTx era ⇒ Proof era → Coin → Tx era → Tx era
- feeCoinL ∷ EraTx era ⇒ Lens' (Tx era) Coin
- firstOutputCoinL ∷ EraTx era ⇒ Lens' (Tx era) Coin
- strictSeqHeadL ∷ Lens' (StrictSeq a) a
Documentation
getSTSLedgerEnv ∷ Reflect era ⇒ Proof era → TxIx → Env era → Typed (LedgerEnv era, LedgerState era) Source #
Given an (Env era) construct the pair the the LendgerEnv and the LedgerState
plutusFree ∷ ∀ era a. Reflect era ⇒ Map (ScriptHash (EraCrypto era)) a → TxOut era → Bool Source #
Does a TxOut have only Non-Plutus Scripts. Non-Plutus status is measured by non-membership in the Map of script hashes of all Plutus scripts.
plutusFreeAddr ∷ Map (ScriptHash c) a → Addr c → Bool Source #
plutusFreeValue ∷ Proof era → Map (ScriptHash (EraCrypto era)) a → Value era → Bool Source #
plutusFreePolicyID ∷ Map (ScriptHash c) a → PolicyID c → Bool Source #
plutusFreeCredential ∷ Map (ScriptHash c) a → Credential kr c → Bool Source #
simpleTxBody ∷ Reflect era ⇒ Proof era → Coin → TraceM era [TxBodyField era] Source #
Make a simple TxBody with 1 input and 1 output. We estimate that such a TxBody will lead to a fee
of less than feeEstimate
. So only pick inputs from the utxo that have at least that much coin. Balance the
Coin in the TxOut with the feeEstimate and the actual Coin in the UTxO output that corresponds to the input.
Only works if the internal Env of the TraceM monad stores variables capable of creating the LedgerState
See genLedgerStateEnv
for an example of how to do that.
simpleTx ∷ Reflect era ⇒ Proof era → Coin → TraceM era (Tx era) Source #
Generate a (Tx era) from a simple (TxBody era), with 1 input and 1 output.
Apply the "finishing" function completeTxBody
to make the result a valid Tx.
Only works if the internal Env of the TraceM monad stores variables capable of
creating the LedgerState. The parameter maxFeeEstimate
has to be chosen by
experience. The fee for most simpleTx as less than 60000. But in at least one
case we have seen as high as 108407. If that case happens we will discard.
A large fee is rare because it is caused by many scripts and fees that need large witnesses,
completeTxBody ∷ Reflect era ⇒ Proof era → Coin → TxBody era → TraceM era (Tx era) Source #
Complete a TxBody, by running a fix-point computation that 1) Adds the appropriate witnesses. 2) Adjusts the the first output to pay the estimated fee. Run the computation until both the fee and the hash of the TxBody reach a fixpoint. Only works if the internal Env of the TraceM monad stores variables capable of creating the LedgerState
addWitnesses ∷ ∀ era. Reflect era ⇒ Proof era → Map (ScriptHash (EraCrypto era)) (Script era) → Map (ScriptHash (EraCrypto era)) (IsValid, ScriptF era) → Map (KeyHash 'Payment (EraCrypto era)) (Addr (EraCrypto era), SigningKey) → Map (KeyHash 'Witness (EraCrypto era)) (KeyPair 'Witness (EraCrypto era)) → Map (DataHash (EraCrypto era)) (Data era) → TxBody era → UTxO era → GenDelegs (EraCrypto era) → Tx era Source #
Add witnesses to the TxBody to construct a Tx with the appropriate witnesses. This is a compilcated function, but it should be applicable to ANY Tx generated using the Universes.
adjustTxForFee ∷ EraTx era ⇒ Proof era → Coin → Tx era → Tx era Source #
adjust a Tx for the fee, by setting the fee to the correct value then moving the excess to the outputs
strictSeqHeadL ∷ Lens' (StrictSeq a) a Source #