forked from octra-labs/wallet-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallet-generator.sh
More file actions
executable file
·113 lines (86 loc) · 2.74 KB
/
wallet-generator.sh
File metadata and controls
executable file
·113 lines (86 loc) · 2.74 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
set -e # Exit on any error
REPO_OWNER="octra-labs"
REPO_NAME="wallet-gen"
INSTALL_DIR="$HOME/.octra"
TEMP_DIR="/tmp/octra-wallet-gen-install"
echo "=== ⚠️ SECURITY WARNING ⚠️ ==="
echo ""
echo "this tool generates real cryptographic keys. always:"
echo " - keep your private keys secure"
echo " - never share your mnemonic phrase"
echo " - don't store wallet files on cloud services"
echo " - use on a secure, offline computer for production wallets"
echo ""
read -p "press enter to continue..." < /dev/tty
echo ""
echo "=== octra wallet generator installer ==="
echo ""
install_bun() {
if ! command -v bun &> /dev/null; then
bash $TEMP_DIR/scripts/install_bun.sh
# Set PATH to include Bun's binary directory
export PATH="$HOME/.bun/bin:$PATH"
fi
}
get_latest_release() {
curl -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/tags" | \
grep '"name":' | \
head -1 | \
sed 's/.*"name": "\(.*\)".*/\1/'
}
download_and_extract() {
local tag=$1
echo "downloading octra wallet generator..."
rm -rf "$TEMP_DIR"
mkdir -p "$TEMP_DIR"
local tarball_url="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/tarball/refs/tags/${tag}"
curl -L -o "$TEMP_DIR/release.tar.gz" "$tarball_url"
cd "$TEMP_DIR"
tar -xzf release.tar.gz --strip-components=1
}
echo "fetching latest release information..."
LATEST_TAG=$(get_latest_release)
if [ -z "$LATEST_TAG" ]; then
echo "❌ error: could not fetch latest release information."
echo "please check your internet connection and try again."
exit 1
fi
download_and_extract "$LATEST_TAG"
cd "$TEMP_DIR"
install_bun
bun install
echo ""
echo "building standalone executable..."
bun run build
if [ ! -f "./wallet-generator" ]; then
echo "❌ error: wallet-generator executable not found!"
echo "build may have failed. please check the build output above."
exit 1
fi
echo "installing to $INSTALL_DIR..."
mkdir -p "$INSTALL_DIR"
cp ./wallet-generator "$INSTALL_DIR/"
echo ""
echo "starting wallet generator server..."
cd "$INSTALL_DIR"
rm -rf "$TEMP_DIR"
if lsof -i :8888 >/dev/null 2>&1; then
echo "❌ error: port 8888 is already in use!"
echo "please stop any existing service using port 8888."
exit 1
fi
./wallet-generator > /dev/null &
WALLET_PID=$!
sleep 2
BROWSER_CMD=$(command -v open 2>/dev/null || command -v xdg-open 2>/dev/null || echo "")
if [ -n "$BROWSER_CMD" ]; then
$BROWSER_CMD http://localhost:8888 2>/dev/null || echo ""
fi
echo ""
echo "=== installation complete! ==="
echo "wallet generator is running at http://localhost:8888"
echo "to run again later, use: $INSTALL_DIR/wallet-generator"
echo "to stop the wallet generator, press Ctrl+C"
echo ""
wait $WALLET_PID