@gearbox-protocol/sdk 15.1.0-next.24 → 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.
Files changed (72) hide show
  1. package/dist/cjs/model/charts.js +20 -34
  2. package/dist/cjs/model/opportunities.schema.js +14 -12
  3. package/dist/cjs/sdk/OnchainSDK.js +16 -0
  4. package/dist/cjs/sdk/accounts/intents/utils/pick-token.js +2 -2
  5. package/dist/cjs/sdk/base/TokensMeta.js +33 -1
  6. package/dist/cjs/sdk/base/index.js +1 -0
  7. package/dist/cjs/sdk/base/token-types.js +13 -0
  8. package/dist/cjs/sdk/chain/chains.js +9 -12
  9. package/dist/cjs/sdk/chain/index.js +0 -1
  10. package/dist/cjs/sdk/index.js +1 -2
  11. package/dist/cjs/sdk/market/MarketSuite.js +11 -5
  12. package/dist/cjs/sdk/market/credit/CreditSuite.js +1 -1
  13. package/dist/cjs/sdk/market/credit/collateralUtils.js +2 -14
  14. package/dist/cjs/sdk/market/credit/index.js +0 -1
  15. package/dist/cjs/sdk/market/index.js +0 -1
  16. package/dist/cjs/sdk/market/strategyName.js +4 -6
  17. package/dist/cjs/sdk/positions/PositionsService.js +1 -1
  18. package/dist/esm/dev/AccountOpener.js +1 -1
  19. package/dist/esm/dev/withdrawalUtils.js +1 -1
  20. package/dist/esm/model/charts.js +20 -34
  21. package/dist/esm/model/opportunities.schema.js +14 -12
  22. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  23. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  24. package/dist/esm/sdk/OnchainSDK.js +16 -0
  25. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
  26. package/dist/esm/sdk/accounts/intents/utils/pick-token.js +1 -1
  27. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -1
  28. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  29. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  30. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  31. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  32. package/dist/esm/sdk/base/TokensMeta.js +36 -4
  33. package/dist/esm/sdk/base/index.js +2 -2
  34. package/dist/esm/sdk/base/token-types.js +13 -1
  35. package/dist/esm/sdk/chain/chains.js +10 -12
  36. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  37. package/dist/esm/sdk/chain/index.js +2 -2
  38. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  39. package/dist/esm/sdk/index.js +4 -4
  40. package/dist/esm/sdk/market/MarketSuite.js +11 -5
  41. package/dist/esm/sdk/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  42. package/dist/esm/sdk/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  43. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  44. package/dist/esm/sdk/market/credit/CreditSuite.js +1 -1
  45. package/dist/esm/sdk/market/credit/collateralUtils.js +2 -13
  46. package/dist/esm/sdk/market/credit/index.js +2 -2
  47. package/dist/esm/sdk/market/index.js +2 -2
  48. package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
  49. package/dist/esm/sdk/market/strategyName.js +4 -6
  50. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  51. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  52. package/dist/esm/sdk/pools/PoolService.js +1 -1
  53. package/dist/esm/sdk/positions/PositionsService.js +1 -1
  54. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  55. package/dist/types/model/charts.d.ts +16 -23
  56. package/dist/types/model/charts.schema.d.ts +24 -52
  57. package/dist/types/model/opportunities.d.ts +18 -4
  58. package/dist/types/model/opportunities.schema.d.ts +101 -38
  59. package/dist/types/model/primitives.d.ts +4 -0
  60. package/dist/types/new-sdk/opportunities/types.d.ts +1 -1
  61. package/dist/types/new-sdk/positions/types.d.ts +1 -1
  62. package/dist/types/sdk/base/TokensMeta.d.ts +31 -2
  63. package/dist/types/sdk/base/index.d.ts +3 -3
  64. package/dist/types/sdk/base/token-types.d.ts +14 -1
  65. package/dist/types/sdk/chain/chains.d.ts +3 -11
  66. package/dist/types/sdk/chain/index.d.ts +2 -2
  67. package/dist/types/sdk/index.d.ts +5 -5
  68. package/dist/types/sdk/market/credit/collateralUtils.d.ts +1 -7
  69. package/dist/types/sdk/market/credit/index.d.ts +2 -2
  70. package/dist/types/sdk/market/index.d.ts +2 -2
  71. package/dist/types/sdk/market/strategyName.d.ts +3 -5
  72. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { iZapperAbi } from "../../../abi/iZapper.js";
