# Deposit

Create and list per-account chain deposit addresses for funding your Polyester account.

`client.deposit` manages the chain addresses you deposit into. Every method is authenticated and account-scoped, so each input accepts an optional `account` field (`"main"`, `"active"`, or `{ subaccountId }`). See [Account scoping](https://testnet.polyester.com/docs/sdk/typescript/guides/accounts-and-balances) for how the default resolves.

Deposit addresses are per-account and per-chain: each root account or subaccount gets its own address on a given chain. Creating an address is idempotent, so it returns the existing address if one is already assigned.

## Methods

| Method          | Summary                                               |
| --------------- | ----------------------------------------------------- |
| `createAddress` | Create or return the deposit address for a chain.     |
| `listAddresses` | List deposit addresses, optionally filtered by chain. |

### `createAddress(input, options?)`

The root account must have accepted the current terms. Use [`client.auth.acceptTerms()`](https://testnet.polyester.com/docs/sdk/typescript/reference/auth#accepttermsoptions) from an interactive JWT session after the user agrees. Missing acceptance produces the typed auth detail `AUTH_TERMS_NOT_ACCEPTED`.

Creates the deposit address for the account scope on a given chain, or returns the existing one. Resolves to a `DepositAddress`, or `null` if the backend does not return an address.

```ts
const address = await client.deposit.createAddress({ chainId: 1 });

if (address) {
	console.log(address.chainId, address.depositAddress);
}
```

#### `CreateDepositAddressInput`

| Field     | Type           | Required | Notes                                 |
| --------- | -------------- | -------- | ------------------------------------- |
| `chainId` | `number`       | yes      | Integer from 1 through 4,294,967,295. |
| `account` | `AccountScope` | no       | Scope override.                       |

### `listAddresses(input?, options?)`

Returns a `DepositAddress[]` for the account scope. Input is optional; pass `chainId` to filter to a single chain, or `account` to override the default.

```ts
// All chains
const all = await client.deposit.listAddresses();

// One chain
const [eth] = await client.deposit.listAddresses({ chainId: 1 });
```

#### `DepositAddress`

```ts
interface DepositAddress {
	chainId: number;
	depositAddress: string;
}
```

Results are ordered by ascending chain id.

## Related

- [Deposits and withdrawals guide](https://testnet.polyester.com/docs/sdk/typescript/guides/deposits-and-withdrawals) for the end-to-end funding walkthrough.
- [Lifecycle](https://testnet.polyester.com/docs/sdk/typescript/reference/lifecycle) for tracking a deposit as it confirms on chain and lands in your ledger.
- [Balances](https://testnet.polyester.com/docs/sdk/typescript/reference/balances) to see the credited funds.
- [Withdrawals](https://testnet.polyester.com/docs/sdk/typescript/reference/withdrawals) for moving funds back out.
