forked from keep-starknet-strange/madara
-
Notifications
You must be signed in to change notification settings - Fork 8
/
deoxys
executable file
·85 lines (78 loc) · 1.74 KB
/
deoxys
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
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: $0 [start|reset|reboot|lint|help] [KEY for start/reboot]"
exit 1
fi
start_deoxys(){
local key=$1
echo "🚀 start deoxys..."
cargo run \
--release \
-- \
--deoxys \
--rpc-port 9944 \
--network main \
--rpc-cors all \
--pruning archive \
--cache \
--l1-endpoint="$key"
}
clear_db(){
echo "🛠️ clear end rebuild DB..."
read -p "Are you sure? [y/N] " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
rm -rf /tmp/deoxys
}
lint(){
echo "📝 Running linters..."
read -p "Are you sure? [y/N] " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
npx @taplo/cli@0.5.2 fmt --config ./taplo/taplo.toml
npx prettier --write .
}
ACTION=$1
case $ACTION in
start)
if [ "$#" -ne 2 ]; then
echo "Usage for start: $0 start [KEY]"
exit 1
fi
start_deoxys "$2"
;;
reset)
if [ "$#" -ne 1 ]; then
echo "Usage for reset: $0 reset"
exit 1
fi
clear_db
;;
reboot)
if [ "$#" -ne 2 ]; then
echo "Usage for reboot: $0 reboot [KEY]"
exit 1
fi
clear_db
start_deoxys "$2"
;;
lint)
lint
;;
help)
echo "Usage: $0 [start|reset|reboot|lint|help] [KEY for start/reboot]"
echo "start: start deoxys with KEY"
echo "reset: clear and rebuild DB"
echo "reboot: clear and rebuild DB, then start deoxys with KEY"
echo "lint: run CI linter on project"
;;
*)
echo "Invalid argument: $ACTION"
exit 1
;;
esac
exit 0