diff --git a/modules/net/dap_chain_node_cli.c b/modules/net/dap_chain_node_cli.c index 95620a0b29061ed7bdfdb3839f3a806ae19f4baa..d5e5497cf4b1cc852b988a49dd6235ebaa9e4a12 100644 --- a/modules/net/dap_chain_node_cli.c +++ b/modules/net/dap_chain_node_cli.c @@ -286,7 +286,8 @@ int dap_chain_node_cli_init(dap_config_t * g_config) // Transaction history dap_cli_server_cmd_add("tx_history", com_tx_history, "Transaction history (for address or by hash)", "tx_history {-addr <addr> | -w <wallet_name> | -tx <tx_hash>} [-net <net_name>] [-chain <chain_name>] [-limit] [-offset]\n" - "tx_history -all -net <net_name> [-chain <chain_name>] [-limit] [-offset]\n"); + "tx_history -all -net <net_name> [-chain <chain_name>] [-limit] [-offset]\n" + "tx_history -count -net <net_name>\n"); // Ledger info dap_cli_server_cmd_add("ledger", com_ledger, "Ledger information", diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c index 42b92f8642adfc10cdbbefc3cd766aeff290df9f..d72b69fa4f52970d382df9f87e0dbeef0c676646 100644 --- a/modules/net/dap_chain_node_cli_cmd.c +++ b/modules/net/dap_chain_node_cli_cmd.c @@ -7253,8 +7253,9 @@ int com_tx_history(int a_argc, char ** a_argv, void **a_str_reply) bool l_brief = (dap_cli_server_cmd_check_option(a_argv, arg_index, a_argc, "-brief") != -1) ? true : false; bool l_is_tx_all = dap_cli_server_cmd_find_option_val(a_argv, arg_index, a_argc, "-all", NULL); + bool l_is_tx_count = dap_cli_server_cmd_find_option_val(a_argv, arg_index, a_argc, "-count", NULL); - if (!l_addr_base58 && !l_wallet_name && !l_tx_hash_str && !l_is_tx_all) { + if (!l_addr_base58 && !l_wallet_name && !l_tx_hash_str && !l_is_tx_all && !l_is_tx_count) { dap_json_rpc_error_add(DAP_CHAIN_NODE_CLI_COM_TX_HISTORY_PARAM_ERR, "tx_history requires parameter '-addr' or '-w' or '-tx'"); return DAP_CHAIN_NODE_CLI_COM_TX_HISTORY_PARAM_ERR; @@ -7393,6 +7394,11 @@ int com_tx_history(int a_argc, char ** a_argv, void **a_str_reply) json_object_array_add(*json_arr_reply, json_arr_history_all); json_object_array_add(*json_arr_reply, json_obj_summary); return DAP_CHAIN_NODE_CLI_COM_TX_HISTORY_OK; + } else if (l_is_tx_count) { + json_object * json_count_obj= json_object_new_object(); + json_object_object_add(json_count_obj, "Number of transaction", json_object_new_uint64(l_chain->callback_count_tx(l_chain))); + json_object_array_add(*json_arr_reply, json_count_obj); + return DAP_CHAIN_NODE_CLI_COM_TX_HISTORY_OK; } if (json_obj_out) { diff --git a/modules/net/dap_chain_node_cli_cmd_tx.c b/modules/net/dap_chain_node_cli_cmd_tx.c index 09a098ebd29497710da77f2f0bbb67c549c9b3bf..1cf0ce1536edac7e4357f6e0f5a80e3e8e490789 100644 --- a/modules/net/dap_chain_node_cli_cmd_tx.c +++ b/modules/net/dap_chain_node_cli_cmd_tx.c @@ -342,7 +342,7 @@ json_object* dap_db_history_addr(dap_chain_addr_t *a_addr, dap_chain_t *a_chain, bool look_for_unknown_service = (a_srv && strcmp(a_srv,"unknown") == 0); size_t l_arr_start = 0; size_t l_arr_end = 0; - s_set_offset_limit_json(json_obj_datum, &l_arr_start, &l_arr_end, a_limit, a_offset, a_chain->callback_count_atom(a_chain)); + s_set_offset_limit_json(json_obj_datum, &l_arr_start, &l_arr_end, a_limit, a_offset, a_chain->callback_count_tx(a_chain)); size_t i_tmp = 0; size_t @@ -750,7 +750,7 @@ json_object *dap_db_history_tx_all(dap_chain_t *a_chain, dap_chain_net_t *a_net, json_object * json_tx_history = NULL; size_t l_arr_start = 0; size_t l_arr_end = 0; - s_set_offset_limit_json(json_arr_out, &l_arr_start, &l_arr_end, a_limit, a_offset, a_chain->callback_count_atom(a_chain)); + s_set_offset_limit_json(json_arr_out, &l_arr_start, &l_arr_end, a_limit, a_offset, a_chain->callback_count_tx(a_chain)); bool look_for_unknown_service = (a_srv && strcmp(a_srv,"unknown") == 0); if(a_head)