@augustdigital/sdk 8.22.1 → 8.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,16 @@
1
1
  import { AugustBase, type IAugustBase } from '../../core/base.class';
2
- import type { ICollateralExcessOrDeficit, ICollateralSimulationInput, ICollateralSimulationResults, ICuratorWhitelistStatus, IDiscountFactorLadder, ILoanBookInfo, IOracleClassification, IOtcMarginRequirement, IOtcPositionRead, IRevertReason, ITimelockRequest, IUnrealizedPnlSnapshot, IVaultPerformanceFees, IWSSubaccountListItem } from '../../types';
2
+ import type { ICollateralExcessOrDeficit, ICollateralSimulationInput, ICollateralSimulationResults, ICuratorWhitelistStatus, IDiscountFactorLadder, ILoanBookInfo, IOracleClassification, IOtcMarginRequirement, IOtcPositionRead, IRevertReason, ITimelockRequest, ITransparencyApySeries, ITransparencyAuditCategory, ITransparencyAuditLog, ITransparencyFees, ITransparencyGovernancePermissions, ITransparencyGovernanceRoles, ITransparencyHistoricalAllocations, ITransparencyPositions, ITransparencyRatioPoint, ITransparencyTimelocks, ITransparencyTimelockStatus, IUnrealizedPnlSnapshot, IVaultPerformanceFees, IWSSubaccountListItem } from '../../types';
3
3
  /**
4
4
  * Read-only client for August backend REST endpoints that have no on-chain
5
- * equivalent — currently the unrealized-PnL series the backend computes
6
- * from periodic vault snapshots.
5
+ * equivalent: the unrealized-PnL series, the transparency dashboard
6
+ * (position snapshot, backing series, smoothed APY, allocations, fee config,
7
+ * governance), plus authenticated loan-book / risk / OTC reads.
7
8
  *
8
- * Every method makes exactly one HTTPS request to the public
9
- * (unauthenticated) August API and zero RPC calls. Responses are not cached
10
- * by the SDK: this is time-sensitive PnL state where staleness is worse
11
- * than request latency.
12
- *
13
- * Accessible as `apiModule` on the SDK instance; the same methods are also
14
- * exposed directly on the SDK class.
15
- *
16
- * A subset of methods (loan book, risk) hit authenticated admin-only backend
17
- * endpoints and require an admin-scoped August API key on the SDK
18
- * constructor; each such method documents the requirement.
9
+ * Every public method makes exactly one HTTPS request to the August API and
10
+ * zero RPC calls. Responses are not cached by the SDK: this is time-sensitive
11
+ * state where staleness is worse than a request. Accessible as
12
+ * `sdk.apiModule`; only the unrealized-PnL methods are also mirrored on the
13
+ * root `AugustSDK` class.
19
14
  */
