> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zyf.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# waitForWithdrawComplete

> Long poll through async cooldown until withdraw lifecycle is completed.

Polls [`getWithdrawStatus`](/docs/sdk/api/get-withdraw-status) until `status === "completed"`. Use after [`waitForWithdrawSettlement`](/docs/sdk/api/wait-for-withdraw-settlement) returns `async_cooldown` or `async_claiming`, or when you want one call that covers sync redeem, async cooldown, and claim.

During `async_cooldown`, the default poll interval is **60 seconds** (override with `cooldownIntervalMs`). Other stages use the same fast intervals as [`waitForWithdrawSettlement`](/docs/sdk/api/wait-for-withdraw-settlement).

The absolute deadline extends when `estimatedClaimAt` appears on the lifecycle (up to that time plus **6 hours** grace). Pass `timeoutMs` to pin a fixed window from the start of the poll.

Requires `connectAccount()` on the **same** `ZyfaiSDK` instance.

## Signature

```typescript theme={null}
waitForWithdrawComplete(
  withdrawalId: string,
  chainId: SupportedChainId,
  options?: WaitForWithdrawCompleteOptions,
): Promise<WithdrawLifecycleResponse>
```

## Parameters

| Parameter | Type | Required | Description |
| - | - | :-: | - |
| `withdrawalId` | `string` | ✅ | Lifecycle UUID from `withdrawFunds().lifecycle.id` |
| `chainId` | `SupportedChainId` | ✅ | Chain withdrawn on (`1`, `8453`, or `42161`) |
| `options` | `WaitForWithdrawCompleteOptions` | ❌ | Poll and deadline overrides |

```typescript theme={null}
interface WaitForWithdrawCompleteOptions {
  intervalMs?: number;           // fast stages; default chain-specific
  timeoutMs?: number;            // fixed deadline from poll start when set
  cooldownIntervalMs?: number;   // default 60000 during async_cooldown
}
```

Default fallback deadline (when `timeoutMs` is omitted): chain short-settlement timeout plus 6 hours grace, extended by `estimatedClaimAt + 6 hours` when the API provides a claim estimate.

## Errors

| Condition | Error |
| - | - |
| `status === "failed"` | `Withdraw {id} failed: {lastError}` |
| Deadline elapsed | `Timed out waiting for withdraw lifecycle {id} to complete` (`WithdrawCompleteTimeoutError`) |

## Example

```typescript theme={null}
const withdrawn = await sdk.withdrawFunds(userAddress, 8453, undefined, "NVDAc");
const withdrawalId = withdrawn.lifecycle!.id;

const completed = await sdk.waitForWithdrawComplete(withdrawalId, 8453);
console.log(completed.status); // "completed"
```

For mixed sync + async withdrawals, settlement and completion can be split:

```typescript theme={null}
const settled = await sdk.waitForWithdrawSettlement(withdrawalId, 8453);

if (settled.status !== "completed") {
  await sdk.waitForWithdrawComplete(withdrawalId, 8453);
}
```

## Related methods

* [`waitForWithdrawSettlement`](/docs/sdk/api/wait-for-withdraw-settlement) — short poll first
* [`withdrawFunds`](/docs/sdk/api/withdraw-funds) — delayed async pools and `pendingAsyncWithdrawals`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.