pub fn token_transfer(
        &self,
        signer: &dyn Signer,
        token_name: &str,
        destination_wallet: &Pubkey,
        ui_amount: f64,
    ) -> Result<Signature, FarmClientError> {
        let mut inst = vec![];
        if !self.has_active_token_account(&signer.pubkey(), token_name) {
            return Err(FarmClientError::RecordNotFound(format!(
                "Source account with token {}",
                token_name
            )));
        }
        if !self.has_active_token_account(destination_wallet, token_name) {
            let token = self.get_token(token_name)?;
            inst.push(create_associated_token_account(
                &signer.pubkey(),
                destination_wallet,
                &token.mint,
            ));
        }
        inst.push(self.new_instruction_token_transfer(
            &signer.pubkey(),
            token_name,
            destination_wallet,
            ui_amount,
        )?);
        self.sign_and_send_instructions(&[signer], inst.as_slice())
    }
/// Transfers tokens from the wallet to the destination
Transfers tokens from the wallet to the destination
Transfers tokens from the wallet to the destination
pub fn token_transfer(
        &self,
        signer: &dyn Signer,
        token_name: &str,
        destination_wallet: &Pubkey,
        ui_amount: f64,
    ) -> Result<Signature, FarmClientError> {
        let mut inst = vec![];
        if !self.has_active_token_account(&signer.pubkey(), token_name) {
            return Err(FarmClientError::RecordNotFound(format!(
                "Source account with token {}",
                token_name
            )));
        }
        if !self.has_active_token_account(destination_wallet, token_name) {
            let token = self.get_token(token_name)?;
            inst.push(create_associated_token_account(
                &signer.pubkey(),
                destination_wallet,
                &token.mint,
            ));
        }
        inst.push(self.new_instruction_token_transfer(
            &signer.pubkey(),
            token_name,
            destination_wallet,
            ui_amount,
        )?);
        self.sign_and_send_instructions(&[signer], inst.as_slice())
    }
pub fn token_transfer ( & self , signer : & dyn Signer , token_name : & str , destination_wallet : & Pubkey , ui_amount : f64 , ) -> Result < Signature , FarmClientError > { let mut inst = vec ! [ ] ; if ! self . has_active_token_account ( & signer . pubkey ( ) , token_name ) { return Err ( FarmClientError :: RecordNotFound ( format ! ( " " token_name ) ) ) ; } if ! self . has_active_token_account ( destination_wallet , token_name ) { let token = self . get_token ( token_name ) ? ; inst . push ( create_associated_token_account ( & signer . pubkey ( ) , destination_wallet , & token . mint , ) ) ; } inst . push ( self . new_instruction_token_transfer ( & signer . pubkey ( ) , token_name , destination_wallet , ui_amount , ) ? ) ; self . sign_and_send_instructions ( & [ signer ] , inst . as_slice ( ) ) }
Transfers tokens from the wallet to the destination
Transfers tokens from the wallet to the destination
&self
signer
&dyn Signer
token_name
&str
destination_wallet
&Pubkey
ui_amount
f64
&self
signer
&dyn Signer
token_name
&str
destination_wallet
&Pubkey
ui_amount
f64