@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.
Files changed (147) hide show
  1. package/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
  2. package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
  3. package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
  4. package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
  5. package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +21 -11
  6. package/dist/cjs/model/charts.js +147 -0
  7. package/dist/cjs/model/charts.schema.js +240 -0
  8. package/dist/cjs/model/index.js +28 -22
  9. package/dist/cjs/model/liquidations.schema.js +1 -1
  10. package/dist/cjs/model/opportunities.schema.js +1 -1
  11. package/dist/cjs/model/positions.schema.js +15 -2
  12. package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +2 -6
  13. package/dist/cjs/new-sdk/positions/PositionsNamespace.js +2 -6
  14. package/dist/cjs/new-sdk/utils/index.js +0 -1
  15. package/dist/cjs/offchain/AbstractOffchainNamespace.js +10 -7
  16. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +4 -8
  17. package/dist/cjs/offchain/positions/OffchainPositions.js +8 -11
  18. package/dist/cjs/preview/preview/CreditAccountState.js +14 -1
  19. package/dist/cjs/preview/preview/buildDelayedPreview.js +16 -6
  20. package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +9 -2
  21. package/dist/cjs/preview/preview/previewOpenCreditAccount.js +11 -3
  22. package/dist/cjs/preview/preview/previewOperation.js +1 -1
  23. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +0 -6
  24. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
  25. package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +31 -4
  26. package/dist/cjs/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +18 -0
  27. package/dist/cjs/sdk/accounts/intents/utils/index.js +2 -0
  28. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +0 -3
  29. package/dist/cjs/sdk/index.js +12 -0
  30. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
  31. package/dist/cjs/sdk/positions/PositionsService.js +206 -1
  32. package/dist/cjs/sdk/positions/calcBorrowRate.js +43 -0
  33. package/dist/cjs/sdk/positions/calcHealthFactor.js +44 -0
  34. package/dist/cjs/sdk/positions/calcLiquidationPrice.js +23 -0
  35. package/dist/cjs/sdk/positions/calcLiquidationPriceForTarget.js +30 -0
  36. package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +18 -0
  37. package/dist/cjs/sdk/positions/index.js +12 -1
  38. package/dist/cjs/sdk/positions/types.js +31 -0
  39. package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
  40. package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
  41. package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
  42. package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
  43. package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +21 -11
  44. package/dist/esm/dev/AccountOpener.js +1 -1
  45. package/dist/esm/dev/withdrawalUtils.js +1 -1
  46. package/dist/esm/model/charts.js +140 -0
  47. package/dist/esm/model/charts.schema.js +226 -0
  48. package/dist/esm/model/index.js +7 -7
  49. package/dist/esm/model/liquidations.schema.js +1 -1
  50. package/dist/esm/model/opportunities.schema.js +1 -1
  51. package/dist/esm/model/positions.schema.js +16 -4
  52. package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +2 -6
  53. package/dist/esm/new-sdk/positions/PositionsNamespace.js +2 -6
  54. package/dist/esm/new-sdk/utils/index.js +0 -1
  55. package/dist/esm/offchain/AbstractOffchainNamespace.js +10 -7
  56. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +4 -8
  57. package/dist/esm/offchain/positions/OffchainPositions.js +8 -11
  58. package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
  59. package/dist/esm/preview/preview/CreditAccountState.js +14 -1
  60. package/dist/esm/preview/preview/buildDelayedPreview.js +16 -6
  61. package/dist/esm/preview/preview/previewAdjustCreditAccount.js +9 -2
  62. package/dist/esm/preview/preview/previewOpenCreditAccount.js +11 -3
  63. package/dist/esm/preview/preview/previewOperation.js +1 -1
  64. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  65. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  66. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -8
  67. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
  68. package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +31 -4
  69. package/dist/esm/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +17 -0
  70. package/dist/esm/sdk/accounts/intents/utils/index.js +2 -1
  71. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -4
  72. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  73. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  74. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  75. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  76. package/dist/esm/sdk/base/TokensMeta.js +3 -3
  77. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  78. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  79. package/dist/esm/sdk/index.js +7 -1
  80. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  81. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
  82. package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
  83. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  84. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  85. package/dist/esm/sdk/pools/PoolService.js +1 -1
  86. package/dist/esm/sdk/positions/PositionsService.js +206 -1
  87. package/dist/esm/sdk/positions/calcBorrowRate.js +42 -0
  88. package/dist/esm/sdk/positions/calcHealthFactor.js +43 -0
  89. package/dist/esm/sdk/positions/calcLiquidationPrice.js +22 -0
  90. package/dist/esm/sdk/positions/calcLiquidationPriceForTarget.js +29 -0
  91. package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +17 -0
  92. package/dist/esm/sdk/positions/index.js +7 -2
  93. package/dist/esm/sdk/positions/types.js +31 -1
  94. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  95. package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +2 -0
  96. package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +3 -0
  97. package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +2 -0
  98. package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +3 -0
  99. package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +3 -0
  100. package/dist/types/model/charts.d.ts +349 -0
  101. package/dist/types/model/charts.schema.d.ts +364 -0
  102. package/dist/types/model/index.d.ts +6 -6
  103. package/dist/types/model/positions.d.ts +85 -2
  104. package/dist/types/model/positions.schema.d.ts +26 -1
  105. package/dist/types/new-sdk/index.d.ts +1 -2
  106. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +4 -5
  107. package/dist/types/new-sdk/opportunities/types.d.ts +9 -7
  108. package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +4 -5
  109. package/dist/types/new-sdk/positions/types.d.ts +9 -9
  110. package/dist/types/new-sdk/utils/index.d.ts +1 -2
  111. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +5 -21
  112. package/dist/types/offchain/index.d.ts +2 -2
  113. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +8 -4
  114. package/dist/types/offchain/positions/OffchainPositions.d.ts +11 -5
  115. package/dist/types/preview/preview/CreditAccountState.d.ts +6 -0
  116. package/dist/types/preview/preview/buildDelayedPreview.d.ts +5 -1
  117. package/dist/types/preview/preview/types.d.ts +4 -2
  118. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -7
  119. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +3 -12
  120. package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +2 -2
  121. package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +1 -19
  122. package/dist/types/sdk/accounts/index.d.ts +2 -2
  123. package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +6 -0
  124. package/dist/types/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts +13 -0
  125. package/dist/types/sdk/accounts/intents/utils/index.d.ts +2 -1
  126. package/dist/types/sdk/accounts/types.d.ts +1 -12
  127. package/dist/types/sdk/index.d.ts +8 -3
  128. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +4 -0
  129. package/dist/types/sdk/market/oracle/types.d.ts +8 -0
  130. package/dist/types/sdk/positions/PositionsService.d.ts +31 -2
  131. package/dist/types/sdk/positions/calcBorrowRate.d.ts +40 -0
  132. package/dist/types/sdk/positions/calcHealthFactor.d.ts +45 -0
  133. package/dist/types/sdk/positions/calcLiquidationPrice.d.ts +12 -0
  134. package/dist/types/sdk/positions/calcLiquidationPriceForTarget.d.ts +43 -0
  135. package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +15 -0
  136. package/dist/types/sdk/positions/index.d.ts +7 -2
  137. package/dist/types/sdk/positions/types.d.ts +58 -1
  138. package/package.json +1 -1
  139. package/dist/cjs/model/history.js +0 -53
  140. package/dist/cjs/model/history.schema.js +0 -128
  141. package/dist/cjs/new-sdk/utils/history.js +0 -1
  142. package/dist/esm/model/history.js +0 -49
  143. package/dist/esm/model/history.schema.js +0 -116
  144. package/dist/esm/new-sdk/utils/history.js +0 -1
  145. package/dist/types/model/history.d.ts +0 -153
  146. package/dist/types/model/history.schema.d.ts +0 -95
  147. package/dist/types/new-sdk/utils/history.d.ts +0 -18
