-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.sh
executable file
·147 lines (127 loc) · 2.54 KB
/
dev.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
140
141
142
143
144
145
146
147
#!/bin/bash
cargo-build() {
docker exec \
-it \
docker_example_1 \
/root/.cargo/bin/cargo build --release --target=wasm32-unknown-unknown
}
wasm-gc() {
docker exec \
-it \
docker_example_1 \
/root/.cargo/bin/wasm-gc target/wasm32-unknown-unknown/release/example.wasm example_gc.wasm
}
wasm-opt() {
docker exec \
-it \
docker_example_1 \
wasm-opt example_gc.wasm --output example_gc_opt.wasm -Oz
}
build() {
cargo-build
wasm-gc
wasm-opt
}
wallet-create() {
docker exec \
-it \
docker_keosd_1 \
cleos \
--url http://nodeosd:8888 \
--wallet-url http://127.0.0.1:8900 \
wallet create \
-n user1 \
--to-console
}
wallet-unlock() {
docker exec \
-it \
docker_keosd_1 \
bash -c 'cleos \
--url http://nodeosd:8888 \
--wallet-url http://127.0.0.1:8900 \
wallet unlock \
-n user1 \
--password ${WALLET_PASSWORD}'
}
wallet-import() {
docker exec -it docker_keosd_1 \
bash -c 'cleos \
--url http://nodeosd:8888 \
--wallet-url http://127.0.0.1:8900 \
wallet import \
-n user1 \
--private-key ${EOS_PRIVKEY}'
}
account-create() {
docker exec \
-it \
docker_keosd_1 \
bash -c 'cleos \
--url http://nodeosd:8888 \
--wallet-url http://127.0.0.1:8900 \
create account eosio user1 ${EOS_PUBKEY}'
}
set-abi-code() {
docker exec \
-it \
docker_keosd_1 \
cleos \
--url http://nodeosd:8888 \
--wallet-url http://127.0.0.1:8900 \
set abi user1 example.abi.json
set code user1 example_gc_opt.wasm
}
install_eoslime() {
docker exec \
-it \
docker_nodeosd_1 \
npm install --prefix /example/testing -y --save-dev --verbose
}
run_test() {
docker exec \
-it \
docker_nodeosd_1 \
npm test --prefix testing tests/basic_repo_operations.js
}
run() {
build
wallet-unlock
account-create
set-abi-code
install_eoslime
run_test
}
if [ "$1" == "run" ]; then
echo "run"
run
fi
if [ "$1" == "build" ]; then
echo "build"
build
fi
if [ "$1" == "set" ]; then
echo "set"
set-abi-code
fi
if [ "$1" == "wallet-create" ]; then
echo "create wallet"
wallet-create
fi
if [ "$1" == "wallet-unlock" ]; then
echo "wallet unlock"
wallet-unlock
fi
if [ "$1" == "account-create" ]; then
echo "creating account"
account-create
fi
if [ "$1" == "import" ]; then
echo "wallet import"
wallet-import
fi
if [ "$1" == "test" ]; then
echo "test"
install_eoslime # It's okay to run this repeatedly.
run_test
fi