@gearbox-protocol/sdk 15.1.0-next.7 → 15.1.0-next.8
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.
- package/dist/cjs/model/charts.js +147 -0
- package/dist/cjs/model/charts.schema.js +240 -0
- package/dist/cjs/model/index.js +27 -22
- package/dist/cjs/model/liquidations.schema.js +1 -1
- package/dist/cjs/model/opportunities.schema.js +1 -1
- package/dist/cjs/model/positions.schema.js +2 -2
- package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +2 -6
- package/dist/cjs/new-sdk/positions/PositionsNamespace.js +2 -6
- package/dist/cjs/new-sdk/utils/index.js +0 -1
- package/dist/cjs/offchain/AbstractOffchainNamespace.js +10 -7
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +4 -8
- package/dist/cjs/offchain/positions/OffchainPositions.js +8 -11
- package/dist/esm/model/charts.js +140 -0
- package/dist/esm/model/charts.schema.js +226 -0
- package/dist/esm/model/index.js +7 -7
- package/dist/esm/model/liquidations.schema.js +1 -1
- package/dist/esm/model/opportunities.schema.js +1 -1
- package/dist/esm/model/positions.schema.js +2 -2
- package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +2 -6
- package/dist/esm/new-sdk/positions/PositionsNamespace.js +2 -6
- package/dist/esm/new-sdk/utils/index.js +0 -1
- package/dist/esm/offchain/AbstractOffchainNamespace.js +10 -7
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +4 -8
- package/dist/esm/offchain/positions/OffchainPositions.js +8 -11
- package/dist/types/model/charts.d.ts +349 -0
- package/dist/types/model/charts.schema.d.ts +364 -0
- package/dist/types/model/index.d.ts +5 -5
- package/dist/types/model/positions.d.ts +1 -1
- package/dist/types/new-sdk/index.d.ts +1 -2
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +4 -5
- package/dist/types/new-sdk/opportunities/types.d.ts +9 -7
- package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +4 -5
- package/dist/types/new-sdk/positions/types.d.ts +9 -9
- package/dist/types/new-sdk/utils/index.d.ts +1 -2
- package/dist/types/offchain/AbstractOffchainNamespace.d.ts +5 -21
- package/dist/types/offchain/index.d.ts +2 -2
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +8 -4
- package/dist/types/offchain/positions/OffchainPositions.d.ts +11 -5
- package/package.json +1 -1
- package/dist/cjs/model/history.js +0 -53
- package/dist/cjs/model/history.schema.js +0 -128
- package/dist/cjs/new-sdk/utils/history.js +0 -1
- package/dist/esm/model/history.js +0 -49
- package/dist/esm/model/history.schema.js +0 -116
- package/dist/esm/new-sdk/utils/history.js +0 -1
- package/dist/types/model/history.d.ts +0 -153
- package/dist/types/model/history.schema.d.ts +0 -95
- package/dist/types/new-sdk/utils/history.d.ts +0 -18
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { ChartBundle, ChartMetric, ChartRange } from "./charts.js";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
//#region src/model/charts.schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Runtime schemas for {@link ./charts.js}, see the note in
|
|
6
|
+
* `primitives.schema.ts` on why they are written by hand.
|
|
7
|
+
*
|
|
8
|
+
* Metric schemas are shared with the backend, while
|
|
9
|
+
* {@link chartBundleSchemaFor} builds the response schema for one concrete
|
|
10
|
+
* request. Component schemas remain available for consumers that validate
|
|
11
|
+
* model fragments.
|
|
12
|
+
**/
|
|
13
|
+
/**
|
|
14
|
+
* {@link ChartRange}
|
|
15
|
+
**/
|
|
16
|
+
declare const chartRangeSchema: z.ZodEnum<{
|
|
17
|
+
"1d": "1d";
|
|
18
|
+
"1m": "1m";
|
|
19
|
+
"1w": "1w";
|
|
20
|
+
"1y": "1y";
|
|
21
|
+
max: "max";
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* {@link PoolOpportunityChartMetric}
|
|
25
|
+
**/
|
|
26
|
+
declare const poolOpportunityChartMetricSchema: z.ZodEnum<{
|
|
27
|
+
availableLiquidity: "availableLiquidity";
|
|
28
|
+
borrowApy: "borrowApy";
|
|
29
|
+
borrowed: "borrowed";
|
|
30
|
+
depositApy: "depositApy";
|
|
31
|
+
dieselRate: "dieselRate";
|
|
32
|
+
supplied: "supplied";
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* {@link StrategyOpportunityChartMetric}
|
|
36
|
+
**/
|
|
37
|
+
declare const strategyOpportunityChartMetricSchema: z.ZodEnum<{
|
|
38
|
+
borrowApy: "borrowApy";
|
|
39
|
+
collateralApy: "collateralApy";
|
|
40
|
+
collateralPrice: "collateralPrice";
|
|
41
|
+
collateralUsdPrice: "collateralUsdPrice";
|
|
42
|
+
netApy: "netApy";
|
|
43
|
+
tvl: "tvl";
|
|
44
|
+
underlyingUsdPrice: "underlyingUsdPrice";
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* {@link PoolPositionChartMetric}
|
|
48
|
+
**/
|
|
49
|
+
declare const poolPositionChartMetricSchema: z.ZodEnum<{
|
|
50
|
+
apy: "apy";
|
|
51
|
+
mwr: "mwr";
|
|
52
|
+
pnl: "pnl";
|
|
53
|
+
twr: "twr";
|
|
54
|
+
underlyingPrice: "underlyingPrice";
|
|
55
|
+
value: "value";
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* {@link StrategyPositionChartMetric}
|
|
59
|
+
**/
|
|
60
|
+
declare const strategyPositionChartMetricSchema: z.ZodEnum<{
|
|
61
|
+
borrowApy: "borrowApy";
|
|
62
|
+
debt: "debt";
|
|
63
|
+
healthFactor: "healthFactor";
|
|
64
|
+
leverage: "leverage";
|
|
65
|
+
mwr: "mwr";
|
|
66
|
+
pnl: "pnl";
|
|
67
|
+
totalValueUnderlying: "totalValueUnderlying";
|
|
68
|
+
totalValueUsd: "totalValueUsd";
|
|
69
|
+
trailingApy30d: "trailingApy30d";
|
|
70
|
+
trailingApy7d: "trailingApy7d";
|
|
71
|
+
twr: "twr";
|
|
72
|
+
twrApy: "twrApy";
|
|
73
|
+
underlyingPrice: "underlyingPrice";
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* {@link ChartMetric}, every metric either kind of subject can chart.
|
|
77
|
+
**/
|
|
78
|
+
declare const chartMetricSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
79
|
+
availableLiquidity: "availableLiquidity";
|
|
80
|
+
borrowApy: "borrowApy";
|
|
81
|
+
borrowed: "borrowed";
|
|
82
|
+
depositApy: "depositApy";
|
|
83
|
+
dieselRate: "dieselRate";
|
|
84
|
+
supplied: "supplied";
|
|
85
|
+
}>, z.ZodEnum<{
|
|
86
|
+
borrowApy: "borrowApy";
|
|
87
|
+
collateralApy: "collateralApy";
|
|
88
|
+
collateralPrice: "collateralPrice";
|
|
89
|
+
collateralUsdPrice: "collateralUsdPrice";
|
|
90
|
+
netApy: "netApy";
|
|
91
|
+
tvl: "tvl";
|
|
92
|
+
underlyingUsdPrice: "underlyingUsdPrice";
|
|
93
|
+
}>, z.ZodEnum<{
|
|
94
|
+
apy: "apy";
|
|
95
|
+
mwr: "mwr";
|
|
96
|
+
pnl: "pnl";
|
|
97
|
+
twr: "twr";
|
|
98
|
+
underlyingPrice: "underlyingPrice";
|
|
99
|
+
value: "value";
|
|
100
|
+
}>, z.ZodEnum<{
|
|
101
|
+
borrowApy: "borrowApy";
|
|
102
|
+
debt: "debt";
|
|
103
|
+
healthFactor: "healthFactor";
|
|
104
|
+
leverage: "leverage";
|
|
105
|
+
mwr: "mwr";
|
|
106
|
+
pnl: "pnl";
|
|
107
|
+
totalValueUnderlying: "totalValueUnderlying";
|
|
108
|
+
totalValueUsd: "totalValueUsd";
|
|
109
|
+
trailingApy30d: "trailingApy30d";
|
|
110
|
+
trailingApy7d: "trailingApy7d";
|
|
111
|
+
twr: "twr";
|
|
112
|
+
twrApy: "twrApy";
|
|
113
|
+
underlyingPrice: "underlyingPrice";
|
|
114
|
+
}>]>;
|
|
115
|
+
/**
|
|
116
|
+
* {@link ChartQuery}
|
|
117
|
+
**/
|
|
118
|
+
declare const chartQuerySchema: z.ZodObject<{
|
|
119
|
+
metrics: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
|
|
120
|
+
availableLiquidity: "availableLiquidity";
|
|
121
|
+
borrowApy: "borrowApy";
|
|
122
|
+
borrowed: "borrowed";
|
|
123
|
+
depositApy: "depositApy";
|
|
124
|
+
dieselRate: "dieselRate";
|
|
125
|
+
supplied: "supplied";
|
|
126
|
+
}>, z.ZodEnum<{
|
|
127
|
+
borrowApy: "borrowApy";
|
|
128
|
+
collateralApy: "collateralApy";
|
|
129
|
+
collateralPrice: "collateralPrice";
|
|
130
|
+
collateralUsdPrice: "collateralUsdPrice";
|
|
131
|
+
netApy: "netApy";
|
|
132
|
+
tvl: "tvl";
|
|
133
|
+
underlyingUsdPrice: "underlyingUsdPrice";
|
|
134
|
+
}>, z.ZodEnum<{
|
|
135
|
+
apy: "apy";
|
|
136
|
+
mwr: "mwr";
|
|
137
|
+
pnl: "pnl";
|
|
138
|
+
twr: "twr";
|
|
139
|
+
underlyingPrice: "underlyingPrice";
|
|
140
|
+
value: "value";
|
|
141
|
+
}>, z.ZodEnum<{
|
|
142
|
+
borrowApy: "borrowApy";
|
|
143
|
+
debt: "debt";
|
|
144
|
+
healthFactor: "healthFactor";
|
|
145
|
+
leverage: "leverage";
|
|
146
|
+
mwr: "mwr";
|
|
147
|
+
pnl: "pnl";
|
|
148
|
+
totalValueUnderlying: "totalValueUnderlying";
|
|
149
|
+
totalValueUsd: "totalValueUsd";
|
|
150
|
+
trailingApy30d: "trailingApy30d";
|
|
151
|
+
trailingApy7d: "trailingApy7d";
|
|
152
|
+
twr: "twr";
|
|
153
|
+
twrApy: "twrApy";
|
|
154
|
+
underlyingPrice: "underlyingPrice";
|
|
155
|
+
}>]>>>;
|
|
156
|
+
range: z.ZodEnum<{
|
|
157
|
+
"1d": "1d";
|
|
158
|
+
"1m": "1m";
|
|
159
|
+
"1w": "1w";
|
|
160
|
+
"1y": "1y";
|
|
161
|
+
max: "max";
|
|
162
|
+
}>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
/**
|
|
165
|
+
* {@link ChartQuery} as a URL can carry it: the metrics comma-joined, since
|
|
166
|
+
* repeated `?metrics=` entries would order differently between clients and give
|
|
167
|
+
* one request two cache keys.
|
|
168
|
+
**/
|
|
169
|
+
declare const chartQueryParamsSchema: z.ZodObject<{
|
|
170
|
+
metrics: z.ZodString;
|
|
171
|
+
range: z.ZodEnum<{
|
|
172
|
+
"1d": "1d";
|
|
173
|
+
"1m": "1m";
|
|
174
|
+
"1w": "1w";
|
|
175
|
+
"1y": "1y";
|
|
176
|
+
max: "max";
|
|
177
|
+
}>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
/**
|
|
180
|
+
* Codec for {@link ChartQuery} to encode/decode to/from url query parameters.
|
|
181
|
+
*
|
|
182
|
+
* The one place the wire form of a chart request is decided. The SDK encodes
|
|
183
|
+
* with it, the backend decodes with it, and the checks that a read names at
|
|
184
|
+
* least one metric and names none of them twice ride along in both directions —
|
|
185
|
+
* so a bad request fails before it is issued, not after a round trip.
|
|
186
|
+
**/
|
|
187
|
+
declare const chartQueryCodec: z.ZodCodec<z.ZodObject<{
|
|
188
|
+
metrics: z.ZodString;
|
|
189
|
+
range: z.ZodEnum<{
|
|
190
|
+
"1d": "1d";
|
|
191
|
+
"1m": "1m";
|
|
192
|
+
"1w": "1w";
|
|
193
|
+
"1y": "1y";
|
|
194
|
+
max: "max";
|
|
195
|
+
}>;
|
|
196
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
metrics: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
|
|
198
|
+
availableLiquidity: "availableLiquidity";
|
|
199
|
+
borrowApy: "borrowApy";
|
|
200
|
+
borrowed: "borrowed";
|
|
201
|
+
depositApy: "depositApy";
|
|
202
|
+
dieselRate: "dieselRate";
|
|
203
|
+
supplied: "supplied";
|
|
204
|
+
}>, z.ZodEnum<{
|
|
205
|
+
borrowApy: "borrowApy";
|
|
206
|
+
collateralApy: "collateralApy";
|
|
207
|
+
collateralPrice: "collateralPrice";
|
|
208
|
+
collateralUsdPrice: "collateralUsdPrice";
|
|
209
|
+
netApy: "netApy";
|
|
210
|
+
tvl: "tvl";
|
|
211
|
+
underlyingUsdPrice: "underlyingUsdPrice";
|
|
212
|
+
}>, z.ZodEnum<{
|
|
213
|
+
apy: "apy";
|
|
214
|
+
mwr: "mwr";
|
|
215
|
+
pnl: "pnl";
|
|
216
|
+
twr: "twr";
|
|
217
|
+
underlyingPrice: "underlyingPrice";
|
|
218
|
+
value: "value";
|
|
219
|
+
}>, z.ZodEnum<{
|
|
220
|
+
borrowApy: "borrowApy";
|
|
221
|
+
debt: "debt";
|
|
222
|
+
healthFactor: "healthFactor";
|
|
223
|
+
leverage: "leverage";
|
|
224
|
+
mwr: "mwr";
|
|
225
|
+
pnl: "pnl";
|
|
226
|
+
totalValueUnderlying: "totalValueUnderlying";
|
|
227
|
+
totalValueUsd: "totalValueUsd";
|
|
228
|
+
trailingApy30d: "trailingApy30d";
|
|
229
|
+
trailingApy7d: "trailingApy7d";
|
|
230
|
+
twr: "twr";
|
|
231
|
+
twrApy: "twrApy";
|
|
232
|
+
underlyingPrice: "underlyingPrice";
|
|
233
|
+
}>]>>>;
|
|
234
|
+
range: z.ZodEnum<{
|
|
235
|
+
"1d": "1d";
|
|
236
|
+
"1m": "1m";
|
|
237
|
+
"1w": "1w";
|
|
238
|
+
"1y": "1y";
|
|
239
|
+
max: "max";
|
|
240
|
+
}>;
|
|
241
|
+
}, z.core.$strip>>;
|
|
242
|
+
/**
|
|
243
|
+
* {@link ChartDenomination}
|
|
244
|
+
**/
|
|
245
|
+
declare const chartDenominationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
246
|
+
unit: z.ZodLiteral<"bps">;
|
|
247
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
248
|
+
unit: z.ZodLiteral<"usd">;
|
|
249
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
250
|
+
unit: z.ZodLiteral<"scalar">;
|
|
251
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
252
|
+
unit: z.ZodLiteral<"token">;
|
|
253
|
+
base: z.ZodObject<{
|
|
254
|
+
chainId: z.ZodNumber;
|
|
255
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
256
|
+
symbol: z.ZodString;
|
|
257
|
+
name: z.ZodString;
|
|
258
|
+
decimals: z.ZodNumber;
|
|
259
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
260
|
+
}, z.core.$strip>;
|
|
261
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
+
unit: z.ZodLiteral<"ratio">;
|
|
263
|
+
base: z.ZodObject<{
|
|
264
|
+
chainId: z.ZodNumber;
|
|
265
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
266
|
+
symbol: z.ZodString;
|
|
267
|
+
name: z.ZodString;
|
|
268
|
+
decimals: z.ZodNumber;
|
|
269
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
270
|
+
}, z.core.$strip>;
|
|
271
|
+
quote: z.ZodObject<{
|
|
272
|
+
chainId: z.ZodNumber;
|
|
273
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
274
|
+
symbol: z.ZodString;
|
|
275
|
+
name: z.ZodString;
|
|
276
|
+
decimals: z.ZodNumber;
|
|
277
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
278
|
+
}, z.core.$strip>;
|
|
279
|
+
}, z.core.$strip>], "unit">;
|
|
280
|
+
/**
|
|
281
|
+
* {@link ChartValue}. `null` is a gap, never a zero.
|
|
282
|
+
**/
|
|
283
|
+
declare const chartValueSchema: z.ZodNullable<z.ZodNumber>;
|
|
284
|
+
/**
|
|
285
|
+
* {@link ChartSeries}
|
|
286
|
+
**/
|
|
287
|
+
declare const chartSeriesSchema: z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
|
|
288
|
+
status: z.ZodLiteral<"ok">;
|
|
289
|
+
values: z.ZodArray<z.ZodNullable<z.ZodNumber>>;
|
|
290
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
291
|
+
unit: z.ZodLiteral<"bps">;
|
|
292
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
293
|
+
unit: z.ZodLiteral<"usd">;
|
|
294
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
295
|
+
unit: z.ZodLiteral<"scalar">;
|
|
296
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
297
|
+
unit: z.ZodLiteral<"token">;
|
|
298
|
+
base: z.ZodObject<{
|
|
299
|
+
chainId: z.ZodNumber;
|
|
300
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
301
|
+
symbol: z.ZodString;
|
|
302
|
+
name: z.ZodString;
|
|
303
|
+
decimals: z.ZodNumber;
|
|
304
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
305
|
+
}, z.core.$strip>;
|
|
306
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
307
|
+
unit: z.ZodLiteral<"ratio">;
|
|
308
|
+
base: z.ZodObject<{
|
|
309
|
+
chainId: z.ZodNumber;
|
|
310
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
311
|
+
symbol: z.ZodString;
|
|
312
|
+
name: z.ZodString;
|
|
313
|
+
decimals: z.ZodNumber;
|
|
314
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
quote: z.ZodObject<{
|
|
317
|
+
chainId: z.ZodNumber;
|
|
318
|
+
address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
319
|
+
symbol: z.ZodString;
|
|
320
|
+
name: z.ZodString;
|
|
321
|
+
decimals: z.ZodNumber;
|
|
322
|
+
assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
|
|
323
|
+
}, z.core.$strip>;
|
|
324
|
+
}, z.core.$strip>], "unit">>, z.ZodObject<{
|
|
325
|
+
status: z.ZodLiteral<"unavailable">;
|
|
326
|
+
reason: z.ZodObject<{
|
|
327
|
+
code: z.ZodEnum<{
|
|
328
|
+
internal: "internal";
|
|
329
|
+
no_price_feed: "no_price_feed";
|
|
330
|
+
not_indexed: "not_indexed";
|
|
331
|
+
unknown_subject: "unknown_subject";
|
|
332
|
+
unsupported_metric: "unsupported_metric";
|
|
333
|
+
}>;
|
|
334
|
+
message: z.ZodOptional<z.ZodString>;
|
|
335
|
+
}, z.core.$strip>;
|
|
336
|
+
}, z.core.$strip>]>;
|
|
337
|
+
/**
|
|
338
|
+
* {@link ChartWindow}
|
|
339
|
+
**/
|
|
340
|
+
declare const chartWindowSchema: z.ZodObject<{
|
|
341
|
+
range: z.ZodEnum<{
|
|
342
|
+
"1d": "1d";
|
|
343
|
+
"1m": "1m";
|
|
344
|
+
"1w": "1w";
|
|
345
|
+
"1y": "1y";
|
|
346
|
+
max: "max";
|
|
347
|
+
}>;
|
|
348
|
+
from: z.ZodNumber;
|
|
349
|
+
to: z.ZodNumber;
|
|
350
|
+
}, z.core.$strip>;
|
|
351
|
+
/**
|
|
352
|
+
* The schema one chart read is decoded with: a {@link ChartBundle} keyed by the
|
|
353
|
+
* requested distinct metrics, all of them and nothing else, for the requested
|
|
354
|
+
* range.
|
|
355
|
+
*
|
|
356
|
+
* Pinning the metrics is what upholds the `ChartBundle<Metrics>` a caller gets
|
|
357
|
+
* back — a response that answers a different question fails validation rather
|
|
358
|
+
* than being cast into the requested shape. The declared return type is the one
|
|
359
|
+
* the key schema actually enforces, which the compiler cannot see through a
|
|
360
|
+
* schema built from a runtime list.
|
|
361
|
+
**/
|
|
362
|
+
declare function chartBundleSchemaFor<const Metrics extends readonly ChartMetric[]>(metrics: Metrics, range: ChartRange): z.ZodType<ChartBundle<Metrics>>;
|
|
363
|
+
//#endregion
|
|
364
|
+
export { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall } from "./primitives.js";
|
|
2
2
|
import { Curator, CuratorName } from "./curators.js";
|
|
3
|
+
import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
|
|
4
|
+
import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
|
|
3
5
|
import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
|
|
4
6
|
import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
|
|
5
7
|
import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
|
|
6
|
-
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
7
8
|
import { DelayedReceivedAsset, InstantReceivedAsset, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, ReceivedAsset, matchesLiquidatableAccountFilter } from "./liquidations.js";
|
|
8
|
-
import { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
|
|
9
|
-
import { HistoryChartMetadata, HistoryMetric, HistoryPoint, HistoryRange, HistorySeries, OpportunityHistoryQuery, POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, PoolHistoryMetric, PoolPositionHistoryMetric, PositionHistoryMetric, PositionHistoryQuery, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS, StrategyHistoryMetric, StrategyPositionHistoryMetric } from "./history.js";
|
|
10
|
-
import { historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, opportunityHistoryQuerySchema, poolHistoryMetricSchema, poolPositionHistoryMetricSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, strategyHistoryMetricSchema, strategyPositionHistoryMetricSchema } from "./history.schema.js";
|
|
11
9
|
import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
|
|
10
|
+
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
12
11
|
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
12
|
+
import { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
|
|
13
13
|
import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
|
|
14
14
|
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema } from "./primitives.schema.js";
|
|
15
15
|
import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
|
|
16
16
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
17
|
-
export { Amount, ApyBreakdown, AssetType, BorrowRateBreakdown, Bps, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, Curator, CuratorName, DataResponse, DataSource, DelayedReceivedAsset, FILTER_ALL, FilterAll, Filterable,
|
|
17
|
+
export { Amount, ApyBreakdown, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, Curator, CuratorName, DataResponse, DataSource, DelayedReceivedAsset, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenRewards, TokenRewardsPnL, TxCall, amountSchema, apyBreakdownSchema, assetTypeSchema, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, txCallSchema };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AssetType, Bps, ChainId, Leverage, Token, TokenAmount } from "./primitives.js";
|
|
2
2
|
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
3
|
-
import { ApyBreakdown, PointsProgram } from "./opportunities.js";
|
|
4
3
|
import { DelayedReceivedAsset, LiquidationPosition } from "./liquidations.js";
|
|
4
|
+
import { ApyBreakdown, PointsProgram } from "./opportunities.js";
|
|
5
5
|
import { Address } from "viem";
|
|
6
6
|
//#region src/model/positions.d.ts
|
|
7
7
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GearboxSDKOptions, Mode, NamespaceOptions, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, PlainMultichainSDKOptions } from "./types.js";
|
|
2
2
|
import { EntityMerger, FilterResult, ListMerger, MergeListResult } from "./utils/types.js";
|
|
3
3
|
import { filterResponse } from "./utils/filterResponse.js";
|
|
4
|
-
import { HistoryReader } from "./utils/history.js";
|
|
5
4
|
import { DEFAULT_MAX_OFFCHAIN_LAG, mergeChainList, mergeChainOne } from "./utils/mergeChains.js";
|
|
6
5
|
import "./utils/index.js";
|
|
7
6
|
import { AbstractNamespace, MergedQuery } from "./AbstractNamespace.js";
|
|
@@ -20,4 +19,4 @@ import { SourceUnavailableError } from "./errors/SourceUnavailableError.js";
|
|
|
20
19
|
import { assertSameChains } from "./errors/assertSameChains.js";
|
|
21
20
|
import { everyChainFailed } from "./errors/everyChainFailed.js";
|
|
22
21
|
import "./errors/index.js";
|
|
23
|
-
export { AbstractNamespace, AllSourcesFailedError, ChainRef, DEFAULT_MAX_OFFCHAIN_LAG, type EntityMerger, type FilterResult, GearboxSDK, GearboxSDKOptions,
|
|
22
|
+
export { AbstractNamespace, AllSourcesFailedError, ChainRef, DEFAULT_MAX_OFFCHAIN_LAG, type EntityMerger, type FilterResult, GearboxSDK, GearboxSDKOptions, type ListMerger, type MergeListResult, MergedQuery, MissingSourceError, Mode, NamespaceOptions, NoSourceServedError, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, Opportunities, OpportunitiesBase, OpportunitiesByMode, OpportunitiesMerged, OpportunitiesNamespace, OpportunitiesOffchainBranch, OpportunitiesOffchainOnly, OpportunitiesOnchainBranch, OpportunitiesOnchainOnly, OpportunityMergers, PlainMultichainSDKOptions, PositionMergers, Positions, PositionsBase, PositionsByMode, PositionsMerged, PositionsNamespace, PositionsOffchainBranch, PositionsOffchainOnly, PositionsOnchainBranch, PositionsOnchainOnly, SourceChainMismatchError, SourceUnavailableError, assertSameChains, everyChainFailed, filterResponse, mergeChainList, mergeChainOne };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
2
|
-
import { PoolHistoryMetric, StrategyHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainSDK } from "../../sdk/MultichainSDK.js";
|
|
@@ -8,7 +8,6 @@ import { GearboxAPI } from "../../offchain/GearboxAPI.js";
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { NamespaceOptions } from "../types.js";
|
|
10
10
|
import { FilterResult } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
13
12
|
import { AbstractNamespace } from "../AbstractNamespace.js";
|
|
14
13
|
import { OpportunitiesBase, OpportunitiesOffchainOnly, OpportunityMergers } from "./types.js";
|
|
@@ -40,10 +39,10 @@ declare class OpportunitiesNamespace extends AbstractNamespace<MultichainSDK["op
|
|
|
40
39
|
**/
|
|
41
40
|
filter<R extends DataResponse<Opportunity[]> | undefined>(response: R, filter?: OpportunityFilter): FilterResult<R, Opportunity>;
|
|
42
41
|
/**
|
|
43
|
-
* {@inheritDoc OpportunitiesOffchainOnly.
|
|
42
|
+
* {@inheritDoc OpportunitiesOffchainOnly.charts}
|
|
44
43
|
**/
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
charts<const Metrics extends readonly PoolOpportunityChartMetric[]>(key: PoolOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
45
|
+
charts<const Metrics extends readonly StrategyOpportunityChartMetric[]>(key: StrategyOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
47
46
|
}
|
|
48
47
|
//#endregion
|
|
49
48
|
export { OpportunitiesNamespace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
|
|
2
|
-
import { PoolHistoryMetric, StrategyHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainOpportunitiesService } from "../../sdk/opportunities/MultichainOpportunitiesService.js";
|
|
@@ -8,7 +8,6 @@ import { OffchainOpportunities } from "../../offchain/opportunities/OffchainOppo
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { Mode } from "../types.js";
|
|
10
10
|
import { EntityMerger, FilterResult, ListMerger } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
13
12
|
//#region src/new-sdk/opportunities/types.d.ts
|
|
14
13
|
/**
|
|
@@ -56,12 +55,15 @@ interface OpportunitiesBase {
|
|
|
56
55
|
**/
|
|
57
56
|
interface OpportunitiesOffchainOnly {
|
|
58
57
|
/**
|
|
59
|
-
* Historical charts of one opportunity, one
|
|
60
|
-
* `
|
|
61
|
-
*
|
|
58
|
+
* Historical charts of one opportunity, one series per metric on a shared
|
|
59
|
+
* axis: `charts(key, ["depositApy", "borrowApy"], "1m")`.
|
|
60
|
+
*
|
|
61
|
+
* The key's kind decides which metrics exist, so asking a pool for a strategy
|
|
62
|
+
* chart does not compile, and the bundle is keyed by exactly the metrics
|
|
63
|
+
* named — one of them is a bundle of one, not a different call.
|
|
62
64
|
**/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
charts<const Metrics extends readonly PoolOpportunityChartMetric[]>(key: PoolOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
66
|
+
charts<const Metrics extends readonly StrategyOpportunityChartMetric[]>(key: StrategyOpportunityRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
65
67
|
}
|
|
66
68
|
/**
|
|
67
69
|
* Reads only the chain can answer. Empty for now.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
-
import { PoolPositionHistoryMetric, StrategyPositionHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainSDK } from "../../sdk/MultichainSDK.js";
|
|
@@ -8,7 +8,6 @@ import { GearboxAPI } from "../../offchain/GearboxAPI.js";
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { NamespaceOptions } from "../types.js";
|
|
10
10
|
import { FilterResult } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
13
12
|
import { AbstractNamespace } from "../AbstractNamespace.js";
|
|
14
13
|
import { PositionMergers, PositionsBase, PositionsOffchainOnly } from "./types.js";
|
|
@@ -33,10 +32,10 @@ declare class PositionsNamespace extends AbstractNamespace<MultichainSDK["positi
|
|
|
33
32
|
**/
|
|
34
33
|
filter<R extends DataResponse<Position[]> | undefined>(response: R, filter?: PositionFilter): FilterResult<R, Position>;
|
|
35
34
|
/**
|
|
36
|
-
* {@inheritDoc PositionsOffchainOnly.
|
|
35
|
+
* {@inheritDoc PositionsOffchainOnly.charts}
|
|
37
36
|
**/
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
charts<const Metrics extends readonly PoolPositionChartMetric[]>(key: PoolPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
38
|
+
charts<const Metrics extends readonly StrategyPositionChartMetric[]>(key: StrategyPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
40
39
|
}
|
|
41
40
|
//#endregion
|
|
42
41
|
export { PositionsNamespace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
1
2
|
import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
-
import { PoolPositionHistoryMetric, StrategyPositionHistoryMetric } from "../../model/history.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import "../../model/index.js";
|
|
5
5
|
import { MultichainPositionsService } from "../../sdk/positions/MultichainPositionsService.js";
|
|
@@ -8,7 +8,6 @@ import { OffchainPositions } from "../../offchain/positions/OffchainPositions.js
|
|
|
8
8
|
import "../../offchain/index.js";
|
|
9
9
|
import { Mode } from "../types.js";
|
|
10
10
|
import { FilterResult, ListMerger } from "../utils/types.js";
|
|
11
|
-
import { HistoryReader } from "../utils/history.js";
|
|
12
11
|
import "../utils/index.js";
|
|
13
12
|
import { Address } from "viem";
|
|
14
13
|
//#region src/new-sdk/positions/types.d.ts
|
|
@@ -50,14 +49,15 @@ interface PositionsBase {
|
|
|
50
49
|
**/
|
|
51
50
|
interface PositionsOffchainOnly {
|
|
52
51
|
/**
|
|
53
|
-
* Historical charts of one position, one
|
|
54
|
-
* `
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
52
|
+
* Historical charts of one position, one series per metric on a shared axis:
|
|
53
|
+
* `charts(key, ["netApy", "borrowApy"], "1m")`.
|
|
54
|
+
*
|
|
55
|
+
* The key's kind decides which metrics exist, so asking a pool position for a
|
|
56
|
+
* strategy chart does not compile. Liquidation positions have no charts: a
|
|
57
|
+
* delayed withdrawal is a single event rather than a series.
|
|
58
58
|
**/
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
charts<const Metrics extends readonly PoolPositionChartMetric[]>(key: PoolPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
60
|
+
charts<const Metrics extends readonly StrategyPositionChartMetric[]>(key: StrategyPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Reads only the chain can answer. Empty for now.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EntityMerger, FilterResult, ListMerger, MergeListResult } from "./types.js";
|
|
2
2
|
import { filterResponse } from "./filterResponse.js";
|
|
3
|
-
import { HistoryReader } from "./history.js";
|
|
4
3
|
import { DEFAULT_MAX_OFFCHAIN_LAG, mergeChainList, mergeChainOne } from "./mergeChains.js";
|
|
5
|
-
export { DEFAULT_MAX_OFFCHAIN_LAG, type EntityMerger, type FilterResult,
|
|
4
|
+
export { DEFAULT_MAX_OFFCHAIN_LAG, type EntityMerger, type FilterResult, type ListMerger, type MergeListResult, filterResponse, mergeChainList, mergeChainOne };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILogger } from "../sdk/types/logger.js";
|
|
2
2
|
import { ChainId } from "../model/primitives.js";
|
|
3
|
+
import { ChartBundle, ChartMetric, ChartRange } from "../model/charts.js";
|
|
3
4
|
import { ChainScopedFilter } from "../model/filters.js";
|
|
4
|
-
import { HistoryMetric, HistoryRange, HistorySeries } from "../model/history.js";
|
|
5
5
|
import { DataResponse } from "../model/response.js";
|
|
6
6
|
import { GearboxAPIOptions } from "./types.js";
|
|
7
7
|
import { z } from "zod/v4";
|
|
@@ -30,22 +30,6 @@ interface OffchainGetRequest<S extends z.ZodType> {
|
|
|
30
30
|
**/
|
|
31
31
|
schema: S;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* One backend read of a historical series.
|
|
35
|
-
*
|
|
36
|
-
* @typeParam M - Metric the series carries.
|
|
37
|
-
**/
|
|
38
|
-
interface OffchainHistoryRequest<M extends HistoryMetric> {
|
|
39
|
-
/**
|
|
40
|
-
* Path of the series, metric included.
|
|
41
|
-
**/
|
|
42
|
-
path: string;
|
|
43
|
-
/**
|
|
44
|
-
* Metric the response must carry.
|
|
45
|
-
**/
|
|
46
|
-
metric: M;
|
|
47
|
-
range: HistoryRange;
|
|
48
|
-
}
|
|
49
33
|
/**
|
|
50
34
|
* Base class of every {@link GearboxAPI} namespace: issues the requests,
|
|
51
35
|
* decodes the responses and reports the failures, so that a namespace holds
|
|
@@ -71,10 +55,10 @@ declare abstract class AbstractOffchainNamespace {
|
|
|
71
55
|
**/
|
|
72
56
|
protected get<S extends z.ZodType>(request: OffchainGetRequest<S>): Promise<DataResponse<z.output<S>>>;
|
|
73
57
|
/**
|
|
74
|
-
* Reads
|
|
75
|
-
*
|
|
58
|
+
* Reads the charts of one subject: one series per metric named, onto the one
|
|
59
|
+
* grid that lets them be compared at an index.
|
|
76
60
|
**/
|
|
77
|
-
protected
|
|
61
|
+
protected readCharts<const Metrics extends readonly ChartMetric[]>(path: string, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
78
62
|
}
|
|
79
63
|
//#endregion
|
|
80
|
-
export { AbstractOffchainNamespace, OffchainGetRequest,
|
|
64
|
+
export { AbstractOffchainNamespace, OffchainGetRequest, OffchainQuery };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GearboxAPIOptions } from "./types.js";
|
|
2
|
-
import { AbstractOffchainNamespace, OffchainGetRequest,
|
|
2
|
+
import { AbstractOffchainNamespace, OffchainGetRequest, OffchainQuery } from "./AbstractOffchainNamespace.js";
|
|
3
3
|
import { backendMessage } from "./errors/backendMessage.js";
|
|
4
4
|
import { ErrorCause, errorCause } from "./errors/errorCause.js";
|
|
5
5
|
import { OffchainTransportError, OffchainTransportErrorParams } from "./errors/OffchainTransportError.js";
|
|
@@ -16,4 +16,4 @@ import "./opportunities/index.js";
|
|
|
16
16
|
import { OffchainPositions } from "./positions/OffchainPositions.js";
|
|
17
17
|
import "./positions/index.js";
|
|
18
18
|
import { GearboxAPI } from "./GearboxAPI.js";
|
|
19
|
-
export { AbstractOffchainNamespace, ErrorCause, GearboxAPI, GearboxAPIOptions, OffchainGetRequest,
|
|
19
|
+
export { AbstractOffchainNamespace, ErrorCause, GearboxAPI, GearboxAPIOptions, OffchainGetRequest, OffchainInvalidJsonError, OffchainNotConfiguredError, OffchainNotImplementedError, OffchainOpportunities, OffchainPositions, OffchainQuery, OffchainRequestFailedError, OffchainStatusError, OffchainTransportError, OffchainTransportErrorParams, OffchainValidationError, backendMessage, errorCause, readResponseBody };
|