@gearbox-protocol/sdk 16.0.0-next.49 → 16.0.0-next.50

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 (54) hide show
  1. package/dist/cjs/model/index.js +0 -7
  2. package/dist/cjs/model/previews.js +0 -40
  3. package/dist/cjs/onchain/index.js +2 -0
  4. package/dist/cjs/onchain/market/index.js +2 -0
  5. package/dist/cjs/onchain/market/oracle/errors.js +14 -0
  6. package/dist/cjs/onchain/market/oracle/index.js +2 -0
  7. package/dist/cjs/onchain/validation/checks.js +19 -11
  8. package/dist/cjs/preview/index.js +7 -2
  9. package/dist/cjs/preview/preview/buildDelayedStrategyPositionOperationPreview.js +8 -8
  10. package/dist/cjs/preview/preview/errors.js +77 -9
  11. package/dist/cjs/preview/preview/index.js +7 -2
  12. package/dist/cjs/preview/preview/previewAdjustStrategyPosition.js +7 -7
  13. package/dist/cjs/preview/preview/previewExitOrRepayStrategyPosition.js +10 -10
  14. package/dist/cjs/preview/preview/previewOpenStrategyPosition.js +7 -9
  15. package/dist/cjs/preview/preview/replayInnerOperations.js +15 -37
  16. package/dist/cjs/preview/preview/replayMulticall.js +1 -1
  17. package/dist/cjs/preview/preview/unwrapNativeCollateral.js +4 -9
  18. package/dist/cjs/preview/validate/checkOperation.js +1 -1
  19. package/dist/esm/model/index.js +2 -2
  20. package/dist/esm/model/previews.js +1 -34
  21. package/dist/esm/onchain/index.js +2 -1
  22. package/dist/esm/onchain/market/index.js +2 -1
  23. package/dist/esm/onchain/market/oracle/errors.js +13 -0
  24. package/dist/esm/onchain/market/oracle/index.js +2 -1
  25. package/dist/esm/onchain/validation/checks.js +19 -11
  26. package/dist/esm/preview/index.js +2 -2
  27. package/dist/esm/preview/preview/buildDelayedStrategyPositionOperationPreview.js +8 -8
  28. package/dist/esm/preview/preview/errors.js +72 -9
  29. package/dist/esm/preview/preview/index.js +2 -2
  30. package/dist/esm/preview/preview/previewAdjustStrategyPosition.js +7 -7
  31. package/dist/esm/preview/preview/previewExitOrRepayStrategyPosition.js +10 -10
  32. package/dist/esm/preview/preview/previewOpenStrategyPosition.js +8 -10
  33. package/dist/esm/preview/preview/replayInnerOperations.js +15 -37
  34. package/dist/esm/preview/preview/replayMulticall.js +1 -1
  35. package/dist/esm/preview/preview/unwrapNativeCollateral.js +4 -9
  36. package/dist/esm/preview/validate/checkOperation.js +1 -1
  37. package/dist/types/model/index.d.ts +2 -2
  38. package/dist/types/model/previews.d.ts +78 -49
  39. package/dist/types/onchain/index.d.ts +2 -1
  40. package/dist/types/onchain/market/MarketSuite.d.ts +2 -2
  41. package/dist/types/onchain/market/index.d.ts +2 -1
  42. package/dist/types/onchain/market/oracle/errors.d.ts +19 -0
  43. package/dist/types/onchain/market/oracle/index.d.ts +2 -1
  44. package/dist/types/onchain/validation/checks.d.ts +10 -13
  45. package/dist/types/onchain/validation/refusal.d.ts +4 -6
  46. package/dist/types/preview/index.d.ts +2 -2
  47. package/dist/types/preview/preview/buildDelayedStrategyPositionOperationPreview.d.ts +1 -1
  48. package/dist/types/preview/preview/errors.d.ts +27 -6
  49. package/dist/types/preview/preview/index.d.ts +2 -2
  50. package/dist/types/preview/preview/replayInnerOperations.d.ts +2 -2
  51. package/dist/types/preview/preview/replayMulticall.d.ts +1 -1
  52. package/dist/types/preview/preview/unwrapNativeCollateral.d.ts +4 -5
  53. package/dist/types/sdk/prepare/errors.d.ts +5 -3
  54. package/package.json +1 -1
