Skip to main content

TransferChecked

Struct TransferChecked 

Source
pub struct TransferChecked<'a> {
    pub from: &'a AccountView<'a>,
    pub mint: &'a AccountView<'a>,
    pub to: &'a AccountView<'a>,
    pub authority: &'a AccountView<'a>,
    pub amount: u64,
    pub decimals: u8,
}
Expand description

Builder for classic SPL Token TransferChecked (instruction index 12).

The token program checks the supplied mint and decimals. This builder calls TOKEN_PROGRAM_ID; it does not dispatch to Token-2022 or resolve transfer hooks. Use hopper_solana::interface or hopper_token_2022 for those program integrations, supplying hook accounts when required.

Fields§

§from: &'a AccountView<'a>§mint: &'a AccountView<'a>§to: &'a AccountView<'a>§authority: &'a AccountView<'a>§amount: u64§decimals: u8

Implementations§

Source§

impl TransferChecked<'_>

Source

pub fn invoke(&self) -> ProgramResult

Invoke with a transaction-signed authority. Fails fast with MissingRequiredSignature before the CPI if the authority is not a signer.

Source

pub fn invoke_strict(&self) -> ProgramResult

Check transaction signer status and require the source’s token owner to equal the authority before CPI. This stricter owner path excludes delegated transfers; use invoke when the token program should validate a delegate or invoke_multisig for an SPL multisig authority.

Verifies self.from’s owner field (SPL TokenAccount bytes [32..64]) matches self.authority.address(). Returns ProgramError::IncorrectAuthority on mismatch.

Source

pub fn invoke_signed(&self, signers: &[Signer<'_, '_>]) -> ProgramResult

Invoke with explicit PDA signer seeds. The SPL token program validates mint + decimals regardless of the signer source.

Source

pub fn invoke_multisig( &self, multisig_signers: &[&AccountView<'_>], ) -> ProgramResult

Invoke with an SPL multisig owner account plus transaction-signed multisig signer accounts.

Source

pub fn invoke_signed_multisig( &self, multisig_signers: &[&AccountView<'_>], signers: &[Signer<'_, '_>], ) -> ProgramResult

Invoke with an SPL multisig owner account and explicit PDA signer seeds.

Source

pub fn invoke_signed_strict(&self, signers: &[Signer<'_, '_>]) -> ProgramResult

Strict PDA-signed invoke: ownership pre-check (the SPL token program revalidates, but Hopper surfaces a branded error first) then CPI with the supplied signer seeds.

Auto Trait Implementations§

§

impl<'a> !Send for TransferChecked<'a>

§

impl<'a> !Sync for TransferChecked<'a>

§

impl<'a> Freeze for TransferChecked<'a>

§

impl<'a> RefUnwindSafe for TransferChecked<'a>

§

impl<'a> Unpin for TransferChecked<'a>

§

impl<'a> UnsafeUnpin for TransferChecked<'a>

§

impl<'a> UnwindSafe for TransferChecked<'a>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.