Skip to main content

hopper_entry

Function hopper_entry 

Source
pub fn hopper_entry<'a, I, F>(
    program_id: &'a Address,
    accounts: &'a [AccountView],
    instruction_data: &'a [u8],
    handler: F,
) -> Result<(), ProgramError>
where I: HopperIx<'a>, F: FnOnce(HopperCtx<'a, <I as HopperIx<'a>>::Accounts>, <I as HopperIx<'a>>::Args) -> Result<(), ProgramError>,
Expand description

Typed instruction entry point.

Parses arguments, constructs the validated context, and invokes the handler. One-line replacement for manual dispatch + parse + validate + execute.

hopper_entry::<DepositIx, _>(program_id, accounts, data, |ctx, args| {
    deposit(ctx, args.amount)
})