hydra-node-0.20.0: The Hydra node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Ledger

Synopsis

Documentation

outputsOfTx :: IsTx tx => tx -> [TxOutType tx] Source #

Get outputs of a transaction.

nextChainSlot :: ChainSlot -> ChainSlot Source #

Get the next chain slot. Use this instead of giving Enum or Num instances to ChainSlot.

newtype Ledger tx Source #

An abstract interface for a Ledger. Allows to define mock / simpler implementation for testing as well as limiting feature-envy from the business logic by forcing a closed interface.

Constructors

Ledger 

Fields

  • applyTransactions :: ChainSlot -> UTxOType tx -> [tx] -> Either (tx, ValidationError) (UTxOType tx)

    Apply a set of transaction to a given UTxO set. Returns the new UTxO or validation failures returned from the ledger. TODO: ValidationError should also include the UTxO, which is not necessarily the same as the given UTxO after some transactions

canApply :: Ledger tx -> ChainSlot -> UTxOType tx -> tx -> ValidationResult Source #

collectTransactions :: Ledger tx -> ChainSlot -> UTxOType tx -> [tx] -> ([tx], UTxOType tx) Source #

Collect applicable transactions and resulting UTxO. In contrast to $sel:applyTransactions:Ledger, this functions continues on validation errors.

data ValidationResult Source #

Either valid or an error which we get from the ledger-specs tx validation.

Instances

Instances details
FromJSON ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

ToJSON ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

Generic ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

Associated Types

type Rep ValidationResult :: Type -> Type Source #

Show ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

Eq ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationResult Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationResult = D1 ('MetaData "ValidationResult" "Hydra.Ledger" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "Valid" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Invalid" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ValidationError)))

newtype ValidationError Source #

Constructors

ValidationError 

Fields

Instances

Instances details
Arbitrary ValidationError Source # 
Instance details

Defined in Hydra.Ledger

FromJSON ValidationError Source # 
Instance details

Defined in Hydra.Ledger

ToJSON ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Generic ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Associated Types

type Rep ValidationError :: Type -> Type Source #

Show ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Eq ValidationError Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationError Source # 
Instance details

Defined in Hydra.Ledger

type Rep ValidationError = D1 ('MetaData "ValidationError" "Hydra.Ledger" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'True) (C1 ('MetaCons "ValidationError" 'PrefixI 'True) (S1 ('MetaSel ('Just "reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))