hydra-tx-0.19.0: Hydra transaction library
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Tx.IsTx

Synopsis

Documentation

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

Types of transactions that can be used by the Head protocol. The associated types and methods of this type class represent the whole interface of what the Head protocol needs from a transaction. This ensure the off-chain protocol stays fairly independent of a concrete transaction type.

Associated Types

type TxIdType tx Source #

Type which identifies a transaction

type TxOutType tx = out | out -> tx Source #

Type for individual transaction outputs.

type UTxOType tx = utxo | utxo -> tx Source #

Type for a set of unspent transaction outputs.

type ValueType tx Source #

Type representing a value on the ledger.

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).

txSpendingUTxO :: UTxOType tx -> tx Source #

utxoFromTx :: tx -> UTxOType tx Source #

Get the UTxO produced by given transaction.

outputsOfUTxO :: UTxOType tx -> [TxOutType tx] Source #

Get only the outputs in given UTxO.

withoutUTxO :: UTxOType tx -> UTxOType tx -> UTxOType tx Source #

Return the left-hand side without the right-hand side.

Instances

Instances details
IsTx Tx Source # 
Instance details

Defined in Hydra.Tx.IsTx

Associated Types

type TxIdType Tx Source #

type TxOutType Tx = (out :: Type) Source #

type UTxOType Tx = (utxo :: Type) Source #

type ValueType Tx Source #

Constraint synonyms

type ArbitraryIsTx tx = (IsTx tx, Arbitrary tx, Arbitrary (UTxOType tx), Arbitrary (TxIdType tx), Arbitrary (TxOutType tx)) Source #

Cardano Tx

Orphan instances

FromJSON Tx Source # 
Instance details

Methods

parseJSON :: Value -> Parser Tx

parseJSONList :: Value -> Parser [Tx]

omittedField :: Maybe Tx

FromCBOR UTxO Source # 
Instance details

Methods

fromCBOR :: Decoder s UTxO

label :: Proxy UTxO -> Text

FromCBOR Tx Source # 
Instance details

Methods

fromCBOR :: Decoder s Tx

label :: Proxy Tx -> Text

ToCBOR UTxO Source # 
Instance details

Methods

toCBOR :: UTxO -> Encoding

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

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

IsShelleyBasedEra era => ToJSON (Tx era) Source # 
Instance details

Methods

toJSON :: Tx era -> Value

toEncoding :: Tx era -> Encoding

toJSONList :: [Tx era] -> Value

toEncodingList :: [Tx era] -> Encoding

omitField :: Tx era -> Bool

IsShelleyBasedEra era => ToCBOR (Tx era) Source # 
Instance details

Methods

toCBOR :: Tx era -> Encoding

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

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