Expand description
Instruction dispatch – tag-based routing with zero allocation.
Hopper uses a 1-byte or 2-byte tag at the start of instruction data
to route to handler functions. The dispatch! macro generates an
efficient match statement.
§Dispatch variants
hopper_dispatch!, Standard: receives(program_id, accounts, data)hopper_dispatch_lazy!, Lazy: receivesLazyContext, parses accounts on-demandhopper_dispatch_8!, 8-byte discriminator (Anchor/Quasar compatible)
Constants§
- EVENT_
CPI_ PREFIX - Event CPI prefix. Programs should check for this at dispatch entry
and return
Ok(())to allow self-CPI events to pass through.
Functions§
- dispatch_
instruction - Read a 1-byte dispatch tag from instruction data.
- dispatch_
instruction_ 8 - Read an 8-byte discriminator (Anchor/Quasar compatible).
- dispatch_
instruction_ u16 - Read a 2-byte dispatch tag (for programs with >256 instructions).