Skip to main content

interface_transfer_checked

Function interface_transfer_checked 

Source
pub fn interface_transfer_checked<'a>(
    source: &'a AccountView,
    mint: &'a AccountView,
    destination: &'a AccountView,
    authority: &'a AccountView,
    amount: u64,
    decimals: u8,
) -> Result<(), ProgramError>
Expand description

Polymorphic TransferChecked CPI that dispatches to the program that owns the source token account.

The instruction layout is shared between SPL Token and Token-2022: [12u8, amount: u64 LE, decimals: u8] with three accounts (source, mint, destination, authority). This helper picks the right program id based on the source account’s owner and forwards through the runtime’s checked CPI path.