@aegis-engine/core 0.8.0 → 0.8.2

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.
@@ -2,6 +2,269 @@ import { z } from 'zod';
2
2
  import type { AegisEngineRestSource } from './types.js';
3
3
  import { EngineMarketCandlesResponseSchema, EngineTokenMarketReferenceResponseSchema } from './marketSeriesSchemas.js';
4
4
  import { RateHistoryResponseSchema } from './rateHistorySchemas.js';
5
+ declare const EnginePoolPriceLineResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
6
+ schemaVersion: z.ZodLiteral<"2">;
7
+ chainId: z.ZodNumber;
8
+ marketId: z.ZodString;
9
+ poolId: z.ZodString;
10
+ poolManager: z.ZodString;
11
+ baseAsset: z.ZodObject<{
12
+ address: z.ZodString;
13
+ decimals: z.ZodNumber;
14
+ }, z.core.$strict>;
15
+ quoteAsset: z.ZodObject<{
16
+ address: z.ZodString;
17
+ decimals: z.ZodNumber;
18
+ }, z.core.$strict>;
19
+ orientation: z.ZodLiteral<"quote_per_base">;
20
+ resolution: z.ZodEnum<{
21
+ "1d": "1d";
22
+ "5m": "5m";
23
+ "1h": "1h";
24
+ }>;
25
+ window: z.ZodEnum<{
26
+ "7d": "7d";
27
+ "30d": "30d";
28
+ "90d": "90d";
29
+ "180d": "180d";
30
+ "1d": "1d";
31
+ }>;
32
+ status: z.ZodEnum<{
33
+ ready: "ready";
34
+ no_data: "no_data";
35
+ partial: "partial";
36
+ }>;
37
+ candles: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
38
+ aggregation: z.ZodLiteral<"exact_swaps">;
39
+ swapCount: z.ZodNumber;
40
+ provenance: z.ZodObject<{
41
+ firstSwap: z.ZodObject<{
42
+ blockNumber: z.ZodNumber;
43
+ blockHash: z.ZodNullable<z.ZodString>;
44
+ transactionHash: z.ZodString;
45
+ logIndex: z.ZodNumber;
46
+ }, z.core.$strict>;
47
+ lastSwap: z.ZodObject<{
48
+ blockNumber: z.ZodNumber;
49
+ blockHash: z.ZodNullable<z.ZodString>;
50
+ transactionHash: z.ZodString;
51
+ logIndex: z.ZodNumber;
52
+ }, z.core.$strict>;
53
+ }, z.core.$strict>;
54
+ t: z.ZodNumber;
55
+ open: z.ZodNumber;
56
+ high: z.ZodNumber;
57
+ low: z.ZodNumber;
58
+ close: z.ZodNumber;
59
+ volumeToken0: z.ZodString;
60
+ volumeToken1: z.ZodString;
61
+ }, z.core.$strict>, z.ZodObject<{
62
+ aggregation: z.ZodLiteral<"uniswap_pool_aggregate">;
63
+ txCount: z.ZodNumber;
64
+ volumeUSD: z.ZodOptional<z.ZodString>;
65
+ feesUSD: z.ZodOptional<z.ZodString>;
66
+ tvlUSD: z.ZodOptional<z.ZodString>;
67
+ t: z.ZodNumber;
68
+ open: z.ZodNumber;
69
+ high: z.ZodNumber;
70
+ low: z.ZodNumber;
71
+ close: z.ZodNumber;
72
+ volumeToken0: z.ZodString;
73
+ volumeToken1: z.ZodString;
74
+ }, z.core.$strict>], "aggregation">>;
75
+ candleCount: z.ZodNumber;
76
+ priceReference: z.ZodOptional<z.ZodNullable<z.ZodObject<{
77
+ kind: z.ZodLiteral<"pool_state">;
78
+ price: z.ZodNumber;
79
+ blockNumber: z.ZodNumber;
80
+ blockHash: z.ZodString;
81
+ timestamp: z.ZodNumber;
82
+ observedAt: z.ZodString;
83
+ }, z.core.$strict>>>;
84
+ coverage: z.ZodObject<{
85
+ requestedFrom: z.ZodNumber;
86
+ requestedTo: z.ZodNumber;
87
+ coverageStart: z.ZodNumber;
88
+ completedThrough: z.ZodNumber;
89
+ expectedBucketCount: z.ZodNumber;
90
+ completeBucketCount: z.ZodNumber;
91
+ }, z.core.$strict>;
92
+ gaps: z.ZodArray<z.ZodObject<{
93
+ from: z.ZodNumber;
94
+ to: z.ZodNumber;
95
+ reason: z.ZodEnum<{
96
+ indexing_gap: "indexing_gap";
97
+ invalid_row: "invalid_row";
98
+ }>;
99
+ }, z.core.$strict>>;
100
+ source: z.ZodEnum<{
101
+ uniswap_v4_subgraph: "uniswap_v4_subgraph";
102
+ pool_manager_rpc: "pool_manager_rpc";
103
+ }>;
104
+ asOf: z.ZodObject<{
105
+ blockNumber: z.ZodNullable<z.ZodNumber>;
106
+ blockHash: z.ZodNullable<z.ZodString>;
107
+ timestamp: z.ZodNullable<z.ZodNumber>;
108
+ }, z.core.$strict>;
109
+ freshness: z.ZodObject<{
110
+ status: z.ZodEnum<{
111
+ ready: "ready";
112
+ warming_up: "warming_up";
113
+ source_unavailable: "source_unavailable";
114
+ reorg_detected: "reorg_detected";
115
+ }>;
116
+ lastProcessedBlockNumber: z.ZodNullable<z.ZodNumber>;
117
+ lastProcessedBlockHash: z.ZodNullable<z.ZodString>;
118
+ confirmationDepth: z.ZodNumber;
119
+ observedAt: z.ZodString;
120
+ updatedAt: z.ZodString;
121
+ warnings: z.ZodArray<z.ZodEnum<{
122
+ "ENGINE-CANDLE-SOURCE-001": "ENGINE-CANDLE-SOURCE-001";
123
+ "ENGINE-CANDLE-SOURCE-002": "ENGINE-CANDLE-SOURCE-002";
124
+ "ENGINE-CANDLE-SOURCE-003": "ENGINE-CANDLE-SOURCE-003";
125
+ "ENGINE-CANDLE-SOURCE-004": "ENGINE-CANDLE-SOURCE-004";
126
+ "ENGINE-CANDLE-SOURCE-005": "ENGINE-CANDLE-SOURCE-005";
127
+ "ENGINE-CANDLE-SOURCE-006": "ENGINE-CANDLE-SOURCE-006";
128
+ "ENGINE-CANDLE-SOURCE-010": "ENGINE-CANDLE-SOURCE-010";
129
+ "ENGINE-CANDLE-REORG-001": "ENGINE-CANDLE-REORG-001";
130
+ }>>;
131
+ }, z.core.$strict>;
132
+ }, z.core.$strict>, z.ZodObject<{
133
+ schemaVersion: z.ZodLiteral<"1">;
134
+ history: z.ZodObject<{
135
+ schemaVersion: z.ZodLiteral<"2">;
136
+ chainId: z.ZodNumber;
137
+ marketId: z.ZodString;
138
+ poolId: z.ZodString;
139
+ poolManager: z.ZodString;
140
+ baseAsset: z.ZodObject<{
141
+ address: z.ZodString;
142
+ decimals: z.ZodNumber;
143
+ }, z.core.$strict>;
144
+ quoteAsset: z.ZodObject<{
145
+ address: z.ZodString;
146
+ decimals: z.ZodNumber;
147
+ }, z.core.$strict>;
148
+ orientation: z.ZodLiteral<"quote_per_base">;
149
+ resolution: z.ZodEnum<{
150
+ "1d": "1d";
151
+ "5m": "5m";
152
+ "1h": "1h";
153
+ }>;
154
+ window: z.ZodEnum<{
155
+ "7d": "7d";
156
+ "30d": "30d";
157
+ "90d": "90d";
158
+ "180d": "180d";
159
+ "1d": "1d";
160
+ }>;
161
+ status: z.ZodEnum<{
162
+ ready: "ready";
163
+ no_data: "no_data";
164
+ partial: "partial";
165
+ }>;
166
+ candles: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
167
+ aggregation: z.ZodLiteral<"exact_swaps">;
168
+ swapCount: z.ZodNumber;
169
+ provenance: z.ZodObject<{
170
+ firstSwap: z.ZodObject<{
171
+ blockNumber: z.ZodNumber;
172
+ blockHash: z.ZodNullable<z.ZodString>;
173
+ transactionHash: z.ZodString;
174
+ logIndex: z.ZodNumber;
175
+ }, z.core.$strict>;
176
+ lastSwap: z.ZodObject<{
177
+ blockNumber: z.ZodNumber;
178
+ blockHash: z.ZodNullable<z.ZodString>;
179
+ transactionHash: z.ZodString;
180
+ logIndex: z.ZodNumber;
181
+ }, z.core.$strict>;
182
+ }, z.core.$strict>;
183
+ t: z.ZodNumber;
184
+ open: z.ZodNumber;
185
+ high: z.ZodNumber;
186
+ low: z.ZodNumber;
187
+ close: z.ZodNumber;
188
+ volumeToken0: z.ZodString;
189
+ volumeToken1: z.ZodString;
190
+ }, z.core.$strict>, z.ZodObject<{
191
+ aggregation: z.ZodLiteral<"uniswap_pool_aggregate">;
192
+ txCount: z.ZodNumber;
193
+ volumeUSD: z.ZodOptional<z.ZodString>;
194
+ feesUSD: z.ZodOptional<z.ZodString>;
195
+ tvlUSD: z.ZodOptional<z.ZodString>;
196
+ t: z.ZodNumber;
197
+ open: z.ZodNumber;
198
+ high: z.ZodNumber;
199
+ low: z.ZodNumber;
200
+ close: z.ZodNumber;
201
+ volumeToken0: z.ZodString;
202
+ volumeToken1: z.ZodString;
203
+ }, z.core.$strict>], "aggregation">>;
204
+ candleCount: z.ZodNumber;
205
+ priceReference: z.ZodOptional<z.ZodNullable<z.ZodObject<{
206
+ kind: z.ZodLiteral<"pool_state">;
207
+ price: z.ZodNumber;
208
+ blockNumber: z.ZodNumber;
209
+ blockHash: z.ZodString;
210
+ timestamp: z.ZodNumber;
211
+ observedAt: z.ZodString;
212
+ }, z.core.$strict>>>;
213
+ coverage: z.ZodObject<{
214
+ requestedFrom: z.ZodNumber;
215
+ requestedTo: z.ZodNumber;
216
+ coverageStart: z.ZodNumber;
217
+ completedThrough: z.ZodNumber;
218
+ expectedBucketCount: z.ZodNumber;
219
+ completeBucketCount: z.ZodNumber;
220
+ }, z.core.$strict>;
221
+ gaps: z.ZodArray<z.ZodObject<{
222
+ from: z.ZodNumber;
223
+ to: z.ZodNumber;
224
+ reason: z.ZodEnum<{
225
+ indexing_gap: "indexing_gap";
226
+ invalid_row: "invalid_row";
227
+ }>;
228
+ }, z.core.$strict>>;
229
+ source: z.ZodEnum<{
230
+ uniswap_v4_subgraph: "uniswap_v4_subgraph";
231
+ pool_manager_rpc: "pool_manager_rpc";
232
+ }>;
233
+ asOf: z.ZodObject<{
234
+ blockNumber: z.ZodNullable<z.ZodNumber>;
235
+ blockHash: z.ZodNullable<z.ZodString>;
236
+ timestamp: z.ZodNullable<z.ZodNumber>;
237
+ }, z.core.$strict>;
238
+ freshness: z.ZodObject<{
239
+ status: z.ZodEnum<{
240
+ ready: "ready";
241
+ warming_up: "warming_up";
242
+ source_unavailable: "source_unavailable";
243
+ reorg_detected: "reorg_detected";
244
+ }>;
245
+ lastProcessedBlockNumber: z.ZodNullable<z.ZodNumber>;
246
+ lastProcessedBlockHash: z.ZodNullable<z.ZodString>;
247
+ confirmationDepth: z.ZodNumber;
248
+ observedAt: z.ZodString;
249
+ updatedAt: z.ZodString;
250
+ warnings: z.ZodArray<z.ZodEnum<{
251
+ "ENGINE-CANDLE-SOURCE-001": "ENGINE-CANDLE-SOURCE-001";
252
+ "ENGINE-CANDLE-SOURCE-002": "ENGINE-CANDLE-SOURCE-002";
253
+ "ENGINE-CANDLE-SOURCE-003": "ENGINE-CANDLE-SOURCE-003";
254
+ "ENGINE-CANDLE-SOURCE-004": "ENGINE-CANDLE-SOURCE-004";
255
+ "ENGINE-CANDLE-SOURCE-005": "ENGINE-CANDLE-SOURCE-005";
256
+ "ENGINE-CANDLE-SOURCE-006": "ENGINE-CANDLE-SOURCE-006";
257
+ "ENGINE-CANDLE-SOURCE-010": "ENGINE-CANDLE-SOURCE-010";
258
+ "ENGINE-CANDLE-REORG-001": "ENGINE-CANDLE-REORG-001";
259
+ }>>;
260
+ }, z.core.$strict>;
261
+ }, z.core.$strict>;
262
+ segments: z.ZodArray<z.ZodObject<{
263
+ from: z.ZodNumber;
264
+ to: z.ZodNumber;
265
+ price: z.ZodNumber;
266
+ }, z.core.$strict>>;
267
+ }, z.core.$strict>]>;
5
268
  export type EnginePoolPriceSegment = {
6
269
  from: number;
7
270
  to: number;
@@ -59,3 +322,4 @@ export declare function fetchEngineRateHistory(input: AegisEngineMarketSeriesInp
59
322
  * segments independently or manufacture OHLC for quiet buckets. */
60
323
  export declare function splitEngineMarketCandleSegments(history: AegisEnginePoolCandleHistory): AegisEnginePoolCandleHistory['candles'][];
61
324
  export { EngineMarketCandlesResponseSchema as engineMarketCandlesResponseSchema } from './marketSeriesSchemas.js';
325
+ export { EnginePoolPriceLineResponseSchema as enginePoolPriceLineResponseSchema };
@@ -1113,6 +1113,8 @@ type AegisEnginePositionActionQuoteBase = {
1113
1113
  signal?: AbortSignal;
1114
1114
  };
1115
1115
  export type AegisEngineRepayQuoteInput = AegisEnginePositionActionQuoteBase & {
1116
+ /** Opt into a recent canonical frame (0–60 seconds); omitted keeps strict current-head verification. */
1117
+ executionFrameMaxAgeSeconds?: bigint;
1116
1118
  target: AegisEngineBorrowPositionTarget;
1117
1119
  repayRl?: bigint | 'full';
1118
1120
  slippageBps: number;
@@ -1126,6 +1128,8 @@ export type AegisEngineAddCollateralQuoteInput = AegisEngineQuoteBase & {
1126
1128
  forceExecutionEvidenceRefresh?: boolean;
1127
1129
  };
1128
1130
  export type AegisEngineCloseQuoteInput = AegisEnginePositionActionQuoteBase & {
1131
+ /** Opt into a recent canonical frame (0–60 seconds); omitted keeps strict current-head verification. */
1132
+ executionFrameMaxAgeSeconds?: bigint;
1129
1133
  target: AegisEngineBorrowPositionTarget;
1130
1134
  };
1131
1135
  export type AegisEngineIdleWithdrawQuoteInput = AegisEnginePositionActionQuoteBase & {