Concepts
Payload Schema
Design fixed-size packed payload schemas for Doppler programs.
Doppler schemas are fixed-size and packed. A schema defines the bytes that come after the oracle sequence number.
Schema Shape
Use a TypeScript, JavaScript, or JSON config file with a payload object:
export default {
payload: {
price: "u64",
confidence: "u32",
slot: "u64",
source: { type: "u8", length: 32 },
},
} as const;Supported Fields
Supported scalar types:
| Type | Size | Notes |
|---|---|---|
u8 | 1 byte | Unsigned integer |
u16 | 2 bytes | Little-endian |
u32 | 4 bytes | Little-endian |
u64 | 8 bytes | Little-endian, bigint in TypeScript |
i8 | 1 byte | Signed integer |
i16 | 2 bytes | Little-endian |
i32 | 4 bytes | Little-endian |
i64 | 8 bytes | Little-endian, bigint in TypeScript |
bool | 1 byte | Encoded as 0 or 1 |
Fixed-size arrays use { type, length }:
payload: {
authority: { type: "u8", length: 32 },
}Layout Rules
The layout is deterministic:
- field 0 starts at offset
0 - each next field starts immediately after the previous field
- there is no Rust
repr(C)padding - integer fields are little-endian
- fixed arrays repeat the scalar layout
lengthtimes
For this schema:
payload: {
price: "u64",
confidence: "u32",
slot: "u64",
}The payload size is 20 bytes:
offset 0 price u64 8 bytes
offset 8 confidence u32 4 bytes
offset 12 slot u64 8 bytesUnsupported Types
Doppler does not support dynamic fields:
- strings
- vectors
- maps
- optional fields
- enums
- variable-length arrays
Use explicit fixed-size fields instead.