Skip to content
markpaper

src/account/index.ts

v0.3.0 · 2 KB

Download file
// Account module: balances, equity, positions, fees, agents, roles and sub-accounts.
// Reads go through the InfoRequester contract; everything else is pure.

export { HlAccountError } from './errors.js';
export type { HlAccountErrorCode } from './errors.js';

export { isAddress, normalizeAddress } from './address.js';
export type { Address } from './address.js';

export type { AccountCallOptions } from './call.js';

export type {
  AccountSnapshot,
  ClearinghouseStateRaw,
  LeverageRaw,
  MarginSummaryRaw,
  PerpDexState,
  PositionRaw,
  SpotBalanceRaw,
  SpotClearinghouseStateRaw,
  SpotRead,
} from './types.js';

export { fetchAccountSnapshot, fetchPerpDexNames } from './snapshot.js';
export type { FetchAccountSnapshotOptions } from './snapshot.js';

export { DEFAULT_STABLES, EQUITY_FORMULA_VERSION, computeEquity, equityBasis, isBasisComparable } from './equity.js';
export type { ComputeEquityOptions, DexEquity, EquityBreakdown, StableBalance } from './equity.js';

export { aggregateRoe, listZeroSizePositions, normalizePositions, roeFromMark } from './positions.js';
export type { NormalizedPosition } from './positions.js';

export {
  createEquitySmoother,
  createLastGoodCache,
  isEquityImplausible,
  ledgerExplainsDrop,
  median,
} from './reliability.js';
export type {
  EquityReading,
  EquitySmoother,
  ImplausibilityOptions,
  LastGoodCache,
  LastGoodInput,
  LastGoodResult,
  LedgerEntry,
} from './reliability.js';

export { fetchUserFees, parseUserFees } from './fees.js';
export type { UserFees } from './fees.js';

export {
  AGENT_LIMITS,
  checkAgentApproval,
  fetchAgents,
  isAbstractionTransitionNotAllowedError,
  isAgentActive,
  isAgentNotFoundError,
  isUnifiedAccountActionDisabledError,
} from './agents.js';
export type { AgentApproval, AgentApprovalReason, AgentInfo } from './agents.js';

export {
  fetchSubAccounts,
  fetchUserAbstraction,
  fetchUserRole,
  parseUserRole,
  resolveTradingAccount,
} from './roles.js';
export type { SubAccountInfo, TradingAccountResolution, UserAbstraction, UserRole, UserRoleInfo } from './roles.js';
All files