@aegis-engine/core 0.2.0 → 0.3.1

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 (42) hide show
  1. package/README.md +109 -4
  2. package/THIRD_PARTY_NOTICES.md +211 -0
  3. package/dist/actions/kyberSwap.d.ts +3 -2
  4. package/dist/address.d.ts +3 -1
  5. package/dist/aegis-core.js +8565 -5305
  6. package/dist/backendAdapters.d.ts +25 -1
  7. package/dist/config/constants.d.ts +4 -0
  8. package/dist/config/types.d.ts +5 -0
  9. package/dist/contract/backendClient.d.ts +16 -6
  10. package/dist/contract/generated/aegis-swap.d.ts +2682 -96
  11. package/dist/contract/schemas.d.ts +27 -20
  12. package/dist/engine/actions.d.ts +56 -0
  13. package/dist/engine/borrowCostProjection.d.ts +1 -0
  14. package/dist/engine/dataSource.d.ts +63 -0
  15. package/dist/engine/index.d.ts +8 -0
  16. package/dist/engine/marketAdapter.d.ts +8 -0
  17. package/dist/engine/positionAmounts.d.ts +37 -0
  18. package/dist/engine/quotes.d.ts +9 -0
  19. package/dist/engine/reads.d.ts +43 -0
  20. package/dist/engine/registry.d.ts +27 -0
  21. package/dist/engine/restSchemas.d.ts +409 -0
  22. package/dist/engine/sdk.d.ts +1 -0
  23. package/dist/engine/sdkRuntime.d.ts +1 -0
  24. package/dist/engine/types.d.ts +1000 -0
  25. package/dist/errors.d.ts +10 -0
  26. package/dist/historicalPrices.d.ts +78 -0
  27. package/dist/index.d.ts +13 -8
  28. package/dist/internal/requestSignal.d.ts +9 -0
  29. package/dist/internal/ttlCache.d.ts +19 -0
  30. package/dist/metadata.d.ts +4 -0
  31. package/dist/permit.d.ts +1 -0
  32. package/dist/quote/aggregatedSwapQuote.d.ts +12 -0
  33. package/dist/quote/kyberCalldata.d.ts +211 -0
  34. package/dist/quote.d.ts +1 -0
  35. package/dist/sdkRuntime-CCRVvSwD.js +16052 -0
  36. package/dist/services/kyberSwap.d.ts +22 -2
  37. package/dist/swap/receiptWait.d.ts +17 -0
  38. package/dist/swap/sendSwapTransaction.d.ts +40 -6
  39. package/dist/swap/settlement.d.ts +15 -0
  40. package/dist/transactionProgress.d.ts +8 -1
  41. package/dist/types/aggregatedSwap.d.ts +18 -0
  42. package/package.json +15 -7
@@ -16,16 +16,16 @@ export declare const aegisBackendMarketStatusSchema: z.ZodEnum<{
16
16
  enabled: "enabled";
17
17
  disabled: "disabled";
18
18
  }>;
19
- export declare const aegisBackendChainIdSchema: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
19
+ export declare const aegisBackendChainIdSchema: z.ZodLiteral<1 | 130 | 8453>;
20
20
  export declare const aegisBackendChainSchema: z.ZodObject<{
21
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
21
+ chainId: z.ZodNumber;
22
22
  slug: z.ZodString;
23
23
  name: z.ZodString;
24
24
  }, z.core.$strip>;
25
25
  export declare const aegisBackendQuoteDefaultsSchema: z.ZodObject<{
26
- ttlSeconds: z.ZodLiteral<15>;
27
- defaultSlippageBps: z.ZodLiteral<100>;
28
- maxSlippageBps: z.ZodLiteral<2000>;
26
+ ttlSeconds: z.ZodNumber;
27
+ defaultSlippageBps: z.ZodNumber;
28
+ maxSlippageBps: z.ZodNumber;
29
29
  }, z.core.$strip>;
30
30
  export declare const aegisBackendContractRegistrySchema: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
31
31
  export declare const aegisBackendAddressAllowlistSchema: z.ZodObject<{
@@ -52,13 +52,13 @@ export declare const aegisBackendAllowlistsByChainSchema: z.ZodObject<{
52
52
  }, z.core.$strip>;
53
53
  }, z.core.$strip>;
