From 57659005200ea51cc85b22f1cc43cb8be69e7e96 Mon Sep 17 00:00:00 2001 From: Furkan Ahmet Kara Date: Wed, 22 Oct 2025 10:39:15 +0300 Subject: [PATCH 1/3] fix view_chain_deploy command, add proper messages and implement the empty block check mechanism Signed-off-by: Furkan Ahmet Kara --- sh/views/view_chain_deploy.sh | 43 ++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/sh/views/view_chain_deploy.sh b/sh/views/view_chain_deploy.sh index aeb45c2..4f55dc5 100644 --- a/sh/views/view_chain_deploy.sh +++ b/sh/views/view_chain_deploy.sh @@ -3,24 +3,48 @@ source "$NCTL"/sh/utils/main.sh ####################################### -# Renders on-chain deploy information. +# Displays on-chain deploy information. # Arguments: -# Deploy hash. +# Deploy hash (optional). If not provided, lists all deploys in the latest block. +# If no deploys are found, prints a message. ####################################### function main() { - local DEPLOY_HASH=${1} + if [ -n "$DEPLOY_HASH" ]; then + # If a specific deploy hash is provided, show only that deploy + $(get_path_to_client) get-deploy \ + --node-address "$(get_node_address_rpc)" \ + "$DEPLOY_HASH" + else + # No deploy hash provided: list all deploys and transfers + JSON_OUTPUT=$($(get_path_to_client) list-deploys \ + --node-address "$(get_node_address_rpc)") - $(get_path_to_client) get-deploy \ - --node-address "$(get_node_address_rpc)" \ - "$DEPLOY_HASH" \ - | jq '.result' + # Combine all hashes + ALL_HASHES=$(echo "$JSON_OUTPUT" | jq -r '.deploy_hashes + .transfer_hashes | .[]?' ) + + if [ -z "$ALL_HASHES" ]; then + echo "No deploys or transfer hashes found in the current block." + return + fi + + # Loop through each hash and display its deploy info + for HASH in $ALL_HASHES; do + echo "===== Deploy: $HASH =====" + $(get_path_to_client) get-deploy \ + --node-address "$(get_node_address_rpc)" \ + "$HASH" + echo "" + done + fi } # ---------------------------------------------------------------- -# ENTRY POINT +# ARGUMENT PARSING # ---------------------------------------------------------------- +DEPLOY_HASH="" + for ARGUMENT in "$@" do KEY=$(echo "$ARGUMENT" | cut -f1 -d=) @@ -28,7 +52,10 @@ do case "$KEY" in deploy) DEPLOY_HASH=${VALUE} ;; *) + # Ignore other arguments + ;; esac done main "$DEPLOY_HASH" + From 236355e5752690bfdbfb08e6c53eb7fd8422c4c0 Mon Sep 17 00:00:00 2001 From: Furkan Ahmet Kara Date: Wed, 22 Oct 2025 10:53:04 +0300 Subject: [PATCH 2/3] edit comments of viev_chain_deploy.sh Signed-off-by: Furkan Ahmet Kara --- sh/views/view_chain_deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/views/view_chain_deploy.sh b/sh/views/view_chain_deploy.sh index 4f55dc5..32bc816 100644 --- a/sh/views/view_chain_deploy.sh +++ b/sh/views/view_chain_deploy.sh @@ -40,7 +40,7 @@ function main() } # ---------------------------------------------------------------- -# ARGUMENT PARSING +# ENTRY POINT # ---------------------------------------------------------------- DEPLOY_HASH="" From 24d60a9b4b9f783874dc4bbef575e9cf26167329 Mon Sep 17 00:00:00 2001 From: Furkan Ahmet Kara Date: Wed, 19 Nov 2025 22:36:39 +0300 Subject: [PATCH 3/3] remove the no-parameter case Signed-off-by: Furkan Ahmet Kara --- sh/views/view_chain_deploy.sh | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/sh/views/view_chain_deploy.sh b/sh/views/view_chain_deploy.sh index 32bc816..f3ea86b 100644 --- a/sh/views/view_chain_deploy.sh +++ b/sh/views/view_chain_deploy.sh @@ -5,8 +5,8 @@ source "$NCTL"/sh/utils/main.sh ####################################### # Displays on-chain deploy information. # Arguments: -# Deploy hash (optional). If not provided, lists all deploys in the latest block. -# If no deploys are found, prints a message. +# Deploy hash +# If no deploys are found or no deploy hash provided, prints a message. ####################################### function main() { @@ -16,26 +16,8 @@ function main() --node-address "$(get_node_address_rpc)" \ "$DEPLOY_HASH" else - # No deploy hash provided: list all deploys and transfers - JSON_OUTPUT=$($(get_path_to_client) list-deploys \ - --node-address "$(get_node_address_rpc)") - - # Combine all hashes - ALL_HASHES=$(echo "$JSON_OUTPUT" | jq -r '.deploy_hashes + .transfer_hashes | .[]?' ) - - if [ -z "$ALL_HASHES" ]; then - echo "No deploys or transfer hashes found in the current block." - return - fi - - # Loop through each hash and display its deploy info - for HASH in $ALL_HASHES; do - echo "===== Deploy: $HASH =====" - $(get_path_to_client) get-deploy \ - --node-address "$(get_node_address_rpc)" \ - "$HASH" - echo "" - done + # No deploy hash provided: + echo "no deploy hash provided, please provide a deploy hash to get the deploy information" fi }