UpshiftDocs

AugustSubAccounts

API reference for the AugustSubAccounts class — querying subaccount summaries, positions, loans, transactions, and health factors.

The Upshift Sub Accounts Module.

Classes

AugustSubAccounts

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

Extends: AugustBase

Constructor

new AugustSubAccounts(baseConfig): AugustSubAccounts

Parameters

ParameterType
baseConfigIAugustBase

Returns

AugustSubAccounts

Overrides

AugustBase.constructor

Properties

PropertyModifierTypeDescriptionInherited from
activeNetwork?publicIActiveNetwork-AugustBase.activeNetwork
appNamepublicstringValidated app-name slug from the constructor.AugustBase.appName
authorizedpublicboolean-AugustBase.authorized
keyspublicIKeys-AugustBase.keys
monitoringpublicIMonitoring-AugustBase.monitoring
providerspublicIProvidersConfig-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 Upshift subaccounts.

Backed by the admin-only GET /subaccount backend endpoint, so the Upshift 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

ParameterTypeDescription
options{ limit?: number; offset?: number }Pagination window over the subaccount directory
options.limit?numberPage size. Defaults to 100; must be an integer between 1 and 1000 (backend maximum).
options.offset?numberNumber 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

const page = await augustSdk.subAccountsModule.getAllSubaccounts({
    offset: 0,
    limit: 200,
  });
  console.log(page.map((s) => `${s.internal_name}: ${s.address}`));
getSubaccountCefiPositions()

getSubaccountCefiPositions(subaccountAddress): Promise<IWSSubaccountCefi[]>

Retrieves CeFi (Centralized Finance) positions for a subaccount.

Parameters

ParameterTypeDescription
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

ParameterTypeDescription
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

const debank = await augustSdk.subAccountsModule.getSubaccountDebank('0xabc…');
  console.log(debank.subaccount.positions.length);
getSubaccountHealthFactor()

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

Retrieves the health factor for a subaccount.

Parameters

ParameterTypeDescription
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 Upshift API key must belong to an admin user. Makes exactly one HTTP request and no RPC calls.

Parameters

ParameterTypeDescription
loanAddressstringThe loan contract address
chainIdnumberNumeric Upshift 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

const loan = await augustSdk.subAccountsModule.getSubaccountLoanByAddress(
    '0xloan…',
    1,
  );
getSubaccountLoans()

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

Retrieves loan positions for a subaccount.

Parameters

ParameterTypeDescription
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
activebooleanWhen 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

ParameterTypeDescription
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

ParameterTypeDescription
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 Upshift API key must be authorized for it (an admin-scoped key always is). Makes exactly one HTTP request and no RPC calls.

Parameters

ParameterTypeDescription
subaccountAddress`0x${string}`The address of the subaccount to query
options{ endTime?: string; startTime?: string }Optional time window
options.endTime?stringISO-8601 datetime upper bound (inclusive); omit for no upper bound
options.startTime?stringISO-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

const txs = await augustSdk.subAccountsModule.getSubaccountTransactions(
    '0xabc…',
    { startTime: '2026-01-01T00:00:00Z' },
  );
init()

init(): Promise<void>

Verify API keys and authorize SDK usage.

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

ParameterType
chainIdnumber

Returns

void

Inherited from

AugustBase.switchNetwork

updateWallet()

updateWallet(address): void

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

Parameters

ParameterType
address`0x${string}`

Returns

void

Inherited from

AugustBase.updateWallet