@augustdigital/sdk 8.24.0 → 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,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AugustApi = void 0;
4
+ /**
5
+ * The August backend API Module — read-only client for public backend
6
+ * endpoints (transparency dashboard, unrealized PnL) and authenticated
7
+ * loan-book / risk / OTC reads. Accessible as `sdk.apiModule`.
8
+ *
9
+ * @module AugustApi
10
+ */
4
11
  const ethers_1 = require("ethers");
5
12
  const fetcher_1 = require("./fetcher");
6
13
  const base_class_1 = require("../../core/base.class");
@@ -32,6 +39,71 @@ function assertVaultAddress(vault, method) {
32
39
  throw new errors_1.AugustValidationError('INVALID_ADDRESS', `${method}: "${vault}" is not a valid vault address — pass the vault's EVM (0x…), Solana, or Stellar address.`);
33
40
  }
34
41
  }
42
+ /** Transparency endpoints are EVM-only and require a positive integer chain id. */
43
+ function assertTransparencyArgs(method, vault, chainId) {
44
+ if (!(0, ethers_1.isAddress)(vault)) {
45
+ throw new errors_1.AugustValidationError('INVALID_ADDRESS', `${method}: vault must be an EVM address (transparency endpoints are EVM-only), got ${String(vault)}.`);
46
+ }
47
+ if (!Number.isInteger(chainId) || chainId <= 0) {
48
+ throw new errors_1.AugustValidationError('INVALID_CHAIN', `${method}: chainId must be a positive integer EVM chain id, got ${chainId}. Transparency endpoints are EVM-only.`);
49
+ }
50
+ }
51
+ const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
52
+ /** Date-window params are plain `YYYY-MM-DD` strings; anything else is rejected before the request. */
53
+ function assertIsoDate(method, name, value) {
54
+ if (value !== undefined && !ISO_DATE.test(value)) {
55
+ throw new errors_1.AugustValidationError('INVALID_INPUT', `${method}: ${name} must be YYYY-MM-DD, got "${value}".`);
56
+ }
57
+ }
58
+ /**
59
+ * Cheap contract-drift guard for the chain-scoped transparency responses.
60
+ * Every one of them (`positions`, `historical_allocations`, `fees`,
61
+ * `governance/*`) is an object keyed by `vault_address` + `chain_id`; if the
62
+ * body is not that, the backend contract has changed and partner code must
63
+ * not receive a silently-malformed object. Leaves are deliberately NOT
64
+ * validated — full validation of eight nested shapes is not worth the
65
+ * weight, and the top-level check catches the common drift (envelope
66
+ * wrapping, error-object-over-200, renamed root).
67
+ */
68
+ function assertTransparencyEnvelope(data, method) {
69
+ const valid = data !== null &&
70
+ typeof data === 'object' &&
71
+ !Array.isArray(data) &&
72
+ typeof data.vault_address === 'string' &&
73
+ typeof data.chain_id === 'number';
74
+ if (!valid) {
75
+ throw new errors_1.AugustServerError(200, `${method}: unexpected response shape from the August API — expected an object with vault_address and chain_id. The backend contract may have changed; refresh packages/sdk/api-spec and update the SDK.`);
76
+ }
77
+ }
78
+ /**
79
+ * Same guard for the backing-series endpoint, whose body is a bare array of
80
+ * ratio points (no envelope). Anything else is contract drift.
81
+ */
82
+ function assertTransparencyArray(data, method) {
83
+ if (!Array.isArray(data)) {
84
+ throw new errors_1.AugustServerError(200, `${method}: unexpected response shape from the August API — expected an array of ratio points. The backend contract may have changed; refresh packages/sdk/api-spec and update the SDK.`);
85
+ }
86
+ }
87
+ /** Runtime mirror of {@link ITransparencyTimelockStatus} (+ `'all'`) — plain-JS callers bypass the type. */
88
+ const TRANSPARENCY_TIMELOCK_STATUSES = [
89
+ 'scheduled',
90
+ 'executed',
91
+ 'cancelled',
92
+ 'all',
93
+ ];
94
+ /** Runtime mirror of {@link ITransparencyAuditCategory} — plain-JS callers bypass the type. */
95
+ const TRANSPARENCY_AUDIT_CATEGORIES = [
96
+ 'Strategy',
97
+ 'Role',
98
+ 'Permission',
99
+ 'Attestation',
100
+ ];
101
+ /** Rejects a filter value outside its allowlist before any request is made (types only guard TS callers). */
102
+ function assertOneOf(method, name, value, allowed) {
103
+ if (value !== undefined && !allowed.includes(value)) {
104
+ throw new errors_1.AugustValidationError('INVALID_INPUT', `${method}: ${name} must be one of ${allowed.map((v) => `'${v}'`).join(', ')}, got "${String(value)}".`);
105
+ }
106
+ }
35
107
  function assertAddressArg(value, label, method) {
36
108
  const valid = typeof value === 'string' &&
37
109
  value.length > 0 &&
@@ -70,20 +142,15 @@ function assertSnapshotArray(data, method) {
70
142
  }
71
143
  /**
72
144
  * Read-only client for August backend REST endpoints that have no on-chain
73
- * equivalent — currently the unrealized-PnL series the backend computes
74
- * from periodic vault snapshots.
75
- *
76
- * Every method makes exactly one HTTPS request to the public
77
- * (unauthenticated) August API and zero RPC calls. Responses are not cached
78
- * by the SDK: this is time-sensitive PnL state where staleness is worse
79
- * than request latency.
145
+ * equivalent: the unrealized-PnL series, the transparency dashboard
146
+ * (position snapshot, backing series, smoothed APY, allocations, fee config,
147
+ * governance), plus authenticated loan-book / risk / OTC reads.
80
148
  *
81
- * Accessible as `apiModule` on the SDK instance; the same methods are also
82
- * exposed directly on the SDK class.
83
- *
84
- * A subset of methods (loan book, risk) hit authenticated admin-only backend
85
- * endpoints and require an admin-scoped August API key on the SDK
86
- * constructor; each such method documents the requirement.
149
+ * Every public method makes exactly one HTTPS request to the August API and
150
+ * zero RPC calls. Responses are not cached by the SDK: this is time-sensitive
151
+ * state where staleness is worse than a request. Accessible as
152
+ * `sdk.apiModule`; only the unrealized-PnL methods are also mirrored on the
153
+ * root `AugustSDK` class.
87
154
  */
88
155
  class AugustApi extends base_class_1.AugustBase {
89
156
  headers = null;
@@ -421,6 +488,365 @@ class AugustApi extends base_class_1.AugustBase {
421
488
  }
422
489
  return (0, fetcher_1.fetchVaultOracleClassification)(vault, chainId, this.headers ?? undefined);
423
490
  }
491
+ // -------------------------------------------------------------------------
492
+ // Transparency dashboard
493
+ //
494
+ // One method per card/tab of the Upshift per-vault transparency page so a
495
+ // partner can compose exactly the subset they want (e.g. Performance without
496
+ // the collateral-ratio card). Every method: public endpoint, no API key, one
497
+ // HTTPS request, zero RPC, snapshot-backed (hourly-ish; cache ≥60s).
498
+ // -------------------------------------------------------------------------
499
+ /**
500
+ * Fetch the latest position snapshot for a vault, grouped per wallet — the
501
+ * data behind the transparency Overview tab (strategy breakdown, backing
502
+ * composition, vault buffer, per-wallet table, headline TVL).
503
+ *
504
+ * Public `GET /upshift/positions/{vault_address}`; no API key. One HTTPS
505
+ * request, no RPC. Snapshots land hourly; every field is from the single
506
+ * `snapshot_at` instant. Vault buffer = `total_nav − Σ subaccounts[].total_usd`;
507
+ * `reported_tvl` is the vault-contract-reported total assets from the same snapshot.
508
+ *
509
+ * @param params.vault EVM vault address.
510
+ * @param params.chainId Numeric chain id the vault lives on.
511
+ * @returns {@link ITransparencyPositions}.
512
+ * @throws AugustValidationError When arguments fail validation (no request is made).
513
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
514
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
515
+ * @throws AugustRateLimitError When the API responds 429.
516
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
517
+ * @example
518
+ * ```ts
519
+ * const p = await sdk.apiModule.getVaultPositionSnapshot({ vault: '0x36eDbF0C834591BFdfCaC0Ef9605528c75c406aA', chainId: 143 });
520
+ * const buffer = p.total_nav - p.subaccounts.reduce((a, s) => a + s.total_usd, 0);
521
+ * ```
522
+ */
523
+ async getVaultPositionSnapshot(params) {
524
+ const method = 'getVaultPositionSnapshot';
525
+ assertTransparencyArgs(method, params.vault, params.chainId);
526
+ const data = await (0, fetcher_1.fetchTransparencyPositions)(params.vault, params.chainId, this.headers ?? undefined);
527
+ assertTransparencyEnvelope(data, method);
528
+ return data;
529
+ }
530
+ /**
531
+ * Fetch the backing / supply / collateral-ratio time series behind the
532
+ * Performance tab's "Backing vs Supply" and "Collateral Ratio" charts, and
533
+ * the Overview sidebar's 7-day deltas.
534
+ *
535
+ * Public `GET /upshift/unrealized_pnl?fields=ratio`; no API key. One HTTPS
536
+ * request, no RPC. Points are hourly, returned newest-first — sort before
537
+ * charting. `actual_tvl` = backing (mark-to-market), `tvl_on_vault` = supply
538
+ * (vault-reported), `adjusted_redeem_ratio` = collateral ratio.
539
+ *
540
+ * Unlike the chain-scoped transparency endpoints (positions, fees,
541
+ * governance…), this one is keyed by vault address only and accepts
542
+ * non-EVM (Solana / Stellar) vaults — same contract as
543
+ * {@link AugustApi.getVaultUnrealizedPnlHistory}, which it shares a route with.
544
+ *
545
+ * @param params.vault Vault address (EVM, Solana, or Stellar).
546
+ * @param params.startDate Optional inclusive lower bound, `YYYY-MM-DD`.
547
+ * @param params.endDate Optional inclusive upper bound, `YYYY-MM-DD`.
548
+ * @param params.limit Optional max points.
549
+ * @returns Array of {@link ITransparencyRatioPoint}; empty when no history.
550
+ * @throws AugustValidationError When arguments fail validation (no request is made).
551
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
552
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
553
+ * @throws AugustRateLimitError When the API responds 429.
554
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
555
+ * @example
556
+ * ```ts
557
+ * const pts = await sdk.apiModule.getVaultBackingSeries({ vault, startDate: '2026-08-01' });
558
+ * const ratio = pts.map((p) => p.adjusted_redeem_ratio * 100); // percent
559
+ * ```
560
+ */
561
+ async getVaultBackingSeries(params) {
562
+ const method = 'getVaultBackingSeries';
563
+ assertVaultAddress(params.vault, method);
564
+ assertIsoDate(method, 'startDate', params.startDate);
565
+ assertIsoDate(method, 'endDate', params.endDate);
566
+ if (params.limit !== undefined &&
567
+ (!Number.isInteger(params.limit) ||
568
+ params.limit < 1 ||
569
+ params.limit > 1000)) {
570
+ throw new errors_1.AugustValidationError('INVALID_INPUT', `${method}: limit must be an integer between 1 and 1000, got ${params.limit}.`);
571
+ }
572
+ const data = await (0, fetcher_1.fetchTransparencyRatioSeries)(params.vault, params.startDate, params.endDate, params.limit, this.headers ?? undefined);
573
+ assertTransparencyArray(data, method);
574
+ return data;
575
+ }
576
+ /**
577
+ * Fetch the smoothed 7-day APY series — the exact series the Upshift app
578
+ * charts (Overview "APY last 30 days" and Performance "APY Over Time").
579
+ *
580
+ * Public `GET /upshift/historical_apy/chart`; no API key. One HTTPS request,
581
+ * no RPC. The backend marks this route deprecated in its OpenAPI spec but it
582
+ * remains the series the Upshift app itself charts; this wrapper tracks it.
583
+ * The backend applies a rolling-median/mean smoothing filter server-side
584
+ * when `applySmoothing` is true (the app default); computing APY locally from
585
+ * raw share ratios will NOT match the published figures.
586
+ *
587
+ * Unlike the chain-scoped transparency endpoints (positions, fees,
588
+ * governance…), this one is keyed by vault address only and accepts
589
+ * non-EVM (Solana / Stellar) vaults.
590
+ *
591
+ * @param params.vault Vault address (EVM, Solana, or Stellar).
592
+ * @param params.daysAgo Window length in days; pass `-1` for the full history since inception. Default 30.
593
+ * @param params.averagingPeriodDays Rolling window for the annualized return; must be ≥ 2. Default 7 (the app's "7D APY").
594
+ * @param params.applySmoothing Apply the backend smoothing filter. Default true.
595
+ * @returns {@link ITransparencyApySeries} — `labels` are `M/D/YYYY`, `values` are decimal fractions (0.0245 = 2.45%). Empty arrays when the vault has no data.
596
+ * @throws AugustValidationError When arguments fail validation (no request is made).
597
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
598
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
599
+ * @throws AugustRateLimitError When the API responds 429.
600
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
601
+ * @example
602
+ * ```ts
603
+ * const apy = await sdk.apiModule.getVaultSmoothedApy({ vault, daysAgo: 30 });
604
+ * console.log(apy.values.at(-1)); // latest 7D APY as a fraction
605
+ * ```
606
+ */
607
+ async getVaultSmoothedApy(params) {
608
+ const method = 'getVaultSmoothedApy';
609
+ assertVaultAddress(params.vault, method);
610
+ const daysAgo = params.daysAgo ?? 30;
611
+ // `0` is deliberately rejected: the backend happens to treat `days_ago=0`
612
+ // as "full history" (same as -1) but only -1 is documented, and a caller
613
+ // passing 0 almost certainly means "today", not "everything". Forcing the
614
+ // explicit sentinel avoids silently returning the whole series.
615
+ if (!Number.isInteger(daysAgo) || (daysAgo < 1 && daysAgo !== -1)) {
616
+ throw new errors_1.AugustValidationError('INVALID_INPUT', `${method}: daysAgo must be a positive integer (≥ 1) or -1 for full history, got ${params.daysAgo}. 0 is not accepted — pass -1 for the full series.`);
617
+ }
618
+ const averaging = params.averagingPeriodDays ?? 7;
619
+ if (!Number.isInteger(averaging) || averaging < 2) {
620
+ throw new errors_1.AugustValidationError('INVALID_INPUT', `${method}: averagingPeriodDays must be an integer ≥ 2, got ${params.averagingPeriodDays}.`);
621
+ }
622
+ const envelope = await (0, fetcher_1.fetchTransparencySmoothedApy)(params.vault, daysAgo, averaging, params.applySmoothing ?? true, this.headers ?? undefined);
623
+ // The endpoint reports not-found / bad-args IN-BODY over HTTP 200. The
624
+ // live shape for those is
625
+ // { data: { labels: [], values: [] }, average_apy: null, status: 404|400, error: "…" }
626
+ // i.e. `data` is never null — it passes `shapeOk` below and falls through
627
+ // to the normal return as an empty series (charts render their empty
628
+ // state). The `!shapeOk && status 404/400` branch is a defensive mirror
629
+ // in case the backend ever sends `data: null` with those statuses.
630
+ // `data: null` with `status: 200` has never been observed; if it shows up
631
+ // it IS a contract change and must fail loudly rather than hand partners
632
+ // a bogus empty chart.
633
+ const data = envelope?.data;
634
+ const shapeOk = data !== null &&
635
+ typeof data === 'object' &&
636
+ Array.isArray(data.labels) &&
637
+ Array.isArray(data.values);
638
+ if (!shapeOk) {
639
+ if (envelope?.status === 404 || envelope?.status === 400) {
640
+ return { labels: [], values: [], average_apy: null };
641
+ }
642
+ throw new errors_1.AugustServerError(200, `${method}: unexpected response shape from the August API — expected { data: { labels, values } }. The backend contract may have changed; refresh packages/sdk/api-spec and update the SDK.`);
643
+ }
644
+ return {
645
+ labels: data.labels,
646
+ values: data.values,
647
+ // average_apy sits at the envelope top level, beside `data`.
648
+ average_apy: envelope?.average_apy ?? null,
649
+ };
650
+ }
651
+ /**
652
+ * Fetch daily allocation history per protocol — the Performance tab's
653
+ * "Allocation Over Time" chart.
654
+ *
655
+ * Public `GET /upshift/historical_allocations/{vault_address}`; no API key.
656
+ * One HTTPS request, no RPC.
657
+ *
658
+ * @param params.vault EVM vault address.
659
+ * @param params.chainId Numeric chain id.
660
+ * @param params.startDate Optional inclusive lower bound, `YYYY-MM-DD`.
661
+ * @param params.endDate Optional inclusive upper bound, `YYYY-MM-DD`.
662
+ * @returns {@link ITransparencyHistoricalAllocations}.
663
+ * @throws AugustValidationError When arguments fail validation (no request is made).
664
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
665
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
666
+ * @throws AugustRateLimitError When the API responds 429.
667
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
668
+ * @example
669
+ * ```ts
670
+ * const h = await sdk.apiModule.getVaultHistoricalAllocations({ vault, chainId: 143, startDate: '2026-08-01' });
671
+ * const byDate = Map.groupBy(h.points, (p) => p.date);
672
+ * ```
673
+ */
674
+ async getVaultHistoricalAllocations(params) {
675
+ const method = 'getVaultHistoricalAllocations';
676
+ assertTransparencyArgs(method, params.vault, params.chainId);
677
+ assertIsoDate(method, 'startDate', params.startDate);
678
+ assertIsoDate(method, 'endDate', params.endDate);
679
+ const data = await (0, fetcher_1.fetchTransparencyHistoricalAllocations)(params.vault, params.chainId, params.startDate, params.endDate, this.headers ?? undefined);
680
+ assertTransparencyEnvelope(data, method);
681
+ return data;
682
+ }
683
+ /**
684
+ * Fetch a vault's fee configuration — the Performance tab's fee card.
685
+ *
686
+ * Public `GET /upshift/fees/{vault_address}`; no API key. One HTTPS
687
+ * request, no RPC. Percent fields are already scaled (`management_fee_pct`
688
+ * of `1.5` means 1.5%).
689
+ *
690
+ * @param params.vault EVM vault address.
691
+ * @param params.chainId Numeric chain id.
692
+ * @returns {@link ITransparencyFees}.
693
+ * @throws AugustValidationError When arguments fail validation (no request is made).
694
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
695
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
696
+ * @throws AugustRateLimitError When the API responds 429.
697
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
698
+ * @example
699
+ * ```ts
700
+ * const fees = await sdk.apiModule.getVaultFeeConfig({ vault, chainId: 143 });
701
+ * console.log(`${fees.management_fee_pct}% mgmt / ${fees.performance_fee_pct}% perf`);
702
+ * ```
703
+ */
704
+ async getVaultFeeConfig(params) {
705
+ const method = 'getVaultFeeConfig';
706
+ assertTransparencyArgs(method, params.vault, params.chainId);
707
+ const data = await (0, fetcher_1.fetchTransparencyFees)(params.vault, params.chainId, this.headers ?? undefined);
708
+ assertTransparencyEnvelope(data, method);
709
+ return data;
710
+ }
711
+ /**
712
+ * Fetch the vault's privileged addresses (owner / operators) with custody
713
+ * enrichment — the Governance tab's "Vault Roles" card.
714
+ *
715
+ * Public `GET /upshift/governance/{vault_address}/roles`; no API key. One
716
+ * HTTPS request from the SDK (the backend performs the on-chain reads).
717
+ * Third-party enrichment failures (Safe / Fordefi) degrade rows and append
718
+ * to `warnings` rather than failing.
719
+ *
720
+ * @param params.vault EVM vault address.
721
+ * @param params.chainId Numeric chain id.
722
+ * @returns {@link ITransparencyGovernanceRoles}.
723
+ * @throws AugustValidationError When arguments fail validation (no request is made).
724
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
725
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
726
+ * @throws AugustRateLimitError When the API responds 429.
727
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
728
+ * @example
729
+ * ```ts
730
+ * const { roles, warnings } = await sdk.apiModule.getVaultGovernanceRoles({ vault, chainId: 143 });
731
+ * const owner = roles.find((r) => r.role === 'owner'); // owner?.is_safe → Safe threshold in safe_threshold
732
+ * ```
733
+ */
734
+ async getVaultGovernanceRoles(params) {
735
+ const method = 'getVaultGovernanceRoles';
736
+ assertTransparencyArgs(method, params.vault, params.chainId);
737
+ const data = await (0, fetcher_1.fetchTransparencyGovernanceRoles)(params.vault, params.chainId, this.headers ?? undefined);
738
+ assertTransparencyEnvelope(data, method);
739
+ return data;
740
+ }
741
+ /**
742
+ * Fetch the integrations each vault wallet is whitelisted to operate —
743
+ * the Governance tab's "Vault Permissions" table.
744
+ *
745
+ * Public `GET /upshift/governance/{vault_address}/permissions`; no API key.
746
+ * One HTTPS request, no RPC.
747
+ *
748
+ * @param params.vault EVM vault address.
749
+ * @param params.chainId Numeric chain id.
750
+ * @returns {@link ITransparencyGovernancePermissions}.
751
+ * @throws AugustValidationError When arguments fail validation (no request is made).
752
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
753
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
754
+ * @throws AugustRateLimitError When the API responds 429.
755
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
756
+ * @example
757
+ * ```ts
758
+ * const { permissions } = await sdk.apiModule.getVaultGovernancePermissions({ vault, chainId: 143 });
759
+ * for (const p of permissions) console.log(p.integration, p.functions.join(','));
760
+ * ```
761
+ */
762
+ async getVaultGovernancePermissions(params) {
763
+ const method = 'getVaultGovernancePermissions';
764
+ assertTransparencyArgs(method, params.vault, params.chainId);
765
+ const data = await (0, fetcher_1.fetchTransparencyGovernancePermissions)(params.vault, params.chainId, this.headers ?? undefined);
766
+ assertTransparencyEnvelope(data, method);
767
+ return data;
768
+ }
769
+ /**
770
+ * Fetch the vault's timelock queue — the Governance tab's "Pending
771
+ * Timelocks" table. Defaults to pending (`scheduled`) requests.
772
+ *
773
+ * Public `GET /upshift/governance/{vault_address}/timelocks`; no API key.
774
+ * `executable_at` is `scheduled_at + TIMELOCK_DURATION()` read live from
775
+ * the timelock contract; null (plus a warning) when that read failed.
776
+ * The default filter is pending only — the list is often empty; pass
777
+ * `status: 'all'` for history. `getTimelockRequests` returns the raw
778
+ * backend rows; this returns the dashboard view (labels, `executable_at`,
779
+ * warnings).
780
+ *
781
+ * @param params.vault EVM vault address.
782
+ * @param params.chainId Numeric chain id.
783
+ * @param params.status Filter: a single {@link ITransparencyTimelockStatus} or `'all'`. Default `'scheduled'`. Any other string is rejected with `AugustValidationError` before a request is made.
784
+ * @returns {@link ITransparencyTimelocks}.
785
+ * @throws AugustValidationError When arguments fail validation (no request is made).
786
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
787
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
788
+ * @throws AugustRateLimitError When the API responds 429.
789
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
790
+ * @example
791
+ * ```ts
792
+ * const { timelocks } = await sdk.apiModule.getVaultGovernanceTimelocks({ vault, chainId: 1 }); // pending only
793
+ * const ready = timelocks.filter((t) => t.executable_at && Date.parse(`${t.executable_at}Z`) <= Date.now());
794
+ * ```
795
+ */
796
+ async getVaultGovernanceTimelocks(params) {
797
+ const method = 'getVaultGovernanceTimelocks';
798
+ assertTransparencyArgs(method, params.vault, params.chainId);
799
+ assertOneOf(method, 'status', params.status, TRANSPARENCY_TIMELOCK_STATUSES);
800
+ const data = await (0, fetcher_1.fetchTransparencyGovernanceTimelocks)(params.vault, params.chainId, params.status, this.headers ?? undefined);
801
+ assertTransparencyEnvelope(data, method);
802
+ return data;
803
+ }
804
+ /**
805
+ * Fetch one page of the vault's governance audit log, newest first — the
806
+ * Governance tab's "Audit Log" timeline. Merges live timelock events with
807
+ * manually recorded entries (attestations, permission changes).
808
+ *
809
+ * Public `GET /upshift/governance/{vault_address}/audit_log`; no API key.
810
+ * Paginate with `before` = the last returned entry's `timestamp` while
811
+ * `has_more` is true (exclusive cursor; ties at the exact boundary
812
+ * timestamp are skipped, never duplicated).
813
+ *
814
+ * @param params.vault EVM vault address.
815
+ * @param params.chainId Numeric chain id.
816
+ * @param params.category Optional {@link ITransparencyAuditCategory} filter. Any other string is rejected with `AugustValidationError` before a request is made.
817
+ * @param params.before Optional exclusive cursor — pass the previous page's last `entry.timestamp` back verbatim (naive-UTC, no offset).
818
+ * @param params.limit Page size, 1–200. Backend default 50.
819
+ * @returns {@link ITransparencyAuditLog}.
820
+ * @throws AugustValidationError When arguments fail validation (no request is made).
821
+ * @throws AugustServerError When the API responds non-2xx (e.g. unknown vault 404, non-EVM vault 422).
822
+ * @throws AugustServerError (status 200) When the body is not the documented shape — backend contract drift.
823
+ * @throws AugustRateLimitError When the API responds 429.
824
+ * @throws AugustTimeoutError When the request exceeds the SDK request timeout.
825
+ * @example
826
+ * ```ts
827
+ * // Walk the whole log, newest first.
828
+ * let before: string | undefined;
829
+ * do {
830
+ * const page = await sdk.apiModule.getVaultGovernanceAuditLog({ vault, chainId: 1, before, limit: 50 });
831
+ * for (const e of page.entries) console.log(e.timestamp, e.type, e.summary);
832
+ * before = page.has_more ? page.entries.at(-1)?.timestamp : undefined;
833
+ * } while (before);
834
+ * ```
835
+ */
836
+ async getVaultGovernanceAuditLog(params) {
837
+ const method = 'getVaultGovernanceAuditLog';
838
+ assertTransparencyArgs(method, params.vault, params.chainId);
839
+ assertOneOf(method, 'category', params.category, TRANSPARENCY_AUDIT_CATEGORIES);
840
+ if (params.limit !== undefined &&
841
+ (!Number.isInteger(params.limit) ||
842
+ params.limit < 1 ||
843
+ params.limit > 200)) {
844
+ throw new errors_1.AugustValidationError('INVALID_INPUT', `${method}: limit must be an integer between 1 and 200, got ${params.limit}.`);
845
+ }
846
+ const data = await (0, fetcher_1.fetchTransparencyGovernanceAuditLog)(params.vault, params.chainId, params.category, params.before, params.limit, this.headers ?? undefined);
847
+ assertTransparencyEnvelope(data, method);
848
+ return data;
849
+ }
424
850
  /**
425
851
  * Fetch the historical unrealized-PnL series for a vault, newest first,
426
852
  * as computed by the August backend from periodic vault snapshots.
@@ -501,6 +501,10 @@ export declare function depositNativeViaSwapRouter(signer: Signer | Wallet, opti
501
501
  * the chain's whitelisted aggregator, fail-closed on router/selector drift)
502
502
  * bundled into {@link swapAndDeposit}.
503
503
  *
504
+ * An `originCode` is forwarded verbatim to whichever of those three entry points
505
+ * runs, so a partner's origin fee accrues on every path. Omitting it sends the
506
+ * all-zero sentinel, which the router reads as "no origin fee".
507
+ *
504
508
  * Side effects: reads tokenized-vault metadata, the vault's reference asset and
505
509
  * decimals, and (on the swap path) one Paraswap quote; sends one ERC-20
506
510
  * `approve` to the SwapRouter when allowance is short, then the deposit tx.
@@ -1311,6 +1311,7 @@ async function dispatchViaSwapRouter(args) {
1311
1311
  vault: args.target,
1312
1312
  receiver: sharesReceiver,
1313
1313
  amount: amountRaw,
1314
+ originCode: args.originCode,
1314
1315
  wait: args.wait,
1315
1316
  });
1316
1317
  }
@@ -1323,6 +1324,7 @@ async function dispatchViaSwapRouter(args) {
1323
1324
  receiver: sharesReceiver,
1324
1325
  asset: args.actualDepositAsset,
1325
1326
  amount: amountRaw,
1327
+ originCode: args.originCode,
1326
1328
  wait: args.wait,
1327
1329
  });
1328
1330
  }
@@ -1389,6 +1391,7 @@ async function dispatchViaSwapRouter(args) {
1389
1391
  payload: quote.payload,
1390
1392
  },
1391
1393
  ],
1394
+ originCode: args.originCode,
1392
1395
  wait: args.wait,
1393
1396
  });
1394
1397
  }
@@ -1638,6 +1641,10 @@ async function depositNativeViaSwapRouter(signer, options) {
1638
1641
  * the chain's whitelisted aggregator, fail-closed on router/selector drift)
1639
1642
  * bundled into {@link swapAndDeposit}.
1640
1643
  *
1644
+ * An `originCode` is forwarded verbatim to whichever of those three entry points
1645
+ * runs, so a partner's origin fee accrues on every path. Omitting it sends the
1646
+ * all-zero sentinel, which the router reads as "no origin fee".
1647
+ *
1641
1648
  * Side effects: reads tokenized-vault metadata, the vault's reference asset and
1642
1649
  * decimals, and (on the swap path) one Paraswap quote; sends one ERC-20
1643
1650
  * `approve` to the SwapRouter when allowance is short, then the deposit tx.
@@ -1664,7 +1671,7 @@ async function depositNativeViaSwapRouter(signer, options) {
1664
1671
  * ```
1665
1672
  */
1666
1673
  async function swapRouterDeposit(signer, options) {
1667
- const { chainId, vault, depositAsset, amount, receiver, slippageBps, wait } = options;
1674
+ const { chainId, vault, depositAsset, amount, receiver, slippageBps, originCode, wait, } = options;
1668
1675
  if (!(0, core_1.checkAddress)(vault, console, 'contract')) {
1669
1676
  throw new core_1.AugustValidationError('INVALID_ADDRESS', `swapRouterDeposit: invalid vault address "${vault}"`);
1670
1677
  }
@@ -1743,6 +1750,7 @@ async function swapRouterDeposit(signer, options) {
1743
1750
  depositTokenDecimals,
1744
1751
  normalizedAmt,
1745
1752
  slippageBps,
1753
+ originCode,
1746
1754
  wait,
1747
1755
  });
1748
1756
  }