2
1
  import { BaseContract } from "../../base/BaseContract.js";
3
2
  import "../../base/index.js";
3
+ import { iZapperAbi } from "../../../abi/iZapper.js";
4
4
  import { UnsupportedZapperFunctionError } from "./errors.js";
5
5
  //#region src/sdk/market/zapper/ZapperContract.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { ierc20Abi } from "../../abi/iERC20.js";
2
1
  import { AddressSet } from "../utils/AddressSet.js";
2
+ import { ierc20Abi } from "../../abi/iERC20.js";
3
3
  import "../constants/addresses.js";
4
4
  import { PERCENTAGE_FACTOR, RAY } from "../constants/math.js";
5
5
  import "../constants/index.js";
@@ -176,7 +176,7 @@ var PositionsService = class extends SDKConstruct {
176
176
  chainId: this.sdk.chainId,
177
177
  creditManager: ca.creditManager,
178
178
  creditAccount: ca.creditAccount,
179
- name: target ? strategyName(this.sdk.tokensMeta.mustGetToken(target), token, this.sdk.chainId) : token.symbol,
179
+ name: target ? strategyName(this.sdk.tokensMeta.mustGetToken(target), token) : token.symbol,
180
180
  targetCollateral: target ? this.sdk.tokensMeta.mustGetToken(target) : null,
181
181
  leverage: calcPositionLeverage(totalValue, totalDebtValue),
182
182
  borrowApy: calcBorrowApy(pool.baseInterestRate, suite.creditManager.feeInterest),
@@ -1,6 +1,6 @@
1
1
  import { errorAbis } from "../../../abi/errors.js";
2
- import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
3
2
  import { generateCastTraceCall } from "./cast.js";
3
+ import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
4
4
  import { simulateMulticall } from "./simulateMulticall.js";
5
5
  import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
6
6
  import { getAction, parseAccount } from "viem/utils";
@@ -22,7 +22,7 @@ type ChartRange = (typeof CHART_RANGES)[number];
22
22
  /**
23
23
  * Every metric a pool opportunity can chart.
24
24
  **/
25
- declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "borrowApy", "dieselRate", "supplied", "borrowed", "availableLiquidity"];
25
+ declare const POOL_OPPORTUNITY_CHART_METRICS: readonly ["depositApy", "depositApyAvg7d", "dieselRate", "supplied", "borrowed"];
26
26
  /**
27
27
  * Metric a pool opportunity can chart. Derived from the runtime list that also
28
28
  * builds the backend's route enum, so the two cannot drift.
@@ -34,7 +34,7 @@ type PoolOpportunityChartMetric = (typeof POOL_OPPORTUNITY_CHART_METRICS)[number
34
34
  * `collateralPrice` is the collateral/underlying series a liquidation-price
35
35
  * chart draws; the two USD series are the same prices quoted in dollars.
36
36
  **/
37
- declare const STRATEGY_OPPORTUNITY_CHART_METRICS: readonly ["netApy", "borrowApy", "collateralApy", "tvl", "collateralPrice", "collateralUsdPrice", "underlyingUsdPrice"];
37
+ declare const STRATEGY_OPPORTUNITY_CHART_METRICS: readonly ["borrowApy", "borrowApyAvg7d", "quotaRate", "liquidationThreshold", "collateralApy", "tvl", "collateralPrice", "collateralUsdPrice", "underlyingUsdPrice"];
38
38
  /**
39
39
  * Metric a strategy opportunity can chart, derived from
40
40
  * {@link STRATEGY_OPPORTUNITY_CHART_METRICS}.
@@ -44,13 +44,12 @@ type StrategyOpportunityChartMetric = (typeof STRATEGY_OPPORTUNITY_CHART_METRICS
44
44
  * Every metric a pool position can chart.
45
45
  *
46
46
  * Nothing to do with {@link POOL_OPPORTUNITY_CHART_METRICS}: an opportunity charts what the
47
- * pool did, a position charts what one wallet's deposit did in it. `mwr` and
48
- * `twr` are cumulative returns since the position opened — money-weighted, so
49
- * sensitive to when deposits and withdrawals landed, and time-weighted, which
50
- * strips that timing out. Both are anchored at inception, so a narrow `range`
51
- * only zooms the visible slice and its first point is rarely zero.
47
+ * pool did, a position charts what one wallet's deposit did in it. `mwr` is the
48
+ * money-weighted return since the position opened, so it is sensitive to when
49
+ * deposits and withdrawals landed. It is anchored at inception, so a narrow
50
+ * `range` only zooms the visible slice and its first point is rarely zero.
52
51
  **/
