@gearbox-protocol/sdk 15.1.0-next.23 → 15.1.0-next.25
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 +20 -34
- package/dist/cjs/model/opportunities.schema.js +17 -17
- package/dist/cjs/sdk/OnchainSDK.js +16 -0
- package/dist/cjs/sdk/accounts/intents/utils/pick-token.js +2 -2
- package/dist/cjs/sdk/base/TokensMeta.js +33 -1
- package/dist/cjs/sdk/base/index.js +1 -0
- package/dist/cjs/sdk/base/token-types.js +13 -0
- package/dist/cjs/sdk/chain/chains.js +9 -12
- package/dist/cjs/sdk/chain/index.js +0 -1
- package/dist/cjs/sdk/index.js +5 -3
- package/dist/cjs/sdk/market/MarketSuite.js +11 -5
- package/dist/cjs/sdk/market/credit/CreditSuite.js +11 -9
- package/dist/cjs/sdk/market/credit/collateralUtils.js +2 -14
- package/dist/cjs/sdk/market/credit/index.js +0 -1
- package/dist/cjs/sdk/market/index.js +4 -2
- package/dist/cjs/sdk/market/math.js +71 -17
- package/dist/cjs/sdk/market/strategyName.js +4 -6
- package/dist/cjs/sdk/positions/PositionsService.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/charts.js +20 -34
- package/dist/esm/model/opportunities.schema.js +17 -17
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/OnchainSDK.js +16 -0
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/intents/utils/pick-token.js +1 -1
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
- 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 +36 -4
- package/dist/esm/sdk/base/index.js +2 -2
- package/dist/esm/sdk/base/token-types.js +13 -1
- package/dist/esm/sdk/chain/chains.js +10 -12
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/chain/index.js +2 -2
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +5 -5
- package/dist/esm/sdk/market/MarketSuite.js +11 -5
- package/dist/esm/sdk/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/sdk/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditSuite.js +12 -10
- package/dist/esm/sdk/market/credit/collateralUtils.js +2 -13
- package/dist/esm/sdk/market/credit/index.js +2 -2
- package/dist/esm/sdk/market/index.js +3 -3
- package/dist/esm/sdk/market/math.js +68 -17
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/strategyName.js +4 -6
- 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 +1 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/model/charts.d.ts +16 -23
- package/dist/types/model/charts.schema.d.ts +24 -52
- package/dist/types/model/opportunities.d.ts +27 -29
- package/dist/types/model/opportunities.schema.d.ts +113 -242
- package/dist/types/model/primitives.d.ts +4 -0
- package/dist/types/new-sdk/opportunities/types.d.ts +1 -1
- package/dist/types/new-sdk/positions/types.d.ts +1 -1
- package/dist/types/sdk/base/TokensMeta.d.ts +31 -2
- package/dist/types/sdk/base/index.d.ts +3 -3
- package/dist/types/sdk/base/token-types.d.ts +14 -1
- package/dist/types/sdk/chain/chains.d.ts +3 -11
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +6 -6
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +1 -5
- package/dist/types/sdk/market/credit/collateralUtils.d.ts +1 -7
- package/dist/types/sdk/market/credit/index.d.ts +2 -2
- package/dist/types/sdk/market/index.d.ts +3 -3
- package/dist/types/sdk/market/math.d.ts +64 -13
- package/dist/types/sdk/market/strategyName.d.ts +3 -5
- package/package.json +1 -1
|
@@ -24,10 +24,9 @@ declare const chartRangeSchema: z.ZodEnum<{
|
|
|
24
24
|
* {@link PoolOpportunityChartMetric}
|
|
25
25
|
**/
|
|
26
26
|
declare const poolOpportunityChartMetricSchema: z.ZodEnum<{
|
|
27
|
-
availableLiquidity: "availableLiquidity";
|
|
28
|
-
borrowApy: "borrowApy";
|
|
29
27
|
borrowed: "borrowed";
|
|
30
28
|
depositApy: "depositApy";
|
|
29
|
+
depositApyAvg7d: "depositApyAvg7d";
|
|
31
30
|
dieselRate: "dieselRate";
|
|
32
31
|
supplied: "supplied";
|
|
33
32
|
}>;
|
|
@@ -36,10 +35,12 @@ declare const poolOpportunityChartMetricSchema: z.ZodEnum<{
|
|
|
36
35
|
**/
|
|
37
36
|
declare const strategyOpportunityChartMetricSchema: z.ZodEnum<{
|
|
38
37
|
borrowApy: "borrowApy";
|
|
38
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
39
39
|
collateralApy: "collateralApy";
|
|
40
40
|
collateralPrice: "collateralPrice";
|
|
41
41
|
collateralUsdPrice: "collateralUsdPrice";
|
|
42
|
-
|
|
42
|
+
liquidationThreshold: "liquidationThreshold";
|
|
43
|
+
quotaRate: "quotaRate";
|
|
43
44
|
tvl: "tvl";
|
|
44
45
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
45
46
|
}>;
|
|
@@ -50,108 +51,86 @@ declare const poolPositionChartMetricSchema: z.ZodEnum<{
|
|
|
50
51
|
apy: "apy";
|
|
51
52
|
mwr: "mwr";
|
|
52
53
|
pnl: "pnl";
|
|
53
|
-
twr: "twr";
|
|
54
|
-
underlyingPrice: "underlyingPrice";
|
|
55
|
-
value: "value";
|
|
56
54
|
}>;
|
|
57
55
|
/**
|
|
58
56
|
* {@link StrategyPositionChartMetric}
|
|
59
57
|
**/
|
|
60
58
|
declare const strategyPositionChartMetricSchema: z.ZodEnum<{
|
|
61
59
|
borrowApy: "borrowApy";
|
|
60
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
62
61
|
debt: "debt";
|
|
63
62
|
healthFactor: "healthFactor";
|
|
64
|
-
leverage: "leverage";
|
|
65
63
|
mwr: "mwr";
|
|
64
|
+
netApy7d: "netApy7d";
|
|
66
65
|
pnl: "pnl";
|
|
67
66
|
totalValueUnderlying: "totalValueUnderlying";
|
|
68
|
-
totalValueUsd: "totalValueUsd";
|
|
69
|
-
trailingApy30d: "trailingApy30d";
|
|
70
|
-
trailingApy7d: "trailingApy7d";
|
|
71
|
-
twr: "twr";
|
|
72
|
-
twrApy: "twrApy";
|
|
73
|
-
underlyingPrice: "underlyingPrice";
|
|
74
67
|
}>;
|
|
75
68
|
/**
|
|
76
69
|
* {@link ChartMetric}, every metric either kind of subject can chart.
|
|
77
70
|
**/
|
|
78
71
|
declare const chartMetricSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
79
|
-
availableLiquidity: "availableLiquidity";
|
|
80
|
-
borrowApy: "borrowApy";
|
|
81
72
|
borrowed: "borrowed";
|
|
82
73
|
depositApy: "depositApy";
|
|
74
|
+
depositApyAvg7d: "depositApyAvg7d";
|
|
83
75
|
dieselRate: "dieselRate";
|
|
84
76
|
supplied: "supplied";
|
|
85
77
|
}>, z.ZodEnum<{
|
|
86
78
|
borrowApy: "borrowApy";
|
|
79
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
87
80
|
collateralApy: "collateralApy";
|
|
88
81
|
collateralPrice: "collateralPrice";
|
|
89
82
|
collateralUsdPrice: "collateralUsdPrice";
|
|
90
|
-
|
|
83
|
+
liquidationThreshold: "liquidationThreshold";
|
|
84
|
+
quotaRate: "quotaRate";
|
|
91
85
|
tvl: "tvl";
|
|
92
86
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
93
87
|
}>, z.ZodEnum<{
|
|
94
88
|
apy: "apy";
|
|
95
89
|
mwr: "mwr";
|
|
96
90
|
pnl: "pnl";
|
|
97
|
-
twr: "twr";
|
|
98
|
-
underlyingPrice: "underlyingPrice";
|
|
99
|
-
value: "value";
|
|
100
91
|
}>, z.ZodEnum<{
|
|
101
92
|
borrowApy: "borrowApy";
|
|
93
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
102
94
|
debt: "debt";
|
|
103
95
|
healthFactor: "healthFactor";
|
|
104
|
-
leverage: "leverage";
|
|
105
96
|
mwr: "mwr";
|
|
97
|
+
netApy7d: "netApy7d";
|
|
106
98
|
pnl: "pnl";
|
|
107
99
|
totalValueUnderlying: "totalValueUnderlying";
|
|
108
|
-
totalValueUsd: "totalValueUsd";
|
|
109
|
-
trailingApy30d: "trailingApy30d";
|
|
110
|
-
trailingApy7d: "trailingApy7d";
|
|
111
|
-
twr: "twr";
|
|
112
|
-
twrApy: "twrApy";
|
|
113
|
-
underlyingPrice: "underlyingPrice";
|
|
114
100
|
}>]>;
|
|
115
101
|
/**
|
|
116
102
|
* {@link ChartQuery}
|
|
117
103
|
**/
|
|
118
104
|
declare const chartQuerySchema: z.ZodObject<{
|
|
119
105
|
metrics: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
|
|
120
|
-
availableLiquidity: "availableLiquidity";
|
|
121
|
-
borrowApy: "borrowApy";
|
|
122
106
|
borrowed: "borrowed";
|
|
123
107
|
depositApy: "depositApy";
|
|
108
|
+
depositApyAvg7d: "depositApyAvg7d";
|
|
124
109
|
dieselRate: "dieselRate";
|
|
125
110
|
supplied: "supplied";
|
|
126
111
|
}>, z.ZodEnum<{
|
|
127
112
|
borrowApy: "borrowApy";
|
|
113
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
128
114
|
collateralApy: "collateralApy";
|
|
129
115
|
collateralPrice: "collateralPrice";
|
|
130
116
|
collateralUsdPrice: "collateralUsdPrice";
|
|
131
|
-
|
|
117
|
+
liquidationThreshold: "liquidationThreshold";
|
|
118
|
+
quotaRate: "quotaRate";
|
|
132
119
|
tvl: "tvl";
|
|
133
120
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
134
121
|
}>, z.ZodEnum<{
|
|
135
122
|
apy: "apy";
|
|
136
123
|
mwr: "mwr";
|
|
137
124
|
pnl: "pnl";
|
|
138
|
-
twr: "twr";
|
|
139
|
-
underlyingPrice: "underlyingPrice";
|
|
140
|
-
value: "value";
|
|
141
125
|
}>, z.ZodEnum<{
|
|
142
126
|
borrowApy: "borrowApy";
|
|
127
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
143
128
|
debt: "debt";
|
|
144
129
|
healthFactor: "healthFactor";
|
|
145
|
-
leverage: "leverage";
|
|
146
130
|
mwr: "mwr";
|
|
131
|
+
netApy7d: "netApy7d";
|
|
147
132
|
pnl: "pnl";
|
|
148
133
|
totalValueUnderlying: "totalValueUnderlying";
|
|
149
|
-
totalValueUsd: "totalValueUsd";
|
|
150
|
-
trailingApy30d: "trailingApy30d";
|
|
151
|
-
trailingApy7d: "trailingApy7d";
|
|
152
|
-
twr: "twr";
|
|
153
|
-
twrApy: "twrApy";
|
|
154
|
-
underlyingPrice: "underlyingPrice";
|
|
155
134
|
}>]>>>;
|
|
156
135
|
range: z.ZodEnum<{
|
|
157
136
|
"1d": "1d";
|
|
@@ -195,41 +174,34 @@ declare const chartQueryCodec: z.ZodCodec<z.ZodObject<{
|
|
|
195
174
|
}>;
|
|
196
175
|
}, z.core.$strip>, z.ZodObject<{
|
|
197
176
|
metrics: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
|
|
198
|
-
availableLiquidity: "availableLiquidity";
|
|
199
|
-
borrowApy: "borrowApy";
|
|
200
177
|
borrowed: "borrowed";
|
|
201
178
|
depositApy: "depositApy";
|
|
179
|
+
depositApyAvg7d: "depositApyAvg7d";
|
|
202
180
|
dieselRate: "dieselRate";
|
|
203
181
|
supplied: "supplied";
|
|
204
182
|
}>, z.ZodEnum<{
|
|
205
183
|
borrowApy: "borrowApy";
|
|
184
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
206
185
|
collateralApy: "collateralApy";
|
|
207
186
|
collateralPrice: "collateralPrice";
|
|
208
187
|
collateralUsdPrice: "collateralUsdPrice";
|
|
209
|
-
|
|
188
|
+
liquidationThreshold: "liquidationThreshold";
|
|
189
|
+
quotaRate: "quotaRate";
|
|
210
190
|
tvl: "tvl";
|
|
211
191
|
underlyingUsdPrice: "underlyingUsdPrice";
|
|
212
192
|
}>, z.ZodEnum<{
|
|
213
193
|
apy: "apy";
|
|
214
194
|
mwr: "mwr";
|
|
215
195
|
pnl: "pnl";
|
|
216
|
-
twr: "twr";
|
|
217
|
-
underlyingPrice: "underlyingPrice";
|
|
218
|
-
value: "value";
|
|
219
196
|
}>, z.ZodEnum<{
|
|
220
197
|
borrowApy: "borrowApy";
|
|
198
|
+
borrowApyAvg7d: "borrowApyAvg7d";
|
|
221
199
|
debt: "debt";
|
|
222
200
|
healthFactor: "healthFactor";
|
|
223
|
-
leverage: "leverage";
|
|
224
201
|
mwr: "mwr";
|
|
202
|
+
netApy7d: "netApy7d";
|
|
225
203
|
pnl: "pnl";
|
|
226
204
|
totalValueUnderlying: "totalValueUnderlying";
|
|
227
|
-
totalValueUsd: "totalValueUsd";
|
|
228
|
-
trailingApy30d: "trailingApy30d";
|
|
229
|
-
trailingApy7d: "trailingApy7d";
|
|
230
|
-
twr: "twr";
|
|
231
|
-
twrApy: "twrApy";
|
|
232
|
-
underlyingPrice: "underlyingPrice";
|
|
233
205
|
}>]>>>;
|
|
234
206
|
range: z.ZodEnum<{
|
|
235
207
|
"1d": "1d";
|
|
@@ -206,6 +206,10 @@ interface PoolOpportunity extends OpportunityBase {
|
|
|
206
206
|
* @mode offchain
|
|
207
207
|
**/
|
|
208
208
|
supplyApyAvg7D?: ApyBreakdown;
|
|
209
|
+
/**
|
|
210
|
+
* Quota configuration of every collateral token of the market.
|
|
211
|
+
**/
|
|
212
|
+
quotaAssets: QuotaAsset[];
|
|
209
213
|
}
|
|
210
214
|
/**
|
|
211
215
|
* A leveraged position: one credit manager plus the single target collateral
|
|
@@ -263,29 +267,13 @@ interface StrategyOpportunity extends OpportunityBase {
|
|
|
263
267
|
* @mode offchain
|
|
264
268
|
**/
|
|
265
269
|
collateralApyAvg7D?: ApyBreakdown;
|
|
266
|
-
/**
|
|
267
|
-
* Net yield at {@link maxLeverage}:
|
|
268
|
-
* `collateralApy × maxLeverage − borrowApy × (maxLeverage − 1) − additionalBorrowApy`.
|
|
269
|
-
* Yield is on the whole position; borrow interest is on the borrowed part only.
|
|
270
|
-
*
|
|
271
|
-
* Absent in `onchain` mode: its {@link collateralApy} term is.
|
|
272
|
-
*
|
|
273
|
-
* @mode offchain
|
|
274
|
-
**/
|
|
275
|
-
maxLeverageApy?: ApyBreakdown;
|
|
276
|
-
/**
|
|
277
|
-
* Average {@link maxLeverageApy} over the trailing seven days.
|
|
278
|
-
*
|
|
279
|
-
* @mode offchain
|
|
280
|
-
**/
|
|
281
|
-
maxLeverageApyAvg7D?: ApyBreakdown;
|
|
282
270
|
/**
|
|
283
271
|
* Annual cost of the borrowed underlying, in basis points, including the
|
|
284
272
|
* protocol's interest fee.
|
|
285
273
|
*
|
|
286
274
|
* @example `520` for 5.2% APY
|
|
287
275
|
**/
|
|
288
|
-
borrowApy
|
|
276
|
+
borrowApy: Bps;
|
|
289
277
|
/**
|
|
290
278
|
* Average {@link borrowApy} over the trailing seven days, in basis points.
|
|
291
279
|
*
|
|
@@ -295,22 +283,22 @@ interface StrategyOpportunity extends OpportunityBase {
|
|
|
295
283
|
**/
|
|
296
284
|
borrowApyAvg7D?: Bps;
|
|
297
285
|
/**
|
|
298
|
-
* Annual cost of
|
|
299
|
-
* `quotaRate × (1 + feeInterest)
|
|
300
|
-
* quoted
|
|
286
|
+
* Annual quota cost of {@link targetCollateral}, in basis points, including
|
|
287
|
+
* the protocol's interest fee: `pqk.quotaRate × (1 + feeInterest)`. Quota
|
|
288
|
+
* accrues on the quoted amount and carries the same DAO fee as
|
|
289
|
+
* {@link borrowApy}.
|
|
301
290
|
*
|
|
302
|
-
* @example `90` for
|
|
291
|
+
* @example `90` for 0.9% APY
|
|
303
292
|
**/
|
|
304
|
-
|
|
293
|
+
quotaRate: Bps;
|
|
305
294
|
/**
|
|
306
|
-
* Average {@link
|
|
307
|
-
* points.
|
|
295
|
+
* Average {@link quotaRate} over the trailing seven days, in basis points.
|
|
308
296
|
*
|
|
309
297
|
* Absent in `onchain` mode: calculating it requires historical data.
|
|
310
298
|
*
|
|
311
299
|
* @mode offchain
|
|
312
300
|
**/
|
|
313
|
-
|
|
301
|
+
quotaRateAvg7D?: Bps;
|
|
314
302
|
/**
|
|
315
303
|
* Size of the strategy: the summed total value of the credit accounts
|
|
316
304
|
* opened in this credit manager.
|
|
@@ -510,6 +498,20 @@ interface QuotaAsset {
|
|
|
510
498
|
* Amount currently quoted, denominated in the market's underlying.
|
|
511
499
|
**/
|
|
512
500
|
used: Amount;
|
|
501
|
+
/**
|
|
502
|
+
* This token's share of the pool's used quota, in basis points:
|
|
503
|
+
* `used / Σ used` over every quota asset of the pool. Zero when nothing is
|
|
504
|
+
* quoted.
|
|
505
|
+
*
|
|
506
|
+
* @example `2500` for 25% of the quoted amount
|
|
507
|
+
**/
|
|
508
|
+
allocationShare: Bps;
|
|
509
|
+
/**
|
|
510
|
+
* Estimate of how much of the pool's {@link OpportunityBase.totalBorrow}
|
|
511
|
+
* backs this collateral: {@link allocationShare} applied to the pool's
|
|
512
|
+
* total borrowed amount, denominated in the underlying.
|
|
513
|
+
**/
|
|
514
|
+
allocatedDebt: Amount;
|
|
513
515
|
}
|
|
514
516
|
/**
|
|
515
517
|
* A price feed and the feeds it is composed of.
|
|
@@ -576,10 +578,6 @@ interface PoolOpportunityDetail extends PoolOpportunity {
|
|
|
576
578
|
* Interest rate curve of the pool.
|
|
577
579
|
**/
|
|
578
580
|
rateCurve: RateCurve;
|
|
579
|
-
/**
|
|
580
|
-
* Quota configuration of every collateral token of the market.
|
|
581
|
-
**/
|
|
582
|
-
quotaAssets: QuotaAsset[];
|
|
583
581
|
}
|
|
584
582
|
/**
|
|
585
583
|
* A strategy opportunity plus the data only its detail screen needs.
|