@aegis-engine/core 0.1.3 → 0.3.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 (55) hide show
  1. package/README.md +124 -33
  2. package/THIRD_PARTY_NOTICES.md +211 -0
  3. package/dist/actions/directPoolSwap.d.ts +4 -4
  4. package/dist/actions/kyberSwap.d.ts +7 -6
  5. package/dist/actions/types.d.ts +4 -4
  6. package/dist/actions/wallet.d.ts +3 -3
  7. package/dist/address.d.ts +3 -1
  8. package/dist/aegis-core.js +8459 -4741
  9. package/dist/backendAdapters.d.ts +41 -0
  10. package/dist/config/chains.d.ts +1 -1
  11. package/dist/config/constants.d.ts +4 -0
  12. package/dist/config/contracts.d.ts +1 -1
  13. package/dist/config/index.d.ts +6 -6
  14. package/dist/config/markets.d.ts +1 -1
  15. package/dist/config/tokens.d.ts +1 -1
  16. package/dist/config/types.d.ts +5 -0
  17. package/dist/contract/backendClient.d.ts +118 -0
  18. package/dist/contract/generated/aegis-swap.d.ts +3306 -0
  19. package/dist/contract/index.d.ts +3 -2
  20. package/dist/contract/schemas.d.ts +95 -127
  21. package/dist/encoding.d.ts +1 -1
  22. package/dist/engine/actions.d.ts +56 -0
  23. package/dist/engine/borrowCostProjection.d.ts +1 -0
  24. package/dist/engine/dataSource.d.ts +63 -0
  25. package/dist/engine/index.d.ts +7 -0
  26. package/dist/engine/marketAdapter.d.ts +8 -0
  27. package/dist/engine/quotes.d.ts +8 -0
  28. package/dist/engine/reads.d.ts +41 -0
  29. package/dist/engine/registry.d.ts +27 -0
  30. package/dist/engine/restSchemas.d.ts +409 -0
  31. package/dist/engine/sdk.d.ts +1 -0
  32. package/dist/engine/sdkRuntime.d.ts +1 -0
  33. package/dist/engine/types.d.ts +992 -0
  34. package/dist/errors.d.ts +10 -0
  35. package/dist/historicalPrices.d.ts +78 -0
  36. package/dist/index.d.ts +39 -32
  37. package/dist/internal/requestSignal.d.ts +9 -0
  38. package/dist/internal/ttlCache.d.ts +19 -0
  39. package/dist/metadata.d.ts +5 -1
  40. package/dist/permit.d.ts +3 -2
  41. package/dist/quote/aggregatedSwapQuote.d.ts +14 -2
  42. package/dist/quote/kyberCalldata.d.ts +211 -0
  43. package/dist/quote.d.ts +3 -2
  44. package/dist/sdkRuntime-CCRVvSwD.js +16052 -0
  45. package/dist/services/kyberSwap.d.ts +22 -2
  46. package/dist/swap/authorizePermit.d.ts +5 -5
  47. package/dist/swap/executeSwapTransaction.d.ts +5 -5
  48. package/dist/swap/receiptWait.d.ts +17 -0
  49. package/dist/swap/sendSwapTransaction.d.ts +42 -8
  50. package/dist/swap/settlement.d.ts +15 -0
  51. package/dist/swap/types.d.ts +2 -2
  52. package/dist/transactionProgress.d.ts +8 -1
  53. package/dist/types/aggregatedSwap.d.ts +19 -1
  54. package/package.json +20 -8
  55. package/dist/backendApi.d.ts +0 -201
@@ -1,2 +1,3 @@
1
- export * from './guards';
2
- export * from './schemas';
1
+ export * from './backendClient.js';
2
+ export * from './guards.js';
3
+ export * from './schemas.js';
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  export declare const aegisBackendAddressSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
3
3
  export declare const aegisBackendHexSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
4
4
  export declare const aegisBackendDecimalStringSchema: z.ZodString;
5
+ export declare const aegisBackendPositiveDecimalStringSchema: z.ZodString;
5
6
  export declare const aegisBackendIsoDateTimeSchema: z.ZodISODateTime;
