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

Hydra.Ledger.Simple

Description

A mock implementation of a ledger using very simple UTxO transactions.

These transactions have a very simplified representation of unspent transaction outputs being just integers, but already have inputs and outputs. Transactions are validated against the current state of the ledger, so that one transaction could at some point be invalid, then becomes valid because some inputs it consumes are now available.

NOTE: There is no notion of time in this ledger, so transactions validation will never depend on the L1 slot.

Synopsis

Simple transactions

data SimpleTx Source #

Simple transaction. A transaction is a SimpleId, a list of inputs and a list of outputs, and it has no time validity.

Instances

Instances details
Arbitrary SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

FromJSON SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

parseJSON :: Value -> Parser SimpleTx

parseJSONList :: Value -> Parser [SimpleTx]

omittedField :: Maybe SimpleTx

ToJSON SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

toJSON :: SimpleTx -> Value

toEncoding :: SimpleTx -> Encoding

toJSONList :: [SimpleTx] -> Value

toEncodingList :: [SimpleTx] -> Encoding

omitField :: SimpleTx -> Bool

Generic SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Associated Types

type Rep SimpleTx :: Type -> Type Source #

Show SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

FromCBOR SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

fromCBOR :: Decoder s SimpleTx

label :: Proxy SimpleTx -> Text

ToCBOR SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

toCBOR :: SimpleTx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy SimpleTx -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [SimpleTx] -> Size

Eq SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Ord SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

IsChainState SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Associated Types

type ChainStateType SimpleTx = (c :: Type) Source #

IsTx SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

type Rep SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

type Rep SimpleTx = D1 ('MetaData "SimpleTx" "Hydra.Ledger.Simple" "hydra-node-0.17.0-91fkOAdXopBJTVA4BAJm8n" 'False) (C1 ('MetaCons "SimpleTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "txSimpleId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SimpleId) :*: (S1 ('MetaSel ('Just "txInputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType SimpleTx)) :*: S1 ('MetaSel ('Just "txOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType SimpleTx)))))
type ChainStateType SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

type TxIdType SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

type UTxOType SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

type ValueType SimpleTx Source # 
Instance details

Defined in Hydra.Ledger.Simple

Simple chain state

newtype SimpleChainState Source #

Constructors

SimpleChainState 

Fields

Instances

Instances details
Arbitrary SimpleChainState Source # 
Instance details

Defined in Hydra.Ledger.Simple

FromJSON SimpleChainState Source # 
Instance details

Defined in Hydra.Ledger.Simple

ToJSON SimpleChainState Source # 
Instance details

Defined in Hydra.Ledger.Simple

Generic SimpleChainState Source # 
Instance details

Defined in Hydra.Ledger.Simple

Associated Types

type Rep SimpleChainState :: Type -> Type Source #

Show SimpleChainState Source # 
Instance details

Defined in Hydra.Ledger.Simple

Eq SimpleChainState Source # 
Instance details

Defined in Hydra.Ledger.Simple

type Rep SimpleChainState Source # 
Instance details

Defined in Hydra.Ledger.Simple

type Rep SimpleChainState = D1 ('MetaData "SimpleChainState" "Hydra.Ledger.Simple" "hydra-node-0.17.0-91fkOAdXopBJTVA4BAJm8n" 'True) (C1 ('MetaCons "SimpleChainState" 'PrefixI 'True) (S1 ('MetaSel ('Just "slot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainSlot)))

newtype SimpleTxIn Source #

An identifier for a single output of a SimpleTx.

Constructors

SimpleTxIn 

Instances

Instances details
Arbitrary SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

FromJSON SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

parseJSON :: Value -> Parser SimpleTxIn

parseJSONList :: Value -> Parser [SimpleTxIn]

omittedField :: Maybe SimpleTxIn

ToJSON SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

toJSON :: SimpleTxIn -> Value

toEncoding :: SimpleTxIn -> Encoding

toJSONList :: [SimpleTxIn] -> Value

toEncodingList :: [SimpleTxIn] -> Encoding

omitField :: SimpleTxIn -> Bool

Generic SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

Associated Types

type Rep SimpleTxIn :: Type -> Type Source #

Num SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

Show SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

FromCBOR SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

fromCBOR :: Decoder s SimpleTxIn

label :: Proxy SimpleTxIn -> Text

ToCBOR SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

Methods

toCBOR :: SimpleTxIn -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy SimpleTxIn -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [SimpleTxIn] -> Size

Eq SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

Ord SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

type Rep SimpleTxIn Source # 
Instance details

Defined in Hydra.Ledger.Simple

type Rep SimpleTxIn = D1 ('MetaData "SimpleTxIn" "Hydra.Ledger.Simple" "hydra-node-0.17.0-91fkOAdXopBJTVA4BAJm8n" 'True) (C1 ('MetaCons "SimpleTxIn" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSimpleTxIn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))