Expand description
Rust client generator.
Produces a self-contained off-chain Rust client from a
ProgramManifest. Consumers are integration tests, CLI tools,
other on-chain programs that CPI into this one, and server-side
services that build transactions.
The generator’s output uses the canonical solana-sdk shape
(Pubkey, Instruction, AccountMeta) so it drops into any
existing Rust program or test harness without a custom runtime.
Closes the “winning architecture” design’s Category 5 item
(“generate TS + Rust clients”) and is the Rust counterpart to
TsClientGen and
KtClientGen.
§Shape
Every generated client file has four sections:
- Constants:
LAYOUT_IDhex bytes per account layout, per-field offsets + sizes, instruction discriminators. - Accounts: a typed struct per layout plus a
decode_{name}(&[u8]) -> Result<{Name}>that reads fields out of raw bytes at their declared offsets, preceded byassert_{name}_layout(&[u8])which compares the header’sLAYOUT_IDagainst the embedded constant. - Instructions:
create_{ix}_ix(accounts, args) -> Instructionbuilders with the discriminator byte + LE-encoded args. - Events:
decode_{event}_data(&[u8]) -> Result<{Event}>.
Client-side layout verification is mandatory. the audit’s
closing directive is that clients must refuse to decode accounts
whose headers disagree with the compiled ABI. The generated
assert_{name}_layout is the enforcement point.
Structs§
- RsClient
Gen - Full Rust client emitter.