54
54
  export declare const aegisBackendFeeConfigSchema: z.ZodObject<{
55
- outputFeeBps: z.ZodLiteral<50>;
55
+ outputFeeBps: z.ZodNumber;
56
56
  recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
57
57
  }, z.core.$strip>;
58
58
  export declare const aegisBackendConfigSchema: z.ZodObject<{
59
59
  schemaVersion: z.ZodLiteral<"1">;
60
60
  chains: z.ZodArray<z.ZodObject<{
61
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
61
+ chainId: z.ZodNumber;
62
62
  slug: z.ZodString;
63
63
  name: z.ZodString;
64
64
  }, z.core.$strip>>;
@@ -67,9 +67,9 @@ export declare const aegisBackendConfigSchema: z.ZodObject<{
67
67
  kyber: "kyber";
68
68
  }>>;
69
69
  quote: z.ZodObject<{
70
- ttlSeconds: z.ZodLiteral<15>;
71
- defaultSlippageBps: z.ZodLiteral<100>;
72
- maxSlippageBps: z.ZodLiteral<2000>;
70
+ ttlSeconds: z.ZodNumber;
71
+ defaultSlippageBps: z.ZodNumber;
72
+ maxSlippageBps: z.ZodNumber;
73
73
  }, z.core.$strip>;
74
74
  contracts: z.ZodObject<{
75
75
  '1': z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
@@ -91,13 +91,13 @@ export declare const aegisBackendConfigSchema: z.ZodObject<{
91
91
  }, z.core.$strip>;
92
92
  }, z.core.$strip>;
93
93
  fee: z.ZodObject<{
94
- outputFeeBps: z.ZodLiteral<50>;
94
+ outputFeeBps: z.ZodNumber;
95
95
  recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
96
96
  }, z.core.$strip>;
97
97
  }, z.core.$strip>;
