> ## 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](/integration/testnet-sandbox) (`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 element to mount the iframe overlay into.                                                                                                                                                                                                                                                                                                        |
| `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. |
| `debug`            | `boolean`                   | `false`                       | Log lifecycle events to `console.debug` with the `[BlinkDeposit]` prefix.                                                                                                                                                                                                                                                                            |

## Methods

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

See [Types](/sdk-reference/types) for `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](/sdk-reference/events).

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

### 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'`).
