- 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
71 lines
2.3 KiB
Bash
Executable File
71 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Deploy XDC-Zero Endpoint (+ EthereumTrieDB + MerklePatricia) to Chain 138 via Hardhat.
|
|
# Requires: XDC-Zero clone with endpoint/hardhat.config.js network "chain138", yarn, PRIVATE_KEY.
|
|
#
|
|
# Usage:
|
|
# XDC_ZERO_REPO=/path/to/XDC-Zero bash scripts/xdc-zero/deploy-endpoint-chain138.sh [--dry-run]
|
|
#
|
|
# RPC: RPC_URL_138 or endpoint/network.config.json "chain138" (repo dotenv loaded from proxmox root).
|
|
|
|
set -eo 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"
|
|
|
|
DRY_RUN=false
|
|
MANUAL=false
|
|
for a in "$@"; do
|
|
[[ "$a" == "--dry-run" ]] && DRY_RUN=true
|
|
[[ "$a" == "--manual" ]] && MANUAL=true
|
|
done
|
|
|
|
REPO="${XDC_ZERO_REPO:-${HOME}/projects/XDC-Zero}"
|
|
EP="${REPO}/endpoint"
|
|
if [[ ! -d "$EP" ]]; then
|
|
echo "ERROR: XDC-Zero endpoint not found: $EP — set XDC_ZERO_REPO" >&2
|
|
exit 1
|
|
fi
|
|
if [[ ! -f "${EP}/hardhat.config.js" ]]; then
|
|
echo "ERROR: missing ${EP}/hardhat.config.js" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "${PRIVATE_KEY:-}" ]]; then
|
|
echo "ERROR: PRIVATE_KEY not set (smom-dbis-138/.env or root .env after load-project-env)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if $DRY_RUN; then
|
|
if $MANUAL; then
|
|
echo "DRY-RUN: cd $EP && node scripts/endpointdeploy-manual.js"
|
|
elif command -v yarn >/dev/null 2>&1; then
|
|
echo "DRY-RUN: cd $EP && yarn hardhat run scripts/endpointdeploy.js --network chain138"
|
|
else
|
|
echo "DRY-RUN: cd $EP && npx hardhat run scripts/endpointdeploy.js --network chain138"
|
|
fi
|
|
echo "RPC_URL_138=${RPC_URL_138:-<from network.config.json chain138>}"
|
|
exit 0
|
|
fi
|
|
|
|
cd "$EP"
|
|
if [[ ! -d node_modules ]]; then
|
|
if command -v yarn >/dev/null 2>&1; then
|
|
echo "Installing endpoint dependencies (yarn)..."
|
|
yarn --silent
|
|
else
|
|
echo "Installing endpoint dependencies (npm)..."
|
|
npm install --silent
|
|
fi
|
|
fi
|
|
echo "Deploying Endpoint stack to chain138 (if this hangs, see CHAIN138_XDC_ZERO_DEPLOYMENT_TROUBLESHOOTING.md)..."
|
|
if $MANUAL; then
|
|
node scripts/endpointdeploy-manual.js
|
|
elif command -v yarn >/dev/null 2>&1; then
|
|
yarn hardhat run scripts/endpointdeploy.js --network chain138
|
|
else
|
|
npx hardhat run scripts/endpointdeploy.js --network chain138
|
|
fi
|
|
echo "Done. Record MerklePatricia + Endpoint addresses; update fragments / merge endpointconfig."
|