pub fn mint_coins(&mut self, space_delim_strings: &[&str], is_blocking: bool) -> Result<()> {
        ensure!(
            space_delim_strings.len() >= 4 && space_delim_strings.len() <= 5,
            "Invalid number of arguments for mint"
        );
        let (receiver, receiver_auth_key_opt) =
            self.get_account_address_from_parameter(space_delim_strings[1])?;
        let receiver_auth_key = receiver_auth_key_opt.ok_or_else(|| {
            format_err!("Need authentication key to create new account via minting")
        })?;
        let mint_currency = space_delim_strings[3];
        let use_base_units = space_delim_strings
            .get(4)
            .map(|s| s == &"use_base_units")
            .unwrap_or(false);
        let num_coins = if !use_base_units {
            self.convert_to_on_chain_represenation(space_delim_strings[2], mint_currency)?
        } else {
            Self::convert_to_scaled_representation(space_delim_strings[2], 1, 1)?
        };
        let currency_code = from_currency_code_string(mint_currency)
            .map_err(|_| format_err!("Invalid currency code {} provided to mint", mint_currency))?;

        ensure!(num_coins > 0, "Invalid number of coins to mint.");

        match self.faucet_account {
            Some(_) => {
                let script = if mint_currency == "LBR" {
                    transaction_builder::encode_mint_lbr_to_address_script(
                        &receiver,
                        receiver_auth_key.prefix().to_vec(),
                        num_coins,
                    )
                } else {
                    transaction_builder::encode_mint_script(
                        type_tag_for_currency_code(currency_code),
                        &receiver,
                        receiver_auth_key.prefix().to_vec(),
                        num_coins,
                    )
                };
                self.association_transaction_with_local_faucet_account(script, is_blocking)
            }
            None => self.mint_coins_with_faucet_service(
                receiver_auth_key,
                num_coins,
                mint_currency.to_owned(),
                is_blocking,
            ),
        }
    }
/// Mints coins for the receiver specified.
Mints coins for the receiver specified.
Mints coins for the receiver specified .
pub fn mint_coins(&mut self, space_delim_strings: &[&str], is_blocking: bool) -> Result<()> {
        ensure!(
            space_delim_strings.len() >= 4 && space_delim_strings.len() <= 5,
            "Invalid number of arguments for mint"
        );
        let (receiver, receiver_auth_key_opt) =
            self.get_account_address_from_parameter(space_delim_strings[1])?;
        let receiver_auth_key = receiver_auth_key_opt.ok_or_else(|| {
            format_err!("Need authentication key to create new account via minting")
        })?;
        let mint_currency = space_delim_strings[3];
        let use_base_units = space_delim_strings
            .get(4)
            .map(|s| s == &"use_base_units")
            .unwrap_or(false);
        let num_coins = if !use_base_units {
            self.convert_to_on_chain_represenation(space_delim_strings[2], mint_currency)?
        } else {
            Self::convert_to_scaled_representation(space_delim_strings[2], 1, 1)?
        };
        let currency_code = from_currency_code_string(mint_currency)
            .map_err(|_| format_err!("Invalid currency code {} provided to mint", mint_currency))?;
        ensure!(num_coins > 0, "Invalid number of coins to mint.");
        match self.faucet_account {
            Some(_) => {
                let script = if mint_currency == "LBR" {
                    transaction_builder::encode_mint_lbr_to_address_script(
                        &receiver,
                        receiver_auth_key.prefix().to_vec(),
                        num_coins,
                    )
                } else {
                    transaction_builder::encode_mint_script(
                        type_tag_for_currency_code(currency_code),
                        &receiver,
                        receiver_auth_key.prefix().to_vec(),
                        num_coins,
                    )
                };
                self.association_transaction_with_local_faucet_account(script, is_blocking)
            }
            None => self.mint_coins_with_faucet_service(
                receiver_auth_key,
                num_coins,
                mint_currency.to_owned(),
                is_blocking,
            ),
        }
    }
pub fn mint_coins ( & mut self , space_delim_strings : & [ & str ] , is_blocking : bool ) -> Result < ( ) > { ensure ! ( space_delim_strings len ( ) 4 space_delim_strings len ( ) 5 " " ) ; let ( receiver , receiver_auth_key_opt ) = self . get_account_address_from_parameter ( space_delim_strings [ 1 ] ) ? ; let receiver_auth_key = receiver_auth_key_opt . ok_or_else ( | | { format_err ! ( " " ) } ) ? ; let mint_currency = space_delim_strings [ 3 ] ; let use_base_units = space_delim_strings . get ( 4 ) . map ( | s | s == & " " ) . unwrap_or ( false ) ; let num_coins = if ! use_base_units { self . convert_to_on_chain_represenation ( space_delim_strings [ 2 ] , mint_currency ) ? } else { Self :: convert_to_scaled_representation ( space_delim_strings [ 2 ] , 1 , 1 ) ? } ; let currency_code = from_currency_code_string ( mint_currency ) . map_err ( | _ | format_err ! ( " " mint_currency ) ) ? ; ensure ! ( num_coins 0 " " ) ; match self . faucet_account { Some ( _ ) => { let script = if mint_currency == " " { transaction_builder :: encode_mint_lbr_to_address_script ( & receiver , receiver_auth_key . prefix ( ) . to_vec ( ) , num_coins , ) } else { transaction_builder :: encode_mint_script ( type_tag_for_currency_code ( currency_code ) , & receiver , receiver_auth_key . prefix ( ) . to_vec ( ) , num_coins , ) } ; self . association_transaction_with_local_faucet_account ( script , is_blocking ) } None => self . mint_coins_with_faucet_service ( receiver_auth_key , num_coins , mint_currency . to_owned ( ) , is_blocking , ) , } }
Mints coins for the receiver specified.
Mints coins for the receiver specified .
&mut self
space_delim_strings
&[&str]
is_blocking
bool
&mut self
space_delim_strings
&[&str]
is_blocking
bool