pub struct HopperCtx<'a, T>where
T: HopperAccounts<'a>,{
pub accounts: T,
pub bumps: <T as HopperAccounts<'a>>::Bumps,
pub program_id: &'a Address,
pub instruction_data: &'a [u8],
pub remaining_accounts: &'a [AccountView],
}Expand description
Typed instruction context carrying validated accounts, bumps, and metadata.
Replaces Anchor’s Context<T> with Hopper-native semantics: receipts,
explain, schema access, and remaining accounts.
Fields§
§accounts: TValidated accounts struct.
bumps: <T as HopperAccounts<'a>>::BumpsResolved PDA bumps.
program_id: &'a AddressThe executing program’s address.
instruction_data: &'a [u8]Remaining unparsed instruction data (after dispatch tag).
remaining_accounts: &'a [AccountView]Accounts not consumed by the struct (for CPI or dynamic use).
Implementations§
Source§impl<'a, T> HopperCtx<'a, T>where
T: HopperAccounts<'a>,
impl<'a, T> HopperCtx<'a, T>where
T: HopperAccounts<'a>,
Sourcepub fn emit_receipt(&self) -> Result<(), ProgramError>
pub fn emit_receipt(&self) -> Result<(), ProgramError>
Emit a default receipt for the current mutation.
Routes to the existing Hopper receipt infrastructure when a receipt profile is bound to this context.
Sourcepub fn explain(&self) -> ContextExplain
pub fn explain(&self) -> ContextExplain
Generate a human-readable explanation of this context and its accounts.
Sourcepub fn schema(&self) -> Option<&'static ContextSchema>
pub fn schema(&self) -> Option<&'static ContextSchema>
Access the static context schema, if available.
Sourcepub fn new(
accounts: T,
bumps: <T as HopperAccounts<'a>>::Bumps,
program_id: &'a Address,
instruction_data: &'a [u8],
remaining_accounts: &'a [AccountView],
) -> HopperCtx<'a, T>
pub fn new( accounts: T, bumps: <T as HopperAccounts<'a>>::Bumps, program_id: &'a Address, instruction_data: &'a [u8], remaining_accounts: &'a [AccountView], ) -> HopperCtx<'a, T>
Construct a context from pre-validated parts.
Callers must ensure all accounts have already been validated.
Typically used by derive-generated try_from_accounts or entry().