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

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

Documentation

data Output Source #

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

Instances details
Show Output Source # 
Instance details

Defined in Cometa.Transaction.Output

Eq Output Source # 
Instance details

Defined in Cometa.Transaction.Output

Methods

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

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

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.

value :: Output -> Value Source #

Nonnegative bundle; Ada quantities are lovelace.

datum :: Output -> Datum Source #

No datum, its hash, or exact inline data.

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

Instances details
Show EncodedOutput Source # 
Instance details

Defined in Cometa.Transaction.Output

Eq EncodedOutput Source # 
Instance details

Defined in Cometa.Transaction.Output

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.