From 639159e40568a7ce96f98ec5398eb42604ef3f28 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 24 Jul 2024 15:17:59 +0530 Subject: [PATCH] Fetch account holdings in a separate script --- .../scripts/fetch-account-holdings.sh | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 stack-orchestrator/stacks/fixturenet-laconicd/scripts/fetch-account-holdings.sh diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/fetch-account-holdings.sh b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/fetch-account-holdings.sh new file mode 100755 index 0000000..6c6069e --- /dev/null +++ b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/fetch-account-holdings.sh @@ -0,0 +1,25 @@ + +#!/bin/bash + +# Exit on error +set -e +set -u + +# Note: Needs to be run in the go-nitro repository +# Example usage: +# In go-nitro +# /home/user/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/scripts/fetch-account-holdings.sh eth-account-holdings.json + +# Check if output file is provided +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +OUTPUT_FILE=$1 + +# Run the nitro-rpc-client command and process the output with jq +laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge" | jq -s '[.[] | {nitro_address: .Balance.Them, balance: .Balance.TheirBalance}]' | > "$OUTPUT_FILE" +npm exec -c "nitro-rpc-client get-all-ledger-channels -p 4006" | jq -s '[.[] | {ethereum_address: .Balance.Them, balance: .Balance.TheirBalance}]' > "$OUTPUT_FILE" + +echo "Ethereum account holdings exported to $OUTPUT_FILE"