-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalgo.sh
executable file
·141 lines (122 loc) · 3.47 KB
/
algo.sh
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
commandHelp()
{
# Display Help
echo "Add a description of the script commands here."
echo
echo "command options:"
echo
echo "sandbox -> Manage sandbox."
echo "- start -> Start Algorand Sandbox."
echo "- stop -> Stop Algorand Sandbox."
echo "- restart -> Restart Algorand Sandbox."
echo "- status -> Status Algorand Sandbox."
echo
echo "account -> Manage accounts."
echo "- create -> Create accounts. [Bob, Aliza]"
echo "- balance -> Check balance accounts. [Bob, Aliza]"
echo "- pump -> Add balance to accounts. [Bob, Aliza]"
echo
echo "lab1 -> Connection to node."
echo "lab2 -> Create account."
echo "lab3 -> Send Algo."
echo "lab4 -> Wait for Confirmation."
echo "lab5 -> Read the Transaction."
echo "lab6 -> Create a wallet and generate an account."
echo "lab7 -> Import an account."
echo "lab8 -> Export an account."
echo "lab9 -> Recover wallet and regenerate account."
echo "lab10 -> First smart-contract."
echo
}
accountFunctionHelp()
{
# Display Help
echo "Add a description of the script functions here."
echo
echo "function options:"
echo
echo "create -> Create accounts. [Bob, Aliza]"
echo "balance -> Check balance accounts. [Bob, Aliza]"
echo "pump -> Add balance to accounts. [Bob, Aliza]"
echo
}
sandboxFunctionHelp()
{
# Display Help
echo "Add a description of the script functions here."
echo
echo "function options:"
echo
echo "start -> Start Algorand Sandbox."
echo "stop -> Stop Algorand Sandbox."
echo "restart -> Restart Algorand Sandbox."
echo "status -> Status Algorand Sandbox."
echo
}
COMMAND="${1:-none}"
FUNCTION="${2:-none}"
if [[ "$COMMAND" == "sandbox" ]]
then
if [[ "$FUNCTION" == "start" ]]
then
cd sandbox && node start.js
elif [[ "$FUNCTION" == "stop" ]]
then
cd sandbox && node stop.js
elif [[ "$FUNCTION" == "restart" ]]
then
cd sandbox && node restart.js
elif [[ "$FUNCTION" == "status" ]]
then
cd sandbox && node status.js
else
sandboxFunctionHelp
fi
elif [[ "$COMMAND" == "account" ]]
then
if [[ "$FUNCTION" == "create" ]]
then
cd account && node create.js
elif [[ "$FUNCTION" == "balance" ]]
then
cd account && node balance.js
elif [[ "$FUNCTION" == "pump" ]]
then
cd account && node pump.js
else
accountFunctionHelp
fi
elif [[ "$COMMAND" == "lab1" ]]
then
cd lab1.connect-node && node index.js
elif [[ "$COMMAND" == "lab2" ]]
then
cd lab2.create-account && node index.js
elif [[ "$COMMAND" == "lab3" ]]
then
cd lab3.send-algo && node index.js
elif [[ "$COMMAND" == "lab4" ]]
then
cd lab4.wait-for-confirmation && node index.js
elif [[ "$COMMAND" == "lab5" ]]
then
cd lab5.read-transaction && node index.js
elif [[ "$COMMAND" == "lab6" ]]
then
cd lab6.create-wallet && node index.js
elif [[ "$COMMAND" == "lab7" ]]
then
cd lab7.import-account && node index.js
elif [[ "$COMMAND" == "lab8" ]]
then
cd lab8.export-account && node index.js
elif [[ "$COMMAND" == "lab9" ]]
then
cd lab9.recover-wallet && node index.js
elif [[ "$COMMAND" == "lab10" ]]
then
cd lab10.first-smartcontract && node index.js
else
commandHelp
fi