Skip to main content

hopper_dispatch_lazy

Macro hopper_dispatch_lazy 

Source
macro_rules! hopper_dispatch_lazy {
    (
        $ctx:expr;
        $( $tag:literal => $handler:expr ),+ $(,)?
    ) => { ... };
}
Expand description

Lazy dispatch – routes on instruction data before parsing any accounts.

Each handler receives a &mut LazyContext and can parse only the accounts it needs, saving CU on instructions that touch few accounts.

hopper_dispatch_lazy! {
    ctx;
    0 => process_init,
    1 => process_deposit,
    2 => process_withdraw,
}