@@ -134,6 +134,7 @@ describe('defaultTransactionBuilder', () => {
134
134
// VALID_ETH_BASE_TYPES.HexString,
135
135
// '0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709',
136
136
// overrideFunction,
137
+ fillGasPrice : true ,
137
138
} ) ;
138
139
expect ( overrideFunction ) . toHaveBeenCalledWith ( input ) ;
139
140
} ) ;
@@ -149,6 +150,7 @@ describe('defaultTransactionBuilder', () => {
149
150
transaction : input ,
150
151
web3Context,
151
152
privateKey : '0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709' ,
153
+ fillGasPrice : true ,
152
154
} ) ;
153
155
expect ( result . from ) . toBe ( expectedFrom ) ;
154
156
} ) ;
@@ -169,6 +171,7 @@ describe('defaultTransactionBuilder', () => {
169
171
const result = await defaultTransactionBuilder ( {
170
172
transaction : input ,
171
173
web3Context,
174
+ fillGasPrice : true ,
172
175
} ) ;
173
176
expect ( result . from ) . toBe ( expectedFrom ) ;
174
177
} ) ;
@@ -183,7 +186,7 @@ describe('defaultTransactionBuilder', () => {
183
186
delete input . maxFeePerGas ;
184
187
185
188
await expect (
186
- defaultTransactionBuilder ( { transaction : input , web3Context } ) ,
189
+ defaultTransactionBuilder ( { transaction : input , web3Context, fillGasPrice : true } ) ,
187
190
) . rejects . toThrow ( new UnableToPopulateNonceError ( ) ) ;
188
191
} ) ;
189
192
@@ -196,6 +199,26 @@ describe('defaultTransactionBuilder', () => {
196
199
const result = await defaultTransactionBuilder ( {
197
200
transaction : input ,
198
201
web3Context,
202
+ fillGasPrice : true ,
203
+ } ) ;
204
+ expect ( result . nonce ) . toBe ( expectedNonce ) ;
205
+ expect ( getTransactionCountSpy ) . toHaveBeenCalledWith (
206
+ web3Context . requestManager ,
207
+ expectedFrom ,
208
+ web3Context . defaultBlock ,
209
+ ) ;
210
+ } ) ;
211
+
212
+ it ( 'should use web3Eth.getTransactionCount to populate nonce without gas fill' , async ( ) => {
213
+ const input = { ...transaction } ;
214
+ delete input . nonce ;
215
+ delete input . maxPriorityFeePerGas ;
216
+ delete input . maxFeePerGas ;
217
+
218
+ const result = await defaultTransactionBuilder ( {
219
+ transaction : input ,
220
+ web3Context,
221
+ fillGasPrice : false ,
199
222
} ) ;
200
223
expect ( result . nonce ) . toBe ( expectedNonce ) ;
201
224
expect ( getTransactionCountSpy ) . toHaveBeenCalledWith (
@@ -216,6 +239,7 @@ describe('defaultTransactionBuilder', () => {
216
239
const result = await defaultTransactionBuilder ( {
217
240
transaction : input ,
218
241
web3Context,
242
+ fillGasPrice : true ,
219
243
} ) ;
220
244
expect ( result . value ) . toBe ( '0x' ) ;
221
245
} ) ;
@@ -232,6 +256,7 @@ describe('defaultTransactionBuilder', () => {
232
256
const result = await defaultTransactionBuilder ( {
233
257
transaction : input ,
234
258
web3Context,
259
+ fillGasPrice : true ,
235
260
} ) ;
236
261
expect ( result . input ) . toBe ( '0x' ) ;
237
262
expect ( result . data ) . toBe ( '0x' ) ;
@@ -247,6 +272,7 @@ describe('defaultTransactionBuilder', () => {
247
272
const result = await defaultTransactionBuilder ( {
248
273
transaction : input ,
249
274
web3Context,
275
+ fillGasPrice : true ,
250
276
} ) ;
251
277
expect ( result . input ) . toBe ( '0x123' ) ;
252
278
expect ( result . data ) . toBe ( '0x123' ) ;
@@ -277,6 +303,7 @@ describe('defaultTransactionBuilder', () => {
277
303
const result = await defaultTransactionBuilder ( {
278
304
transaction : input ,
279
305
web3Context,
306
+ fillGasPrice : true ,
280
307
} ) ;
281
308
expect ( result . chain ) . toBe ( 'mainnet' ) ;
282
309
} ) ;
@@ -293,6 +320,7 @@ describe('defaultTransactionBuilder', () => {
293
320
const result = await defaultTransactionBuilder ( {
294
321
transaction : input ,
295
322
web3Context,
323
+ fillGasPrice : true ,
296
324
} ) ;
297
325
expect ( result . chain ) . toBe ( web3Context . defaultChain ) ;
298
326
} ) ;
@@ -309,6 +337,7 @@ describe('defaultTransactionBuilder', () => {
309
337
const result = await defaultTransactionBuilder ( {
310
338
transaction : input ,
311
339
web3Context,
340
+ fillGasPrice : true ,
312
341
} ) ;
313
342
expect ( result . hardfork ) . toBe ( 'london' ) ;
314
343
} ) ;
@@ -325,6 +354,7 @@ describe('defaultTransactionBuilder', () => {
325
354
const result = await defaultTransactionBuilder ( {
326
355
transaction : input ,
327
356
web3Context,
357
+ fillGasPrice : true ,
328
358
} ) ;
329
359
expect ( result . hardfork ) . toBe ( web3Context . defaultHardfork ) ;
330
360
} ) ;
@@ -357,6 +387,7 @@ describe('defaultTransactionBuilder', () => {
357
387
const result = await defaultTransactionBuilder ( {
358
388
transaction : input ,
359
389
web3Context,
390
+ fillGasPrice : true ,
360
391
} ) ;
361
392
expect ( result . common ) . toStrictEqual ( customCommon ) ;
362
393
} ) ;
@@ -373,6 +404,7 @@ describe('defaultTransactionBuilder', () => {
373
404
const result = await defaultTransactionBuilder ( {
374
405
transaction : input ,
375
406
web3Context,
407
+ fillGasPrice : true ,
376
408
} ) ;
377
409
expect ( result . chainId ) . toBe ( expectedChainId ) ;
378
410
} ) ;
@@ -388,6 +420,7 @@ describe('defaultTransactionBuilder', () => {
388
420
const result = await defaultTransactionBuilder ( {
389
421
transaction : input ,
390
422
web3Context,
423
+ fillGasPrice : true ,
391
424
} ) ;
392
425
expect ( result . networkId ) . toBe ( expectedNetworkId ) ;
393
426
} ) ;
@@ -403,6 +436,7 @@ describe('defaultTransactionBuilder', () => {
403
436
const result = await defaultTransactionBuilder ( {
404
437
transaction : input ,
405
438
web3Context,
439
+ fillGasPrice : true ,
406
440
} ) ;
407
441
expect ( result . gasLimit ) . toBe ( expectedGasLimit ) ;
408
442
} ) ;
@@ -414,7 +448,7 @@ describe('defaultTransactionBuilder', () => {
414
448
input . type = '0x8' ; // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2718.md#transactions
415
449
416
450
await expect (
417
- defaultTransactionBuilder ( { transaction : input , web3Context } ) ,
451
+ defaultTransactionBuilder ( { transaction : input , web3Context, fillGasPrice : true } ) ,
418
452
) . rejects . toThrow ( new UnsupportedTransactionTypeError ( input . type ) ) ;
419
453
} ) ;
420
454
@@ -441,6 +475,7 @@ describe('defaultTransactionBuilder', () => {
441
475
const result = await defaultTransactionBuilder ( {
442
476
transaction : input ,
443
477
web3Context,
478
+ fillGasPrice : true ,
444
479
} ) ;
445
480
expect ( result . type ) . toBe ( web3Context . defaultTransactionType ) ;
446
481
} ) ;
@@ -454,7 +489,11 @@ describe('defaultTransactionBuilder', () => {
454
489
delete input . maxPriorityFeePerGas ;
455
490
input . type = '0x0' ;
456
491
457
- const result = await defaultTransactionBuilder ( { transaction : input , web3Context } ) ;
492
+ const result = await defaultTransactionBuilder ( {
493
+ transaction : input ,
494
+ web3Context,
495
+ fillGasPrice : true ,
496
+ } ) ;
458
497
expect ( result . gasPrice ) . toBe ( expectedGasPrice ) ;
459
498
} ) ;
460
499
@@ -468,6 +507,7 @@ describe('defaultTransactionBuilder', () => {
468
507
const result = await defaultTransactionBuilder ( {
469
508
transaction : input ,
470
509
web3Context,
510
+ fillGasPrice : true ,
471
511
} ) ;
472
512
expect ( result . gasPrice ) . toBe ( expectedGasPrice ) ;
473
513
} ) ;
@@ -484,6 +524,7 @@ describe('defaultTransactionBuilder', () => {
484
524
const result = await defaultTransactionBuilder < PopulatedUnsignedEip2930Transaction > ( {
485
525
transaction : input ,
486
526
web3Context,
527
+ fillGasPrice : true ,
487
528
} ) ;
488
529
expect ( result . accessList ) . toStrictEqual ( [ ] ) ;
489
530
} ) ;
@@ -497,6 +538,7 @@ describe('defaultTransactionBuilder', () => {
497
538
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
498
539
transaction : input ,
499
540
web3Context,
541
+ fillGasPrice : true ,
500
542
} ) ;
501
543
expect ( result . accessList ) . toStrictEqual ( [ ] ) ;
502
544
} ) ;
@@ -516,7 +558,7 @@ describe('defaultTransactionBuilder', () => {
516
558
input . type = '0x2' ;
517
559
518
560
await expect (
519
- defaultTransactionBuilder ( { transaction : input , web3Context } ) ,
561
+ defaultTransactionBuilder ( { transaction : input , web3Context, fillGasPrice : true } ) ,
520
562
) . rejects . toThrow ( new Eip1559NotSupportedError ( ) ) ;
521
563
} ) ;
522
564
@@ -530,6 +572,7 @@ describe('defaultTransactionBuilder', () => {
530
572
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
531
573
transaction : input ,
532
574
web3Context,
575
+ fillGasPrice : true ,
533
576
} ) ;
534
577
535
578
expect ( result . maxPriorityFeePerGas ) . toBeDefined ( ) ;
@@ -546,6 +589,7 @@ describe('defaultTransactionBuilder', () => {
546
589
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
547
590
transaction : input ,
548
591
web3Context,
592
+ fillGasPrice : true ,
549
593
} ) ;
550
594
expect ( result . maxPriorityFeePerGas ) . toBe ( expectedMaxPriorityFeePerGas ) ; // 2.5 Gwei, hardcoded in defaultTransactionBuilder;
551
595
expect ( result . maxFeePerGas ) . toBe ( expectedMaxFeePerGas ) ;
@@ -560,6 +604,7 @@ describe('defaultTransactionBuilder', () => {
560
604
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
561
605
transaction : input ,
562
606
web3Context,
607
+ fillGasPrice : true ,
563
608
} ) ;
564
609
expect ( result . maxPriorityFeePerGas ) . toBe ( expectedMaxPriorityFeePerGas ) ; // 2.5 Gwei, hardcoded in defaultTransactionBuilder;
565
610
expect ( result . maxFeePerGas ) . toBe ( expectedMaxFeePerGas ) ;
@@ -574,6 +619,7 @@ describe('defaultTransactionBuilder', () => {
574
619
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
575
620
transaction : input ,
576
621
web3Context,
622
+ fillGasPrice : true ,
577
623
} ) ;
578
624
expect ( result . maxPriorityFeePerGas ) . toBe ( expectedMaxPriorityFeePerGas ) ; // 2.5 Gwei, hardcoded in defaultTransactionBuilder;
579
625
expect ( result . maxFeePerGas ) . toBe ( expectedMaxFeePerGas ) ;
@@ -596,6 +642,7 @@ describe('defaultTransactionBuilder', () => {
596
642
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
597
643
transaction : input ,
598
644
web3Context,
645
+ fillGasPrice : true ,
599
646
} ) ;
600
647
expect ( result . maxPriorityFeePerGas ) . toBe ( web3Context . defaultMaxPriorityFeePerGas ) ; // 2.5 Gwei, hardcoded in defaultTransactionBuilder;
601
648
expect ( result . maxFeePerGas ) . toBe ( expectedMaxFeePerGas ) ;
@@ -617,6 +664,7 @@ describe('defaultTransactionBuilder', () => {
617
664
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
618
665
transaction : input ,
619
666
web3Context,
667
+ fillGasPrice : true ,
620
668
} ) ;
621
669
expect ( result . maxPriorityFeePerGas ) . toBe ( web3Context . defaultMaxPriorityFeePerGas ) ; // 2.5 Gwei, hardcoded in defaultTransactionBuilder;
622
670
expect ( result . maxFeePerGas ) . toBe ( expectedMaxFeePerGas ) ;
@@ -638,6 +686,7 @@ describe('defaultTransactionBuilder', () => {
638
686
const result = await defaultTransactionBuilder < PopulatedUnsignedEip1559Transaction > ( {
639
687
transaction : input ,
640
688
web3Context,
689
+ fillGasPrice : true ,
641
690
} ) ;
642
691
expect ( result . maxPriorityFeePerGas ) . toBe ( web3Context . defaultMaxPriorityFeePerGas ) ; // 2.5 Gwei, hardcoded in defaultTransactionBuilder;
643
692
expect ( result . maxFeePerGas ) . toBe ( expectedMaxFeePerGas ) ;
0 commit comments