Expand description
Layout contracts as runtime truth.
LayoutContract is the central trait for Hopper’s state-first architecture.
It ties together discriminator, version, and layout fingerprint into a single
compile-time contract that the runtime can validate before granting typed access.
This is what makes Hopper different from every other Solana framework: layouts are not just metadata or serialization hints. They are runtime contracts that gate account access, enforce compatibility, and enable schema evolution.
No competitor (Pinocchio, Steel, Quasar) has anything equivalent.
Structs§
- Hopper
Header - The canonical 16-byte header at the start of every Hopper account.
- Layout
Info - Runtime metadata snapshot of an account’s layout identity.
Constants§
- DEFAULT_
SCHEMA_ EPOCH - Default schema-evolution epoch written by
init_header.
Traits§
- Layout
Contract - A compile-time layout contract binding type identity to wire format.
Functions§
- init_
header - Initialize an account’s header from a layout contract type.
- read_
disc - Read the discriminator from account data (byte 0).
- read_
flags - Read the flags from account data (bytes 2..4) as u16 LE.
- read_
layout_ id - Read the 8-byte layout_id from account data (bytes 4..12).
- read_
schema_ epoch - Read the
schema_epochfield from an already-written header. - read_
version - Read the version from account data (byte 1).
- write_
header - Write a complete Hopper header to the beginning of
data. - write_
header_ with_ epoch - Write a Hopper header with a caller-specified schema epoch.