@@ -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.history}
35
+ * {@inheritDoc PositionsOffchainOnly.charts}
37
36
  **/
38
- history(key: PoolPositionRef): HistoryReader<PoolPositionHistoryMetric>;
39
- history(key: StrategyPositionRef): HistoryReader<StrategyPositionHistoryMetric>;
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 metric and one range at a time:
54
- * `history(key).chart("netApy", "1m")`. The key's kind decides which metrics
55
- * exist, so asking a pool position for a strategy series does not compile.
56
- * Liquidation positions have no charts: a delayed withdrawal is a single
57
- * event rather than a series.
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
- history(key: PoolPositionRef): HistoryReader<PoolPositionHistoryMetric>;
60
- history(key: StrategyPositionRef): HistoryReader<StrategyPositionHistoryMetric>;
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, HistoryReader, type ListMerger, type MergeListResult, filterResponse, mergeChainList, mergeChainOne };
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 one historical series. A response carrying a metric other than the
75
- * requested one fails validation.
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 readHistory<M extends HistoryMetric>(request: OffchainHistoryRequest<M>): Promise<DataResponse<HistorySeries<M>>>;
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, OffchainHistoryRequest, OffchainQuery };
64
+ export { AbstractOffchainNamespace, OffchainGetRequest, OffchainQuery };
@@ -1,5 +1,5 @@
1
1
  import { GearboxAPIOptions } from "./types.js";
