@aegis-engine/core 0.7.0 → 0.8.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.
Files changed (74) hide show
  1. package/README.md +215 -7
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/account.d.ts +11 -0
  4. package/dist/account.js +129 -0
  5. package/dist/actions/allowance.d.ts +94 -0
  6. package/dist/actions/directPoolSwap.d.ts +8 -1
  7. package/dist/actions/kyberSwap.d.ts +1 -0
  8. package/dist/actions/types.d.ts +2 -0
  9. package/dist/actions/wallet.d.ts +1 -0
  10. package/dist/aegis-core.js +9654 -205
  11. package/dist/backendAdapters.d.ts +3 -1
  12. package/dist/config/chains.d.ts +1 -0
  13. package/dist/config/constants.d.ts +4 -0
  14. package/dist/config/tokens.d.ts +2 -1
  15. package/dist/config/types.d.ts +8 -0
  16. package/dist/contract/backendClient.d.ts +3 -1
  17. package/dist/contract/generated/aegis-swap.d.ts +6337 -1377
  18. package/dist/contract/generated/market-data.d.ts +8286 -0
  19. package/dist/contract/index.d.ts +1 -0
  20. package/dist/contract/responseBudget.d.ts +9 -0
  21. package/dist/contract/schemas.d.ts +13 -3
  22. package/dist/engine/account/accounting.d.ts +24 -0
  23. package/dist/engine/account/accountingSchemas.d.ts +2056 -0
  24. package/dist/engine/account/activity.d.ts +42 -0
  25. package/dist/engine/account/activitySchemas.d.ts +327 -0
  26. package/dist/engine/account/amountSchemas.d.ts +9 -0
  27. package/dist/engine/account/catalogSchemas.d.ts +108 -0
  28. package/dist/engine/account/client.d.ts +14 -0
  29. package/dist/engine/account/history.d.ts +40 -0
  30. package/dist/engine/account/historySchemas.d.ts +251 -0
  31. package/dist/engine/account/management.d.ts +13 -0
  32. package/dist/engine/account/portfolioSchemas.d.ts +712 -0
  33. package/dist/engine/account/positionPerformance.d.ts +18 -0
  34. package/dist/engine/account/positionPerformanceSchemas.d.ts +101 -0
  35. package/dist/engine/account/positionPnl.d.ts +18 -0
  36. package/dist/engine/account/positionPnlSchemas.d.ts +149 -0
  37. package/dist/engine/account/transactionHistory.d.ts +50 -0
  38. package/dist/engine/account/transactionSchemas.d.ts +101 -0
  39. package/dist/engine/account/transactions.d.ts +26 -0
  40. package/dist/engine/account/transport.d.ts +31 -0
  41. package/dist/engine/account/types.d.ts +39 -0
  42. package/dist/engine/actions.d.ts +8 -3
  43. package/dist/engine/adaptiveFee.d.ts +14 -0
  44. package/dist/engine/balancedLending.d.ts +82 -0
  45. package/dist/engine/dataSource.d.ts +2 -0
  46. package/dist/engine/index.d.ts +19 -0
  47. package/dist/engine/marketAdapter.d.ts +3 -0
  48. package/dist/engine/marketSeries.d.ts +61 -0
  49. package/dist/engine/marketSeriesSchemas.d.ts +312 -0
  50. package/dist/engine/marketTrust.d.ts +26 -0
  51. package/dist/engine/openingEntry.d.ts +41 -0
  52. package/dist/engine/rateHistorySchemas.d.ts +88 -0
  53. package/dist/engine/reads.d.ts +1 -1
  54. package/dist/engine/registry.d.ts +1 -1
  55. package/dist/engine/restSchemas.d.ts +59 -1
  56. package/dist/engine/tradeExecutionSession.d.ts +155 -0
  57. package/dist/engine/types.d.ts +128 -14
  58. package/dist/engine/v4Quote.d.ts +5 -0
  59. package/dist/index.d.ts +11 -7
  60. package/dist/internal/guardedWalletTransaction.d.ts +31 -0
  61. package/dist/permit.d.ts +80 -7
  62. package/dist/quote/aggregatedSwapQuote.d.ts +5 -1
  63. package/dist/quote/kyberCalldata.d.ts +5 -1
  64. package/dist/{sdkRuntime-BE3ZMb5o.js → sdkRuntime-3aRt_g55.js} +3385 -2958
  65. package/dist/services/kyberSwap.d.ts +12 -0
  66. package/dist/swap/authorizePermit.d.ts +11 -9
  67. package/dist/swap/executeSwapTransaction.d.ts +5 -1
  68. package/dist/swap/receiptWait.d.ts +9 -0
  69. package/dist/swap/sendSwapTransaction.d.ts +7 -0
  70. package/dist/swap/trustedMarket.d.ts +25 -0
  71. package/dist/transactionHistory-1Zl2KCcV.js +5915 -0
  72. package/dist/wallet.d.ts +4 -0
  73. package/package.json +12 -5
  74. package/dist/index-DofKgro2.js +0 -11201
@@ -1,4 +1,4 @@
1
- import type { Address } from 'viem';
1
+ import { type Address } from 'viem';
2
2
  import type { AegisEngineVersion } from './types.js';
3
3
  /** Engine hard utilization cap as a percentage of supplied liquidity.
4
4
  * Mirrors the SDK's UTILIZATION_CAP_PIPS (950_000/1_000_000), inlined so
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export declare const engineAdaptiveTickThresholdModeSchema: z.ZodLiteral<"post_swap_surge_trigger">;
2
3
  export declare const enginePoolIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
3
4
  export declare const engineMarketsRestResponseSchema: z.ZodObject<{
4
5
  schemaVersion: z.ZodLiteral<"1">;
@@ -9,8 +10,21 @@ export declare const engineMarketsRestResponseSchema: z.ZodObject<{
9
10
  updatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
10
11
  blockNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
11
12
  marketCount: z.ZodNumber;
12
- }, z.core.$strip>;
13
+ }, z.core.$strict>;
13
14
  }, z.core.$strip>;
15
+ /** Opt-in market envelope from GET /v1/engine/markets/v2. Market rows are
16
+ * validated by marketAdapter because static and REST rows share normalization. */
17
+ export declare const engineMarketsV2RestResponseSchema: z.ZodObject<{
18
+ schemaVersion: z.ZodLiteral<"2">;
19
+ chainId: z.ZodNumber;
20
+ markets: z.ZodArray<z.ZodUnknown>;
21
+ freshness: z.ZodObject<{
22
+ source: z.ZodLiteral<"canopy">;
23
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
24
+ blockNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
25
+ marketCount: z.ZodNumber;
26
+ }, z.core.$strict>;
27
+ }, z.core.$strict>;
14
28
  export declare const engineMarketIdSchema: z.ZodString;
