Skip to main content

HopperAccounts

Trait HopperAccounts 

Source
pub trait HopperAccounts<'a>: Sized {
    type Bumps: Default;

    const ACCOUNT_COUNT: usize;

    // Required method
    fn try_from_accounts(
        program_id: &'a Address,
        accounts: &'a [AccountView],
        instruction_data: &'a [u8],
    ) -> Result<(Self, Self::Bumps), ProgramError>;
}
Expand description

Trait implemented by account structs (manually or via derive).

Provides typed construction from raw accounts and optional schema metadata.

Required Associated Constants§

Source

const ACCOUNT_COUNT: usize

Number of accounts consumed by this context struct.

Used by hopper_entry() to split the accounts slice into consumed accounts and remaining accounts for CPI forwarding.

Required Associated Types§

Source

type Bumps: Default

PDA bump storage type for this context.

Required Methods§

Source

fn try_from_accounts( program_id: &'a Address, accounts: &'a [AccountView], instruction_data: &'a [u8], ) -> Result<(Self, Self::Bumps), ProgramError>

Construct the account struct from raw instruction inputs.

Performs all validation: signer checks, writable checks, owner checks, PDA verification, layout validation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§