forked from Invoice-Liquidity-Network/ILN-Smart-Contract
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset-testnet.sh
More file actions
executable file
·51 lines (42 loc) · 1.2 KB
/
Copy pathreset-testnet.sh
File metadata and controls
executable file
·51 lines (42 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Reset testnet: deploy fresh contracts, seed data, and verify.
# Usage:
# npm run reset-testnet # interactive (prompts for confirmation)
# npm run reset-testnet -- --yes # skip confirmation (for CI)
set -euo pipefail
SKIP_CONFIRM=false
for arg in "$@"; do
if [[ "$arg" == "--yes" || "$arg" == "-y" ]]; then
SKIP_CONFIRM=true
fi
done
if [[ "$SKIP_CONFIRM" == false ]]; then
echo "⚠️ This will wipe all testnet data and deploy fresh contracts."
read -p "Continue? [y/N] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 0
fi
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
echo "=== Step 1: Deploying fresh contracts ==="
bash scripts/deploy-testnet.sh
echo ""
echo "=== Step 2: Seeding test data ==="
npx tsx scripts/seed.ts
echo ""
echo "=== Step 3: Verifying deployment ==="
npx tsx scripts/verify-deployment.ts
echo ""
echo "=== Step 4: Updating testnet README ==="
bash scripts/update-testnet-readme.sh
echo ""
echo "✅ Testnet reset complete."
if [[ -f .contracts-testnet.env ]]; then
echo ""
echo "New contract IDs:"
grep "_ID=" .contracts-testnet.env
fi