15
29
  export declare const engineMetricHistoryRestResponseSchema: z.ZodObject<{
16
30
  marketId: z.ZodString;
@@ -52,6 +66,50 @@ export declare const engineMetricHistoryRestResponseSchema: z.ZodObject<{
52
66
  }, z.core.$strict>>;
53
67
  updatedAt: z.ZodNullable<z.ZodISODateTime>;
54
68
  }, z.core.$strict>;
69
+ export declare const engineMetricHistoryV2RestResponseSchema: z.ZodObject<{
70
+ schemaVersion: z.ZodLiteral<"2">;
71
+ marketId: z.ZodString;
72
+ resolution: z.ZodLiteral<"12h">;
73
+ window: z.ZodEnum<{
74
+ "7d": "7d";
75
+ "30d": "30d";
76
+ "60d": "60d";
77
+ }>;
78
+ status: z.ZodEnum<{
79
+ ready: "ready";
80
+ warming_up: "warming_up";
81
+ no_data: "no_data";
82
+ }>;
83
+ pointCount: z.ZodNumber;
84
+ points: z.ZodArray<z.ZodObject<{
85
+ t: z.ZodNumber;
86
+ observedAt: z.ZodISODateTime;
87
+ blockNumber: z.ZodNumber;
88
+ utilizationPct: z.ZodNullable<z.ZodNumber>;
89
+ borrowAprPct: z.ZodNullable<z.ZodNumber>;
90
+ lendApyPct: z.ZodNullable<z.ZodNumber>;
91
+ ratePerSecondWad: z.ZodNullable<z.ZodString>;
92
+ rateSource: z.ZodNullable<z.ZodString>;
93
+ fullUtilizationRate: z.ZodNullable<z.ZodString>;
94
+ sharePriceWad: z.ZodNullable<z.ZodString>;
95
+ suppliedUsd: z.ZodNullable<z.ZodNumber>;
96
+ borrowedUsd: z.ZodNullable<z.ZodNumber>;
97
+ availableToBorrowUsd: z.ZodNullable<z.ZodNumber>;
98
+ baseFeePpm: z.ZodNullable<z.ZodNumber>;
99
+ activeFeePpm: z.ZodNullable<z.ZodNumber>;
100
+ surgeFeePpm: z.ZodNullable<z.ZodNumber>;
101
+ feeSource: z.ZodNullable<z.ZodString>;
102
+ surgeActive: z.ZodNullable<z.ZodBoolean>;
103
+ inCapEvent: z.ZodNullable<z.ZodBoolean>;
104
+ manualOverride: z.ZodNullable<z.ZodBoolean>;
105
+ perSwapMode: z.ZodNullable<z.ZodBoolean>;
106
+ warnings: z.ZodArray<z.ZodString>;
107
+ adaptiveTickThresholdTicks: z.ZodNullable<z.ZodNumber>;
108
+ adaptiveTickThresholdMode: z.ZodNullable<z.ZodLiteral<"post_swap_surge_trigger">>;
109
+ feeObservedAt: z.ZodNullable<z.ZodISODateTime>;
110
+ }, z.core.$strict>>;
111
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
112
+ }, z.core.$strict>;
55
113
  export declare const enginePositionsRestResponseSchema: z.ZodObject<{
56
114
  schemaVersion: z.ZodLiteral<"1">;
57
115
  chainId: z.ZodNumber;
@@ -0,0 +1,155 @@
1
+ import type { Address, Hex, PublicClient } from 'viem';
2
+ import type { AegisSwapChainConfig } from '../config/index.js';
3
+ import { type ClassifiedError } from '../errors.js';
4
+ import { type AegisTransactionObservation } from '../swap/receiptWait.js';
5
+ import { type Eip1193Provider } from '../wallet.js';
6
+ import type { AegisEngineApprovalInput, AegisEngineAuthorizationPlan, AegisEngineAuthorizationStepKind, AegisEngineMarket, AegisEngineToken, AegisEngineTradeDirection, AegisEngineTradeOpenQuote, AegisEngineTransactionResult } from './types.js';
7
+ export type AegisEngineTradeOpenIntent = Readonly<{
8
+ owner: Address;
9
+ market: AegisEngineMarket;
10
+ direction: AegisEngineTradeDirection;
11
+ token: AegisEngineToken;
12
+ amount: bigint;
13
+ leverage?: number;
14
+ horizonSeconds: number;
15
+ priceMove: number;
16
+ slippageBps: number;
17
+ maxPriceImpactBps: number;
18
+ approvalMode: 'exact' | 'max';
19
+ }>;
20
+ export type AegisEngineTradeExecutionStepStatus = 'planned' | 'wallet-requested' | 'submitted' | 'confirmed' | 'failed' | 'cancelled';
21
+ export type AegisEngineTradeExecutionStep = Readonly<{
22
+ kind: AegisEngineAuthorizationStepKind;
23
+ status: AegisEngineTradeExecutionStepStatus;
24
+ hash: Hex | null;
25
+ }>;
26
+ export type AegisEngineTradeExecutionFailure = ClassifiedError & Readonly<{
27
+ step: AegisEngineAuthorizationStepKind | null;
28
+ hash: Hex | null;
29
+ /**
30
+ * Last execution boundary observed before this failure.
31
+ *
32
+ * `submission` means the wallet transaction request started but returned no
33
+ * hash. It does not claim that signing completed or that the transaction
34
+ * reached the network. Optional only so existing v1 consumers that
35
+ * construct failure fixtures remain source-compatible; sessions created by
36
+ * this version always publish it.
37
+ */
38
+ failurePhase?: 'preparation' | 'wallet-request' | 'submission' | 'confirmation';
39
+ }>;
40
+ export type AegisEngineTradeExecutionRecovery = Readonly<{
41
+ kind: 'retry-wallet';
42
+ }> | Readonly<{
43
+ kind: 'switch-network';
44
+ chainId: number;
45
+ }> | Readonly<{
46
+ kind: 'review-quote';
47
+ }> | Readonly<{
48
+ kind: 'view-transaction';
49
+ hash: Hex;
50
+ }> | Readonly<{
51
+ kind: 'resume-remaining';
52
+ }> | Readonly<{
53
+ kind: 'none';
54
+ }>;
55
+ export type AegisEngineAuthorizationReviewReason = Readonly<{
56
+ kind: 'intent-changed';
57
+ }> | Readonly<{
58
+ kind: 'wallet-chain-switch-added';
59
+ }> | Readonly<{
60
+ kind: 'permission-added' | 'permission-changed' | 'unexpected-wallet-request';
61
+ step: AegisEngineAuthorizationStepKind;
62
+ }>;
63
+ export type AegisEngineTradeQuoteReviewReason = Readonly<{
64
+ kind: 'intent-changed';
65
+ }> | Readonly<{
66
+ kind: 'position-availability-changed' | 'swap-route-changed' | 'minimum-output-lower' | 'price-impact-higher' | 'displayed-leverage-changed' | 'opening-ltv-higher' | 'interest-higher' | 'target-return-lower' | 'borrow-limit-lower' | 'liquidation-threshold-lower' | 'utilization-worse-or-missing' | 'runway-shorter' | 'adaptive-fee-evidence-unavailable' | 'adaptive-fee-mode-changed' | 'adaptive-manual-override-changed' | 'adaptive-threshold-lower' | 'adaptive-surge-entered' | 'active-fee-higher';
67
+ }>;
68
+ export type AegisEngineTradeExecutionReview = Readonly<{
69
+ kind: 'permissions';
70
+ revision: number;
71
+ reasons: readonly AegisEngineAuthorizationReviewReason[];
72
+ }> | Readonly<{
73
+ kind: 'quote';
74
+ revision: number;
75
+ reasons: readonly AegisEngineTradeQuoteReviewReason[];
76
+ }>;
77
+ export type AegisEngineTradeExecutionPhase = 'ready' | 'executing' | 'quote-review-required' | 'awaiting-receipt' | 'resume-required' | 'success' | 'failed' | 'cancelled';
78
+ export type AegisEngineTradeExecutionNext = Readonly<{
79
+ kind: 'continue';
80
+ }> | Readonly<{
81
+ kind: 'accept-review';
82
+ revision: number;
83
+ }> | Readonly<{
84
+ kind: 'check-receipt';
85
+ hash: Hex;
86
+ }> | Readonly<{
87
+ kind: 'cancel';
88
+ }> | Readonly<{
89
+ kind: 'none';
90
+ }>;
91
+ export type AegisEngineTradeExecutionSnapshot = Readonly<{
92
+ schemaVersion: '1';
93
+ kind: 'engine-trade-open-execution';
94
+ sessionId: string;
95
+ sequence: number;
96
+ occurredAt: string;
97
+ chainId: number;
98
+ quoteRevision: number;
99
+ phase: AegisEngineTradeExecutionPhase;
100
+ plan: AegisEngineAuthorizationPlan;
101
+ quote: AegisEngineTradeOpenQuote;
102
+ review: AegisEngineTradeExecutionReview | null;
103
+ next: AegisEngineTradeExecutionNext;
104
+ steps: readonly AegisEngineTradeExecutionStep[];
105
+ currentStep: AegisEngineTradeExecutionStep | null;
106
+ completedPermissions: readonly AegisEngineAuthorizationStepKind[];
107
+ completedTransactions: readonly Readonly<{
108
+ kind: AegisEngineAuthorizationStepKind;
109
+ hash: Hex;
110
+ }>[];
111
+ transactionHash: Hex | null;
112
+ receiptSummary?: AegisEngineTransactionResult['summary'];
113
+ quoteReviewRequired: boolean;
114
+ failure: AegisEngineTradeExecutionFailure | null;
115
+ recovery: AegisEngineTradeExecutionRecovery;
116
+ }>;
117
+ export type AegisEngineTradeExecutionCommand = Readonly<{
118
+ kind: 'continue';
119
+ }> | Readonly<{
120
+ kind: 'accept-review';
121
+ revision: number;
122
+ }> | Readonly<{
123
+ kind: 'check-receipt';
124
+ }> | Readonly<{
125
+ kind: 'cancel';
126
+ }>;
127
+ export type AegisEngineTradeOpenExecutionSession = Readonly<{
128
+ getSnapshot: () => AegisEngineTradeExecutionSnapshot;
129
+ subscribe: (listener: () => void) => () => void;
130
+ dispatch: (command: AegisEngineTradeExecutionCommand, options?: Readonly<{
131
+ signal?: AbortSignal;
132
+ }>) => Promise<AegisEngineTradeExecutionSnapshot>;
133
+ }>;
134
+ export type AegisEngineTradeOpenExecutionSessionOptions = Readonly<{
135
+ wallet: Readonly<{
136
+ provider: Eip1193Provider;
137
+ account: Address;
138
+ }>;
139
+ publicClient: PublicClient;
140
+ activeChain: AegisSwapChainConfig;
141
+ intent: AegisEngineTradeOpenIntent;
142
+ reviewed: Readonly<{
143
+ plan: AegisEngineAuthorizationPlan;
144
+ quote: AegisEngineTradeOpenQuote;
145
+ }>;
146
+ onTransactionObservation?: (event: AegisTransactionObservation, stage: 'authorization' | 'action') => void;
147
+ onAuthorizationExecution?: AegisEngineApprovalInput['onAuthorizationExecution'];
148
+ sessionId?: string;
149
+ onChange?: (snapshot: AegisEngineTradeExecutionSnapshot) => void;
150
+ }>;
151
+ /** Pure review policy for newly introduced or materially changed wallet authority. */
152
+ export declare function engineAuthorizationPlanReviewReasons(reviewed: AegisEngineAuthorizationPlan, fresh: AegisEngineAuthorizationPlan): readonly AegisEngineAuthorizationReviewReason[];
153
+ /** Pure zero-tolerance policy for weaker or materially different quote facts. */
154
+ export declare function engineTradeQuoteReviewReasons(reviewed: AegisEngineTradeOpenQuote, fresh: AegisEngineTradeOpenQuote): readonly AegisEngineTradeQuoteReviewReason[];
155
+ export declare function createEngineTradeOpenExecutionSession(options: AegisEngineTradeOpenExecutionSessionOptions): AegisEngineTradeOpenExecutionSession;
@@ -1,3 +1,4 @@
1
+ import type { AegisTransactionObservation } from '../swap/receiptWait.js';
1
2
  import type { Address, Hex, PublicClient, TransactionReceipt } from 'viem';
2
3
  import type { AegisSwapChainConfig, AegisSwapToken } from '../config/index.js';
3
4
  import type { SignedPermitBatch } from '../encoding.js';
@@ -30,6 +31,13 @@ export type AegisEngineMarketMetrics = {
30
31
  manualOverride?: boolean | null;
31
32
  perSwapMode?: boolean | null;
32
33
  feeSource?: string | null;
34
+ /** Post-swap surge-trigger threshold from the opt-in REST v2 market plane.
35
+ * It is observability data, not a hard price, tick, or slippage limit. */
36
+ adaptiveTickThresholdTicks?: number;
37
+ /** Present exactly when adaptiveTickThresholdTicks is present. */
38
+ adaptiveTickThresholdMode?: 'post_swap_surge_trigger';
39
+ /** Fee-quote observation time from the opt-in REST v2 market plane. */
40
+ feeObservedAt?: string | null;
33
41
  computedAt?: string | null;
34
42
  updatedAt?: string | null;
35
43
  engineUpdatedAt?: string | null;
@@ -55,6 +63,7 @@ export type AegisEngineMarket = {
55
63
  source: AegisEngineMarketSource;
56
64
  status: AegisEngineMarketStatus;
57
65
  displayName: string;
66
+ labels?: string[];
58
67
  poolId: Hex;
59
68
  token0: AegisEngineToken;
60
69
  token1: AegisEngineToken;
@@ -109,6 +118,14 @@ export type AegisEngineMetricPoint = {
109
118
  inCapEvent: boolean | null;
110
119
  manualOverride: boolean | null;
111
120
  perSwapMode: boolean | null;
121
+ /** Required-nullable on the REST v2 wire; absent only after a 404 fallback
122
+ * to the frozen v1 history endpoint. */
123
+ adaptiveTickThresholdTicks?: number | null;
124
+ /** Paired with adaptiveTickThresholdTicks; describes a post-swap trigger,
125
+ * never an execution cap. */
126
+ adaptiveTickThresholdMode?: 'post_swap_surge_trigger' | null;
127
+ /** Required-nullable on the REST v2 wire; absent after a v1 fallback. */
128
+ feeObservedAt?: string | null;
112
129
  warnings: string[];
113
130
  };
114
131
  export type AegisEngineMetricHistory = {
@@ -347,8 +364,8 @@ export type AegisEnginePositionActivitySnapshot = {
347
364
  /** Off-chain opening intent for one confirmed Long/Short transaction. The
348
365
  * Engine transaction does not encode its target scenario or average leverage,
349
366
  * so consumers may persist this small record and join it back to the indexed
350
- * opening transaction. Indexed actions remain authoritative for direction and
351
- * entry price. */
367
+ * opening transaction. Indexed actions identify the opening direction; they do not prove an
368
+ * executed entry price. */
352
369
  export type AegisEngineTradePositionIntent = {
353
370
  schemaVersion: '1';
354
371
  chainId: number;
@@ -367,7 +384,7 @@ export type AegisEngineTradePositionIntent = {
367
384
  /** Durable Long/Short identity reconstructed from one vault's indexed opening
368
385
  * transaction. Optional scenario fields are present only when a matching
369
386
  * off-chain intent record survived; they never override indexed direction or
370
- * entry price. */
387
+ * supply execution evidence. */
371
388
  export type AegisEngineTradePositionStrategy = {
372
389
  kind: 'trade';
373
390
  vaultId: string;
@@ -375,8 +392,16 @@ export type AegisEngineTradePositionStrategy = {
375
392
  direction: AegisEngineTradeDirection;
376
393
  openTxHash: Hex;
377
394
  openedAt: number;
378
- /** Executed opening spot, token1 per token0, derived from DebtModified. */
395
+ /** Receipt-reconciled opening swap price in token1 per token0. Indexed
396
+ * Engine actions alone leave this null; this is not wallet cost basis or PnL. */
379
397
  entryPrice: number | null;
398
+ /** Missing on legacy host records; consumers must treat those as unverified. */
399
+ entryPriceBasis?: 'receipt-reconciled' | 'unavailable';
400
+ /** Informational debt-action ratio only. Never substitute it for entryPrice. */
401
+ referencePrice?: {
402
+ basis: 'debt-action-token-ratio';
403
+ price: number | null;
404
+ };
380
405
  /** Reviewed average leverage to the target scenario, not current leverage. */
381
406
  averageLeverage: number | null;
382
407
  /** Reviewed scenario only. Null when no matching intent record is available. */
@@ -396,6 +421,12 @@ export type AegisEngineBorrowPositionHydration = {
396
421
  rL: bigint;
397
422
  /** Accrued debt in L units at this hydration frame. */
398
423
  debtLLatest: bigint;
424
+ /** Rounded-up full-range repayment legs at the same verified block.
425
+ * Null/absent means USD debt and equity must not be estimated from L alone. */
426
+ debtAmounts?: {
427
+ amount0: bigint;
428
+ amount1: bigint;
429
+ } | null;
399
430
  idle0: bigint;
400
431
  idle1: bigint;
401
432
  /** Null when the vault has no debt, never a synthetic zero. */
@@ -440,6 +471,7 @@ export type AegisEnginePositionsHydrationInput = {
440
471
  export type AegisEngineRestSource = {
441
472
  kind: 'rest';
442
473
  baseUrl: string;
474
+ includeLabels?: boolean;
443
475
  headers?: Record<string, string>;
444
476
  /**
445
477
  * Maximum time for a shared REST request, including response-body parsing.
@@ -524,6 +556,21 @@ export type AegisEngineReadFrame = {
524
556
  /** Local wall-clock time when the frame was assembled, in Unix milliseconds. */
525
557
  observedAt: number;
526
558
  };
559
+ /** Block-pinned DFM state. The threshold is observed after execution and can
560
+ * activate or adapt surge fees; it is not an on-chain swap limit. */
561
+ export type AegisEngineAdaptiveFeeEvidence = {
562
+ source: 'rpc';
563
+ enforcement: 'post-swap-surge-trigger';
564
+ evaluationScope: 'per-swap' | 'per-block';
565
+ blockNumber: bigint;
566
+ activeFeePpm: number;
567
+ baseFeePpm: number;
568
+ surgeFeePpm: number;
569
+ adaptiveTickThresholdTicks: number;
570
+ surgeActive: boolean;
571
+ inCapEvent: boolean;
572
+ manualOverride: boolean;
573
+ };
527
574
  export type AegisEngineVersion = 'v0.4.0' | 'v1.0.2' | 'v1.0.3';
528
575
  export type AegisEngineBorrowMarketContext = {
529
576
  poolId: Hex;
@@ -587,6 +634,9 @@ export type AegisEngineQuoteBase = {
587
634
  };
588
635
  export type AegisEngineDepositQuoteInput = AegisEngineQuoteBase & {
589
636
  amountIn: bigint;
637
+ /** Required host policy. A swap quote above this block-pinned impact is
638
+ * returned as non-executable; this is independent of output slippage. */
639
+ maxPriceImpactBps: number;
590
640
  };
591
641
  /**
592
642
  * Live snapshot of an already-open borrow vault, in the pool's real token
@@ -648,7 +698,7 @@ export type AegisEngineBorrowCapacityInput = Omit<AegisEngineQuoteBase, 'owner'
648
698
  export type AegisEngineDepositQuoteResult = {
649
699
  feasible: boolean;
650
700
  executable: boolean;
651
- infeasibleReason?: 'invalid-input' | 'quote-unavailable' | 'insufficient-output' | 'zero-liquidity' | 'builder-error';
701
+ infeasibleReason?: 'invalid-input' | 'quote-unavailable' | 'price-impact-unavailable' | 'price-impact-limit' | 'insufficient-output' | 'zero-liquidity' | 'builder-error';
652
702
  /** SDK recipe input retained for diagnostics. Use `tx` on the enclosing
653
703
  * Core quote for execution instead of encoding this value downstream. */
654
704
  encodeInput: unknown | null;
@@ -706,6 +756,9 @@ export type AegisEngineDepositQuote = {
706
756
  kind: 'lend';
707
757
  market: AegisEngineMarket;
708
758
  inputToken: AegisEngineToken;
759
+ /** Same-block DFM evidence when the trusted RPC read succeeded. Null means
760
+ * the quote carries no adaptive-fee observation, never a zero threshold. */
761
+ adaptiveFee?: AegisEngineAdaptiveFeeEvidence | null;
709
762
  quote: AegisEngineDepositQuoteResult;
710
763
  tx: AegisEnginePreparedTransaction | null;
711
764
  };
@@ -805,12 +858,28 @@ export type AegisEngineTradeOpenQuoteInput = {
805
858
  /** @deprecated Ignored. Spec-0168 always selects the lower-debt frontier. */
806
859
  rootPolicy?: AegisEngineTapRootPolicy;
807
860
  slippageBps: number;
861
+ /** Required host policy. Core rejects a block-pinned internal swap whose
862
+ * price impact exceeds this value. It is not a pool-movement invariant. */
863
+ maxPriceImpactBps: number;
808
864
  deadline?: bigint;
809
865
  /** Abort a superseded indicative quote between its block-pinned phases. */
810
866
  signal?: AbortSignal;
811
867
  /** Submit paths set this after changing router authorization. */
812
868
  forceExecutionEvidenceRefresh?: boolean;
813
869
  };
870
+ /** Exact caller-owned strategy and safety policy that produced a Trade quote.
871
+ * Execution sessions bind this echo before any wallet request. */
872
+ export type AegisEngineTradeOpenQuoteIntent = Readonly<{
873
+ owner: Address;
874
+ inputIsToken0: boolean;
875
+ collateralIn: bigint;
876
+ /** Null means the quote selected the live maximum. */
877
+ leverage: number | null;
878
+ horizonSeconds: number;
879
+ priceMove: number;
880
+ slippageBps: number;
881
+ maxPriceImpactBps: number;
882
+ }>;
814
883
  export type AegisEngineTradeOpenInfeasibleReason = AegisEngineTapInfeasibleReason['kind']
815
884
  /** The chosen root's swap trades against the requested direction at entry. */
816
885
  | 'swap-direction-mismatch'
@@ -821,7 +890,11 @@ export type AegisEngineTradeOpenInfeasibleReason = AegisEngineTapInfeasibleReaso
821
890
  /** LTV recomputed from the encoded amounts is at or above the open cap. */
822
891
  | 'ltv-above-max'
823
892
  /** The swap was quoted at a different block than the sizing state. */
824
- | 'stale-frame';
893
+ | 'stale-frame'
894
+ /** The block-pinned quote could not produce a finite impact assessment. */
895
+ | 'price-impact-unavailable'
896
+ /** The block-pinned quote exceeded the host's required impact limit. */
897
+ | 'price-impact-limit';
825
898
  /** Actionable bounds for a rejected quote. Each field is null when the
826
899
  * rejection did not produce one. */
827
900
  export type AegisEngineTradeOpenLimits = {
@@ -867,8 +940,25 @@ export type AegisEngineTradeOpenPosition = {
867
940
  /** Gross return from exact entry equity to target equity, before horizon
868
941
  * interest. The encoded swap output floor is already reflected in both. */
869
942
  grossReturnAtTargetPct: number;
943
+ /** Indicative equity at the reviewed prices, in token1 major units. Uses
944
+ * the quote rate held constant; excludes gas and future closing costs. */
945
+ scenario?: {
946
+ entryEquity: number;
947
+ targetEquityAfterInterest: number;
948
+ targetInterest: number;
949
+ };
870
950
  /** Borrow principal in rL units. */
871
951
  principalDeltaRl: bigint;
952
+ /**
953
+ * Market utilization immediately before and after this position's final,
954
+ * integer-rounded debt is added. Both values come from the quote's pinned
955
+ * market frame; consumers must not mix in a REST utilization snapshot.
956
+ */
957
+ marketUtilization?: {
958
+ beforePips: number;
959
+ afterPips: number;
960
+ capPips?: number;
961
+ };
872
962
  /** Vault idle at lock, in base units — the collateral `lockVault` values. */
873
963
  collateral0: bigint;
874
964
  collateral1: bigint;
@@ -894,6 +984,8 @@ export type AegisEngineTradeOpenQuote = {
894
984
  market: AegisEngineMarket;
895
985
  direction: AegisEngineTradeDirection;
896
986
  collateralToken: AegisEngineToken;
987
+ /** Exact request identity used to build this quote. */
988
+ intent: AegisEngineTradeOpenQuoteIntent;
897
989
  /** Thresholds read in the same live frame used to size the position. */
898
990
  thresholds: {
899
991
  maxLtvPips: number;
@@ -908,6 +1000,8 @@ export type AegisEngineTradeOpenQuote = {
908
1000
  position: AegisEngineTradeOpenPosition | null;
909
1001
  /** Null when the borrow already delivers the target mix. */
910
1002
  swap: AegisEngineTradeOpenSwap | null;
1003
+ /** Same-block DFM evidence. This is review telemetry, not an execution cap. */
1004
+ adaptiveFee?: AegisEngineAdaptiveFeeEvidence | null;
911
1005
  deposit: {
912
1006
  amount0: bigint;
913
1007
  amount1: bigint;
@@ -974,6 +1068,13 @@ export type AegisEnginePositionActionQuote = {
974
1068
  } | null;
975
1069
  /** Borrow principal affected by repay/close, in rL units. */
976
1070
  principalDeltaRl: bigint | null;
1071
+ requestedRepayProjection?: {
1072
+ ltvPips: number | null;
1073
+ debtFree: boolean;
1074
+ idle0: bigint;
1075
+ idle1: bigint;
1076
+ debtL: bigint;
1077
+ } | null;
977
1078
  /** Exact idle token amounts requested by withdraw. */
978
1079
  withdraw: {
979
1080
  amount0: bigint;
@@ -1211,7 +1312,10 @@ export type AegisEnginePreparedTransaction = {
1211
1312
  export type AegisEngineSignedPermitBatch = SignedPermitBatch;
1212
1313
  export type AegisEngineWalletSession = WalletSession;
1213
1314
  export type AegisEngineActionCallbacks = {
1315
+ onTransactionObservation?: (event: AegisTransactionObservation) => void;
1214
1316
  onStatus?: (status: 'approving' | 'signing' | 'submitting' | 'success' | 'idle') => void;
1317
+ /** Fires after simulation and chain guards, immediately before the wallet request. */
1318
+ onWalletRequest?: () => void;
1215
1319
  onTxHash?: (hash: Hex | null) => void;
1216
1320
  onSubmitted?: (hash: Hex) => void;
1217
1321
  };
@@ -1235,8 +1339,11 @@ export type AegisEngineAuthorizationStep = {
1235
1339
  id: AegisEngineAuthorizationStepKind;
1236
1340
  kind: AegisEngineAuthorizationStepKind;
1237
1341
  status: AegisEngineAuthorizationStepStatus;
1238
- /** Every current Long/Short authorization is an on-chain wallet transaction. */
1239
- walletAction: 'transaction';
1342
+ /**
1343
+ * Wallet interaction required by this step. Permit2 signature mode can fall
1344
+ * back to an on-chain spending-cap transaction when typed data is unavailable.
1345
+ */
1346
+ walletAction: 'transaction' | 'signature-or-transaction';
1240
1347
  /** Contract the wallet action targets. */
1241
1348
  target: Address;
1242
1349
  /** Contract receiving authority, when distinct from the target. */
@@ -1245,6 +1352,7 @@ export type AegisEngineAuthorizationStep = {
1245
1352
  token: AegisEngineToken | null;
1246
1353
  /** Current on-chain allowance, when the step governs a token amount. */
1247
1354
  currentAmount: bigint | null;
1355
+ currentExpiration?: number | null;
1248
1356
  /** Amount a required wallet action will set. Null for satisfied or non-token actions. */
1249
1357
  requestedAmount: bigint | null;
1250
1358
  /** Permit2 expiry in Unix seconds. Null when the authority has no expiry field. */
@@ -1277,7 +1385,7 @@ export type AegisEngineAuthorizationPlan = {
1277
1385
  missingPermissionCount: number;
1278
1386
  /** True when the known wallet chain adds a network-switch request; null when unknown. */
1279
1387
  walletChainSwitchRequired: boolean | null;
1280
- /** Sequential transaction request count. A network switch is reported separately. */
1388
+ /** Sequential wallet-action count. A network switch is reported separately. */
1281
1389
  walletPromptCount: number;
1282
1390
  /** True when only the final position transaction remains. */
1283
1391
  readyForOpen: boolean;
@@ -1292,12 +1400,16 @@ export type AegisEngineAuthorizationPlanInput = {
1292
1400
  token: AegisEngineToken;
1293
1401
  amount: bigint;
1294
1402
  approvalMode?: 'exact' | 'max';
1403
+ /** Must match the authorization mode used when the reviewed plan is executed. */
1404
+ permit2AuthorizationMode?: 'signature' | 'spending-cap';
1295
1405
  };
1296
1406
  export type AegisEngineAuthorizationProgress = {
1297
1407
  kind: AegisEngineAuthorizationStepKind;
1298
1408
  status: 'requesting' | 'confirmed';
1299
1409
  };
1300
- /** Lifecycle evidence for one Engine permission request. */
1410
+ /** Truthful per-prerequisite lifecycle. Kept separate from the legacy
1411
+ * requesting/confirmed projection so existing exhaustive consumers do not
1412
+ * break when submitted and terminal states are added. */
1301
1413
  export type AegisEngineAuthorizationExecutionEvent = Readonly<{
1302
1414
  kind: AegisEngineAuthorizationStepKind;
1303
1415
  status: 'wallet-requested';
@@ -1306,13 +1418,15 @@ export type AegisEngineAuthorizationExecutionEvent = Readonly<{
1306
1418
  kind: AegisEngineAuthorizationStepKind;
1307
1419
  status: 'submitted';
1308
1420
  hash: Hex;
1421
+ replacesHash?: Hex;
1422
+ executionChanged?: boolean;
1309
1423
  }> | Readonly<{
1310
1424
  kind: AegisEngineAuthorizationStepKind;
1311
1425
  status: 'confirmed';
1312
1426
  hash: Hex | null;
1313
1427
  }> | Readonly<{
1314
1428
  kind: AegisEngineAuthorizationStepKind;
1315
- status: 'cancelled' | 'failed';
1429
+ status: 'failed' | 'cancelled';
1316
1430
  hash: Hex | null;
1317
1431
  error: ClassifiedError;
1318
1432
  }>;
@@ -1320,9 +1434,9 @@ export type AegisEngineApprovalInput = {
1320
1434
  wallet: AegisEngineWalletSession;
1321
1435
  publicClient: PublicClient;
1322
1436
  activeChain: AegisSwapChainConfig;
1437
+ /** Reviewed market used to resolve Permit2 and router from the trusted registry. */
1438
+ market: AegisEngineMarket;
1323
1439
  token: AegisEngineToken;
1324
- permit2: Address;
1325
- router: Address;
1326
1440
  amount: bigint;
1327
1441
  approvalMode?: 'exact' | 'max';
1328
1442
  permit2AuthorizationMode?: 'signature' | 'spending-cap';
@@ -1331,7 +1445,7 @@ export type AegisEngineApprovalInput = {
1331
1445
  onStatus?: AegisEngineActionCallbacks['onStatus'];
1332
1446
  /** Fine-grained prerequisite progress for truthful wallet onboarding. */
1333
1447
  onAuthorizationProgress?: (progress: AegisEngineAuthorizationProgress) => void;
1334
- /** Full prerequisite lifecycle at the wallet and receipt boundaries. */
1448
+ /** Full prerequisite lifecycle at the real wallet and receipt boundaries. */
1335
1449
  onAuthorizationExecution?: (event: AegisEngineAuthorizationExecutionEvent) => void;
1336
1450
  /** Awaited after each prerequisite receipt and before another wallet request. */
1337
1451
  onAuthorizationCheckpoint?: () => Promise<void>;
@@ -0,0 +1,5 @@
1
+ export type AegisEngineV4ExactInputFrameQuote = Readonly<{
2
+ amountOut: bigint;
3
+ gasEstimate: bigint;
4
+ blockNumber: bigint;
5
+ }>;
package/dist/index.d.ts CHANGED
@@ -1,37 +1,40 @@
1
- export { AEGIS_DYNAMIC_FEE_FLAG, AEGIS_SWAP_CHAINS, AEGIS_SWAP_CHAIN_ID, AEGIS_SWAP_DEFAULT_FEE_BPS, AEGIS_SWAP_DEFAULT_FEE_RECIPIENT, AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT, AEGIS_SWAP_DEFAULT_RPC_URLS, AEGIS_SWAP_HOOK, AEGIS_SWAP_MAINNET_CHAIN, AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS, AEGIS_SWAP_PERMIT2, AEGIS_SWAP_ROUTER, AEGIS_SWAP_TOKENS, AEGIS_SWAP_TRUSTED_ROUTERS_BY_CHAIN, AEGIS_SWAP_V4_QUOTER, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_DEFAULT_TOKENS, AGGREGATED_SWAP_SUPPORTED_CHAIN_IDS, AGGREGATED_SWAP_TOKEN_PRESETS, AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST, AGGREGATED_SWAP_WOLFGAME_TOKENS, UNISWAP_V4_CONTRACTS_BY_CHAIN, createAegisSwapChainConfig, createAegisSwapChains, createAegisSwapMarketsFromPools, createAegisSwapPoolMarket, createAegisSwapUniswapV4Contracts, getExplorerUrl } from './config/index.js';
2
- export type { AegisPoolKey, AegisSwapBuiltInTokenSymbol, AegisSwapChainConfig, AegisSwapChainConfigInput, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapPoolConfig, AegisSwapToken, AegisSwapTokenSymbol, AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapTokenSymbol, AggregatedSwapWolfGameTokenSymbol } from './config/index.js';
1
+ export { AEGIS_DYNAMIC_FEE_FLAG, AEGIS_SWAP_BSC_CHAIN, AEGIS_SWAP_BSC_CHAIN_ID, AEGIS_SWAP_BSC_HOOK, AEGIS_SWAP_BSC_ROUTER, AEGIS_SWAP_BSC_RPC_URLS, AEGIS_SWAP_BSC_TOKENS, AEGIS_SWAP_CHAINS, AEGIS_SWAP_CHAIN_ID, AEGIS_SWAP_DEFAULT_FEE_BPS, AEGIS_SWAP_DEFAULT_FEE_RECIPIENT, AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT, AEGIS_SWAP_DEFAULT_RPC_URLS, AEGIS_SWAP_HOOK, AEGIS_SWAP_MAINNET_CHAIN, AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS, AEGIS_SWAP_PERMIT2, AEGIS_SWAP_ROUTER, AEGIS_SWAP_TOKENS, AEGIS_SWAP_TRUSTED_ROUTERS_BY_CHAIN, AEGIS_SWAP_V4_QUOTER, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_DEFAULT_TOKENS, AGGREGATED_SWAP_SUPPORTED_CHAIN_IDS, AGGREGATED_SWAP_TOKEN_PRESETS, AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST, AGGREGATED_SWAP_WOLFGAME_TOKENS, UNISWAP_V4_CONTRACTS_BY_CHAIN, createAegisSwapChainConfig, createAegisSwapChains, createAegisSwapMarketsFromPools, createAegisSwapPoolMarket, createAegisSwapUniswapV4Contracts, getExplorerUrl } from './config/index.js';
2
+ export type { AegisPoolKey, AegisSwapBscTokenSymbol, AegisSwapBuiltInTokenSymbol, AegisSwapChainConfig, AegisSwapChainConfigInput, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapPoolConfig, AegisSwapToken, AegisSwapTokenSymbol, AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapTokenSymbol, AggregatedSwapWolfGameTokenSymbol } from './config/index.js';
3
3
  export { assertUint128, buildExactInSwapTransaction, buildExactOutSwapTransaction, computePoolId, MAX_UINT128 } from './encoding.js';
4
4
  export type { BuiltSwapTransaction, ExecutionBatch, PermitBatch, PermitDetails, SignedPermitBatch, SwapOutputFee } from './encoding.js';
5
5
  export { getZeroForOne, outputFeeForQuote, quoteSpendAmount, reconcileSubmitQuote, sameQuote } from './quote.js';
6
6
  export type { DirectSwapQuote, ReconciledSubmitQuote, SwapQuoteMode } from './quote.js';
7
7
  export { AggregatedSwapBuildMismatchError, aggregatedSwapErrorMessage, fetchAggregatedSwapQuote } from './quote/aggregatedSwapQuote.js';
8
+ export type { AggregatedSwapExecutionIntent } from './quote/aggregatedSwapQuote.js';
8
9
  export { AggregatedSwapCalldataError } from './quote/kyberCalldata.js';
9
10
  export type { AggregatedSwapQuote, AggregatedSwapRoute, HopInfo } from './types/aggregatedSwap.js';
10
- export { KyberSwapApiError, KyberSwapContractError, buildKyberSwapRoute, fetchKyberSwapRoute, isRetryableKyberSwapError } from './services/kyberSwap.js';
11
+ export { KyberSwapApiError, KyberSwapContractError, KyberSwapResourceLimitError, buildKyberSwapRoute, fetchKyberSwapRoute, isRetryableKyberSwapError } from './services/kyberSwap.js';
11
12
  export type { KyberSwapBuild, KyberSwapError, KyberSwapFeeParams, KyberSwapRoute, KyberSwapRouteLeg, KyberSwapRouteSummary } from './services/kyberSwap.js';
12
- export { approveErc20Spender, approveErc20ToPermit2, approvePermit2ToRouter, buildSignedPermitBatch, DEFAULT_PERMIT_EXPIRATION_SECONDS, MAX_UINT160, MAX_UINT256, PERMIT2_FAR_FUTURE_EXPIRATION, readErc20Allowance, readPermit2RouterAllowance, SWAP_TX_DEADLINE_SECONDS } from './permit.js';
13
+ export { approveErc20Spender, approveErc20ToPermit2, approvePermit2ToRouter, buildSignedPermitBatch, DEFAULT_PERMIT_EXPIRATION_SECONDS, hasUsablePermit2Allowance, isUnlimitedErc20Approval, isUnlimitedPermit2Approval, MAX_UINT160, MAX_UINT256, PERMIT2_FAR_FUTURE_EXPIRATION, readErc20Allowance, readPermit2RouterAllowance, SWAP_TX_DEADLINE_SECONDS, UNLIMITED_ERC20_FLOOR, UNLIMITED_PERMIT2_FLOOR } from './permit.js';
13
14
  export { fetchGlobalTokenMetadata, resolveTokenIconUrl } from './metadata.js';
14
15
  export type { AegisSwapGlobalTokenMetadata, TokenMetadataByAddress } from './metadata.js';
15
- export { clearTokenPriceHistoryCache, fetchTokenPriceHistory, peekTokenPriceHistory } from './historicalPrices.js';
16
+ export { clearTokenPriceHistoryCache, fetchTokenPriceHistory, peekTokenPriceHistory, tokenPriceHistoryRestResponseSchema } from './historicalPrices.js';
16
17
  export type { AegisTokenPriceHistory, AegisTokenPriceHistoryStatus, AegisTokenPriceHistoryWindow, AegisTokenPricePoint } from './historicalPrices.js';
17
- export { createSwapPublicClient, getInjectedProvider, getProviderAccount, getProviderChainId, isEip1193Provider, normalizeAccount, normalizeWalletConnection, requestProviderAccount, subscribeProvider, switchProviderChain } from './wallet.js';
18
+ export { createSwapPublicClient, getInjectedProvider, getProviderAccount, getProviderChainId, isEip1193Provider, normalizeAccount, normalizeWalletConnection, requestProviderAccount, SDK_RPC_MULTICALL_RULE_ID, subscribeProvider, switchProviderChain } from './wallet.js';
18
19
  export type { AegisSwapProviderResolver, AegisSwapWalletConnection, Eip1193Provider, ProviderChainConfig } from './wallet.js';
19
20
  export { approveDirectPoolSwapInput, DirectPoolSwapPriceMovedError, executeDirectPoolSwap, fetchDirectPoolSwapQuote } from './actions/directPoolSwap.js';
20
21
  export type { DirectPoolSwapApprovalResult } from './actions/directPoolSwap.js';
21
22
  export { isNativeAssetAddress } from './address.js';
22
23
  export { approveKyberSwapInput, executeKyberSwap, isNativeToken, KyberSwapPriceMovedError, NATIVE_TOKEN_ADDRESS } from './actions/kyberSwap.js';
23
24
  export type { KyberSwapApprovalResult } from './actions/kyberSwap.js';
25
+ export { erc20ApprovalRequest, requiresErc20ApprovalReset } from './actions/allowance.js';
24
26
  export { ensureWalletChain, resolveWalletSession, waitForProviderChain } from './actions/wallet.js';
25
27
  export type { AegisSwapActionCallbacks, AegisSwapActionResult, AegisSwapApprovalProgress, AegisSwapApprovalRequest, AegisSwapAuthorizationProgress } from './actions/types.js';
26
28
  export { estimateSwapGasWithBuffer } from './swap/gas.js';
27
29
  export type { SwapGasRequest } from './swap/gas.js';
30
+ export { assertDirectSwapMarketTrusted, authorizeHostDirectSwapMarket, DIRECT_SWAP_MARKET_TRUST_RULE_ID, DirectSwapMarketTrustError, isDirectSwapMarketTrusted } from './swap/trustedMarket.js';
28
31
  export type { AegisSwapApprovalMode, AegisSwapSubmitDetails, WalletSession } from './swap/types.js';
29
32
  export { classifyError, errorMessage, isSubmittedTransactionReceiptError, isUserRejectedError, SubmittedTransactionReceiptError, TransactionReceiptTimeoutError, USER_REJECTED_MESSAGE, UserFacingError } from './errors.js';
30
33
  export type { ClassifiedError, UserFacingErrorKind } from './errors.js';
31
34
  export { isBusy, progressRailSteps, transactionProgressView, transactionSequenceProgress } from './transactionProgress.js';
32
35
  export type { AegisSwapReceiptSummary, AegisSwapStatusSnapshot, AegisSwapStatusTransactionContext, AegisSwapStatusTransactionToken, AegisSwapWalletPromptProgress, SubmitStatus, TransactionProgressState, TransactionProgressView } from './transactionProgress.js';
33
36
  export { reconcileSubmittedReceipt } from './swap/receiptWait.js';
34
- export type { SubmittedReceiptOutcome } from './swap/receiptWait.js';
37
+ export type { SubmittedReceiptOutcome, AegisTransactionObservation } from './swap/receiptWait.js';
35
38
  export { summarizeTransactionReceipt } from './swap/sendSwapTransaction.js';
36
39
  export { isDocumentVisible, pollUntil, retryOnError } from './polling.js';
37
40
  export { AEGIS_BACKEND_PROD_BASE_URL, AegisBackendApiError, AegisBackendContractError, createAegisBackendApiClient, isRetryableAegisBackendApiError, normalizeAegisBackendBaseUrl } from './contract/backendClient.js';
@@ -42,3 +45,4 @@ export { aegisBackendAddressAllowlistSchema, aegisBackendAddressSchema, aegisBac
42
45
  export type { AegisContractGuardCode } from './contract/index.js';
43
46
  export { engineMarketsRestResponseSchema } from './engine/restSchemas.js';
44
47
  export * from './engine/index.js';
48
+ export { PortfolioQuerySchema, PortfolioPageQuerySchema, PortfolioResponseSchema, PortfolioPageSchema } from './engine/account/portfolioSchemas.js';