@gearbox-protocol/sdk 16.0.0-next.47 → 16.0.0-next.48

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 (46) hide show
  1. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +2 -0
  2. package/dist/cjs/onchain/market/MarketSuite.js +28 -0
  3. package/dist/cjs/onchain/positions/PositionsService.js +4 -2
  4. package/dist/cjs/preview/index.js +2 -0
  5. package/dist/cjs/preview/preview/buildDelayedStrategyPositionOperationPreview.js +20 -20
  6. package/dist/cjs/preview/preview/errors.js +16 -0
  7. package/dist/cjs/preview/preview/index.js +2 -1
  8. package/dist/cjs/preview/preview/previewAdjustStrategyPosition.js +4 -12
  9. package/dist/cjs/preview/preview/previewExitOrRepayStrategyPosition.js +15 -5
  10. package/dist/esm/dev/AccountOpener.js +1 -1
  11. package/dist/esm/dev/withdrawalUtils.js +1 -1
  12. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  13. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +2 -0
  14. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  15. package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  16. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  17. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  18. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  19. package/dist/esm/onchain/base/TokensMeta.js +3 -3
  20. package/dist/esm/onchain/core/createAddressProvider.js +1 -1
  21. package/dist/esm/onchain/market/MarketSuite.js +28 -0
  22. package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  23. package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  24. package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
  25. package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
  26. package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
  27. package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
  28. package/dist/esm/onchain/positions/PositionsService.js +4 -2
  29. package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
  30. package/dist/esm/preview/index.js +2 -1
  31. package/dist/esm/preview/preview/buildDelayedStrategyPositionOperationPreview.js +21 -21
  32. package/dist/esm/preview/preview/errors.js +16 -1
  33. package/dist/esm/preview/preview/index.js +2 -2
  34. package/dist/esm/preview/preview/previewAdjustStrategyPosition.js +5 -13
  35. package/dist/esm/preview/preview/previewExitOrRepayStrategyPosition.js +15 -5
  36. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  37. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  38. package/dist/types/model/previews.d.ts +6 -11
  39. package/dist/types/onchain/index.d.ts +2 -2
  40. package/dist/types/onchain/market/MarketSuite.d.ts +29 -2
  41. package/dist/types/onchain/market/index.d.ts +2 -2
  42. package/dist/types/preview/index.d.ts +2 -2
  43. package/dist/types/preview/preview/buildDelayedStrategyPositionOperationPreview.d.ts +3 -2
  44. package/dist/types/preview/preview/errors.d.ts +9 -1
  45. package/dist/types/preview/preview/index.d.ts +2 -2
  46. package/package.json +1 -1
@@ -2,6 +2,7 @@ require("../../../constants/math.js");
2
2
  require("../../../constants/index.js");
3
3
  const require_onchain_market_math = require("../../../market/math.js");
4
4
  const require_onchain_market_credit_CreditSuite = require("../../../market/credit/CreditSuite.js");
5
+ const require_onchain_market_MarketSuite = require("../../../market/MarketSuite.js");
5
6
  const require_onchain_positions_PositionsService = require("../../../positions/PositionsService.js");
6
7
  let vitest = require("vitest");
7
8
  //#region src/onchain/accounts/intents/testing/sdk-mock.ts
@@ -221,6 +222,7 @@ function buildMockSdk(args) {
221
222
  underlying: args.underlying
222
223
  }
223
224
  };
225
+ Object.assign(market, { valueInUnderlying: require_onchain_market_MarketSuite.MarketSuite.prototype.valueInUnderlying });
224
226
  const collateralTokens = [args.underlying.toLowerCase(), ...Object.keys(args.liquidationThresholds).map((t) => t.toLowerCase()).filter((t) => t !== args.underlying.toLowerCase())];
225
227
  const forbidden = new Set((args.forbiddenTokens ?? []).map((t) => t.toLowerCase()));
226
228
  const forbiddenTokensMask = collateralTokens.reduce((mask, token, i) => forbidden.has(token) ? mask | 1n << BigInt(i) : mask, 0n);
@@ -1,6 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_utils_AddressMap = require("../utils/AddressMap.js");
3
3
  const require_onchain_chain_chains = require("../chain/chains.js");
4
+ const require_onchain_constants_math = require("../constants/math.js");
5
+ require("../constants/index.js");
4
6
  require("../utils/index.js");
5
7
  const require_onchain_base_SDKConstruct = require("../base/SDKConstruct.js");
6
8
  require("../base/index.js");
@@ -151,6 +153,32 @@ var MarketSuite = class extends require_onchain_base_SDKConstruct.SDKConstruct {
151
153
  ...this.priceOracle.toAmount(this.underlying, value)
152
154
  });
153
155
  /**
156
+ * Sums `assets` in this market's underlying at latest oracle prices.
157
+ *
158
+ * Balances at or below `minBalance` are ignored. A token the oracle cannot
159
+ * price contributes nothing; the first such token is {@link ValueInUnderlying.unpriceable}.
160
+ *
161
+ * The counterpart of {@link toUnderlyingAmount}: that method labels a figure
162
+ * already in underlying, this one produces the figure from mixed holdings.
163
+ **/
164
+ valueInUnderlying(assets, minBalance = require_onchain_constants_math.DUST_THRESHOLD) {
165
+ let unpriceable;
166
+ let value = 0n;
167
+ for (const { token, balance } of assets) {
168
+ if (balance <= minBalance) continue;
169
+ const converted = this.priceOracle.safeConvert(token, this.underlying, balance);
170
+ if (converted === null) {
171
+ unpriceable ??= token;
172
+ continue;
173
+ }
174
+ value += converted;
175
+ }
176
+ return unpriceable === void 0 ? { value } : {
177
+ value,
178
+ unpriceable
179
+ };
180
+ }
181
+ /**
154
182
  * Display name of this market's pool, e.g. `"USDC Pool"`.
155
183
  */
156
184
  get poolName() {
@@ -294,12 +294,14 @@ var PositionsService = class extends require_onchain_base_SDKConstruct.SDKConstr
294
294
  withdrawals: withdrawals.get(t.token) ?? []
295
295
  });
296
296
  if (recomputeTotals) {
297
- const value = priceOracle.safeConvert(t.token, market.underlying, t.balance) || 0n;
298
- totalValue += value;
299
297
  const usd = priceOracle.safeConvertToUSD(t.token, t.balance) || 0n;
300
298
  totalValueUSD += usd;
301
299
  }
302
300
  }
