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 {}
- 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
- distributedUTxO :: UTxO
- observeDecrementTx :: UTxO -> Tx -> Maybe DecrementObservation
- data DepositObservation = DepositObservation {}
- 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
- recoveredUTxO :: UTxO
- observeRecoverTx :: NetworkId -> UTxO -> Tx -> Maybe RecoverObservation
- data CloseObservation = CloseObservation {}
- observeCloseTx :: UTxO -> Tx -> Maybe CloseObservation
- data ContestObservation = ContestObservation {
- headId :: HeadId
- snapshotNumber :: SnapshotNumber
- contestationDeadline :: UTCTime
- contesters :: [PubKeyHash]
- observeContestTx :: UTxO -> Tx -> Maybe ContestObservation
- data FanoutObservation = FanoutObservation {
- headId :: HeadId
- fanoutUTxO :: UTxO
- 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.22.0-F0GpoikV7lPBPp4VCs3iEf" '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
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 | |
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 | |
Instances
observeDepositTx :: NetworkId -> Tx -> Maybe DepositObservation Source #
Observe a deposit transaction by decoding the target head id, deposit deadline and deposited utxo in the datum.
This includes checking whether - the first output is a deposit output - all inputs of deposited utxo are actually spent, - the deposit script output actually contains the deposited value, - an upper validity bound has been set (used as creation slot).
data IncrementObservation Source #
Constructors
IncrementObservation | |
Fields
|
Instances
observeIncrementTx :: UTxO -> Tx -> Maybe IncrementObservation Source #
data RecoverObservation Source #
Constructors
RecoverObservation | |
Fields
|
Instances
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.
data FanoutObservation Source #
Constructors
FanoutObservation | |
Fields
|
Instances
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.