| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Tx.IsTx
Contents
Synopsis
- 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), Ord (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
- type TxIdType tx
- type TxOutType tx = out | out -> tx
- type UTxOType tx = utxo | utxo -> tx
- type ValueType tx
- txId :: tx -> TxIdType tx
- balance :: UTxOType tx -> ValueType tx
- hashUTxO :: UTxOType tx -> ByteString
- txIdBytes :: TxIdType tx -> ByteString
- txSpendingUTxO :: UTxOType tx -> tx
- utxoFromTx :: tx -> UTxOType tx
- outputsOfUTxO :: UTxOType tx -> [TxOutType tx]
- withoutUTxO :: UTxOType tx -> UTxOType tx -> UTxOType tx
- applyTxTo :: tx -> UTxOType tx -> UTxOType tx
- filterUTxOByOutputs :: UTxOType tx -> Set (TxOutType tx) -> UTxOType tx
- removeOneOutputFromUTxO :: TxOutType tx -> UTxOType tx -> UTxOType tx
- utxoToElement :: TxOutType tx -> ByteString
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), Ord (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 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 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).
txIdBytes :: TxIdType tx -> ByteString Source #
Raw bytes identifying a transaction, as bound into snapshot signatures.
Must match what the on-chain code reads out of a TxOutRef, see
getSignableRepresentation.
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.
applyTxTo :: tx -> UTxOType tx -> UTxOType tx Source #
Apply a transaction to a UTxO via pure UTxO arithmetic, returning the post-tx UTxO. Removes the tx's inputs from the given UTxO and adds the tx's outputs. Performs no ledger validation; the caller must ensure the tx is valid against the given UTxO.
filterUTxOByOutputs :: UTxOType tx -> Set (TxOutType tx) -> UTxOType tx Source #
Filter a UTxO set keeping only entries whose output value is in the given set.
removeOneOutputFromUTxO :: TxOutType tx -> UTxOType tx -> UTxOType tx Source #
utxoToElement :: TxOutType tx -> ByteString Source #
Convert a TxOut to a ByteString element for the accumulator. This serializes the TxOut in the same way as the on-chain code does.
Instances
| IsTx Tx Source # | |
Defined in Hydra.Tx.IsTx Associated Types type TxOutType Tx = (out :: Type) Source # Methods txId :: Tx -> TxIdType Tx Source # balance :: UTxOType Tx -> ValueType Tx Source # hashUTxO :: UTxOType Tx -> ByteString Source # txIdBytes :: TxIdType Tx -> ByteString Source # txSpendingUTxO :: UTxOType Tx -> Tx Source # utxoFromTx :: Tx -> UTxOType Tx Source # outputsOfUTxO :: UTxOType Tx -> [TxOutType Tx] Source # withoutUTxO :: UTxOType Tx -> UTxOType Tx -> UTxOType Tx Source # applyTxTo :: Tx -> UTxOType Tx -> UTxOType Tx Source # filterUTxOByOutputs :: UTxOType Tx -> Set (TxOutType Tx) -> UTxOType Tx Source # removeOneOutputFromUTxO :: TxOutType Tx -> UTxOType Tx -> UTxOType Tx Source # utxoToElement :: TxOutType Tx -> ByteString Source # | |
Cardano Tx
Orphan instances
| FromJSON Tx Source # | |
| FromJSON UTxO Source # | |
Methods parseJSON :: Value -> Parser UTxO parseJSONList :: Value -> Parser [UTxO] omittedField :: Maybe UTxO | |
| FromCBOR Tx Source # | |
| FromCBOR UTxO Source # | |
| ToCBOR UTxO Source # | |
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 # | |
Methods toJSON :: Tx era -> Value toEncoding :: Tx era -> Encoding toJSONList :: [Tx era] -> Value toEncodingList :: [Tx era] -> Encoding | |
| IsShelleyBasedEra era => ToCBOR (Tx era) Source # | |
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 | |
| Ord (TxOut CtxUTxO) Source # | Orphan XXX: This fully serialises both operands on every comparison (including any
reference script, as hex CBOR), so it is O(size of output) rather than O(1)
and allocates on each call. It is kept as-is deliberately: the ordering it
induces is observable through every |
Methods compare :: TxOut CtxUTxO -> TxOut CtxUTxO -> Ordering Source # (<) :: TxOut CtxUTxO -> TxOut CtxUTxO -> Bool Source # (<=) :: TxOut CtxUTxO -> TxOut CtxUTxO -> Bool Source # (>) :: TxOut CtxUTxO -> TxOut CtxUTxO -> Bool Source # (>=) :: TxOut CtxUTxO -> TxOut CtxUTxO -> Bool Source # max :: TxOut CtxUTxO -> TxOut CtxUTxO -> TxOut CtxUTxO Source # min :: TxOut CtxUTxO -> TxOut CtxUTxO -> TxOut CtxUTxO Source # | |