Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sendmore command add a parameter --exclude. #379

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/metaverse/explorer/extensions/commands/send.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ class send: public send_command
(
"exclude,e",
value<colon_delimited2_item<uint64_t, uint64_t>>(&option_.exclude),
"Exclude utxo whose value is between this range [begin:end)."
"Exclude utxo whose value is between this range [begin:end) the "
"limit of which is split by a colon."
)
(
"fee,f",
Expand Down
7 changes: 7 additions & 0 deletions include/metaverse/explorer/extensions/commands/sendmore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ class sendmore: public send_command
value<std::string>(&option_.memo)->default_value(""),
"The memo to descript transaction"
)
(
"exclude,e",
value<colon_delimited2_item<uint64_t, uint64_t>>(&option_.exclude),
"Exclude utxo whose value is between this range [begin:end) the "
"limit of which is split by a colon."
)
(
"fee,f",
value<uint64_t>(&option_.fee)->default_value(10000),
Expand Down Expand Up @@ -126,6 +132,7 @@ class sendmore: public send_command
std::string from;
std::string change;
std::string memo;
colon_delimited2_item<uint64_t, uint64_t> exclude = { 0, 0 };
} option_;

};
Expand Down
15 changes: 11 additions & 4 deletions src/lib/explorer/extensions/commands/sendmore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ console_result sendmore::invoke (Json::Value& jv_output,
from_did = option_.from;
}

if (!option_.exclude.is_valid()) {
throw argument_legality_exception("invalid exclude option! "
+ option_.exclude.encode_colon_delimited());
}

// receiver
std::vector<receiver_record> receiver;

Expand Down Expand Up @@ -83,10 +88,12 @@ console_result sendmore::invoke (Json::Value& jv_output,
chain::attachment(0, 0, chain::blockchain_message(option_.memo))});
}

auto send_helper = sending_etp(*this, blockchain,
std::move(auth_.name), std::move(auth_.auth),
std::move(from_address), std::move(receiver),
std::move(change_address), option_.fee);
auto send_helper = sending_etp(
*this, blockchain,
std::move(auth_.name), std::move(auth_.auth),
std::move(from_address), std::move(receiver),
std::move(change_address), option_.fee, 0,
std::make_pair(option_.exclude.first(), option_.exclude.second()));

send_helper.exec();

Expand Down