# AugustSubAccounts

[SDK Reference](/developers/typescript-sdk/api.md) / AugustSubAccounts

## AugustSubAccounts

The August Sub Accounts Module.

### Classes

#### AugustSubAccounts

Subaccount operation class interacting with August Subaccounts Subaccount is a smart contract wallet that serves as the fundamental infrastructure for August's platform. It functions as a cross-margin account designed for optimal capital efficiency. Most of the operations require a August API key to perform

**Extends**

* `AugustBase`

**Constructors**

**Constructor**

> **new AugustSubAccounts**(`baseConfig`): [`AugustSubAccounts`](#augustsubaccounts)

**Parameters**

| Parameter    | Type          |
| ------------ | ------------- |
| `baseConfig` | `IAugustBase` |

**Returns**

[`AugustSubAccounts`](#augustsubaccounts)

**Overrides**

`AugustBase.constructor`

**Properties**

| Property         | Modifier | Type               | Description                                           | Inherited from             |
| ---------------- | -------- | ------------------ | ----------------------------------------------------- | -------------------------- |
| `activeNetwork?` | `public` | `IActiveNetwork`   | -                                                     | `AugustBase.activeNetwork` |
| `authorized`     | `public` | `boolean`          | -                                                     | `AugustBase.authorized`    |
| `appName`        | `public` | `string`           | Validated integrator identifier from the constructor. | `AugustBase.appName`       |
| `keys`           | `public` | `IKeys`            | -                                                     | `AugustBase.keys`          |
| `monitoring`     | `public` | `IMonitoring`      | -                                                     | `AugustBase.monitoring`    |
| `providers`      | `public` | `IProvidersConfig` | -                                                     | `AugustBase.providers`     |

**Methods**

**clearWallet()**

> **clearWallet**(): `void`

Remove wallet address from SDK state and monitoring headers.

**Returns**

`void`

**Inherited from**

`AugustBase.clearWallet`

**getSubaccountCefiPositions()**

> **getSubaccountCefiPositions**(`subaccountAddress`): `Promise`<`IWSSubaccountCefi`\[]>

Retrieves CeFi (Centralized Finance) positions for a subaccount.

**Parameters**

| Parameter           | Type                | Description                            |
| ------------------- | ------------------- | -------------------------------------- |
| `subaccountAddress` | `` `0x${string}` `` | The address of the subaccount to query |

**Returns**

`Promise`<`IWSSubaccountCefi`\[]>

List of CeFi positions held by the subaccount

**getSubaccountHealthFactor()**

> **getSubaccountHealthFactor**(`subaccountAddress`): `Promise`<{ `dateTime`: `string`; `healthFactor`: `number`; `id`: `` `0x${string}` ``; `totalCollateral`: `number`; `totalLoan`: `number`; }>

Retrieves the health factor for a subaccount.

**Parameters**

| Parameter           | Type                | Description                            |
| ------------------- | ------------------- | -------------------------------------- |
| `subaccountAddress` | `` `0x${string}` `` | The address of the subaccount to query |

**Returns**

`Promise`<{ `dateTime`: `string`; `healthFactor`: `number`; `id`: `` `0x${string}` ``; `totalCollateral`: `number`; `totalLoan`: `number`; }>

The health factor data including collateral value, loan value, and health factor ratio

**getSubaccountLoans()**

> **getSubaccountLoans**(`subaccountAddress`, `side`, `active`): `Promise`<`IWSSubaccountLoan`\[]>

Retrieves loan positions for a subaccount.

**Parameters**

| Parameter           | Type                                   | Description                                                                                               |
| ------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `subaccountAddress` | `` `0x${string}` ``                    | The address of the subaccount to query                                                                    |
| `side`              | `"BORROWER"` \| `"LENDER"` \| `"BOTH"` | Filter by loan side: 'BOTH' for all loans, 'LENDER' for lent positions, 'BORROWER' for borrowed positions |
| `active`            | `boolean`                              | When true, returns only active loans; when false, returns all loans including closed ones                 |

**Returns**

`Promise`<`IWSSubaccountLoan`\[]>

List of loan positions matching the specified filters

**getSubaccountOtcPositions()**

> **getSubaccountOtcPositions**(`subaccountAddress`): `Promise`<`IOTCPosition`\[]>

Retrieves OTC (Over-The-Counter) positions for a subaccount.

**Parameters**

| Parameter           | Type                | Description                            |
| ------------------- | ------------------- | -------------------------------------- |
| `subaccountAddress` | `` `0x${string}` `` | The address of the subaccount to query |

**Returns**

`Promise`<`IOTCPosition`\[]>

List of OTC positions held by the subaccount

**getSubaccountSummary()**

> **getSubaccountSummary**(`subaccountAddress`): `Promise`<{ `address`: `` `0x${string}` ``; `chains`: `object`\[]; `healthFactor`: `number`; `loanbook`: { `aggregatesByToken`: `unknown`\[]; `loans`: `object`\[]; `totalCredit`: `number`; `totalDebt`: `number`; }; `name`: `string`; `netAccountValue`: `number`; `portfolio`: { `cefiPositions`: `unknown`\[]; `collateralBalances`: `unknown`\[]; `defiPositions`: `unknown`\[]; `discountedValue`: `number`; `legacyHedgerPositions`: `unknown`\[]; `marginBalances`: `unknown`\[]; `otcPositions`: `unknown`\[]; `strategyContractPositions`: `unknown`\[]; `tokens`: `object`\[]; `totalValue`: `number`; `trsPositions`: `unknown`\[]; }; `tokens`: `object`\[]; `totalAccountValue`: `number`; `totalCollateralValue`: `number`; `totalEquityValue`: `number`; `totalLoanValue`: `number`; `type`: `"eoa"` | `"subaccount"`; }>

Retrieves the summary view for a subaccount or EOA operator.

**Parameters**

| Parameter           | Type                | Description                            |
| ------------------- | ------------------- | -------------------------------------- |
| `subaccountAddress` | `` `0x${string}` `` | The address of the subaccount to query |

**Returns**

`Promise`<{ `address`: `` `0x${string}` ``; `chains`: `object`\[]; `healthFactor`: `number`; `loanbook`: { `aggregatesByToken`: `unknown`\[]; `loans`: `object`\[]; `totalCredit`: `number`; `totalDebt`: `number`; }; `name`: `string`; `netAccountValue`: `number`; `portfolio`: { `cefiPositions`: `unknown`\[]; `collateralBalances`: `unknown`\[]; `defiPositions`: `unknown`\[]; `discountedValue`: `number`; `legacyHedgerPositions`: `unknown`\[]; `marginBalances`: `unknown`\[]; `otcPositions`: `unknown`\[]; `strategyContractPositions`: `unknown`\[]; `tokens`: `object`\[]; `totalValue`: `number`; `trsPositions`: `unknown`\[]; }; `tokens`: `object`\[]; `totalAccountValue`: `number`; `totalCollateralValue`: `number`; `totalEquityValue`: `number`; `totalLoanValue`: `number`; `type`: `"eoa"` | `"subaccount"`; }>

The full summary including portfolio, loanbook, tokens, and account values

**init()**

> **init**(): `Promise`<`void`>

Verify API keys and authorize SDK usage. TODO: initialize class with appropriate keys and verify august key

**Returns**

`Promise`<`void`>

**Inherited from**

`AugustBase.init`

**switchNetwork()**

> **switchNetwork**(`chainId`): `void`

Switch the active blockchain network. Updates both chain ID and RPC URL for subsequent operations.

**Parameters**

| Parameter | Type     |
| --------- | -------- |
| `chainId` | `number` |

**Returns**

`void`

**Inherited from**

`AugustBase.switchNetwork`

**updateWallet()**

> **updateWallet**(`address`): `void`

Set active wallet address and update monitoring headers. Preserves existing environment setting.

**Parameters**

| Parameter | Type                |
| --------- | ------------------- |
| `address` | `` `0x${string}` `` |

**Returns**

`void`

**Inherited from**

`AugustBase.updateWallet`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augustdigital.io/developers/typescript-sdk/api/augustsubaccounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
