Skip to main content

HopperCpiBuf

Struct HopperCpiBuf 

Source
pub struct HopperCpiBuf<'a, const ACCTS: usize, const MAX: usize> { /* private fields */ }
Expand description

Variable-data CPI builder – const accounts, runtime data length.

For instructions where data size isn’t known at compile time (e.g., Borsh-serialized arguments), but bounded by MAX.

Implementations§

Source§

impl<'a, const ACCTS: usize, const MAX: usize> HopperCpiBuf<'a, ACCTS, MAX>

Source

pub fn new(program_id: &'a Address) -> Self

Begin building a variable-data CPI call.

Source

pub fn add_account( self, view: &'a AccountView, is_writable: bool, is_signer: bool, ) -> Self

Add an account.

Source

pub fn write_data(self, src: &[u8]) -> Result<Self, ProgramError>

Write data into the buffer. Returns error if exceeds MAX.

Source

pub fn invoke(&self) -> ProgramResult

Invoke without signer seeds.

Source

pub fn invoke_signed(&self, seeds: &[&[&[u8]]]) -> ProgramResult

Invoke with PDA signer seeds.

Auto Trait Implementations§

§

impl<'a, const ACCTS: usize, const MAX: usize> Freeze for HopperCpiBuf<'a, ACCTS, MAX>

§

impl<'a, const ACCTS: usize, const MAX: usize> RefUnwindSafe for HopperCpiBuf<'a, ACCTS, MAX>

§

impl<'a, const ACCTS: usize, const MAX: usize> Send for HopperCpiBuf<'a, ACCTS, MAX>

§

impl<'a, const ACCTS: usize, const MAX: usize> Sync for HopperCpiBuf<'a, ACCTS, MAX>

§

impl<'a, const ACCTS: usize, const MAX: usize> Unpin for HopperCpiBuf<'a, ACCTS, MAX>

§

impl<'a, const ACCTS: usize, const MAX: usize> UnsafeUnpin for HopperCpiBuf<'a, ACCTS, MAX>

§

impl<'a, const ACCTS: usize, const MAX: usize> UnwindSafe for HopperCpiBuf<'a, ACCTS, MAX>

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.