Skip to main content

Module payload

Module payload 

Source
Expand description

This module contains generic utilities for serializing and deserializing method calls to/from payload bytes.

It can be reused to implement a different wallet implementation. TransactionPayloadCaller calls the methods of a payload one by one. TransactionPayloadDecoder in decoder checks a payload and describes its methods without calling them, for example to show a transaction on the screen of a hardware wallet before it is signed. Both use the same decoding code, so they apply the same rules.

Methods can pass values to later methods of the same payload through outputs. A payload declares all its outputs upfront, each with a capacity, and every #[output] and return value of a method writes one of them. Later methods can refer to what was written last into a declared output as a slot or an input, see TransactionOutput.

Builder interface requires heap allocations and can be enabled with payload-builder feature, while the rest works in no_std environment without a global allocator.

Modules§

builder
Transaction payload creation utilities
decoder
Checking a payload and describing its methods without calling them

Structs§

DeclaredOutput
Output that a payload declares, with what is known about the value that was written into it last, see TransactionPayloadDecoder::new() and TransactionPayloadCaller::new()
TransactionInput
The type of transaction input could be either explicit value or output index.
TransactionOutput
The type of transaction output could be either #[output] or return value, with the index of the declared output that it writes.
TransactionPayloadCaller
Caller of methods in a transaction payload created using TransactionPayloadBuilder.
TransactionSlot
The type of transaction slot could be either explicit slot address or output index.

Enums§

TransactionInputType
TransactionMethodContext
TransactionOutputKind
Whether an output is #[output] or the return value
TransactionOutputType
TransactionPayloadCallError
Errors for TransactionPayloadCaller::call_next_method()
TransactionPayloadDecoderError
Errors of decoding a payload with TransactionPayloadDecoder or TransactionPayloadCaller, whose constructors already read the declared outputs
TransactionSlotType