Skip to main content

Memo

Struct Memo 

Source
pub struct Memo<'a, 'b, 'c> {
    pub signers: &'a [&'a AccountView],
    pub memo: &'b [u8],
    pub program_id: Option<&'c Address>,
}
Expand description

SPL Memo CPI builder.

signers are the accounts the memo program will assert signed the surrounding transaction; pass an empty slice for unauthenticated memos (the program then only logs the bytes). memo is the raw payload - UTF-8 framing is the caller’s responsibility.

program_id selects the target program. Default (None) uses MEMO_PROGRAM_ID (Memo v2). Pass Some(&v1::MEMO_V1_PROGRAM_ID) for the legacy program.

The struct holds borrowed references only; nothing is allocated on the heap.

Fields§

§signers: &'a [&'a AccountView]

Signing accounts the Memo program will validate.

§memo: &'b [u8]

Raw memo payload.

§program_id: Option<&'c Address>

Target program. None = Memo v2 (default).

Implementations§

Source§

impl Memo<'_, '_, '_>

Source

pub fn invoke(&self) -> Result<(), ProgramError>

Invoke the Memo program with no PDA signer seeds.

Source

pub fn invoke_signed( &self, signers_seeds: &[Signer<'_, '_>], ) -> Result<(), ProgramError>

Invoke the Memo program, supplying PDA signer seeds.

Any signer in self.signers whose address is a PDA must have its derivation seeds in signers_seeds; the runtime will sign the inner CPI on its behalf.

Auto Trait Implementations§

§

impl<'a, 'b, 'c> Freeze for Memo<'a, 'b, 'c>

§

impl<'a, 'b, 'c> RefUnwindSafe for Memo<'a, 'b, 'c>

§

impl<'a, 'b, 'c> Send for Memo<'a, 'b, 'c>

§

impl<'a, 'b, 'c> Sync for Memo<'a, 'b, 'c>

§

impl<'a, 'b, 'c> Unpin for Memo<'a, 'b, 'c>

§

impl<'a, 'b, 'c> UnsafeUnpin for Memo<'a, 'b, 'c>

§

impl<'a, 'b, 'c> UnwindSafe for Memo<'a, 'b, 'c>

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.