| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cometa.Transaction.Output
Description
Owned transaction outputs with validated quantities, explicit datum choice and optional reference scripts. This module does not check minimum Ada or ledger admission rules.
payment address = mkOutput address (Value.lovelace 2000000) Datum.NoDatum Nothing
Synopsis
- data Output
- mkOutput :: Address -> Value -> Datum -> Maybe Script -> Either Error Output
- address :: Output -> Address
- value :: Output -> Value
- datum :: Output -> Datum
- referenceScript :: Output -> Maybe Script
- encodeCbor :: Output -> ByteString
- data EncodedOutput
- decodeCbor :: ByteString -> Either Error EncodedOutput
- fromOutput :: Output -> EncodedOutput
- toOutput :: EncodedOutput -> Output
- toCbor :: EncodedOutput -> ByteString
Documentation
A semantic output. Equality compares fields, including inline datum encoding. Quantities are nonnegative and no greater than 2^63 - 1. Inspecting an immutable output is pure.
Instances
mkOutput :: Address -> Value -> Datum -> Maybe Script -> Either Error Output Source #
Validate every output quantity once. Negative quantities and quantities
greater than 2^63 - 1 return InvalidTransactionOutputValue.
Address, datum and script values have already passed their own validation.
address :: Output -> Address Source #
Destination address. Reward addresses are representable without asserting that a ledger accepts them as payment destinations.
referenceScript :: Output -> Maybe Script Source #
Optional reusable reference script, distinct from a spending witness.
encodeCbor :: Output -> ByteString Source #
Fresh Babbage-style map. Optional absent fields are omitted; inline data and scripts are wrapped in tag 24 byte strings. Datum bytes remain exact.
data EncodedOutput Source #
Exact imported or freshly encoded output. Equality compares encoded bytes.
Instances
| Show EncodedOutput Source # | |
Defined in Cometa.Transaction.Output Methods showsPrec :: Int -> EncodedOutput -> ShowS # show :: EncodedOutput -> String # showList :: [EncodedOutput] -> ShowS # | |
| Eq EncodedOutput Source # | |
Defined in Cometa.Transaction.Output Methods (==) :: EncodedOutput -> EncodedOutput -> Bool # (/=) :: EncodedOutput -> EncodedOutput -> Bool # | |
decodeCbor :: ByteString -> Either Error EncodedOutput Source #
Decode exactly one legacy array or Babbage map, rejecting unknown or duplicate keys, malformed datum/script envelopes, invalid quantities and trailing bytes. Legacy arrays contain address, value and optionally a datum hash. Original bytes are retained independently of the semantic output.
fromOutput :: Output -> EncodedOutput Source #
Pair semantic output with a fresh encoding.
toOutput :: EncodedOutput -> Output Source #
Inspect semantic output fields. Re-encoding may change imported legacy form.
toCbor :: EncodedOutput -> ByteString Source #
Exact imported or freshly encoded bytes.