@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
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { HistoryChartMetadata } from "./history.js";
|
|
2
|
-
import { z } from "zod/v4";
|
|
3
|
-
//#region src/model/history.schema.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Runtime schemas for {@link ./history.js}, see the note in
|
|
6
|
-
* `primitives.schema.ts` on why they are written by hand.
|
|
7
|
-
**/
|
|
8
|
-
/**
|
|
9
|
-
* {@link HistoryRange}
|
|
10
|
-
**/
|
|
11
|
-
declare const historyRangeSchema: z.ZodUnion<readonly [z.ZodLiteral<"1d">, z.ZodLiteral<"1w">, z.ZodLiteral<"1m">, z.ZodLiteral<"1y">, z.ZodLiteral<"max">]>;
|
|
12
|
-
/**
|
|
13
|
-
* {@link PoolHistoryMetric}
|
|
14
|
-
**/
|
|
15
|
-
declare const poolHistoryMetricSchema: z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>;
|
|
16
|
-
/**
|
|
17
|
-
* {@link StrategyHistoryMetric}
|
|
18
|
-
**/
|
|
19
|
-
declare const strategyHistoryMetricSchema: z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>;
|
|
20
|
-
/**
|
|
21
|
-
* {@link PoolPositionHistoryMetric}
|
|
22
|
-
**/
|
|
23
|
-
declare const poolPositionHistoryMetricSchema: z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>;
|
|
24
|
-
/**
|
|
25
|
-
* {@link StrategyPositionHistoryMetric}
|
|
26
|
-
**/
|
|
27
|
-
declare const strategyPositionHistoryMetricSchema: z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>;
|
|
28
|
-
/**
|
|
29
|
-
* {@link PositionHistoryMetric}
|
|
30
|
-
**/
|
|
31
|
-
declare const positionHistoryMetricSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>]>;
|
|
32
|
-
/**
|
|
33
|
-
* {@link HistoryMetric}
|
|
34
|
-
**/
|
|
35
|
-
declare const historyMetricSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>]>]>;
|
|
36
|
-
/**
|
|
37
|
-
* {@link HistoryPoint}
|
|
38
|
-
**/
|
|
39
|
-
declare const historyPointSchema: z.ZodObject<{
|
|
40
|
-
timestamp: z.ZodNumber;
|
|
41
|
-
value: z.ZodNumber;
|
|
42
|
-
}, z.core.$strip>;
|
|
43
|
-
/**
|
|
44
|
-
* {@link HistoryChartMetadata}
|
|
45
|
-
*
|
|
46
|
-
* TODO: empty until the backend specifies the payload.
|
|
47
|
-
**/
|
|
48
|
-
declare const historyChartMetadataSchema: z.ZodType<HistoryChartMetadata>;
|
|
49
|
-
/**
|
|
50
|
-
* {@link HistorySeries}
|
|
51
|
-
**/
|
|
52
|
-
declare const historySeriesSchema: z.ZodObject<{
|
|
53
|
-
metric: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>]>]>;
|
|
54
|
-
points: z.ZodArray<z.ZodObject<{
|
|
55
|
-
timestamp: z.ZodNumber;
|
|
56
|
-
value: z.ZodNumber;
|
|
57
|
-
}, z.core.$strip>>;
|
|
58
|
-
metadata: z.ZodType<HistoryChartMetadata, unknown, z.core.$ZodTypeInternals<HistoryChartMetadata, unknown>>;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
|
-
/**
|
|
61
|
-
* {@link OpportunityHistoryQuery}
|
|
62
|
-
**/
|
|
63
|
-
declare const opportunityHistoryQuerySchema: z.ZodObject<{
|
|
64
|
-
opportunity: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
65
|
-
chainId: z.ZodNumber;
|
|
66
|
-
pool: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
67
|
-
kind: z.ZodLiteral<"pool">;
|
|
68
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
-
chainId: z.ZodNumber;
|
|
70
|
-
creditManager: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
71
|
-
targetCollateral: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
72
|
-
kind: z.ZodLiteral<"strategy">;
|
|
73
|
-
}, z.core.$strip>], "kind">;
|
|
74
|
-
range: z.ZodUnion<readonly [z.ZodLiteral<"1d">, z.ZodLiteral<"1w">, z.ZodLiteral<"1m">, z.ZodLiteral<"1y">, z.ZodLiteral<"max">]>;
|
|
75
|
-
metric: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>]>]>;
|
|
76
|
-
}, z.core.$strip>;
|
|
77
|
-
/**
|
|
78
|
-
* {@link PositionHistoryQuery}
|
|
79
|
-
**/
|
|
80
|
-
declare const positionHistoryQuerySchema: z.ZodObject<{
|
|
81
|
-
position: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
82
|
-
chainId: z.ZodNumber;
|
|
83
|
-
pool: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
84
|
-
wallet: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
85
|
-
kind: z.ZodLiteral<"pool">;
|
|
86
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
87
|
-
chainId: z.ZodNumber;
|
|
88
|
-
creditAccount: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
|
|
89
|
-
kind: z.ZodLiteral<"strategy">;
|
|
90
|
-
}, z.core.$strip>], "kind">;
|
|
91
|
-
range: z.ZodUnion<readonly [z.ZodLiteral<"1d">, z.ZodLiteral<"1w">, z.ZodLiteral<"1m">, z.ZodLiteral<"1y">, z.ZodLiteral<"max">]>;
|
|
92
|
-
metric: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"depositApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"dieselRate">, z.ZodLiteral<"supplied">, z.ZodLiteral<"borrowed">, z.ZodLiteral<"availableLiquidity">]>, z.ZodUnion<readonly [z.ZodLiteral<"netApy">, z.ZodLiteral<"borrowApy">, z.ZodLiteral<"collateralApy">, z.ZodLiteral<"tvl">, z.ZodLiteral<"collateralPrice">, z.ZodLiteral<"collateralUsdPrice">, z.ZodLiteral<"underlyingUsdPrice">]>]>;
|
|
93
|
-
}, z.core.$strip>;
|
|
94
|
-
//#endregion
|
|
95
|
-
export { historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, opportunityHistoryQuerySchema, poolHistoryMetricSchema, poolPositionHistoryMetricSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, strategyHistoryMetricSchema, strategyPositionHistoryMetricSchema };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { HistoryRange, HistorySeries } from "../../model/history.js";
|
|
2
|
-
import { DataResponse } from "../../model/response.js";
|
|
3
|
-
import "../../model/index.js";
|
|
4
|
-
//#region src/new-sdk/utils/history.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Reads the charts of one subject, one metric and one range at a time.
|
|
7
|
-
*
|
|
8
|
-
* @typeParam Metric - Metrics the subject has.
|
|
9
|
-
**/
|
|
10
|
-
interface HistoryReader<Metric extends string> {
|
|
11
|
-
/**
|
|
12
|
-
* Historical chart of one metric over one window. A metric the subject does
|
|
13
|
-
* not have is a compile error.
|
|
14
|
-
**/
|
|
15
|
-
chart(metric: Metric, range: HistoryRange): Promise<DataResponse<HistorySeries<Metric>>>;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { HistoryReader };
|