pub fn add_locked_liquidity_vault(
        &self,
        signer: &dyn Signer,
        vault_name: &str,
        ui_amount: f64,
    ) -> Result<Signature, FarmClientError> {
        // check user accounts
        let mut inst = Vec::<Instruction>::new();
        self.check_vault_accounts(signer, vault_name, 0.0, 0.0, 0.0, true, false, &mut inst)?;
        if !inst.is_empty() {
            self.sign_and_send_instructions(&[signer], inst.as_slice())?;
            inst.clear();
        }

        // check if the user has locked balance
        if ui_amount > 0.0 {
            let lp_debt = self
                .get_vault_user_info(&signer.pubkey(), vault_name)?
                .lp_tokens_debt;
            let pool_token_decimals = self.get_vault_lp_token_decimals(vault_name)?;
            if self.tokens_to_ui_amount_with_decimals(lp_debt, pool_token_decimals) < ui_amount {
                return Err(FarmClientError::InsufficientBalance(
                    "Not enough locked tokens to deposit".to_string(),
                ));
            }
        }

        inst.push(self.new_instruction_lock_liquidity_vault(
            &signer.pubkey(),
            vault_name,
            ui_amount,
        )?);
        self.sign_and_send_instructions(&[signer], inst.as_slice())
    }
/// Adds locked liquidity to the Vault.
/// Useful if add liquidity operation partially failed.
Adds locked liquidity to the Vault.
Useful if add liquidity operation partially failed.
Adds locked liquidity to the Vault . Useful if add liquidity operation partially failed .
pub fn add_locked_liquidity_vault(
        &self,
        signer: &dyn Signer,
        vault_name: &str,
        ui_amount: f64,
    ) -> Result<Signature, FarmClientError> {
        // check user accounts
        let mut inst = Vec::<Instruction>::new();
        self.check_vault_accounts(signer, vault_name, 0.0, 0.0, 0.0, true, false, &mut inst)?;
        if !inst.is_empty() {
            self.sign_and_send_instructions(&[signer], inst.as_slice())?;
            inst.clear();
        }
        // check if the user has locked balance
        if ui_amount > 0.0 {
            let lp_debt = self
                .get_vault_user_info(&signer.pubkey(), vault_name)?
                .lp_tokens_debt;
            let pool_token_decimals = self.get_vault_lp_token_decimals(vault_name)?;
            if self.tokens_to_ui_amount_with_decimals(lp_debt, pool_token_decimals) < ui_amount {
                return Err(FarmClientError::InsufficientBalance(
                    "Not enough locked tokens to deposit".to_string(),
                ));
            }
        }
        inst.push(self.new_instruction_lock_liquidity_vault(
            &signer.pubkey(),
            vault_name,
            ui_amount,
        )?);
        self.sign_and_send_instructions(&[signer], inst.as_slice())
    }
pub fn add_locked_liquidity_vault ( & self , signer : & dyn Signer , vault_name : & str , ui_amount : f64 , ) -> Result < Signature , FarmClientError > { // check user accounts let mut inst = Vec :: < Instruction > :: new ( ) ; self . check_vault_accounts ( signer , vault_name , 0.0 , 0.0 , 0.0 , true , false , & mut inst ) ? ; if ! inst . is_empty ( ) { self . sign_and_send_instructions ( & [ signer ] , inst . as_slice ( ) ) ? ; inst . clear ( ) ; } // check if the user has locked balance if ui_amount > 0.0 { let lp_debt = self . get_vault_user_info ( & signer . pubkey ( ) , vault_name ) ? . lp_tokens_debt ; let pool_token_decimals = self . get_vault_lp_token_decimals ( vault_name ) ? ; if self . tokens_to_ui_amount_with_decimals ( lp_debt , pool_token_decimals ) < ui_amount { return Err ( FarmClientError :: InsufficientBalance ( " " . to_string ( ) , ) ) ; } } inst . push ( self . new_instruction_lock_liquidity_vault ( & signer . pubkey ( ) , vault_name , ui_amount , ) ? ) ; self . sign_and_send_instructions ( & [ signer ] , inst . as_slice ( ) ) }
Adds locked liquidity to the Vault.
Adds locked liquidity to the Vault .
&self
signer
&dyn Signer
vault_name
&str
ui_amount
f64
&self
signer
&dyn Signer
vault_name
&str
ui_amount
f64