Skip to main content

HopperCtx

Struct HopperCtx 

Source
pub struct HopperCtx<'a, T>
where T: HopperAccounts<'a>,
{ pub accounts: T, pub bumps: T::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: T

Validated accounts struct.

§bumps: T::Bumps

Resolved PDA bumps.

§program_id: &'a Address

The 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>,

Source

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.

Source

pub fn explain(&self) -> ContextExplain

Generate a human-readable explanation of this context and its accounts.

Source

pub fn schema(&self) -> Option<&'static ContextSchema>

Access the static context schema, if available.

Source

pub fn new( accounts: T, bumps: T::Bumps, program_id: &'a Address, instruction_data: &'a [u8], remaining_accounts: &'a [AccountView], ) -> Self

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().

Auto Trait Implementations§

§

impl<'a, T> Freeze for HopperCtx<'a, T>
where T: Freeze, <T as HopperAccounts<'a>>::Bumps: Freeze,

§

impl<'a, T> RefUnwindSafe for HopperCtx<'a, T>

§

impl<'a, T> Send for HopperCtx<'a, T>
where T: Send, <T as HopperAccounts<'a>>::Bumps: Send,

§

impl<'a, T> Sync for HopperCtx<'a, T>
where T: Sync, <T as HopperAccounts<'a>>::Bumps: Sync,

§

impl<'a, T> Unpin for HopperCtx<'a, T>
where T: Unpin, <T as HopperAccounts<'a>>::Bumps: Unpin,

§

impl<'a, T> UnsafeUnpin for HopperCtx<'a, T>

§

impl<'a, T> UnwindSafe for HopperCtx<'a, T>
where T: UnwindSafe, <T as HopperAccounts<'a>>::Bumps: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.