@gearbox-protocol/sdk 16.0.0-next.19 → 16.0.0-next.20

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 (36) hide show
  1. package/dist/cjs/onchain/accounts/intents/index.js +1 -1
  2. package/dist/cjs/onchain/accounts/intents/leverage-band.js +1 -3
  3. package/dist/cjs/onchain/accounts/intents/open-strategy.js +2 -3
  4. package/dist/cjs/onchain/accounts/intents/realize.js +1 -2
  5. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +9 -0
  6. package/dist/cjs/onchain/accounts/intents/utils/index.js +0 -2
  7. package/dist/cjs/onchain/accounts/intents/utils/pick-token.js +2 -2
  8. package/dist/cjs/onchain/accounts/intents/utils/router-path.js +2 -2
  9. package/dist/cjs/onchain/accounts/intents/view.js +4 -4
  10. package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
  11. package/dist/esm/onchain/accounts/intents/index.js +1 -1
  12. package/dist/esm/onchain/accounts/intents/leverage-band.js +1 -3
  13. package/dist/esm/onchain/accounts/intents/open-strategy.js +2 -3
  14. package/dist/esm/onchain/accounts/intents/realize.js +1 -2
  15. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +9 -0
  16. package/dist/esm/onchain/accounts/intents/utils/index.js +1 -2
  17. package/dist/esm/onchain/accounts/intents/utils/pick-token.js +2 -2
  18. package/dist/esm/onchain/accounts/intents/utils/router-path.js +2 -2
  19. package/dist/esm/onchain/accounts/intents/view.js +4 -4
  20. package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
  21. package/dist/types/onchain/accounts/intents/plan.d.ts +1 -1
  22. package/dist/types/onchain/accounts/intents/utils/index.d.ts +2 -3
  23. package/dist/types/onchain/accounts/intents/utils/ledger.d.ts +2 -2
  24. package/dist/types/onchain/accounts/intents/utils/quotas-for-update.d.ts +1 -1
  25. package/dist/types/onchain/accounts/intents/view.d.ts +2 -2
  26. package/dist/types/onchain/index.d.ts +2 -2
  27. package/dist/types/onchain/market/index.d.ts +2 -2
  28. package/dist/types/onchain/market/oracle/index.d.ts +2 -2
  29. package/dist/types/onchain/market/oracle/types.d.ts +7 -1
  30. package/dist/types/preview/index.d.ts +2 -2
  31. package/dist/types/preview/preview/buildDelayedPreview.d.ts +2 -5
  32. package/dist/types/preview/preview/index.d.ts +2 -2
  33. package/package.json +1 -1
  34. package/dist/cjs/onchain/accounts/intents/utils/convert-amount.js +0 -37
  35. package/dist/esm/onchain/accounts/intents/utils/convert-amount.js +0 -36
  36. package/dist/types/onchain/accounts/intents/utils/convert-amount.d.ts +0 -13
@@ -3,10 +3,10 @@ const require_onchain_base_SDKConstruct = require("../../base/SDKConstruct.js");
3
3
  const require_onchain_validation_checks = require("../../validation/checks.js");
4
4
  const require_onchain_validation_refusal = require("../../validation/refusal.js");
5
5
  const require_onchain_accounts_intents_guards = require("./guards.js");
6
- const require_onchain_accounts_intents_utils_credit_account_slice = require("./utils/credit-account-slice.js");
7
6
  const require_onchain_accounts_intents_leverage_band = require("./leverage-band.js");
8
7
  const require_onchain_accounts_intents_math = require("./math.js");
9
8
  const require_onchain_accounts_intents_maxWithdrawCollateral = require("./maxWithdrawCollateral.js");
9
+ const require_onchain_accounts_intents_utils_credit_account_slice = require("./utils/credit-account-slice.js");
10
10
  const require_onchain_accounts_intents_open_strategy = require("./open-strategy.js");
11
11
  const require_onchain_accounts_intents_plan = require("./plan.js");
12
12
  const require_onchain_accounts_intents_realize = require("./realize.js");
@@ -1,8 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_utils_bigint_math = require("../../utils/bigint-math.js");
3
3
  const require_onchain_constants_math = require("../../constants/math.js");
4
- const require_onchain_accounts_intents_utils_convert_amount = require("./utils/convert-amount.js");
5
- require("./utils/index.js");
6
4
  //#region src/onchain/accounts/intents/leverage-band.ts
7
5
  /**
8
6
  * The leverages this market will actually fund for a position of this size.
@@ -39,7 +37,7 @@ function calcLeverageBand({ sdk, creditManager, collateral, targetHF }) {
39
37
  if (!target) return;
40
38
  const ceiling = suite.creditManager.maxLeverage(target, targetHF);
41
39
  const underlying = market.pool.underlying;
42
- const convert = require_onchain_accounts_intents_utils_convert_amount.convertAmount(sdk, creditManager);
40
+ const convert = (from, to, amount) => market.priceOracle.safeConvert(from, to, amount) ?? 0n;
43
41
  const netValue = collateral.reduce((acc, a) => acc + convert(a.token, underlying, a.balance), 0n);
44
42
  if (netValue <= 0n) return {
45
43
  min: 1,
@@ -1,12 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_validation_refusal = require("../../validation/refusal.js");
3
- const require_onchain_accounts_intents_utils_convert_amount = require("./utils/convert-amount.js");
4
3
  const require_onchain_accounts_intents_guards = require("./guards.js");
4
+ const require_onchain_accounts_intents_math = require("./math.js");
5
5
  const require_onchain_accounts_intents_utils_price_impact = require("./utils/price-impact.js");
6
6
  const require_onchain_accounts_intents_utils_quotas_for_update = require("./utils/quotas-for-update.js");
7
7
  const require_onchain_accounts_intents_utils_router_path = require("./utils/router-path.js");
8
8
  require("./utils/index.js");
9
- const require_onchain_accounts_intents_math = require("./math.js");
10
9
  //#region src/onchain/accounts/intents/open-strategy.ts
11
10
  /** Stand-in account address: nothing exists on chain until the tx lands. */
12
11
  const NO_ACCOUNT = "0x0000000000000000000000000000000000000000";