301
+ if (recomputeTotals) totalValue = market.valueInUnderlying(ca.tokens.map((t) => ({
302
+ token: t.token,
303
+ balance: t.balance
304
+ }))).value;
303
305
  const snapshot = {
304
306
  ...require_onchain_positions_types.accountSnapshotFromCreditAccountData(ca),
305
307
  totalValue
@@ -18,6 +18,7 @@ const require_preview_prerequisites_BalancePrerequisite = require("./prerequisit
18
18
  const require_preview_prerequisites_RWAOpenRequirementsPrerequisite = require("./prerequisites/RWAOpenRequirementsPrerequisite.js");
19
19
  const require_preview_prerequisites_checkPrerequisites = require("./prerequisites/checkPrerequisites.js");
20
20
  require("./prerequisites/index.js");
21
+ const require_preview_preview_errors = require("./preview/errors.js");
21
22
  const require_preview_preview_buildDelayedStrategyPositionOperationPreview = require("./preview/buildDelayedStrategyPositionOperationPreview.js");
22
23
  const require_preview_preview_CreditAccountState = require("./preview/CreditAccountState.js");
23
24
  const require_preview_preview_detectCloseOrRepay = require("./preview/detectCloseOrRepay.js");
@@ -77,3 +78,4 @@ exports.refuse = require_onchain_validation_refusal.refuse;
77
78
  exports.replayInnerOperations = require_preview_preview_replayInnerOperations.replayInnerOperations;
78
79
  exports.replayMulticall = require_preview_preview_replayMulticall.replayMulticall;
79
80
  exports.resolveDelayedClaimIntent = require_preview_preview_detectDelayedClaim.resolveDelayedClaimIntent;
81
+ exports.unpriceableTokenError = require_preview_preview_errors.unpriceableTokenError;
@@ -5,6 +5,7 @@ const require_onchain_constants_math = require("../../onchain/constants/math.js"
5
5
  const require_model_previews = require("../../model/previews.js");
6
6
  require("../../model/index.js");
7
7
  require("../../onchain/index.js");
8
+ const require_preview_preview_errors = require("./errors.js");
8
9
  let viem = require("viem");
9
10
  //#region src/preview/preview/buildDelayedStrategyPositionOperationPreview.ts
10
11
  /**
@@ -13,8 +14,9 @@ let viem = require("viem");
13
14
  * the claim itself followed by the intent-specific tail
14
15
  *
15
16
  * Pure function: the input states are never mutated and no network access is performed.
16
- * Swaps are estimated with the injected conversion; tokens it cannot price contribute
17
- * nothing and set a non-fatal `ERROR_UNPRICEABLE_TOKEN` error on the
17
+ * Swaps are estimated with the injected conversion; remaining holdings are
18
+ * priced by `MarketSuite.valueInUnderlying`. Tokens that cannot be priced
19
+ * contribute nothing and set a non-fatal `ERROR_UNPRICEABLE_TOKEN` error on the
18
20
  * preview.
19
21
  *
20
22
  * The changes (e.g. `totalDebtChange`) are reported relative to the account
@@ -51,10 +53,7 @@ function makeSafeConverter(convert) {
51
53
  try {
52
54
  return convert(token, to, amount);
53
55
  } catch {
54
- error ??= {
55
- code: require_model_previews.ERROR_UNPRICEABLE_TOKEN,
56
- message: `cannot price token ${token}`
57
- };
56
+ error ??= require_preview_preview_errors.unpriceableTokenError(token);
58
57
  return 0n;
59
58
  }
60
59
  },
@@ -149,35 +148,36 @@ function repayFromClaim(post, claimToken, convert, amount) {
149
148
  post.repay(received);
150
149
  }
151
150
  /**
152
- * Oracle estimate of the account's total value in the underlying, ignoring
153
- * balances at or below `dust`.
154
- */
155
- function totalValueInUnderlying(post, convert, dust) {
156
- return post.balances.sum((token, balance) => balance > dust ? convert(token, post.underlying, balance) : 0n);
157
- }
158
- /**
159
151
  * `CLOSE_ACCOUNT` operation tail: everything is swapped into the
160
152
  * underlying, the debt is repaid in full and the remainder is withdrawn to
161
153
  * the user as `receivedToken`.
162
154
  */
163
155
  function buildClosePreview(post, converter, receivedToken, sdk) {
164
- const totalValue = totalValueInUnderlying(post, converter.convert, 0n);
165
- const oracle = sdk.marketRegister.findByCreditManager(post.creditManager).priceOracle;
156
+ const market = sdk.marketRegister.findByCreditManager(post.creditManager);
157
+ const priced = market.valueInUnderlying(post.balances.toAssets(), 0n);
158
+ const oracle = market.priceOracle;
166
159
  const suite = sdk.marketRegister.findCreditManager(post.creditManager);
167
160
  return {
168
161
  operation: "CloseCreditAccount",
169
162
  permanent: false,
170
- ...suite.creditOperationMarket(),
163
+ ...require_model_previews.asEstimated(sdk.positions.projection({
164
+ creditManager: post.creditManager,
165
+ assets: [],
166
+ quotas: [],
167
+ totalDebt: 0n,
168
+ totalValue: 0n
169
+ }, { availableLiquidityChange: post.totalDebt })),
171
170
  creditAccount: post.creditAccount,
172
171
  name: suite.accountStrategyName(post.creditAccount),
173
172
  targetCollateral: suite.accountTargetCollateral(post.creditAccount),
174
- receivedAmount: oracle.toTokenAmount(receivedToken, require_onchain_utils_bigint_math.BigIntMath.max(totalValue - post.totalDebt, 0n)),
175
- error: converter.error
173
+ receivedAmount: oracle.toTokenAmount(receivedToken, require_onchain_utils_bigint_math.BigIntMath.max(priced.value - post.totalDebt, 0n)),
174
+ error: converter.error ?? (priced.unpriceable ? require_preview_preview_errors.unpriceableTokenError(priced.unpriceable) : void 0)
176
175
  };
177
176
  }
178
177
  function buildAdjustPreview(post, before, collateralWithdrawn, converter, sdk) {
179
- const snap = post.toSnapshot(totalValueInUnderlying(post, converter.convert, require_onchain_constants_math.DUST_THRESHOLD));
180
178
  const market = sdk.marketRegister.findByCreditManager(post.creditManager);
179
+ const priced = market.valueInUnderlying(post.balances.toAssets());
180
+ const snap = post.toSnapshot(priced.value);
181
181
  const suite = sdk.marketRegister.findCreditManager(post.creditManager);
182
182
  const oracle = market.priceOracle;
183
183
  return {
@@ -194,7 +194,7 @@ function buildAdjustPreview(post, before, collateralWithdrawn, converter, sdk) {
194
194
  ...oracle.toAmount(market.underlying, q.balance)
195
195
  })),
196
196
  assetsChange: post.balances.difference(before.balances).toAssets(require_onchain_constants_math.DUST_THRESHOLD).map((a) => oracle.toTokenAmount(a.token, a.balance)),
197
- error: converter.error
197
+ error: converter.error ?? (priced.unpriceable ? require_preview_preview_errors.unpriceableTokenError(priced.unpriceable) : void 0)
198
198
  };
199
199
  }
200
200
  //#endregion
@@ -1 +1,17 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_model_previews = require("../../model/previews.js");
3
+ require("../../model/index.js");
4
+ //#region src/preview/preview/errors.ts
5
+ /**
6
+ * Preview limitation (2xxx): the oracle could not price `token`. Callers
7
+ * attach this with `error ??=` so a malformed-transaction (1xxx) error
8
+ * already recorded keeps precedence.
9
+ **/
10
+ function unpriceableTokenError(token) {
11
+ return {
12
+ code: require_model_previews.ERROR_UNPRICEABLE_TOKEN,
13
+ message: `cannot price token ${token}`
14
+ };
15
+ }
16
+ //#endregion
17
+ exports.unpriceableTokenError = unpriceableTokenError;
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_preview_preview_errors = require("./errors.js");
2
3
  const require_preview_preview_buildDelayedStrategyPositionOperationPreview = require("./buildDelayedStrategyPositionOperationPreview.js");
3
4
  const require_preview_preview_CreditAccountState = require("./CreditAccountState.js");
4
5
  const require_preview_preview_detectCloseOrRepay = require("./detectCloseOrRepay.js");
5
6
  const require_preview_preview_detectDelayedClaim = require("./detectDelayedClaim.js");
6
7
  const require_preview_preview_detectDelayedOperation = require("./detectDelayedOperation.js");
7
- require("./errors.js");
8
8
  const require_preview_preview_estimateClaimableAt = require("./estimateClaimableAt.js");
9
9
  const require_preview_preview_replayInnerOperations = require("./replayInnerOperations.js");
10
10
  const require_preview_preview_replayMulticall = require("./replayMulticall.js");
@@ -25,3 +25,4 @@ exports.previewOperation = require_preview_preview_previewOperation.previewOpera
25
25
  exports.replayInnerOperations = require_preview_preview_replayInnerOperations.replayInnerOperations;
26
26
  exports.replayMulticall = require_preview_preview_replayMulticall.replayMulticall;
27
27
  exports.resolveDelayedClaimIntent = require_preview_preview_detectDelayedClaim.resolveDelayedClaimIntent;
28
+ exports.unpriceableTokenError = require_preview_preview_errors.unpriceableTokenError;
@@ -4,6 +4,7 @@ const require_onchain_constants_math = require("../../onchain/constants/math.js"
4
4
  const require_model_previews = require("../../model/previews.js");
5
5
  require("../../model/index.js");
6
6
  require("../../onchain/index.js");
7
+ const require_preview_preview_errors = require("./errors.js");
7
8
  const require_preview_preview_replayMulticall = require("./replayMulticall.js");
8
9
  const require_preview_preview_unwrapNativeCollateral = require("./unwrapNativeCollateral.js");
9
10
  //#region src/preview/preview/previewAdjustStrategyPosition.ts
@@ -25,18 +26,9 @@ function previewAdjustStrategyPosition(input, operation, options) {
25
26
  const { assets: collateralAdded, error: unwrapError } = require_preview_preview_unwrapNativeCollateral.unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(require_onchain_constants_address_provider.AP_WETH_TOKEN, 0));
26
27
  error ??= unwrapError;
27
28
  const assetsChange = account.balances.difference(before.balances).toAssets(require_onchain_constants_math.DUST_THRESHOLD);
28
- const totalValue = account.balances.toAssets(require_onchain_constants_math.DUST_THRESHOLD).reduce((acc, { token, balance }) => {
29
- try {
30
- return acc + oracle.convert(token, market.underlying, balance);
31
- } catch {
32
- error ??= {
33
- code: require_model_previews.ERROR_UNPRICEABLE_TOKEN,
34
- message: `cannot price token ${token}`
35
- };
36
- return acc;
37
- }
38
- }, 0n);
39
- const snap = account.toSnapshot(totalValue);
29
+ const priced = market.valueInUnderlying(account.balances.toAssets());
30
+ if (priced.unpriceable) error ??= require_preview_preview_errors.unpriceableTokenError(priced.unpriceable);
31
+ const snap = account.toSnapshot(priced.value);
40
32
  return {
41
33
  operation: "AdjustCreditAccount",
42
34
  ...require_model_previews.asEstimated(sdk.positions.projection(snap, { availableLiquidityChange: before.totalDebt - account.totalDebt })),
@@ -1,7 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_constants_address_provider = require("../../onchain/constants/address-provider.js");
3
3
  require("../../onchain/constants/math.js");
4
+ const require_model_previews = require("../../model/previews.js");
5
+ require("../../model/index.js");
4
6
  require("../../onchain/index.js");
7
+ const require_preview_preview_errors = require("./errors.js");
5
8
  const require_preview_preview_detectCloseOrRepay = require("./detectCloseOrRepay.js");
6
9
  const require_preview_preview_replayMulticall = require("./replayMulticall.js");
7
10
  const require_preview_preview_unwrapNativeCollateral = require("./unwrapNativeCollateral.js");
@@ -23,7 +26,11 @@ function previewExitOrRepayStrategyPosition(input, operation, permanent, options
23
26
  function previewCloseCreditAccount(input, operation, permanent, replay) {
24
27
  const { sdk } = input;
25
28
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
26
- const { after, error } = replay;
29
+ const { before, after, error: replayError } = replay;
30
+ const account = after.account;
31
+ let error = replayError;
32
+ const priced = market.valueInUnderlying(account.balances.toAssets());
33
+ if (priced.unpriceable) error ??= require_preview_preview_errors.unpriceableTokenError(priced.unpriceable);
27
34
  const suite = sdk.marketRegister.findCreditManager(operation.creditManager);
28
35
  let receivedToken = market.underlying;
29
36
  for (const m of operation.multicall) if (m.operation === "WithdrawCollateral" && m.amount === 115792089237316195423570985008687907853269984665640564039457584007913129639935n) {
@@ -33,7 +40,7 @@ function previewCloseCreditAccount(input, operation, permanent, replay) {
33
40
  return {
34
41
  operation: "CloseCreditAccount",
35
42
  permanent,
36
- ...suite.creditOperationMarket(),
43
+ ...require_model_previews.asEstimated(sdk.positions.projection(account.toSnapshot(priced.value), { availableLiquidityChange: before.totalDebt - account.totalDebt })),
37
44
  creditAccount: operation.creditAccount,
38
45
  name: suite.accountStrategyName(operation.creditAccount),
39
46
  targetCollateral: suite.accountTargetCollateral(operation.creditAccount),
@@ -50,18 +57,21 @@ function previewRepayCreditAccount(input, operation, permanent, replay) {
50
57
  const { sdk, value = 0n } = input;
51
58
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
52
59
  const { before, after, error: replayError } = replay;
60
+ const account = after.account;
53
61
  const { assets: collateralAdded, error: unwrapError } = require_preview_preview_unwrapNativeCollateral.unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(require_onchain_constants_address_provider.AP_WETH_TOKEN, 0));
54
- const error = replayError ?? unwrapError;
62
+ let error = replayError ?? unwrapError;
63
+ const priced = market.valueInUnderlying(account.balances.toAssets());
64
+ if (priced.unpriceable) error ??= require_preview_preview_errors.unpriceableTokenError(priced.unpriceable);
55
65
  const suite = sdk.marketRegister.findCreditManager(operation.creditManager);
56
66
  return {
57
67
  operation: "RepayCreditAccount",
58
68
  permanent,
59
- ...suite.creditOperationMarket(),
69
+ ...require_model_previews.asEstimated(sdk.positions.projection(account.toSnapshot(priced.value), { availableLiquidityChange: before.totalDebt - account.totalDebt })),
60
70
  creditAccount: operation.creditAccount,
61
71
  name: suite.accountStrategyName(operation.creditAccount),
62
72
  targetCollateral: suite.accountTargetCollateral(operation.creditAccount),
63
73
  collateralAdded: collateralAdded.map((a) => market.priceOracle.toTokenAmount(a.token, a.balance)),
64
- debtRepaid: market.toUnderlyingAmount(before.totalDebt - after.account.totalDebt),
74
+ debtRepaid: market.toUnderlyingAmount(before.totalDebt - account.totalDebt),
65
75
  collateralWithdrawn: after.collateralWithdrawn.toAssets().map((a) => market.priceOracle.toTokenAmount(a.token, a.balance)),
66
76
  error
67
77
  };
@@ -1,5 +1,5 @@
1
- import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
2
1
  import { ierc20Abi } from "../abi/iERC20.js";
2
+ import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
3
3
  import { AddressMap } from "../onchain/utils/AddressMap.js";
4
4
  import { AddressSet } from "../onchain/utils/AddressSet.js";
5
5
  import { AssetsMap } from "../onchain/utils/AssetsMap.js";
@@ -1,6 +1,6 @@
1
+ import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
1
2
  import { getNetworkType } from "../onchain/chain/chains.js";
2
3
  import { getWithdrawalCompressorAddress } from "../onchain/accounts/withdrawal-compressor/addresses.js";
3
- import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
4
4
  import "../onchain/index.js";
5
5
  import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
6
6
  import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
@@ -1,3 +1,5 @@
1
+ import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
2
+ import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
1
3
  import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
2
4
  import { ADDRESS_0X0 } from "../constants/addresses.js";
3
5
  import { MAX_UINT256 } from "../constants/math.js";
@@ -8,8 +10,6 @@ import "../base/index.js";
8
10
  import { AccountBotsService } from "./bots/AccountBotsService.js";
9
11
  import "./bots/index.js";
10
12
  import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
11
- import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
12
- import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
13
13
  import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
14
14
  import "../market/index.js";
15
15
  import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
@@ -2,6 +2,7 @@ import "../../../constants/math.js";
2
2
  import "../../../constants/index.js";
3
3
  import { calcMaxLeverage, usdToNumber } from "../../../market/math.js";
4
4
  import { CreditSuite } from "../../../market/credit/CreditSuite.js";
5
+ import { MarketSuite } from "../../../market/MarketSuite.js";
5
6
  import { PositionsService } from "../../../positions/PositionsService.js";
6
7
  import { vi } from "vitest";
7
8
  //#region src/onchain/accounts/intents/testing/sdk-mock.ts
@@ -221,6 +222,7 @@ function buildMockSdk(args) {
221
222
  underlying: args.underlying
222
223
  }
223
224
  };
225
+ Object.assign(market, { valueInUnderlying: MarketSuite.prototype.valueInUnderlying });
224
226
  const collateralTokens = [args.underlying.toLowerCase(), ...Object.keys(args.liquidationThresholds).map((t) => t.toLowerCase()).filter((t) => t !== args.underlying.toLowerCase())];
225
227
  const forbidden = new Set((args.forbiddenTokens ?? []).map((t) => t.toLowerCase()));
226
228
  const forbiddenTokensMask = collateralTokens.reduce((mask, token, i) => forbidden.has(token) ? mask | 1n << BigInt(i) : mask, 0n);
@@ -1,3 +1,4 @@
1
+ import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
1
2
  import { AddressSet } from "../../utils/AddressSet.js";
2
3
  import { bytes32ToString } from "../../utils/bytes32ToString.js";
3
4
  import { ADDRESS_0X0 } from "../../constants/addresses.js";
@@ -19,7 +20,6 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
19
20
  import "../../market/rwa/securitize/index.js";
20
21
  import "../../market/index.js";
21
22
  import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
22
- import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
23
23
  import { skipLiquidatableAccount } from "./skipLiquidatableAccount.js";
24
24
  //#region src/onchain/accounts/liquidations/LiquidationsService.ts
25
25
  /**
@@ -1,9 +1,9 @@
1
+ import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
1
2
  import { BaseContract } from "../../base/BaseContract.js";
2
3
  import "../../base/index.js";
3
4
  import { sdkErr, sdkOk } from "../../../model/result.js";
4
5
  import "../../../model/index.js";
5
6
  import { decodeDelayedIntent } from "./intent-codec.js";
6
- import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
7
7
  //#region src/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
8
8
  const abi = iRedemptionLoggerV310Abi;
9
9
  /**
@@ -1,5 +1,5 @@
1
- import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
2
1
  import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
2
+ import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
3
3
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
4
4
  const abi = iWithdrawalCompressorV310Abi;
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
2
1
  import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
2
+ import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
3
3
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
4
4
  const abi = iWithdrawalCompressorV311Abi;
5
5
  /**
@@ -1,6 +1,6 @@
1
+ import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
1
2
  import { encodeDelayedIntent } from "./intent-codec.js";
2
3
  import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
3
- import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
4
4
  import { toWithdrawalStatus } from "./types.js";
5
5
  //#region src/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
6
6
  const abi = iWithdrawalCompressorV313Abi;
@@ -1,12 +1,12 @@
1
+ import { iExpirableAbi } from "../../abi/iExpirable.js";
2
+ import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
3
+ import { iVersionAbi } from "../../abi/iVersion.js";
1
4
  import { AddressMap } from "../utils/AddressMap.js";
2
5
  import { AddressSet } from "../utils/AddressSet.js";
3
6
  import { bytes32ToString } from "../utils/bytes32ToString.js";
4
7
  import { getAssetType } from "../chain/chains.js";
5
8
  import { formatBN } from "../utils/formatter.js";
6
9
  import "../utils/index.js";
7
- import { iExpirableAbi } from "../../abi/iExpirable.js";
8
- import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
9
- import { iVersionAbi } from "../../abi/iVersion.js";
10
10
  import { SdkRWADataNotLoadedError } from "../core/errors.js";
11
11
  import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
12
12
  //#region src/onchain/base/TokensMeta.ts
@@ -1,8 +1,8 @@
1
+ import { iVersionAbi } from "../../abi/iVersion.js";
1
2
  import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
2
3
  import { isV310 } from "../constants/versions.js";
3
4
  import "../constants/index.js";
4
5
  import { hexEq } from "../utils/hex.js";
5
- import { iVersionAbi } from "../../abi/iVersion.js";
6
6
  import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
7
7
  //#region src/onchain/core/createAddressProvider.ts
8
8
  const OVERRIDE_ADDRESSES = { Mainnet: {
@@ -1,5 +1,7 @@
1
1
  import { AddressMap } from "../utils/AddressMap.js";
2
2
  import { isRWAToken, isSunsetPool } from "../chain/chains.js";
3
+ import { DUST_THRESHOLD } from "../constants/math.js";
4
+ import "../constants/index.js";
3
5
  import "../utils/index.js";
4
6
  import { SDKConstruct } from "../base/SDKConstruct.js";
5
7
  import "../base/index.js";
@@ -150,6 +152,32 @@ var MarketSuite = class extends SDKConstruct {
150
152
  ...this.priceOracle.toAmount(this.underlying, value)
151
153
  });
152
154
  /**
155
+ * Sums `assets` in this market's underlying at latest oracle prices.
156
+ *
157
+ * Balances at or below `minBalance` are ignored. A token the oracle cannot
158
+ * price contributes nothing; the first such token is {@link ValueInUnderlying.unpriceable}.
159
+ *
160
+ * The counterpart of {@link toUnderlyingAmount}: that method labels a figure
161
+ * already in underlying, this one produces the figure from mixed holdings.
162
+ **/
163
+ valueInUnderlying(assets, minBalance = DUST_THRESHOLD) {
164
+ let unpriceable;
165
+ let value = 0n;
166
+ for (const { token, balance } of assets) {
167
+ if (balance <= minBalance) continue;
168
+ const converted = this.priceOracle.safeConvert(token, this.underlying, balance);
169
+ if (converted === null) {
170
+ unpriceable ??= token;
171
+ continue;
172
+ }
173
+ value += converted;
174
+ }
175
+ return unpriceable === void 0 ? { value } : {
176
+ value,
177
+ unpriceable
178
+ };
179
+ }
180
+ /**
153
181
  * Display name of this market's pool, e.g. `"USDC Pool"`.
154
182
  */
155
183
  get poolName() {
@@ -1,5 +1,5 @@
1
- import { AbstractAdapterContract } from "./AbstractAdapter.js";
2
1
  import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
2
+ import { AbstractAdapterContract } from "./AbstractAdapter.js";
3
3
  //#region src/onchain/market/adapters/contracts/AccountMigratorAdapterContract.ts
4
4
  const abi = accountMigratorAbi;
5
5
  const protocolAbi = accountMigratorAbi;
@@ -1,6 +1,6 @@
1
+ import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
1
2
  import { MissingSerializedParamsError } from "../../../base/errors.js";
2
3
  import "../../../base/index.js";
3
- import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
4
4
  import { iERC4626Abi } from "../abi/targetContractAbi.js";
5
5
  import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
6
6
  import { AbstractAdapterContract } from "./AbstractAdapter.js";
@@ -1,7 +1,7 @@
1
+ import { iPausableAbi } from "../../../abi/iPausable.js";
1
2
  import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
2
3
  import { BaseContract } from "../../base/BaseContract.js";
3
4
  import "../../base/index.js";
4
- import { iPausableAbi } from "../../../abi/iPausable.js";
5
5
  //#region src/onchain/market/credit/CreditFacadeV310BaseContract.ts
6
6
  const abi = [
7
7
  ...iCreditFacadeV310Abi,
@@ -1,3 +1,4 @@
1
+ import { iPausableAbi } from "../../../abi/iPausable.js";
1
2
  import { iPoolV310Abi } from "../../../abi/310/generated.js";
2
3
  import { AddressMap } from "../../utils/AddressMap.js";
3
4
  import { RAY } from "../../constants/math.js";
@@ -7,7 +8,6 @@ import "../../utils/index.js";
7
8
  import { SdkRWADataNotLoadedError } from "../../core/errors.js";
8
9
  import { BaseContract } from "../../base/BaseContract.js";
9
10
  import "../../base/index.js";
10
- import { iPausableAbi } from "../../../abi/iPausable.js";
11
11
  //#region src/onchain/market/pool/PoolV310Contract.ts
12
12
  const abi = [...iPoolV310Abi, ...iPausableAbi];
13
13
  var PoolV310Contract = class extends BaseContract {
@@ -1,5 +1,5 @@
1
- import { ZapperContract } from "./ZapperContract.js";
2
1
  import { iethZapperAbi } from "../../../abi/iETHZapper.js";
2
+ import { ZapperContract } from "./ZapperContract.js";
3
3
  //#region src/onchain/market/zapper/IETHZapperContract.ts
4
4
  const abi = iethZapperAbi;
5
5
  var IETHZapperContract = class extends ZapperContract {
@@ -1,8 +1,8 @@
1
+ import { iZapperAbi } from "../../../abi/iZapper.js";
1
2
  import { BaseContract } from "../../base/BaseContract.js";
2
3
  import "../../base/index.js";
3
4
  import { sdkErr, sdkOk } from "../../../model/result.js";
4
5
  import "../../../model/index.js";
5
- import { iZapperAbi } from "../../../abi/iZapper.js";
6
6
  //#region src/onchain/market/zapper/ZapperContract.ts
7
7
  /**
8
8
  * Base contract for every Gearbox zapper. Specialized zappers (e.g.
@@ -293,12 +293,14 @@ var PositionsService = class extends SDKConstruct {
293
293
  withdrawals: withdrawals.get(t.token) ?? []
294
294
  });
295
295
  if (recomputeTotals) {
296
- const value = priceOracle.safeConvert(t.token, market.underlying, t.balance) || 0n;
297
- totalValue += value;
298
296
  const usd = priceOracle.safeConvertToUSD(t.token, t.balance) || 0n;
299
297
  totalValueUSD += usd;
300
298
  }
301
299
  }
300
+ if (recomputeTotals) totalValue = market.valueInUnderlying(ca.tokens.map((t) => ({
301
+ token: t.token,
302
+ balance: t.balance
303
+ }))).value;
302
304
  const snapshot = {
303
305
  ...accountSnapshotFromCreditAccountData(ca),
304
306
  totalValue
@@ -1,6 +1,6 @@
1
1
  import { errorAbis } from "../../../abi/errors.js";
2
- import { generateCastTraceCall } from "./cast.js";
3
2
  import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
3
+ import { generateCastTraceCall } from "./cast.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";
@@ -17,6 +17,7 @@ import { BalancePrerequisite } from "./prerequisites/BalancePrerequisite.js";
17
17
  import { RWAOpenRequirementsPrerequisite } from "./prerequisites/RWAOpenRequirementsPrerequisite.js";
18
18
  import { checkPrerequisites } from "./prerequisites/checkPrerequisites.js";
19
19
  import "./prerequisites/index.js";
20
+ import { unpriceableTokenError } from "./preview/errors.js";
20
21
  import { buildDelayedStrategyPositionOperationPreview } from "./preview/buildDelayedStrategyPositionOperationPreview.js";
21
22
  import { CreditAccountState } from "./preview/CreditAccountState.js";
22
23
  import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
@@ -34,4 +35,4 @@ import "./types.js";
34
35
  import { checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./validate/checkOperation.js";
35
36
  import { checkSimulation } from "./validate/checkSimulation.js";
36
37
  import "./validate/index.js";
37
- export { AllowancePrerequisite, BalancePrerequisite, CreditAccountState, Prerequisite, RWAOpenRequirementsPrerequisite, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, WithdrawCollateralAlignmentError, asPreviewSimulationError, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, marketIssues, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
38
+ export { AllowancePrerequisite, BalancePrerequisite, CreditAccountState, Prerequisite, RWAOpenRequirementsPrerequisite, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, WithdrawCollateralAlignmentError, asPreviewSimulationError, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, marketIssues, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpriceableTokenError };
@@ -1,9 +1,10 @@
1
1
  import { AssetsMap } from "../../onchain/utils/AssetsMap.js";
2
2
  import { BigIntMath } from "../../onchain/utils/bigint-math.js";
3
3
  import { DUST_THRESHOLD } from "../../onchain/constants/math.js";
4
- import { ERROR_UNPRICEABLE_TOKEN, asEstimated } from "../../model/previews.js";
4
+ import { asEstimated } from "../../model/previews.js";
5
5
  import "../../model/index.js";
6
6
  import "../../onchain/index.js";
7
+ import { unpriceableTokenError } from "./errors.js";
7
8
  import { isAddressEqual } from "viem";
8
9
  //#region src/preview/preview/buildDelayedStrategyPositionOperationPreview.ts
9
10
  /**
@@ -12,8 +13,9 @@ import { isAddressEqual } from "viem";
12
13
  * the claim itself followed by the intent-specific tail
13
14
  *
14
15
  * Pure function: the input states are never mutated and no network access is performed.
15
- * Swaps are estimated with the injected conversion; tokens it cannot price contribute
16
- * nothing and set a non-fatal `ERROR_UNPRICEABLE_TOKEN` error on the
16
+ * Swaps are estimated with the injected conversion; remaining holdings are
17
+ * priced by `MarketSuite.valueInUnderlying`. Tokens that cannot be priced
18
+ * contribute nothing and set a non-fatal `ERROR_UNPRICEABLE_TOKEN` error on the
17
19
  * preview.
18
20
  *
19
21
  * The changes (e.g. `totalDebtChange`) are reported relative to the account
@@ -50,10 +52,7 @@ function makeSafeConverter(convert) {
50
52
  try {
51
53
  return convert(token, to, amount);
52
54
  } catch {
53
- error ??= {
54
- code: ERROR_UNPRICEABLE_TOKEN,
55
- message: `cannot price token ${token}`
56
- };
55
+ error ??= unpriceableTokenError(token);
57
56
  return 0n;
58
57
  }
59
58
  },
@@ -148,35 +147,36 @@ function repayFromClaim(post, claimToken, convert, amount) {
148
147
  post.repay(received);
149
148
  }
150
149
  /**
151
- * Oracle estimate of the account's total value in the underlying, ignoring
152
- * balances at or below `dust`.
153
- */
154
- function totalValueInUnderlying(post, convert, dust) {
155
- return post.balances.sum((token, balance) => balance > dust ? convert(token, post.underlying, balance) : 0n);
156
- }
157
- /**
158
150
  * `CLOSE_ACCOUNT` operation tail: everything is swapped into the
159
151
  * underlying, the debt is repaid in full and the remainder is withdrawn to
160
152
  * the user as `receivedToken`.
161
153
  */
162
154
  function buildClosePreview(post, converter, receivedToken, sdk) {
163
- const totalValue = totalValueInUnderlying(post, converter.convert, 0n);
164
- const oracle = sdk.marketRegister.findByCreditManager(post.creditManager).priceOracle;
155
+ const market = sdk.marketRegister.findByCreditManager(post.creditManager);
156
+ const priced = market.valueInUnderlying(post.balances.toAssets(), 0n);
157
+ const oracle = market.priceOracle;
165
158
  const suite = sdk.marketRegister.findCreditManager(post.creditManager);
166
159
  return {
167
160
  operation: "CloseCreditAccount",
168
161
  permanent: false,
169
- ...suite.creditOperationMarket(),
162
+ ...asEstimated(sdk.positions.projection({
163
+ creditManager: post.creditManager,
164
+ assets: [],
165
+ quotas: [],
166
+ totalDebt: 0n,
167
+ totalValue: 0n
168
+ }, { availableLiquidityChange: post.totalDebt })),
170
169
  creditAccount: post.creditAccount,
171
170
  name: suite.accountStrategyName(post.creditAccount),
172
171
  targetCollateral: suite.accountTargetCollateral(post.creditAccount),
173
- receivedAmount: oracle.toTokenAmount(receivedToken, BigIntMath.max(totalValue - post.totalDebt, 0n)),
174
- error: converter.error
172
+ receivedAmount: oracle.toTokenAmount(receivedToken, BigIntMath.max(priced.value - post.totalDebt, 0n)),
173
+ error: converter.error ?? (priced.unpriceable ? unpriceableTokenError(priced.unpriceable) : void 0)
175
174
  };
176
175
  }
177
176
  function buildAdjustPreview(post, before, collateralWithdrawn, converter, sdk) {
178
- const snap = post.toSnapshot(totalValueInUnderlying(post, converter.convert, DUST_THRESHOLD));
179
177
  const market = sdk.marketRegister.findByCreditManager(post.creditManager);
178
+ const priced = market.valueInUnderlying(post.balances.toAssets());
179
+ const snap = post.toSnapshot(priced.value);
180
180
  const suite = sdk.marketRegister.findCreditManager(post.creditManager);
181
181
  const oracle = market.priceOracle;
182
182
  return {
@@ -193,7 +193,7 @@ function buildAdjustPreview(post, before, collateralWithdrawn, converter, sdk) {
193
193
  ...oracle.toAmount(market.underlying, q.balance)
194
194
  })),
195
195
  assetsChange: post.balances.difference(before.balances).toAssets(DUST_THRESHOLD).map((a) => oracle.toTokenAmount(a.token, a.balance)),
196
- error: converter.error
196
+ error: converter.error ?? (priced.unpriceable ? unpriceableTokenError(priced.unpriceable) : void 0)
197
197
  };
198
198
  }
199
199
  //#endregion
@@ -1 +1,16 @@
1
- export {};
1
+ import { ERROR_UNPRICEABLE_TOKEN } from "../../model/previews.js";
2
+ import "../../model/index.js";
3
+ //#region src/preview/preview/errors.ts
4
+ /**
5
+ * Preview limitation (2xxx): the oracle could not price `token`. Callers
6
+ * attach this with `error ??=` so a malformed-transaction (1xxx) error
7
+ * already recorded keeps precedence.
8
+ **/
9
+ function unpriceableTokenError(token) {
10
+ return {
11
+ code: ERROR_UNPRICEABLE_TOKEN,
12
+ message: `cannot price token ${token}`
13
+ };
14
+ }
15
+ //#endregion
16
+ export { unpriceableTokenError };
@@ -1,13 +1,13 @@
1
+ import { unpriceableTokenError } from "./errors.js";
1
2
  import { buildDelayedStrategyPositionOperationPreview } from "./buildDelayedStrategyPositionOperationPreview.js";
2
3
  import { CreditAccountState } from "./CreditAccountState.js";
3
4
  import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
4
5
  import { detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
5
6
  import { detectDelayedOperation } from "./detectDelayedOperation.js";
6
- import "./errors.js";
7
7
  import { estimateClaimableAt } from "./estimateClaimableAt.js";
8
8
  import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
9
9
  import { replayMulticall } from "./replayMulticall.js";
10
10
  import { previewAdjustStrategyPosition } from "./previewAdjustStrategyPosition.js";
11
11
  import { previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategyPosition.js";
12
12
  import { previewOperation } from "./previewOperation.js";
13
- export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
13
+ export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpriceableTokenError };
@@ -1,8 +1,9 @@
1
1
  import { AP_WETH_TOKEN } from "../../onchain/constants/address-provider.js";
2
2
  import { DUST_THRESHOLD } from "../../onchain/constants/math.js";
3
- import { ERROR_UNPRICEABLE_TOKEN, asEstimated } from "../../model/previews.js";
3
+ import { asEstimated } from "../../model/previews.js";
4
4
  import "../../model/index.js";
5
5
  import "../../onchain/index.js";
6
+ import { unpriceableTokenError } from "./errors.js";
6
7
  import { replayMulticall } from "./replayMulticall.js";
7
8
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
8
9
  //#region src/preview/preview/previewAdjustStrategyPosition.ts
@@ -24,18 +25,9 @@ function previewAdjustStrategyPosition(input, operation, options) {
24
25
  const { assets: collateralAdded, error: unwrapError } = unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
25
26
  error ??= unwrapError;
26
27
  const assetsChange = account.balances.difference(before.balances).toAssets(DUST_THRESHOLD);
27
- const totalValue = account.balances.toAssets(DUST_THRESHOLD).reduce((acc, { token, balance }) => {
28
- try {
29
- return acc + oracle.convert(token, market.underlying, balance);
30
- } catch {
31
- error ??= {
32
- code: ERROR_UNPRICEABLE_TOKEN,
33
- message: `cannot price token ${token}`
34
- };
35
- return acc;
36
- }
37
- }, 0n);
38
- const snap = account.toSnapshot(totalValue);
28
+ const priced = market.valueInUnderlying(account.balances.toAssets());
29
+ if (priced.unpriceable) error ??= unpriceableTokenError(priced.unpriceable);
30
+ const snap = account.toSnapshot(priced.value);
39
31
  return {
40
32
  operation: "AdjustCreditAccount",
41
33
  ...asEstimated(sdk.positions.projection(snap, { availableLiquidityChange: before.totalDebt - account.totalDebt })),
@@ -1,6 +1,9 @@
1
1
  import { AP_WETH_TOKEN } from "../../onchain/constants/address-provider.js";
2
2
  import "../../onchain/constants/math.js";
3
+ import { asEstimated } from "../../model/previews.js";
4
+ import "../../model/index.js";
3
5
  import "../../onchain/index.js";
6
+ import { unpriceableTokenError } from "./errors.js";
4
7
  import { classifyCloseOrRepay } from "./detectCloseOrRepay.js";
5
8
  import { replayMulticall } from "./replayMulticall.js";
6
9
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
@@ -22,7 +25,11 @@ function previewExitOrRepayStrategyPosition(input, operation, permanent, options
22
25
  function previewCloseCreditAccount(input, operation, permanent, replay) {
23
26
  const { sdk } = input;
24
27
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
25
- const { after, error } = replay;
28
+ const { before, after, error: replayError } = replay;
29
+ const account = after.account;
30
+ let error = replayError;
31
+ const priced = market.valueInUnderlying(account.balances.toAssets());
32
+ if (priced.unpriceable) error ??= unpriceableTokenError(priced.unpriceable);
26
33
  const suite = sdk.marketRegister.findCreditManager(operation.creditManager);
27
34
  let receivedToken = market.underlying;
28
35
  for (const m of operation.multicall) if (m.operation === "WithdrawCollateral" && m.amount === 115792089237316195423570985008687907853269984665640564039457584007913129639935n) {
@@ -32,7 +39,7 @@ function previewCloseCreditAccount(input, operation, permanent, replay) {
32
39
  return {
33
40
  operation: "CloseCreditAccount",
34
41
  permanent,
35
- ...suite.creditOperationMarket(),
42
+ ...asEstimated(sdk.positions.projection(account.toSnapshot(priced.value), { availableLiquidityChange: before.totalDebt - account.totalDebt })),
36
43
  creditAccount: operation.creditAccount,
37
44
  name: suite.accountStrategyName(operation.creditAccount),
38
45
  targetCollateral: suite.accountTargetCollateral(operation.creditAccount),
@@ -49,18 +56,21 @@ function previewRepayCreditAccount(input, operation, permanent, replay) {
49
56
  const { sdk, value = 0n } = input;
50
57
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
51
58
  const { before, after, error: replayError } = replay;
59
+ const account = after.account;
52
60
  const { assets: collateralAdded, error: unwrapError } = unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
53
- const error = replayError ?? unwrapError;
61
+ let error = replayError ?? unwrapError;
62
+ const priced = market.valueInUnderlying(account.balances.toAssets());
63
+ if (priced.unpriceable) error ??= unpriceableTokenError(priced.unpriceable);
54
64
  const suite = sdk.marketRegister.findCreditManager(operation.creditManager);
55
65
  return {
56
66
  operation: "RepayCreditAccount",
57
67
  permanent,
58
- ...suite.creditOperationMarket(),
68
+ ...asEstimated(sdk.positions.projection(account.toSnapshot(priced.value), { availableLiquidityChange: before.totalDebt - account.totalDebt })),
59
69
  creditAccount: operation.creditAccount,
60
70
  name: suite.accountStrategyName(operation.creditAccount),
61
71
  targetCollateral: suite.accountTargetCollateral(operation.creditAccount),
62
72
  collateralAdded: collateralAdded.map((a) => market.priceOracle.toTokenAmount(a.token, a.balance)),
63
- debtRepaid: market.toUnderlyingAmount(before.totalDebt - after.account.totalDebt),
73
+ debtRepaid: market.toUnderlyingAmount(before.totalDebt - account.totalDebt),
64
74
  collateralWithdrawn: after.collateralWithdrawn.toAssets().map((a) => market.priceOracle.toTokenAmount(a.token, a.balance)),
65
75
  error
66
76
  };
@@ -1,7 +1,7 @@
1
+ import { iZapperAbi } from "../../abi/iZapper.js";
1
2
  import { iPoolV310Abi } from "../../abi/310/generated.js";
2
3
  import { sdkErr, sdkOk } from "../../model/result.js";
3
4
  import "../../model/index.js";
4
- import { iZapperAbi } from "../../abi/iZapper.js";
5
5
  import { asPreviewSimulationError } from "./errors.js";
6
6
  //#region src/preview/simulate/simulatePoolOperation.ts
7
7
  function previewRead(operation) {
@@ -1,5 +1,5 @@
1
- import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
2
1
  import { ierc20Abi } from "../../abi/iERC20.js";
2
+ import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
3
3
  import { AddressMap } from "../../onchain/utils/AddressMap.js";
4
4
  import "../../onchain/index.js";
5
5
  import { UnexpectedFacadeEventOrderError } from "./errors.js";
@@ -468,12 +468,8 @@ interface AdjustStrategyPositionPreview extends EstimatedProjection, AccountStat
468
468
  * What an exit transaction that already exists would do — the counterpart of
469
469
  * `prepare.withdrawStrategy` asked for everything, read off calldata rather
470
470
  * than planned into it.
471
- *
472
- * Carries no {@link AccountProjection}: the account it describes ends up empty,
473
- * so there is no position left to weigh — what a caller wants to know is the
474
- * payout. The market it happened in is still named, as everywhere else.
475
471
  **/
476
- interface ExitStrategyPositionPreview extends CreditOperationMarket {
472
+ interface ExitStrategyPositionPreview extends EstimatedProjection {
477
473
  operation: "CloseCreditAccount";
478
474
  /**
479
475
  * True when the account is closed permanently (facade `closeCreditAccount`
@@ -506,7 +502,8 @@ interface ExitStrategyPositionPreview extends CreditOperationMarket {
506
502
  /**
507
503
  * Set when preview encountered non-fatal errors, all fields are
508
504
  * still computed best-effort, but the
509
- * balance-derived `receivedAmount` may be unreliable in that case.
505
+ * balance-derived `receivedAmount` and the projected holdings may be
506
+ * unreliable in that case.
510
507
  */
511
508
  error?: OperationPreviewError;
512
509
  }
@@ -514,11 +511,8 @@ interface ExitStrategyPositionPreview extends CreditOperationMarket {
514
511
  * What a settling repayment that already exists would do — the counterpart of
515
512
  * `prepare.repayStrategy` asked for the whole debt, read off calldata rather
516
513
  * than planned into it.
517
- *
518
- * Carries no {@link AccountProjection} for the same reason the exit does not:
519
- * the loan ends here, so the risk metrics have nothing left to describe.
520
514
  **/
521
- interface RepayStrategyPositionPreview extends CreditOperationMarket {
515
+ interface RepayStrategyPositionPreview extends EstimatedProjection {
522
516
  operation: "RepayCreditAccount";
523
517
  /**
524
518
  * True when the account is closed permanently (facade `closeCreditAccount`
@@ -564,7 +558,8 @@ interface RepayStrategyPositionPreview extends CreditOperationMarket {
564
558
  /**
565
559
  * Set when preview encountered non-fatal errors, all fields are
566
560
  * still computed best-effort, but the
567
- * balance-derived `collateralWithdrawn` may be unreliable in that case.
561
+ * balance-derived `collateralWithdrawn` and the projected holdings may be
562
+ * unreliable in that case.
568
563
  */
569
564
  error?: OperationPreviewError;
570
565
  }
@@ -172,7 +172,7 @@ import { GaugeContract, GaugeParams } from "./market/pool/GaugeContract.js";
172
172
  import { LinearInterestRateModelContract } from "./market/pool/LinearInterestRateModelContract.js";
173
173
  import { PoolSuite } from "./market/pool/PoolSuite.js";
174
174
  import { PoolV310Contract } from "./market/pool/PoolV310Contract.js";
175
- import { MarketSuite } from "./market/MarketSuite.js";
175
+ import { MarketSuite, ValueInUnderlying } from "./market/MarketSuite.js";
176
176
  import { CreditSuite } from "./market/credit/CreditSuite.js";
177
177
  import { StrategyCollateralProps, dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./market/credit/collateralUtils.js";
178
178
  import { ExpectedBalanceDeltasProps, ExpectedOutput, expectedBalanceDeltas } from "./market/credit/expectedBalanceDeltas.js";
@@ -273,4 +273,4 @@ import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./opti
273
273
  import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, amountOf, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, isMalformedPreviewError } from "./validation/checks.js";
274
274
  import { toToken, toTokenAmount } from "./validation/token.js";
275
275
  import "./validation/index.js";
276
- 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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetWithAmountInTarget, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, type BorrowLimitBinding, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcDefaultQuotaProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, CallTrace, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, 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, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, type FinishIntentResult, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetCurrentWithdrawalsProps, GetCurrentWithdrawalsPropsBase, GetExternalAccountCurrentWithdrawalsProps, GetInvestorOptions, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IMultichainOpportunitiesService, IMultichainPositionsService, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, type LeverageBand, LidoSubmit, LidoV1AdapterContract, 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_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, 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, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OpenStrategyState, type OperationState, 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, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, type PreviewErrorDetails, type PreviewErrorReason, type PreviewIssue, type PreviewRefusal, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, type QuotaParamsHuman, QuotaSlice, 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, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, 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, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, type WithdrawCeilings, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPhantomToken, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
276
+ 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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetWithAmountInTarget, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, type BorrowLimitBinding, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcDefaultQuotaProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, CallTrace, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, 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, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, type FinishIntentResult, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetCurrentWithdrawalsProps, GetCurrentWithdrawalsPropsBase, GetExternalAccountCurrentWithdrawalsProps, GetInvestorOptions, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IMultichainOpportunitiesService, IMultichainPositionsService, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, type LeverageBand, LidoSubmit, LidoV1AdapterContract, 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_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, 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, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OpenStrategyState, type OperationState, 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, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, type PreviewErrorDetails, type PreviewErrorReason, type PreviewIssue, type PreviewRefusal, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaKeeperState, QuotaMode, type QuotaParamsHuman, QuotaSlice, 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, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteRefusals, 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, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StakingRewardsAdapterContract, type StartIntent, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VERSION_RANGE_310, ValueInUnderlying, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, type WithdrawAssetIntent, type WithdrawCeilings, WithdrawCollateral, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, borrowable, botPermissionsToString, bpsToRay, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isDust, isLPPriceFeed, isMalformedPreviewError, isPhantomToken, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, percentFmt, pickStrategyTargetCollateral, raise, rayToBps, rayToNumber, refuse, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -2,7 +2,7 @@ import { Token, TokenAmount, UnderlyingToken } from "../../model/primitives.js";
2
2
  import { Curator } from "../../model/curators.js";
3
3
  import { Opportunity, OpportunityFilter, PoolOpportunity, PoolOpportunityDetail, PriceFeedSummary, QuotaAsset } from "../../model/opportunities.js";
4
4
  import "../../model/index.js";
5
- import { MarketData } from "../base/types.js";
5
+ import { Asset, MarketData } from "../base/types.js";
6
6
  import { IRWAFactory } from "./rwa/types.js";
7
7
  import { MarketStateHuman } from "../types/state-human.js";
8
8
  import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
@@ -20,6 +20,23 @@ import { SDKConstruct } from "../base/SDKConstruct.js";
20
20
  import "../base/index.js";
21
21
  import { Address } from "viem";
22
22
  //#region src/onchain/market/MarketSuite.d.ts
23
+ /**
24
+ * Oracle estimate of a bag of holdings in this market's underlying.
25
+ *
26
+ * Tokens the oracle cannot price contribute `0` and are named on
27
+ * {@link unpriceable} (the first miss). Callers that speak preview errors map
28
+ * that address to `ERROR_UNPRICEABLE_TOKEN` themselves.
29
+ **/
30
+ interface ValueInUnderlying {
31
+ /**
32
+ * Sum of converted balances, in the pool underlying's decimals.
33
+ **/
34
+ value: bigint;
35
+ /**
36
+ * First token with no price; omitted if every entry converted.
37
+ **/
38
+ unpriceable?: Address;
39
+ }
23
40
  /**
24
41
  * Aggregates all SDK wrappers that make up one Gearbox market.
25
42
  *
@@ -119,6 +136,16 @@ declare class MarketSuite extends SDKConstruct {
119
136
  * not see two.
120
137
  **/
121
138
  toUnderlyingAmount: (value: bigint) => TokenAmount;
139
+ /**
140
+ * Sums `assets` in this market's underlying at latest oracle prices.
141
+ *
142
+ * Balances at or below `minBalance` are ignored. A token the oracle cannot
143
+ * price contributes nothing; the first such token is {@link ValueInUnderlying.unpriceable}.
144
+ *
145
+ * The counterpart of {@link toUnderlyingAmount}: that method labels a figure
146
+ * already in underlying, this one produces the figure from mixed holdings.
147
+ **/
148
+ valueInUnderlying(assets: Asset[], minBalance?: bigint): ValueInUnderlying;
122
149
  /**
123
150
  * Display name of this market's pool, e.g. `"USDC Pool"`.
124
151
  */
@@ -198,4 +225,4 @@ declare class MarketSuite extends SDKConstruct {
198
225
  stateHuman(raw?: boolean): MarketStateHuman;
199
226
  }
200
227
  //#endregion
201
- export { MarketSuite };
228
+ export { MarketSuite, ValueInUnderlying };
@@ -136,7 +136,7 @@ import { LinearInterestRateModelContract } from "./pool/LinearInterestRateModelC
136
136
  import { PoolSuite } from "./pool/PoolSuite.js";
137
137
  import { PoolV310Contract } from "./pool/PoolV310Contract.js";
138
138
  import "./pool/index.js";
139
- import { MarketSuite } from "./MarketSuite.js";
139
+ import { MarketSuite, ValueInUnderlying } from "./MarketSuite.js";
140
140
  import { CreditSuite } from "./credit/CreditSuite.js";
141
141
  import { StrategyCollateralProps, dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./credit/collateralUtils.js";
142
142
  import { ExpectedBalanceDeltasProps, ExpectedOutput, expectedBalanceDeltas } from "./credit/expectedBalanceDeltas.js";
@@ -152,4 +152,4 @@ import "./zapper/index.js";
152
152
  import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./MarketRegister.js";
153
153
  import { DEFAULT_QUOTA_BUFFER_BPS, MAX_LEVERAGE_BUFFER_BPS, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, QuotaMode, StrategyRateInputs, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, healthFactorBps, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, rayToBps, usdToNumber } from "./math.js";
154
154
  import { strategyName } from "./strategyName.js";
155
- export { AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterContractStateHuman, AdapterContractType, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BasicSwapCall, BoundedPriceFeedContract, CamelotPool, CamelotV3AdapterContract, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DStokenData, DaiUsdsAdapterContract, DelayedWithdrawalClaim, DelayedWithdrawalRequest, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FluidDexAdapterContract, GaugeContract, GaugeParams, GetInvestorOptions, GetOpenAccountRequirementsProps, GetReward, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InterestRateModelType, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationFees, MAX_LEVERAGE_BUFFER_BPS, MakerDeposit, MakerRedeem, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PrepareUpdateQuotasProps, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaMode, QuotaSlice, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StakingRewardsAdapterContract, StrategyCollateralProps, StrategyRateInputs, Swap, type TimestampedCalldata, TokenAmount, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, VaultDeposit, VelodromeV2RouterAdapterContract, VersionedAbi, WithdrawCollateral, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, usdToNumber };
155
+ export { AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterContractStateHuman, AdapterContractType, AdapterFactoryArgs, AdapterProtocolOperation, AdapterType, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BasicSwapCall, BoundedPriceFeedContract, CamelotPool, CamelotV3AdapterContract, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, CreditAccountTokenQuota, CreditConfiguratorV310Contract, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DStokenData, DaiUsdsAdapterContract, DelayedWithdrawalClaim, DelayedWithdrawalRequest, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FluidDexAdapterContract, GaugeContract, GaugeParams, GetInvestorOptions, GetOpenAccountRequirementsProps, GetReward, IAdapterContract, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, IPoolContract, IPriceFeedContract, IPriceOracleContract, IRWAFactory, IRateKeeperContract, IUpdatablePriceFeedContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InterestRateModelType, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LatestUpdate, LegacyAdapterOperation, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationFees, MAX_LEVERAGE_BUFFER_BPS, MakerDeposit, MakerRedeem, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolQuotaKeeperContract, PoolSuite, PoolV310Contract, PrepareUpdateQuotasProps, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaMode, QuotaSlice, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RampEvent, RateKeeperType, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOnRampAdapterContract, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StakingRewardsAdapterContract, StrategyCollateralProps, StrategyRateInputs, Swap, type TimestampedCalldata, TokenAmount, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, UpshiftVaultAdapterContract, ValueInUnderlying, VaultDeposit, VelodromeV2RouterAdapterContract, VersionedAbi, WithdrawCollateral, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, usdToNumber };
@@ -32,7 +32,7 @@ import { DetectedDelayedOperation, detectDelayedOperation } from "./preview/dete
32
32
  import { buildDelayedStrategyPositionOperationPreview } from "./preview/buildDelayedStrategyPositionOperationPreview.js";
33
33
  import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
34
34
  import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
35
- import { UnsupportedOperationError } from "./preview/errors.js";
35
+ import { UnsupportedOperationError, unpriceableTokenError } from "./preview/errors.js";
36
36
  import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
37
37
  import { previewAdjustStrategyPosition } from "./preview/previewAdjustStrategyPosition.js";
38
38
  import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./preview/previewExitOrRepayStrategyPosition.js";
@@ -44,4 +44,4 @@ import "./preview/index.js";
44
44
  import { CheckOperationOptions, WeighedFactors, checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./validate/checkOperation.js";
45
45
  import { checkSimulation } from "./validate/checkSimulation.js";
46
46
  import "./validate/index.js";
47
- export { AdapterOperation, AdapterOperationBase, AddCollateralOp, AllowanceDetail, AllowancePrerequisite, AllowanceResult, BalanceDetail, BalancePrerequisite, BalanceResult, type BorrowLimitBinding, CheckOperationOptions, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, FacadeOperationMetadata, FacadeParsedCall, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, type InvalidDelayedIntentError, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, Prerequisite, PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult, type PreviewErrorDetails, type PreviewErrorReason, type PreviewIssue, PreviewOperationError, PreviewOperationInput, PreviewOperationOptions, type PreviewRefusal, type PreviewSimulationError, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, type SimulationError, type SimulationFlowFailure, type SimulationFlowSource, StoreExpectedBalancesOp, TokenTransfer, TraceAdapterExt, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, type UnsupportedZapperFunctionError, UpdateQuotaOp, WeighedFactors, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, asPreviewSimulationError, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, marketIssues, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
47
+ export { AdapterOperation, AdapterOperationBase, AddCollateralOp, AllowanceDetail, AllowancePrerequisite, AllowanceResult, BalanceDetail, BalancePrerequisite, BalanceResult, type BorrowLimitBinding, CheckOperationOptions, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, FacadeOperationMetadata, FacadeParsedCall, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, type InvalidDelayedIntentError, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, Prerequisite, PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult, type PreviewErrorDetails, type PreviewErrorReason, type PreviewIssue, PreviewOperationError, PreviewOperationInput, PreviewOperationOptions, type PreviewRefusal, type PreviewSimulationError, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, type SimulationError, type SimulationFlowFailure, type SimulationFlowSource, StoreExpectedBalancesOp, TokenTransfer, TraceAdapterExt, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, type UnsupportedZapperFunctionError, UpdateQuotaOp, WeighedFactors, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, asPreviewSimulationError, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, marketIssues, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpriceableTokenError };
@@ -13,8 +13,9 @@ import { Address } from "viem";
13
13
  * the claim itself followed by the intent-specific tail
14
14
  *
15
15
  * Pure function: the input states are never mutated and no network access is performed.
16
- * Swaps are estimated with the injected conversion; tokens it cannot price contribute
17
- * nothing and set a non-fatal `ERROR_UNPRICEABLE_TOKEN` error on the
16
+ * Swaps are estimated with the injected conversion; remaining holdings are
17
+ * priced by `MarketSuite.valueInUnderlying`. Tokens that cannot be priced
18
+ * contribute nothing and set a non-fatal `ERROR_UNPRICEABLE_TOKEN` error on the
18
19
  * preview.
19
20
  *
20
21
  * The changes (e.g. `totalDebtChange`) are reported relative to the account
@@ -1,5 +1,7 @@
1
1
  import { IGearboxError } from "../../model/errors.js";
2
+ import { OperationPreviewError } from "../../model/previews.js";
2
3
  import "../../model/index.js";
4
+ import { Address } from "viem";
3
5
  //#region src/preview/preview/errors.d.ts
4
6
  /**
5
7
  * Refusal answered by `previewOperation` for parsed operations it cannot
@@ -11,5 +13,11 @@ interface UnsupportedOperationError extends IGearboxError {
11
13
  /** The parsed operation kind (the `operation` discriminant). */
12
14
  operation: string;
13
15
  }
16
+ /**
17
+ * Preview limitation (2xxx): the oracle could not price `token`. Callers
18
+ * attach this with `error ??=` so a malformed-transaction (1xxx) error
19
+ * already recorded keeps precedence.
20
+ **/
21
+ declare function unpriceableTokenError(token: Address): OperationPreviewError;
14
22
  //#endregion
15
- export { UnsupportedOperationError };
23
+ export { UnsupportedOperationError, unpriceableTokenError };
@@ -3,11 +3,11 @@ import { DetectedDelayedOperation, detectDelayedOperation } from "./detectDelaye
3
3
  import { buildDelayedStrategyPositionOperationPreview } from "./buildDelayedStrategyPositionOperationPreview.js";
4
4
  import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
5
5
  import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
6
- import { UnsupportedOperationError } from "./errors.js";
6
+ import { UnsupportedOperationError, unpriceableTokenError } from "./errors.js";
7
7
  import { estimateClaimableAt } from "./estimateClaimableAt.js";
8
8
  import { previewAdjustStrategyPosition } from "./previewAdjustStrategyPosition.js";
9
9
  import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategyPosition.js";
10
10
  import { PreviewOperationError, previewOperation } from "./previewOperation.js";
11
11
  import { ReplayState, makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
12
12
  import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./replayMulticall.js";
13
- export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
13
+ export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpriceableTokenError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "16.0.0-next.47",
3
+ "version": "16.0.0-next.48",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {