pub fn transfer_simple<'info>(
mint: AccountInfo<'info>,
token_program_id: AccountInfo<'info>,
source_pubkey: Pubkey,
destination_pubkey: AccountInfo<'info>,
authority_pubkey: AccountInfo<'info>,
amount: u64,
signer_seeds: &[&[u8]],
) -> Result<()>Expand description
Transfers SPL tokens from one account to another.
This function facilitates the transfer of SPL tokens between accounts
on the Solana blockchain. It uses the spl_token::instruction::transfer function
to create the transfer instruction, and signs the transaction using the provided
signer_seeds.
§Arguments
mint- The mint account of the token.token_program_id- The token program account (usuallyspl_token).source_pubkey- The source account’s public key from which tokens will be transferred.destination_pubkey- The destination account’sAccountInfo.authority_pubkey- The authority account that will sign the transfer.amount- The amount of tokens to transfer.signer_seeds- A slice of slices of seeds for signing the transaction.
§Example
use simplespl::transfer_simple;
use anchor_lang::solana_program::account_info::AccountInfo;
transfer_simple(
mint_account_info,
token_program_account_info,
source_pubkey,
destination_account_info,
authority_account_info,
500, // Transfer 500 tokens
&[&signer_seeds],
).unwrap();