Skip to content

Commit

Permalink
specify callDataLimit from user as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
vignesha22 committed Dec 11, 2023
1 parent 9729b6c commit 8b31f57
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { Factory, PaymasterApi, SdkOptions } from './interfaces';
import { Network } from "./network";
import { BatchUserOpsRequest, Exception, getGasFee, onRampApiKey, openUrl, UserOpsRequest } from "./common";
import { BigNumber, ethers, providers } from 'ethers';
import { BigNumber, BigNumberish, ethers, providers } from 'ethers';
import { getNetworkConfig, Networks, onRamperAllNetworks } from './network/constants';
import { UserOperationStruct } from './contracts/account-abstraction/contracts/core/BaseAccount';
import { EtherspotWalletAPI, HttpRpcClient, VerifyingPaymasterAPI } from './base';
Expand Down Expand Up @@ -169,7 +169,7 @@ export class PrimeSdk {
return this.etherspotWallet.getCounterFactualAddress();
}

async estimate(paymasterDetails?: PaymasterApi, gasDetails?: TransactionGasInfoForUserOp) {
async estimate(paymasterDetails?: PaymasterApi, gasDetails?: TransactionGasInfoForUserOp, callDataLimit?: BigNumberish) {
if (this.userOpsBatch.to.length < 1) {
throw new ErrorHandler('cannot sign empty transaction batch', 1);
}
Expand All @@ -192,6 +192,10 @@ export class PrimeSdk {
maxPriorityFeePerGas: 1,
});

if (callDataLimit) {
partialtx.callGasLimit = BigNumber.from(callDataLimit).toHexString();
}

/**
* Dummy signature used only in the case of zeroDev factory contract
*/
Expand Down Expand Up @@ -219,7 +223,8 @@ export class PrimeSdk {
if (bundlerGasEstimate.preVerificationGas) {
partialtx.preVerificationGas = BigNumber.from(bundlerGasEstimate.preVerificationGas);
partialtx.verificationGasLimit = BigNumber.from(bundlerGasEstimate.verificationGasLimit ?? bundlerGasEstimate.verificationGas);
partialtx.callGasLimit = BigNumber.from(bundlerGasEstimate.callGasLimit);
if (!callDataLimit)
partialtx.callGasLimit = BigNumber.from(bundlerGasEstimate.callGasLimit);
}

return partialtx;
Expand Down

0 comments on commit 8b31f57

Please sign in to comment.