2
2
3
3
### 1.1 首先安装Rust:
4
4
5
- ``` sh
6
- curl --proto ' =https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
7
- # 将Rust加载到当前shell会话中
8
- source " $HOME /.cargo/env"
9
- ```
10
-
11
- 验证安装:
5
+ 确认系统是否已安装Rust:
12
6
13
7
``` sh
14
8
rustc --version
15
9
cargo --version
16
10
```
17
11
18
- ### 1.2 其次安装 ` wasm32-unknown-unknown ` target:
12
+ 如果没有,请通过下列命令安装:
19
13
20
14
``` sh
21
- rustup target add wasm32-unknown-unknown
15
+ curl --proto ' =https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
16
+
17
+ # 将Rust加载到当前shell会话中
18
+ source " $HOME /.cargo/env"
22
19
```
23
20
24
- 验证安装:
21
+ ### 1.2 其次安装` wasm32-unknown-unknown ` target:
22
+
23
+ 确认是否已安装wasm32-unknown-unknown:
25
24
26
25
``` sh
27
26
rustup target list --installed
28
27
# 或使用
29
28
rustup show
30
29
```
31
30
32
- 确保在'installed targets'下显示'wasm32-unknown-unknown'。
31
+ 'installed targets'下应该显示'wasm32-unknown-unknown',如果没有,请通过下列命令安装:
32
+
33
+ ``` sh
34
+ rustup target add wasm32-unknown-unknown
35
+ ```
36
+
33
37
34
38
### 1.3 接着安装[ cargo-generate] ( https://github.com/ashleygwilliams/cargo-generate ) 和cargo-run-script:
35
39
40
+ 确认是否已安装'cargo generate'和'cargo run-script':
41
+
42
+ ``` sh
43
+ cargo --list
44
+ ```
45
+
46
+ 命令列表中应显示'generate'和'run-script',如果没有,请通过下列命令安装:
47
+
36
48
``` sh
37
49
cargo install cargo-generate --features vendored-openssl
50
+
38
51
cargo install cargo-run-script
39
52
```
40
53
41
- 验证安装:
54
+ ### 1.4 然后安装Injectived:
55
+
56
+ 确认是否已安装injectived:
42
57
43
58
``` sh
44
- cargo --list
59
+ injectived version
45
60
```
46
61
47
- 确保命令列表中显示'generate'和'run-script'。
48
-
49
- ### 1.4 最后安装Injectived:
62
+ 如果没有,请通过下列命令安装:
50
63
51
64
``` sh
52
65
wget https://github.com/InjectiveLabs/injective-chain-releases/releases/download/v1.15.0-1748457819/linux-amd64.zip
66
+
53
67
unzip linux-amd64.zip
68
+
54
69
sudo mv injectived peggo /usr/bin
55
70
sudo mv libwasmvm.x86_64.so /usr/lib
56
71
```
57
72
58
- 验证安装:
73
+ ### 1.5 最后安装yj:
74
+
75
+ 确认是否已安装yj:
59
76
60
77
``` sh
61
- injectived version
78
+ yj --version
79
+ ```
80
+
81
+ 如果没有,请通过下列命令安装:
82
+
83
+ ``` sh
84
+ sudo curl -L https://github.com/sclevine/yj/releases/latest/download/yj-linux-amd64 -o /usr/local/bin/yj
85
+
86
+ sudo chmod +x /usr/local/bin/yj
62
87
```
63
88
64
89
## 2. 创建Counter项目
@@ -160,16 +185,13 @@ TXHASH=$(
160
185
--node=https://testnet.sentry.tm.injective.network:443 \
161
186
| yj -yj | jq -r .txhash
162
187
)
163
-
164
188
echo " txhash: $TXHASH "
165
189
166
190
# 得到Code ID
167
191
CODE_ID=$(
168
192
injectived query tx $TXHASH --node=https://testnet.sentry.tm.injective.network:443 \
169
- | yj -yj | jq .events[] -c | jq .attibutes[] -c \
170
- | grep code_id | jq -r .value | head -n1
193
+ | yj -yj | jq -r ' .events[] | select(.type == "store_code") | .attributes[] | select(.key == "code_id") | .value'
171
194
)
172
-
173
195
echo " code_id: $CODE_ID "
174
196
```
175
197
@@ -191,16 +213,14 @@ TXHASH=$(
191
213
--node=https://testnet.sentry.tm.injective.network:443 \
192
214
| yj -yj | jq -r .txhash
193
215
)
194
-
195
216
echo " txhash: $TXHASH "
196
217
197
218
# 得到合约地址
198
219
CONTRACT=$(
199
220
injectived query tx $TXHASH --node=https://testnet.sentry.tm.injective.network:443 \
200
- | yj -yj | jq .events[] -c | jq .attibutes [] -c \
221
+ | yj -yj | jq .events[] -c | jq .attributes [] -c \
201
222
| grep contract_address | jq -r .value | head -n1
202
223
)
203
-
204
224
echo " contract: $CONTRACT "
205
225
```
206
226
0 commit comments