@@ -2,9 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_utils_AssetsMap = require("../../onchain/utils/AssetsMap.js");
3
3
  require("../../onchain/constants/math.js");
4
4
  const require_onchain_market_adapters_contracts_AbstractAdapter = require("../../onchain/market/adapters/contracts/AbstractAdapter.js");
5
- const require_model_previews = require("../../model/previews.js");
6
- require("../../model/index.js");
7
5
  require("../../onchain/index.js");
6
+ const require_preview_preview_errors = require("./errors.js");
8
7
  //#region src/preview/preview/replayInnerOperations.ts
9
8
  /**
10
9
  * Creates a {@link ReplayState} around the given account seed, with empty
@@ -22,16 +21,16 @@ function makeReplayState(account) {
22
21
  * facade execution order. The result is the *minimal guaranteed* post-state.
23
22
  *
24
23
  * The function assumes that the call was generated by our frontend using
25
- * router/withdrawal compressor, otherwise it returns an error, but still
24
+ * router/withdrawal compressor, otherwise it returns a warning, but still
26
25
  * proceeds best-effort.
27
26
  *
28
- * @returns `undefined` on success, the error on a malformed multicall.
27
+ * @returns `undefined` on success, the warning on a malformed multicall.
29
28
  */
30
29
  function replayInnerOperations(sdk, multicall, state) {
31
30
  let inBracket = false;
32
- let error;
31
+ let warning;
33
32
  for (const op of multicall) {
34
- let opError;
33
+ let opWarning;
35
34
  switch (op.operation) {
36
35
  case "AddCollateral":
37
36
  applyAddCollateral(state, op);
@@ -49,29 +48,20 @@ function replayInnerOperations(sdk, multicall, state) {
49
48
  state.account.updateQuota(op.token, op.change);
50
49
  break;
51
50
  case "StoreExpectedBalances":
52
- if (inBracket) opError = {
53
- code: require_model_previews.ERROR_MALFORMED_BRACKET,
54
- message: "nested storeExpectedBalances/compareBalances bracket"
55
- };
51
+ if (inBracket) opWarning = require_preview_preview_errors.malformedBracketError("nested");
56
52
  inBracket = true;
57
53
  for (const { token, balance } of op.deltas) state.account.balances.inc(token, balance);
58
54
  break;
59
55
  case "CompareBalances":
60
- if (!inBracket) opError = {
61
- code: require_model_previews.ERROR_MALFORMED_BRACKET,
62
- message: "compareBalances without a preceding storeExpectedBalances"
63
- };
56
+ if (!inBracket) opWarning = require_preview_preview_errors.malformedBracketError("unmatchedCompare");
64
57
  inBracket = false;
65
58
  break;
66
- case "Execute": opError = applyExecute(sdk, op, inBracket, state.account.balances);
59
+ case "Execute": opWarning = applyExecute(sdk, op, inBracket, state.account.balances);
67
60
  }
68
- error ??= opError;
61
+ warning ??= opWarning;
69
62
  }
70
- if (inBracket) error ??= {
71
- code: require_model_previews.ERROR_MALFORMED_BRACKET,
72
- message: "storeExpectedBalances without a matching compareBalances"
73
- };
74
- return error;
63
+ if (inBracket) warning ??= require_preview_preview_errors.malformedBracketError("unmatchedStore");
64
+ return warning;
75
65
  }
76
66
  function applyAddCollateral(state, op) {
77
67
  state.collateralAdded.inc(op.token, op.amount);
@@ -102,28 +92,16 @@ function applyExecute(sdk, op, inBracket, balances) {
102
92
  if (adapter instanceof require_onchain_market_adapters_contracts_AbstractAdapter.AbstractAdapterContract) try {
103
93
  if (adapter.replayOutOfBracketCall(balances, op.calldata)) return;
104
94
  } catch (e) {
105
- return {
106
- code: require_model_previews.ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL,
107
- message: e instanceof Error ? e.message : String(e)
108
- };
95
+ return require_preview_preview_errors.unsupportedOutOfBracketCallError(op.adapter, e);
109
96
  }
110
- return {
111
- code: require_model_previews.ERROR_ADAPTER_CALL_OUTSIDE_BRACKET,
112
- message: `call to ${op.adapter} outside of a storeExpectedBalances/compareBalances bracket`
113
- };
97
+ return require_preview_preview_errors.adapterCallOutsideBracketError(op.adapter);
114
98
  }
115
- if (!(adapter instanceof require_onchain_market_adapters_contracts_AbstractAdapter.AbstractAdapterContract)) return {
116
- code: require_model_previews.ERROR_NON_ADAPTER_CALL_IN_BRACKET,
117
- message: `call to ${op.adapter} between storeExpectedBalances and compareBalances is not an adapter call`
118
- };
99
+ if (!(adapter instanceof require_onchain_market_adapters_contracts_AbstractAdapter.AbstractAdapterContract)) return require_preview_preview_errors.nonAdapterCallInBracketError(op.adapter);
119
100
  try {
120
101
  adapter.previewBalanceChanges(balances, op.calldata);
121
102
  return;
122
103
  } catch (e) {
123
- return {
124
- code: require_model_previews.ERROR_UNPREVIEWABLE_ADAPTER_CALL,
125
- message: e instanceof Error ? e.message : String(e)
126
- };
104
+ return require_preview_preview_errors.unpreviewableAdapterCallError(op.adapter, e);
127
105
  }
128
106
  }
129
107
  //#endregion
@@ -12,7 +12,7 @@ function replayMulticall(sdk, operation, options) {
12
12
  return {
13
13
  before,
14
14
  after,
15
- error: require_preview_preview_replayInnerOperations.replayInnerOperations(sdk, operation.multicall, after)
15
+ warning: require_preview_preview_replayInnerOperations.replayInnerOperations(sdk, operation.multicall, after)
16
16
  };
17
17
  }
18
18
  //#endregion
@@ -1,9 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_utils_AssetsMap = require("../../onchain/utils/AssetsMap.js");
3
3
  const require_onchain_constants_addresses = require("../../onchain/constants/addresses.js");
4
- const require_model_previews = require("../../model/previews.js");
5
- require("../../model/index.js");
6
4
  require("../../onchain/index.js");
5
+ const require_preview_preview_errors = require("./errors.js");
7
6
  //#region src/preview/preview/unwrapNativeCollateral.ts
8
7
  /**
9
8
  * Represents the transaction's attached native value as a `NATIVE_ADDRESS`
@@ -17,14 +16,13 @@ require("../../onchain/index.js");
17
16
  *
18
17
  * When `nativeAmount` is positive but the WETH collateral is missing or
19
18
  * smaller than it, the transaction is malformed: the collateral is returned
20
- * as-is (no unwrapping) together with an `ERROR_INVALID_TRANSACTION_VALUE`
21
- * error.
19
+ * as-is (no unwrapping) together with an `invalidTransactionValue` warning.
22
20
  *
23
21
  * @param collateral - Collateral assets as declared by the multicall.
24
22
  * @param nativeAmount - Transaction `msg.value`.
25
23
  * @param wethToken - Wrapped native token address.
26
24
  * @returns Collateral with the native amount unwrapped from the WETH entry,
27
- * plus the error on a malformed transaction value.
25
+ * plus the warning on a malformed transaction value.
28
26
  */
29
27
  function unwrapNativeCollateral(collateral, nativeAmount, wethToken) {
30
28
  if (nativeAmount === 0n) return { assets: collateral };
@@ -32,10 +30,7 @@ function unwrapNativeCollateral(collateral, nativeAmount, wethToken) {
32
30
  const wethBalance = balances.get(wethToken) ?? 0n;
33
31
  if (wethBalance < nativeAmount) return {
34
32
  assets: collateral,
35
- error: {
36
- code: require_model_previews.ERROR_INVALID_TRANSACTION_VALUE,
37
- message: `transaction value ${nativeAmount} exceeds WETH collateral ${wethBalance}`
38
- }
33
+ warning: require_preview_preview_errors.invalidTransactionValueError(nativeAmount, wethBalance)
39
34
  };
40
35
  balances.upsert(wethToken, wethBalance === nativeAmount ? void 0 : wethBalance - nativeAmount);
41
36
  balances.inc(require_onchain_constants_addresses.NATIVE_ADDRESS, nativeAmount);
@@ -16,7 +16,7 @@ let viem = require("viem");
16
16
  */
17
17
  function checkOperation(input, options = {}) {
18
18
  const { sdk, preview } = input;
19
- const malformed = require_onchain_validation_checks.checkPreviewError("error" in preview ? preview.error : void 0);
19
+ const malformed = require_onchain_validation_checks.checkPreviewError("warning" in preview ? preview.warning : void 0);
20
20
  if (malformed) return malformed;
21
21
  switch (preview.operation) {
22
22
  case "Deposit":
@@ -16,11 +16,11 @@ import { matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpp
16
16
  import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
17
17
  import { STRATEGY_POSITION_COLLATERAL_ERROR, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
18
18
  import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
19
- import { ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, asEstimated } from "./previews.js";
19
+ import { asEstimated } from "./previews.js";
20
20
  import "./primitives.js";
21
21
  import "./response.js";
22
22
  import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
23
23
  import { isSDKError, sdkErr, sdkOk } from "./result.js";
24
24
  import "./withdrawals.js";
25
25
  import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
26
- export { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, isSDKError, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, withdrawalOutputAmountSchema };
26
+ export { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, FILTER_ALL, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, isSDKError, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, withdrawalOutputAmountSchema };
@@ -1,38 +1,5 @@
1
1
  //#region src/model/previews.ts
2
2
  /**
3
- * Broken `storeExpectedBalances`/`compareBalances` bracket structure:
4
- * `storeExpectedBalances` without a matching `compareBalances`, nested
5
- * brackets, or `compareBalances` without a preceding `storeExpectedBalances`.
6
- * We expect transactions that were generated by our frontend using router/withdrawal compressor
7
- **/
8
- const ERROR_MALFORMED_BRACKET = 1001;
9
- /**
10
- * Adapter call outside a `storeExpectedBalances`/`compareBalances` bracket
11
- * We expect transactions that were generated by our frontend using router/withdrawal compressor,
12
- **/
13
- const ERROR_ADAPTER_CALL_OUTSIDE_BRACKET = 1002;
14
- /**
15
- * Bracketed call whose target is not an adapter (or adapter that is not known to the SDK)
16
- **/
17
- const ERROR_NON_ADAPTER_CALL_IN_BRACKET = 1003;
18
- /**
19
- * Bracketed adapter call cannot be replayed (undecodable/unsupported calldata)
20
- **/
21
- const ERROR_UNPREVIEWABLE_ADAPTER_CALL = 1004;
22
- /**
23
- * An out-of-bracket adapter call that is allowed there (e.g. RWA wrap/unwrap)
24
- * could not be decoded or replayed
25
- **/
26
- const ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL = 1005;
27
- /**
28
- * `msg.value` does not fit into the declared WETH collateral
29
- * Transactions can have arbitrary value, but the ones that we create
30
- * using our frontend should have a value that fits into the declared WETH collateral.
31
- **/
32
- const ERROR_INVALID_TRANSACTION_VALUE = 1006;
33
- /** A token in the preview could not be priced by the oracle */
34
- const ERROR_UNPRICEABLE_TOKEN = 2001;
35
- /**
36
3
  * Renames a projection's routed fields, for a caller that built one from floor
37
4
  * balances.
38
5
  *
@@ -55,4 +22,4 @@ function asEstimated(p) {
55
22
  };
56
23
  }
57
24
  //#endregion
58
- export { ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, asEstimated };
25
+ export { asEstimated };
@@ -171,6 +171,7 @@ import { ZeroPriceFeedContract } from "./market/pricefeeds/ZeroPriceFeed.js";
171
171
  import { PriceFeedRegister } from "./market/pricefeeds/PriceFeedsRegister.js";
172
172
  import { PriceOracleV310Contract } from "./market/oracle/PriceOracleV310Contract.js";
173
173
  import { createPriceOracle } from "./market/oracle/createPriceOracle.js";
174
+ import { unpriceableTokenError } from "./market/oracle/errors.js";
174
175
  import { GaugeContract } from "./market/pool/GaugeContract.js";
175
176
  import { LinearInterestRateModelContract } from "./market/pool/LinearInterestRateModelContract.js";
176
177
  import { PoolV310Contract } from "./market/pool/PoolV310Contract.js";
@@ -244,4 +245,4 @@ import { MultichainSDK } from "./MultichainSDK.js";
244
245
  import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
245
246
  import "./types/index.js";
246
247
  import "./validation/index.js";
247
- 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, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, 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, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, 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, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, 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, abi as creditFacadeV310Abi, 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 };
248
+ 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, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountMigratorAdapterContract, AdapterType, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LidoV1AdapterContract, LinearInterestRateModelContract, LiquidationsService, 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, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, 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, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, SimulateWithPriceUpdatesError, SimulationError, StakingRewardsAdapterContract, TokensMeta, TraderJoePoolVersion, TraderJoeRouterAdapterContract, TypedObjectUtils, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VERSION_RANGE_310, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, 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, abi as creditFacadeV310Abi, 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, unpriceableTokenError, usdToNumber, watchBlocksAsync };
@@ -121,6 +121,7 @@ import { PriceFeedRegister } from "./pricefeeds/PriceFeedsRegister.js";
121
121
  import "./pricefeeds/index.js";
122
122
  import { PriceOracleV310Contract } from "./oracle/PriceOracleV310Contract.js";
123
123
  import { createPriceOracle } from "./oracle/createPriceOracle.js";
124
+ import { unpriceableTokenError } from "./oracle/errors.js";
124
125
  import "./oracle/index.js";
125
126
  import { GaugeContract } from "./pool/GaugeContract.js";
126
127
  import { LinearInterestRateModelContract } from "./pool/LinearInterestRateModelContract.js";
@@ -144,4 +145,4 @@ import { RWARegistry } from "./rwa/RWARegistry.js";
144
145
  import { RWA_FACTORY_TYPES, isRWAFactory } from "./rwa/types.js";
145
146
  import "./rwa/index.js";
146
147
  import "./types.js";
147
- export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, 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 };
148
+ export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, 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, unpriceableTokenError, usdToNumber };
@@ -0,0 +1,13 @@
1
+ //#region src/onchain/market/oracle/errors.ts
2
+ /**
3
+ * Builds an {@link UnpriceableTokenError} for `token`.
4
+ **/
5
+ function unpriceableTokenError(token) {
6
+ return {
7
+ code: "unpriceableToken",
8
+ message: `cannot price token ${token}`,
9
+ token
10
+ };
11
+ }
12
+ //#endregion
13
+ export { unpriceableTokenError };
@@ -1,5 +1,6 @@
1
1
  import { collateralPriceInUnderlying } from "./collateralPriceInUnderlying.js";
2
2
  import { PriceOracleV310Contract } from "./PriceOracleV310Contract.js";
3
3
  import { createPriceOracle } from "./createPriceOracle.js";
4
+ import { unpriceableTokenError } from "./errors.js";
4
5
  import "./types.js";
5
- export { PriceOracleV310Contract, collateralPriceInUnderlying, createPriceOracle };
6
+ export { PriceOracleV310Contract, collateralPriceInUnderlying, createPriceOracle, unpriceableTokenError };
@@ -207,24 +207,32 @@ function checkFunding(args) {
207
207
  /**
208
208
  * The SDK could not replay the transaction.
209
209
  *
210
- * Only the 1xxx class lands here. A 2xxx error says the transaction is fine and
211
- * the SDK could not fully evaluate it, which is a caveat on the numbers rather
212
- * than a reason to refuse — it stays on the preview for the caller to surface.
210
+ * Only a {@link MalformedPreviewError} lands here. An `unpriceableToken`
211
+ * warning says the transaction is fine and the SDK could not fully evaluate
212
+ * it, which is a caveat on the numbers rather than a reason to refuse — it
213
+ * stays on the preview for the caller to surface.
213
214
  */
214
- function checkPreviewError(error) {
215
- if (!error || !isMalformedPreviewError(error)) return null;
215
+ function checkPreviewError(warning) {
216
+ if (!warning || !isMalformedPreviewError(warning)) return null;
216
217
  return {
217
218
  reason: "malformedTransaction",
218
- detail: error
219
+ detail: warning
219
220
  };
220
221
  }
221
222
  /**
222
- * The class boundary the preview error codes are written against: 1xxx means
223
- * the transaction itself is malformed, 2xxx that only the evaluation was
224
- * incomplete. A range, so a future 1007 classifies itself.
223
+ * Whether the preview warning means the transaction itself is malformed,
224
+ * rather than that only the evaluation was incomplete.
225
225
  */
226
- function isMalformedPreviewError(error) {
227
- return error.code >= 1e3 && error.code < 2e3;
226
+ function isMalformedPreviewError(warning) {
227
+ switch (warning.code) {
228
+ case "malformedBracket":
229
+ case "adapterCallOutsideBracket":
230
+ case "nonAdapterCallInBracket":
231
+ case "unpreviewableAdapterCall":
232
+ case "unsupportedOutOfBracketCall":
233
+ case "invalidTransactionValue": return true;
234
+ default: return false;
235
+ }
228
236
  }
229
237
  //#endregion
230
238
  export { 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 };
@@ -17,12 +17,12 @@ 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";
21
20
  import { buildDelayedStrategyPositionOperationPreview } from "./preview/buildDelayedStrategyPositionOperationPreview.js";
22
21
  import { CreditAccountState } from "./preview/CreditAccountState.js";
23
22
  import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
24
23
  import { detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
25
24
  import { detectDelayedOperation } from "./preview/detectDelayedOperation.js";
25
+ import { adapterCallOutsideBracketError, invalidTransactionValueError, malformedBracketError, nonAdapterCallInBracketError, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError } from "./preview/errors.js";
26
26
  import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
27
27
  import { makeReplayState, replayInnerOperations } from "./preview/replayInnerOperations.js";
28
28
  import { replayMulticall } from "./preview/replayMulticall.js";
@@ -35,4 +35,4 @@ import "./types.js";
35
35
  import { checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./validate/checkOperation.js";
36
36
  import { checkSimulation } from "./validate/checkSimulation.js";
37
37
  import "./validate/index.js";
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 };
38
+ export { AllowancePrerequisite, BalancePrerequisite, CreditAccountState, Prerequisite, RWAOpenRequirementsPrerequisite, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, WithdrawCollateralAlignmentError, adapterCallOutsideBracketError, asPreviewSimulationError, buildDelayedStrategyPositionOperationPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssue, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, extractAdapterCallTraces, extractTransfers, findFacadeCalls, invalidTransactionValueError, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, malformedBracketError, marketIssues, nonAdapterCallInBracketError, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, quotaCountIssue, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError };
@@ -3,8 +3,8 @@ import { BigIntMath } from "../../onchain/utils/bigint-math.js";
3
3
  import { DUST_THRESHOLD } from "../../onchain/constants/math.js";
4
4
  import { asEstimated } from "../../model/previews.js";
5
5
  import "../../model/index.js";
6
+ import { unpriceableTokenError } from "../../onchain/market/oracle/errors.js";
6
7
  import "../../onchain/index.js";
7
- import { unpriceableTokenError } from "./errors.js";
8
8
  import { isAddressEqual } from "viem";
9
9
  //#region src/preview/preview/buildDelayedStrategyPositionOperationPreview.ts
10
10
  /**
@@ -15,7 +15,7 @@ import { isAddressEqual } from "viem";
15
15
  * Pure function: the input states are never mutated and no network access is performed.
16
16
  * Swaps are estimated with the injected conversion; remaining holdings are
17
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
+ * contribute nothing and set a non-fatal `unpriceableToken` warning on the
19
19
  * preview.
20
20
  *
21
21
  * The changes (e.g. `totalDebtChange`) are reported relative to the account
@@ -46,18 +46,18 @@ function buildDelayedStrategyPositionOperationPreview(afterInstant, before, dete
46
46
  return buildAdjustPreview(post, before, collateralWithdrawn, converter, sdk);
47
47
  }
48
48
  function makeSafeConverter(convert) {
49
- let error;
49
+ let warning;
50
50
  return {
51
51
  convert: (token, to, amount) => {
52
52
  try {
53
53
  return convert(token, to, amount);
54
54
  } catch {
55
- error ??= unpriceableTokenError(token);
55
+ warning ??= unpriceableTokenError(token);
56
56
  return 0n;
57
57
  }
58
58
  },
59
- get error() {
60
- return error;
59
+ get warning() {
60
+ return warning;
61
61
  }
62
62
  };
63
63
  }
@@ -170,7 +170,7 @@ function buildClosePreview(post, converter, receivedToken, sdk) {
170
170
  name: suite.accountStrategyName(post.creditAccount),
171
171
  targetCollateral: suite.accountTargetCollateral(post.creditAccount),
172
172
  receivedAmount: oracle.toTokenAmount(receivedToken, BigIntMath.max(priced.value - post.totalDebt, 0n)),
173
- error: converter.error ?? (priced.unpriceable ? unpriceableTokenError(priced.unpriceable) : void 0)
173
+ warning: converter.warning ?? (priced.unpriceable ? unpriceableTokenError(priced.unpriceable) : void 0)
174
174
  };
175
175
  }
176
176
  function buildAdjustPreview(post, before, collateralWithdrawn, converter, sdk) {
@@ -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 ?? (priced.unpriceable ? unpriceableTokenError(priced.unpriceable) : void 0)
196
+ warning: converter.warning ?? (priced.unpriceable ? unpriceableTokenError(priced.unpriceable) : void 0)
197
197
  };
198
198
  }
199
199
  //#endregion
@@ -1,16 +1,79 @@
1
- import { ERROR_UNPRICEABLE_TOKEN } from "../../model/previews.js";
2
- import "../../model/index.js";
3
1
  //#region src/preview/preview/errors.ts
2
+ const MALFORMED_BRACKET_MESSAGE = {
3
+ nested: "nested storeExpectedBalances/compareBalances bracket",
4
+ unmatchedCompare: "compareBalances without a preceding storeExpectedBalances",
5
+ unmatchedStore: "storeExpectedBalances without a matching compareBalances"
6
+ };
4
7
  /**
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
+ * Builds a {@link MalformedBracketError} for the given bracket invariant.
8
9
  **/
9
- function unpriceableTokenError(token) {
10
+ function malformedBracketError(kind) {
10
11
  return {
11
- code: ERROR_UNPRICEABLE_TOKEN,
12
- message: `cannot price token ${token}`
12
+ code: "malformedBracket",
13
+ message: MALFORMED_BRACKET_MESSAGE[kind],
14
+ kind
15
+ };
16
+ }
17
+ /**
18
+ * Builds an {@link AdapterCallOutsideBracketError} for `adapter`.
19
+ **/
20
+ function adapterCallOutsideBracketError(adapter) {
21
+ return {
22
+ code: "adapterCallOutsideBracket",
23
+ message: `call to ${adapter} outside of a storeExpectedBalances/compareBalances bracket`,
24
+ adapter
25
+ };
26
+ }
27
+ /**
28
+ * Builds a {@link NonAdapterCallInBracketError} for `target`.
29
+ **/
30
+ function nonAdapterCallInBracketError(target) {
31
+ return {
32
+ code: "nonAdapterCallInBracket",
33
+ message: `call to ${target} between storeExpectedBalances and compareBalances is not an adapter call`,
34
+ target
35
+ };
36
+ }
37
+ function asCause(cause) {
38
+ return cause instanceof Error ? cause : new Error(String(cause));
39
+ }
40
+ /**
41
+ * Builds an {@link UnpreviewableAdapterCallError} for a bracketed adapter
42
+ * call that could not be replayed.
43
+ **/
44
+ function unpreviewableAdapterCallError(adapter, cause) {
45
+ const err = asCause(cause);
46
+ return {
47
+ code: "unpreviewableAdapterCall",
48
+ message: err.message,
49
+ adapter,
50
+ cause: err
51
+ };
52
+ }
53
+ /**
54
+ * Builds an {@link UnsupportedOutOfBracketCallError} for an allowed
55
+ * out-of-bracket adapter call that could not be replayed.
56
+ **/
57
+ function unsupportedOutOfBracketCallError(adapter, cause) {
58
+ const err = asCause(cause);
59
+ return {
60
+ code: "unsupportedOutOfBracketCall",
61
+ message: err.message,
62
+ adapter,
63
+ cause: err
64
+ };
65
+ }
66
+ /**
67
+ * Builds an {@link InvalidTransactionValueError} when `msg.value` does not
68
+ * fit into the declared WETH collateral.
69
+ **/
70
+ function invalidTransactionValueError(value, wethCollateral) {
71
+ return {
72
+ code: "invalidTransactionValue",
73
+ message: `transaction value ${value} exceeds WETH collateral ${wethCollateral}`,
74
+ value,
75
+ wethCollateral
13
76
  };
14
77
  }
15
78
  //#endregion
16
- export { unpriceableTokenError };
79
+ export { adapterCallOutsideBracketError, invalidTransactionValueError, malformedBracketError, nonAdapterCallInBracketError, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError };
@@ -1,13 +1,13 @@
1
- import { unpriceableTokenError } from "./errors.js";
2
1
  import { buildDelayedStrategyPositionOperationPreview } from "./buildDelayedStrategyPositionOperationPreview.js";
3
2
  import { CreditAccountState } from "./CreditAccountState.js";
4
3
  import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
5
4
  import { detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
6
5
  import { detectDelayedOperation } from "./detectDelayedOperation.js";
6
+ import { adapterCallOutsideBracketError, invalidTransactionValueError, malformedBracketError, nonAdapterCallInBracketError, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError } from "./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, unpriceableTokenError };
13
+ export { CreditAccountState, adapterCallOutsideBracketError, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, invalidTransactionValueError, isCloseOrRepay, makeReplayState, malformedBracketError, nonAdapterCallInBracketError, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, unpreviewableAdapterCallError, unsupportedOutOfBracketCallError };
@@ -2,8 +2,8 @@ import { AP_WETH_TOKEN } from "../../onchain/constants/address-provider.js";
2
2
  import { DUST_THRESHOLD } from "../../onchain/constants/math.js";
3
3
  import { asEstimated } from "../../model/previews.js";
4
4
  import "../../model/index.js";
5
+ import { unpriceableTokenError } from "../../onchain/market/oracle/errors.js";
5
6
  import "../../onchain/index.js";
6
- import { unpriceableTokenError } from "./errors.js";
7
7
  import { replayMulticall } from "./replayMulticall.js";
8
8
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
9
9
  //#region src/preview/preview/previewAdjustStrategyPosition.ts
@@ -19,14 +19,14 @@ function previewAdjustStrategyPosition(input, operation, options) {
19
19
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
20
20
  const suite = sdk.marketRegister.findCreditManager(operation.creditManager);
21
21
  const oracle = market.priceOracle;
22
- const { before, after, error: replayError } = replayMulticall(sdk, operation, options);
22
+ const { before, after, warning: replayWarning } = replayMulticall(sdk, operation, options);
23
23
  const account = after.account;
24
- let error = replayError;
25
- const { assets: collateralAdded, error: unwrapError } = unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
26
- error ??= unwrapError;
24
+ let warning = replayWarning;
25
+ const { assets: collateralAdded, warning: unwrapWarning } = unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
26
+ warning ??= unwrapWarning;
27
27
  const assetsChange = account.balances.difference(before.balances).toAssets(DUST_THRESHOLD);
28
28
  const priced = market.valueInUnderlying(account.balances.toAssets());
29
- if (priced.unpriceable) error ??= unpriceableTokenError(priced.unpriceable);
29
+ if (priced.unpriceable) warning ??= unpriceableTokenError(priced.unpriceable);
30
30
  const snap = account.toSnapshot(priced.value);
31
31
  return {
32
32
  operation: "AdjustCreditAccount",
@@ -42,7 +42,7 @@ function previewAdjustStrategyPosition(input, operation, options) {
42
42
  ...oracle.toAmount(market.underlying, q.balance)
43
43
  })),
44
44
  assetsChange: assetsChange.map((a) => oracle.toTokenAmount(a.token, a.balance)),
45
- error
45
+ warning
46
46
  };
47
47
  }
48
48
  //#endregion