#!/usr/bin/env bash # Prepare Chain 138 for chainlist.org (ethereum-lists/chains). # Prints PR steps and validates pr-workspace/chains/_data/chains/eip155-138.json. # See: https://github.com/ethereum-lists/chains set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" CHAIN_FILE="$PROJECT_ROOT/pr-workspace/chains/_data/chains/eip155-138.json" REPO_URL="https://github.com/ethereum-lists/chains" REPO_DATA_PATH="_data/chains" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "Chain 138 – submit to chainlist.org (ethereum-lists/chains)" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" if [ ! -f "$CHAIN_FILE" ]; then echo "❌ Chain file not found: $CHAIN_FILE" exit 1 fi # Validate JSON if command -v jq >/dev/null 2>&1; then if jq empty "$CHAIN_FILE" 2>/dev/null; then echo "✓ JSON valid: $CHAIN_FILE" echo " name: $(jq -r '.name' "$CHAIN_FILE")" echo " chainId: $(jq -r '.chainId' "$CHAIN_FILE")" echo " rpc count: $(jq -r '.rpc | length' "$CHAIN_FILE")" else echo "❌ Invalid JSON: $CHAIN_FILE" exit 1 fi else echo "⚠ jq not found; skipping JSON validation" fi echo "" echo "To add Chain 138 to chainlist.org:" echo "" echo " 1. Fork the repo: $REPO_URL" echo " 2. Clone your fork, then copy the chain file:" echo " cp $CHAIN_FILE /$REPO_DATA_PATH/eip155-138.json" echo " 3. Commit and push, then open a Pull Request to ethereum-lists/chains" echo " 4. PR title example: \"Add Defi Oracle Meta Mainnet (Chain ID 138)\"" echo "" echo "Chain list format: one file per chain, filename eip155-.json" echo "Docs: https://github.com/ethereum-lists/chains#adding-a-new-chain" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"