@@ -117,7 +117,11 @@ describe('fundChainRecipients', () => {
117
117
// Capture console.log outputs
118
118
const consoleLogSpy = jest . spyOn ( console , 'log' ) ;
119
119
120
- await fundChainRecipients ( { options, merkleFunderDepositories } , mockContract as unknown as ethers . Contract ) ;
120
+ await fundChainRecipients (
121
+ '31337' ,
122
+ { options, merkleFunderDepositories } ,
123
+ mockContract as unknown as ethers . Contract
124
+ ) ;
121
125
122
126
expect ( buildMerkleTree ) . toHaveBeenCalledTimes ( 1 ) ;
123
127
expect ( buildMerkleTree ) . toHaveBeenCalledWith ( values ) ;
@@ -132,13 +136,18 @@ describe('fundChainRecipients', () => {
132
136
[ owner , treeRoot , proof2 , values [ 1 ] . recipient , ethers . utils . parseEther ( '5' ) , ethers . utils . parseEther ( '15' ) ]
133
137
) ;
134
138
const [ , ...multicallCalldata ] = staticMulticallCalldata ;
135
- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'Expected number of calldatas to be sent: ' , multicallCalldata . length ) ;
139
+ expect ( consoleLogSpy ) . toHaveBeenCalledWith (
140
+ 'Expected number of calldatas to be sent: ' ,
141
+ multicallCalldata . length ,
142
+ '31337'
143
+ ) ;
136
144
expect ( mockContractCallStaticTryMulticall ) . toHaveBeenCalledWith ( staticMulticallCalldata ) ;
137
145
expect ( consoleLogSpy ) . not . toHaveBeenCalledWith (
138
146
`Failed to call merkleFunderContract.callStatic.tryMulticall:` ,
139
- expect . any ( String )
147
+ expect . any ( String ) ,
148
+ '31337'
140
149
) ;
141
- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'Block number:' , '10' ) ;
150
+ expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'Block number:' , '10' , '31337' ) ;
142
151
expect ( consoleLogSpy ) . not . toHaveBeenCalledWith ( 'Failded to fetch block number:' , expect . any ( String ) ) ;
143
152
expect ( consoleLogSpy ) . not . toHaveBeenCalledWith (
144
153
`Calldata #${ 1 } reverted with message:` ,
@@ -157,7 +166,8 @@ describe('fundChainRecipients', () => {
157
166
expect . any ( String )
158
167
) ;
159
168
expect ( consoleLogSpy ) . toHaveBeenCalledWith (
160
- `Sent tx with hash ${ tryMulticallResult . hash } that will send funds to ${ multicallCalldata . length } recipients`
169
+ `Sent tx with hash ${ tryMulticallResult . hash } that will send funds to ${ multicallCalldata . length } recipients` ,
170
+ '31337'
161
171
) ;
162
172
expect ( consoleLogSpy ) . not . toHaveBeenCalledWith ( 'All recipients are already funded' ) ;
163
173
} ) ;
@@ -250,7 +260,11 @@ describe('fundChainRecipients', () => {
250
260
// Capture console.log outputs
251
261
const consoleLogSpy = jest . spyOn ( console , 'log' ) ;
252
262
253
- await fundChainRecipients ( { options, merkleFunderDepositories } , mockContract as unknown as ethers . Contract ) ;
263
+ await fundChainRecipients (
264
+ '31337' ,
265
+ { options, merkleFunderDepositories } ,
266
+ mockContract as unknown as ethers . Contract
267
+ ) ;
254
268
255
269
expect ( buildMerkleTree ) . toHaveBeenCalledTimes ( 1 ) ;
256
270
expect ( buildMerkleTree ) . toHaveBeenCalledWith ( values ) ;
@@ -265,21 +279,31 @@ describe('fundChainRecipients', () => {
265
279
[ owner , treeRoot , proof2 , values [ 1 ] . recipient , ethers . utils . parseEther ( '5' ) , ethers . utils . parseEther ( '15' ) ]
266
280
) ;
267
281
const [ , ...multicallCalldata ] = staticMulticallCalldata ;
268
- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'Expected number of calldatas to be sent: ' , multicallCalldata . length ) ;
282
+ expect ( consoleLogSpy ) . toHaveBeenCalledWith (
283
+ 'Expected number of calldatas to be sent: ' ,
284
+ multicallCalldata . length ,
285
+ '31337'
286
+ ) ;
269
287
expect ( mockContractCallStaticTryMulticall ) . toHaveBeenCalledWith ( staticMulticallCalldata ) ;
270
- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'Block number:' , '10' ) ;
271
- expect ( consoleLogSpy ) . not . toHaveBeenCalledWith ( 'Failded to fetch block number:' , expect . any ( String ) ) ;
272
- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( `Calldata #${ 1 } reverted with message:` , 'mocked-revert-string' ) ;
288
+ expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'Block number:' , '10' , '31337' ) ;
289
+ expect ( consoleLogSpy ) . not . toHaveBeenCalledWith ( 'Failded to fetch block number:' , expect . any ( String ) , '31337' ) ;
290
+ expect ( consoleLogSpy ) . toHaveBeenCalledWith (
291
+ `Calldata #${ 1 } reverted with message:` ,
292
+ 'mocked-revert-string' ,
293
+ '31337'
294
+ ) ;
273
295
expect ( mockGetTransactionCount ) . toHaveBeenCalledTimes ( 1 ) ;
274
296
expect ( getGasPriceMock ) . toHaveBeenCalledTimes ( 1 ) ;
275
297
expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'mocked-get-gas-price-message' ) ;
276
298
expect ( mockContractTryMulticall ) . toHaveBeenCalledWith ( [ staticMulticallCalldata [ 2 ] ] , expect . anything ( ) ) ;
277
299
expect ( consoleLogSpy ) . not . toHaveBeenCalledWith (
278
300
`Failed to call merkleFunderContract.tryMulticall:` ,
279
- expect . any ( String )
301
+ expect . any ( String ) ,
302
+ '31337'
280
303
) ;
281
304
expect ( consoleLogSpy ) . toHaveBeenCalledWith (
282
- `Sent tx with hash ${ tryMulticallResult . hash } that will send funds to 1 recipients`
305
+ `Sent tx with hash ${ tryMulticallResult . hash } that will send funds to 1 recipients` ,
306
+ '31337'
283
307
) ;
284
308
expect ( consoleLogSpy ) . not . toHaveBeenCalledWith ( 'All recipients are already funded' ) ;
285
309
} ) ;
@@ -357,7 +381,11 @@ describe('fundChainRecipients', () => {
357
381
// Capture console.log outputs
358
382
const consoleLogSpy = jest . spyOn ( console , 'log' ) ;
359
383
360
- await fundChainRecipients ( { options, merkleFunderDepositories } , mockContract as unknown as ethers . Contract ) ;
384
+ await fundChainRecipients (
385
+ '31337' ,
386
+ { options, merkleFunderDepositories } ,
387
+ mockContract as unknown as ethers . Contract
388
+ ) ;
361
389
362
390
expect ( buildMerkleTree ) . toHaveBeenCalledTimes ( 1 ) ;
363
391
expect ( buildMerkleTree ) . toHaveBeenCalledWith ( values ) ;
@@ -367,19 +395,25 @@ describe('fundChainRecipients', () => {
367
395
[ owner , treeRoot , proof1 , values [ 0 ] . recipient , ethers . utils . parseEther ( '10' ) , ethers . utils . parseEther ( '20' ) ]
368
396
) ;
369
397
const [ , ...multicallCalldata ] = staticMulticallCalldata ;
370
- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'Expected number of calldatas to be sent: ' , multicallCalldata . length ) ;
398
+ expect ( consoleLogSpy ) . toHaveBeenCalledWith (
399
+ 'Expected number of calldatas to be sent: ' ,
400
+ multicallCalldata . length ,
401
+ '31337'
402
+ ) ;
371
403
expect ( mockContractCallStaticTryMulticall ) . toHaveBeenCalledWith ( staticMulticallCalldata ) ;
372
404
expect ( consoleLogSpy ) . not . toHaveBeenCalledWith (
373
405
`Failed to call merkleFunderContract.callStatic.tryMulticall:` ,
374
- expect . any ( String )
406
+ expect . any ( String ) ,
407
+ '31337'
375
408
) ;
376
409
expect ( mockGetTransactionCount ) . toHaveBeenCalledTimes ( 1 ) ;
377
410
expect ( getGasPriceMock ) . toHaveBeenCalledTimes ( 1 ) ;
378
411
expect ( consoleLogSpy ) . toHaveBeenCalledWith ( 'mocked-get-gas-price-message' ) ;
379
412
expect ( mockContractTryMulticall ) . toHaveBeenCalledWith ( multicallCalldata , expect . anything ( ) ) ;
380
413
expect ( consoleLogSpy ) . toHaveBeenCalledWith (
381
414
'Failed to call merkleFunderContract.tryMulticall:' ,
382
- 'mocked-error-message'
415
+ 'mocked-error-message' ,
416
+ '31337'
383
417
) ;
384
418
} ) ;
385
419
} ) ;
0 commit comments