@aegis-engine/core 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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,35 +16,49 @@ 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.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
24
20
  export declare const aegisBackendChainSchema: z.ZodObject<{
25
- chainId: z.ZodNumber;
21
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
26
22
  slug: z.ZodString;
27
23
  name: z.ZodString;
28
24
  }, z.core.$strip>;
29
25
  export declare const aegisBackendQuoteDefaultsSchema: z.ZodObject<{
30
- ttlSeconds: z.ZodNumber;
31
- defaultSlippageBps: z.ZodNumber;
32
- maxSlippageBps: z.ZodNumber;
26
+ ttlSeconds: z.ZodLiteral<15>;
27
+ defaultSlippageBps: z.ZodLiteral<100>;
28
+ maxSlippageBps: z.ZodLiteral<2000>;
33
29
  }, z.core.$strip>;
34
30
  export declare const aegisBackendContractRegistrySchema: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
35
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
- outputFeeBps: z.ZodNumber;
55
+ outputFeeBps: z.ZodLiteral<50>;
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
- chainId: z.ZodNumber;
61
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
47
62
  slug: z.ZodString;
48
63
  name: z.ZodString;
49
64
  }, z.core.$strip>>;
@@ -52,36 +67,50 @@ export declare const aegisBackendConfigSchema: z.ZodObject<{
52
67
  kyber: "kyber";
53
68
  }>>;
54
69
  quote: z.ZodObject<{
55
- ttlSeconds: z.ZodNumber;
56
- defaultSlippageBps: z.ZodNumber;
57
- maxSlippageBps: z.ZodNumber;
70
+ ttlSeconds: z.ZodLiteral<15>;
71
+ defaultSlippageBps: z.ZodLiteral<100>;
72
+ maxSlippageBps: z.ZodLiteral<2000>;
73
+ }, 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>;
58
92
  }, 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>>;
64
93
  fee: z.ZodObject<{
65
- outputFeeBps: z.ZodNumber;
94
+ outputFeeBps: z.ZodLiteral<50>;
66
95
  recipient: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
67
96
  }, z.core.$strip>;
68
97
  }, z.core.$strip>;
