Skip to content

Commit 08ace58

Browse files
authored
UserOp simulation support with new Account.sol release (#102)
1 parent 2312475 commit 08ace58

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Assets/Thirdweb/Core/Scripts/AccountAbstraction/Core/SmartWallet.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,13 @@ private async Task<RpcResponseMessage> CreateUserOpAndSend(RpcRequestMessage req
164164
partialUserOp.PreVerificationGas = partialUserOp.CalcPreVerificationGas();
165165
var partialUserOpHexified = partialUserOp.EncodeUserOperation();
166166

167-
// Update paymaster data if any
167+
// Update gas estimates and paymaster data if any
168168

169+
var gasEstimates = await BundlerClient.EthEstimateUserOperationGas(Config.bundlerUrl, apiKey, requestMessage.Id, partialUserOpHexified, Config.entryPointAddress);
170+
171+
partialUserOp.PreVerificationGas = new HexBigInteger(gasEstimates.PreVerificationGas).Value;
172+
partialUserOp.CallGasLimit = new HexBigInteger(gasEstimates.CallGasLimit).Value;
173+
partialUserOp.VerificationGasLimit = new HexBigInteger(gasEstimates.VerificationGas).Value;
169174
partialUserOp.PaymasterAndData = await GetPaymasterAndData(requestMessage.Id, partialUserOpHexified, apiKey);
170175

171176
// Hash, sign and encode the user operation

0 commit comments

Comments
 (0)