Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Hydra.Tx.Observe
Description
Observe hydra transactions
Synopsis
- data HeadObservation
- = NoHeadTx
- | Init InitObservation
- | Abort AbortObservation
- | Commit CommitObservation
- | CollectCom CollectComObservation
- | Deposit DepositObservation
- | Recover RecoverObservation
- | Increment IncrementObservation
- | Decrement DecrementObservation
- | Close CloseObservation
- | Contest ContestObservation
- | Fanout FanoutObservation
- observeHeadTx :: NetworkId -> UTxO -> Tx -> HeadObservation
- data InitObservation = InitObservation {
- initialThreadUTxO :: (TxIn, TxOut CtxUTxO)
- initials :: [(TxIn, TxOut CtxUTxO)]
- headId :: HeadId
- seedTxIn :: TxIn
- contestationPeriod :: ContestationPeriod
- parties :: [Party]
- participants :: [OnChainId]
- data NotAnInitReason
- observeInitTx :: Tx -> Either NotAnInitReason InitObservation
- newtype AbortObservation = AbortObservation {}
- observeAbortTx :: UTxO -> Tx -> Maybe AbortObservation
- data CommitObservation = CommitObservation {}
- observeCommitTx :: NetworkId -> UTxO -> Tx -> Maybe CommitObservation
- data CollectComObservation = CollectComObservation {}
- observeCollectComTx :: UTxO -> Tx -> Maybe CollectComObservation
- data DecrementObservation = DecrementObservation {
- headId :: HeadId
- newVersion :: SnapshotVersion
- distributedOutputs :: [TxOut CtxUTxO]
- observeDecrementTx :: UTxO -> Tx -> Maybe DecrementObservation
- data DepositObservation = DepositObservation {
- headId :: HeadId
- deposited :: UTxO
- depositTxId :: TxId
- deadline :: POSIXTime
- observeDepositTx :: NetworkId -> Tx -> Maybe DepositObservation
- data IncrementObservation = IncrementObservation {
- headId :: HeadId
- newVersion :: SnapshotVersion
- depositTxId :: TxId
- observeIncrementTx :: UTxO -> Tx -> Maybe IncrementObservation
- data RecoverObservation = RecoverObservation {
- headId :: HeadId
- recoveredTxId :: TxId
- observeRecoverTx :: NetworkId -> UTxO -> Tx -> Maybe RecoverObservation
- data CloseObservation = CloseObservation {}
- observeCloseTx :: UTxO -> Tx -> Maybe CloseObservation
- data ContestObservation = ContestObservation {
- contestedThreadOutput :: (TxIn, TxOut CtxUTxO)
- headId :: HeadId
- snapshotNumber :: SnapshotNumber
- contestationDeadline :: UTCTime
- contesters :: [PubKeyHash]
- observeContestTx :: UTxO -> Tx -> Maybe ContestObservation
- newtype FanoutObservation = FanoutObservation {}
- observeFanoutTx :: UTxO -> Tx -> Maybe FanoutObservation
Documentation
data HeadObservation Source #
Generalised type for arbitrary Head observations on-chain.
Constructors
Instances
observeHeadTx :: NetworkId -> UTxO -> Tx -> HeadObservation Source #
Observe any Hydra head transaction.
data InitObservation Source #
Data which can be observed from an initTx
.
Constructors
InitObservation | |
Fields
|
Instances
data NotAnInitReason Source #
Instances
Generic NotAnInitReason Source # | |
Defined in Hydra.Tx.Init Methods from :: NotAnInitReason -> Rep NotAnInitReason x Source # to :: Rep NotAnInitReason x -> NotAnInitReason Source # | |
Show NotAnInitReason Source # | |
Defined in Hydra.Tx.Init | |
Eq NotAnInitReason Source # | |
Defined in Hydra.Tx.Init Methods (==) :: NotAnInitReason -> NotAnInitReason -> Bool Source # (/=) :: NotAnInitReason -> NotAnInitReason -> Bool Source # | |
type Rep NotAnInitReason Source # | |
Defined in Hydra.Tx.Init type Rep NotAnInitReason = D1 ('MetaData "NotAnInitReason" "Hydra.Tx.Init" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'False) ((C1 ('MetaCons "NoHeadOutput" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NotAHeadDatum" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "InvalidPartyInDatum" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NoSTFound" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NotAHeadPolicy" 'PrefixI 'False) (U1 :: Type -> Type)))) |
observeInitTx :: Tx -> Either NotAnInitReason InitObservation Source #
Identify a init tx by checking the output value for holding tokens that are valid head tokens (checked by seed + policy).
newtype AbortObservation Source #
Constructors
AbortObservation | |
Instances
Generic AbortObservation Source # | |
Defined in Hydra.Tx.Abort Methods from :: AbortObservation -> Rep AbortObservation x Source # to :: Rep AbortObservation x -> AbortObservation Source # | |
Show AbortObservation Source # | |
Defined in Hydra.Tx.Abort | |
Eq AbortObservation Source # | |
Defined in Hydra.Tx.Abort Methods (==) :: AbortObservation -> AbortObservation -> Bool Source # (/=) :: AbortObservation -> AbortObservation -> Bool Source # | |
type Rep AbortObservation Source # | |
Defined in Hydra.Tx.Abort type Rep AbortObservation = D1 ('MetaData "AbortObservation" "Hydra.Tx.Abort" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'True) (C1 ('MetaCons "AbortObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId))) |
Arguments
:: UTxO | A UTxO set to lookup tx inputs |
-> Tx | |
-> Maybe AbortObservation |
Identify an abort tx by looking up the input spending the Head output and decoding its redeemer.
data CommitObservation Source #
Full observation of a commit transaction.
Constructors
CommitObservation | |
Instances
Arguments
:: NetworkId | |
-> UTxO | A UTxO set to lookup tx inputs. Should at least contain the input spending from νInitial. |
-> Tx | |
-> Maybe CommitObservation |
Identify a commit tx by:
- Check that its spending from the init validator,
- Find the outputs which pays to the commit validator,
- Using the datum of that output, deserialize the committed output,
- Reconstruct the committed UTxO from both values (tx input and output).
data CollectComObservation Source #
Constructors
CollectComObservation | |
Fields
|
Instances
Arguments
:: UTxO | A UTxO set to lookup tx inputs |
-> Tx | |
-> Maybe CollectComObservation |
Identify a collectCom tx by lookup up the input spending the Head output and decoding its redeemer.
data DecrementObservation Source #
Constructors
DecrementObservation | |
Fields
|
Instances
observeDecrementTx :: UTxO -> Tx -> Maybe DecrementObservation Source #
data DepositObservation Source #
Constructors
DepositObservation | |
Fields
|
Instances
observeDepositTx :: NetworkId -> Tx -> Maybe DepositObservation Source #
data IncrementObservation Source #
Constructors
IncrementObservation | |
Fields
|
Instances
observeIncrementTx :: UTxO -> Tx -> Maybe IncrementObservation Source #
data RecoverObservation Source #
Constructors
RecoverObservation | |
Fields
|
Instances
Generic RecoverObservation Source # | |
Defined in Hydra.Tx.Recover Methods from :: RecoverObservation -> Rep RecoverObservation x Source # to :: Rep RecoverObservation x -> RecoverObservation Source # | |
Show RecoverObservation Source # | |
Defined in Hydra.Tx.Recover | |
Eq RecoverObservation Source # | |
Defined in Hydra.Tx.Recover Methods (==) :: RecoverObservation -> RecoverObservation -> Bool Source # (/=) :: RecoverObservation -> RecoverObservation -> Bool Source # | |
type Rep RecoverObservation Source # | |
Defined in Hydra.Tx.Recover type Rep RecoverObservation = D1 ('MetaData "RecoverObservation" "Hydra.Tx.Recover" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'False) (C1 ('MetaCons "RecoverObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "recoveredTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId))) |
observeRecoverTx :: NetworkId -> UTxO -> Tx -> Maybe RecoverObservation Source #
data CloseObservation Source #
Constructors
CloseObservation | |
Fields |
Instances
Arguments
:: UTxO | A UTxO set to lookup tx inputs |
-> Tx | |
-> Maybe CloseObservation |
Identify a close tx by lookup up the input spending the Head output and decoding its redeemer.
data ContestObservation Source #
Constructors
ContestObservation | |
Fields
|
Instances
Arguments
:: UTxO | A UTxO set to lookup tx inputs |
-> Tx | |
-> Maybe ContestObservation |
Identify a close tx by lookup up the input spending the Head output and decoding its redeemer.
newtype FanoutObservation Source #
Constructors
FanoutObservation | |
Instances
Generic FanoutObservation Source # | |
Defined in Hydra.Tx.Fanout Methods from :: FanoutObservation -> Rep FanoutObservation x Source # to :: Rep FanoutObservation x -> FanoutObservation Source # | |
Show FanoutObservation Source # | |
Defined in Hydra.Tx.Fanout | |
Eq FanoutObservation Source # | |
Defined in Hydra.Tx.Fanout Methods (==) :: FanoutObservation -> FanoutObservation -> Bool Source # (/=) :: FanoutObservation -> FanoutObservation -> Bool Source # | |
type Rep FanoutObservation Source # | |
Defined in Hydra.Tx.Fanout type Rep FanoutObservation = D1 ('MetaData "FanoutObservation" "Hydra.Tx.Fanout" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'True) (C1 ('MetaCons "FanoutObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId))) |
Arguments
:: UTxO | A UTxO set to lookup tx inputs |
-> Tx | |
-> Maybe FanoutObservation |
Identify a fanout tx by lookup up the input spending the Head output and decoding its redeemer.