Run nitro-rpc-client command in the bridge-deployment
This commit is contained in:
parent
20f6d163d2
commit
03f4884018
@ -2,17 +2,16 @@
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
# Prerequisite: nitro-rpc-client package installed globally
|
||||
# https://github.com/cerc-io/go-nitro/blob/main/packages/nitro-rpc-client/readme.md#global-install
|
||||
set -u
|
||||
|
||||
# Check args
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <stage0-deployment-dir-absolute>"
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 <bridge-deployment-dir-absolute> <stage0-deployment-dir-absolute>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STAGE0_DEPLOYMENT_DIR="$1"
|
||||
BRIDGE_DEPLOYMENT_DIR="$1"
|
||||
STAGE0_DEPLOYMENT_DIR="$2"
|
||||
STAGE1_GENESIS_DIR=stage1-genesis
|
||||
|
||||
# Create a temporary target directory
|
||||
@ -22,11 +21,13 @@ mkdir -p $STAGE1_GENESIS_DIR
|
||||
|
||||
# Fetch ETH account holdings from the bridge node
|
||||
|
||||
# Trust locally-trusted development certificates created by mkcert
|
||||
export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"
|
||||
|
||||
# Run the nitro-rpc-client command and process the output with jq
|
||||
eth_account_holdings=$(nitro-rpc-client get-all-l2-channels -p 4006 | jq -s '[.[] | {nitro_address: .Balance.Them, balance: .Balance.TheirBalance}]')
|
||||
cd $BRIDGE_DEPLOYMENT_DIR
|
||||
|
||||
eth_account_holdings=$(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}]')
|
||||
|
||||
# Change back to the original directory
|
||||
cd -
|
||||
|
||||
echo "Fetched Ethereum account holdings"
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
set -u
|
||||
|
||||
# Note: Needs to be run in a docker container with image cerc/laconicd:local
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user