Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype UTxO era = UTxO {}
- class EraTx era ⇒ EraUTxO era where
- type ScriptsNeeded era = (r ∷ Type) | r → era
- getConsumedValue ∷ PParams era → (Credential 'Staking → Maybe Coin) → (Credential 'DRepRole → Maybe Coin) → UTxO era → TxBody era → Value era
- getProducedValue ∷ PParams era → (KeyHash 'StakePool → Bool) → TxBody era → Value era
- getScriptsProvided ∷ UTxO era → Tx era → ScriptsProvided era
- getScriptsNeeded ∷ UTxO era → TxBody era → ScriptsNeeded era
- getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash
- getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness)
- getMinFeeTxUtxo ∷ PParams era → Tx era → UTxO era → Coin
- newtype ScriptsProvided era = ScriptsProvided {
- unScriptsProvided ∷ Map ScriptHash (Script era)
- txins ∷ EraTxBody era ⇒ TxBody era → Set TxIn
- txinLookup ∷ TxIn → UTxO era → Maybe (TxOut era)
- txInsFilter ∷ UTxO era → Set TxIn → UTxO era
- txouts ∷ ∀ era. EraTxBody era ⇒ TxBody era → UTxO era
- balance ∷ EraTxOut era ⇒ UTxO era → Value era
- coinBalance ∷ EraTxOut era ⇒ UTxO era → Coin
- sumAllValue ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Value era
- sumAllCoin ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Coin
- areAllAdaOnly ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Bool
- verifyWitVKey ∷ Typeable kr ⇒ Hash HASH EraIndependentTxBody → WitVKey kr → Bool
- getScriptHash ∷ Addr → Maybe ScriptHash
Primitives
The unspent transaction outputs.
Instances
ToJSON (TxOut era) ⇒ ToJSON (UTxO era) Source # | |
Era era ⇒ Monoid (UTxO era) Source # | |
Semigroup (UTxO era) Source # | |
Generic (UTxO era) Source # | |
Show (TxOut era) ⇒ Show (UTxO era) Source # | |
(DecCBOR (TxOut era), Era era) ⇒ FromCBOR (UTxO era) Source # | |
(EncCBOR (TxOut era), Era era) ⇒ ToCBOR (UTxO era) Source # | |
(Era era, DecCBOR (TxOut era)) ⇒ DecCBOR (UTxO era) Source # | |
(DecShareCBOR (TxOut era), Share (TxOut era) ~ Interns (Credential 'Staking)) ⇒ DecShareCBOR (UTxO era) Source # | |
(Era era, EncCBOR (TxOut era)) ⇒ EncCBOR (UTxO era) Source # | |
Default (UTxO era) Source # | |
Defined in Cardano.Ledger.UTxO | |
(Era era, NFData (TxOut era)) ⇒ NFData (UTxO era) Source # | |
Defined in Cardano.Ledger.UTxO | |
(Era era, Eq (TxOut era)) ⇒ Eq (UTxO era) Source # | |
NoThunks (TxOut era) ⇒ NoThunks (UTxO era) Source # | |
type Rep (UTxO era) Source # | |
Defined in Cardano.Ledger.UTxO | |
type Share (UTxO era) Source # | |
class EraTx era ⇒ EraUTxO era where Source #
type ScriptsNeeded era = (r ∷ Type) | r → era Source #
A customizable type on per era basis for the information required to find all scripts needed for the transaction.
∷ PParams era | |
→ (Credential 'Staking → Maybe Coin) | Function that can lookup current delegation deposits |
→ (Credential 'DRepRole → Maybe Coin) | Function that can lookup current drep deposits |
→ UTxO era | |
→ TxBody era | |
→ Value era |
Calculate all the value that is being consumed by the transaction.
∷ PParams era | |
→ (KeyHash 'StakePool → Bool) | Check whether a pool with a supplied PoolStakeId is already registered. |
→ TxBody era | |
→ Value era |
∷ UTxO era | For some era it is necessary to look into the UTxO to find all of the available scripts for the transaction |
→ Tx era | |
→ ScriptsProvided era |
Initial eras will look into witness set to find all of the available scripts, but starting with Babbage we can look for available scripts in the UTxO using reference inputs.
getScriptsNeeded ∷ UTxO era → TxBody era → ScriptsNeeded era Source #
Produce all the information required for figuring out which scripts are required for the transaction to be valid, once those scripts are evaluated
getScriptsHashesNeeded ∷ ScriptsNeeded era → Set ScriptHash Source #
Extract the set of all script hashes that are needed for script validation.
getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness) Source #
Extract all of the KeyHash witnesses that are required for validating the transaction
getMinFeeTxUtxo ∷ PParams era → Tx era → UTxO era → Coin Source #
Minimum fee computation, excluding witnesses and including ref scripts size
newtype ScriptsProvided era Source #
The only reason it is a newtype instead of just a Map is becuase for later eras is expensive to compute the actual map, so we want to use the type safety guidance to avoid redundant work.
Instances
Functions
txins ∷ EraTxBody era ⇒ TxBody era → Set TxIn Source #
Compute the UTxO inputs of a transaction. txins has the same problems as txouts, see notes below.
Filter out TxIn's from the UTxO
map
txouts ∷ ∀ era. EraTxBody era ⇒ TxBody era → UTxO era Source #
Compute the transaction outputs of a transaction.
balance ∷ EraTxOut era ⇒ UTxO era → Value era Source #
Determine the total balance contained in the UTxO.
coinBalance ∷ EraTxOut era ⇒ UTxO era → Coin Source #
Determine the total Ada only balance contained in the UTxO. This is equivalent to `coin . balance`, but it will be more efficient
sumAllValue ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Value era Source #
Sum all the value in any Foldable with TxOut
s
areAllAdaOnly ∷ (EraTxOut era, Foldable f) ⇒ f (TxOut era) → Bool Source #
Check whether any of the supplied TxOut
s contain any MultiAssets. Returns
True if non of them do.
verifyWitVKey ∷ Typeable kr ⇒ Hash HASH EraIndependentTxBody → WitVKey kr → Bool Source #
Verify a transaction body witness
getScriptHash ∷ Addr → Maybe ScriptHash Source #
Extract script hash from value address with script.