spl_transfer_hook_interface::onchain

Function add_extra_accounts_for_execute_cpi

Source
pub fn add_extra_accounts_for_execute_cpi<'a>(
    cpi_instruction: &mut Instruction,
    cpi_account_infos: &mut Vec<AccountInfo<'a>>,
    program_id: &Pubkey,
    source_info: AccountInfo<'a>,
    mint_info: AccountInfo<'a>,
    destination_info: AccountInfo<'a>,
    authority_info: AccountInfo<'a>,
    amount: u64,
    additional_accounts: &[AccountInfo<'a>],
) -> ProgramResult
Expand description

Helper to add accounts required for an ExecuteInstruction on-chain, looking through the additional account infos to add the proper accounts.

Note this helper is designed to add the extra accounts that will be required for a CPI to a transfer hook program. However, the instruction being provided to this helper is for the program that will CPI to the transfer hook program. Because of this, we must resolve the extra accounts for the ExecuteInstruction CPI, then add those extra resolved accounts to the provided instruction.