From 5fce7d4ccde7ad2b27bfcd4abb7c2a8584fb4b61 Mon Sep 17 00:00:00 2001 From: East Agile Date: Tue, 5 Apr 2022 21:47:34 +0700 Subject: [PATCH] [txs] Allow invoking balance_transfer function when importing libra (#995) --- ol/txs/src/commands/transfer_cmd.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ol/txs/src/commands/transfer_cmd.rs b/ol/txs/src/commands/transfer_cmd.rs index 3abb2b41f0..b875669b1c 100644 --- a/ol/txs/src/commands/transfer_cmd.rs +++ b/ol/txs/src/commands/transfer_cmd.rs @@ -2,7 +2,11 @@ #![allow(clippy::never_loop)] -use crate::{entrypoint, submit_tx::{TxError, maybe_submit, tx_params_wrapper}}; +use crate::{ + entrypoint, + submit_tx::{TxError, maybe_submit, tx_params_wrapper}, + tx_params::TxParams, +}; use abscissa_core::{Command, Options, Runnable}; use diem_json_rpc_types::views::TransactionView; @@ -29,8 +33,8 @@ impl Runnable for TransferCmd { exit(1); }, }; - - match balance_transfer(destination, self.coins, entry_args.save_path) { + let tx_params = tx_params_wrapper(TxType::Mgmt).unwrap(); + match balance_transfer(destination, self.coins, tx_params, entry_args.save_path) { Ok(_) => println!("Success: Balance transfer posted: {}", self.destination_account), Err(e) => { println!("ERROR: execute balance transfer message: {:?}", &e); @@ -41,9 +45,7 @@ impl Runnable for TransferCmd { } /// create an account by sending coin to it -pub fn balance_transfer(destination: AccountAddress, coins: u64, save_path: Option) -> Result{ - let tx_params = tx_params_wrapper(TxType::Mgmt).unwrap(); - +pub fn balance_transfer(destination: AccountAddress, coins: u64, tx_params: TxParams, save_path: Option) -> Result{ // NOTE: coins here do not have the scaling factor. Rescaling is the responsibility of the Move script. See the script in ol_accounts.move for detail. let script = transaction_builder::encode_balance_transfer_script_function( destination,