@@ -112,7 +112,25 @@ export class Paymaster {
112112 if ( ! userOp . signature ) userOp . signature = '0x' ;
113113 if ( userOp . factory && userOp . factoryData ) userOp . initCode = hexConcat ( [ userOp . factory , userOp . factoryData ?? '' ] )
114114 if ( ! userOp . initCode ) userOp . initCode = "0x" ;
115+ const paymasterPostOpGasLimit = BigNumber . from ( "40000" ) . toHexString ( ) ;
115116 if ( estimate ) {
117+ userOp . paymaster = paymasterAddress ;
118+ userOp . paymasterVerificationGasLimit = this . EP7_PVGL ;
119+ userOp . paymasterPostOpGasLimit = paymasterPostOpGasLimit ;
120+ const accountGasLimits = this . packUint ( userOp . verificationGasLimit , userOp . callGasLimit )
121+ const gasFees = this . packUint ( userOp . maxPriorityFeePerGas , userOp . maxFeePerGas ) ;
122+ const packedUserOp = {
123+ sender : userOp . sender ,
124+ nonce : userOp . nonce ,
125+ initCode : userOp . initCode ,
126+ callData : userOp . callData ,
127+ accountGasLimits : accountGasLimits ,
128+ preVerificationGas : userOp . preVerificationGas ,
129+ gasFees : gasFees ,
130+ paymasterAndData : this . packPaymasterData ( paymasterAddress , this . EP7_PVGL , paymasterPostOpGasLimit ) ,
131+ signature : userOp . signature
132+ }
133+ userOp . paymasterData = await this . getPaymasterData ( packedUserOp , validUntil , validAfter , paymasterContract , signer ) ;
116134 const response = await provider . send ( 'eth_estimateUserOperationGas' , [ userOp , entryPoint ] ) ;
117135 userOp . verificationGasLimit = response . verificationGasLimit ;
118136 userOp . callGasLimit = response . callGasLimit ;
@@ -128,7 +146,7 @@ export class Paymaster {
128146 accountGasLimits : accountGasLimits ,
129147 preVerificationGas : userOp . preVerificationGas ,
130148 gasFees : gasFees ,
131- paymasterAndData : this . packPaymasterData ( paymasterAddress , this . EP7_PVGL , "0x1" ) ,
149+ paymasterAndData : this . packPaymasterData ( paymasterAddress , this . EP7_PVGL , paymasterPostOpGasLimit ) ,
132150 signature : userOp . signature
133151 }
134152
@@ -142,7 +160,7 @@ export class Paymaster {
142160 verificationGasLimit : BigNumber . from ( userOp . verificationGasLimit ) . toHexString ( ) ,
143161 callGasLimit : BigNumber . from ( userOp . callGasLimit ) . toHexString ( ) ,
144162 paymasterVerificationGasLimit : this . EP7_PVGL . toHexString ( ) ,
145- paymasterPostOpGasLimit : "0x1"
163+ paymasterPostOpGasLimit
146164 }
147165 } else {
148166 returnValue = {
0 commit comments