@@ -28,7 +27,7 @@ async function previewOpenStrategy(props) {
28
27
  const market = sdk.marketRegister.findByCreditManager(creditManager);
29
28
  require_onchain_accounts_intents_guards.assertMarketOperable(suite);
30
29
  const underlying = market.pool.underlying.toLowerCase();
31
- const convert = require_onchain_accounts_intents_utils_convert_amount.convertAmount(sdk, creditManager);
30
+ const convert = (from, to, amount) => market.priceOracle.safeConvert(from, to, amount) ?? 0n;
32
31
  const margin = collateral.reduce((acc, a) => acc + convert(a.token, underlying, a.balance), 0n);
33
32
  if (margin <= 0n) throw new require_onchain_validation_refusal.IntentPreviewError("insufficientSourceBalance", void 0, "openStrategy: collateral is worth nothing in underlying");
34
33
  const debt = require_onchain_accounts_intents_math.debtForLeverage(margin, leverage);
@@ -3,7 +3,6 @@ const require_onchain_market_math = require("../../market/math.js");
3
3
  const require_onchain_validation_refusal = require("../../validation/refusal.js");
4
4
  const require_onchain_validation_token = require("../../validation/token.js");
5
5
  const require_onchain_accounts_intents_utils_common = require("./utils/common.js");
6
- const require_onchain_accounts_intents_utils_convert_amount = require("./utils/convert-amount.js");
7
6
  const require_onchain_accounts_intents_utils_pick_token = require("./utils/pick-token.js");
8
7
  const require_onchain_accounts_intents_guards = require("./guards.js");
9
8
  const require_onchain_accounts_intents_utils_ledger = require("./utils/ledger.js");
@@ -26,13 +25,13 @@ async function realize(steps, props) {
26
25
  const { creditAccount, sdk, slippage, quotaReserve } = props;
27
26
  const { underlying } = creditAccount;
28
27
  const rwaAsset = sdk.tokensMeta.rwaUnderlyings.get(underlying)?.asset;
29
- const price = require_onchain_accounts_intents_utils_convert_amount.convertAmount(sdk, creditAccount.creditManager);
30
28
  const paths = props.paths ?? require_onchain_accounts_intents_utils_router_path.createRouterPaths({
31
29
  sdk,
32
30
  creditAccount,
33
31
  slippage
34
32
  });
35
33
  const market = sdk.marketRegister.findByCreditManager(creditAccount.creditManager);
34
+ const price = (from, to, amount) => market.priceOracle.safeConvert(from, to, amount) ?? 0n;
36
35
  const suite = sdk.marketRegister.findCreditManager(creditAccount.creditManager);
37
36
  const ledger = new require_onchain_accounts_intents_utils_ledger.OperationLedger({
38
37
  initialAssets: creditAccount.tokens,
@@ -81,11 +81,19 @@ function buildMockSdk(args) {
81
81
  const convert = (token, to, amount) => {
82
82
  const from = token.toLowerCase();
83
83
  const target = to.toLowerCase();
84
+ if (from === target) return amount;
84
85
  const fromPrice = args.prices[from];
85
86
  const toPrice = args.prices[target];
86
87
  if (fromPrice === void 0 || toPrice === void 0) throw new Error(`mock priceOracle: missing price for ${from} or ${target}`);
87
88
  return amount * fromPrice * 10n ** BigInt(decimalsOf(target)) / (toPrice * 10n ** BigInt(decimalsOf(from)));
88
89
  };
90
+ const safeConvert = (token, to, amount) => {
91
+ try {
92
+ return convert(token, to, amount);
93
+ } catch {
94
+ return null;
95
+ }
96
+ };
89
97
  const fullQuota = (q) => ({
90
98
  cumulativeIndexLU: 0n,
91
99
  totalQuoted: 0n,
@@ -139,6 +147,7 @@ function buildMockSdk(args) {
139
147
  const market = {
140
148
  priceOracle: {
141
149
  convert,
150
+ safeConvert,
142
151
  mainPrice: mainPriceOf,
143
152
  reservePrice: reservePriceOf,
144
153
  convertToUSD: _convertToUSD,
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_accounts_intents_utils_common = require("./common.js");
3
- const require_onchain_accounts_intents_utils_convert_amount = require("./convert-amount.js");
4
3
  const require_onchain_accounts_intents_utils_pick_token = require("./pick-token.js");
5
4
  const require_onchain_accounts_intents_utils_adjust_state_to_snapshot = require("./adjust-state-to-snapshot.js");
6
5
  const require_onchain_accounts_intents_utils_assemble_operation_calls = require("./assemble-operation-calls.js");
@@ -16,7 +15,6 @@ exports.assembleOperationCalls = require_onchain_accounts_intents_utils_assemble
16
15
  exports.calcBorrowedAmountPlusInterestAndFees = require_onchain_accounts_intents_utils_borrowed_amount_plus_interest_and_fees.calcBorrowedAmountPlusInterestAndFees;
17
16
  exports.clearedQuotas = require_onchain_accounts_intents_utils_quotas_for_update.clearedQuotas;
18
17
  exports.collectPriceImpact = require_onchain_accounts_intents_utils_price_impact.collectPriceImpact;
19
- exports.convertAmount = require_onchain_accounts_intents_utils_convert_amount.convertAmount;
20
18
  exports.createOraclePaths = require_onchain_accounts_intents_utils_router_path.createOraclePaths;
21
19
  exports.createRouterPaths = require_onchain_accounts_intents_utils_router_path.createRouterPaths;
22
20
  exports.eq = require_onchain_accounts_intents_utils_common.eq;
@@ -1,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_base_token_types = require("../../../base/token-types.js");
3
3
  const require_onchain_accounts_intents_utils_common = require("./common.js");
4
- const require_onchain_accounts_intents_utils_convert_amount = require("./convert-amount.js");
5
4
  //#region src/onchain/accounts/intents/utils/pick-token.ts
6
5
  /** Prefix marking every phantom-token contract type in the registry. */
7
6
  const PHANTOM_TOKEN_PREFIX = "PHANTOM_TOKEN::";
@@ -37,7 +36,8 @@ function isRedemptionPhantomToken(sdk, token) {
37
36
  */
38
37
  function rankAccountTokens(args) {
39
38
  const { creditAccount, sdk, exclude = [] } = args;
40
- const convert = require_onchain_accounts_intents_utils_convert_amount.convertAmount(sdk, creditAccount.creditManager);
39
+ const oracle = sdk.marketRegister.findByCreditManager(creditAccount.creditManager).priceOracle;
40
+ const convert = (from, to, amount) => oracle.safeConvert(from, to, amount) ?? 0n;
41
41
  const candidates = [];
42
42
  for (const t of creditAccount.tokens) {
43
43
  if (t.balance <= 0n) continue;
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_accounts_intents_utils_common = require("./common.js");
3
- const require_onchain_accounts_intents_utils_convert_amount = require("./convert-amount.js");
4
3
  const require_onchain_accounts_intents_utils_price_impact = require("./price-impact.js");
5
4
  //#region src/onchain/accounts/intents/utils/router-path.ts
6
5
  /**
@@ -152,7 +151,8 @@ function createRouterPaths(args) {
152
151
  */
153
152
  function createOraclePaths(args) {
154
153
  const { sdk, creditAccount } = args;
155
- const price = require_onchain_accounts_intents_utils_convert_amount.convertAmount(sdk, creditAccount.creditManager);
154
+ const oracle = sdk.marketRegister.findByCreditManager(creditAccount.creditManager).priceOracle;
155
+ const price = (from, to, amount) => oracle.safeConvert(from, to, amount) ?? 0n;
156
156
  const estimate = (amount) => ({
157
157
  amount,
158
158
  minAmount: amount,
@@ -1,18 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_onchain_accounts_intents_utils_common = require("./utils/common.js");
3
- const require_onchain_accounts_intents_utils_convert_amount = require("./utils/convert-amount.js");
4
3
  const require_onchain_accounts_intents_utils_pick_token = require("./utils/pick-token.js");
5
4
  //#region src/onchain/accounts/intents/view.ts
6
5
  /**
7
6
  * The account as the planners see it: a handful of numbers in underlying units
8
7
  * plus balance / price lookups. Read once per preview.
9
8
  *
10
- * TVL uses the RWA-aware conversion so an `rwa.asset` balance without a direct
11
- * pool price still counts at its wrapped value instead of throwing.
9
+ * TVL uses the market oracle: an unpriceable token contributes 0n rather
10
+ * than throwing.
12
11
  */
13
12
  function accountView(creditAccount, sdk) {
14
13
  const { underlying, creditManager } = creditAccount;
15
- const price = require_onchain_accounts_intents_utils_convert_amount.convertAmount(sdk, creditManager);
14
+ const oracle = sdk.marketRegister.findByCreditManager(creditManager).priceOracle;
15
+ const price = (from, to, amount) => oracle.safeConvert(from, to, amount) ?? 0n;
16
16
  const { creditFacade } = sdk.marketRegister.findCreditManager(creditManager);
17
17
  let totalValue = 0n;
18
18
  for (const t of creditAccount.tokens) totalValue += price(t.token, underlying, t.balance);
@@ -109,7 +109,7 @@ var PriceOracleBaseContract = class extends require_onchain_base_BaseContract.Ba
109
109
  * {@inheritDoc IPriceOracleContract.convert}
110
110
  **/
111
111
  convert(from, to, amount, reserve = false) {
112
- if (from === to) return amount;
112
+ if ((0, viem.isAddressEqual)(from, to)) return amount;
113
113
  const fromToken = this.#priceableToken(from);
114
114
  const toToken = this.#priceableToken(to);
115
115
  const fromPrice = reserve ? this.reservePrice(fromToken) : this.mainPrice(fromToken);
@@ -2,10 +2,10 @@ import { SDKConstruct } from "../../base/SDKConstruct.js";
2
2
  import { MIN_HF_LIMITED } from "../../validation/checks.js";
3
3
  import { IntentPreviewError, refuse } from "../../validation/refusal.js";
4
4
  import { assertMarketOperable, borrowable } from "./guards.js";
5
- import { fetchCreditAccountSlice, toCreditAccountSlice } from "./utils/credit-account-slice.js";
6
5
  import { calcLeverageBand } from "./leverage-band.js";
7
6
  import { maxProportionalWithdrawal } from "./math.js";
8
7
  import { maxWithdrawCollateral } from "./maxWithdrawCollateral.js";
8
+ import { fetchCreditAccountSlice, toCreditAccountSlice } from "./utils/credit-account-slice.js";
9
9
  import { previewOpenStrategy } from "./open-strategy.js";
10
10
  import { planAddCollateral, planAdjustLeverage, planAdjustLeverageDelayed, planDeposit, planRepay, planWithdraw, planWithdrawAsset, planWithdrawDelayed } from "./plan.js";
11
11
  import { realize } from "./realize.js";
@@ -1,7 +1,5 @@
1
1
  import { BigIntMath } from "../../utils/bigint-math.js";
2
2
  import { LEVERAGE_DECIMALS } from "../../constants/math.js";
3
- import { convertAmount } from "./utils/convert-amount.js";
4
- import "./utils/index.js";
5
3
  //#region src/onchain/accounts/intents/leverage-band.ts
6
4
  /**
7
5
  * The leverages this market will actually fund for a position of this size.
@@ -38,7 +36,7 @@ function calcLeverageBand({ sdk, creditManager, collateral, targetHF }) {
38
36
  if (!target) return;
39
37
  const ceiling = suite.creditManager.maxLeverage(target, targetHF);
40
38
  const underlying = market.pool.underlying;
41
- const convert = convertAmount(sdk, creditManager);
39
+ const convert = (from, to, amount) => market.priceOracle.safeConvert(from, to, amount) ?? 0n;
42
40
  const netValue = collateral.reduce((acc, a) => acc + convert(a.token, underlying, a.balance), 0n);
43
41
  if (netValue <= 0n) return {
44
42
  min: 1,
@@ -1,11 +1,10 @@
1
1
  import { IntentPreviewError } from "../../validation/refusal.js";
2
- import { convertAmount } from "./utils/convert-amount.js";
3
2
  import { assertCanBorrow, assertCollateralised, assertGrowthAllowed, assertMarketOperable, assertQuotaHeadroom } from "./guards.js";
3
+ import { assertDebtInBand, assertLeverageAtLeastOne, debtForLeverage } from "./math.js";
4
4
  import { collectPriceImpact } from "./utils/price-impact.js";
5
5
  import { getQuotasForUpdate } from "./utils/quotas-for-update.js";
6
6
  import { createRouterPaths } from "./utils/router-path.js";
7
7
  import "./utils/index.js";
8
- import { assertDebtInBand, assertLeverageAtLeastOne, debtForLeverage } from "./math.js";
9
8
  //#region src/onchain/accounts/intents/open-strategy.ts
10
9
  /** Stand-in account address: nothing exists on chain until the tx lands. */
11
10
  const NO_ACCOUNT = "0x0000000000000000000000000000000000000000";
@@ -27,7 +26,7 @@ async function previewOpenStrategy(props) {
27
26
  const market = sdk.marketRegister.findByCreditManager(creditManager);
28
27
  assertMarketOperable(suite);
29
28
  const underlying = market.pool.underlying.toLowerCase();
30
- const convert = convertAmount(sdk, creditManager);
29
+ const convert = (from, to, amount) => market.priceOracle.safeConvert(from, to, amount) ?? 0n;
31
30
  const margin = collateral.reduce((acc, a) => acc + convert(a.token, underlying, a.balance), 0n);
32
31
  if (margin <= 0n) throw new IntentPreviewError("insufficientSourceBalance", void 0, "openStrategy: collateral is worth nothing in underlying");
33
32
  const debt = debtForLeverage(margin, leverage);
@@ -2,7 +2,6 @@ import { calcPositionLeverage } from "../../market/math.js";
2
2
  import { IntentPreviewError } from "../../validation/refusal.js";
3
3
  import { toToken, toTokenAmount } from "../../validation/token.js";
4
4
  import { eq, toTargetDecimals } from "./utils/common.js";
5
- import { convertAmount } from "./utils/convert-amount.js";
6
5
  import { isRedemptionPhantomToken } from "./utils/pick-token.js";
7
6
  import { assertCanBorrow, assertCollateralised, assertGrowthAllowed, assertQuotaHeadroom } from "./guards.js";
8
7
  import { OperationLedger } from "./utils/ledger.js";
@@ -25,13 +24,13 @@ async function realize(steps, props) {
25
24
  const { creditAccount, sdk, slippage, quotaReserve } = props;
26
25
  const { underlying } = creditAccount;
27
26
  const rwaAsset = sdk.tokensMeta.rwaUnderlyings.get(underlying)?.asset;
28
- const price = convertAmount(sdk, creditAccount.creditManager);
29
27
  const paths = props.paths ?? createRouterPaths({
30
28
  sdk,
31
29
  creditAccount,
32
30
  slippage
33
31
  });
34
32
  const market = sdk.marketRegister.findByCreditManager(creditAccount.creditManager);
33
+ const price = (from, to, amount) => market.priceOracle.safeConvert(from, to, amount) ?? 0n;
35
34
  const suite = sdk.marketRegister.findCreditManager(creditAccount.creditManager);
36
35
  const ledger = new OperationLedger({
37
36
  initialAssets: creditAccount.tokens,
@@ -81,11 +81,19 @@ function buildMockSdk(args) {
81
81
  const convert = (token, to, amount) => {
82
82
  const from = token.toLowerCase();
83
83
  const target = to.toLowerCase();
84
+ if (from === target) return amount;
84
85
  const fromPrice = args.prices[from];
85
86
  const toPrice = args.prices[target];
86
87
  if (fromPrice === void 0 || toPrice === void 0) throw new Error(`mock priceOracle: missing price for ${from} or ${target}`);
87
88
  return amount * fromPrice * 10n ** BigInt(decimalsOf(target)) / (toPrice * 10n ** BigInt(decimalsOf(from)));
88
89
  };
90
+ const safeConvert = (token, to, amount) => {
91
+ try {
92
+ return convert(token, to, amount);
93
+ } catch {
94
+ return null;
95
+ }
96
+ };
89
97
  const fullQuota = (q) => ({
90
98
  cumulativeIndexLU: 0n,
91
99
  totalQuoted: 0n,
@@ -139,6 +147,7 @@ function buildMockSdk(args) {
139
147
  const market = {
140
148
  priceOracle: {
141
149
  convert,
150
+ safeConvert,
142
151
  mainPrice: mainPriceOf,
143
152
  reservePrice: reservePriceOf,
144
153
  convertToUSD: _convertToUSD,
@@ -1,5 +1,4 @@
1
1
  import { eq, toRouterCaSlice, toTargetDecimals } from "./common.js";
2
- import { convertAmount } from "./convert-amount.js";
3
2
  import { isPhantomToken, isRedemptionPhantomToken, pickFattestNonPhantomToken, rankAccountTokens } from "./pick-token.js";
4
3
  import { adjustStateToSnapshot } from "./adjust-state-to-snapshot.js";
5
4
  import { assembleOperationCalls } from "./assemble-operation-calls.js";
@@ -9,4 +8,4 @@ import { OperationLedger } from "./ledger.js";
9
8
  import { collectPriceImpact, lossRate, startProbe } from "./price-impact.js";
10
9
  import { clearedQuotas, getQuotasForUpdate, quotasAfterUpdate } from "./quotas-for-update.js";
11
10
  import { createOraclePaths, createRouterPaths } from "./router-path.js";
12
- export { OperationLedger, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, clearedQuotas, collectPriceImpact, convertAmount, createOraclePaths, createRouterPaths, eq, fetchCreditAccountSlice, getQuotasForUpdate, isPhantomToken, isRedemptionPhantomToken, lossRate, pickFattestNonPhantomToken, quotasAfterUpdate, rankAccountTokens, startProbe, toCreditAccountSlice, toRouterCaSlice, toTargetDecimals };
11
+ export { OperationLedger, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, clearedQuotas, collectPriceImpact, createOraclePaths, createRouterPaths, eq, fetchCreditAccountSlice, getQuotasForUpdate, isPhantomToken, isRedemptionPhantomToken, lossRate, pickFattestNonPhantomToken, quotasAfterUpdate, rankAccountTokens, startProbe, toCreditAccountSlice, toRouterCaSlice, toTargetDecimals };
@@ -1,6 +1,5 @@
1
1
  import { NON_STRATEGY_PHANTOM_TOKEN_TYPES } from "../../../base/token-types.js";
2
2
  import { eq } from "./common.js";
3
- import { convertAmount } from "./convert-amount.js";
4
3
  //#region src/onchain/accounts/intents/utils/pick-token.ts
5
4
  /** Prefix marking every phantom-token contract type in the registry. */
6
5
  const PHANTOM_TOKEN_PREFIX = "PHANTOM_TOKEN::";
@@ -36,7 +35,8 @@ function isRedemptionPhantomToken(sdk, token) {
36
35
  */
37
36
  function rankAccountTokens(args) {
38
37
  const { creditAccount, sdk, exclude = [] } = args;
39
- const convert = convertAmount(sdk, creditAccount.creditManager);
38
+ const oracle = sdk.marketRegister.findByCreditManager(creditAccount.creditManager).priceOracle;
39
+ const convert = (from, to, amount) => oracle.safeConvert(from, to, amount) ?? 0n;
40
40
  const candidates = [];
41
41
  for (const t of creditAccount.tokens) {
42
42
  if (t.balance <= 0n) continue;
@@ -1,5 +1,4 @@
1
1
  import { toRouterCaSlice } from "./common.js";
2
- import { convertAmount } from "./convert-amount.js";
3
2
  import { startProbe } from "./price-impact.js";
4
3
  //#region src/onchain/accounts/intents/utils/router-path.ts
5
4
  /**
@@ -151,7 +150,8 @@ function createRouterPaths(args) {
151
150
  */
152
151
  function createOraclePaths(args) {
153
152
  const { sdk, creditAccount } = args;
154
- const price = convertAmount(sdk, creditAccount.creditManager);
153
+ const oracle = sdk.marketRegister.findByCreditManager(creditAccount.creditManager).priceOracle;
154
+ const price = (from, to, amount) => oracle.safeConvert(from, to, amount) ?? 0n;
155
155
  const estimate = (amount) => ({
156
156
  amount,
157
157
  minAmount: amount,
@@ -1,17 +1,17 @@
1
1
  import { eq } from "./utils/common.js";
2
- import { convertAmount } from "./utils/convert-amount.js";
3
2
  import { pickFattestNonPhantomToken } from "./utils/pick-token.js";
4
3
  //#region src/onchain/accounts/intents/view.ts
5
4
  /**
6
5
  * The account as the planners see it: a handful of numbers in underlying units
7
6
  * plus balance / price lookups. Read once per preview.
8
7
  *
9
- * TVL uses the RWA-aware conversion so an `rwa.asset` balance without a direct
10
- * pool price still counts at its wrapped value instead of throwing.
8
+ * TVL uses the market oracle: an unpriceable token contributes 0n rather
9
+ * than throwing.
11
10
  */
12
11
  function accountView(creditAccount, sdk) {
13
12
  const { underlying, creditManager } = creditAccount;
14
- const price = convertAmount(sdk, creditManager);
13
+ const oracle = sdk.marketRegister.findByCreditManager(creditManager).priceOracle;
14
+ const price = (from, to, amount) => oracle.safeConvert(from, to, amount) ?? 0n;
15
15
  const { creditFacade } = sdk.marketRegister.findCreditManager(creditManager);
16
16
  let totalValue = 0n;
17
17
  for (const t of creditAccount.tokens) totalValue += price(t.token, underlying, t.balance);
@@ -108,7 +108,7 @@ var PriceOracleBaseContract = class extends BaseContract {
108
108
  * {@inheritDoc IPriceOracleContract.convert}
109
109
  **/
110
110
  convert(from, to, amount, reserve = false) {
111
- if (from === to) return amount;
111
+ if (isAddressEqual(from, to)) return amount;
112
112
  const fromToken = this.#priceableToken(from);
113
113
  const toToken = this.#priceableToken(to);
114
114
  const fromPrice = reserve ? this.reservePrice(fromToken) : this.mainPrice(fromToken);
@@ -110,7 +110,7 @@ interface AccountView {
110
110
  collateral: bigint;
111
111
  band: DebtBand;
112
112
  balanceOf(token: Address): bigint;
113
- /** Oracle conversion, RWA-aware. */
113
+ /** Oracle conversion; unpriceable tokens contribute 0n. */
114
114
  price(from: Address, to: Address, amount: bigint): bigint;
115
115
  /** Most valuable non-phantom balance, or undefined when there is none. */
116
116
  fattest(exclude?: Address[]): Address | undefined;
@@ -5,8 +5,7 @@ import { adjustStateToSnapshot } from "./adjust-state-to-snapshot.js";
5
5
  import { assembleOperationCalls } from "./assemble-operation-calls.js";
6
6
  import { calcBorrowedAmountPlusInterestAndFees } from "./borrowed-amount-plus-interest-and-fees.js";
7
7
  import { eq, toRouterCaSlice, toTargetDecimals } from "./common.js";
8
- import { convertAmount } from "./convert-amount.js";
9
- import { ConvertFn, LedgerSnapshot, OperationLedger } from "./ledger.js";
8
+ import { LedgerSnapshot, OperationLedger } from "./ledger.js";
10
9
  import { CandidateToken, isPhantomToken, isRedemptionPhantomToken, pickFattestNonPhantomToken, rankAccountTokens } from "./pick-token.js";
11
10
  import { clearedQuotas, getQuotasForUpdate, quotasAfterUpdate } from "./quotas-for-update.js";
12
- export { CandidateToken, ConvertFn, LedgerSnapshot, LegProbe, OpenStrategyLeg, OperationLedger, RouterPaths, SwapLeg, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, clearedQuotas, collectPriceImpact, convertAmount, createOraclePaths, createRouterPaths, eq, fetchCreditAccountSlice, getQuotasForUpdate, isPhantomToken, isRedemptionPhantomToken, lossRate, pickFattestNonPhantomToken, quotasAfterUpdate, rankAccountTokens, startProbe, toCreditAccountSlice, toRouterCaSlice, toTargetDecimals };
11
+ export { CandidateToken, LedgerSnapshot, LegProbe, OpenStrategyLeg, OperationLedger, RouterPaths, SwapLeg, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, clearedQuotas, collectPriceImpact, createOraclePaths, createRouterPaths, eq, fetchCreditAccountSlice, getQuotasForUpdate, isPhantomToken, isRedemptionPhantomToken, lossRate, pickFattestNonPhantomToken, quotasAfterUpdate, rankAccountTokens, startProbe, toCreditAccountSlice, toRouterCaSlice, toTargetDecimals };
@@ -1,9 +1,9 @@
1
1
  import { Asset } from "../../../base/types.js";
2
+ import { ConvertFn } from "../../../market/oracle/types.js";
2
3
  import { AccountCalculatorOperation } from "../operations.js";
3
4
  import "../../../index.js";
4
5
  import { Address } from "viem";
5
6
  //#region src/onchain/accounts/intents/utils/ledger.d.ts
6
- type ConvertFn = (token: Address, to: Address, amount: bigint) => bigint;
7
7
  /** Account state at one point in an operation chain. */
8
8
  interface LedgerSnapshot {
9
9
  /** Non-zero balances only, lowercased, in insertion order. */
@@ -38,4 +38,4 @@ declare class OperationLedger {
38
38
  apply(op: AccountCalculatorOperation): this;
39
39
  }
40
40
  //#endregion
41
- export { ConvertFn, LedgerSnapshot, OperationLedger };
41
+ export { LedgerSnapshot, OperationLedger };
@@ -1,8 +1,8 @@
1
1
  import { AddressMap } from "../../../utils/AddressMap.js";
2
2
  import { Asset } from "../../../base/types.js";
3
+ import { ConvertFn } from "../../../market/oracle/types.js";
3
4
  import { QuotaUpdateState } from "../operations.js";
4
5
  import "../../../index.js";
5
- import { ConvertFn } from "./ledger.js";
6
6
  import { Address } from "viem";
7
7
  //#region src/onchain/accounts/intents/utils/quotas-for-update.d.ts
8
8
  interface InitialQuota {
@@ -7,8 +7,8 @@ import { AccountView } from "./plan.js";
7
7
  * The account as the planners see it: a handful of numbers in underlying units
8
8
  * plus balance / price lookups. Read once per preview.
9
9
  *
10
- * TVL uses the RWA-aware conversion so an `rwa.asset` balance without a direct
11
- * pool price still counts at its wrapped value instead of throwing.
10
+ * TVL uses the market oracle: an unpriceable token contributes 0n rather
11
+ * than throwing.
12
12
  */
13
13
  declare function accountView(creditAccount: CreditAccountSlice, sdk: OnchainSDK): AccountView;
14
14
  //#endregion
@@ -161,7 +161,7 @@ import { createRouter } from "./router/createRouter.js";
161
161
  import { assetsMap } from "./router/helpers.js";
162
162
  import { RouterV310Contract } from "./router/RouterV310Contract.js";
163
163
  import "./router/index.js";
164
- import { IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions } from "./market/oracle/types.js";
164
+ import { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions } from "./market/oracle/types.js";
165
165
  import { createPriceOracle } from "./market/oracle/createPriceOracle.js";
166
166
  import { PriceOracleV310Contract } from "./market/oracle/PriceOracleV310Contract.js";
167
167
  import { IInterestRateModelContract, IPoolContract, IRateKeeperContract, InterestRateModelType, PoolQuotaKeeperContract, RateKeeperType } from "./market/pool/types.js";
@@ -268,4 +268,4 @@ import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./opti
268
268
  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";
269
269
  import { toToken, toTokenAmount } from "./validation/token.js";
270
270
  import "./validation/index.js";
271
- 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, 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, BorrowLimitBinding, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, 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, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, 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, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, 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, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, 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, 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, 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, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, 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, findCuratorMarketConfigurator, 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, 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, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
271
+ 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, 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, BorrowLimitBinding, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, 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, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, FluidDexAdapterContract, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetReward, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, type InstantRoute, IntentPreviewError, 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, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, 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, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, 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, 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, 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, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkBorrowLimit, checkCollateralised, checkCreditManagerPaused, checkDebtInBand, checkForbiddenToken, checkFunding, checkLeverageAtLeastOne, checkMarketExpired, checkPoolPaused, checkPoolPayout, checkPoolSunset, checkPreviewError, checkQuotaCount, checkQuotaLimit, childLogger, classifyCurveOperation, 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, findCuratorMarketConfigurator, 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, 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, retry, rewardsFromTransfers, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toShares, toSharesUp, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
@@ -125,7 +125,7 @@ import { CreditConfiguratorV310Contract, RampEvent } from "./credit/CreditConfig
125
125
  import { CreditFacadeV310Abi as abi, CreditFacadeV310BaseContract } from "./credit/CreditFacadeV310BaseContract.js";
126
126
  import { CreditFacadeV310Contract } from "./credit/CreditFacadeV310Contract.js";
127
127
  import { CreditManagerV310Contract } from "./credit/CreditManagerV310Contract.js";
128
- import { IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions } from "./oracle/types.js";
128
+ import { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions } from "./oracle/types.js";
129
129
  import { createPriceOracle } from "./oracle/createPriceOracle.js";
130
130
  import { PriceOracleV310Contract } from "./oracle/PriceOracleV310Contract.js";
131
131
  import "./oracle/index.js";
@@ -151,4 +151,4 @@ import "./zapper/index.js";
151
151
  import { MarketRegister, MarketRegistryState, MarketRegistryStateHuman } from "./MarketRegister.js";
152
152
  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";
153
153
  import { strategyName } from "./strategyName.js";
154
- 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, 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, 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, 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, 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 };
154
+ 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, 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, 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, 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 };
@@ -1,4 +1,4 @@
1
- import { IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions } from "./types.js";
1
+ import { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions } from "./types.js";
2
2
  import { createPriceOracle } from "./createPriceOracle.js";
3
3
  import { PriceOracleV310Contract } from "./PriceOracleV310Contract.js";
4
- export { IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, createPriceOracle };
4
+ export { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleV310Contract, createPriceOracle };
@@ -42,6 +42,12 @@ interface PriceFeedsForAccountOptions extends PriceFeedsForTokensOptions {
42
42
  **/
43
43
  extraTokens?: Address[];
44
44
  }
45
+ /**
46
+ * Token-to-token conversion at latest known prices, result in `to`-token
47
+ * decimals. Whether an unpriceable token throws (raw `convert`) or coerces
48
+ * to 0n (`safeConvert(...) ?? 0n`) is the implementation's contract.
49
+ */
50
+ type ConvertFn = (from: Address, to: Address, amount: bigint) => bigint;
45
51
  /**
46
52
  * Public interface for a Gearbox price oracle contract.
47
53
  *
@@ -237,4 +243,4 @@ interface IPriceOracleContract extends IBaseContract {
237
243
  stateHuman: (raw?: boolean) => PriceOracleStateHuman;
238
244
  }
239
245
  //#endregion
240
- export { IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions };
246
+ export { ConvertFn, IPriceOracleContract, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions };
@@ -28,7 +28,7 @@ import { checkPrerequisites } from "./prerequisites/checkPrerequisites.js";
28
28
  import "./prerequisites/index.js";
29
29
  import { CreditAccountState, CreditAccountStateProps } from "./preview/CreditAccountState.js";
30
30
  import { DetectedDelayedOperation, detectDelayedOperation } from "./preview/detectDelayedOperation.js";
31
- import { ConvertFn, buildDelayedPreview } from "./preview/buildDelayedPreview.js";
31
+ import { buildDelayedPreview } from "./preview/buildDelayedPreview.js";
32
32
  import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRepay.js";
33
33
  import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
34
34
  import { UnsupportedOperationError } from "./preview/errors.js";
@@ -41,4 +41,4 @@ import "./preview/index.js";
41
41
  import { CheckOperationOptions, checkOperation, collateralIssuesOf } from "./validate/checkOperation.js";
42
42
  import { checkSimulation } from "./validate/checkSimulation.js";
43
43
  import "./validate/index.js";
44
- export { AdapterOperation, AdapterOperationBase, AddCollateralOp, AllowanceDetail, AllowancePrerequisite, AllowanceResult, BalanceDetail, BalancePrerequisite, BalanceResult, BorrowLimitBinding, CheckOperationOptions, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, ConvertFn, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, FacadeOperationMetadata, FacadeParsedCall, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, IntentPreviewError, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, Prerequisite, PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewOperationInput, PreviewOperationOptions, PreviewRefusal, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, StoreExpectedBalancesOp, TokenTransfer, TraceAdapterExt, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, UpdateQuotaOp, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, buildDelayedPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssuesOf, detectDelayedClaim, detectDelayedOperation, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustCreditAccount, previewCloseOrRepayCreditAccount, previewOperation, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
44
+ export { AdapterOperation, AdapterOperationBase, AddCollateralOp, AllowanceDetail, AllowancePrerequisite, AllowanceResult, BalanceDetail, BalancePrerequisite, BalanceResult, BorrowLimitBinding, CheckOperationOptions, ClassifyInnerOperationsProps, CloseCreditAccountOperation, CloseOrRepayOperation, CompareBalancesOp, CreditAccountOperation, CreditAccountState, CreditAccountStateProps, DecreaseDebtOp, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ExtractTransfersResult, FacadeCallType, FacadeOperationMetadata, FacadeParsedCall, IncreaseDebtOp, InnerFacadeOperation, InnerOperation, IntentPreviewError, LiquidateCreditAccountOperation, MulticallOperation, OpenCreditAccountOperation, Operation, OperationMetadata, OuterFacadeOperation, PartialLiquidationOperation, PoolDepositOperation, PoolMintOperation, PoolOperation, PoolRedeemOperation, PoolWithdrawOperation, Prerequisite, PrerequisiteContext, PrerequisiteError, PrerequisiteKind, PrerequisiteOutcome, PrerequisiteResult, PreviewErrorDetails, PreviewErrorReason, PreviewIssue, PreviewOperationInput, PreviewOperationOptions, PreviewRefusal, RWAMulticallOperation, RWAOpenCreditAccountOperation, RWAOpenRequirementsDetail, RWAOpenRequirementsPrerequisite, RWAOpenRequirementsResult, RWAOperation, RWAOperationMetadata, ReplayMulticallResult, ReplayState, ReplayableOperation, StoreExpectedBalancesOp, TokenTransfer, TraceAdapterExt, TransferAlignmentError, UnexpectedFacadeEventOrderError, UnknownAdapterError, UnknownFacadeCallError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, UpdateQuotaOp, WithdrawCollateralAlignmentError, WithdrawCollateralEventInfo, WithdrawCollateralOp, buildDelayedPreview, checkOperation, checkPrerequisites, checkSimulation, classifyCloseOrRepay, classifyInnerOperations, collateralIssuesOf, detectDelayedClaim, detectDelayedOperation, extractAdapterCallTraces, extractTransfers, findFacadeCalls, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustCreditAccount, previewCloseOrRepayCreditAccount, previewOperation, raise, refuse, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -1,15 +1,12 @@
1
1
  import { InstantOperationPreview } from "../../model/previews.js";
2
2
  import "../../model/index.js";
3
+ import { ConvertFn } from "../../onchain/market/oracle/types.js";
3
4
  import { OnchainSDK } from "../../onchain/OnchainSDK.js";
4
5
  import "../../onchain/index.js";
5
6
  import { CreditAccountState } from "./CreditAccountState.js";
6
7
  import { DetectedDelayedOperation } from "./detectDelayedOperation.js";
7
8
  import { Address } from "viem";
8
9
  //#region src/preview/preview/buildDelayedPreview.d.ts
9
- /**
10
- * Oracle conversion, injected so unit tests don't need a market
11
- */
12
- type ConvertFn = (token: Address, to: Address, amount: bigint) => bigint;
13
10
  /**
14
11
  * Builds the best-effort preview of the account state after the detected
15
12
  * delayed withdrawal is claimed and its intent (if any) is resumed:
@@ -34,4 +31,4 @@ type ConvertFn = (token: Address, to: Address, amount: bigint) => bigint;
34
31
  */
35
32
  declare function buildDelayedPreview(afterInstant: CreditAccountState, before: CreditAccountState, detected: DetectedDelayedOperation, convert: ConvertFn, receivedToken: Address, sdk: OnchainSDK): InstantOperationPreview;
36
33
  //#endregion
37
- export { ConvertFn, buildDelayedPreview };
34
+ export { buildDelayedPreview };
@@ -1,6 +1,6 @@
1
1
  import { CreditAccountState, CreditAccountStateProps } from "./CreditAccountState.js";
2
2
  import { DetectedDelayedOperation, detectDelayedOperation } from "./detectDelayedOperation.js";
3
- import { ConvertFn, buildDelayedPreview } from "./buildDelayedPreview.js";
3
+ import { buildDelayedPreview } from "./buildDelayedPreview.js";
4
4
  import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
5
5
  import { DetectedDelayedClaim, detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
6
6
  import { UnsupportedOperationError } from "./errors.js";
@@ -9,4 +9,4 @@ import { CloseOrRepayOperation, previewCloseOrRepayCreditAccount } from "./previ
9
9
  import { previewOperation } from "./previewOperation.js";
10
10
  import { ReplayState, makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
11
11
  import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./replayMulticall.js";
12
- export { CloseOrRepayOperation, ConvertFn, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, buildDelayedPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, isCloseOrRepay, makeReplayState, previewAdjustCreditAccount, previewCloseOrRepayCreditAccount, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
12
+ export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, ReplayMulticallResult, ReplayState, ReplayableOperation, UnsupportedOperationError, buildDelayedPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, isCloseOrRepay, makeReplayState, previewAdjustCreditAccount, previewCloseOrRepayCreditAccount, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "16.0.0-next.19",
3
+ "version": "16.0.0-next.20",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,37 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_onchain_accounts_intents_utils_common = require("./common.js");
3
- //#region src/onchain/accounts/intents/utils/convert-amount.ts
4
- /**
5
- * Converts an amount from one token to another using oracle prices of the
6
- * given credit manager's market. When the direct oracle path is missing
7
- * (e.g. `rwa.asset` has no pool price), bridges via the wrapped underlying
8
- * (1:1 wrap + decimals rescale) — mirrors legacy `convertAmountWithRwaBridge`.
9
- */
10
- const convertAmount = (sdk, creditManager) => (fromTokenRaw, toTokenRaw, amount) => {
11
- const fromToken = fromTokenRaw.toLowerCase();
12
- const toToken = toTokenRaw.toLowerCase();
13
- if (amount === 0n || fromToken === toToken) return amount;
14
- const market = sdk.marketRegister.findByCreditManager(creditManager);
15
- const underlying = market.pool.underlying.toLowerCase();
16
- let direct = 0n;
17
- try {
18
- direct = market.priceOracle.convert(fromToken, toToken, amount);
19
- } catch {}
20
- if (direct > 0n) return direct;
21
- const rwa = sdk.tokensMeta.rwaUnderlyings.get(underlying);
22
- if (!rwa) return 0n;
23
- const asset = rwa.asset.toLowerCase();
24
- if (fromToken === asset && toToken === underlying) return require_onchain_accounts_intents_utils_common.toTargetDecimals(amount, fromToken, toToken, sdk);
25
- if (fromToken === underlying && toToken === asset) return require_onchain_accounts_intents_utils_common.toTargetDecimals(amount, fromToken, toToken, sdk);
26
- if (fromToken === asset) {
27
- const asUnd = require_onchain_accounts_intents_utils_common.toTargetDecimals(amount, fromToken, underlying, sdk);
28
- return convertAmount(sdk, creditManager)(underlying, toTokenRaw, asUnd);
29
- }
30
- if (toToken === asset) {
31
- const asUnd = convertAmount(sdk, creditManager)(fromToken, underlying, amount);
32
- return asUnd === 0n ? 0n : require_onchain_accounts_intents_utils_common.toTargetDecimals(asUnd, underlying, toToken, sdk);
33
- }
34
- return 0n;
35
- };
36
- //#endregion
37
- exports.convertAmount = convertAmount;
@@ -1,36 +0,0 @@
1
- import { toTargetDecimals } from "./common.js";
2
- //#region src/onchain/accounts/intents/utils/convert-amount.ts
3
- /**
4
- * Converts an amount from one token to another using oracle prices of the
5
- * given credit manager's market. When the direct oracle path is missing
6
- * (e.g. `rwa.asset` has no pool price), bridges via the wrapped underlying
7
- * (1:1 wrap + decimals rescale) — mirrors legacy `convertAmountWithRwaBridge`.
8
- */
9
- const convertAmount = (sdk, creditManager) => (fromTokenRaw, toTokenRaw, amount) => {
10
- const fromToken = fromTokenRaw.toLowerCase();
11
- const toToken = toTokenRaw.toLowerCase();
12
- if (amount === 0n || fromToken === toToken) return amount;
13
- const market = sdk.marketRegister.findByCreditManager(creditManager);
14
- const underlying = market.pool.underlying.toLowerCase();
15
- let direct = 0n;
16
- try {
17
- direct = market.priceOracle.convert(fromToken, toToken, amount);
18
- } catch {}
19
- if (direct > 0n) return direct;
20
- const rwa = sdk.tokensMeta.rwaUnderlyings.get(underlying);
21
- if (!rwa) return 0n;
22
- const asset = rwa.asset.toLowerCase();
23
- if (fromToken === asset && toToken === underlying) return toTargetDecimals(amount, fromToken, toToken, sdk);
24
- if (fromToken === underlying && toToken === asset) return toTargetDecimals(amount, fromToken, toToken, sdk);
25
- if (fromToken === asset) {
26
- const asUnd = toTargetDecimals(amount, fromToken, underlying, sdk);
27
- return convertAmount(sdk, creditManager)(underlying, toTokenRaw, asUnd);
28
- }
29
- if (toToken === asset) {
30
- const asUnd = convertAmount(sdk, creditManager)(fromToken, underlying, amount);
31
- return asUnd === 0n ? 0n : toTargetDecimals(asUnd, underlying, toToken, sdk);
32
- }
33
- return 0n;
34
- };
35
- //#endregion
36
- export { convertAmount };
@@ -1,13 +0,0 @@
1
- import { OnchainSDK } from "../../../OnchainSDK.js";
2
- import "../../../index.js";
3
- import { Address } from "viem";
4
- //#region src/onchain/accounts/intents/utils/convert-amount.d.ts
5
- /**
6
- * Converts an amount from one token to another using oracle prices of the
7
- * given credit manager's market. When the direct oracle path is missing
8
- * (e.g. `rwa.asset` has no pool price), bridges via the wrapped underlying
9
- * (1:1 wrap + decimals rescale) — mirrors legacy `convertAmountWithRwaBridge`.
10
- */
11
- declare const convertAmount: (sdk: OnchainSDK, creditManager: Address) => (fromTokenRaw: Address, toTokenRaw: Address, amount: bigint) => bigint;
12
- //#endregion
13
- export { convertAmount };