From 4f1b322eedba94e72ce277324ca1e54e9dda3feb Mon Sep 17 00:00:00 2001 From: Pascal Marco Caversaccio Date: Thu, 6 Mar 2025 15:15:50 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Amend=20Printed=20Method?= =?UTF-8?q?=20and=20Parameters=20for=20Non-Decoded=20Case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pascal Marco Caversaccio --- safe_hashes.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/safe_hashes.sh b/safe_hashes.sh index 7ef1030..c53be23 100755 --- a/safe_hashes.sh +++ b/safe_hashes.sh @@ -291,11 +291,15 @@ print_hash_info() { # Utility function to print the ABI-decoded transaction data. print_decoded_data() { - local data_decoded=$1 + local data=$1 + local data_decoded=$2 - if [[ "$data_decoded" == "0x" ]]; then + if [[ "$data" == "0x" && "$data_decoded" == "0x" ]]; then print_field "Method" "0x (ETH Transfer)" print_field "Parameters" "[]" + elif [[ "$data" != "0x" && "$data_decoded" == "0x" ]]; then + print_field "Method" "Unknown" + print_field "Parameters" "Unknown" else local method=$(echo "$data_decoded" | jq -r ".method") local parameters=$(echo "$data_decoded" | jq -r ".parameters") @@ -438,7 +442,7 @@ calculate_hashes() { # Print the retrieved transaction data. print_transaction_data "$address" "$to" "$value" "$data" "$message" # Print the ABI-decoded transaction data. - print_decoded_data "$data_decoded" + print_decoded_data "$data" "$data_decoded" # Print the results with the same formatting for "Domain hash" and "Message hash" as a Ledger hardware device. print_hash_info "$domain_hash" "$message_hash" "$safe_tx_hash" }