- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
59 lines
1.6 KiB
Bash
Executable File
59 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run XDC-Zero registerchain.js on xdcparentnet and chain138 (owner txs).
|
|
# Prerequisites: merged endpointconfig.json, PRIVATE_KEY is Endpoint owner, yarn deps installed.
|
|
#
|
|
# Usage:
|
|
# source scripts/lib/load-project-env.sh
|
|
# XDC_ZERO_ENDPOINT_DIR=/path/to/XDC-Zero/endpoint bash scripts/xdc-zero/run-registerchain-both.sh [--dry-run]
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
# shellcheck source=/dev/null
|
|
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
|
|
|
|
EP="${XDC_ZERO_ENDPOINT_DIR:-${HOME}/projects/XDC-Zero/endpoint}"
|
|
DRY=false
|
|
[[ "${1:-}" == "--dry-run" ]] && DRY=true
|
|
|
|
[[ -f "${EP}/endpointconfig.json" ]] || {
|
|
echo "ERROR: missing ${EP}/endpointconfig.json" >&2
|
|
exit 1
|
|
}
|
|
[[ -f "${EP}/hardhat.config.js" ]] || {
|
|
echo "ERROR: missing Hardhat project at $EP" >&2
|
|
exit 1
|
|
}
|
|
|
|
cd "$EP"
|
|
if [[ ! -d node_modules ]]; then
|
|
if command -v yarn >/dev/null 2>&1; then
|
|
yarn install
|
|
else
|
|
npm install
|
|
fi
|
|
fi
|
|
|
|
run() {
|
|
local net="$1"
|
|
if $DRY; then
|
|
if command -v yarn >/dev/null 2>&1; then
|
|
echo "DRY-RUN: yarn hardhat run scripts/registerchain.js --network $net"
|
|
else
|
|
echo "DRY-RUN: npx hardhat run scripts/registerchain.js --network $net"
|
|
fi
|
|
return 0
|
|
fi
|
|
if command -v yarn >/dev/null 2>&1; then
|
|
yarn hardhat run scripts/registerchain.js --network "$net"
|
|
else
|
|
npx hardhat run scripts/registerchain.js --network "$net"
|
|
fi
|
|
}
|
|
|
|
# Parent first or 138 first — both must succeed for bilateral registration
|
|
run xdcparentnet
|
|
run chain138
|
|
echo "Done. Next: registerapplications.js on both networks if apps are configured."
|