| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
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
- data Body
- body :: [Input] -> [Output] -> Body
- fromFields :: Fields -> Body
- fields :: Body -> Fields
- encodeCbor :: Body -> Either Error ByteString
- encodeCborWith :: SetEncoding -> Body -> Either Error ByteString
- data SetField
- setEncoding :: SetField -> EncodedBody -> Maybe SetEncoding
- withSetEncoding :: SetField -> SetEncoding -> EncodedBody -> EncodedBody
- data EncodedBody
- decodeCbor :: ByteString -> Either Error EncodedBody
- fromBody :: Body -> Either Error EncodedBody
- toBody :: EncodedBody -> Body
- toCbor :: EncodedBody -> ByteString
- hash :: EncodedBody -> IO (Either Error TransactionId)
Documentation
Shared semantic fields with the subtransaction schema. Equality compares fields, distinguishing absence, empty collections and embedded datum bytes.
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.
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.
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. |
Instances
| Bounded SetField Source # | |
| Enum SetField Source # | |
Defined in Cometa.SubTransaction.Body | |
| Show SetField Source # | |
| Eq SetField Source # | |
| Ord SetField Source # | |
Defined in Cometa.SubTransaction.Body | |
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
| Show EncodedBody Source # | |
Defined in Cometa.SubTransaction.Body Methods showsPrec :: Int -> EncodedBody -> ShowS # show :: EncodedBody -> String # showList :: [EncodedBody] -> ShowS # | |
| Eq EncodedBody Source # | |
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.