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 (EraCrypto era) → Maybe Coin) → (Credential 'DRepRole (EraCrypto era) → Maybe Coin) → UTxO era → TxBody era → Value era
- getProducedValue ∷ PParams era → (KeyHash 'StakePool (EraCrypto era) → Bool) → TxBody era → Value era
- getScriptsProvided ∷ UTxO era → Tx era → ScriptsProvided era
- getScriptsNeeded ∷ UTxO era → TxBody era → ScriptsNeeded era
- getScriptsHashesNeeded ∷ ScriptsNeeded era → Set (ScriptHash (EraCrypto era))
- getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness (EraCrypto era))
- getMinFeeTxUtxo ∷ PParams era → Tx era → UTxO era → Coin
- newtype ScriptsProvided era = ScriptsProvided {
- unScriptsProvided ∷ Map (ScriptHash (EraCrypto era)) (Script era)
- txins ∷ EraTxBody era ⇒ TxBody era → Set (TxIn (EraCrypto era))
- txinLookup ∷ TxIn (EraCrypto era) → UTxO era → Maybe (TxOut era)
- txInsFilter ∷ UTxO era → Set (TxIn (EraCrypto era)) → 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, Crypto c, DSignable c (Hash c EraIndependentTxBody)) ⇒ Hash c EraIndependentTxBody → WitVKey kr c → Bool
- getScriptHash ∷ Addr c → Maybe (ScriptHash c)
Primitives
The unspent transaction outputs.
Instances
(Era era, ToJSON (TxOut era)) ⇒ ToJSON (UTxO era) Source # | |
Era era ⇒ Monoid (UTxO era) Source # | |
Semigroup (UTxO era) Source # | |
Generic (UTxO era) Source # | |
(Show (TxOut era), Crypto (EraCrypto 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 # | |
(Crypto (EraCrypto era), DecShareCBOR (TxOut era), Share (TxOut era) ~ Interns (Credential 'Staking (EraCrypto era))) ⇒ 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 (EraCrypto era) → Maybe Coin) | Function that can lookup current delegation deposits |
→ (Credential 'DRepRole (EraCrypto era) → 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 (EraCrypto era) → 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 (EraCrypto era)) Source #
Extract the set of all script hashes that are needed for script validation.
getWitsVKeyNeeded ∷ CertState era → UTxO era → TxBody era → Set (KeyHash 'Witness (EraCrypto era)) 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.
ScriptsProvided | |
|
Instances
Functions
txins ∷ EraTxBody era ⇒ TxBody era → Set (TxIn (EraCrypto era)) Source #
Compute the UTxO inputs of a transaction. txins has the same problems as txouts, see notes below.
txinLookup ∷ TxIn (EraCrypto era) → UTxO era → Maybe (TxOut era) Source #
Lookup a txin for a given UTxO collection
∷ UTxO era | Source |
→ Set (TxIn (EraCrypto era)) | Which of the |
→ UTxO era |
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, Crypto c, DSignable c (Hash c EraIndependentTxBody)) ⇒ Hash c EraIndependentTxBody → WitVKey kr c → Bool Source #
Verify a transaction body witness
getScriptHash ∷ Addr c → Maybe (ScriptHash c) Source #
Extract script hash from value address with script.