53
- declare const POOL_POSITION_CHART_METRICS: readonly ["value", "apy", "pnl", "mwr", "twr", "underlyingPrice"];
52
+ declare const POOL_POSITION_CHART_METRICS: readonly ["apy", "pnl", "mwr"];
54
53
  /**
55
54
  * Metric a pool position can chart, derived from
56
55
  * {@link POOL_POSITION_CHART_METRICS}.
@@ -59,12 +58,11 @@ type PoolPositionChartMetric = (typeof POOL_POSITION_CHART_METRICS)[number];
59
58
  /**
60
59
  * Every metric a strategy position can chart.
61
60
  *
62
- * `twrApy` annualizes `twr` over the position's whole life; the two trailing
63
- * APYs annualize it over a fixed window instead, so they track the current pace
64
- * rather than the lifetime rate and are comparable across positions of
65
- * different ages.
61
+ * `netApy7d` is the trailing seven-day net yield, so it tracks the position's
62
+ * recent pace rather than its lifetime return and is comparable across
63
+ * positions of different ages.
66
64
  **/
67
- declare const STRATEGY_POSITION_CHART_METRICS: readonly ["totalValueUsd", "totalValueUnderlying", "debt", "healthFactor", "leverage", "borrowApy", "underlyingPrice", "pnl", "mwr", "twr", "twrApy", "trailingApy7d", "trailingApy30d"];
65
+ declare const STRATEGY_POSITION_CHART_METRICS: readonly ["totalValueUnderlying", "debt", "healthFactor", "borrowApy", "borrowApyAvg7d", "pnl", "mwr", "netApy7d"];
68
66
  /**
69
67
  * Metric a strategy position can chart, derived from
70
68
  * {@link STRATEGY_POSITION_CHART_METRICS}.
@@ -161,31 +159,26 @@ type ChartUnit =
161
159
  **/
162
160
  declare const CHART_METRIC_UNITS: {
163
161
  readonly depositApy: "bps";
162
+ readonly depositApyAvg7d: "bps";
164
163
  readonly borrowApy: "bps";
165
- readonly netApy: "bps";
164
+ readonly borrowApyAvg7d: "bps";
165
+ readonly quotaRate: "bps";
166
+ readonly liquidationThreshold: "bps";
166
167
  readonly collateralApy: "bps";
167
168
  readonly supplied: "token";
168
169
  readonly borrowed: "token";
169
- readonly availableLiquidity: "token";
170
170
  readonly tvl: "token";
171
171
  readonly dieselRate: "ratio";
172
172
  readonly collateralPrice: "ratio";
173
173
  readonly collateralUsdPrice: "usd";
174
174
  readonly underlyingUsdPrice: "usd";
175
- readonly value: "token";
176
175
  readonly apy: "bps";
177
176
  readonly pnl: "token";
178
177
  readonly mwr: "bps";
179
- readonly twr: "bps";
180
- readonly underlyingPrice: "usd";
181
- readonly totalValueUsd: "usd";
182
178
  readonly totalValueUnderlying: "token";
183
179
  readonly debt: "token";
184
180
  readonly healthFactor: "bps";
185
- readonly leverage: "scalar";
186
- readonly twrApy: "bps";
187
- readonly trailingApy7d: "bps";
188
- readonly trailingApy30d: "bps";
181
+ readonly netApy7d: "bps";
189
182
  };
190
183
  /**
191
184
  * A unit together with what it is denominated in.
@@ -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
- netApy: "netApy";
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
- netApy: "netApy";
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
- netApy: "netApy";
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
- netApy: "netApy";
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
@@ -494,6 +498,20 @@ interface QuotaAsset {
494
498
  * Amount currently quoted, denominated in the market's underlying.
495
499
  **/
496
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;
497
515
  }
498
516
  /**
499
517
  * A price feed and the feeds it is composed of.
@@ -560,10 +578,6 @@ interface PoolOpportunityDetail extends PoolOpportunity {
560
578
  * Interest rate curve of the pool.
561
579
  **/
562
580
  rateCurve: RateCurve;
563
- /**
564
- * Quota configuration of every collateral token of the market.
565
- **/
566
- quotaAssets: QuotaAsset[];
567
581
  }
