diff --git a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs index 8bdf1c8..7cc926a 100644 --- a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs @@ -798,11 +798,22 @@ private async Task 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;