hydra-tx
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
FromJSON HeadObservation Source # 
Instance details

Defined in Hydra.Tx.Observe

ToJSON HeadObservation Source # 
Instance details

Defined in Hydra.Tx.Observe

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-2.3.0-AmphLXDqLbeiaw5uNmLIz" '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 "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 "PartialFanout" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PartialFanoutObservation)) :+: (C1 ('MetaCons "Fanout" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FanoutObservation)) :+: C1 ('MetaCons "FinalPartialFanout" '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.

Instances

Instances details
FromJSON InitObservation Source # 
Instance details

Defined in Hydra.Tx.Init

ToJSON InitObservation Source # 
Instance details

Defined in Hydra.Tx.Init

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-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "InitObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "headSeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadSeed)) :*: (S1 ('MetaSel ('Just "headParameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadParameters) :*: 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-2.3.0-AmphLXDqLbeiaw5uNmLIz" '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) :+: C1 ('MetaCons "NoTokensMinted" '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).

data DecrementObservation Source #

Instances

Instances details
FromJSON DecrementObservation Source # 
Instance details

Defined in Hydra.Tx.Decrement

ToJSON DecrementObservation Source # 
Instance details

Defined in Hydra.Tx.Decrement

Generic DecrementObservation Source # 
Instance details

Defined in Hydra.Tx.Decrement

Associated Types

type Rep DecrementObservation :: Type -> Type Source #

Show DecrementObservation Source # 
Instance details

Defined in Hydra.Tx.Decrement

Eq DecrementObservation Source # 
Instance details

Defined in Hydra.Tx.Decrement

type Rep DecrementObservation Source # 
Instance details

Defined in Hydra.Tx.Decrement

type Rep DecrementObservation = D1 ('MetaData "DecrementObservation" "Hydra.Tx.Decrement" "hydra-tx-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "DecrementObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "newVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "distributedUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO))))

data DepositObservation Source #

Constructors

DepositObservation 

Fields

Instances

Instances details
FromJSON DepositObservation Source # 
Instance details

Defined in Hydra.Tx.Deposit

ToJSON DepositObservation Source # 
Instance details

Defined in Hydra.Tx.Deposit

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-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "DepositObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId)) :*: (S1 ('MetaSel ('Just "deposited") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO) :*: (S1 ('MetaSel ('Just "created") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SlotNo) :*: S1 ('MetaSel ('Just "deadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime)))))

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

Instances details
FromJSON IncrementObservation Source # 
Instance details

Defined in Hydra.Tx.Increment

ToJSON IncrementObservation Source # 
Instance details

Defined in Hydra.Tx.Increment

Generic IncrementObservation Source # 
Instance details

Defined in Hydra.Tx.Increment

Associated Types

type Rep IncrementObservation :: Type -> Type Source #

Show IncrementObservation Source # 
Instance details

Defined in Hydra.Tx.Increment

Eq IncrementObservation Source # 
Instance details

Defined in Hydra.Tx.Increment

type Rep IncrementObservation Source # 
Instance details

Defined in Hydra.Tx.Increment

type Rep IncrementObservation = D1 ('MetaData "IncrementObservation" "Hydra.Tx.Increment" "hydra-tx-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "IncrementObservation" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "newVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotVersion)) :*: (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId) :*: S1 ('MetaSel ('Just "deposited") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO))))

observeIncrementTx :: NetworkId -> UTxO -> Tx -> Maybe IncrementObservation Source #

data RecoverObservation Source #

Constructors

RecoverObservation 

Fields

Instances

Instances details
FromJSON RecoverObservation Source # 
Instance details

Defined in Hydra.Tx.Recover

ToJSON RecoverObservation Source # 
Instance details

Defined in Hydra.Tx.Recover

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-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "RecoverObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "recoveredTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId) :*: S1 ('MetaSel ('Just "recoveredUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO))))

observeRecoverTx :: NetworkId -> UTxO -> Tx -> Maybe RecoverObservation Source #

data CloseObservation Source #

Instances

Instances details
FromJSON CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

ToJSON CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

Generic CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

Associated Types

type Rep CloseObservation :: Type -> Type Source #

Show CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

Eq CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

type Rep CloseObservation Source # 
Instance details

Defined in Hydra.Tx.Close

type Rep CloseObservation = D1 ('MetaData "CloseObservation" "Hydra.Tx.Close" "hydra-tx-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "CloseObservation" 'PrefixI 'True) (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))))

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 #

Instances

Instances details
FromJSON ContestObservation Source # 
Instance details

Defined in Hydra.Tx.Contest

ToJSON ContestObservation Source # 
Instance details

Defined in Hydra.Tx.Contest

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-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "ContestObservation" 'PrefixI 'True) ((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 contest tx by lookup up the input spending the Head output and decoding its redeemer.

data FanoutObservation Source #

Constructors

FanoutObservation 

Fields

Instances

Instances details
FromJSON FanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

ToJSON FanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

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-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "FanoutObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "fanoutUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO)))

data PartialFanoutObservation Source #

Constructors

PartialFanoutObservation 

Fields

Instances

Instances details
FromJSON PartialFanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

ToJSON PartialFanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

Generic PartialFanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

Associated Types

type Rep PartialFanoutObservation :: Type -> Type Source #

Show PartialFanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

Eq PartialFanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

type Rep PartialFanoutObservation Source # 
Instance details

Defined in Hydra.Tx.Fanout

type Rep PartialFanoutObservation = D1 ('MetaData "PartialFanoutObservation" "Hydra.Tx.Fanout" "hydra-tx-2.3.0-AmphLXDqLbeiaw5uNmLIz" 'False) (C1 ('MetaCons "PartialFanoutObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "distributedOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxO)))

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.

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.