568
582
  /**
569
583
  * A strategy opportunity plus the data only its detail screen needs.
@@ -143,6 +143,33 @@ declare const opportunityBaseSchema: z.ZodObject<{
143
143
  rwa: z.ZodBoolean;
144
144
  sunset: z.ZodBoolean;
145
145
  }, z.core.$strip>;
146
+ /**
147
+ * {@link QuotaAsset}
148
+ **/
149
+ declare const quotaAssetSchema: z.ZodObject<{
150
+ token: z.ZodObject<{
151
+ chainId: z.ZodNumber;
152
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
153
+ symbol: z.ZodString;
154
+ name: z.ZodString;
155
+ decimals: z.ZodNumber;
156
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
157
+ }, z.core.$strip>;
158
+ quotaRate: z.ZodNumber;
159
+ limit: z.ZodObject<{
160
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
161
+ valueUsd: z.ZodNullable<z.ZodNumber>;
162
+ }, z.core.$strip>;
163
+ used: z.ZodObject<{
164
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
165
+ valueUsd: z.ZodNullable<z.ZodNumber>;
166
+ }, z.core.$strip>;
167
+ allocationShare: z.ZodNumber;
168
+ allocatedDebt: z.ZodObject<{
169
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
170
+ valueUsd: z.ZodNullable<z.ZodNumber>;
171
+ }, z.core.$strip>;
172
+ }, z.core.$strip>;
146
173
  /**
147
174
  * {@link PoolOpportunity}
148
175
  **/
@@ -251,6 +278,30 @@ declare const poolOpportunitySchema: z.ZodObject<{
251
278
  }, z.core.$strip>>;
252
279
  }, z.core.$strip>], "kind">>>;
253
280
  }, z.core.$strip>>;
281
+ quotaAssets: z.ZodArray<z.ZodObject<{
282
+ token: z.ZodObject<{
283
+ chainId: z.ZodNumber;
284
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
285
+ symbol: z.ZodString;
286
+ name: z.ZodString;
287
+ decimals: z.ZodNumber;
288
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
289
+ }, z.core.$strip>;
290
+ quotaRate: z.ZodNumber;
291
+ limit: z.ZodObject<{
292
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
293
+ valueUsd: z.ZodNullable<z.ZodNumber>;
294
+ }, z.core.$strip>;
295
+ used: z.ZodObject<{
296
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
297
+ valueUsd: z.ZodNullable<z.ZodNumber>;
298
+ }, z.core.$strip>;
299
+ allocationShare: z.ZodNumber;
300
+ allocatedDebt: z.ZodObject<{
301
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
302
+ valueUsd: z.ZodNullable<z.ZodNumber>;
303
+ }, z.core.$strip>;
304
+ }, z.core.$strip>>;
254
305
  }, z.core.$strip>;
255
306
  /**
256
307
  * {@link StrategyOpportunity}
@@ -498,6 +549,30 @@ declare const opportunitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
498
549
  }, z.core.$strip>>;
499
550
  }, z.core.$strip>], "kind">>>;
500
551
  }, z.core.$strip>>;
552
+ quotaAssets: z.ZodArray<z.ZodObject<{
553
+ token: z.ZodObject<{
554
+ chainId: z.ZodNumber;
555
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
556
+ symbol: z.ZodString;
557
+ name: z.ZodString;
558
+ decimals: z.ZodNumber;
559
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
560
+ }, z.core.$strip>;
561
+ quotaRate: z.ZodNumber;
562
+ limit: z.ZodObject<{
563
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
564
+ valueUsd: z.ZodNullable<z.ZodNumber>;
565
+ }, z.core.$strip>;
566
+ used: z.ZodObject<{
567
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
568
+ valueUsd: z.ZodNullable<z.ZodNumber>;
569
+ }, z.core.$strip>;
570
+ allocationShare: z.ZodNumber;
571
+ allocatedDebt: z.ZodObject<{
572
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
573
+ valueUsd: z.ZodNullable<z.ZodNumber>;
574
+ }, z.core.$strip>;
575
+ }, z.core.$strip>>;
501
576
  }, z.core.$strip>, z.ZodObject<{
502
577
  chainId: z.ZodNumber;
503
578
  name: z.ZodString;
@@ -711,28 +786,6 @@ declare const rateCurveSchema: z.ZodObject<{
711
786
  }, z.core.$strip>>;
712
787
  borrowingLimitUtilization: z.ZodNullable<z.ZodNumber>;
713
788
  }, z.core.$strip>;
714
- /**
715
- * {@link QuotaAsset}
716
- **/
717
- declare const quotaAssetSchema: z.ZodObject<{
718
- token: z.ZodObject<{
719
- chainId: z.ZodNumber;
720
- address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
721
- symbol: z.ZodString;
722
- name: z.ZodString;
723
- decimals: z.ZodNumber;
724
- assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
725
- }, z.core.$strip>;
726
- quotaRate: z.ZodNumber;
727
- limit: z.ZodObject<{
728
- value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
729
- valueUsd: z.ZodNullable<z.ZodNumber>;
730
- }, z.core.$strip>;
731
- used: z.ZodObject<{
732
- value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
733
- valueUsd: z.ZodNullable<z.ZodNumber>;
734
- }, z.core.$strip>;
735
- }, z.core.$strip>;
736
789
  /**
737
790
  * {@link PriceFeedData}. Recursive: a composite feed lists the feeds it reads.
738
791
  **/
