mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-12-03 04:13:57 +01:00
Implement fee inclusive transactions (#657)
* Add amount_includes_fee option in TX building * Add --amount_includes_fee CLI option * Implement send 'max' amount Co-authored-by: cliik <cliik@example.com>
This commit is contained in:
@@ -444,7 +444,11 @@ pub fn parse_account_args(account_args: &ArgMatches) -> Result<command::AccountA
|
||||
pub fn parse_send_args(args: &ArgMatches) -> Result<command::SendArgs, ParseError> {
|
||||
// amount
|
||||
let amount = parse_required(args, "amount")?;
|
||||
let amount = core::core::amount_from_hr_string(amount);
|
||||
let (amount, spend_max) = if amount.eq_ignore_ascii_case("max") {
|
||||
(Ok(0), true)
|
||||
} else {
|
||||
(core::core::amount_from_hr_string(amount), false)
|
||||
};
|
||||
let amount = match amount {
|
||||
Ok(a) => a,
|
||||
Err(e) => {
|
||||
@@ -455,6 +459,7 @@ pub fn parse_send_args(args: &ArgMatches) -> Result<command::SendArgs, ParseErro
|
||||
return Err(ParseError::ArgumentError(msg));
|
||||
}
|
||||
};
|
||||
let amount_includes_fee = args.is_present("amount_includes_fee") || spend_max;
|
||||
|
||||
// minimum_confirmations
|
||||
let min_c = parse_required(args, "minimum_confirmations")?;
|
||||
@@ -524,6 +529,8 @@ pub fn parse_send_args(args: &ArgMatches) -> Result<command::SendArgs, ParseErro
|
||||
|
||||
Ok(command::SendArgs {
|
||||
amount: amount,
|
||||
amount_includes_fee: amount_includes_fee,
|
||||
use_max_amount: spend_max,
|
||||
minimum_confirmations: min_c,
|
||||
selection_strategy: selection_strategy.to_owned(),
|
||||
estimate_selection_strategies,
|
||||
|
||||
Reference in New Issue
Block a user