@@ -18,8 +18,7 @@ import { serializeAccountTransactionPayload } from '@concordium/common-sdk/src';
18
18
import {
19
19
getModuleBuffer ,
20
20
getIdentityInput ,
21
- getNodeClient as getNodeClientV1 ,
22
- getNodeClientV2 ,
21
+ getNodeClient ,
23
22
} from './testHelpers' ;
24
23
import * as ed from '@noble/ed25519' ;
25
24
import * as expected from './resources/expectedJsons' ;
@@ -49,8 +48,7 @@ export function getNodeClientWeb(
49
48
return new v1 . ConcordiumGRPCClient ( transport ) ;
50
49
}
51
50
52
- const clientV1 = getNodeClientV1 ( 'node.testnet.concordium.com' , 10000 ) ;
53
- const clientV2 = getNodeClientV2 ( ) ;
51
+ const clientV2 = getNodeClient ( ) ;
54
52
const clientWeb = getNodeClientWeb ( ) ;
55
53
56
54
const testAccount = new v1 . AccountAddress (
@@ -174,66 +172,26 @@ test.each([clientV2, clientWeb])(
174
172
test . each ( [ clientV2 , clientWeb ] ) (
175
173
'accountInfo implementations is the same' ,
176
174
async ( client ) => {
177
- const oldReg = await clientV1 . getAccountInfo (
178
- testAccount ,
179
- testBlockHash
180
- ) ;
181
- const newReg = await client . getAccountInfo ( testAccount , testBlockHash ) ;
182
-
183
- const oldCredId = await clientV1 . getAccountInfo (
184
- testCredId ,
185
- testBlockHash
186
- ) ;
187
- const newCredId = await client . getAccountInfo (
188
- testCredId ,
189
- testBlockHash
190
- ) ;
191
-
192
- const oldBaker = await clientV1 . getAccountInfo (
193
- testAccBaker ,
194
- testBlockHash
195
- ) ;
196
- const newBaker = await client . getAccountInfo (
197
- testAccBaker ,
198
- testBlockHash
199
- ) ;
200
-
201
- const oldDeleg = await clientV1 . getAccountInfo (
202
- testAccDeleg ,
203
- testBlockHash
204
- ) ;
205
- const newDeleg = await client . getAccountInfo (
206
- testAccDeleg ,
207
- testBlockHash
208
- ) ;
209
-
210
- expect ( oldReg ) . toEqual ( newReg ) ;
211
- expect ( oldCredId ) . toEqual ( newCredId ) ;
212
- expect ( oldDeleg ) . toEqual ( newDeleg ) ;
213
- expect ( oldBaker ) . toEqual ( newBaker ) ;
175
+ const regular = await client . getAccountInfo ( testAccount , testBlockHash ) ;
176
+ const credId = await client . getAccountInfo ( testCredId , testBlockHash ) ;
177
+ const baker = await client . getAccountInfo ( testAccBaker , testBlockHash ) ;
178
+ const deleg = await client . getAccountInfo ( testAccDeleg , testBlockHash ) ;
179
+
180
+ expect ( regular ) . toEqual ( expected . regularAccountInfo ) ;
181
+ expect ( credId ) . toEqual ( expected . credIdAccountInfo ) ;
182
+ expect ( baker ) . toEqual ( expected . bakerAccountInfo ) ;
183
+ expect ( deleg ) . toEqual ( expected . delegatorAccountInfo ) ;
214
184
}
215
185
) ;
216
186
217
187
test . each ( [ clientV2 , clientWeb ] ) (
218
188
'getChainParameters corresponds to GetBlockSummary subset' ,
219
189
async ( client ) => {
220
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
221
- const blockSummary : any = await clientV1 . getBlockSummary ( testBlockHash ) ;
222
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
- const chainParameters : any = await client . getBlockChainParameters (
190
+ const chainParameters = await client . getBlockChainParameters (
224
191
testBlockHash
225
192
) ;
226
193
227
- const foundationAccount = (
228
- await client . getAccountInfo (
229
- blockSummary . updates . chainParameters . foundationAccountIndex
230
- )
231
- ) . accountAddress ;
232
- expect ( chainParameters . foundationAccount ) . toEqual ( foundationAccount ) ;
233
- blockSummary . updates . chainParameters . foundationAccountIndex = undefined ;
234
- chainParameters . foundationAccount = undefined ;
235
-
236
- expect ( blockSummary . updates . chainParameters ) . toEqual ( chainParameters ) ;
194
+ expect ( chainParameters ) . toEqual ( expected . chainParameters ) ;
237
195
}
238
196
) ;
239
197
@@ -242,43 +200,29 @@ test.each([clientV2, clientWeb])(
242
200
async ( client ) => {
243
201
const oldBlockHash =
244
202
'ed2507c4d05108038741e87757ab1c3acdeeb3327027cd2972666807c9c4a20d' ;
245
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
246
- const blockSummary : any = await clientV1 . getBlockSummary ( oldBlockHash ) ;
247
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
248
- const chainParameters : any = await client . getBlockChainParameters (
203
+ const oldChainParameters = await client . getBlockChainParameters (
249
204
oldBlockHash
250
205
) ;
251
206
252
- const foundationAccount = (
253
- await client . getAccountInfo (
254
- blockSummary . updates . chainParameters . foundationAccountIndex
255
- )
256
- ) . accountAddress ;
257
- expect ( chainParameters . foundationAccount ) . toEqual ( foundationAccount ) ;
258
- blockSummary . updates . chainParameters . foundationAccountIndex = undefined ;
259
- chainParameters . foundationAccount = undefined ;
260
-
261
- expect ( blockSummary . updates . chainParameters ) . toEqual ( chainParameters ) ;
207
+ expect ( oldChainParameters ) . toEqual ( expected . oldChainParameters ) ;
262
208
}
263
209
) ;
264
210
265
211
test . each ( [ clientV2 , clientWeb ] ) (
266
212
'getPoolInfo corresponds to getPoolStatus with a bakerId' ,
267
213
async ( client ) => {
268
- const oldStatus = await clientV1 . getPoolStatus ( testBlockHash , 1n ) ;
269
- const newStatus = await client . getPoolInfo ( 1n , testBlockHash ) ;
214
+ const bakerPoolStatus = await client . getPoolInfo ( 1n , testBlockHash ) ;
270
215
271
- expect ( oldStatus ) . toEqual ( newStatus ) ;
216
+ expect ( bakerPoolStatus ) . toEqual ( expected . bakerPoolStatus ) ;
272
217
}
273
218
) ;
274
219
275
220
test . each ( [ clientV2 , clientWeb ] ) (
276
221
'getPassiveDelegationInfo corresponds to getPoolStatus with no bakerId' ,
277
222
async ( client ) => {
278
- const oldStatus = await clientV1 . getPoolStatus ( testBlockHash ) ;
279
- const newStatus = await client . getPassiveDelegationInfo ( testBlockHash ) ;
223
+ const status = await client . getPassiveDelegationInfo ( testBlockHash ) ;
280
224
281
- expect ( oldStatus ) . toEqual ( newStatus ) ;
225
+ expect ( status ) . toEqual ( expected . passiveDelegationStatus ) ;
282
226
}
283
227
) ;
284
228
test . each ( [ clientV2 , clientWeb ] ) (
@@ -287,13 +231,10 @@ test.each([clientV2, clientWeb])(
287
231
const changeHash =
288
232
'2aa7c4a54ad403a9f9b48de2469e5f13a64c95f2cf7a8e72c0f9f7ae0718f642' ;
289
233
const changedAccount = 1879n ;
290
- const oldStatus = await clientV1 . getPoolStatus (
291
- changeHash ,
292
- changedAccount
293
- ) ;
294
- const newStatus = await client . getPoolInfo ( changedAccount , changeHash ) ;
295
234
296
- expect ( oldStatus ) . toEqual ( newStatus ) ;
235
+ const poolStatus = await client . getPoolInfo ( changedAccount , changeHash ) ;
236
+
237
+ expect ( poolStatus ) . toEqual ( expected . bakerPoolStatusWithPendingChange ) ;
297
238
}
298
239
) ;
299
240
@@ -396,10 +337,9 @@ test.each([clientV2, clientWeb])(
396
337
parameter : undefined ,
397
338
energy : 30000n ,
398
339
} ;
399
- const resultV1 = await clientV1 . invokeContract ( context , testBlockHash ) ;
400
- const resultV2 = await client . invokeContract ( context , testBlockHash ) ;
340
+ const result = await client . invokeContract ( context , testBlockHash ) ;
401
341
402
- expect ( resultV2 ) . toEqual ( resultV1 ) ;
342
+ expect ( result ) . toEqual ( expected . invokeContractResult ) ;
403
343
}
404
344
) ;
405
345
@@ -665,10 +605,9 @@ test.each([clientV2, clientWeb])('getAnonymityRevokers', async (client) => {
665
605
} ) ;
666
606
667
607
test . each ( [ clientV2 , clientWeb ] ) ( 'getBlocksAtHeight' , async ( client ) => {
668
- const blocksV1 = await clientV1 . getBlocksAtHeight ( 1n ) ;
669
- const blocksV2 = await client . getBlocksAtHeight ( 1n ) ;
608
+ const blocks = await client . getBlocksAtHeight ( 1n ) ;
670
609
671
- expect ( blocksV1 [ 0 ] ) . toEqual ( blocksV2 [ 0 ] ) ;
610
+ expect ( blocks ) . toEqual ( expected . blocksAtHeight ) ;
672
611
} ) ;
673
612
674
613
test . each ( [ clientV2 , clientWeb ] ) (
@@ -682,23 +621,22 @@ test.each([clientV2, clientWeb])(
682
621
const expectedBlock =
683
622
'956c3bc5c9d10449e13686a4cc69e8bc7dee450608866242075a6ce37331187c' ;
684
623
const blocks = await client . getBlocksAtHeight ( request ) ;
624
+
685
625
expect ( blocks [ 0 ] ) . toEqual ( expectedBlock ) ;
686
626
}
687
627
) ;
688
628
689
629
test . each ( [ clientV2 , clientWeb ] ) ( 'getBlockInfo' , async ( client ) => {
690
- const blockInfoV1 = await clientV1 . getBlockInfo ( testBlockHash ) ;
691
- const blockInfoV2 = await client . getBlockInfo ( testBlockHash ) ;
630
+ const blockInfo = await client . getBlockInfo ( testBlockHash ) ;
692
631
693
- expect ( blockInfoV2 ) . toEqual ( blockInfoV1 ) ;
632
+ expect ( blockInfo ) . toEqual ( expected . blockInfo ) ;
694
633
} ) ;
695
634
696
635
test . each ( [ clientV2 , clientWeb ] ) ( 'getBakerList' , async ( client ) => {
697
636
const bakerAsyncIterable = client . getBakerList ( testBlockHash ) ;
698
- const bakersV2 = await asyncIterableToList ( bakerAsyncIterable ) ;
699
- const bakersV1 = await clientV1 . getBakerList ( testBlockHash ) ;
637
+ const bakers = await asyncIterableToList ( bakerAsyncIterable ) ;
700
638
701
- expect ( bakersV2 ) . toEqual ( bakersV1 ) ;
639
+ expect ( bakers ) . toEqual ( expected . bakers ) ;
702
640
} ) ;
703
641
704
642
test . each ( [ clientV2 , clientWeb ] ) ( 'getPoolDelegators' , async ( client ) => {
0 commit comments