cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Encoding.Reencode

Description

Explicit native representation changes for advanced encoding workflows. These operations produce distinct snapshots; their source values remain exact. They follow native representation policy, including retained indefinite script lists and mixed-depth transaction rules. They are not canonical-CBOR codecs.

Re-encoding can change script hashes, transaction IDs, auxiliary-data hashes and script-data commitments. Transaction signatures are retained verbatim and may become invalid. No commitment, signature or ledger rule is repaired. Inspect the result and assemble/sign a new transaction when identity changes. Ordinary transaction setters remain the interface for normal body edits.

import qualified Cometa.Encoding.Reencode as Reencode
import qualified Cometa.Script.Native as Native

reencodedCondition = Reencode.nativeScript (Native.invalidBefore 100)
Synopsis

Documentation

nativeScript :: NativeScript -> IO (Either Error NativeScript) Source #

Re-encode native condition nodes with fresh definite node arrays and shortest scalar encodings, recursively retaining each child list's existing definite/indefinite shape, order and duplicates. The resulting script hash may differ. Native parsing/encoding failures are explicit; the source is unchanged.

nativeScripts :: Cbor -> IO (Either Error Cbor) Source #

Validate and re-encode an encoded native-script list. Retain the outer list's definite/indefinite shape and recursively apply nativeScript policy to its children. Definite lengths use their shortest encoding. Empty lists, order and duplicates are retained. A non-list or invalid script returns a native error. Source bytes remain unchanged.

transaction :: Transaction -> IO (Either Error Transaction) Source #

Re-encode an outer transaction body, witness collections and auxiliary container under native policy. Nested intent bodies remain exact. Witness datum/redeemer data are re-encoded recursively; native-script child encodings in witnesses are retained and witness set tags are freshly emitted. Existing signatures and commitments are retained, so they may become invalid. Native decoding failures include unsupported source representations, such as indefinite body maps. The original transaction is unchanged.

subTransaction :: SubTransaction -> IO (Either Error SubTransaction) Source #

Re-encode one intent's body, witness collections and auxiliary container with the same policy and signature/commitment caveats as transaction. Its body ID may change. This operation does not alter an enclosing transaction or the original intent; native parsing/encoding failures remain explicit.