Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- data ScriptRegistry = ScriptRegistry {
- initialReference :: (TxIn, TxOut CtxUTxO)
- commitReference :: (TxIn, TxOut CtxUTxO)
- headReference :: (TxIn, TxOut CtxUTxO)
- genScriptRegistry :: Gen ScriptRegistry
- data NewScriptRegistryException = MissingScript {
- scriptName :: Text
- scriptHash :: ScriptHash
- discoveredScripts :: Set ScriptHash
- newScriptRegistry :: UTxO -> Either NewScriptRegistryException ScriptRegistry
- registryUTxO :: ScriptRegistry -> UTxO
- queryScriptRegistry :: (MonadIO m, MonadThrow m) => NetworkId -> SocketPath -> TxId -> m ScriptRegistry
- publishHydraScripts :: NetworkId -> SocketPath -> SigningKey PaymentKey -> IO TxId
Documentation
data ScriptRegistry Source #
Hydra scripts published as reference scripts at these UTxO.
Constructors
ScriptRegistry | |
Fields
|
Instances
genScriptRegistry :: Gen ScriptRegistry Source #
data NewScriptRegistryException Source #
Constructors
MissingScript | |
Fields
|
Instances
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 :: (MonadIO m, MonadThrow m) => NetworkId -> SocketPath -> TxId -> m ScriptRegistry Source #
Query for TxIn
s 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.
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 |