Skip to content

Commit

Permalink
Apply userop timeout based on client options (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFirekeeper authored Feb 12, 2025
1 parent bee1518 commit 6b4afc1
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -798,11 +798,22 @@ private async Task<string> SendUserOp(object userOperation, int? requestId = nul
// Wait for the transaction to be mined

string txHash = null;
while (txHash == null)
using var ct = new CancellationTokenSource(this.Client.FetchTimeoutOptions.GetTimeout(TimeoutType.Other));
try
{
while (txHash == null)
{
ct.Token.ThrowIfCancellationRequested();

var userOpReceipt = await BundlerClient.EthGetUserOperationReceipt(this.Client, this._bundlerUrl, requestId, userOpHash).ConfigureAwait(false);

txHash = userOpReceipt?.Receipt?.TransactionHash;
await ThirdwebTask.Delay(100, ct.Token).ConfigureAwait(false);
}
}
catch (OperationCanceledException)
{
var userOpReceipt = await BundlerClient.EthGetUserOperationReceipt(this.Client, this._bundlerUrl, requestId, userOpHash).ConfigureAwait(false);
txHash = userOpReceipt?.Receipt?.TransactionHash;
await ThirdwebTask.Delay(100).ConfigureAwait(false);
throw new Exception($"User operation timed out with user op hash: {userOpHash}");
}

this.IsDeploying = false;
Expand Down

0 comments on commit 6b4afc1

Please sign in to comment.