Skip to content

Commit

Permalink
make gas limits & fee optional in estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSulpiride committed Feb 9, 2024
1 parent 77f09d1 commit db39b11
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
19 changes: 16 additions & 3 deletions packages/api/src/dto/EstimateUserOperation.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
IsDefined,
IsEthereumAddress,
IsObject,
IsOptional,
IsString,
ValidateNested,
} from "class-validator";
Expand All @@ -20,21 +21,33 @@ export class EstimateUserOperationStruct {
initCode!: BytesLike;
@IsString()
callData!: BytesLike;
@IsString()
signature!: BytesLike;

@IsBigNumber()
@IsOptional()
verificationGasLimit?: BigNumberish;

@IsBigNumber()
@IsOptional()
preVerificationGas?: BigNumberish;

@IsBigNumber()
@IsOptional()
maxFeePerGas?: BigNumberish;

@IsBigNumber()
@IsOptional()
maxPriorityFeePerGas?: BigNumberish;

@IsString()
@IsCallData()
@IsOptional()
paymasterAndData?: BytesLike;
@IsString()
signature!: BytesLike;

@IsBigNumber()
callGasLimit!: BigNumberish;
@IsOptional()
callGasLimit?: BigNumberish;
}

export class EstimateUserOperationGasArgs {
Expand Down
13 changes: 8 additions & 5 deletions packages/api/src/utils/RpcMethodValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ export function validationFactory<T>(
const schema = Reflect.getOwnMetadata(metadataKey, target, propertyName);
const errors = await validate(plainToInstance(schema, args[0]));
if (errors.length > 0) {
logger.info("Invalid Request", {
data: {
errors,
arguments: args[0],
logger.info(
{
data: {
errors,
arguments: args[0],
},
},
});
"Invalid Request"
);
throw new RpcError("Invalid Request", RpcErrorCodes.INVALID_REQUEST);
}

Expand Down
5 changes: 3 additions & 2 deletions packages/executor/src/modules/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ export class EstimateUserOperationStruct {
nonce!: BigNumberish;
initCode!: BytesLike;
callData!: BytesLike;
signature!: BytesLike;

verificationGasLimit?: BigNumberish;
preVerificationGas?: BigNumberish;
maxFeePerGas?: BigNumberish;
maxPriorityFeePerGas?: BigNumberish;
paymasterAndData?: BytesLike;
signature!: BytesLike;
callGasLimit!: BigNumberish;
callGasLimit?: BigNumberish;
}

export class EstimateUserOperationGasArgs {
Expand Down

0 comments on commit db39b11

Please sign in to comment.