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

# Deposit Class

> API reference for the Deposit class. The core SDK entry point.

The `Deposit` class is the main entry point for the SDK. It manages the signer call, iframe lifecycle, and completion handling.

```typescript theme={null}
import { Deposit } from '@swype-org/deposit';
```

## Constructor

```typescript theme={null}
new Deposit(config: DepositConfig)
```

Creates a new `Deposit` instance. Throws a `DepositError` with code `INVALID_REQUEST` if `config.signer` is missing or not a string/function.

### DepositConfig

| Property | Type | Default | Description |
| - | - | - | - |
| `signer` | `string \| SignerFunction` | **required** | URL string for the signer endpoint, or a custom async function. When a string, the SDK sends a `POST` with a JSON `SignerRequest` body. When a function, the SDK calls it with a `SignerRequest` and expects a `Promise<SignerResponse>`. |
| `environment` | `'production' \| 'sandbox'` | `'production'` | Blink environment to target. `'sandbox'` points the hosted flow at the [testnet sandbox](https://docs.blink.cash/integration/testnet-sandbox.md) (`https://pay-sandbox.blink.cash`). An explicit `webviewBaseUrl` takes precedence. |
| `webviewBaseUrl` | `string` | `'https://pay.blink.cash'` | Base URL of the hosted payment webview app. The SDK appends `merchantId`, `payload`, and `signature` as query parameters. Overrides `environment` when set. |
| `hostedFlowOrigin` | `string` | Derived from `webviewBaseUrl` | Origin for `postMessage` validation. |
| `containerElement` | `HTMLElement` | `document.body` | DOM mount point. Required for embedded presentation, where it must remain a stable, rendered element for the life of the instance. |
| `presentation` | `'overlay' \| 'embedded'` | `'overlay'` | Present the hosted flow as Blink's standard overlay or inline inside `containerElement`. Embedded resolves to overlay on mobile. See [Embed Blink in an aggregator](https://docs.blink.cash/integration/embedded-deposit-sdk.md). |
| `embedMaxHeightPx` | `number` | 90% of host viewport | Embedded only. Caps the inline iframe height and provides the layout budget used by Blink's internal screens. |
| `signerTimeoutMs` | `number` | `15000` | Maximum milliseconds to wait for the signer to respond. |
| `flowTimeoutMs` | `number` | `undefined` (no limit) | Maximum milliseconds for the entire flow (signer + user completion). |
| `enableFullWidget` | `boolean` | `true` | Whether the hosted flow may show the full widget — the deposit options entry screen offering deposit addresses (pay from an exchange or any wallet) alongside Blink one tap. The full widget appears only when this is `true` **and** it is enabled on your Blink merchant account. Set to `false` to send users straight to the Blink one-tap flow. |
| `appearance` | `{ theme?, variables?, hideDepositTitle?: boolean }` | Detected from the page | Color scheme, optional brand colors, and deposit title visibility for the hosted UI. `hideDepositTitle` defaults to `false`; set it to `true` when your container supplies the heading. **More** and other navigation titles remain visible. `variables` accepts `colorPrimary`, `colorBackground`, `colorText`, `colorDanger`, and `colorBorder` as opaque hex. See [Dark and light mode](https://docs.blink.cash/integration/deposit-sdk.md#dark-and-light-mode). |
| `preload` | `boolean` | `true` | Warm a hidden hosted flow after construction so it can appear faster. Set to `false` to defer or disable the background page load. |
| `merchantId` | `string` | `undefined` | Optional preload performance hint used to prefetch merchant configuration. Authorization always comes from the signed signer response. |
| `debug` | `boolean` | `false` | Log lifecycle events to `console.debug` with the `[BlinkDeposit]` prefix. |

> [!NOTE]
>
> `appearance` is read when the instance builds its hosted-flow URLs, including the warm-up iframe created at construction. To change the theme, call `destroy()` and construct a new `Deposit`.

## Methods

### preload

```typescript theme={null}
deposit.preload(): void
```

Warm the hosted flow before the user starts a deposit. The SDK calls this automatically after construction unless `preload: false`. Call it manually when you want to control the timing, such as when a payment widget opens or the user hovers the Blink option.

It is a no-op when a warm iframe already exists or a deposit flow is active.

### requestDeposit

```typescript theme={null}
deposit.requestDeposit(request: DepositRequest): Promise<DepositResult>
```

Opens the hosted deposit flow for the given deposit. The returned Promise resolves when the user completes the payment and rejects with a `DepositError` on failure.

If a flow is already active, calling `requestDeposit` again cancels the previous flow and starts a new one.

Throws `DepositError` with code `INVALID_REQUEST` if the instance has been destroyed.

Pass `minimumDeposit` in the request to raise the minimum deposit in USD. It never lowers Blink's route minimum. See [Minimum deposit](https://docs.blink.cash/integration/deposit-sdk.md#minimum-deposit) for validation and examples, and [Types](https://docs.blink.cash/sdk-reference/types.md) for the full `DepositRequest` and `DepositResult` definitions.

### on

```typescript theme={null}
deposit.on(event: EventName, handler: EventHandler): this
```

Register an event listener. Returns `this` for chaining. See [Events](https://docs.blink.cash/sdk-reference/events.md).

### off

```typescript theme={null}
deposit.off(event: EventName, handler: EventHandler): this
```

Remove a previously registered event listener. Returns `this` for chaining.

### close

```typescript theme={null}
deposit.close(): void
```

Close the transfer iframe without waiting for completion. If a flow is active, its `requestDeposit()` promise rejects with `DEPOSIT_DISMISSED`. The method resets status to `idle` and fires the `close` event.

### destroy

```typescript theme={null}
deposit.destroy(): void
```

Tear down the instance and release all resources. Closes the iframe, removes all event listeners, and marks the instance as destroyed. Subsequent calls to `requestDeposit` will reject with `INVALID_REQUEST`.

Call this on component unmount or page unload.

### focus

```typescript theme={null}
deposit.focus(): void
```

No-op. Retained for API compatibility.

## Properties

### presentation

```typescript theme={null}
deposit.presentation: 'overlay' | 'embedded'
```

The resolved presentation for this instance. It can differ from the requested config because embedded presentation resolves to the overlay on mobile. No `resize` event fires when this value is `'overlay'`.

### status

```typescript theme={null}
deposit.status: DepositStatus
```

Current phase of the deposit flow. One of `'idle'`, `'signer-loading'`, `'iframe-active'`, `'completed'`, or `'error'`.

### result

```typescript theme={null}
deposit.result: DepositResult | null
```

Last successful `DepositResult`, available when `status === 'completed'`.

### error

```typescript theme={null}
deposit.error: DepositError | null
```

Last `DepositError`, available when `status === 'error'`.

### isActive

```typescript theme={null}
deposit.isActive: boolean
```

`true` when a deposit flow is in progress (`status` is `'signer-loading'` or `'iframe-active'`).


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