Skip to main content

Module intent

Module intent 

Source
Expand description

Order intents and their canonical byte representation.

The intent has two representations:

  • OrderIntent is the idiomatic Rust representation. Everything outside the settlement program uses it.
  • EncodedOrderIntent is the canonical byte representation: the only thing sent on the wire and also the data encoding used to generate the order UID. There, kind and partially_fillable share a single flags byte.

Conversion is asymmetric: encoding an OrderIntent is infallible, but decoding raw bytes returns Result and rejects a flags byte carrying a bit the encoding doesn’t define.

Structs§

EncodedOrderIntent
Canonical 213-byte representation of an OrderIntent. The wire format and the order UID preimage.
Flags
Collection of OrderIntent fields that can be represented as a single bit.
NativeSolHasNoMint
Native SOL has no mint: it moves as lamports, not through a token program. The error returned when a TokenAsset naming native SOL is converted to an Asset.
OrderIntent
Order intent. Its canonical encoding, EncodedOrderIntent, is the exact wire format of create_order’s intent argument and the exact bytes hashed (SHA-256) to produce the order UID used in the order PDA’s seeds.
TokenAsset
The representation of the side of a trade involving an actual token. Tokens from the mint mint stored at token_account.

Enums§

Asset
One side of a trade: what moves, and the account it moves through.
OrderKind
Direction of the trade. The discriminants are the values the kind bit of the encoded flags byte takes.

Constants§

ENCODED_NATIVE_SOL_TRANSFER
The address an encoded intent carries as a mint to trade native SOL rather than a token; see Asset::Native.

Functions§

check_bytes
Given a slice of intent bytes, verify that it can encode a valid intent.
hash_bytes