From c7cf10fa33dece6735837ff9b7ddc290e1ab85ab Mon Sep 17 00:00:00 2001 From: Igor Egorov Date: Fri, 7 Sep 2018 19:39:27 +0300 Subject: [PATCH 1/3] Remove unused param from iroha-cli:AddAssetQuantity:AccountId Signed-off-by: Igor Egorov --- iroha-cli/interactive/impl/interactive_transaction_cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iroha-cli/interactive/impl/interactive_transaction_cli.cpp b/iroha-cli/interactive/impl/interactive_transaction_cli.cpp index 8ba6be8104..ae0ee58e10 100644 --- a/iroha-cli/interactive/impl/interactive_transaction_cli.cpp +++ b/iroha-cli/interactive/impl/interactive_transaction_cli.cpp @@ -86,7 +86,7 @@ namespace iroha_cli { const auto can_roles = "Can create/append roles"; command_params_map_ = { - {ADD_ASSET_QTY, makeParamsDescription({acc_id, ast_id, amount_str})}, + {ADD_ASSET_QTY, makeParamsDescription({ast_id, amount_str})}, {ADD_PEER, makeParamsDescription({peer_id, pub_key})}, {ADD_SIGN, makeParamsDescription({acc_id, pub_key})}, {CREATE_ACC, makeParamsDescription({acc_name, dom_id, pub_key})}, From 0b41edbffd00f14af9691bfb3df01929a432d13c Mon Sep 17 00:00:00 2001 From: Igor Egorov Date: Fri, 7 Sep 2018 19:39:44 +0300 Subject: [PATCH 2/3] Update license header Signed-off-by: Igor Egorov --- .../impl/interactive_transaction_cli.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/iroha-cli/interactive/impl/interactive_transaction_cli.cpp b/iroha-cli/interactive/impl/interactive_transaction_cli.cpp index ae0ee58e10..7467b5e95d 100644 --- a/iroha-cli/interactive/impl/interactive_transaction_cli.cpp +++ b/iroha-cli/interactive/impl/interactive_transaction_cli.cpp @@ -1,18 +1,6 @@ /** - * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. - * http://soramitsu.co.jp - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright Soramitsu Co., Ltd. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 */ #include "interactive/interactive_transaction_cli.hpp" From 1ef81b5c24e4d46e7c3ef98fef2ce8cc7efdaa9d Mon Sep 17 00:00:00 2001 From: Igor Egorov Date: Tue, 18 Sep 2018 12:11:35 +0300 Subject: [PATCH 3/3] Add support of SubtractAssetQty in Iroha-cli Signed-off-by: Igor Egorov --- .../impl/interactive_transaction_cli.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/iroha-cli/interactive/impl/interactive_transaction_cli.cpp b/iroha-cli/interactive/impl/interactive_transaction_cli.cpp index 7467b5e95d..9a2db5796c 100644 --- a/iroha-cli/interactive/impl/interactive_transaction_cli.cpp +++ b/iroha-cli/interactive/impl/interactive_transaction_cli.cpp @@ -42,7 +42,7 @@ namespace iroha_cli { {CREATE_ASSET, "Create Asset"}, {REMOVE_SIGN, "Remove Signatory"}, {SET_QUO, "Set Account Quorum"}, - {SUB_ASSET_QTY, "Subtract Assets Quantity from Account"}, + {SUB_ASSET_QTY, "Subtract Assets Quantity"}, {TRAN_ASSET, "Transfer Assets"}, {CREATE_ROLE, "Create new role"}, {APPEND_ROLE, "Add new role to account"}, @@ -56,7 +56,9 @@ namespace iroha_cli { const auto acc_id = "Account Id"; const auto ast_id = "Asset Id"; const auto dom_id = "Domain Id"; - const auto amount_str = "Amount to to add, e.g 123.456"; + const auto add_amount_str = "Amount to add, e.g 123.456"; + const auto sub_amount_str = "Amount to subtract, e.g 123.456"; + const auto transfer_amount_str = "Amount to transfer, e.g 123.456"; const auto peer_id = "Full address of a peer"; const auto pub_key = "Public Key"; const auto acc_name = "Account Name"; @@ -74,7 +76,7 @@ namespace iroha_cli { const auto can_roles = "Can create/append roles"; command_params_map_ = { - {ADD_ASSET_QTY, makeParamsDescription({ast_id, amount_str})}, + {ADD_ASSET_QTY, makeParamsDescription({ast_id, add_amount_str})}, {ADD_PEER, makeParamsDescription({peer_id, pub_key})}, {ADD_SIGN, makeParamsDescription({acc_id, pub_key})}, {CREATE_ACC, makeParamsDescription({acc_name, dom_id, pub_key})}, @@ -84,12 +86,12 @@ namespace iroha_cli { makeParamsDescription({ast_name, dom_id, ast_precision})}, {REMOVE_SIGN, makeParamsDescription({acc_id, pub_key})}, {SET_QUO, makeParamsDescription({acc_id, quorum})}, - {SUB_ASSET_QTY, makeParamsDescription({})}, + {SUB_ASSET_QTY, makeParamsDescription({ast_id, sub_amount_str})}, {TRAN_ASSET, makeParamsDescription({std::string("Src") + acc_id, std::string("Dest") + acc_id, ast_id, - amount_str})}, + transfer_amount_str})}, {CREATE_ROLE, makeParamsDescription({role, can_read_self, @@ -394,9 +396,9 @@ namespace iroha_cli { std::shared_ptr InteractiveTransactionCli::parseSubtractAssetQuantity( std::vector params) { - // TODO 13/09/17 grimadas: implement command IR-498 - std::cout << "Not implemented" << std::endl; - return nullptr; + auto asset_id = params[0]; + auto amount = params[1]; + return generator_.generateSubtractAssetQuantity(asset_id, amount); } std::shared_ptr