hydra-node-0.13.0: The Hydra node
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hydra.Ledger

Synopsis

Documentation

class (Eq tx, Show tx, Typeable tx, Arbitrary tx, FromCBOR tx, ToCBOR tx, FromJSON tx, ToJSON tx, Eq (TxIdType tx), Ord (TxIdType tx), Show (TxIdType tx), Typeable (TxIdType tx), Arbitrary (TxIdType tx), FromJSON (TxIdType tx), ToJSON (TxIdType tx), FromCBOR (TxIdType tx), ToCBOR (TxIdType tx), FromJSONKey (TxIdType tx), ToJSONKey (TxIdType tx), Eq (UTxOType tx), Show (UTxOType tx), Arbitrary (UTxOType tx), FromJSON (UTxOType tx), Monoid (UTxOType tx), ToJSON (UTxOType tx), FromCBOR (UTxOType tx), ToCBOR (UTxOType tx)) => IsTx tx where Source #

Associated Types

type UTxOType tx Source #

type TxIdType tx Source #

type ValueType tx Source #

Methods

txId :: tx -> TxIdType tx Source #

balance :: UTxOType tx -> ValueType tx Source #

hashUTxO :: UTxOType tx -> ByteString Source #

Hash a utxo set to be able to sign (off-chain) and verify it (on-chain).

Instances

Instances details
IsTx Tx Source # 
Instance details

Defined in Hydra.Ledger.Cardano

Associated Types

type UTxOType Tx Source #

type TxIdType Tx Source #

type ValueType Tx Source #

IsTx SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

newtype ChainSlot Source #

A generic description for a chain slot all implementions need to use.

Constructors

ChainSlot Natural 

Instances

Instances details
Arbitrary ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

FromJSON ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

Methods

parseJSON :: Value -> Parser ChainSlot

parseJSONList :: Value -> Parser [ChainSlot]

ToJSON ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

Methods

toJSON :: ChainSlot -> Value

toEncoding :: ChainSlot -> Encoding

toJSONList :: [ChainSlot] -> Value

toEncodingList :: [ChainSlot] -> Encoding

Generic ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

Associated Types

type Rep ChainSlot :: Type -> Type Source #

Show ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

Eq ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

Ord ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

type Rep ChainSlot Source # 
Instance details

Defined in Hydra.Ledger

type Rep ChainSlot = D1 ('MetaData "ChainSlot" "Hydra.Ledger" "hydra-node-0.13.0-HKlbaPrFKjs2dhEMwn7ono" 'True) (C1 ('MetaCons "ChainSlot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)))

nextChainSlot :: ChainSlot -> ChainSlot Source #

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

data 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

  • initUTxO :: UTxOType tx

    Generates an initial UTXO set. This is only temporary as it does not allow to initialize the UTXO.

    TODO: This seems redundant with the `Monoid (UTxOType tx)` constraints coming with IsTx. We probably want to dry this out.

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

Methods

parseJSON :: Value -> Parser ValidationResult

parseJSONList :: Value -> Parser [ValidationResult]

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.13.0-HKlbaPrFKjs2dhEMwn7ono" '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

Methods

parseJSON :: Value -> Parser ValidationError

parseJSONList :: Value -> Parser [ValidationError]

ToJSON ValidationError Source # 
Instance details

Defined in Hydra.Ledger

Methods

toJSON :: ValidationError -> Value

toEncoding :: ValidationError -> Encoding

toJSONList :: [ValidationError] -> Value

toEncodingList :: [ValidationError] -> Encoding

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.13.0-HKlbaPrFKjs2dhEMwn7ono" 'True) (C1 ('MetaCons "ValidationError" 'PrefixI 'True) (S1 ('MetaSel ('Just "reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))