hydra-node-0.16.0: The Hydra node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Chain.Direct.Tx

Description

Smart constructors for creating Hydra protocol transactions to be used in the Direct way of talking to the main-chain.

This module also encapsulates the transaction format used when talking to the cardano-node, which is currently different from the Cardano, thus we have not yet "reached" isomorphism.

Synopsis

Documentation

type UTxOWithScript = (TxIn, TxOut CtxUTxO, HashableScriptData) Source #

Needed on-chain data to create Head transactions.

newtype UTxOHash Source #

Constructors

UTxOHash ByteString 

Instances

Instances details
Arbitrary UTxOHash Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

FromJSON UTxOHash Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Methods

parseJSON :: Value -> Parser UTxOHash

parseJSONList :: Value -> Parser [UTxOHash]

omittedField :: Maybe UTxOHash

ToJSON UTxOHash Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Methods

toJSON :: UTxOHash -> Value

toEncoding :: UTxOHash -> Encoding

toJSONList :: [UTxOHash] -> Value

toEncodingList :: [UTxOHash] -> Encoding

omitField :: UTxOHash -> Bool

Generic UTxOHash Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep UTxOHash :: Type -> Type Source #

Show UTxOHash Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq UTxOHash Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep UTxOHash Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep UTxOHash = D1 ('MetaData "UTxOHash" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'True) (C1 ('MetaCons "UTxOHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

data InitialThreadOutput Source #

Representation of the Head output after an Init transaction.

Constructors

InitialThreadOutput 

Fields

Instances

Instances details
Arbitrary InitialThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

FromJSON InitialThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

ToJSON InitialThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic InitialThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep InitialThreadOutput :: Type -> Type Source #

Show InitialThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq InitialThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep InitialThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep InitialThreadOutput = D1 ('MetaData "InitialThreadOutput" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'False) (C1 ('MetaCons "InitialThreadOutput" 'PrefixI 'True) (S1 ('MetaSel ('Just "initialThreadUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: (S1 ('MetaSel ('Just "initialContestationPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContestationPeriod) :*: S1 ('MetaSel ('Just "initialParties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Party]))))

data OpenThreadOutput Source #

Representation of the Head output after a CollectCom transaction.

Constructors

OpenThreadOutput 

Fields

Instances

Instances details
Arbitrary OpenThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

FromJSON OpenThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

ToJSON OpenThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic OpenThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep OpenThreadOutput :: Type -> Type Source #

Show OpenThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq OpenThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep OpenThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep OpenThreadOutput = D1 ('MetaData "OpenThreadOutput" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'False) (C1 ('MetaCons "OpenThreadOutput" 'PrefixI 'True) (S1 ('MetaSel ('Just "openThreadUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: (S1 ('MetaSel ('Just "openContestationPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContestationPeriod) :*: S1 ('MetaSel ('Just "openParties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Party]))))

data ClosedThreadOutput Source #

Constructors

ClosedThreadOutput 

Fields

Instances

Instances details
Arbitrary ClosedThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

FromJSON ClosedThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

ToJSON ClosedThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic ClosedThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep ClosedThreadOutput :: Type -> Type Source #

Show ClosedThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq ClosedThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep ClosedThreadOutput Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep ClosedThreadOutput = D1 ('MetaData "ClosedThreadOutput" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'False) (C1 ('MetaCons "ClosedThreadOutput" 'PrefixI 'True) ((S1 ('MetaSel ('Just "closedThreadUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: S1 ('MetaSel ('Just "closedParties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Party])) :*: (S1 ('MetaSel ('Just "closedContestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 POSIXTime) :*: S1 ('MetaSel ('Just "closedContesters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PubKeyHash]))))

hydraMetadataLabel :: Word64 Source #

The metadata label used for identifying Hydra protocol transactions. As suggested by a friendly large language model: The number most commonly associated with Hydra is 5, as in the mythological creature Hydra, which had multiple heads, and the number 5 often symbolizes multiplicity or diversity. However, there is no specific numerical association for Hydra smaller than 10000 beyond this mythological reference.

mkHydraHeadV1TxName :: Text -> TxMetadata Source #

Create a transaction metadata entry to identify Hydra transactions (for informational purposes).

getHydraHeadV1TxName :: Tx -> Maybe Text Source #

Get the metadata entry to identify Hydra transactions (for informational purposes).

Create Hydra Head transactions

initTx Source #

Arguments

:: NetworkId 
-> TxIn

Seed input.

-> [OnChainId]

Verification key hashes of all participants.

-> HeadParameters 
-> Tx 

Create the init transaction from some HeadParameters and a single TxIn which will be used as unique parameter for minting NFTs.

mkHeadOutput :: NetworkId -> PolicyId -> TxOutDatum ctx -> TxOut ctx Source #

mkHeadOutputInitial :: NetworkId -> TxIn -> HeadParameters -> TxOut CtxTx Source #

mkInitialOutput :: NetworkId -> TxIn -> OnChainId -> TxOut CtxTx Source #

commitTx Source #

Arguments

:: NetworkId 
-> ScriptRegistry

Published Hydra scripts to reference.

-> HeadId 
-> Party 
-> UTxO' (TxOut CtxUTxO, Witness WitCtxTxIn)

The UTxO to commit to the Head along with witnesses.

-> (TxIn, TxOut CtxUTxO, Hash PaymentKey)

The initial output (sent to each party) which should contain the PT and is locked by initial script

-> Tx 

Craft a commit transaction which includes the "committed" utxo as a datum.

mkCommitDatum :: Party -> UTxO -> CurrencySymbol -> Datum Source #

collectComTx Source #

Arguments

:: NetworkId 
-> ScriptRegistry

Published Hydra scripts to reference.

-> VerificationKey PaymentKey

Party who's authorizing this transaction

-> HeadId

Head identifier

-> HeadParameters

Parameters of the head to collect .

-> (TxIn, TxOut CtxUTxO)

Everything needed to spend the Head state-machine output.

-> Map TxIn (TxOut CtxUTxO)

Data needed to spend the commit output produced by each party. Should contain the PT and is locked by ν_commit script.

-> UTxO

UTxO to be used to collect. Should match whatever is recorded in the commit inputs.

-> Tx 

Create a transaction collecting all "committed" utxo and opening a Head, i.e. driving the Head script state.

data ClosingSnapshot Source #

Low-level data type of a snapshot to close the head with. This is different to the ConfirmedSnasphot, which is provided to CloseTx as it also contains relevant chain state like the $sel:openUtxoHash:CloseWithInitialSnapshot.

closeTx Source #

Arguments

:: ScriptRegistry

Published Hydra scripts to reference.

-> VerificationKey PaymentKey

Party who's authorizing this transaction

-> ClosingSnapshot

The snapshot to close with, can be either initial or confirmed one.

-> SlotNo

Lower validity slot number, usually a current or quite recent slot number.

-> PointInTime

Upper validity slot and UTC time to compute the contestation deadline time.

-> OpenThreadOutput

Everything needed to spend the Head state-machine output.

-> HeadId

Head identifier

-> Tx 

Create a transaction closing a head with either the initial snapshot or with a multi-signed confirmed snapshot.

contestTx Source #

Arguments

:: ScriptRegistry

Published Hydra scripts to reference.

-> VerificationKey PaymentKey

Party who's authorizing this transaction

-> Snapshot Tx

Contested snapshot number (i.e. the one we contest to)

-> MultiSignature (Snapshot Tx)

Multi-signature of the whole snapshot

-> PointInTime

Current slot and posix time to be used as the contestation time.

-> ClosedThreadOutput

Everything needed to spend the Head state-machine output.

-> HeadId 
-> ContestationPeriod 
-> Tx 

fanoutTx Source #

Arguments

:: ScriptRegistry

Published Hydra scripts to reference.

-> UTxO

Snapshotted UTxO to fanout on layer 1

-> (TxIn, TxOut CtxUTxO)

Everything needed to spend the Head state-machine output.

-> SlotNo

Contestation deadline as SlotNo, used to set lower tx validity bound.

-> PlutusScript

Minting Policy script, made from initial seed

-> Tx 

Create the fanout transaction, which distributes the closed state accordingly. The head validator allows fanout only > deadline, so we need to set the lower bound to be deadline + 1 slot.

abortTx Source #

Arguments

:: UTxO

Committed UTxOs to reimburse.

-> ScriptRegistry

Published Hydra scripts to reference.

-> VerificationKey PaymentKey

Party who's authorizing this transaction

-> (TxIn, TxOut CtxUTxO)

Everything needed to spend the Head state-machine output.

-> PlutusScript

Script for monetary policy to burn tokens

-> Map TxIn (TxOut CtxUTxO)

Data needed to spend the initial output sent to each party to the Head. Should contain the PT and is locked by initial script.

-> Map TxIn (TxOut CtxUTxO)

Data needed to spend commit outputs. Should contain the PT and is locked by commit script.

-> Either AbortTxError Tx 

Create transaction which aborts a head by spending the Head output and all other "initial" outputs.

Observe Hydra Head transactions

data HeadObservation Source #

Generalised type for arbitrary Head observations on-chain.

Instances

Instances details
Arbitrary HeadObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic HeadObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep HeadObservation :: Type -> Type Source #

Show HeadObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq HeadObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep HeadObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

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
Arbitrary InitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic InitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep InitObservation :: Type -> Type Source #

Show InitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq InitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep InitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep InitObservation = D1 ('MetaData "InitObservation" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" '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
Arbitrary NotAnInitReason Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

FromJSON NotAnInitReason Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

ToJSON NotAnInitReason Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic NotAnInitReason Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep NotAnInitReason :: Type -> Type Source #

Show NotAnInitReason Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq NotAnInitReason Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep NotAnInitReason Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep NotAnInitReason = D1 ('MetaData "NotAnInitReason" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'False) ((C1 ('MetaCons "NoHeadOutput" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NotAHeadDatum" '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).

data CommitObservation Source #

Full observation of a commit transaction.

Constructors

CommitObservation 

Fields

Instances

Instances details
Arbitrary CommitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic CommitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep CommitObservation :: Type -> Type Source #

Show CommitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq CommitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep CommitObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep CommitObservation = D1 ('MetaData "CommitObservation" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" '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 #

Instances

Instances details
Arbitrary CollectComObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic CollectComObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep CollectComObservation :: Type -> Type Source #

Show CollectComObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq CollectComObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep CollectComObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep CollectComObservation = D1 ('MetaData "CollectComObservation" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'False) (C1 ('MetaCons "CollectComObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "threadOutput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OpenThreadOutput) :*: (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 CloseObservation Source #

Instances

Instances details
Arbitrary CloseObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic CloseObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep CloseObservation :: Type -> Type Source #

Show CloseObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq CloseObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep CloseObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep CloseObservation = D1 ('MetaData "CloseObservation" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'False) (C1 ('MetaCons "CloseObservation" 'PrefixI 'True) (S1 ('MetaSel ('Just "threadOutput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ClosedThreadOutput) :*: (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotNumber))))

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
Arbitrary ContestObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic ContestObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep ContestObservation :: Type -> Type Source #

Show ContestObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq ContestObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep ContestObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep ContestObservation = D1 ('MetaData "ContestObservation" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" '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
Arbitrary FanoutObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic FanoutObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep FanoutObservation :: Type -> Type Source #

Show FanoutObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq FanoutObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep FanoutObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep FanoutObservation = D1 ('MetaData "FanoutObservation" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" '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.

newtype AbortObservation Source #

Constructors

AbortObservation 

Fields

Instances

Instances details
Arbitrary AbortObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Generic AbortObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Associated Types

type Rep AbortObservation :: Type -> Type Source #

Show AbortObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

Eq AbortObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep AbortObservation Source # 
Instance details

Defined in Hydra.Chain.Direct.Tx

type Rep AbortObservation = D1 ('MetaData "AbortObservation" "Hydra.Chain.Direct.Tx" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" '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.

Cardano specific identifiers

mkHeadId :: PolicyId -> HeadId Source #

headIdToCurrencySymbol :: HeadId -> CurrencySymbol Source #

currencySymbolToHeadId :: MonadFail m => CurrencySymbol -> m HeadId Source #

headIdToPolicyId :: MonadFail m => HeadId -> m PolicyId Source #

verificationKeyToOnChainId :: VerificationKey PaymentKey -> OnChainId Source #

Derive the OnChainId from a Cardano PaymentKey. The on-chain identifier is the public key hash as it is also availble to plutus validators.

Helpers

headTokensFromValue :: PlutusScript -> Value -> [(AssetName, Quantity)] Source #

findFirst :: Foldable t => (a -> Maybe b) -> t a -> Maybe b Source #

Find first occurrence including a transformation.

findHeadAssetId :: TxOut ctx -> Maybe (PolicyId, AssetName) Source #

findStateToken :: TxOut ctx -> Maybe HeadId Source #

Find (if it exists) the head identifier contained in given TxOut.