6
7
  export declare const aegisBackendSwapProviderSchema: z.ZodEnum<{
7
8
  "aegis-direct-v4": "aegis-direct-v4";
@@ -15,12 +16,7 @@ export declare const aegisBackendMarketStatusSchema: z.ZodEnum<{
15
16
  enabled: "enabled";
16
17
  disabled: "disabled";
17
18
  }>;
18
- export declare const aegisBackendTxStatusSchema: z.ZodEnum<{
19
- pending: "pending";
20
- success: "success";
21
- reverted: "reverted";
22
- not_found: "not_found";
23
- }>;
19
+ export declare const aegisBackendChainIdSchema: z.ZodLiteral<1 | 130 | 8453>;
24
20
  export declare const aegisBackendChainSchema: z.ZodObject<{
25
21
  chainId: z.ZodNumber;
26
22
  slug: z.ZodString;
@@ -36,12 +32,31 @@ export declare const aegisBackendAddressAllowlistSchema: z.ZodObject<{
36
32
  routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
37
33
  spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
38
34
  }, z.core.$strip>;
35
+ export declare const aegisBackendContractsByChainSchema: z.ZodObject<{
36
+ '1': z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
37
+ '130': z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
38
+ '8453': z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
39
+ }, z.core.$strip>;
40
+ export declare const aegisBackendAllowlistsByChainSchema: z.ZodObject<{
41
+ '1': z.ZodObject<{
42
+ routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
43
+ spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
44
+ }, z.core.$strip>;
45
+ '130': z.ZodObject<{
46
+ routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
47
+ spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
48
+ }, z.core.$strip>;
49
+ '8453': z.ZodObject<{
50
+ routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
51
+ spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
52
+ }, z.core.$strip>;
53
+ }, z.core.$strip>;
39
54
  export declare const aegisBackendFeeConfigSchema: z.ZodObject<{
40
55
  outputFeeBps: z.ZodNumber;
41
56
  recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
42
57
  }, z.core.$strip>;
43
58
  export declare const aegisBackendConfigSchema: z.ZodObject<{
44
- schemaVersion: z.ZodString;
59
+ schemaVersion: z.ZodLiteral<"1">;
45
60
  chains: z.ZodArray<z.ZodObject<{
46
61
  chainId: z.ZodNumber;
47
62
  slug: z.ZodString;
@@ -56,11 +71,25 @@ export declare const aegisBackendConfigSchema: z.ZodObject<{
56
71
  defaultSlippageBps: z.ZodNumber;
57
72
  maxSlippageBps: z.ZodNumber;
58
73
  }, z.core.$strip>;
59
- contracts: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>>;
60
- allowlists: z.ZodRecord<z.ZodString, z.ZodObject<{
61
- routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
62
- spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
63
- }, z.core.$strip>>;
74
+ contracts: z.ZodObject<{
75
+ '1': z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
76
+ '130': z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
77
+ '8453': z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
78
+ }, z.core.$strip>;
79
+ allowlists: z.ZodObject<{
80
+ '1': z.ZodObject<{
81
+ routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
82
+ spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
83
+ }, z.core.$strip>;
84
+ '130': z.ZodObject<{
85
+ routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
86
+ spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
87
+ }, z.core.$strip>;
88
+ '8453': z.ZodObject<{
89
+ routers: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
90
+ spenders: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
91
+ }, z.core.$strip>;
92
+ }, z.core.$strip>;
64
93
  fee: z.ZodObject<{
65
94
  outputFeeBps: z.ZodNumber;
66
95
  recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -74,14 +103,14 @@ export declare const aegisBackendTokenSchema: z.ZodObject<{
74
103
  displayName: z.ZodString;
75
104
  fullName: z.ZodString;
76
105
  decimals: z.ZodNumber;
77
- priceUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
78
- iconUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
- stable: z.ZodOptional<z.ZodBoolean>;
106
+ priceUsd: z.ZodNumber;
107
+ iconUrl: z.ZodString;
108
+ stable: z.ZodBoolean;
80
109
  }, z.core.$strip>;
81
110
  export declare const aegisBackendMarketMetricsSchema: z.ZodObject<{
82
- tvlUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
83
- volumeUsd7d: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
84
- feeApr7d: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
111
+ tvlUsd: z.ZodNumber;
112
+ volumeUsd7d: z.ZodNumber;
113
+ feeApr7d: z.ZodNumber;
85
114
  }, z.core.$strip>;
86
115
  export declare const aegisPoolKeySchema: z.ZodObject<{
87
116
  currency0: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -91,16 +120,13 @@ export declare const aegisPoolKeySchema: z.ZodObject<{
91
120
  hooks: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
92
121
  }, z.core.$strip>;
93
122
  export declare const aegisBackendMarketSchema: z.ZodObject<{
94
- id: z.ZodString;
123
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
95
124
  chainId: z.ZodNumber;
96
125
  status: z.ZodEnum<{
97
126
  enabled: "enabled";
98
127
  disabled: "disabled";
99
128
  }>;
100
- kind: z.ZodEnum<{
101
- "aegis-direct-v4": "aegis-direct-v4";
102
- kyber: "kyber";
103
- }>;
129
+ kind: z.ZodLiteral<"aegis-direct-v4">;
104
130
  label: z.ZodString;
105
131
  baseToken: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
106
132
  quoteToken: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -112,18 +138,21 @@ export declare const aegisBackendMarketSchema: z.ZodObject<{
112
138
  tickSpacing: z.ZodNumber;
113
139
  hooks: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
114
140
  }, z.core.$strip>;
115
- metrics: z.ZodOptional<z.ZodObject<{
116
- tvlUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
117
- volumeUsd7d: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
118
- feeApr7d: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
119
- }, z.core.$strip>>;
120
- warnings: z.ZodArray<z.ZodString>;
141
+ metrics: z.ZodObject<{
142
+ tvlUsd: z.ZodNumber;
143
+ volumeUsd7d: z.ZodNumber;
144
+ feeApr7d: z.ZodNumber;
145
+ }, z.core.$strip>;
146
+ warnings: z.ZodArray<z.ZodEnum<{
147
+ paused: "paused";
148
+ "surge-active": "surge-active";
149
+ "cap-event": "cap-event";
150
+ }>>;
121
151
  }, z.core.$strip>;
122
152
  export declare const aegisBackendSwapQuoteRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
123
153
  mode: z.ZodLiteral<"exactIn">;
124
154
  amountIn: z.ZodString;
125
- amountOut: z.ZodOptional<z.ZodNever>;
126
- chainId: z.ZodNumber;
155
+ chainId: z.ZodLiteral<1 | 130 | 8453>;
127
156
  provider: z.ZodEnum<{
128
157
  "aegis-direct-v4": "aegis-direct-v4";
129
158
  kyber: "kyber";
@@ -133,11 +162,10 @@ export declare const aegisBackendSwapQuoteRequestSchema: z.ZodDiscriminatedUnion
133
162
  tokenOut: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
134
163
  slippageBps: z.ZodNumber;
135
164
  account: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
136
- }, z.core.$strip>, z.ZodObject<{
165
+ }, z.core.$loose>, z.ZodObject<{
137
166
  mode: z.ZodLiteral<"exactOut">;
138
167
  amountOut: z.ZodString;
139
- amountIn: z.ZodOptional<z.ZodNever>;
140
- chainId: z.ZodNumber;
168
+ chainId: z.ZodLiteral<1 | 130 | 8453>;
141
169
  provider: z.ZodEnum<{
142
170
  "aegis-direct-v4": "aegis-direct-v4";
143
171
  kyber: "kyber";
@@ -147,95 +175,27 @@ export declare const aegisBackendSwapQuoteRequestSchema: z.ZodDiscriminatedUnion
147
175
  tokenOut: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
148
176
  slippageBps: z.ZodNumber;
149
177
  account: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
150
- }, z.core.$strip>], "mode">;
151
- export declare const aegisBackendSwapApprovalSchema: z.ZodObject<{
152
- required: z.ZodBoolean;
153
- model: z.ZodEnum<{
154
- permit2: "permit2";
155
- erc20: "erc20";
156
- native: "native";
157
- none: "none";
158
- }>;
159
- spender: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
160
- }, z.core.$strip>;
178
+ }, z.core.$loose>], "mode">;
161
179
  export declare const aegisBackendSwapQuoteResponseSchema: z.ZodObject<{
162
- quoteId: z.ZodString;
163
- quoteHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
164
- routeHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
165
- expiresAt: z.ZodISODateTime;
166
- quoteBlockNumber: z.ZodString;
167
- provider: z.ZodEnum<{
168
- "aegis-direct-v4": "aegis-direct-v4";
169
- kyber: "kyber";
170
- }>;
171
- marketId: z.ZodOptional<z.ZodString>;
180
+ indicative: z.ZodLiteral<true>;
181
+ executable: z.ZodLiteral<false>;
182
+ provider: z.ZodLiteral<"aegis-direct-v4">;
183
+ marketId: z.ZodString;
184
+ mode: z.ZodLiteral<"exactIn">;
185
+ tokenIn: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
186
+ tokenOut: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
172
187
  amountIn: z.ZodString;
173
188
  amountOut: z.ZodString;
174
189
  minAmountOut: z.ZodString;
175
- gasEstimate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
176
- approval: z.ZodObject<{
177
- required: z.ZodBoolean;
178
- model: z.ZodEnum<{
179
- permit2: "permit2";
180
- erc20: "erc20";
181
- native: "native";
182
- none: "none";
183
- }>;
184
- spender: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
185
- }, z.core.$strip>;
190
+ price: z.ZodNumber;
191
+ slippageBps: z.ZodNumber;
186
192
  fee: z.ZodObject<{
187
193
  outputFeeBps: z.ZodNumber;
188
194
  recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
189
195
  }, z.core.$strip>;
196
+ asOf: z.ZodISODateTime;
190
197
  warnings: z.ZodArray<z.ZodString>;
191
198
  }, z.core.$strip>;
192
- export declare const aegisBackendSwapBuildRequestSchema: z.ZodObject<{
193
- quoteId: z.ZodString;
194
- account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
195
- recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
196
- permitSignature: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
197
- }, z.core.$strip>;
198
- export declare const aegisBackendUnsignedSwapTxSchema: z.ZodObject<{
199
- chainId: z.ZodNumber;
200
- to: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
201
- data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
202
- value: z.ZodString;
203
- }, z.core.$strip>;
204
- export declare const aegisBackendSwapBuildResponseSchema: z.ZodObject<{
205
- buildId: z.ZodString;
206
- quoteId: z.ZodString;
207
- routeHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
208
- expectedCalldataHash: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
209
- expiresAt: z.ZodISODateTime;
210
- tx: z.ZodObject<{
211
- chainId: z.ZodNumber;
212
- to: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
213
- data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
214
- value: z.ZodString;
215
- }, z.core.$strip>;
216
- allowance: z.ZodObject<{
217
- spender: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
218
- permit2Required: z.ZodBoolean;
219
- }, z.core.$strip>;
220
- simulation: z.ZodObject<{
221
- ok: z.ZodBoolean;
222
- blockNumber: z.ZodOptional<z.ZodString>;
223
- }, z.core.$strip>;
224
- warnings: z.ZodArray<z.ZodString>;
225
- }, z.core.$strip>;
226
- export declare const aegisBackendTxStatusResponseSchema: z.ZodObject<{
227
- status: z.ZodEnum<{
228
- pending: "pending";
229
- success: "success";
230
- reverted: "reverted";
231
- not_found: "not_found";
232
- }>;
233
- blockNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
234
- gasUsed: z.ZodOptional<z.ZodNullable<z.ZodString>>;
235
- effectiveGasPrice: z.ZodOptional<z.ZodNullable<z.ZodString>>;
236
- feeWei: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
- explorerUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
238
- }, z.core.$strip>;
239
199
  export declare const aegisBackendHealthResponseSchema: z.ZodObject<{
240
200
  ok: z.ZodBoolean;
241
201
  }, z.core.$strip>;
@@ -247,21 +207,18 @@ export declare const aegisBackendTokensResponseSchema: z.ZodArray<z.ZodObject<{
247
207
  displayName: z.ZodString;
248
208
  fullName: z.ZodString;
249
209
  decimals: z.ZodNumber;
250
- priceUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
251
- iconUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
- stable: z.ZodOptional<z.ZodBoolean>;
210
+ priceUsd: z.ZodNumber;
211
+ iconUrl: z.ZodString;
212
+ stable: z.ZodBoolean;
253
213
  }, z.core.$strip>>;
254
214
  export declare const aegisBackendMarketsResponseSchema: z.ZodArray<z.ZodObject<{
255
- id: z.ZodString;
215
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
256
216
  chainId: z.ZodNumber;
257
217
  status: z.ZodEnum<{
258
218
  enabled: "enabled";
259
219
  disabled: "disabled";
260
220
  }>;
261
- kind: z.ZodEnum<{
262
- "aegis-direct-v4": "aegis-direct-v4";
263
- kyber: "kyber";
264
- }>;
221
+ kind: z.ZodLiteral<"aegis-direct-v4">;
265
222
  label: z.ZodString;
266
223
  baseToken: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
267
224
  quoteToken: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
@@ -273,10 +230,21 @@ export declare const aegisBackendMarketsResponseSchema: z.ZodArray<z.ZodObject<{
273
230
  tickSpacing: z.ZodNumber;
274
231
  hooks: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
275
232
  }, z.core.$strip>;
276
- metrics: z.ZodOptional<z.ZodObject<{
277
- tvlUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
278
- volumeUsd7d: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
279
- feeApr7d: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
280
- }, z.core.$strip>>;
281
- warnings: z.ZodArray<z.ZodString>;
233
+ metrics: z.ZodObject<{
234
+ tvlUsd: z.ZodNumber;
235
+ volumeUsd7d: z.ZodNumber;
236
+ feeApr7d: z.ZodNumber;
237
+ }, z.core.$strip>;
238
+ warnings: z.ZodArray<z.ZodEnum<{
239
+ paused: "paused";
240
+ "surge-active": "surge-active";
241
+ "cap-event": "cap-event";
242
+ }>>;
282
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;
@@ -1,5 +1,5 @@
1
1
  import { type Address, type Hex } from 'viem';
2
- import type { AegisPoolKey } from './config';
2
+ import type { AegisPoolKey } from './config/index.js';
3
3
  export type ExecutionBatch = {
4
4
  requiresV4Unlock: boolean;
5
5
  actions: Hex;
@@ -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,7 @@
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';
@@ -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,8 @@
1
+ import type { AegisEngineBorrowCapacity, AegisEngineBorrowCapacityInput, AegisEngineBorrowQuote, AegisEngineBorrowQuoteInput, 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 quoteEngineBorrowCapacity(input: AegisEngineBorrowCapacityInput): Promise<AegisEngineBorrowCapacity>;
5
+ export declare function quoteEngineRepay(input: AegisEngineRepayQuoteInput): Promise<AegisEnginePositionActionQuote>;
6
+ export declare function quoteEngineCloseVault(input: AegisEngineCloseQuoteInput): Promise<AegisEnginePositionActionQuote>;
7
+ export declare function quoteEngineIdleWithdraw(input: AegisEngineIdleWithdrawQuoteInput): Promise<AegisEnginePositionActionQuote>;
8
+ export declare function quoteEngineRedeem(input: AegisEngineRedeemQuoteInput): Promise<AegisEnginePositionActionQuote>;
@@ -0,0 +1,41 @@
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
+ }): Promise<AegisEngineBorrowQuoteContext>;
13
+ /**
14
+ * Hydrates REST/subgraph-discovered borrow and lender positions in one
15
+ * block-pinned SDK frame. Results remain one-to-one with the discovery arrays
16
+ * and carry their stable position ids so consumers can merge without relying
17
+ * on list order after the read completes.
18
+ */
19
+ export declare function readEnginePositionsHydration(input: AegisEnginePositionsHydrationInput): Promise<AegisEnginePositionsHydration>;
20
+ /** Classifies one transaction's vault actions into a ledger entry: the shared
21
+ * grammar for turning a group of debt/idle action rows into a
22
+ * {@link AegisEngineVaultActivityEntry}. Public so hosts rendering their own
23
+ * activity list classify transactions the same way core does. */
24
+ export declare function classifyEngineVaultActivity(group: {
25
+ txHash: `0x${string}`;
26
+ timestamp: number;
27
+ debt: readonly {
28
+ principalDeltaActual: bigint;
29
+ }[];
30
+ idle: readonly {
31
+ deltaAmount0: bigint;
32
+ deltaAmount1: bigint;
33
+ }[];
34
+ }): AegisEngineVaultActivityEntry;
35
+ /** Latest transaction that touched a vault, from the public Engine subgraph.
36
+ * Read-only and wallet-free; returns null for an untraceable vault (no
37
+ * trusted deployment, empty ledger, or subgraph outage — callers degrade). */
38
+ export declare function readEngineVaultActivity(input: {
39
+ market: AegisEngineMarket;
40
+ vaultId: bigint;
41
+ }): 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;