fix
This commit is contained in:
@@ -1541,6 +1541,7 @@
|
||||
]
|
||||
},
|
||||
"aztec-testnet": {
|
||||
"rollup_version": "2500495677",
|
||||
"urls": [
|
||||
"https://rpc.testnet.aztec-labs.com"
|
||||
]
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -51,22 +51,24 @@ for path in $pathlist; do
|
||||
ref="$2"
|
||||
else
|
||||
if $is_aztec; then
|
||||
# Aztec: resolve ref by path (mainnet/testnet/devnet)
|
||||
case "$path" in
|
||||
*aztec-mainnet*)
|
||||
ref=$($BASEPATH/reference-rpc-endpoint.sh 418)
|
||||
;;
|
||||
*aztec-testnet*)
|
||||
ref=$($BASEPATH/reference-rpc-endpoint.sh 11124)
|
||||
;;
|
||||
*aztec-devnet*)
|
||||
ref=$($BASEPATH/reference-rpc-endpoint.sh 11125)
|
||||
;;
|
||||
*)
|
||||
echo "error: unknown aztec path $path"
|
||||
# Aztec: resolve ref by rollup_version from node (result.header.globalVariables.version)
|
||||
aztec_block_response=$(curl -L --ipv4 -m 1 -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"node_getBlock","params":["latest"],"id":1}' $RPC_URL)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "error: failed to get Aztec block from $RPC_URL"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
version_hex=$(echo "$aztec_block_response" | jq -r '.result.header.globalVariables.version' 2>/dev/null)
|
||||
if [ -z "$version_hex" ] || [ "$version_hex" = "null" ]; then
|
||||
echo "error: could not parse rollup version from Aztec node"
|
||||
exit 1
|
||||
fi
|
||||
# Convert hex (e.g. 0x950a893d) to decimal for JSON lookup
|
||||
version_decimal=$((16#${version_hex#0x}))
|
||||
ref=$($BASEPATH/reference-rpc-endpoint.sh --rollup-version "$version_decimal")
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "error: no reference endpoint for Aztec rollup_version $version_decimal"
|
||||
exit 1
|
||||
fi
|
||||
elif $is_starknet; then
|
||||
# Starknet chain ID detection
|
||||
chain_id_response=$(curl -L --ipv4 -m 1 -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"starknet_chainId","params":[],"id":1}' $RPC_URL)
|
||||
|
||||
Reference in New Issue
Block a user