1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Borsh instruction-data helpers for Solana instructions the Palinurus plugins emit.
//!
//! Pure-Rust, `wasm32-wasip2`-friendly. The `borsh` crate handles primitive
//! (u8 / u32 / u64 / i64 / Vec / arrays) serialization; this module defines the
//! Solana-specific structs + helpers, verified byte-for-byte against canonical
//! reference encoders:
//!
//! - [`CreateAttestationIxData`] — the Solana Attestation Service (SAS)
//! `create_attestation` instruction DATA. Layout verified 2026-07-19 against
//! the sas-lib Codama-generated codec (`tools/verify-borsh.mjs` oracle,
//! `sas-lib@1.0.10`):
//! `[u8 discriminator=6] [32-byte nonce] [u32 LE len][N bytes data] [i64 LE expiry]`
//! - [`memo_ix_data`] — the SPL Memo program v3 instruction DATA = raw UTF-8
//! bytes (no discriminator, no length prefix; ground-truth from
//! `@solana/spl-memo` `createMemoInstruction`).
//!
//! The nonce is a `Pubkey` (used as an attestation-PDA seed for uniqueness — the
//! replay guard), NOT a u64 counter. `expiry` is a signed `i64` unix timestamp.
//! `data` is the schema-encoded attestation payload (`serializeAttestationData`
//! in sas-lib) — produced by the plugin, opaque to this struct.
use cratePubkey;
use ;
/// Solana Attestation Service `create_attestation` instruction DATA.
///
/// Borsh layout (matches sas-lib `getCreateAttestationInstructionDataEncoder`):
/// `u8 discriminator` (=6) · `Pubkey nonce` (32 B) · `Vec<u8> data` (u32 LE len + bytes) · `i64 expiry` (LE).
/// SPL Memo program v3 instruction DATA — the raw memo UTF-8 bytes.
///
/// The memo program reads `ix.data` directly: no discriminator, no length
/// prefix. Returns the memo string as a byte vector.