chore: sync submodule state (parent ref update)
Made-with: Cursor
This commit is contained in:
@@ -1,41 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Verify All RPC Endpoints
|
||||
# This script tests connectivity to all configured RPC endpoints
|
||||
#!/usr/bin/env bash
|
||||
# Verify All RPC Endpoints — tests connectivity to Mainnet, Chain 138, and all configured chain RPCs.
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
echo "=== RPC Endpoint Verification ==="
|
||||
echo ""
|
||||
|
||||
# Load environment variables
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | grep -v '^$' | xargs)
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
|
||||
# Use Infura with Basic Auth when INFURA_PROJECT_SECRET is set (fixes "error sending request" from Infura)
|
||||
[ -f "${PROJECT_ROOT}/scripts/lib/infura.sh" ] && source "${PROJECT_ROOT}/scripts/lib/infura.sh"
|
||||
|
||||
if ! command -v cast &> /dev/null; then
|
||||
echo "Error: cast command not found. Install foundry to verify RPC endpoints."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to test RPC
|
||||
# Function to test RPC (uses Infura Basic Auth URL when INFURA_PROJECT_SECRET is set)
|
||||
test_rpc() {
|
||||
local name=$1
|
||||
local url=$2
|
||||
[ -n "$url" ] && type ensure_infura_rpc_url &>/dev/null && url=$(ensure_infura_rpc_url "$url")
|
||||
|
||||
if [ -z "$url" ] || [ "$url" == "http://chain138.example.com:8545" ] || [[ "$url" == *"YOUR_PROJECT_ID"* ]]; then
|
||||
if [ -z "$url" ] || [ "$url" == "http://chain138.example.com:8545" ] || [[ "$url" == *"YOUR_PROJECT_ID"* ]] || [[ "$url" == *"<"* ]]; then
|
||||
echo "○ $name: Not configured"
|
||||
return
|
||||
fi
|
||||
|
||||
echo -n "Testing $name... "
|
||||
BLOCK=$(cast block-number --rpc-url "$url" 2>&1)
|
||||
|
||||
if [ $? -eq 0 ] && [[ "$BLOCK" =~ ^[0-9]+$ ]]; then
|
||||
BLOCK=$(cast block-number --rpc-url "$url" 2>&1) || true
|
||||
if [[ "$BLOCK" =~ ^[0-9]+$ ]]; then
|
||||
echo "✓ Connected (block: $BLOCK)"
|
||||
else
|
||||
echo "✗ Failed: $BLOCK"
|
||||
echo "✗ Failed (${BLOCK:0:80})"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
echo "--- Required RPC Endpoints ---"
|
||||
@@ -43,7 +50,7 @@ test_rpc "Ethereum Mainnet" "$ETHEREUM_MAINNET_RPC"
|
||||
test_rpc "ChainID 138" "$RPC_URL_138"
|
||||
|
||||
echo ""
|
||||
echo "--- Additional Network RPC Endpoints ---"
|
||||
echo "--- Additional Network RPC Endpoints (Infura when set) ---"
|
||||
test_rpc "Ethereum Sepolia" "$ETHEREUM_SEPOLIA_RPC"
|
||||
test_rpc "Polygon Mainnet" "$POLYGON_MAINNET_RPC"
|
||||
test_rpc "Polygon Amoy" "$POLYGON_AMOY_RPC"
|
||||
@@ -51,6 +58,19 @@ test_rpc "Base Mainnet" "$BASE_MAINNET_RPC"
|
||||
test_rpc "Base Sepolia" "$BASE_SEPOLIA_RPC"
|
||||
test_rpc "Optimism Mainnet" "$OPTIMISM_MAINNET_RPC"
|
||||
test_rpc "Optimism Sepolia" "$OPTIMISM_SEPOLIA_RPC"
|
||||
test_rpc "Arbitrum Mainnet" "$ARBITRUM_MAINNET_RPC"
|
||||
test_rpc "Arbitrum Sepolia" "$ARBITRUM_SEPOLIA_RPC"
|
||||
test_rpc "Avalanche Mainnet" "$AVALANCHE_MAINNET_RPC"
|
||||
test_rpc "Avalanche Fuji" "$AVALANCHE_FUJI_RPC"
|
||||
test_rpc "BSC Mainnet" "$BSC_MAINNET_RPC"
|
||||
test_rpc "Celo Mainnet" "$CELO_MAINNET_RPC"
|
||||
test_rpc "Linea Mainnet" "$LINEA_MAINNET_RPC"
|
||||
|
||||
echo ""
|
||||
echo "--- Other chain RPCs (aliases / public fallbacks) ---"
|
||||
test_rpc "AVALANCHE_RPC_URL" "${AVALANCHE_RPC_URL:-}"
|
||||
test_rpc "ARBITRUM_RPC" "${ARBITRUM_MAINNET_RPC:-$ARBITRUM_RPC}"
|
||||
test_rpc "Cronos" "$CRONOS_RPC_URL"
|
||||
|
||||
echo ""
|
||||
echo "=== Verification Complete ==="
|
||||
|
||||
Reference in New Issue
Block a user