@@ -870,14 +923,6 @@ declare const poolOpportunityDetailSchema: z.ZodObject<{
870
923
  }, z.core.$strip>>;
871
924
  }, z.core.$strip>], "kind">>>;
872
925
  }, z.core.$strip>>;
873
- rateCurve: z.ZodObject<{
874
- points: z.ZodArray<z.ZodObject<{
875
- utilization: z.ZodNumber;
876
- supplyApy: z.ZodNumber;
877
- borrowApy: z.ZodNumber;
878
- }, z.core.$strip>>;
879
- borrowingLimitUtilization: z.ZodNullable<z.ZodNumber>;
880
- }, z.core.$strip>;
881
926
  quotaAssets: z.ZodArray<z.ZodObject<{
882
927
  token: z.ZodObject<{
883
928
  chainId: z.ZodNumber;
@@ -896,7 +941,20 @@ declare const poolOpportunityDetailSchema: z.ZodObject<{
896
941
  value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
897
942
  valueUsd: z.ZodNullable<z.ZodNumber>;
898
943
  }, z.core.$strip>;
944
+ allocationShare: z.ZodNumber;
945
+ allocatedDebt: z.ZodObject<{
946
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
947
+ valueUsd: z.ZodNullable<z.ZodNumber>;
948
+ }, z.core.$strip>;
899
949
  }, z.core.$strip>>;
950
+ rateCurve: z.ZodObject<{
951
+ points: z.ZodArray<z.ZodObject<{
952
+ utilization: z.ZodNumber;
953
+ supplyApy: z.ZodNumber;
954
+ borrowApy: z.ZodNumber;
955
+ }, z.core.$strip>>;
956
+ borrowingLimitUtilization: z.ZodNullable<z.ZodNumber>;
957
+ }, z.core.$strip>;
900
958
  }, z.core.$strip>;
901
959
  /**
902
960
  * {@link StrategyOpportunityDetail}
@@ -1169,14 +1227,6 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1169
1227
  }, z.core.$strip>>;
1170
1228
  }, z.core.$strip>], "kind">>>;
1171
1229
  }, z.core.$strip>>;
1172
- rateCurve: z.ZodObject<{
1173
- points: z.ZodArray<z.ZodObject<{
1174
- utilization: z.ZodNumber;
1175
- supplyApy: z.ZodNumber;
1176
- borrowApy: z.ZodNumber;
1177
- }, z.core.$strip>>;
1178
- borrowingLimitUtilization: z.ZodNullable<z.ZodNumber>;
1179
- }, z.core.$strip>;
1180
1230
  quotaAssets: z.ZodArray<z.ZodObject<{
1181
1231
  token: z.ZodObject<{
1182
1232
  chainId: z.ZodNumber;
@@ -1195,7 +1245,20 @@ declare const opportunityDetailSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1195
1245
  value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
1196
1246
  valueUsd: z.ZodNullable<z.ZodNumber>;
1197
1247
  }, z.core.$strip>;
1248
+ allocationShare: z.ZodNumber;
1249
+ allocatedDebt: z.ZodObject<{
1250
+ value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
1251
+ valueUsd: z.ZodNullable<z.ZodNumber>;
1252
+ }, z.core.$strip>;
1198
1253
  }, z.core.$strip>>;
1254
+ rateCurve: z.ZodObject<{
1255
+ points: z.ZodArray<z.ZodObject<{
1256
+ utilization: z.ZodNumber;
1257
+ supplyApy: z.ZodNumber;
1258
+ borrowApy: z.ZodNumber;
1259
+ }, z.core.$strip>>;
1260
+ borrowingLimitUtilization: z.ZodNullable<z.ZodNumber>;
1261
+ }, z.core.$strip>;
1199
1262
  }, z.core.$strip>, z.ZodObject<{
1200
1263
  chainId: z.ZodNumber;
1201
1264
  name: z.ZodString;
@@ -128,6 +128,10 @@ interface Token {
128
128
  /**
129
129
  * Ticker symbol.
130
130
  *
131
+ * Display ticker, not necessarily the on-chain ERC-20 `symbol()`. The SDK
132
+ * may rewrite it (curated pretty names, `"source -> target"` for redemption
133
+ * phantom tokens).
134
+ *
131
135
  * @example `"USDC"`
132
136
  **/
