Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.Ledger
Synopsis
- 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
- newtype ChainSlot = ChainSlot Natural
- nextChainSlot :: ChainSlot -> ChainSlot
- data Ledger tx = Ledger {
- applyTransactions :: ChainSlot -> UTxOType tx -> [tx] -> Either (tx, ValidationError) (UTxOType tx)
- initUTxO :: UTxOType tx
- canApply :: Ledger tx -> ChainSlot -> UTxOType tx -> tx -> ValidationResult
- data ValidationResult
- newtype ValidationError = ValidationError {
- reason :: Text
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 #
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).
A generic description for a chain slot all implementions need to use.
Instances
Arbitrary ChainSlot Source # | |
FromJSON ChainSlot Source # | |
Defined in Hydra.Ledger | |
ToJSON ChainSlot Source # | |
Defined in Hydra.Ledger Methods toEncoding :: ChainSlot -> Encoding toJSONList :: [ChainSlot] -> Value toEncodingList :: [ChainSlot] -> Encoding | |
Generic ChainSlot Source # | |
Show ChainSlot Source # | |
Eq ChainSlot Source # | |
Ord ChainSlot Source # | |
Defined in Hydra.Ledger | |
type Rep ChainSlot Source # | |
Defined in Hydra.Ledger |
nextChainSlot :: ChainSlot -> ChainSlot 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
|
data ValidationResult Source #
Either valid or an error which we get from the ledger-specs tx validation.
Constructors
Valid | |
Invalid ValidationError |
Instances
newtype ValidationError Source #
Constructors
ValidationError | |
Fields
|