Expand description
Const-generic CPI builder – stack-only, zero-allocation CPI calls.
Both account count and data size are const generics, ensuring everything lives on the SBF stack (4096 bytes). No heap allocation ever.
§Design
HopperCpi<A, D>– fully const-generic: accounts + dataHopperCpiBuf<A, MAX>– const accounts, runtime data length- Uses
MaybeUninitfor zero-cost initialization - Direct
sol_invoke_signed_csyscall on SBF
ⓘ
let cpi = HopperCpi::<3, 9>::new(token_program_id)
.account(source, true, false) // writable, not signer
.account(dest, true, false)
.account(authority, false, true) // not writable, signer
.data(&[3, /* transfer discriminator + amount */]);
cpi.invoke()?;Structs§
- Hopper
Cpi - Stack-allocated CPI call with compile-time-known account count and data size.
- Hopper
CpiBuf - Variable-data CPI builder – const accounts, runtime data length.