Skip to content

Commit

Permalink
Fix/set gas limits and prices to zero for gas estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
sherifahmed990 committed May 20, 2024
2 parents f4fa43f + 3a2bea9 commit 33af6d6
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"dependencies": {
"dotenv": "^16.3.1",
"typescript": "^5.1.6",
"abstractionkit": "^0.1.8"
"abstractionkit": "^0.1.13"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ async function main(): Promise<void> {
],
jsonRpcNodeProvider, //the node rpc is used to fetch the current nonce and fetch gas prices.
bundlerUrl, //the bundler rpc is used to estimate the gas limits.
//uncomment the following values for polygon or any chains where
//gas prices change rapidly
//{
// maxFeePerGasPercentageMultiplier:130,
// maxPriorityFeePerGasPercentageMultiplier:130
//}
)

const cost = calculateUserOperationMaxGasCost(userOperation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"dependencies": {
"dotenv": "^16.3.1",
"typescript": "^5.1.6",
"abstractionkit": "^0.1.8"
"abstractionkit": "^0.1.13"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ async function main(): Promise<void> {
jsonRpcNodeProvider, //the node rpc is used to fetch the current nonce and fetch gas prices.
bundlerUrl, //the bundler rpc is used to estimate the gas limits.
{
numberOfSigners:2 // set the number of signers for accurate gas estimation
}
numberOfSigners:2, // set the number of signers for accurate gas estimation
//uncomment the following values for polygon or any chains where
//gas prices change rapidly
// maxFeePerGasPercentageMultiplier:130,
// maxPriorityFeePerGasPercentageMultiplier:130
}
)

const cost = calculateUserOperationMaxGasCost(userOperation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"dotenv": "^16.3.1",
"ethers": "^6.6.7",
"typescript": "^5.1.6",
"abstractionkit": "^0.1.8"
"abstractionkit": "^0.1.13"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ async function main(): Promise<void> {
],
jsonRpcNodeProvider, //the node rpc is used to fetch the current nonce and fetch gas prices.
bundlerUrl, //the bundler rpc is used to estimate the gas limits.
//uncomment the following values for polygon or any chains where
//gas prices change rapidly
//{
// maxFeePerGasPercentageMultiplier:130,
// maxPriorityFeePerGasPercentageMultiplier:130
//}
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"dotenv": "^16.3.1",
"ethers": "^6.6.7",
"typescript": "^5.1.6",
"abstractionkit": "^0.1.8"
"abstractionkit": "^0.1.13"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ async function main(): Promise<void> {
],
jsonRpcNodeProvider, //the node rpc is used to fetch the current nonce and fetch gas prices.
bundlerUrl, //the bundler rpc is used to estimate the gas limits.
//uncomment the following values for polygon or any chains where
//gas prices change rapidly
//{
// maxFeePerGasPercentageMultiplier:130,
// maxPriorityFeePerGasPercentageMultiplier:130
//}
)

let paymaster: CandidePaymaster = new CandidePaymaster(
Expand Down
2 changes: 1 addition & 1 deletion examples/UsingBundlerRPC/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"license": "MIT",
"dependencies": {
"abstractionkit": "^0.1.8",
"abstractionkit": "^0.1.13",
"typescript": "^5.1.6"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Candidelabs",
"url": "https://candide.dev"
},
"version": "0.1.8",
"version": "0.1.13",
"description": "Account Abstraction 4337 SDK by Candidelabs",
"main": "dist/index.js",
"module": "dist/index.m.js",
Expand Down
3 changes: 2 additions & 1 deletion src/account/Safe/SafeAccountV0_2_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ export class SafeAccountV0_2_0 extends SmartAccount {

const preVerificationGas = BigInt(estimation.preVerificationGas);
const verificationGasLimit =
BigInt(estimation.verificationGasLimit) + BigInt(numberOfSigners) * 20_000n;
BigInt(estimation.verificationGasLimit) +
(BigInt(numberOfSigners) * 30_000n);
const callGasLimit = BigInt(estimation.callGasLimit);

return [preVerificationGas, verificationGasLimit, callGasLimit];
Expand Down

0 comments on commit 33af6d6

Please sign in to comment.