> ## 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.

# waitForDepositPosition

> Await deposit allocation after credit (rebalance into a position or skipped).

Polls [`getDepositStatus`](/docs/sdk/api/get-deposit-status) until the deposit reaches a terminal allocation state. Call this **after** [`waitForDepositCredit`](/docs/sdk/api/wait-for-deposit-credit) when your UI needs to know that rebalance into a protocol position finished (or was skipped).

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

## Signature

```typescript theme={null}
waitForDepositPosition(
  depositId: string,
  chainId: SupportedChainId,
  options?: WaitForDepositPositionOptions,
): Promise<DepositLifecycleResponse>
```

## Parameters

| Parameter | Type | Required | Description |
| - | - | :-: | - |
| `depositId` | `string` | ✅ | Lifecycle UUID from `logDeposit().deposit.id` or `sendDeposit().registration.id` |
| `chainId` | `SupportedChainId` | ✅ | Chain the deposit was registered on (`1`, `8453`, or `42161`) — selects default poll interval and timeout |
| `options` | `WaitForDepositPositionOptions` | ❌ | Poll interval and timeout overrides |

```typescript theme={null}
interface WaitForDepositPositionOptions {
  intervalMs?: number;  // default: chain-specific (see below)
  timeoutMs?: number;   // default: chain-specific (see below)
}
```

Default polling by chain:

| Chain | `intervalMs` | `timeoutMs` |
| - | - | - |
| Ethereum (`1`) | 4000 ms | 180000 ms (3 minutes) |
| Base (`8453`) | 1000 ms | 90000 ms (1.5 minutes) |
| Arbitrum (`42161`) | 1000 ms | 90000 ms (1.5 minutes) |

## When it resolves

| Condition | Meaning |
| - | - |
| `status === "positioned"` | Funds allocated to a protocol position on the registration chain |
| `positionOutcome === "skipped"` | Credit completed but allocation was skipped (for example below minimum deploy) |
| `crosschain === true` and `executionTxHash` set | Crosschain deposit: bridge transaction recorded. **Destination-chain allocation is not tracked on this lifecycle.** |

Credit alone is not enough: the first poll after [`waitForDepositCredit`](/docs/sdk/api/wait-for-deposit-credit) may already show `position_pending` or `positioned`.

## Errors

| Condition | Error |
| - | - |
| `positionOutcome === "failed"` | `Deposit {id} position allocation failed (status=…)` |
| `status === "recovered_to_eoa"` | `Deposit {id} recovered to EOA; position was not opened` |
| Timeout | `Timed out waiting for deposit {id} to reach a position` (`DepositPositionTimeoutError`) |
| Poll failure | Original error from `getDepositStatus` |

## Example

```typescript theme={null}
const sent = await sdk.sendDeposit(userAddress, 8453, "100000000", "USDC");

await sdk.waitForDepositCredit(sent.registration.id, 8453);

const positioned = await sdk.waitForDepositPosition(
  sent.registration.id,
  8453,
);

console.log(positioned.status, positioned.positionOutcome);
```

## Related methods

* [`waitForDepositCredit`](/docs/sdk/api/wait-for-deposit-credit) — wait until the Safe balance is credited
* [`getDepositStatus`](/docs/sdk/api/get-deposit-status) — single status fetch


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