fix
This commit is contained in:
@@ -1,6 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if more than two arguments are provided
|
||||
BASEPATH="$(dirname "$0")"
|
||||
json_file="${BASEPATH}/reference-rpc-endpoint.json"
|
||||
|
||||
# Check if JSON file exists
|
||||
if [ ! -f "$json_file" ]; then
|
||||
# Fallback for legacy path
|
||||
json_file="/root/rpc/reference-rpc-endpoint.json"
|
||||
fi
|
||||
if [ ! -f "$json_file" ]; then
|
||||
echo "JSON file not found: $json_file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Look up by rollup_version (for Aztec: version from result.header.globalVariables.version)
|
||||
if [ "$1" = "--rollup-version" ]; then
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Usage: $0 --rollup-version <version_decimal>"
|
||||
exit 1
|
||||
fi
|
||||
version="$2"
|
||||
urls=$(jq -r --arg v "$version" '.[] | select(.rollup_version == $v) | .urls[]' "$json_file" 2>/dev/null | tr '\n' ' ')
|
||||
if [ -z "$urls" ]; then
|
||||
echo "Rollup version not found: $version"
|
||||
exit 1
|
||||
fi
|
||||
echo "$urls"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Look up by chain id
|
||||
if [ $# -gt 2 ]; then
|
||||
echo "Usage: $0 <chainid> [<index>]"
|
||||
exit 1
|
||||
@@ -14,14 +43,6 @@ if [[ "$id" == "0x"* ]]; then
|
||||
id=$(printf "%d" "$id")
|
||||
fi
|
||||
|
||||
json_file="/root/rpc/reference-rpc-endpoint.json"
|
||||
|
||||
# Check if JSON file exists
|
||||
if [ ! -f "$json_file" ]; then
|
||||
echo "JSON file not found: $json_file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find the object with matching id
|
||||
object=$(jq --arg id "$id" '.[] | select(.id == ($id | tonumber))' "$json_file")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user