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

Cometa.SubTransaction.Body

Description

Dijkstra subtransaction bodies. Their schema contains shared transaction fields but excludes fees, legacy updates, collateral, nested subtransactions and starting-account-balance requirements.

minimal = body [] []
Synopsis

Documentation

data Body Source #

Shared semantic fields with the subtransaction schema. Equality compares fields, distinguishing absence, empty collections and embedded datum bytes.

Instances

Instances details
Show Body Source # 
Instance details

Defined in Cometa.SubTransaction.Body

Methods

showsPrec :: Int -> Body -> ShowS #

show :: Body -> String #

showList :: [Body] -> ShowS #

Eq Body Source # 
Instance details

Defined in Cometa.SubTransaction.Body

Methods

(==) :: Body -> Body -> Bool #

(/=) :: Body -> Body -> Bool #

body :: [Input] -> [Output] -> Body Source #

Assemble required references and ordered outputs; all optional fields absent.

fromFields :: Fields -> Body Source #

Assemble shared fields without introducing unsupported top-level fields.

fields :: Body -> Fields Source #

Inspect all shared semantic fields.

encodeCbor :: Body -> Either Error ByteString Source #

Fresh definite body map in ascending numeric field order. Embedded datums retain exact encoding; imported body identity is obtained through toCbor.

encodeCborWith :: SetEncoding -> Body -> Either Error ByteString Source #

Encode fresh body fields with the requested set tags. Embedded values keep their own encoding choices. Protocol validity is the caller's responsibility.

data SetField Source #

Set-valued fields in this body schema. Outputs and maps are not sets.

Constructors

Inputs

Spending inputs.

Certificates

Stake and governance certificates.

Guards

Required signer or guard credentials.

ReferenceInputs

Reference inputs.

Proposals

Governance proposals.

setEncoding :: SetField -> EncodedBody -> Maybe SetEncoding Source #

Observe one field's set tag. An absent optional field returns Nothing.

withSetEncoding :: SetField -> SetEncoding -> EncodedBody -> EncodedBody Source #

Change one present field's set tag. Absence and an unchanged tag preserve the exact original body. A change rebuilds the outer map in numeric key order, retaining all other field bytes and the selected array's contents. It can change the body hash: signatures over the previous body must be renewed.

data EncodedBody Source #

Exact imported subtransaction-body encoding. Equality compares exact bytes.

Instances

Instances details
Show EncodedBody Source # 
Instance details

Defined in Cometa.SubTransaction.Body

Eq EncodedBody Source # 
Instance details

Defined in Cometa.SubTransaction.Body

decodeCbor :: ByteString -> Either Error EncodedBody Source #

Decode the complete subtransaction schema. Top-level-only fields and unknown keys are rejected rather than dropped. Original map, set and number encodings are preserved. Missing required fields and malformed nested data return errors.

fromBody :: Body -> Either Error EncodedBody Source #

Validate context-specific fields and pair them with fresh bytes. Present empty certificates, mint or guards and duplicate guard credentials return InvalidTransactionField.

toBody :: EncodedBody -> Body Source #

Inspect semantic fields without normalizing the exact body.

toCbor :: EncodedBody -> ByteString Source #

Exact ledger subtransaction-body bytes.

hash :: EncodedBody -> IO (Either Error TransactionId) Source #

Native BLAKE2b-256 of exact body bytes, with native errors retained.