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

Hydra.Chain.Direct.ScriptRegistry

Description

A data-type to keep track of reference Hydra scripts published on-chain, and needed to construct transactions leveraging reference inputs.

Synopsis

Documentation

data ScriptRegistry Source #

Hydra scripts published as reference scripts at these UTxO.

Constructors

ScriptRegistry 

Fields

Instances

Instances details
FromJSON ScriptRegistry Source # 
Instance details

Defined in Hydra.Chain.Direct.ScriptRegistry

Methods

parseJSON :: Value -> Parser ScriptRegistry

parseJSONList :: Value -> Parser [ScriptRegistry]

omittedField :: Maybe ScriptRegistry

ToJSON ScriptRegistry Source # 
Instance details

Defined in Hydra.Chain.Direct.ScriptRegistry

Generic ScriptRegistry Source # 
Instance details

Defined in Hydra.Chain.Direct.ScriptRegistry

Associated Types

type Rep ScriptRegistry :: Type -> Type Source #

Show ScriptRegistry Source # 
Instance details

Defined in Hydra.Chain.Direct.ScriptRegistry

Eq ScriptRegistry Source # 
Instance details

Defined in Hydra.Chain.Direct.ScriptRegistry

type Rep ScriptRegistry Source # 
Instance details

Defined in Hydra.Chain.Direct.ScriptRegistry

type Rep ScriptRegistry = D1 ('MetaData "ScriptRegistry" "Hydra.Chain.Direct.ScriptRegistry" "hydra-node-0.16.0-C0XGScKIquG5I6dPp21445" 'False) (C1 ('MetaCons "ScriptRegistry" 'PrefixI 'True) (S1 ('MetaSel ('Just "initialReference") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: (S1 ('MetaSel ('Just "commitReference") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)) :*: S1 ('MetaSel ('Just "headReference") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIn, TxOut CtxUTxO)))))

newScriptRegistry :: UTxO -> Either NewScriptRegistryException ScriptRegistry Source #

Create a script registry from a UTxO containing outputs with reference scripts. This will return Nothing if one or all of the references could not be found.

registryUTxO :: ScriptRegistry -> UTxO Source #

Get the UTxO that corresponds to a script registry.

  • *Property**:

    newScriptRegistry (registryUTxO r) === Just r

queryScriptRegistry Source #

Arguments

:: (MonadIO m, MonadThrow m) 
=> NetworkId

cardano-node's network identifier. A combination of network discriminant + magic number.

-> SocketPath

Filepath to the cardano-node's domain socket

-> TxId 
-> m ScriptRegistry 

Query for TxIns in the search for outputs containing all the reference scripts of the ScriptRegistry.

This is implemented by repeated querying until we have all necessary reference scripts as we do only know the transaction id, not the indices.

NOTE: This is limited to an upper bound of 10 to not query too much before providing an error.

NOTE: If this should change, make sure to update the command line help.

Can throw at least NewScriptRegistryException on failure.

publishHydraScripts Source #

Arguments

:: NetworkId

Expected network discriminant.

-> SocketPath

Path to the cardano-node's domain socket

-> SigningKey PaymentKey

Keys assumed to hold funds to pay for the publishing transaction.

-> IO TxId