133
137
  symbol: string;
@@ -60,7 +60,7 @@ interface OpportunitiesBase {
60
60
  interface OpportunitiesOffchainOnly {
61
61
  /**
62
62
  * Historical charts of one opportunity, one series per metric on a shared
63
- * axis: `charts(key, ["depositApy", "borrowApy"], "1m")`.
63
+ * axis: `charts(key, ["depositApy", "depositApyAvg7d"], "1m")`.
64
64
  *
65
65
  * The key's kind decides which metrics exist, so asking a pool for a strategy
66
66
  * chart does not compile, and the bundle is keyed by exactly the metrics
@@ -50,7 +50,7 @@ interface PositionsBase {
50
50
  interface PositionsOffchainOnly {
51
51
  /**
52
52
  * Historical charts of one position, one series per metric on a shared axis:
53
- * `charts(key, ["value", "apy"], "1m")`.
53
+ * `charts(key, ["apy", "mwr"], "1m")`.
54
54
  *
55
55
  * The key's kind decides which metrics exist, so asking a pool position for a
56
56
  * strategy chart does not compile. Liquidation positions have no charts: a
@@ -20,6 +20,24 @@ interface FormatBNOptions {
20
20
  **/
21
21
  symbol?: boolean;
22
22
  }
23
+ /**
24
+ * Source, target, and phantom token of a delayed redemption, used to rewrite
25
+ * the phantom's display symbol as `"source -> target"`.
26
+ **/
27
+ interface RedemptionPhantomRename {
28
+ /**
29
+ * Redemption phantom token whose symbol is rewritten.
30
+ **/
31
+ phantom: Address;
32
+ /**
33
+ * Token being redeemed (e.g. mGLOBAL, ACRED).
34
+ **/
35
+ source: Address;
36
+ /**
37
+ * Token received when the redemption is claimed (e.g. USDC).
38
+ **/
39
+ target: Address;
40
+ }
23
41
  /**
24
42
  * Serializable snapshot of the token metadata registry.
25
43
  **/
@@ -51,7 +69,11 @@ declare class TokensMeta extends AddressMap<TokenMetaData> {
51
69
  reset(): void;
52
70
  upsert(address: string, value: TokenMetaData | undefined): void;
53
71
  /**
54
- * Returns the symbol string for a token.
72
+ * Returns the display symbol for a token.
73
+ *
74
+ * This is not always the on-chain ERC-20 `symbol()`: curated pretty names
75
+ * and redemption phantom tokens (`"source -> target"`) replace it.
76
+ *
55
77
  * @param token - Token address.
56
78
  * @throws If the token is not in the registry.
57
79
  */
@@ -109,6 +131,13 @@ declare class TokensMeta extends AddressMap<TokenMetaData> {
109
131
  * @param token - Token address, wrapper or not.
110
132
  */
111
133
  unwrapRWA(token: Address): Address;
134
+ /**
135
+ * Rewrites display symbols of redemption phantom tokens to
136
+ * `"${source} -> ${target}"`.
137
+ *
138
+ * @param renames - Phantom / source / target address triples.
139
+ **/
140
+ renameRedemptionPhantoms(renames: RedemptionPhantomRename[]): void;
112
141
  /**
113
142
  * Formats a raw token amount into a human-readable decimal string,
114
143
  * dividing by `10^decimals` for the token.
@@ -174,4 +203,4 @@ declare class TokensMeta extends AddressMap<TokenMetaData> {
174
203
  hydrate(state: TokensMetaState): void;
175
204
  }
176
205
  //#endregion
177
- export { FormatBNOptions, TokensMeta, TokensMetaState };
206
+ export { FormatBNOptions, RedemptionPhantomRename, TokensMeta, TokensMetaState };