@gearbox-protocol/sdk 15.1.0-next.6 → 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/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
- package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/cjs/model/charts.js +147 -0
- package/dist/cjs/model/charts.schema.js +240 -0
- package/dist/cjs/model/index.js +28 -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 +15 -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/cjs/preview/preview/CreditAccountState.js +14 -1
- package/dist/cjs/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/cjs/preview/preview/previewOperation.js +1 -1
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +0 -6
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +31 -4
- package/dist/cjs/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +18 -0
- package/dist/cjs/sdk/accounts/intents/utils/index.js +2 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +0 -3
- package/dist/cjs/sdk/index.js +12 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/cjs/sdk/positions/PositionsService.js +206 -1
- package/dist/cjs/sdk/positions/calcBorrowRate.js +43 -0
- package/dist/cjs/sdk/positions/calcHealthFactor.js +44 -0
- package/dist/cjs/sdk/positions/calcLiquidationPrice.js +23 -0
- package/dist/cjs/sdk/positions/calcLiquidationPriceForTarget.js +30 -0
- package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +18 -0
- package/dist/cjs/sdk/positions/index.js +12 -1
- package/dist/cjs/sdk/positions/types.js +31 -0
- package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
- package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- 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 +16 -4
- 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/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/preview/preview/CreditAccountState.js +14 -1
- package/dist/esm/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/esm/preview/preview/previewOperation.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -8
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +31 -4
- package/dist/esm/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +17 -0
- package/dist/esm/sdk/accounts/intents/utils/index.js +2 -1
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -4
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +3 -3
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +7 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/positions/PositionsService.js +206 -1
- package/dist/esm/sdk/positions/calcBorrowRate.js +42 -0
- package/dist/esm/sdk/positions/calcHealthFactor.js +43 -0
- package/dist/esm/sdk/positions/calcLiquidationPrice.js +22 -0
- package/dist/esm/sdk/positions/calcLiquidationPriceForTarget.js +29 -0
- package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +17 -0
- package/dist/esm/sdk/positions/index.js +7 -2
- package/dist/esm/sdk/positions/types.js +31 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +3 -0
- package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +3 -0
- package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +3 -0
- 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 +6 -6
- package/dist/types/model/positions.d.ts +85 -2
- package/dist/types/model/positions.schema.d.ts +26 -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/dist/types/preview/preview/CreditAccountState.d.ts +6 -0
- package/dist/types/preview/preview/buildDelayedPreview.d.ts +5 -1
- package/dist/types/preview/preview/types.d.ts +4 -2
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -7
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +3 -12
- package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +2 -2
- package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +1 -19
- package/dist/types/sdk/accounts/index.d.ts +2 -2
- package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +6 -0
- package/dist/types/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/utils/index.d.ts +2 -1
- package/dist/types/sdk/accounts/types.d.ts +1 -12
- package/dist/types/sdk/index.d.ts +8 -3
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +4 -0
- package/dist/types/sdk/market/oracle/types.d.ts +8 -0
- package/dist/types/sdk/positions/PositionsService.d.ts +31 -2
- package/dist/types/sdk/positions/calcBorrowRate.d.ts +40 -0
- package/dist/types/sdk/positions/calcHealthFactor.d.ts +45 -0
- package/dist/types/sdk/positions/calcLiquidationPrice.d.ts +12 -0
- package/dist/types/sdk/positions/calcLiquidationPriceForTarget.d.ts +43 -0
- package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +15 -0
- package/dist/types/sdk/positions/index.d.ts +7 -2
- package/dist/types/sdk/positions/types.d.ts +58 -1
- 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,153 +0,0 @@
|
|
|
1
|
-
import { Timestamp } from "./primitives.js";
|
|
2
|
-
import { OpportunityKey } from "./opportunities.js";
|
|
3
|
-
import { PositionKey } from "./positions.js";
|
|
4
|
-
//#region src/model/history.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Historical time series of an opportunity.
|
|
7
|
-
*
|
|
8
|
-
* History is backend-only by construction: the chain serves the present, and
|
|
9
|
-
* reconstructing a series from it would mean archive-node reads per point.
|
|
10
|
-
**/
|
|
11
|
-
/**
|
|
12
|
-
* Time window a series covers, ending at the present.
|
|
13
|
-
*
|
|
14
|
-
* `"max"` is the full history the backend retains for the opportunity.
|
|
15
|
-
**/
|
|
16
|
-
type HistoryRange = "1d" | "1w" | "1m" | "1y" | "max";
|
|
17
|
-
/**
|
|
18
|
-
* Series available for a pool opportunity.
|
|
19
|
-
**/
|
|
20
|
-
type PoolHistoryMetric = "depositApy" | "borrowApy" | "dieselRate" | "supplied" | "borrowed" | "availableLiquidity";
|
|
21
|
-
/**
|
|
22
|
-
* Every {@link PoolHistoryMetric}, for callers that enumerate them.
|
|
23
|
-
**/
|
|
24
|
-
declare const POOL_HISTORY_METRICS: readonly ["depositApy", "borrowApy", "dieselRate", "supplied", "borrowed", "availableLiquidity"];
|
|
25
|
-
/**
|
|
26
|
-
* Series available for a strategy opportunity.
|
|
27
|
-
*
|
|
28
|
-
* `collateralPrice` is the collateral/underlying series a liquidation-price
|
|
29
|
-
* chart draws; the two USD series are the same prices quoted in dollars.
|
|
30
|
-
**/
|
|
31
|
-
type StrategyHistoryMetric = "netApy" | "borrowApy" | "collateralApy" | "tvl" | "collateralPrice" | "collateralUsdPrice" | "underlyingUsdPrice";
|
|
32
|
-
/**
|
|
33
|
-
* Every {@link StrategyHistoryMetric}, for callers that enumerate them.
|
|
34
|
-
**/
|
|
35
|
-
declare const STRATEGY_HISTORY_METRICS: readonly ["netApy", "borrowApy", "collateralApy", "tvl", "collateralPrice", "collateralUsdPrice", "underlyingUsdPrice"];
|
|
36
|
-
/**
|
|
37
|
-
* Series available for a pool position.
|
|
38
|
-
*
|
|
39
|
-
* Spelled out rather than aliased to {@link PoolHistoryMetric}: an opportunity
|
|
40
|
-
* and a position are separate contracts with the backend, and the position
|
|
41
|
-
* series are expected to grow their own members (PnL above all) without that
|
|
42
|
-
* change reaching the opportunity charts.
|
|
43
|
-
**/
|
|
44
|
-
type PoolPositionHistoryMetric = "depositApy" | "borrowApy" | "dieselRate" | "supplied" | "borrowed" | "availableLiquidity";
|
|
45
|
-
/**
|
|
46
|
-
* Every {@link PoolPositionHistoryMetric}, for callers that enumerate them.
|
|
47
|
-
**/
|
|
48
|
-
declare const POOL_POSITION_HISTORY_METRICS: readonly ["depositApy", "borrowApy", "dieselRate", "supplied", "borrowed", "availableLiquidity"];
|
|
49
|
-
/**
|
|
50
|
-
* Series available for a strategy position, see the note on
|
|
51
|
-
* {@link PoolPositionHistoryMetric} for why these are spelled out separately
|
|
52
|
-
* from {@link StrategyHistoryMetric}.
|
|
53
|
-
**/
|
|
54
|
-
type StrategyPositionHistoryMetric = "netApy" | "borrowApy" | "collateralApy" | "tvl" | "collateralPrice" | "collateralUsdPrice" | "underlyingUsdPrice";
|
|
55
|
-
/**
|
|
56
|
-
* Every {@link StrategyPositionHistoryMetric}, for callers that enumerate them.
|
|
57
|
-
**/
|
|
58
|
-
declare const STRATEGY_POSITION_HISTORY_METRICS: readonly ["netApy", "borrowApy", "collateralApy", "tvl", "collateralPrice", "collateralUsdPrice", "underlyingUsdPrice"];
|
|
59
|
-
/**
|
|
60
|
-
* Any series a position can return.
|
|
61
|
-
**/
|
|
62
|
-
type PositionHistoryMetric = PoolPositionHistoryMetric | StrategyPositionHistoryMetric;
|
|
63
|
-
/**
|
|
64
|
-
* Any series the read model can return.
|
|
65
|
-
**/
|
|
66
|
-
type HistoryMetric = PoolHistoryMetric | StrategyHistoryMetric | PositionHistoryMetric;
|
|
67
|
-
/**
|
|
68
|
-
* One sample of a series.
|
|
69
|
-
**/
|
|
70
|
-
interface HistoryPoint {
|
|
71
|
-
/**
|
|
72
|
-
* When the sample was taken.
|
|
73
|
-
**/
|
|
74
|
-
timestamp: Timestamp;
|
|
75
|
-
/**
|
|
76
|
-
* Sampled value. The unit follows from the metric: APY metrics are in basis
|
|
77
|
-
* points, amount metrics are in the underlying's base units expressed as a
|
|
78
|
-
* float, price metrics are plain prices.
|
|
79
|
-
*
|
|
80
|
-
* @example `842` for an 8.42% APY sample
|
|
81
|
-
**/
|
|
82
|
-
value: number;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Annotations the backend ships alongside a series, e.g. what a chart drawn
|
|
86
|
-
* from it should say beyond the points themselves.
|
|
87
|
-
*
|
|
88
|
-
* TODO: the backend has not specified this payload yet. It stays empty until
|
|
89
|
-
* it does, so that filling it in later is additive rather than a rename.
|
|
90
|
-
**/
|
|
91
|
-
interface HistoryChartMetadata {}
|
|
92
|
-
/**
|
|
93
|
-
* A named series of samples ordered by ascending timestamp.
|
|
94
|
-
*
|
|
95
|
-
* @typeParam M - Metric the series carries.
|
|
96
|
-
**/
|
|
97
|
-
interface HistorySeries<M extends string = HistoryMetric> {
|
|
98
|
-
/**
|
|
99
|
-
* Metric the samples belong to; it also defines their unit, so no separate
|
|
100
|
-
* unit field ships.
|
|
101
|
-
**/
|
|
102
|
-
metric: M;
|
|
103
|
-
/**
|
|
104
|
-
* Samples, oldest first.
|
|
105
|
-
**/
|
|
106
|
-
points: HistoryPoint[];
|
|
107
|
-
/**
|
|
108
|
-
* What the backend says about the series, see {@link HistoryChartMetadata}.
|
|
109
|
-
**/
|
|
110
|
-
metadata: HistoryChartMetadata;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* A request for one series of a single opportunity.
|
|
114
|
-
*
|
|
115
|
-
* @typeParam M - Metric requested.
|
|
116
|
-
**/
|
|
117
|
-
interface OpportunityHistoryQuery<M extends HistoryMetric = HistoryMetric> {
|
|
118
|
-
/**
|
|
119
|
-
* Opportunity the series belongs to.
|
|
120
|
-
**/
|
|
121
|
-
opportunity: OpportunityKey;
|
|
122
|
-
/**
|
|
123
|
-
* Window to cover.
|
|
124
|
-
**/
|
|
125
|
-
range: HistoryRange;
|
|
126
|
-
/**
|
|
127
|
-
* Metric to return. A metric that does not apply to the opportunity's kind
|
|
128
|
-
* has no series.
|
|
129
|
-
**/
|
|
130
|
-
metric: M;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* A request for one series of a single position.
|
|
134
|
-
*
|
|
135
|
-
* @typeParam M - Metric requested.
|
|
136
|
-
**/
|
|
137
|
-
interface PositionHistoryQuery<M extends PositionHistoryMetric = PositionHistoryMetric> {
|
|
138
|
-
/**
|
|
139
|
-
* Position the series belongs to.
|
|
140
|
-
**/
|
|
141
|
-
position: PositionKey;
|
|
142
|
-
/**
|
|
143
|
-
* Window to cover.
|
|
144
|
-
**/
|
|
145
|
-
range: HistoryRange;
|
|
146
|
-
/**
|
|
147
|
-
* Metric to return. A metric that does not apply to the position's kind has
|
|
148
|
-
* no series.
|
|
149
|
-
**/
|
|
150
|
-
metric: M;
|
|
151
|
-
}
|
|
152
|
-
//#endregion
|
|
153
|
-
export { 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 };
|
|
@@ -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 };
|