| License | Apache-2.0 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
Singular.State.Script
Description
The state validator takes the application policy as its one parameter, so its hash is the state policy of a registry, the payment credential of its address and the policy of the tokens of its keys. A transaction carries the code either attached to the witness set or from a reference output; a reference output is used only when the script it carries has the expected hash.
Synopsis
- data ScriptSource
- = Attached
- | Referenced TxIn
- data ReferenceFault
- = OutputMissing TxIn
- | OutputCarries TxIn (Maybe ScriptHash) ScriptHash
- findReferenceOutputs :: Session NoWitness IO -> Script ConwayEra -> ScriptSource -> IO (Either ReferenceFault [(TxIn, TxOut ConwayEra)])
- referenceOutputs :: Session NoWitness IO -> Script ConwayEra -> ScriptSource -> IO (Either Refusal [(TxIn, TxOut ConwayEra)])
- useScript :: forall (q :: Type -> Type) e. Script ConwayEra -> ScriptSource -> TxBuild q e ()
- data StateScript = StateScript {
- ssScript :: Script ConwayEra
- ssSource :: ScriptSource
- stateScriptTitle :: Text
- stateScriptFromBlueprint :: Blueprint -> PolicyID -> Either String (Script ConwayEra)
- stateScriptHash :: StateScript -> ScriptHash
- statePolicy :: StateScript -> PolicyID
- stateAddress :: Network -> StateScript -> Addr
Where the code comes from
data ScriptSource Source #
Where a transaction takes a script's code from.
Constructors
| Attached | The code travels in the transaction's witness set. |
| Referenced TxIn | The code is a reference script of this output. |
Instances
| Show ScriptSource Source # | |
Defined in Singular.State.Script Methods showsPrec :: Int -> ScriptSource -> ShowS Source # show :: ScriptSource -> String Source # showList :: [ScriptSource] -> ShowS Source # | |
| Eq ScriptSource Source # | |
Defined in Singular.State.Script Methods (==) :: ScriptSource -> ScriptSource -> Bool Source # (/=) :: ScriptSource -> ScriptSource -> Bool Source # | |
data ReferenceFault Source #
Why the reference output named for a script cannot be used.
Constructors
| OutputMissing TxIn | The output is not on the chain. |
| OutputCarries TxIn (Maybe ScriptHash) ScriptHash | The output carries no script, or another one: the hash it carries, when it carries a script, and the expected hash. |
Instances
| Show ReferenceFault Source # | |
Defined in Singular.State.Script Methods showsPrec :: Int -> ReferenceFault -> ShowS Source # show :: ReferenceFault -> String Source # showList :: [ReferenceFault] -> ShowS Source # | |
| Eq ReferenceFault Source # | |
Defined in Singular.State.Script Methods (==) :: ReferenceFault -> ReferenceFault -> Bool Source # (/=) :: ReferenceFault -> ReferenceFault -> Bool Source # | |
findReferenceOutputs :: Session NoWitness IO -> Script ConwayEra -> ScriptSource -> IO (Either ReferenceFault [(TxIn, TxOut ConwayEra)]) Source #
The reference outputs a transaction using a script resolves: none when the code is attached, the output otherwise, after checking that the script it carries has the expected hash.
referenceOutputs :: Session NoWitness IO -> Script ConwayEra -> ScriptSource -> IO (Either Refusal [(TxIn, TxOut ConwayEra)]) Source #
The reference outputs of a script, with the refusal of the state builders.
useScript :: forall (q :: Type -> Type) e. Script ConwayEra -> ScriptSource -> TxBuild q e () Source #
Make a script available to the transaction under construction.
The state validator
data StateScript Source #
The state validator of an application and where a transaction takes it from.
Constructors
| StateScript | |
Fields
| |
stateScriptTitle :: Text Source #
The blueprint title the state validator is read from.
stateScriptFromBlueprint :: Blueprint -> PolicyID -> Either String (Script ConwayEra) Source #
The state validator a blueprint carries, with the application policy applied as its parameter.
stateScriptHash :: StateScript -> ScriptHash Source #
The hash of the script: the state policy and the credential of its address.
statePolicy :: StateScript -> PolicyID Source #
The policy of the state tokens and of the tokens of the keys.
stateAddress :: Network -> StateScript -> Addr Source #
The enterprise address of the script on a network.