20
15
  export declare class AugustApi extends AugustBase {
21
16
  private headers;
@@ -274,6 +269,285 @@ export declare class AugustApi extends AugustBase {
274
269
  * console.log(cls.warnings);
275
270
  */
276
271
  getVaultOracleClassification(vault: string, chainId: number): Promise<IOracleClassification>;
272
+ /**
273
+ * Fetch the latest position snapshot for a vault, grouped per wallet — the
274
+ * data behind the transparency Overview tab (strategy breakdown, backing
275
+ * composition, vault buffer, per-wallet table, headline TVL).
276
+ *
277
+ * Public `GET /upshift/positions/{vault_address}`; no API key. One HTTPS
278
+ * request, no RPC. Snapshots land hourly; every field is from the single
279
+ * `snapshot_at` instant. Vault buffer = `total_nav − Σ subaccounts[].total_usd`;
280
+ * `reported_tvl` is the vault-contract-reported total assets from the same snapshot.
281
+ *
282
+ * @param params.vault EVM vault address.
283
+ * @param params.chainId Numeric chain id the vault lives on.
284
+ * @returns {@link ITransparencyPositions}.
285
+ * @throws AugustValidationError When arguments fail validation (no request is made).
286
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
287
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
288
+ * @throws AugustRateLimitError When the API responds 429.
289
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
290
+ * @example
291
+ * ```ts
292
+ * const p = await sdk.apiModule.getVaultPositionSnapshot({ vault: '0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA', chainId: 143 });
293
+ * const buffer = p.total_nav - p.subaccounts.reduce((a, s) => a + s.total_usd, 0);
294
+ * ```
295
+ */
296
+ getVaultPositionSnapshot(params: {
297
+ vault: string;
298
+ chainId: number;
299
+ }): Promise<ITransparencyPositions>;
300
+ /**
301
+ * Fetch the backing / supply / collateral-ratio time series behind the
302
+ * Performance tab's "Backing vs Supply" and "Collateral Ratio" charts, and
303
+ * the Overview sidebar's 7-day deltas.
304
+ *
305
+ * Public `GET /upshift/unrealized_pnl?fields=ratio`; no API key. One HTTPS
306
+ * request, no RPC. Points are hourly, returned newest-first — sort before
307
+ * charting. `actual_tvl` = backing (mark-to-market), `tvl_on_vault` = supply
308
+ * (vault-reported), `adjusted_redeem_ratio` = collateral ratio.
309
+ *
310
+ * Unlike the chain-scoped transparency endpoints (positions, fees,
311
+ * governance…), this one is keyed by vault address only and accepts
312
+ * non-EVM (Solana / Stellar) vaults — same contract as
313
+ * {@link AugustApi.getVaultUnrealizedPnlHistory}, which it shares a route with.
314
+ *
315
+ * @param params.vault Vault address (EVM, Solana, or Stellar).
316
+ * @param params.startDate Optional inclusive lower bound, `YYYY-MM-DD`.
317
+ * @param params.endDate Optional inclusive upper bound, `YYYY-MM-DD`.
318
+ * @param params.limit Optional max points.
319
+ * @returns Array of {@link ITransparencyRatioPoint}; empty when no history.
320
+ * @throws AugustValidationError When arguments fail validation (no request is made).
321
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
322
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
323
+ * @throws AugustRateLimitError When the API responds 429.
324
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
325
+ * @example
326
+ * ```ts
327
+ * const pts = await sdk.apiModule.getVaultBackingSeries({ vault, startDate: '2026-08-01' });
328
+ * const ratio = pts.map((p) => p.adjusted_redeem_ratio * 100); // percent
329
+ * ```
330
+ */
331
+ getVaultBackingSeries(params: {
332
+ vault: string;
333
+ startDate?: string;
334
+ endDate?: string;
335
+ limit?: number;
336
+ }): Promise<ITransparencyRatioPoint[]>;
337
+ /**
338
+ * Fetch the smoothed 7-day APY series — the exact series the Upshift app
339
+ * charts (Overview "APY last 30 days" and Performance "APY Over Time").
340
+ *
341
+ * Public `GET /upshift/historical_apy/chart`; no API key. One HTTPS request,
342
+ * no RPC. The backend marks this route deprecated in its OpenAPI spec but it
343
+ * remains the series the Upshift app itself charts; this wrapper tracks it.
344
+ * The backend applies a rolling-median/mean smoothing filter server-side
345
+ * when `applySmoothing` is true (the app default); computing APY locally from
346
+ * raw share ratios will NOT match the published figures.
347
+ *
348
+ * Unlike the chain-scoped transparency endpoints (positions, fees,
349
+ * governance…), this one is keyed by vault address only and accepts
350
+ * non-EVM (Solana / Stellar) vaults.
351
+ *
352
+ * @param params.vault Vault address (EVM, Solana, or Stellar).
353
+ * @param params.daysAgo Window length in days; pass `-1` for the full history since inception. Default 30.
354
+ * @param params.averagingPeriodDays Rolling window for the annualized return; must be ≥ 2. Default 7 (the app's "7D APY").
355
+ * @param params.applySmoothing Apply the backend smoothing filter. Default true.
356
+ * @returns {@link ITransparencyApySeries} — `labels` are `M/D/YYYY`, `values` are decimal fractions (0.0245 = 2.45%). Empty arrays when the vault has no data.
357
+ * @throws AugustValidationError When arguments fail validation (no request is made).
358
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
359
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
360
+ * @throws AugustRateLimitError When the API responds 429.
361
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
362
+ * @example
363
+ * ```ts
364
+ * const apy = await sdk.apiModule.getVaultSmoothedApy({ vault, daysAgo: 30 });
365
+ * console.log(apy.values.at(-1)); // latest 7D APY as a fraction
366
+ * ```
367
+ */
368
+ getVaultSmoothedApy(params: {
369
+ vault: string;
370
+ daysAgo?: number;
371
+ averagingPeriodDays?: number;
372
+ applySmoothing?: boolean;
373
+ }): Promise<ITransparencyApySeries>;
374
+ /**
375
+ * Fetch daily allocation history per protocol — the Performance tab's
376
+ * "Allocation Over Time" chart.
377
+ *
378
+ * Public `GET /upshift/historical_allocations/{vault_address}`; no API key.
379
+ * One HTTPS request, no RPC.
380
+ *
381
+ * @param params.vault EVM vault address.
382
+ * @param params.chainId Numeric chain id.
383
+ * @param params.startDate Optional inclusive lower bound, `YYYY-MM-DD`.
384
+ * @param params.endDate Optional inclusive upper bound, `YYYY-MM-DD`.
385
+ * @returns {@link ITransparencyHistoricalAllocations}.
386
+ * @throws AugustValidationError When arguments fail validation (no request is made).
387
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
388
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
389
+ * @throws AugustRateLimitError When the API responds 429.
390
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
391
+ * @example
392
+ * ```ts
393
+ * const h = await sdk.apiModule.getVaultHistoricalAllocations({ vault, chainId: 143, startDate: '2026-08-01' });
394
+ * const byDate = Map.groupBy(h.points, (p) => p.date);
395
+ * ```
396
+ */
397
+ getVaultHistoricalAllocations(params: {
398
+ vault: string;
399
+ chainId: number;
400
+ startDate?: string;
401
+ endDate?: string;
402
+ }): Promise<ITransparencyHistoricalAllocations>;
403
+ /**
404
+ * Fetch a vault's fee configuration — the Performance tab's fee card.
405
+ *
406
+ * Public `GET /upshift/fees/{vault_address}`; no API key. One HTTPS
407
+ * request, no RPC. Percent fields are already scaled (`management_fee_pct`
408
+ * of `1.5` means 1.5%).
409
+ *
410
+ * @param params.vault EVM vault address.
411
+ * @param params.chainId Numeric chain id.
412
+ * @returns {@link ITransparencyFees}.
413
+ * @throws AugustValidationError When arguments fail validation (no request is made).
414
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
415
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
416
+ * @throws AugustRateLimitError When the API responds 429.
417
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
418
+ * @example
419
+ * ```ts
420
+ * const fees = await sdk.apiModule.getVaultFeeConfig({ vault, chainId: 143 });
421
+ * console.log(`${fees.management_fee_pct}% mgmt / ${fees.performance_fee_pct}% perf`);
422
+ * ```
423
+ */
424
+ getVaultFeeConfig(params: {
425
+ vault: string;
426
+ chainId: number;
427
+ }): Promise<ITransparencyFees>;
428
+ /**
429
+ * Fetch the vault's privileged addresses (owner / operators) with custody
430
+ * enrichment — the Governance tab's "Vault Roles" card.
431
+ *
432
+ * Public `GET /upshift/governance/{vault_address}/roles`; no API key. One
433
+ * HTTPS request from the SDK (the backend performs the on-chain reads).
434
+ * Third-party enrichment failures (Safe / Fordefi) degrade rows and append
435
+ * to `warnings` rather than failing.
436
+ *
437
+ * @param params.vault EVM vault address.
438
+ * @param params.chainId Numeric chain id.
439
+ * @returns {@link ITransparencyGovernanceRoles}.
440
+ * @throws AugustValidationError When arguments fail validation (no request is made).
441
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
442
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
443
+ * @throws AugustRateLimitError When the API responds 429.
444
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
445
+ * @example
446
+ * ```ts
447
+ * const { roles, warnings } = await sdk.apiModule.getVaultGovernanceRoles({ vault, chainId: 143 });
448
+ * const owner = roles.find((r) => r.role === 'owner'); // owner?.is_safe → Safe threshold in safe_threshold
449
+ * ```
450
+ */
451
+ getVaultGovernanceRoles(params: {
452
+ vault: string;
453
+ chainId: number;
454
+ }): Promise<ITransparencyGovernanceRoles>;
455
+ /**
456
+ * Fetch the integrations each vault wallet is whitelisted to operate —
457
+ * the Governance tab's "Vault Permissions" table.
458
+ *
459
+ * Public `GET /upshift/governance/{vault_address}/permissions`; no API key.
460
+ * One HTTPS request, no RPC.
461
+ *
462
+ * @param params.vault EVM vault address.
463
+ * @param params.chainId Numeric chain id.
464
+ * @returns {@link ITransparencyGovernancePermissions}.
465
+ * @throws AugustValidationError When arguments fail validation (no request is made).
466
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
467
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
468
+ * @throws AugustRateLimitError When the API responds 429.
469
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
470
+ * @example
471
+ * ```ts
472
+ * const { permissions } = await sdk.apiModule.getVaultGovernancePermissions({ vault, chainId: 143 });
473
+ * for (const p of permissions) console.log(p.integration, p.functions.join(','));
474
+ * ```
475
+ */
476
+ getVaultGovernancePermissions(params: {
477
+ vault: string;
478
+ chainId: number;
479
+ }): Promise<ITransparencyGovernancePermissions>;
480
+ /**
481
+ * Fetch the vault's timelock queue — the Governance tab's "Pending
482
+ * Timelocks" table. Defaults to pending (`scheduled`) requests.
483
+ *
484
+ * Public `GET /upshift/governance/{vault_address}/timelocks`; no API key.
485
+ * `executable_at` is `scheduled_at + TIMELOCK_DURATION()` read live from
486
+ * the timelock contract; null (plus a warning) when that read failed.
487
+ * The default filter is pending only — the list is often empty; pass
488
+ * `status: 'all'` for history. `getTimelockRequests` returns the raw
489
+ * backend rows; this returns the dashboard view (labels, `executable_at`,
490
+ * warnings).
491
+ *
492
+ * @param params.vault EVM vault address.
493
+ * @param params.chainId Numeric chain id.
494
+ * @param params.status Filter: a single {@link ITransparencyTimelockStatus} or `'all'`. Default `'scheduled'`. Any other string is rejected with `AugustValidationError` before a request is made.
495
+ * @returns {@link ITransparencyTimelocks}.
496
+ * @throws AugustValidationError When arguments fail validation (no request is made).
497
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
498
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
499
+ * @throws AugustRateLimitError When the API responds 429.
500
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
501
+ * @example
502
+ * ```ts
503
+ * const { timelocks } = await sdk.apiModule.getVaultGovernanceTimelocks({ vault, chainId: 1 }); // pending only
504
+ * const ready = timelocks.filter((t) => t.executable_at && Date.parse(`${t.executable_at}Z`) <= Date.now());
505
+ * ```
506
+ */
507
+ getVaultGovernanceTimelocks(params: {
508
+ vault: string;
509
+ chainId: number;
510
+ status?: ITransparencyTimelockStatus | 'all';
511
+ }): Promise<ITransparencyTimelocks>;
512
+ /**
513
+ * Fetch one page of the vault's governance audit log, newest first — the
514
+ * Governance tab's "Audit Log" timeline. Merges live timelock events with
515
+ * manually recorded entries (attestations, permission changes).
516
+ *
517
+ * Public `GET /upshift/governance/{vault_address}/audit_log`; no API key.
518
+ * Paginate with `before` = the last returned entry's `timestamp` while
519
+ * `has_more` is true (exclusive cursor; ties at the exact boundary
520
+ * timestamp are skipped, never duplicated).
521
+ *
522
+ * @param params.vault EVM vault address.
523
+ * @param params.chainId Numeric chain id.
524
+ * @param params.category Optional {@link ITransparencyAuditCategory} filter. Any other string is rejected with `AugustValidationError` before a request is made.
525
+ * @param params.before Optional exclusive cursor — pass the previous page's last `entry.timestamp` back verbatim (naive-UTC, no offset).
526
+ * @param params.limit Page size, 1–200. Backend default 50.
527
+ * @returns {@link ITransparencyAuditLog}.
528
+ * @throws AugustValidationError When arguments fail validation (no request is made).
529
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
530
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
531
+ * @throws AugustRateLimitError When the API responds 429.
532
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
533
+ * @example
534
+ * ```ts
535
+ * // Walk the whole log, newest first.
536
+ * let before: string | undefined;
537
+ * do {
538
+ * const page = await sdk.apiModule.getVaultGovernanceAuditLog({ vault, chainId: 1, before, limit: 50 });
539
+ * for (const e of page.entries) console.log(e.timestamp, e.type, e.summary);
540
+ * before = page.has_more ? page.entries.at(-1)?.timestamp : undefined;
541
+ * } while (before);
542
+ * ```
543
+ */
544
+ getVaultGovernanceAuditLog(params: {
545
+ vault: string;
546
+ chainId: number;
547
+ category?: ITransparencyAuditCategory;
548
+ before?: string;
549
+ limit?: number;
550
+ }): Promise<ITransparencyAuditLog>;
277
551
  /**
278
552
  * Fetch the historical unrealized-PnL series for a vault, newest first,
279
553
  * as computed by the August backend from periodic vault snapshots.