chore(scripts): use load_explorer_runtime_env + address-inventory helper

Align remaining shell scripts with shared env loading (no direct .env source).

Made-with: Cursor
This commit is contained in:
defiQUG
2026-03-27 22:10:38 -07:00
parent ed0af8aaa0
commit 292a5eca0f
28 changed files with 130 additions and 246 deletions

View File

@@ -6,6 +6,7 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "$PROJECT_ROOT/scripts/lib/address-inventory.sh"
# Colors
RED='\033[0;31m'
@@ -21,19 +22,14 @@ log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
log_step() { echo -e "${CYAN}[STEP]${NC} $1"; }
# Load environment variables
if [ -f "$PROJECT_ROOT/.env" ]; then
source "$PROJECT_ROOT/.env"
elif [ -f "$PROJECT_ROOT/../.env" ]; then
source "$PROJECT_ROOT/../.env"
fi
load_explorer_runtime_env
# Check for private key
if [ -z "${PRIVATE_KEY:-}" ]; then
log_error "PRIVATE_KEY not found in .env file"
log_error "PRIVATE_KEY not available in effective environment"
log_info ""
log_info "Please add your private key to .env file:"
log_info " echo 'PRIVATE_KEY=0x...' >> $PROJECT_ROOT/.env"
log_info "Please export your private key before running:"
log_info " export PRIVATE_KEY=0x..."
log_info ""
log_info "Or provide it as an argument:"
log_info " $0 [private_key]"
@@ -89,4 +85,3 @@ log_step "Bridging 100 ETH to Ethereum Mainnet..."
log_info ""
"$SCRIPT_DIR/wrap-and-bridge-to-ethereum.sh" 100 "$PRIVATE_KEY"