| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Tx.Observe
Description
Observe hydra transactions
Synopsis
- data HeadObservation
- = NoHeadTx
- | Init InitObservation
- | Deposit DepositObservation
- | Recover RecoverObservation
- | Increment IncrementObservation
- | Decrement DecrementObservation
- | Close CloseObservation
- | Contest ContestObservation
- | PartialFanout PartialFanoutObservation
- | Fanout FanoutObservation
- | FinalPartialFanout FanoutObservation
- observeHeadTx :: NetworkId -> UTxO -> Tx -> HeadObservation
- data InitObservation = InitObservation {}
- data NotAnInitReason
- observeInitTx :: Tx -> Either NotAnInitReason InitObservation
- 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
- deposited :: UTxO
- observeIncrementTx :: NetworkId -> 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
- data PartialFanoutObservation = PartialFanoutObservation {
- headId :: HeadId
- distributedOutputs :: UTxO
- observeFanoutTx :: UTxO -> Tx -> Maybe FanoutObservation
- observeFinalPartialFanoutTx :: UTxO -> Tx -> Maybe FanoutObservation
- observePartialFanoutTx :: UTxO -> Tx -> Maybe PartialFanoutObservation
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
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).
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 transaction's first output is the deposit output - all of deposited value is contained in the deposit tx output, - 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 :: NetworkId -> 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 contest tx by lookup up the input spending the Head output and decoding its redeemer.
data FanoutObservation Source #
Constructors
| FanoutObservation | |
Fields
| |
Instances
data PartialFanoutObservation Source #
Constructors
| PartialFanoutObservation | |
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.
observeFinalPartialFanoutTx Source #
Arguments
| :: UTxO | A UTxO set to lookup tx inputs |
| -> Tx | |
| -> Maybe FanoutObservation |
Identify a final partial fanout tx by looking up the input spending the Head output and decoding its redeemer as FinalPartialFanout. Returns a FanoutObservation since this is the finalizing step.
observePartialFanoutTx Source #
Arguments
| :: UTxO | A UTxO set to lookup tx inputs |
| -> Tx | |
| -> Maybe PartialFanoutObservation |
Identify a partial fanout tx by looking up the input spending the Head output and decoding its redeemer as PartialFanout.