2
- import { AbstractOffchainNamespace, OffchainGetRequest, OffchainHistoryRequest, OffchainQuery } from "./AbstractOffchainNamespace.js";
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, OffchainHistoryRequest, OffchainInvalidJsonError, OffchainNotConfiguredError, OffchainNotImplementedError, OffchainOpportunities, OffchainPositions, OffchainQuery, OffchainRequestFailedError, OffchainStatusError, OffchainTransportError, OffchainTransportErrorParams, OffchainValidationError, backendMessage, errorCause, readResponseBody };
19
+ export { AbstractOffchainNamespace, ErrorCause, GearboxAPI, GearboxAPIOptions, OffchainGetRequest, OffchainInvalidJsonError, OffchainNotConfiguredError, OffchainNotImplementedError, OffchainOpportunities, OffchainPositions, OffchainQuery, OffchainRequestFailedError, OffchainStatusError, OffchainTransportError, OffchainTransportErrorParams, OffchainValidationError, backendMessage, errorCause, readResponseBody };
@@ -1,9 +1,13 @@
1
- import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
2
- import { HistoryMetric, HistorySeries, OpportunityHistoryQuery } from "../../model/history.js";
1
+ import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
2
+ import { Opportunity, OpportunityFilter, OpportunityKey, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import { GearboxAPIOptions } from "../types.js";
5
5
  import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
6
6
  //#region src/offchain/opportunities/OffchainOpportunities.d.ts
7
+ type OpportunityChartMetricFor<K extends OpportunityKey> = {
8
+ pool: PoolOpportunityChartMetric;
9
+ strategy: StrategyOpportunityChartMetric;
10
+ }[K["kind"]];
7
11
  /**
8
12
  * Backend counterpart of the `opportunities` namespace.
9
13
  **/
@@ -24,9 +28,9 @@ declare class OffchainOpportunities extends AbstractOffchainNamespace {
24
28
  **/
25
29
  getStrategy(key: StrategyOpportunityKey): Promise<DataResponse<StrategyOpportunityDetail>>;
26
30
  /**
27
- * One historical series of one opportunity
31
+ * Charts of one opportunity: one series per metric, on a shared grid.
28
32
  **/
29
- getHistory<M extends HistoryMetric>(query: OpportunityHistoryQuery<M>): Promise<DataResponse<HistorySeries<M>>>;
33
+ getCharts<K extends OpportunityKey, const Metrics extends readonly OpportunityChartMetricFor<K>[]>(key: K, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
30
34
  }
31
35
  //#endregion
32
36
  export { OffchainOpportunities };
@@ -1,10 +1,14 @@
1
- import { Position } from "../../model/positions.js";
2
- import { HistorySeries, PositionHistoryMetric, PositionHistoryQuery } from "../../model/history.js";
1
+ import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
2
+ import { Position, PositionKey } from "../../model/positions.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import { ListPositionsPropsBase } from "../../sdk/positions/types.js";
5
5
  import { GearboxAPIOptions } from "../types.js";
6
6
  import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
7
7
  //#region src/offchain/positions/OffchainPositions.d.ts
8
+ type PositionChartMetricFor<K extends PositionKey> = {
9
+ pool: PoolPositionChartMetric;
10
+ strategy: StrategyPositionChartMetric;
11
+ }[K["kind"]];
8
12
  /**
9
13
  * Backend counterpart of the `positions` namespace.
10
14
  **/
@@ -16,11 +20,13 @@ declare class OffchainPositions extends AbstractOffchainNamespace {
16
20
  **/
17
21
  list(props: ListPositionsPropsBase): Promise<DataResponse<Position[]>>;
18
22
  /**
19
- * One historical series of one position.
23
+ * Charts of one position: one series per metric, on a shared grid.
20
24
  *
21
- * @returns An empty series until the backend client is implemented.
25
+ * @throws {OffchainNotImplementedError} Until the backend serves it. An empty
26
+ * bundle would be the one answer this model exists to rule out: a chart that
27
+ * could not be read is not a chart with no points.
22
28
  **/
23
- getHistory<M extends PositionHistoryMetric>(query: PositionHistoryQuery<M>): Promise<DataResponse<HistorySeries<M>>>;
29
+ getCharts<K extends PositionKey, const Metrics extends readonly PositionChartMetricFor<K>[]>(key: K, _metrics: Metrics, _range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
24
30
  }
25
31
  //#endregion
26
32
  export { OffchainPositions };
@@ -1,5 +1,6 @@
1
1
  import { CreditAccountData } from "../../sdk/base/types.js";
2
2
  import { AssetsMap } from "../../sdk/utils/AssetsMap.js";
3
+ import { AccountSnapshot } from "../../sdk/positions/types.js";
3
4
  import "../../sdk/index.js";
4
5
  import { Address } from "viem";
5
6
  //#region src/preview/preview/CreditAccountState.d.ts
@@ -60,6 +61,11 @@ declare class CreditAccountState {
60
61
  * balances and quotas (≤ 1 wei) filtered out.
61
62
  */
62
63
  static fromCreditAccountData(ca: CreditAccountData): CreditAccountState;
64
+ /**
65
+ * Immutable snapshot of this projected state for `sdk.positions` metric
66
+ * methods: dust-filtered balances, all quotas, and {@link totalDebt}.
67
+ **/
68
+ toSnapshot(totalValue: bigint): AccountSnapshot;
63
69
  clone(): CreditAccountState;
64
70
  /**
65
71
  * Borrows `amount` of underlying: debt, total debt and the underlying
@@ -1,3 +1,5 @@
1
+ import { OnchainSDK } from "../../sdk/OnchainSDK.js";
2
+ import "../../sdk/index.js";
1
3
  import { CreditAccountState } from "./CreditAccountState.js";
2
4
  import { DetectedDelayedOperation } from "./detectDelayedOperation.js";
3
5
  import { InstantOperationPreview } from "./types.js";
@@ -26,7 +28,9 @@ type ConvertFn = (token: Address, to: Address, amount: bigint) => bigint;
26
28
  * @param receivedToken - Token the `CLOSE_ACCOUNT` resume withdraws to the
27
29
  * user: the unwrapped underlying (vault asset) for RWA markets, the
28
30
  * underlying itself otherwise.
31
+ * @param sdk - Market data source for the position metrics of the resulting
32
+ * state; read synchronously, no network access.
29
33
  */
30
- declare function buildDelayedPreview(afterInstant: CreditAccountState, before: CreditAccountState, detected: DetectedDelayedOperation, convert: ConvertFn, receivedToken: Address): InstantOperationPreview;
34
+ declare function buildDelayedPreview(afterInstant: CreditAccountState, before: CreditAccountState, detected: DetectedDelayedOperation, convert: ConvertFn, receivedToken: Address, sdk: OnchainSDK): InstantOperationPreview;
31
35
  //#endregion
32
36
  export { ConvertFn, buildDelayedPreview };
@@ -1,5 +1,7 @@
1
1
  import { DelayedIntent } from "../../sdk/accounts/withdrawal-compressor/types.js";
2
2
  import { Asset } from "../../sdk/base/types.js";
3
+ import { PositionMetrics } from "../../model/positions.js";
4
+ import "../../model/index.js";
3
5
  import "../../sdk/index.js";
4
6
  import { PoolOperationType } from "../parse/types-pools.js";
5
7
  import "../parse/index.js";
@@ -89,7 +91,7 @@ interface PoolOperationPreview {
89
91
  */
90
92
  error?: OperationPreviewError;
91
93
  }
92
- interface OpenCreditAccountPreview {
94
+ interface OpenCreditAccountPreview extends PositionMetrics {
93
95
  operation: "OpenCreditAccount" | "RWAOpenCreditAccount";
94
96
  /**
95
97
  * Credit manager the account is opened in
@@ -132,7 +134,7 @@ interface OpenCreditAccountPreview {
132
134
  */
133
135
  error?: OperationPreviewError;
134
136
  }
135
- interface AdjustCreditAccountPreview {
137
+ interface AdjustCreditAccountPreview extends PositionMetrics {
136
138
  operation: "AdjustCreditAccount";
137
139
  /**
138
140
  * Credit manager the account is opened in
@@ -1,7 +1,5 @@
1
1
  import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
2
2
  import { Asset, CreditAccountData, CreditAccountTokensSlice, PermitResult } from "../base/types.js";
3
- import { StrategyPosition } from "../../model/positions.js";
4
- import "../../model/index.js";
5
3
  import { GetOpenAccountRequirementsProps, RWAOpenAccountRequirements } from "../market/rwa/types.js";
6
4
  import "../market/rwa/index.js";
7
5
  import { PriceUpdate } from "../market/pricefeeds/types.js";
@@ -14,7 +12,7 @@ import { OnchainSDK } from "../OnchainSDK.js";
14
12
  import "../types/index.js";
15
13
  import { SDKConstruct } from "../base/SDKConstruct.js";
16
14
  import "../base/index.js";
17
- import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
15
+ import { GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
18
16
  import "./credit-account-compressor/index.js";
19
17
  import "./withdrawal-compressor/index.js";
20
18
  import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
@@ -50,10 +48,6 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
50
48
  * {@inheritDoc ICreditAccountsService.getBorrowerCreditAccounts}
51
49
  **/
52
50
  getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
53
- /**
54
- * {@inheritDoc ICreditAccountsService.listPositions}
55
- **/
56
- listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
57
51
  /**
58
52
  * {@inheritDoc ICreditAccountsService.getRewards}
59
53
  **/
@@ -1,18 +1,15 @@
1
1
  import { CreditAccountData } from "../../base/types.js";
2
- import { StrategyPosition } from "../../../model/positions.js";
3
- import "../../../model/index.js";
4
2
  import { SDKConstruct } from "../../base/SDKConstruct.js";
5
3
  import "../../base/index.js";
6
- import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./types.js";
4
+ import { GetCreditAccountsOptions } from "./types.js";
7
5
  import { Address } from "viem";
8
6
  //#region src/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts
9
7
  /**
10
8
  * Reads credit accounts of the current chain.
11
9
  *
12
10
  * Stitches the credit account compressor together with the RWA factories (for
13
- * accounts owned via an investor EOA) and with the withdrawal compressor (for
14
- * assets that are on their way out of an account), and describes the result
15
- * either as raw account data or as {@link StrategyPosition}s.
11
+ * accounts owned via an investor EOA), and describes the result as raw
12
+ * account data.
16
13
  *
17
14
  * TODO: create and deploy new compressor contract onchain to avoid all this stitching
18
15
  **/
@@ -49,12 +46,6 @@ declare class CreditAccountCompressor extends SDKConstruct {
49
46
  * @param blockNumber - Block to read at, defaults to the latest block.
50
47
  **/
51
48
  getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<CreditAccountData<true>[]>;
52
- /**
53
- * Describes all credit accounts of a wallet as strategy positions.
54
- *
55
- * @param props - {@link ListStrategyPositionsProps}
56
- **/
57
- listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
58
49
  }
59
50
  //#endregion
60
51
  export { CreditAccountCompressor };
@@ -1,4 +1,4 @@
1
- import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps } from "./types.js";
1
+ import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./types.js";
2
2
  import { CreditAccountCompressor } from "./CreditAccountCompressor.js";
3
3
  import { CreditAccountCompressorV310Contract } from "./CreditAccountCompressorV310Contract.js";
4
- export { CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps };
4
+ export { CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions };
@@ -146,23 +146,5 @@ interface GetCreditAccountsOptions {
146
146
  **/
147
147
  ignoreReservePrices?: boolean;
148
148
  }
149
- /**
150
- * Props for {@link CreditAccountCompressor.listPositions}.
151
- **/
152
- interface ListStrategyPositionsProps {
153
- /**
154
- * Wallet whose credit accounts to describe. RWA accounts are resolved from
155
- * the investor EOA, see {@link CreditAccountCompressor.getBorrowerCreditAccounts}.
156
- **/
157
- owner: Address;
158
- /**
159
- * Whether to include accounts that carry no debt.
160
- **/
161
- includeZeroDebt: boolean;
162
- /**
163
- * Block to read at. Defaults to the latest block.
164
- **/
165
- blockNumber?: bigint;
166
- }
167
149
  //#endregion
168
- export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps };
150
+ export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions };
@@ -1,5 +1,5 @@
1
1
  import { ClaimableWithdrawal, CurrentWithdrawals, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, GetExternalAccountCurrentWithdrawalsProps, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./withdrawal-compressor/types.js";
2
- import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
2
+ import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
3
3
  import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
4
4
  import { CreditAccountCompressorV310Contract } from "./credit-account-compressor/CreditAccountCompressorV310Contract.js";
5
5
  import "./credit-account-compressor/index.js";
@@ -28,4 +28,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
28
28
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
29
29
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
30
30
  import "./liquidations/index.js";
31
- export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, ListStrategyPositionsProps, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, SetBotResult, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
31
+ export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, SetBotResult, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -62,6 +62,12 @@ interface BuildMockSdkArgs {
62
62
  quotas: Record<Address, MockQuotaEntry>;
63
63
  liquidationThresholds: Record<Address, number>;
64
64
  maxDebt: bigint;
65
+ /** Facade `minDebt`; defaults to 0n so debt-range checks stay opt-in. */
66
+ minDebt?: bigint;
67
+ /** Pool base rate in ray; feeds `calcBorrowApy` of position metrics. */
68
+ baseInterestRate?: bigint;
69
+ /** Credit manager interest fee in Bps; feeds position metrics. */
70
+ feeInterest?: number;
65
71
  creditManager: Address;
66
72
  creditFacade: Address;
67
73
  /** Market underlying token (`market.pool.underlying`). */
@@ -0,0 +1,13 @@
1
+ import { AccountSnapshot } from "../../../positions/types.js";
2
+ import "../../../positions/index.js";
3
+ import { AdjustState } from "../types.js";
4
+ import { Address } from "viem";
5
+ //#region src/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts
6
+ /**
7
+ * Maps an intents {@link AdjustState} onto the {@link AccountSnapshot} that
8
+ * position-metric functions take. `accountDebt` is treated as total debt
9
+ * (principal plus accrued interest and fees).
10
+ **/
11
+ declare function adjustStateToSnapshot(creditManager: Address, state: AdjustState): AccountSnapshot;
12
+ //#endregion
13
+ export { adjustStateToSnapshot };
@@ -1,3 +1,4 @@
1
+ import { adjustStateToSnapshot } from "./adjust-state-to-snapshot.js";
1
2
  import { assembleOperationCalls } from "./assemble-operation-calls.js";
2
3
  import { calcBorrowedAmountPlusInterestAndFees } from "./borrowed-amount-plus-interest-and-fees.js";
3
4
  import { eq, toRouterCaSlice, toTargetDecimals } from "./common.js";
@@ -6,4 +7,4 @@ import { ConvertFn, simulateOperationAssets } from "./simulate-assets.js";
6
7
  import { getQuotasForUpdate } from "./quotas-for-update.js";
7
8
  import { SimulateStateReturn, simulateState } from "./simulate-adjust-state.js";
8
9
  import { getOperationsWithQuotaUpdate } from "./with-quota-update.js";
9
- export { ConvertFn, SimulateStateReturn, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, convertAmount, eq, getOperationsWithQuotaUpdate, getQuotasForUpdate, simulateOperationAssets, simulateState, toRouterCaSlice, toTargetDecimals };
10
+ export { ConvertFn, SimulateStateReturn, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, convertAmount, eq, getOperationsWithQuotaUpdate, getQuotasForUpdate, simulateOperationAssets, simulateState, toRouterCaSlice, toTargetDecimals };
@@ -1,7 +1,5 @@
1
1
  import { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
2
2
  import { Asset, CreditAccountData, CreditAccountTokensSlice, PermitResult } from "../base/types.js";
3
- import { StrategyPosition } from "../../model/positions.js";
4
- import "../../model/index.js";
5
3
  import { GetOpenAccountRequirementsProps, RWAOpenAccountRequirements, RWAOperationArgs } from "../market/rwa/types.js";
6
4
  import "../market/rwa/index.js";
7
5
  import { PriceUpdate } from "../market/pricefeeds/types.js";
@@ -15,7 +13,7 @@ import { OnchainSDK } from "../OnchainSDK.js";
15
13
  import { Construct } from "../base/Construct.js";
16
14
  import "../types/index.js";
17
15
  import "../base/index.js";
18
- import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
16
+ import { GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
19
17
  import "./credit-account-compressor/index.js";
20
18
  import "./withdrawal-compressor/index.js";
21
19
  import { AccountBotsService } from "./bots/AccountBotsService.js";
@@ -404,15 +402,6 @@ interface ICreditAccountsService extends Construct {
404
402
  * @returns Credit accounts (with investor) sorted by health factor ascending
405
403
  */
406
404
  getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
407
- /**
408
- * Describes the open credit accounts of a wallet as the shared read model's
409
- * strategy positions.
410
- *
411
- * @param props - {@link ListStrategyPositionsProps}
412
- * @returns One row per open account. Accounts whose collateral computation
413
- * failed are excluded, because none of their amounts can be computed.
414
- */
415
- listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
416
405
  /**
417
406
  * Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards).
418
407
  * Associates rewards by adapter + stakedPhantomToken.
@@ -112,7 +112,12 @@ import { ContractMethod, IPriceUpdateTx, MultiCall, RawTx } from "./types/transa
112
112
  import { AddLiquidityProps, DepositMetadata, IPoolsService, ListPoolPositionsProps, MarketType, PoolServiceCall, PoolServiceCallResult, RemoveLiquidityProps, WithdrawalMetadata } from "./pools/types.js";
113
113
  import { PoolService } from "./pools/PoolService.js";
114
114
  import "./pools/index.js";
115
- import { ListPositionsProps, ListPositionsPropsBase } from "./positions/types.js";
115
+ import { AccountSnapshot, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, accountSnapshotFromCreditAccountData } from "./positions/types.js";
116
+ import { CalcBorrowRateProps, calcBorrowRate } from "./positions/calcBorrowRate.js";
117
+ import { CalcHealthFactorProps, calcHealthFactor } from "./positions/calcHealthFactor.js";
118
+ import { CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, calcLiquidationPriceForTarget } from "./positions/calcLiquidationPriceForTarget.js";
119
+ import { calcLiquidationPrice } from "./positions/calcLiquidationPrice.js";
120
+ import { calcTimeToLiquidationMs } from "./positions/calcTimeToLiquidationMs.js";
116
121
  import { MultichainPositionsService } from "./positions/MultichainPositionsService.js";
117
122
  import { PositionsService } from "./positions/PositionsService.js";
118
123
  import "./positions/index.js";
@@ -146,7 +151,7 @@ import { ChainBlock, ChainBlockPin, ChainBlockSource, ChainQueryOneProps, ChainQ
146
151
  import { PlaceholderContract } from "./base/PlaceholderContract.js";
147
152
  import { SDKConstruct } from "./base/SDKConstruct.js";
148
153
  import "./base/index.js";
149
- import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps } from "./accounts/credit-account-compressor/types.js";
154
+ import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./accounts/credit-account-compressor/types.js";
150
155
  import { CreditAccountCompressor } from "./accounts/credit-account-compressor/CreditAccountCompressor.js";
151
156
  import { CreditAccountCompressorV310Contract } from "./accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js";
152
157
  import { AbstractWithdrawalCompressorContract, OnchainRequestableWithdrawal, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js";
@@ -173,4 +178,4 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
173
178
  import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
174
179
  import "./accounts/index.js";
175
180
  import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
176
- export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AdapterData, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, IsStrategyCollateralProps, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcAdditionalBorrowApy, calcBorrowApy, calcMaxLeverage, calcPositionLeverage, calcUtilization, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
181
+ export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountSnapshot, AccountToCheck, AdapterData, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, IsStrategyCollateralProps, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcAdditionalBorrowApy, calcBorrowApy, calcBorrowRate, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcPositionLeverage, calcTimeToLiquidationMs, calcUtilization, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -92,6 +92,10 @@ declare abstract class PriceOracleBaseContract<abi extends Abi | readonly unknow
92
92
  * {@inheritDoc IPriceOracleContract.convertFromUSD}
93
93
  **/
94
94
  convertFromUSD(to: Address, amount: bigint, reserve?: boolean): bigint;
95
+ /**
96
+ * {@inheritDoc IPriceOracleContract.safeConvertToUSD}
97
+ **/
98
+ safeConvertToUSD(token: Address, amount: bigint): bigint | null;
95
99
  /**
96
100
  * {@inheritDoc IPriceOracleContract.safeUsdValue}
97
101
  **/
@@ -134,6 +134,14 @@ interface IPriceOracleContract extends IBaseContract {
134
134
  * @param reserve - Use reserve feeds instead of main.
135
135
  **/
136
136
  convertToUSD: (from: Address, amount: bigint, reserve?: boolean) => bigint;
137
+ /**
138
+ * Like {@link convertToUSD}, but returns `null` instead of throwing when
139
+ * the token cannot be priced (missing or unsuccessful feed).
140
+ *
141
+ * @param token - Token address.
142
+ * @param amount - Amount in token decimals.
143
+ **/
144
+ safeConvertToUSD: (token: Address, amount: bigint) => bigint | null;
137
145
  /**
138
146
  * Converts a USD amount to a token amount using latest known prices.
139
147
  * @param to - Token address.