pub fn transfer_coins_int(
        &mut self,
        sender_account_ref_id: usize,
        receiver_address: &AccountAddress,
        receiver_auth_key_prefix: Vec<u8>,
        num_coins: u64,
        coin_currency: String,
        gas_unit_price: Option<u64>,
        gas_currency_code: Option<String>,
        max_gas_amount: Option<u64>,
        is_blocking: bool,
    ) -> Result<IndexAndSequence> {
        let sender_address;
        let sender_sequence;
        let currency_code = from_currency_code_string(&coin_currency)
            .map_err(|_| format_err!("Invalid currency code {} specified", coin_currency))?;
        let gas_currency_code = gas_currency_code.or(Some(coin_currency));
        {
            let sender = self.accounts.get(sender_account_ref_id).ok_or_else(|| {
                format_err!("Unable to find sender account: {}", sender_account_ref_id)
            })?;
            let program = transaction_builder::encode_transfer_with_metadata_script(
                type_tag_for_currency_code(currency_code),
                &receiver_address,
                receiver_auth_key_prefix,
                num_coins,
                vec![],
                vec![],
            );
            let txn = self.create_txn_to_submit(
                TransactionPayload::Script(program),
                sender,
                max_gas_amount,    /* max_gas_amount */
                gas_unit_price,    /* gas_unit_price */
                gas_currency_code, /* gas_currency_code */
            )?;
            let sender_mut = self
                .accounts
                .get_mut(sender_account_ref_id)
                .ok_or_else(|| {
                    format_err!("Unable to find sender account: {}", sender_account_ref_id)
                })?;
            self.client.submit_transaction(Some(sender_mut), txn)?;
            sender_address = sender_mut.address;
            sender_sequence = sender_mut.sequence_number;
        }

        if is_blocking {
            self.wait_for_transaction(sender_address, sender_sequence)?;
        }

        Ok(IndexAndSequence {
            account_index: AccountEntry::Index(sender_account_ref_id),
            sequence_number: sender_sequence - 1,
        })
    }
/// Transfer num_coins from sender account to receiver. If is_blocking = true,
/// it will keep querying validator till the sequence number is bumped up in validator.
Transfer num_coins from sender account to receiver. If is_blocking = true,
it will keep querying validator till the sequence number is bumped up in validator.
Transfer num_coins from sender account to receiver . If is_blocking = true it will keep querying validator till the sequence number is bumped up in validator .
pub fn transfer_coins_int(
        &mut self,
        sender_account_ref_id: usize,
        receiver_address: &AccountAddress,
        receiver_auth_key_prefix: Vec<u8>,
        num_coins: u64,
        coin_currency: String,
        gas_unit_price: Option<u64>,
        gas_currency_code: Option<String>,
        max_gas_amount: Option<u64>,
        is_blocking: bool,
    ) -> Result<IndexAndSequence> {
        let sender_address;
        let sender_sequence;
        let currency_code = from_currency_code_string(&coin_currency)
            .map_err(|_| format_err!("Invalid currency code {} specified", coin_currency))?;
        let gas_currency_code = gas_currency_code.or(Some(coin_currency));
        {
            let sender = self.accounts.get(sender_account_ref_id).ok_or_else(|| {
                format_err!("Unable to find sender account: {}", sender_account_ref_id)
            })?;
            let program = transaction_builder::encode_transfer_with_metadata_script(
                type_tag_for_currency_code(currency_code),
                &receiver_address,
                receiver_auth_key_prefix,
                num_coins,
                vec![],
                vec![],
            );
            let txn = self.create_txn_to_submit(
                TransactionPayload::Script(program),
                sender,
                max_gas_amount,    /* max_gas_amount */
                gas_unit_price,    /* gas_unit_price */
                gas_currency_code, /* gas_currency_code */
            )?;
            let sender_mut = self
                .accounts
                .get_mut(sender_account_ref_id)
                .ok_or_else(|| {
                    format_err!("Unable to find sender account: {}", sender_account_ref_id)
                })?;
            self.client.submit_transaction(Some(sender_mut), txn)?;
            sender_address = sender_mut.address;
            sender_sequence = sender_mut.sequence_number;
        }
        if is_blocking {
            self.wait_for_transaction(sender_address, sender_sequence)?;
        }
        Ok(IndexAndSequence {
            account_index: AccountEntry::Index(sender_account_ref_id),
            sequence_number: sender_sequence - 1,
        })
    }
pub fn transfer_coins_int ( & mut self , sender_account_ref_id : usize , receiver_address : & AccountAddress , receiver_auth_key_prefix : Vec < u8 > , num_coins : u64 , coin_currency : String , gas_unit_price : Option < u64 > , gas_currency_code : Option < String > , max_gas_amount : Option < u64 > , is_blocking : bool , ) -> Result < IndexAndSequence > { let sender_address ; let sender_sequence ; let currency_code = from_currency_code_string ( & coin_currency ) . map_err ( | _ | format_err ! ( " " coin_currency ) ) ? ; let gas_currency_code = gas_currency_code . or ( Some ( coin_currency ) ) ; { let sender = self . accounts . get ( sender_account_ref_id ) . ok_or_else ( | | { format_err ! ( " " sender_account_ref_id ) } ) ? ; let program = transaction_builder :: encode_transfer_with_metadata_script ( type_tag_for_currency_code ( currency_code ) , & receiver_address , receiver_auth_key_prefix , num_coins , vec ! [ ] , vec ! [ ] , ) ; let txn = self . create_txn_to_submit ( TransactionPayload :: Script ( program ) , sender , max_gas_amount , /* max_gas_amount */ gas_unit_price , /* gas_unit_price */ gas_currency_code , /* gas_currency_code */ ) ? ; let sender_mut = self . accounts . get_mut ( sender_account_ref_id ) . ok_or_else ( | | { format_err ! ( " " sender_account_ref_id ) } ) ? ; self . client . submit_transaction ( Some ( sender_mut ) , txn ) ? ; sender_address = sender_mut . address ; sender_sequence = sender_mut . sequence_number ; } if is_blocking { self . wait_for_transaction ( sender_address , sender_sequence ) ? ; } Ok ( IndexAndSequence { account_index : AccountEntry :: Index ( sender_account_ref_id ) , sequence_number : sender_sequence - 1 , } ) }
Transfer num_coins from sender account to receiver.
Transfer num_coins from sender account to receiver .
&mut self
sender_account_ref_id
usize
receiver_address
&AccountAddress
receiver_auth_key_prefix
Vec<u8>
num_coins
u64
coin_currency
String
gas_unit_price
Option<u64>
gas_currency_code
Option<String>
max_gas_amount
Option<u64>
is_blocking
bool
&mut self
sender_account_ref_id
usize
receiver_address
&AccountAddress
receiver_auth_key_prefix
Vec<u8>
num_coins
u64
coin_currency
String
gas_unit_price
Option<u64>
gas_currency_code
Option<String>
max_gas_amount
Option<u64>
is_blocking
bool