@@ -53,11 +53,14 @@ async fn test_counter() {
53
53
54
54
// Check that it was created correctly.
55
55
let compressed_accounts = rpc
56
- . get_compressed_accounts_by_owner_v2 ( & counter:: ID )
56
+ . get_compressed_accounts_by_owner ( & counter:: ID , None , None )
57
57
. await
58
- . unwrap ( ) ;
58
+ . unwrap ( )
59
+ . value
60
+ . items ;
59
61
assert_eq ! ( compressed_accounts. len( ) , 1 ) ;
60
- let compressed_account = & compressed_accounts[ 0 ] ;
62
+ let compressed_account: CompressedAccountWithMerkleContext =
63
+ compressed_accounts[ 0 ] . clone ( ) . into ( ) ;
61
64
let counter = & compressed_account
62
65
. compressed_account
63
66
. data
@@ -68,17 +71,20 @@ async fn test_counter() {
68
71
assert_eq ! ( counter. value, 0 ) ;
69
72
70
73
// Increment the counter.
71
- increment_counter ( & mut rpc, & payer, compressed_account)
74
+ increment_counter ( & mut rpc, & payer, & compressed_account)
72
75
. await
73
76
. unwrap ( ) ;
74
77
75
78
// Check that it was incremented correctly.
76
79
let compressed_accounts = rpc
77
- . get_compressed_accounts_by_owner_v2 ( & counter:: ID )
80
+ . get_compressed_accounts_by_owner ( & counter:: ID , None , None )
78
81
. await
79
- . unwrap ( ) ;
82
+ . unwrap ( )
83
+ . value
84
+ . items ;
80
85
assert_eq ! ( compressed_accounts. len( ) , 1 ) ;
81
- let compressed_account = & compressed_accounts[ 0 ] ;
86
+ let compressed_account: CompressedAccountWithMerkleContext =
87
+ compressed_accounts[ 0 ] . clone ( ) . into ( ) ;
82
88
let counter = & compressed_account
83
89
. compressed_account
84
90
. data
@@ -89,17 +95,20 @@ async fn test_counter() {
89
95
assert_eq ! ( counter. value, 1 ) ;
90
96
91
97
// Decrement the counter.
92
- decrement_counter ( & mut rpc, & payer, compressed_account)
98
+ decrement_counter ( & mut rpc, & payer, & compressed_account)
93
99
. await
94
100
. unwrap ( ) ;
95
101
96
102
// Check that it was decremented correctly.
97
103
let compressed_accounts = rpc
98
- . get_compressed_accounts_by_owner_v2 ( & counter:: ID )
104
+ . get_compressed_accounts_by_owner ( & counter:: ID , None , None )
99
105
. await
100
- . unwrap ( ) ;
106
+ . unwrap ( )
107
+ . value
108
+ . items ;
101
109
assert_eq ! ( compressed_accounts. len( ) , 1 ) ;
102
- let compressed_account = & compressed_accounts[ 0 ] ;
110
+ let compressed_account: CompressedAccountWithMerkleContext =
111
+ compressed_accounts[ 0 ] . clone ( ) . into ( ) ;
103
112
let counter = & compressed_account
104
113
. compressed_account
105
114
. data
@@ -110,17 +119,20 @@ async fn test_counter() {
110
119
assert_eq ! ( counter. value, 0 ) ;
111
120
112
121
// Reset the counter.
113
- reset_counter ( & mut rpc, & payer, compressed_account)
122
+ reset_counter ( & mut rpc, & payer, & compressed_account)
114
123
. await
115
124
. unwrap ( ) ;
116
125
117
126
// Check that it was reset correctly.
118
127
let compressed_accounts = rpc
119
- . get_compressed_accounts_by_owner_v2 ( & counter:: ID )
128
+ . get_compressed_accounts_by_owner ( & counter:: ID , None , None )
120
129
. await
121
- . unwrap ( ) ;
130
+ . unwrap ( )
131
+ . value
132
+ . items ;
122
133
assert_eq ! ( compressed_accounts. len( ) , 1 ) ;
123
- let compressed_account = & compressed_accounts[ 0 ] ;
134
+ let compressed_account: CompressedAccountWithMerkleContext =
135
+ compressed_accounts[ 0 ] . clone ( ) . into ( ) ;
124
136
let counter = & compressed_account
125
137
. compressed_account
126
138
. data
@@ -131,16 +143,16 @@ async fn test_counter() {
131
143
assert_eq ! ( counter. value, 0 ) ;
132
144
133
145
// Close the counter.
134
- close_counter ( & mut rpc, & payer, compressed_account)
146
+ close_counter ( & mut rpc, & payer, & compressed_account)
135
147
. await
136
148
. unwrap ( ) ;
137
149
138
150
// Check that it was closed correctly (no compressed accounts after closing).
139
151
let compressed_accounts = rpc
140
- . get_compressed_accounts_by_owner_v2 ( & counter:: ID )
152
+ . get_compressed_accounts_by_owner ( & counter:: ID , None , None )
141
153
. await
142
154
. unwrap ( ) ;
143
- assert_eq ! ( compressed_accounts. len( ) , 0 ) ;
155
+ assert_eq ! ( compressed_accounts. value . items . len( ) , 0 ) ;
144
156
}
145
157
146
158
async fn create_counter < R > (
@@ -164,19 +176,21 @@ where
164
176
tree: address_merkle_context. address_merkle_tree_pubkey,
165
177
address: * address,
166
178
} ] ,
179
+ None ,
167
180
)
168
181
. await
169
- . unwrap ( ) ;
182
+ . unwrap ( )
183
+ . value ;
170
184
171
185
let output_merkle_tree_index = remaining_accounts. insert_or_get ( output_merkle_tree) ;
172
186
let packed_address_merkle_context = pack_address_merkle_context (
173
187
& address_merkle_context,
174
188
& mut remaining_accounts,
175
- rpc_result. address_root_indices [ 0 ] ,
189
+ rpc_result. get_address_root_indices ( ) [ 0 ] ,
176
190
) ;
177
191
178
192
let instruction_data = counter:: instruction:: CreateCounter {
179
- proof : rpc_result. proof . into ( ) ,
193
+ proof : rpc_result. proof ,
180
194
address_merkle_context : packed_address_merkle_context,
181
195
output_merkle_tree_index,
182
196
} ;
@@ -204,7 +218,6 @@ where
204
218
#[ allow( clippy:: too_many_arguments) ]
205
219
async fn increment_counter < R > (
206
220
rpc : & mut R ,
207
-
208
221
payer : & Keypair ,
209
222
compressed_account : & CompressedAccountWithMerkleContext ,
210
223
) -> Result < Signature , RpcError >
@@ -218,9 +231,10 @@ where
218
231
let hash = compressed_account. hash ( ) . unwrap ( ) ;
219
232
220
233
let rpc_result = rpc
221
- . get_validity_proof_v2 ( Vec :: from ( & [ hash] ) , vec ! [ ] )
234
+ . get_validity_proof ( Vec :: from ( & [ hash] ) , vec ! [ ] , None )
222
235
. await
223
- . unwrap ( ) ;
236
+ . unwrap ( )
237
+ . value ;
224
238
225
239
let packed_merkle_context =
226
240
pack_merkle_context ( & compressed_account. merkle_context , & mut remaining_accounts) ;
@@ -239,12 +253,12 @@ where
239
253
let account_meta = CompressedAccountMeta {
240
254
merkle_context : packed_merkle_context,
241
255
address : compressed_account. compressed_account . address . unwrap ( ) ,
242
- root_index : Some ( rpc_result. root_indices [ 0 ] . unwrap ( ) ) ,
256
+ root_index : Some ( rpc_result. get_root_indices ( ) [ 0 ] . unwrap ( ) ) ,
243
257
output_merkle_tree_index : packed_merkle_context. merkle_tree_pubkey_index ,
244
258
} ;
245
259
246
260
let instruction_data = counter:: instruction:: IncrementCounter {
247
- proof : rpc_result. proof . into ( ) ,
261
+ proof : rpc_result. proof ,
248
262
counter_value : counter_account. value ,
249
263
account_meta,
250
264
} ;
@@ -285,9 +299,10 @@ where
285
299
let hash = compressed_account. hash ( ) . unwrap ( ) ;
286
300
287
301
let rpc_result = rpc
288
- . get_validity_proof ( Vec :: from ( & [ hash] ) , vec ! [ ] )
302
+ . get_validity_proof ( Vec :: from ( & [ hash] ) , vec ! [ ] , None )
289
303
. await
290
- . unwrap ( ) ;
304
+ . unwrap ( )
305
+ . value ;
291
306
292
307
let packed_merkle_context =
293
308
pack_merkle_context ( & compressed_account. merkle_context , & mut remaining_accounts) ;
@@ -306,12 +321,12 @@ where
306
321
let account_meta = CompressedAccountMeta {
307
322
merkle_context : packed_merkle_context,
308
323
address : compressed_account. compressed_account . address . unwrap ( ) ,
309
- root_index : Some ( rpc_result. root_indices [ 0 ] ) ,
324
+ root_index : rpc_result. get_root_indices ( ) [ 0 ] ,
310
325
output_merkle_tree_index : packed_merkle_context. merkle_tree_pubkey_index ,
311
326
} ;
312
327
313
328
let instruction_data = counter:: instruction:: DecrementCounter {
314
- proof : rpc_result. proof . into ( ) ,
329
+ proof : rpc_result. proof ,
315
330
counter_value : counter_account. value ,
316
331
account_meta,
317
332
} ;
@@ -352,7 +367,7 @@ where
352
367
let hash = compressed_account. hash ( ) . unwrap ( ) ;
353
368
354
369
let rpc_result = rpc
355
- . get_validity_proof_v2 ( Vec :: from ( & [ hash] ) , vec ! [ ] )
370
+ . get_validity_proof ( Vec :: from ( & [ hash] ) , vec ! [ ] , None )
356
371
. await
357
372
. unwrap ( ) ;
358
373
@@ -373,12 +388,12 @@ where
373
388
let account_meta = CompressedAccountMeta {
374
389
merkle_context : packed_merkle_context,
375
390
address : compressed_account. compressed_account . address . unwrap ( ) ,
376
- root_index : Some ( rpc_result. root_indices [ 0 ] . unwrap ( ) ) ,
391
+ root_index : Some ( rpc_result. value . get_root_indices ( ) [ 0 ] . unwrap ( ) ) ,
377
392
output_merkle_tree_index : packed_merkle_context. merkle_tree_pubkey_index ,
378
393
} ;
379
394
380
395
let instruction_data = counter:: instruction:: ResetCounter {
381
- proof : rpc_result. proof . into ( ) ,
396
+ proof : rpc_result. value . proof ,
382
397
counter_value : counter_account. value ,
383
398
account_meta,
384
399
} ;
@@ -418,7 +433,7 @@ where
418
433
let hash = compressed_account. hash ( ) . unwrap ( ) ;
419
434
420
435
let rpc_result = rpc
421
- . get_validity_proof_v2 ( Vec :: from ( & [ hash] ) , vec ! [ ] )
436
+ . get_validity_proof ( Vec :: from ( & [ hash] ) , vec ! [ ] , None )
422
437
. await
423
438
. unwrap ( ) ;
424
439
@@ -439,12 +454,12 @@ where
439
454
let account_meta = CompressedAccountMeta {
440
455
merkle_context : packed_merkle_context,
441
456
address : compressed_account. compressed_account . address . unwrap ( ) ,
442
- root_index : Some ( rpc_result. root_indices [ 0 ] . unwrap ( ) ) ,
457
+ root_index : Some ( rpc_result. value . get_root_indices ( ) [ 0 ] . unwrap ( ) ) ,
443
458
output_merkle_tree_index : packed_merkle_context. merkle_tree_pubkey_index ,
444
459
} ;
445
460
446
461
let instruction_data = counter:: instruction:: CloseCounter {
447
- proof : rpc_result. proof . into ( ) ,
462
+ proof : rpc_result. value . proof ,
448
463
counter_value : counter_account. value ,
449
464
account_meta,
450
465
} ;
0 commit comments