pub fn convert_to_on_chain_represenation(
        &mut self,
        input: &str,
        currency: &str,
    ) -> Result<u64> {
        ensure!(!input.is_empty(), "Empty input not allowed for libra unit");
        // This is not supposed to panic as it is used as constant here.
        let currencies_info = self.client.get_currency_info()?;
        let currency_info = currencies_info
            .iter()
            .find(|info| info.code == currency)
            .ok_or_else(|| {
                format_err!(
                    "Unable to get currency info for {} when converting to on-chain units",
                    currency
                )
            })?;
        Self::convert_to_scaled_representation(
            input,
            currency_info.scaling_factor as i64,
            currency_info.fractional_part as i64,
        )
    }
/// convert number of coins (main unit) given as string to its on-chain represention
convert number of coins (main unit) given as string to its on-chain represention
convert number of coins ( main unit ) given as string to its on - chain represention
pub fn convert_to_on_chain_represenation(
        &mut self,
        input: &str,
        currency: &str,
    ) -> Result<u64> {
        ensure!(!input.is_empty(), "Empty input not allowed for libra unit");
        // This is not supposed to panic as it is used as constant here.
        let currencies_info = self.client.get_currency_info()?;
        let currency_info = currencies_info
            .iter()
            .find(|info| info.code == currency)
            .ok_or_else(|| {
                format_err!(
                    "Unable to get currency info for {} when converting to on-chain units",
                    currency
                )
            })?;
        Self::convert_to_scaled_representation(
            input,
            currency_info.scaling_factor as i64,
            currency_info.fractional_part as i64,
        )
    }
pub fn convert_to_on_chain_represenation ( & mut self , input : & str , currency : & str , ) -> Result < u64 > { ensure ! ( input is_empty ( ) " " ) ; // This is not supposed to panic as it is used as constant here. let currencies_info = self . client . get_currency_info ( ) ? ; let currency_info = currencies_info . iter ( ) . find ( | info | info . code == currency ) . ok_or_else ( | | { format_err ! ( " " currency ) } ) ? ; Self :: convert_to_scaled_representation ( input , currency_info . scaling_factor as i64 , currency_info . fractional_part as i64 , ) }
convert number of coins (main unit) given as string to its on-chain represention
convert number of coins ( main unit ) given as string to its on - chain represention
&mut self
input
&str
currency
&str
&mut self
input
&str
currency
&str