hydra-tx-0.22.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
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-0.22.0-F0GpoikV7lPBPp4VCs3iEf" '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.

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-0.22.0-F0GpoikV7lPBPp4VCs3iEf" '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-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 

Fields

Instances

Instances details
FromJSON AbortObservation Source # 
Instance details

Defined in Hydra.Tx.Abort

ToJSON AbortObservation Source # 
Instance details

Defined in Hydra.Tx.Abort

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.22.0-F0GpoikV7lPBPp4VCs3iEf" '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
FromJSON CommitObservation Source # 
Instance details

Defined in Hydra.Tx.Commit

ToJSON CommitObservation Source # 
Instance details

Defined in Hydra.Tx.Commit

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.22.0-F0GpoikV7lPBPp4VCs3iEf" 'False) (C1 ('MetaCons "CommitObservation" 'PrefixI 'True) (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 #

Instances

Instances details
FromJSON CollectComObservation Source # 
Instance details

Defined in Hydra.Tx.CollectCom

ToJSON CollectComObservation Source # 
Instance details

Defined in Hydra.Tx.CollectCom

Generic CollectComObservation Source # 
Instance details

Defined in Hydra.Tx.CollectCom

Associated Types

type Rep CollectComObservation :: Type -> Type Source #

Show CollectComObservation Source # 
Instance details

Defined in Hydra.Tx.CollectCom

Eq CollectComObservation Source # 
Instance details

Defined in Hydra.Tx.CollectCom

type Rep CollectComObservation Source # 
Instance details

Defined in Hydra.Tx.CollectCom

type Rep CollectComObservation = D1 ('MetaData "CollectComObservation" "Hydra.Tx.CollectCom" "hydra-tx-0.22.0-F0GpoikV7lPBPp4VCs3iEf" 'False) (C1 ('MetaCons "CollectComObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "utxoHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTxOHash)))

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 #

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-0.22.0-F0GpoikV7lPBPp4VCs3iEf" '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-0.22.0-F0GpoikV7lPBPp4VCs3iEf" '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 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 #

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-0.22.0-F0GpoikV7lPBPp4VCs3iEf" '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))))

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