2
2
3
3
load ../utils/_
4
4
5
+ install_nns () {
6
+ dfx_start_for_nns_install
7
+
8
+ dfx extension install nns --version 0.4.3
9
+ dfx nns install --ledger-accounts 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 22ca7edac648b814e81d7946e8bacea99280e07c5f51a04ba7a38009d8ad8e89 5a94fe181e9d411c58726cb87cbf2d016241b6c350bc3330e4869ca76e54ecbc
10
+ }
11
+
5
12
setup () {
6
13
standard_setup
7
14
install_asset ledger
8
15
install_shared_asset subnet_type/shared_network_settings/system
9
16
10
17
dfx identity import --storage-mode plaintext alice alice.pem
11
18
dfx identity import --storage-mode plaintext bob bob.pem
12
-
13
- dfx_start_for_nns_install
14
-
15
- dfx extension install nns --version 0.4.3
16
- dfx nns install --ledger-accounts 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752 22ca7edac648b814e81d7946e8bacea99280e07c5f51a04ba7a38009d8ad8e89 5a94fe181e9d411c58726cb87cbf2d016241b6c350bc3330e4869ca76e54ecbc
17
19
}
18
20
19
21
teardown () {
@@ -27,6 +29,8 @@ current_time_nanoseconds() {
27
29
}
28
30
29
31
@test " ledger account-id" {
32
+ install_nns
33
+
30
34
dfx identity use alice
31
35
assert_command dfx ledger account-id
32
36
assert_match 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752
@@ -46,6 +50,8 @@ current_time_nanoseconds() {
46
50
}
47
51
48
52
@test " ledger balance & transfer" {
53
+ install_nns
54
+
49
55
dfx identity use alice
50
56
assert_command dfx ledger account-id
51
57
assert_eq 345f723e9e619934daac6ae0f4be13a7b0ba57d6a608e511a00fd0ded5866752
@@ -104,6 +110,8 @@ current_time_nanoseconds() {
104
110
}
105
111
106
112
@test " ledger subaccounts" {
113
+ install_nns
114
+
107
115
subacct=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
108
116
assert_command dfx ledger account-id --identity bob --subaccount " $subacct "
109
117
assert_match 5a94fe181e9d411c58726cb87cbf2d016241b6c350bc3330e4869ca76e54ecbc
@@ -140,6 +148,8 @@ tc_to_num() {
140
148
}
141
149
142
150
@test " ledger top-up" {
151
+ install_nns
152
+
143
153
dfx identity use alice
144
154
assert_command dfx ledger balance
145
155
assert_match " 1000000000.00000000 ICP"
@@ -198,6 +208,8 @@ tc_to_num() {
198
208
}
199
209
200
210
@test " ledger create-canister" {
211
+ install_nns
212
+
201
213
dfx identity use alice
202
214
assert_command dfx ledger create-canister --amount=100 --subnet-type " type1" " $( dfx identity get-principal) "
203
215
assert_match " Transfer sent at block height"
@@ -269,6 +281,7 @@ tc_to_num() {
269
281
}
270
282
271
283
@test " ledger show-subnet-types" {
284
+ install_nns
272
285
install_asset cmc
273
286
274
287
dfx deploy cmc
@@ -278,3 +291,10 @@ tc_to_num() {
278
291
assert_command dfx ledger show-subnet-types --cycles-minting-canister-id " $CANISTER_ID "
279
292
assert_eq ' ["type1", "type2"]'
280
293
}
294
+
295
+ @test " balance without ledger fails as expected" {
296
+ dfx_start
297
+
298
+ assert_command_fail dfx ledger balance
299
+ assert_contains " ICP Ledger with canister ID 'ryjl3-tyaaa-aaaaa-aaaba-cai' is not installed."
300
+ }
0 commit comments