Skip to content

Provide token program cross-program-invocation wrappers #91

Closed as not planned
@jackcmay

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    stale[bot only] Added to stale content; will be closed soon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions