For the complete documentation index, see llms.txt. This page is also available as Markdown.

AugustSubAccounts

SDK Reference / 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

Parameters

Parameter
Type

baseConfig

IAugustBase

Returns

AugustSubAccounts

Overrides

AugustBase.constructor

Properties

Property
Modifier
Type
Description
Inherited from

activeNetwork?

public

IActiveNetwork

-

AugustBase.activeNetwork

appName

public

string

Validated app-name slug from the constructor.

AugustBase.appName

authorized

public

boolean

-

AugustBase.authorized

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

getAllSubaccounts()

getAllSubaccounts(options): Promise<IWSSubaccountListItem[]>

Retrieves one page of the directory of all August subaccounts.

Backed by the admin-only GET /subaccount backend endpoint, so the August API key configured on the SDK must belong to an admin user — non-admin keys are rejected with an auth error by the backend. Makes exactly one HTTP request and no RPC calls.

Parameters

Parameter
Type
Description

options

{ limit?: number; offset?: number; }

Pagination window over the subaccount directory

options.limit?

number

Page size. Defaults to 100; must be an integer between 1 and 1000 (backend maximum).

options.offset?

number

Number of records to skip. Defaults to 0; must be a non-negative integer.

Returns

Promise<IWSSubaccountListItem[]>

The page of subaccount records (address, internal/friendly names, status, type, linked chains, risk metadata). An empty array means the offset is past the end of the directory.

Throws

AugustValidationError when offset or limit is out of range

Throws

AugustAuthError when the API key is missing or not admin-scoped

Example

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

getSubaccountDebank()

getSubaccountDebank(subaccountAddress): Promise<ISubaccountDebank>

Retrieves cross-chain DeBank protocol positions and token balances for a subaccount and its associated strategies.

Backed by GET /subaccount/{subaccount_address}/debank (300-second server-side cache). This is a slow endpoint — it fans out to DeBank across every supported chain — so expect higher latency than other subaccount reads. Makes exactly one HTTP request and no RPC calls.

Parameters

Parameter
Type
Description

subaccountAddress

`0x${string}`

The address of the subaccount to query

Returns

Promise<ISubaccountDebank>

The subaccount's DeBank positions/tokens plus per-strategy breakdowns

Throws

AugustValidationError When subaccountAddress is not a valid EVM address

Throws

AugustServerError When the API responds with a non-2xx status

Example

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

getSubaccountLoanByAddress()

getSubaccountLoanByAddress(loanAddress, chainId): Promise<ILoanBookInfo>

Retrieves the full loan-book detail for a single loan by its address and chain.

Backed by the admin-only GET /subaccount/loans/{loan_address} backend endpoint (60-second server-side cache), so the configured August API key must belong to an admin user. Makes exactly one HTTP request and no RPC calls.

Parameters

Parameter
Type
Description

loanAddress

string

The loan contract address

chainId

number

Numeric August chain id the loan lives on (e.g. 1 for Ethereum mainnet)

Returns

Promise<ILoanBookInfo>

The loan's ILoanBookInfo detail

Throws

AugustValidationError When chainId is not an integer

Throws

AugustAuthError When the API key is missing or not admin-scoped

Throws

AugustServerError When the loan or chain is not found, or the API otherwise responds non-2xx

Example

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

getSubaccountTransactions()

getSubaccountTransactions(subaccountAddress, options): Promise<ISubaccountTransaction[]>

Retrieves a subaccount's on-chain transaction history, newest first, optionally windowed by a time range.

Backed by the authenticated GET /transactions/v2 backend endpoint, which resolves and authorizes the subaccount, so the configured August API key must be authorized for it (an admin-scoped key always is). Makes exactly one HTTP request and no RPC calls.

Parameters

Parameter
Type
Description

subaccountAddress

`0x${string}`

The address of the subaccount to query

options

{ endTime?: string; startTime?: string; }

Optional time window

options.endTime?

string

ISO-8601 datetime upper bound (inclusive); omit for no upper bound

options.startTime?

string

ISO-8601 datetime lower bound (inclusive); omit for no lower bound

Returns

Promise<ISubaccountTransaction[]>

The subaccount's transactions with decoded logs, transfers, and function names

Throws

AugustValidationError When subaccountAddress is not a valid EVM address

Throws

AugustAuthError When the API key is missing or not authorized for the subaccount

Throws

AugustServerError When the API responds with a non-2xx status

Example

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

Last updated