98
98
  export declare const aegisBackendTokenSchema: z.ZodObject<{
99
99
  id: z.ZodString;
100
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
100
+ chainId: z.ZodNumber;
101
101
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
102
102
  symbol: z.ZodString;
103
103
  displayName: z.ZodString;
@@ -120,8 +120,8 @@ export declare const aegisPoolKeySchema: z.ZodObject<{
120
120
  hooks: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
121
121
  }, z.core.$strip>;
122
122
  export declare const aegisBackendMarketSchema: z.ZodObject<{
123
- id: z.ZodString;
124
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
123
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
124
+ chainId: z.ZodNumber;
125
125
  status: z.ZodEnum<{
126
126
  enabled: "enabled";
127
127
  disabled: "disabled";
@@ -152,7 +152,7 @@ export declare const aegisBackendMarketSchema: z.ZodObject<{
152
152
  export declare const aegisBackendSwapQuoteRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
153
153
  mode: z.ZodLiteral<"exactIn">;
154
154
  amountIn: z.ZodString;
155
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
155
+ chainId: z.ZodLiteral<1 | 130 | 8453>;
156
156
  provider: z.ZodEnum<{
157
157
  "aegis-direct-v4": "aegis-direct-v4";
158
158
  kyber: "kyber";
@@ -165,7 +165,7 @@ export declare const aegisBackendSwapQuoteRequestSchema: z.ZodDiscriminatedUnion
165
165
  }, z.core.$loose>, z.ZodObject<{
166
166
  mode: z.ZodLiteral<"exactOut">;
167
167
  amountOut: z.ZodString;
168
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
168
+ chainId: z.ZodLiteral<1 | 130 | 8453>;
169
169
  provider: z.ZodEnum<{
170
170
  "aegis-direct-v4": "aegis-direct-v4";
171
171
  kyber: "kyber";
@@ -190,7 +190,7 @@ export declare const aegisBackendSwapQuoteResponseSchema: z.ZodObject<{
190
190
  price: z.ZodNumber;
191
191
  slippageBps: z.ZodNumber;
192
192
  fee: z.ZodObject<{
193
- outputFeeBps: z.ZodLiteral<50>;
193
+ outputFeeBps: z.ZodNumber;
194
194
  recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
195
195
  }, z.core.$strip>;
196
196
  asOf: z.ZodISODateTime;
@@ -201,7 +201,7 @@ export declare const aegisBackendHealthResponseSchema: z.ZodObject<{
201
201
  }, z.core.$strip>;
202
202
  export declare const aegisBackendTokensResponseSchema: z.ZodArray<z.ZodObject<{
203
203
  id: z.ZodString;
204
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
204
+ chainId: z.ZodNumber;
205
205
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
206
206
  symbol: z.ZodString;
207
207
  displayName: z.ZodString;
@@ -212,8 +212,8 @@ export declare const aegisBackendTokensResponseSchema: z.ZodArray<z.ZodObject<{
212
212
  stable: z.ZodBoolean;
213
213
  }, z.core.$strip>>;
214
214
  export declare const aegisBackendMarketsResponseSchema: z.ZodArray<z.ZodObject<{
215
- id: z.ZodString;
216
- chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
215
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
216
+ chainId: z.ZodNumber;
217
217
  status: z.ZodEnum<{
218
218
  enabled: "enabled";
219
219
  disabled: "disabled";
@@ -241,3 +241,10 @@ export declare const aegisBackendMarketsResponseSchema: z.ZodArray<z.ZodObject<{
241
241
  "cap-event": "cap-event";
242
242
  }>>;
243
243
  }, z.core.$strip>>;
244
+ export declare function refineHistorySeries(value: {
245
+ status: 'ready' | 'warming_up' | 'no_data';
246
+ pointCount: number;
247
+ points: ReadonlyArray<{
248
+ t: number;
249
+ }>;
250
+ }, context: z.RefinementCtx): void;
@@ -0,0 +1,56 @@
1
+ import { type Address, type Hex } from 'viem';
2
+ import type { AegisEngineActionCallbacks, AegisEngineApprovalInput, AegisEngineMarket, AegisEnginePositionTarget, AegisEngineSendInput, AegisEngineSignedPermitBatch, AegisEngineTransactionResult } from './types.js';
3
+ export type AegisEnginePositionRouterAuthorizationInput = {
4
+ wallet: AegisEngineSendInput['wallet'];
5
+ publicClient: AegisEngineSendInput['publicClient'];
6
+ activeChain: AegisEngineSendInput['activeChain'];
7
+ market: AegisEngineMarket;
8
+ target: AegisEnginePositionTarget;
9
+ /** Exact ERC-6909 share allowance required for a lender-position action. */
10
+ amount?: bigint;
11
+ onStatus?: AegisEngineActionCallbacks['onStatus'];
12
+ onTxHash?: AegisEngineActionCallbacks['onTxHash'];
13
+ };
14
+ export declare function prepareEnginePermit(args: AegisEngineApprovalInput): Promise<{
15
+ approvalHash: Hex | null;
16
+ permit: AegisEngineSignedPermitBatch | null;
17
+ }>;
18
+ /**
19
+ * Authorize the trusted Engine router to manage an already-open position.
20
+ *
21
+ * Borrow vaults use a per-vault ERC-721 approval; lender positions use a
22
+ * per-pool, amount-bounded ERC-6909 allowance. The helper deliberately
23
+ * does not accept `onSubmitted`: authorization is a prerequisite transaction,
24
+ * not the host's requested position action.
25
+ */
26
+ export declare function authorizeEnginePositionRouter(args: AegisEnginePositionRouterAuthorizationInput): Promise<AegisEngineTransactionResult>;
27
+ /**
28
+ * Whether the trusted router may already move this borrow vault — either a
29
+ * per-vault approval or a blanket operator approval. Lets a borrow into an
30
+ * existing vault skip a redundant ERC-721 approval on repeat borrows. Without
31
+ * a `vaultId` (createVault path) only the blanket operator approval can
32
+ * exist, so only that is read.
33
+ */
34
+ export declare function readEngineVaultRouterApproved(args: {
35
+ publicClient: AegisEngineSendInput['publicClient'];
36
+ market: AegisEngineMarket;
37
+ owner: Address;
38
+ vaultId?: bigint;
39
+ }): Promise<boolean>;
40
+ /**
41
+ * Blanket operator approval for the trusted router on the vault registry.
42
+ * A first borrow (createVault) has no vault to approve per-token, and the
43
+ * SDK's execution evidence for a fresh vault checks `isApprovedForAll` only —
44
+ * this is the only authorization that can satisfy its router gate. Existing
45
+ * vaults should keep the narrower per-vault approval via
46
+ * `authorizeEnginePositionRouter`.
47
+ */
48
+ export declare function authorizeEngineVaultOperator(args: Omit<AegisEnginePositionRouterAuthorizationInput, 'target' | 'amount'>): Promise<AegisEngineTransactionResult>;
49
+ export declare function sendEngineTransaction(args: AegisEngineSendInput): Promise<AegisEngineTransactionResult>;
50
+ export declare function missingEngineExecutionReason(market: {
51
+ router?: Address;
52
+ permit2?: Address;
53
+ stateView?: Address;
54
+ v4StateView?: Address;
55
+ v4Quoter?: Address;
56
+ }): string | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ import type { Address } from 'viem';
2
+ import type { AegisEngineDataSource, AegisEngineHistoryWindow, AegisEngineMarket, AegisEngineMetricHistory, AegisEnginePositionActivitySnapshot, AegisEngineVaultActivityEntry, AegisEnginePositionsSnapshot } from './types.js';
3
+ export declare function clearEngineMarketsCache(): void;
4
+ export declare function clearEngineMarketHistoryCache(): void;
5
+ export declare function clearEnginePositionsCache(): void;
6
+ export declare function clearEnginePositionActivityCache(): void;
7
+ export declare function clearEnginePositionsV2ProbeCache(): void;
8
+ export declare function fetchEngineMarkets(args: {
9
+ source: AegisEngineDataSource;
10
+ chainId: number;
11
+ signal?: AbortSignal;
12
+ defaultV4Quoter?: Address;
13
+ }): Promise<AegisEngineMarket[]>;
14
+ export declare function fetchEngineMarketHistory(args: {
15
+ source: AegisEngineDataSource;
16
+ marketId: string;
17
+ window?: AegisEngineHistoryWindow;
18
+ signal?: AbortSignal;
19
+ }): Promise<AegisEngineMetricHistory | null>;
20
+ export declare function fetchEnginePositionsSnapshot(args: {
21
+ source: AegisEngineDataSource;
22
+ chainId: number;
23
+ account: Address;
24
+ signal?: AbortSignal;
25
+ /** Explicit user refresh and post-transaction reconciliation bypass the
26
+ * short display cache; normal tab re-entry does not. */
27
+ force?: boolean;
28
+ }): Promise<AegisEnginePositionsSnapshot>;
29
+ /** Loads the complete account-scoped Engine action ledger. Static sources have
30
+ * no activity plane and return null rather than presenting fixture data as
31
+ * indexed history. */
32
+ export declare function fetchEnginePositionActivitySnapshot(args: {
33
+ source: AegisEngineDataSource;
34
+ chainId: number;
35
+ account: Address;
36
+ signal?: AbortSignal;
37
+ /** Explicit refresh and post-transaction reconciliation bypass the cache. */
38
+ force?: boolean;
39
+ }): Promise<AegisEnginePositionActivitySnapshot | null>;
40
+ /** Convenience view for the latest debt/idle transaction of one vault. The
41
+ * full REST ledger remains available through fetchEnginePositionActivitySnapshot. */
42
+ export declare function fetchEngineVaultActivity(args: {
43
+ source: AegisEngineDataSource;
44
+ chainId: number;
45
+ account: Address;
46
+ vaultId: bigint | string;
47
+ signal?: AbortSignal;
48
+ force?: boolean;
49
+ }): Promise<AegisEngineVaultActivityEntry | null>;
50
+ /** Convenience view for the wallet's latest lend transaction in one market.
51
+ * Deposit/withdraw only: share transfers move pool shares between wallets
52
+ * without a token leg, so presenting one as the market's latest transaction
53
+ * would misstate what the wallet last did with tokens. Rides the shared
54
+ * wallet activity snapshot cache — no extra request beyond
55
+ * fetchEnginePositionActivitySnapshot. */
56
+ export declare function fetchEngineLendActivity(args: {
57
+ source: AegisEngineDataSource;
58
+ chainId: number;
59
+ account: Address;
60
+ poolId: string;
61
+ signal?: AbortSignal;
62
+ force?: boolean;
63
+ }): Promise<AegisEngineVaultActivityEntry | null>;
@@ -0,0 +1,8 @@
1
+ export * from './types.js';
2
+ export * from './dataSource.js';
3
+ export * from './marketAdapter.js';
4
+ export * from './registry.js';
5
+ export * from './reads.js';
6
+ export * from './quotes.js';
7
+ export * from './actions.js';
8
+ export * from './positionAmounts.js';
@@ -0,0 +1,8 @@
1
+ import type { Address } from 'viem';
2
+ import type { AegisEngineMarket, AegisEngineMarketSource } from './types.js';
3
+ export declare function normalizeEngineMarkets(args: {
4
+ chainId: number;
5
+ markets: readonly unknown[];
6
+ source?: AegisEngineMarketSource;
7
+ defaultV4Quoter?: Address;
8
+ }): AegisEngineMarket[];
@@ -0,0 +1,37 @@
1
+ /** Conservative cap to size a withdrawal preview against. */
2
+ export declare function enginePreviewMaxLtvPips(marketMaxLtvPips: number): number;
3
+ export type AegisEngineIdleWithdrawSide = 'token0' | 'token1';
4
+ export type AegisEngineIdleWithdrawAmountInput = {
5
+ /** Same-frame live idle token amounts. */
6
+ idle0: bigint;
7
+ idle1: bigint;
8
+ /**
9
+ * Same-frame accrued debt in L units, rounded up by position hydration.
10
+ * Using the rounded-up value makes this preview no less conservative than
11
+ * the Engine's exact rL × borrow-index residual check.
12
+ */
13
+ debtLLatest: bigint;
14
+ maxLtvPips: number;
15
+ side: AegisEngineIdleWithdrawSide;
16
+ };
17
+ /**
18
+ * Mirrors the idle-only residual-LTV inequality used by the Engine lifecycle
19
+ * quote. Engine idle balances are int128-packed, so their product fits uint256
20
+ * and `floor(sqrt(idle0 × idle1)) >= requiredFloor` is exactly equivalent to
21
+ * `idle0 × idle1 >= requiredFloor²`.
22
+ */
23
+ export declare function engineIdleWithdrawPassesResidualLtv(input: AegisEngineIdleWithdrawAmountInput): boolean;
24
+ /**
25
+ * Maximum independently withdrawable idle amount for one selected token.
26
+ * The opposite token remains untouched. This is a conservative preview; the
27
+ * exact amount is always re-quoted from a fresh block before submission.
28
+ */
29
+ export declare function computeEngineMaxIdleWithdraw(input: AegisEngineIdleWithdrawAmountInput): bigint;
30
+ /**
31
+ * Projected idle-only LTV after one exact withdrawal. Returns null for a
32
+ * debt-free vault or an invalid/zero-collateral post-state. The exact action
33
+ * remains quote-driven; this is display math over the same hydrated frame.
34
+ */
35
+ export declare function computeEngineIdleWithdrawPostLtvPips(input: AegisEngineIdleWithdrawAmountInput & {
36
+ withdrawAmount: bigint;
37
+ }): number | null;
@@ -0,0 +1,9 @@
1
+ import type { AegisEngineBorrowCapacity, AegisEngineBorrowCapacityInput, AegisEngineBorrowQuote, AegisEngineBorrowQuoteInput, AegisEngineAddCollateralQuoteInput, AegisEngineCloseQuoteInput, AegisEngineDepositQuote, AegisEngineDepositQuoteInput, AegisEngineIdleWithdrawQuoteInput, AegisEnginePositionActionQuote, AegisEngineRedeemQuoteInput, AegisEngineRepayQuoteInput } from './types.js';
2
+ export declare function quoteEngineDeposit(input: AegisEngineDepositQuoteInput): Promise<AegisEngineDepositQuote>;
3
+ export declare function quoteEngineBorrow(input: AegisEngineBorrowQuoteInput): Promise<AegisEngineBorrowQuote>;
4
+ export declare function quoteEngineAddCollateral(input: AegisEngineAddCollateralQuoteInput): Promise<AegisEnginePositionActionQuote>;
5
+ export declare function quoteEngineBorrowCapacity(input: AegisEngineBorrowCapacityInput): Promise<AegisEngineBorrowCapacity>;
6
+ export declare function quoteEngineRepay(input: AegisEngineRepayQuoteInput): Promise<AegisEnginePositionActionQuote>;
7
+ export declare function quoteEngineCloseVault(input: AegisEngineCloseQuoteInput): Promise<AegisEnginePositionActionQuote>;
8
+ export declare function quoteEngineIdleWithdraw(input: AegisEngineIdleWithdrawQuoteInput): Promise<AegisEnginePositionActionQuote>;
9
+ export declare function quoteEngineRedeem(input: AegisEngineRedeemQuoteInput): Promise<AegisEnginePositionActionQuote>;
@@ -0,0 +1,43 @@
1
+ import type { Address } from 'viem';
2
+ import type { AegisEngineBorrowQuoteContext, AegisEngineMarket, AegisEngineMarketReadInput, AegisEngineMarketSnapshot, AegisEnginePositionsHydration, AegisEnginePositionsHydrationInput, AegisEngineVaultActivityEntry } from './types.js';
3
+ export declare class AegisEngineMarketNotReadyError extends Error {
4
+ constructor(message: string);
5
+ }
6
+ /** Test-only reset for the module-owned, weakly client-scoped read caches. */
7
+ export declare function clearEngineReadCaches(): void;
8
+ export declare function readEngineMarketSnapshot(input: AegisEngineMarketReadInput): Promise<AegisEngineMarketSnapshot>;
9
+ export declare function readEngineBorrowQuoteContext(input: AegisEngineMarketReadInput, execution?: {
10
+ owner: Address;
11
+ vaultId?: bigint;
12
+ }, options?: {
13
+ forceRefresh?: boolean;
14
+ }): Promise<AegisEngineBorrowQuoteContext>;
15
+ /**
16
+ * Hydrates REST/subgraph-discovered borrow and lender positions in one
17
+ * block-pinned SDK frame. Results remain one-to-one with the discovery arrays
18
+ * and carry their stable position ids so consumers can merge without relying
19
+ * on list order after the read completes.
20
+ */
21
+ export declare function readEnginePositionsHydration(input: AegisEnginePositionsHydrationInput): Promise<AegisEnginePositionsHydration>;
22
+ /** Classifies one transaction's vault actions into a ledger entry: the shared
23
+ * grammar for turning a group of debt/idle action rows into a
24
+ * {@link AegisEngineVaultActivityEntry}. Public so hosts rendering their own
25
+ * activity list classify transactions the same way core does. */
26
+ export declare function classifyEngineVaultActivity(group: {
27
+ txHash: `0x${string}`;
28
+ timestamp: number;
29
+ debt: readonly {
30
+ principalDeltaActual: bigint;
31
+ }[];
32
+ idle: readonly {
33
+ deltaAmount0: bigint;
34
+ deltaAmount1: bigint;
35
+ }[];
36
+ }): AegisEngineVaultActivityEntry;
37
+ /** Latest transaction that touched a vault, from the public Engine subgraph.
38
+ * Read-only and wallet-free; returns null for an untraceable vault (no
39
+ * trusted deployment, empty ledger, or subgraph outage — callers degrade). */
40
+ export declare function readEngineVaultActivity(input: {
41
+ market: AegisEngineMarket;
42
+ vaultId: bigint;
43
+ }): Promise<AegisEngineVaultActivityEntry | null>;
@@ -0,0 +1,27 @@
1
+ import type { Address } from 'viem';
2
+ import type { AegisEngineVersion } from './types.js';
3
+ /** Engine hard utilization cap as a percentage of supplied liquidity.
4
+ * Mirrors the SDK's UTILIZATION_CAP_PIPS (950_000/1_000_000), inlined so
5
+ * sync widget code can read cap state off REST `utilizationPct` without
6
+ * loading the SDK. Drift-guarded by engineRegistry.test.ts. */
7
+ export declare const ENGINE_UTILIZATION_CAP_PCT = 95;
8
+ export type AegisEngineChainAddresses = {
9
+ aegisEngine: Address;
10
+ aegisHook: Address;
11
+ aegisRouterV1: Address;
12
+ aegisStateView: Address;
13
+ vaultRegistry: Address;
14
+ variableInterestRate: Address;
15
+ oracleManager: Address;
16
+ limitOrderManager: Address;
17
+ dynamicFeeManager: Address;
18
+ poolManager: Address;
19
+ positionManager: Address;
20
+ stateView: Address;
21
+ uniswapV4Quoter: Address;
22
+ permit2: Address;
23
+ weth9: Address;
24
+ };
25
+ export declare function trustedEngineVersionForChain(chainId: number): AegisEngineVersion | null;
26
+ export declare function trustedEngineRegistryForChain(chainId: number): AegisEngineChainAddresses | null;
27
+ export declare function engineRouterForChain(chainId: number): Address;