Provide token program cross-program-invocation wrappers #91
Closed as not planned
Description
opened on Jul 7, 2020
Could use a trait object:
pub fn token_transfer(
&self,
accounts: &[AccountInfo],
token: &Pubkey,
destination: &Pubkey,
amount: u64,
) -> Result<(), ProgramError> {
let swap_string = self.self_pubkey.to_string();
let signers = &[&[&swap_string[..32]][..]];
let ix = spl_token::instruction::transfer(
self.token_program,
self.authority,
token,
destination,
amount,
)?;
invoke_signed(&ix, accounts, signers)
}
Activity