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

Hydra.Tx.Observe

Description

Observe hydra transactions

Synopsis

Documentation

data HeadObservation Source #

Generalised type for arbitrary Head observations on-chain.

Instances

Instances details
Generic HeadObservation Source # 
Instance details

Defined in Hydra.Tx.Observe

Associated Types

type Rep HeadObservation :: Type -> Type Source #

Show HeadObservation Source # 
Instance details

Defined in Hydra.Tx.Observe

Eq HeadObservation Source # 
Instance details

Defined in Hydra.Tx.Observe

type Rep HeadObservation Source # 
Instance details

Defined in Hydra.Tx.Observe

type Rep HeadObservation = D1 ('MetaData "HeadObservation" "Hydra.Tx.Observe" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'False) (((C1 ('MetaCons "NoHeadTx" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Init" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 InitObservation)) :+: C1 ('MetaCons "Abort" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbortObservation)))) :+: (C1 ('MetaCons "Commit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CommitObservation)) :+: (C1 ('MetaCons "CollectCom" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CollectComObservation)) :+: C1 ('MetaCons "Deposit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DepositObservation))))) :+: ((C1 ('MetaCons "Recover" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RecoverObservation)) :+: (C1 ('MetaCons "Increment" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IncrementObservation)) :+: C1 ('MetaCons "Decrement" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DecrementObservation)))) :+: (C1 ('MetaCons "Close" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CloseObservation)) :+: (C1 ('MetaCons "Contest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContestObservation)) :+: C1 ('MetaCons "Fanout" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FanoutObservation))))))

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

Instances details
Generic InitObservation Source # 
Instance details

Defined in Hydra.Tx.Init

Associated Types

type Rep InitObservation :: Type -> Type Source #

Show InitObservation Source # 
Instance details

Defined in Hydra.Tx.Init

Eq InitObservation Source # 
Instance details

Defined in Hydra.Tx.Init

type Rep InitObservation Source # 
Instance details

Defined in Hydra.Tx.Init

type Rep InitObservation = D1 ('MetaData "InitObservation" "Hydra.Tx.Init" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'False) (C1 ('MetaCons "InitObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "initialThreadUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: (S1 ('MetaSel ('Just "initials") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(TxIn, TxOut CtxUTxO)]) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId))) :*: ((S1 ('MetaSel ('Just "seedTxIn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxIn) :*: S1 ('MetaSel ('Just "contestationPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContestationPeriod)) :*: (S1 ('MetaSel ('Just "parties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Party]) :*: S1 ('MetaSel ('Just "participants") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [OnChainId])))))

data NotAnInitReason Source #

Instances

Instances details
Generic NotAnInitReason Source # 
Instance details

Defined in Hydra.Tx.Init

Associated Types

type Rep NotAnInitReason :: Type -> Type Source #

Show NotAnInitReason Source # 
Instance details

Defined in Hydra.Tx.Init

Eq NotAnInitReason Source # 
Instance details

Defined in Hydra.Tx.Init

type Rep NotAnInitReason Source # 
Instance details

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 

Fields

Instances

Instances details
Generic AbortObservation Source # 
Instance details

Defined in Hydra.Tx.Abort

Associated Types

type Rep AbortObservation :: Type -> Type Source #

Show AbortObservation Source # 
Instance details

Defined in Hydra.Tx.Abort

Eq AbortObservation Source # 
Instance details

Defined in Hydra.Tx.Abort

type Rep AbortObservation Source # 
Instance details

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

observeAbortTx Source #

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 

Fields

Instances

Instances details
Generic CommitObservation Source # 
Instance details

Defined in Hydra.Tx.Commit

Associated Types

type Rep CommitObservation :: Type -> Type Source #

Show CommitObservation Source # 
Instance details

Defined in Hydra.Tx.Commit

Eq CommitObservation Source # 
Instance details

Defined in Hydra.Tx.Commit

type Rep CommitObservation Source # 
Instance details

Defined in Hydra.Tx.Commit

type Rep CommitObservation = D1 ('MetaData "CommitObservation" "Hydra.Tx.Commit" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'False) (C1 ('MetaCons "CommitObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "commitOutput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: S1 ('MetaSel ('Just "party") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Party)) :*: (S1 ('MetaSel ('Just "committed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId))))

observeCommitTx Source #

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 #

observeCollectComTx Source #

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

data DepositObservation Source #

Constructors

DepositObservation 

Fields

Instances

Instances details
Generic DepositObservation Source # 
Instance details

Defined in Hydra.Tx.Deposit

Associated Types

type Rep DepositObservation :: Type -> Type Source #

Show DepositObservation Source # 
Instance details

Defined in Hydra.Tx.Deposit

Eq DepositObservation Source # 
Instance details

Defined in Hydra.Tx.Deposit

type Rep DepositObservation Source # 
Instance details

Defined in Hydra.Tx.Deposit

type Rep DepositObservation = D1 ('MetaData "DepositObservation" "Hydra.Tx.Deposit" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'False) (C1 ('MetaCons "DepositObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "deposited") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO)) :*: (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId) :*: S1 ('MetaSel ('Just "deadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 POSIXTime))))

data IncrementObservation Source #

data RecoverObservation Source #

Constructors

RecoverObservation 

Fields

Instances

Instances details
Generic RecoverObservation Source # 
Instance details

Defined in Hydra.Tx.Recover

Associated Types

type Rep RecoverObservation :: Type -> Type Source #

Show RecoverObservation Source # 
Instance details

Defined in Hydra.Tx.Recover

Eq RecoverObservation Source # 
Instance details

Defined in Hydra.Tx.Recover

type Rep RecoverObservation Source # 
Instance details

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 #

observeCloseTx Source #

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

Instances details
Generic ContestObservation Source # 
Instance details

Defined in Hydra.Tx.Contest

Associated Types

type Rep ContestObservation :: Type -> Type Source #

Show ContestObservation Source # 
Instance details

Defined in Hydra.Tx.Contest

Eq ContestObservation Source # 
Instance details

Defined in Hydra.Tx.Contest

type Rep ContestObservation Source # 
Instance details

Defined in Hydra.Tx.Contest

type Rep ContestObservation = D1 ('MetaData "ContestObservation" "Hydra.Tx.Contest" "hydra-tx-0.20.0-BmRyRQFLFM1GEyuAAp07H7" 'False) (C1 ('MetaCons "ContestObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "contestedThreadOutput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId)) :*: (S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotNumber) :*: (S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "contesters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PubKeyHash])))))

observeContestTx Source #

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 

Fields

Instances

Instances details
Generic FanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

Associated Types

type Rep FanoutObservation :: Type -> Type Source #

Show FanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

Eq FanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

type Rep FanoutObservation Source # 
Instance details

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

observeFanoutTx Source #

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.