| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cometa.Script
Description
Native and versioned Plutus script alternatives. The combined CBOR form is
[language, payload], where native is zero and Plutus versions are 1 through 4.
The envelope is normalized on encoding; each payload retains its exact bytes,
which determine script identity and hashing.
import qualified Cometa.Script as Script import qualified Cometa.Script.Native as Native script :: Script.Script script = Script.Native (Native.allOf [])
Synopsis
- data Script
- encodeCbor :: Script -> ByteString
- decodeCbor :: ByteString -> Either Error Script
- hash :: Script -> IO (Either Error ScriptHash)
Documentation
Script alternatives with Haskell-owned payloads. Equality and ordering compare the alternative then its payload representation; native comes first.
Constructors
| Native !NativeScript | A signaturetimeguard native script. |
| Plutus !PlutusScript | A compiled Plutus script carrying its language version. |
encodeCbor :: Script -> ByteString Source #
Encode a definite two-element array and minimal language tag, preserving the payload's exact encoding. Nonminimal imported envelopes normalize on encoding; they do not contribute to the script hash.
decodeCbor :: ByteString -> Either Error Script Source #
Decode exactly one two-element native/Plutus envelope. Unknown language tags,
incorrect arity, malformed payloads and trailing bytes return
InvalidScriptCbor. Payload validators also retain their documented errors.
The envelope's encoding is not retained; the payload's encoding is exact.
hash :: Script -> IO (Either Error ScriptHash) Source #
Hash using the native prefix zero or the declared Plutus version prefix.
The combined envelope is excluded. Native failures return NativeError.