@@ -3,7 +3,7 @@ import { CurrencyTypes, LogTypes, StorageTypes } from '@requestnetwork/types';
33import { requestHashSubmitterArtifact } from '@requestnetwork/smart-contracts' ;
44import { RequestOpenHashSubmitter } from '@requestnetwork/smart-contracts/types' ;
55import { GasFeeDefiner } from './gas-fee-definer' ;
6- import { SimpleLogger , isEip1559Supported } from '@requestnetwork/utils' ;
6+ import { isEip1559Supported , SimpleLogger } from '@requestnetwork/utils' ;
77
88export type SubmitterProps = {
99 signer : Signer ;
@@ -22,6 +22,11 @@ export type SubmitterProps = {
2222 * The default is 100, which does not change the value (100 is equal to x1, 200 is equal to x2).
2323 */
2424 gasPriceMultiplier ?: number ;
25+ /**
26+ * If set, the gas limit will be used when submitting transactions.
27+ * If not, the gas limit will be estimated on each submission.
28+ */
29+ gasLimit ?: BigNumber ;
2530 network : CurrencyTypes . EvmChainName ;
2631 logger ?: LogTypes . ILogger ;
2732 debugProvider ?: boolean ;
@@ -36,6 +41,7 @@ export class EthereumTransactionSubmitter implements StorageTypes.ITransactionSu
3641 private readonly hashSubmitter : RequestOpenHashSubmitter ;
3742 private readonly provider : providers . JsonRpcProvider ;
3843 private readonly gasFeeDefiner : GasFeeDefiner ;
44+ private readonly gasLimit : BigNumber | undefined ;
3945
4046 constructor ( {
4147 network,
@@ -44,6 +50,7 @@ export class EthereumTransactionSubmitter implements StorageTypes.ITransactionSu
4450 gasPriceMin,
4551 gasPriceMax,
4652 gasPriceMultiplier,
53+ gasLimit,
4754 debugProvider,
4855 } : SubmitterProps ) {
4956 this . logger = logger || new SimpleLogger ( ) ;
@@ -60,6 +67,7 @@ export class EthereumTransactionSubmitter implements StorageTypes.ITransactionSu
6067 gasPriceMultiplier,
6168 logger : this . logger ,
6269 } ) ;
70+ this . gasLimit = gasLimit ;
6371 if ( debugProvider ) {
6472 this . provider . on ( 'debug' , ( event ) => {
6573 this . logger . debug ( 'JsonRpcProvider debug event' , event ) ;
@@ -96,6 +104,12 @@ export class EthereumTransactionSubmitter implements StorageTypes.ITransactionSu
96104 utils . hexZeroPad ( utils . hexlify ( ipfsSize ) , 32 ) ,
97105 ] ) ;
98106
99- return { to : this . hashSubmitter . address , data : tx , value : fee , ...gasFees } ;
107+ return {
108+ to : this . hashSubmitter . address ,
109+ data : tx ,
110+ value : fee ,
111+ gasLimit : this . gasLimit ,
112+ ...gasFees ,
113+ } ;
100114 }
101115}
0 commit comments