69
98
  export declare const aegisBackendTokenSchema: z.ZodObject<{
70
99
  id: z.ZodString;
71
- chainId: z.ZodNumber;
100
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
72
101
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
73
102
  symbol: z.ZodString;
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>>;
@@ -92,15 +121,12 @@ export declare const aegisPoolKeySchema: z.ZodObject<{
92
121
  }, z.core.$strip>;
93
122
  export declare const aegisBackendMarketSchema: z.ZodObject<{
94
123
  id: z.ZodString;
95
- chainId: z.ZodNumber;
124
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
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.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<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.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
141
169
  provider: z.ZodEnum<{
142
170
  "aegis-direct-v4": "aegis-direct-v4";
143
171
  kyber: "kyber";
@@ -147,121 +175,50 @@ 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
- outputFeeBps: z.ZodNumber;
193
+ outputFeeBps: z.ZodLiteral<50>;
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>;
242
202
  export declare const aegisBackendTokensResponseSchema: z.ZodArray<z.ZodObject<{
243
203
  id: z.ZodString;
244
- chainId: z.ZodNumber;
204
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
245
205
  address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
246
206
  symbol: z.ZodString;
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
215
  id: z.ZodString;
256
- chainId: z.ZodNumber;
216
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<130>, z.ZodLiteral<8453>]>;
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,14 @@ 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>>;
@@ -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;
package/dist/index.d.ts CHANGED
@@ -1,32 +1,34 @@
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_V4_QUOTER, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_DEFAULT_TOKENS, 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';
2
- export type { AegisPoolKey, AegisSwapBuiltInTokenSymbol, AegisSwapChainConfig, AegisSwapChainConfigInput, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapPoolConfig, AegisSwapToken, AegisSwapTokenSymbol, AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapTokenSymbol, AggregatedSwapWolfGameTokenSymbol } from './config';
3
- export { assertUint128, buildExactInSwapTransaction, buildExactOutSwapTransaction, computePoolId, MAX_UINT128 } from './encoding';
4
- export type { BuiltSwapTransaction, ExecutionBatch, PermitBatch, PermitDetails, SignedPermitBatch, SwapOutputFee } from './encoding';
5
- export { getZeroForOne, outputFeeForQuote, quoteSpendAmount, reconcileSubmitQuote, sameQuote } from './quote';
6
- export type { DirectSwapQuote, ReconciledSubmitQuote, SwapQuoteMode } from './quote';
7
- export { aggregatedSwapErrorMessage, fetchAggregatedSwapQuote } from './quote/aggregatedSwapQuote';
8
- export type { AggregatedSwapQuote, AggregatedSwapRoute, HopInfo } from './types/aggregatedSwap';
9
- export { KyberSwapApiError, buildKyberSwapRoute, fetchKyberSwapRoute, isRetryableKyberSwapError } from './services/kyberSwap';
10
- export type { KyberSwapBuild, KyberSwapError, KyberSwapFeeParams, KyberSwapRoute, KyberSwapRouteLeg, KyberSwapRouteSummary } from './services/kyberSwap';
11
- 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';
12
- export { fetchGlobalTokenMetadata, getIchiIconGuess, resolveTokenIconUrl } from './metadata';
13
- export type { AegisSwapGlobalTokenMetadata, TokenMetadataByAddress } from './metadata';
14
- export { createSwapPublicClient, getInjectedProvider, getProviderAccount, getProviderChainId, isEip1193Provider, normalizeAccount, normalizeWalletConnection, requestProviderAccount, subscribeProvider, switchProviderChain } from './wallet';
15
- export type { AegisSwapProviderResolver, AegisSwapWalletConnection, Eip1193Provider, ProviderChainConfig } from './wallet';
16
- export { approveDirectPoolSwapInput, DirectPoolSwapPriceMovedError, executeDirectPoolSwap, fetchDirectPoolSwapQuote } from './actions/directPoolSwap';
17
- export type { DirectPoolSwapApprovalResult } from './actions/directPoolSwap';
18
- export { approveKyberSwapInput, executeKyberSwap, isNativeToken, KyberSwapPriceMovedError, NATIVE_TOKEN_ADDRESS } from './actions/kyberSwap';
19
- export type { KyberSwapApprovalResult } from './actions/kyberSwap';
20
- export { ensureWalletChain, resolveWalletSession, waitForProviderChain } from './actions/wallet';
21
- export type { AegisSwapActionCallbacks, AegisSwapActionResult } from './actions/types';
22
- export { estimateSwapGasWithBuffer } from './swap/gas';
23
- export type { SwapGasRequest } from './swap/gas';
24
- export type { AegisSwapApprovalMode, AegisSwapSubmitDetails, WalletSession } from './swap/types';
25
- export { errorMessage, isUserRejectedError } from './errors';
26
- export { isBusy, transactionProgressView } from './transactionProgress';
27
- export type { AegisSwapReceiptSummary, AegisSwapStatusSnapshot, AegisSwapWalletPromptProgress, SubmitStatus, TransactionProgressState, TransactionProgressView } from './transactionProgress';
28
- export { isDocumentVisible, pollUntil, retryOnError } from './polling';
29
- export { AegisBackendApiError, AegisBackendContractError, createAegisBackendApiClient, isRetryableAegisBackendApiError } from './backendApi';
30
- export type { AegisBackendAddressAllowlist, AegisBackendApiClient, AegisBackendApiClientOptions, AegisBackendChain, AegisBackendConfig, AegisBackendContractRegistry, AegisBackendFeeConfig, AegisBackendMarket, AegisBackendMarketMetrics, AegisBackendMarketStatus, AegisBackendQuoteDefaults, AegisBackendQuoteMode, AegisBackendRequestOptions, AegisBackendSwapApproval, AegisBackendSwapBuildRequest, AegisBackendSwapBuildResponse, AegisBackendSwapProvider, AegisBackendSwapQuoteRequest, AegisBackendSwapQuoteResponse, AegisBackendToken, AegisBackendTxStatus, AegisBackendTxStatusResponse, AegisBackendUnsignedSwapTx } from './backendApi';
31
- export { aegisBackendAddressAllowlistSchema, aegisBackendAddressSchema, aegisBackendChainSchema, aegisBackendConfigSchema, aegisBackendContractRegistrySchema, aegisBackendDecimalStringSchema, aegisBackendFeeConfigSchema, aegisBackendHealthResponseSchema, aegisBackendHexSchema, aegisBackendIsoDateTimeSchema, aegisBackendMarketMetricsSchema, aegisBackendMarketSchema, aegisBackendMarketStatusSchema, aegisBackendMarketsResponseSchema, aegisBackendQuoteDefaultsSchema, aegisBackendQuoteModeSchema, aegisBackendSwapApprovalSchema, aegisBackendSwapBuildRequestSchema, aegisBackendSwapBuildResponseSchema, aegisBackendSwapProviderSchema, aegisBackendSwapQuoteRequestSchema, aegisBackendSwapQuoteResponseSchema, aegisBackendTokenSchema, aegisBackendTokensResponseSchema, aegisBackendTxStatusResponseSchema, aegisBackendTxStatusSchema, aegisBackendUnsignedSwapTxSchema, aegisPoolKeySchema, AegisContractGuardError, assertCalldataHash, assertChainMatches, assertQuoteFresh, assertRouterAllowlisted, assertSpenderAllowlisted } from './contract';
32
- export type { AegisContractGuardCode } from './contract';
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_V4_QUOTER, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_DEFAULT_TOKENS, 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';
3
+ export { assertUint128, buildExactInSwapTransaction, buildExactOutSwapTransaction, computePoolId, MAX_UINT128 } from './encoding.js';
4
+ export type { BuiltSwapTransaction, ExecutionBatch, PermitBatch, PermitDetails, SignedPermitBatch, SwapOutputFee } from './encoding.js';
5
+ export { getZeroForOne, outputFeeForQuote, quoteSpendAmount, reconcileSubmitQuote, sameQuote } from './quote.js';
6
+ export type { DirectSwapQuote, ReconciledSubmitQuote, SwapQuoteMode } from './quote.js';
7
+ export { aggregatedSwapErrorMessage, fetchAggregatedSwapQuote } from './quote/aggregatedSwapQuote.js';
8
+ export type { AggregatedSwapQuote, AggregatedSwapRoute, HopInfo } from './types/aggregatedSwap.js';
9
+ export { KyberSwapApiError, buildKyberSwapRoute, fetchKyberSwapRoute, isRetryableKyberSwapError } from './services/kyberSwap.js';
10
+ export type { KyberSwapBuild, KyberSwapError, KyberSwapFeeParams, KyberSwapRoute, KyberSwapRouteLeg, KyberSwapRouteSummary } from './services/kyberSwap.js';
11
+ 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';
12
+ export { fetchGlobalTokenMetadata, getIchiIconGuess, resolveTokenIconUrl } from './metadata.js';
13
+ export type { AegisSwapGlobalTokenMetadata, TokenMetadataByAddress } from './metadata.js';
14
+ export { createSwapPublicClient, getInjectedProvider, getProviderAccount, getProviderChainId, isEip1193Provider, normalizeAccount, normalizeWalletConnection, requestProviderAccount, subscribeProvider, switchProviderChain } from './wallet.js';
15
+ export type { AegisSwapProviderResolver, AegisSwapWalletConnection, Eip1193Provider, ProviderChainConfig } from './wallet.js';
16
+ export { approveDirectPoolSwapInput, DirectPoolSwapPriceMovedError, executeDirectPoolSwap, fetchDirectPoolSwapQuote } from './actions/directPoolSwap.js';
17
+ export type { DirectPoolSwapApprovalResult } from './actions/directPoolSwap.js';
18
+ export { approveKyberSwapInput, executeKyberSwap, isNativeToken, KyberSwapPriceMovedError, NATIVE_TOKEN_ADDRESS } from './actions/kyberSwap.js';
19
+ export type { KyberSwapApprovalResult } from './actions/kyberSwap.js';
20
+ export { ensureWalletChain, resolveWalletSession, waitForProviderChain } from './actions/wallet.js';
21
+ export type { AegisSwapActionCallbacks, AegisSwapActionResult } from './actions/types.js';
22
+ export { estimateSwapGasWithBuffer } from './swap/gas.js';
23
+ export type { SwapGasRequest } from './swap/gas.js';
24
+ export type { AegisSwapApprovalMode, AegisSwapSubmitDetails, WalletSession } from './swap/types.js';
25
+ export { errorMessage, isUserRejectedError } from './errors.js';
26
+ export { isBusy, transactionProgressView } from './transactionProgress.js';
27
+ export type { AegisSwapReceiptSummary, AegisSwapStatusSnapshot, AegisSwapWalletPromptProgress, SubmitStatus, TransactionProgressState, TransactionProgressView } from './transactionProgress.js';
28
+ export { isDocumentVisible, pollUntil, retryOnError } from './polling.js';
29
+ export { AEGIS_BACKEND_PROD_BASE_URL, AegisBackendApiError, AegisBackendContractError, createAegisBackendApiClient, isRetryableAegisBackendApiError } from './contract/backendClient.js';
30
+ export type { AegisBackendAddressAllowlist, AegisBackendAllowlistsByChain, AegisBackendApiClient, AegisBackendApiClientOptions, AegisBackendChain, AegisBackendConfig, AegisBackendContractRegistry, AegisBackendContractsByChain, AegisBackendFeeConfig, AegisBackendMarket, AegisBackendMarketMetrics, AegisBackendMarketStatus, AegisBackendQuoteDefaults, AegisBackendQuoteMode, AegisBackendRequestOptions, AegisBackendSwapProvider, AegisBackendSwapQuoteRequest, AegisBackendSwapQuoteResponse, AegisBackendToken } from './contract/backendClient.js';
31
+ export { backendTokenToAegisSwapToken, backendTokensToAegisSwapTokens, createAegisSwapChainsFromBackendConfig, createAegisSwapPoolsFromBackendMarkets } from './backendAdapters.js';
32
+ export type { AegisBackendChainOptions } from './backendAdapters.js';
33
+ export { aegisBackendAddressAllowlistSchema, aegisBackendAddressSchema, aegisBackendAllowlistsByChainSchema, aegisBackendChainSchema, aegisBackendChainIdSchema, aegisBackendConfigSchema, aegisBackendContractsByChainSchema, aegisBackendContractRegistrySchema, aegisBackendDecimalStringSchema, aegisBackendFeeConfigSchema, aegisBackendHealthResponseSchema, aegisBackendHexSchema, aegisBackendIsoDateTimeSchema, aegisBackendMarketMetricsSchema, aegisBackendMarketSchema, aegisBackendMarketStatusSchema, aegisBackendMarketsResponseSchema, aegisBackendQuoteDefaultsSchema, aegisBackendQuoteModeSchema, aegisBackendSwapProviderSchema, aegisBackendSwapQuoteRequestSchema, aegisBackendSwapQuoteResponseSchema, aegisBackendTokenSchema, aegisBackendTokensResponseSchema, aegisPoolKeySchema, AegisContractGuardError, assertCalldataHash, assertChainMatches, assertQuoteFresh, assertRouterAllowlisted, assertSpenderAllowlisted } from './contract/index.js';
34
+ export type { AegisContractGuardCode } from './contract/index.js';
@@ -1,5 +1,5 @@
1
1
  import { type Address } from 'viem';
2
- import type { AegisSwapToken } from './config';
2
+ import type { AegisSwapToken } from './config/index.js';
3
3
  export type AegisSwapGlobalTokenMetadata = {
4
4
  chainId: number | null;
5
5
  address: string | null;
package/dist/permit.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Address, type Chain, type Hex, type PublicClient } from 'viem';
2
- import type { Eip1193Provider } from './wallet';
3
- import type { SignedPermitBatch } from './encoding';
2
+ import type { Eip1193Provider } from './wallet.js';
3
+ import type { SignedPermitBatch } from './encoding.js';
4
4
  export declare const MAX_UINT160: bigint;
5
5
  export declare const MAX_UINT256: bigint;
6
6
  export declare const SWAP_TX_DEADLINE_SECONDS = 600;
@@ -1,5 +1,5 @@
1
1
  import { type Address, type PublicClient } from 'viem';
2
- import { type AegisSwapToken } from '../config';
3
- import type { AggregatedSwapQuote } from '../types/aggregatedSwap';
2
+ import { type AegisSwapToken } from '../config/index.js';
3
+ import type { AggregatedSwapQuote } from '../types/aggregatedSwap.js';
4
4
  export declare function aggregatedSwapErrorMessage(error: unknown, fallbackMessage: string): string;
5
5
  export declare function fetchAggregatedSwapQuote(inputToken: AegisSwapToken, outputToken: AegisSwapToken, amount: bigint, slippageBps: number, mode?: 'exactIn' | 'exactOut', account?: Address | null, signal?: AbortSignal, _publicClient?: PublicClient): Promise<AggregatedSwapQuote>;
package/dist/quote.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Address, type PublicClient } from 'viem';
2
- import { type SwapOutputFee } from './encoding';
3
- import type { AegisPoolKey, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapToken } from './config';
2
+ import { type SwapOutputFee } from './encoding.js';
3
+ import type { AegisPoolKey, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapToken } from './config/index.js';
4
4
  export type SwapQuoteMode = 'exactIn' | 'exactOut';
5
5
  export type DirectSwapQuote = {
6
6
  mode: SwapQuoteMode;
@@ -1,9 +1,9 @@
1
1
  import type { Address, PublicClient } from 'viem';
2
- import type { AegisSwapChainConfig } from '../config';
3
- import type { SignedPermitBatch } from '../encoding';
4
- import { readPermit2RouterAllowance } from '../permit';
5
- import type { SubmitStatus } from '../transactionProgress';
6
- import type { AegisSwapApprovalMode, WalletSession } from './types';
2
+ import type { AegisSwapChainConfig } from '../config/index.js';
3
+ import type { SignedPermitBatch } from '../encoding.js';
4
+ import { readPermit2RouterAllowance } from '../permit.js';
5
+ import type { SubmitStatus } from '../transactionProgress.js';
6
+ import type { AegisSwapApprovalMode, WalletSession } from './types.js';
7
7
  /**
8
8
  * Produces the Permit2 authorization the swap calldata needs.
9
9
  *
@@ -1,9 +1,9 @@
1
1
  import { type Hex, type PublicClient } from 'viem';
2
- import type { AegisSwapChainConfig, AegisSwapMarket, AegisSwapToken } from '../config';
3
- import { type SignedPermitBatch } from '../encoding';
4
- import { type DirectSwapQuote } from '../quote';
5
- import type { AegisSwapReceiptSummary, SubmitStatus } from '../transactionProgress';
6
- import type { AegisSwapSubmitDetails, WalletSession } from './types';
2
+ import type { AegisSwapChainConfig, AegisSwapMarket, AegisSwapToken } from '../config/index.js';
3
+ import { type SignedPermitBatch } from '../encoding.js';
4
+ import { type DirectSwapQuote } from '../quote.js';
5
+ import type { AegisSwapReceiptSummary, SubmitStatus } from '../transactionProgress.js';
6
+ import type { AegisSwapSubmitDetails, WalletSession } from './types.js';
7
7
  export type SwapExecutionResult = {
8
8
  receipt: {
9
9
  status: 'success' | 'reverted';
@@ -1,6 +1,6 @@
1
1
  import { type Address, type Chain, type Hex, type PublicClient, type TransactionReceipt } from 'viem';
2
- import type { AegisSwapReceiptSummary } from '../transactionProgress';
3
- import type { AegisSwapSubmitDetails, WalletSession } from './types';
2
+ import type { AegisSwapReceiptSummary } from '../transactionProgress.js';
3
+ import type { AegisSwapSubmitDetails, WalletSession } from './types.js';
4
4
  /**
5
5
  * Sends a prepared swap transaction and waits for its receipt.
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import type { Address } from 'viem';
2
- import type { SwapQuoteMode } from '../quote';
3
- import type { Eip1193Provider } from '../wallet';
2
+ import type { SwapQuoteMode } from '../quote.js';
3
+ import type { Eip1193Provider } from '../wallet.js';
4
4
  /** A resolved wallet: a provider landed on the active chain plus its account. */
5
5
  export type WalletSession = {
6
6
  provider: Eip1193Provider;
@@ -1,5 +1,5 @@
1
1
  import type { Address, Hex } from 'viem';
2
- import type { AegisSwapToken } from '../config';
2
+ import type { AegisSwapToken } from '../config/index.js';
3
3
  export type HopInfo = {
4
4
  dex: string;
5
5
  inputToken: AegisSwapToken;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aegis-engine/core",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "React-free Aegis swap operations for direct Uniswap v4 pools and KyberSwap routes.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,12 +23,14 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^25.9.1",
26
+ "openapi-typescript": "^7.13.0",
26
27
  "typescript": "~5.6.2",
27
28
  "viem": "^2.52.0",
28
29
  "vite": "^6.0.1",
29
30
  "vitest": "^4.1.8"
30
31
  },
31
32
  "dependencies": {
33
+ "openapi-fetch": "^0.17.0",
32
34
  "zod": "^4.4.3"
33
35
  },
34
36
  "sideEffects": false,
@@ -42,9 +44,11 @@
42
44
  },
43
45
  "bugs": "https://github.com/amplifi-liquidity/aegis-widget/issues",
44
46
  "scripts": {
47
+ "openapi:generate": "openapi-typescript ./openapi/aegis-swap.json -o ./src/contract/generated/aegis-swap.ts",
48
+ "openapi:check": "pnpm run openapi:generate && git diff --exit-code -- src/contract/generated/aegis-swap.ts",
45
49
  "typecheck": "tsc -p tsconfig.build.json --noEmit",
46
50
  "typecheck:test": "tsc -p tsconfig.test.json --noEmit",
47
51
  "test": "vitest run",
48
- "build": "vite build && tsc -p tsconfig.build.json"
52
+ "build": "vite build && tsc -p tsconfig.build.json && node ../../scripts/fix-dts-imports.mjs ."
49
53
  }
50
54
  }