From f731a416b80048616c3ff48fd3c521aec348f00f Mon Sep 17 00:00:00 2001 From: "roman.padenkov" <roman.padenkov@demlabs.net> Date: Fri, 4 Oct 2024 19:04:34 +0700 Subject: [PATCH] ... --- modules/common/dap_chain_datum.c | 4 ++-- modules/net/dap_chain_node_cli_cmd_tx.c | 16 +++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/modules/common/dap_chain_datum.c b/modules/common/dap_chain_datum.c index 14e8c79d09..a47665d22b 100644 --- a/modules/common/dap_chain_datum.c +++ b/modules/common/dap_chain_datum.c @@ -238,8 +238,8 @@ bool dap_chain_datum_dump_tx_json(dap_chain_datum_tx_t *a_datum, json_object_object_add(json_obj_out, "first transaction", json_object_new_string("emit")): json_object_object_add(json_obj_out, "first transaction", json_object_new_string("")); json_object_object_add(json_obj_out, "hash", json_object_new_string(l_hash_str)); - json_object_object_add(json_obj_out, "TS Created", json_object_new_string(l_tmp_buf)); - json_object_object_add(json_obj_out, "Token ticker", a_ticker ? json_object_new_string(a_ticker) : json_object_new_string("")); + json_object_object_add(json_obj_out, "tx created", json_object_new_string(l_tmp_buf)); + json_object_object_add(json_obj_out, "token ticker", a_ticker ? json_object_new_string(a_ticker) : json_object_new_string("")); //json_object_array_add(json_arr_items, json_obj_tx); dap_hash_fast_t l_hash_tmp = { }; diff --git a/modules/net/dap_chain_node_cli_cmd_tx.c b/modules/net/dap_chain_node_cli_cmd_tx.c index e95c2b8467..06a62b393c 100644 --- a/modules/net/dap_chain_node_cli_cmd_tx.c +++ b/modules/net/dap_chain_node_cli_cmd_tx.c @@ -163,11 +163,9 @@ json_object * dap_db_tx_history_to_json(dap_chain_hash_fast_t* a_tx_hash, ? dap_enc_base58_encode_hash_to_str_static(a_tx_hash) : dap_chain_hash_fast_to_str_static(a_tx_hash); json_object_object_add(json_obj_datum, "hash", json_object_new_string(l_hash_str)); - - json_object_object_add(json_obj_datum, "token_ticker", l_tx_token_ticker ? json_object_new_string(l_tx_token_ticker) - : json_object_new_null()); - json_object_object_add(json_obj_datum, "token_description", l_tx_token_description ? json_object_new_string(l_tx_token_description) - : json_object_new_null()); + + if (l_tx_token_description) + json_object_object_add(json_obj_datum, "token_description", json_object_new_string(l_tx_token_description)); json_object_object_add(json_obj_datum, "ret_code", json_object_new_int(l_ret_code)); json_object_object_add(json_obj_datum, "ret_code_str", json_object_new_string(dap_ledger_check_error_str(l_ret_code))); @@ -189,15 +187,11 @@ json_object * dap_db_tx_history_to_json(dap_chain_hash_fast_t* a_tx_hash, //json_object_object_add(json_obj_datum, "service", json_object_new_string("UNKNOWN")); json_object_object_add(json_obj_datum, "action", json_object_new_string("UNKNOWN")); } - - char l_time_str[DAP_TIME_STR_SIZE]; - dap_time_to_str_rfc822(l_time_str, DAP_TIME_STR_SIZE, l_tx->header.ts_created); /* Convert ts to "Sat May 17 01:17:08 2014" */ - json_object *l_obj_ts_created = json_object_new_string(l_time_str); - json_object_object_add(json_obj_datum, "tx_created", l_obj_ts_created); if(!brief_out) { - dap_chain_datum_dump_tx_json(l_tx,NULL,json_obj_datum,a_hash_out_type,a_tx_hash,a_chain->net_id); + dap_chain_datum_dump_tx_json(l_tx,l_tx_token_ticker ? l_tx_token_ticker : NULL, + json_obj_datum,a_hash_out_type,a_tx_hash,a_chain->net_id); } return json_obj_datum; -- GitLab