@gearbox-protocol/sdk 16.0.0-next.28 → 16.0.0-next.29

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 (64) hide show
  1. package/dist/cjs/onchain/accounts/intents/open-strategy.js +1 -0
  2. package/dist/cjs/onchain/accounts/intents/realize.js +2 -1
  3. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +15 -0
  4. package/dist/cjs/onchain/index.js +6 -0
  5. package/dist/cjs/onchain/market/credit/creditOperationMarket.js +32 -0
  6. package/dist/cjs/onchain/market/credit/index.js +3 -0
  7. package/dist/cjs/onchain/market/index.js +5 -0
  8. package/dist/cjs/onchain/market/oracle/collateralPriceInUnderlying.js +27 -0
  9. package/dist/cjs/onchain/market/oracle/index.js +2 -0
  10. package/dist/cjs/onchain/positions/PositionsService.js +17 -2
  11. package/dist/cjs/onchain/positions/calcLiquidationPrice.js +14 -4
  12. package/dist/cjs/onchain/positions/index.js +1 -0
  13. package/dist/cjs/preview/preview/buildDelayedStrategyVerify.js +2 -2
  14. package/dist/cjs/preview/preview/previewExitOrRepayStrategyVerify.js +3 -4
  15. package/dist/cjs/preview/preview/previewOperation.js +3 -2
  16. package/dist/esm/dev/AccountOpener.js +1 -1
  17. package/dist/esm/dev/withdrawalUtils.js +1 -1
  18. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  19. package/dist/esm/onchain/accounts/intents/open-strategy.js +1 -0
  20. package/dist/esm/onchain/accounts/intents/realize.js +2 -1
  21. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +14 -1
  22. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  23. package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  24. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  25. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  26. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  27. package/dist/esm/onchain/base/TokensMeta.js +3 -3
  28. package/dist/esm/onchain/core/createAddressProvider.js +1 -1
  29. package/dist/esm/onchain/index.js +4 -2
  30. package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  31. package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  32. package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
  33. package/dist/esm/onchain/market/credit/creditOperationMarket.js +30 -0
  34. package/dist/esm/onchain/market/credit/index.js +2 -1
  35. package/dist/esm/onchain/market/index.js +3 -1
  36. package/dist/esm/onchain/market/oracle/collateralPriceInUnderlying.js +26 -0
  37. package/dist/esm/onchain/market/oracle/index.js +2 -1
  38. package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
  39. package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
  40. package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
  41. package/dist/esm/onchain/positions/PositionsService.js +18 -3
  42. package/dist/esm/onchain/positions/calcLiquidationPrice.js +14 -5
  43. package/dist/esm/onchain/positions/index.js +2 -2
  44. package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
  45. package/dist/esm/preview/preview/buildDelayedStrategyVerify.js +2 -2
  46. package/dist/esm/preview/preview/previewExitOrRepayStrategyVerify.js +3 -4
  47. package/dist/esm/preview/preview/previewOperation.js +3 -2
  48. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  49. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  50. package/dist/types/model/index.d.ts +2 -2
  51. package/dist/types/model/previews.d.ts +40 -41
  52. package/dist/types/onchain/accounts/intents/open-strategy.d.ts +12 -0
  53. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +11 -0
  54. package/dist/types/onchain/accounts/intents/types.d.ts +12 -0
  55. package/dist/types/onchain/index.d.ts +4 -2
  56. package/dist/types/onchain/market/credit/creditOperationMarket.d.ts +23 -0
  57. package/dist/types/onchain/market/credit/index.d.ts +2 -1
  58. package/dist/types/onchain/market/index.d.ts +3 -1
  59. package/dist/types/onchain/market/oracle/collateralPriceInUnderlying.d.ts +19 -0
  60. package/dist/types/onchain/market/oracle/index.d.ts +2 -1
  61. package/dist/types/onchain/positions/PositionsService.d.ts +8 -0
  62. package/dist/types/onchain/positions/calcLiquidationPrice.d.ts +10 -1
  63. package/dist/types/onchain/positions/index.d.ts +2 -2
  64. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
2
1
  import { MissingSerializedParamsError } from "../../../base/errors.js";
3
2
  import "../../../base/index.js";
3
+ import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
4
4
  import { iERC4626Abi } from "../abi/targetContractAbi.js";
5
5
  import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
6
6
  import { AbstractAdapterContract } from "./AbstractAdapter.js";
@@ -1,7 +1,7 @@
1
- import { iPausableAbi } from "../../../abi/iPausable.js";
2
1
  import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
3
2
  import { BaseContract } from "../../base/BaseContract.js";
4
3
  import "../../base/index.js";
4
+ import { iPausableAbi } from "../../../abi/iPausable.js";
5
5
  //#region src/onchain/market/credit/CreditFacadeV310BaseContract.ts
6
6
  const abi = [
7
7
  ...iCreditFacadeV310Abi,
@@ -0,0 +1,30 @@
1
+ import { PERCENTAGE_FACTOR } from "../../constants/math.js";
2
+ //#region src/onchain/market/credit/creditOperationMarket.ts
3
+ /**
4
+ * What a liquidation takes off an account, in basis points: the premium the
5
+ * liquidator keeps plus the protocol's own fee, with the suite's expiration
6
+ * already resolved.
7
+ *
8
+ * Not {@link LiquidationFees.liquidationDiscount}, which is the complement of
9
+ * the premium alone (`100% - liquidationPremium`) and says what share of the
10
+ * seized collateral repays the debt.
11
+ **/
12
+ function totalLiquidationDiscount(suite) {
13
+ const { feeLiquidation, liquidationDiscount } = suite.liquidationFees();
14
+ return Number(PERCENTAGE_FACTOR) - liquidationDiscount + feeLiquidation;
15
+ }
16
+ /**
17
+ * The market half of every credit operation result, read off the suite that
18
+ * serves it. Spread into a preview or a projection so the four fields are
19
+ * filled in one place and cannot drift apart between the two halves of the SDK.
20
+ **/
21
+ function creditOperationMarket(suite) {
22
+ return {
23
+ creditManager: suite.creditManager.address,
24
+ name: suite.name,
25
+ curator: suite.marketConfigurator.address,
26
+ liquidationDiscount: totalLiquidationDiscount(suite)
27
+ };
28
+ }
29
+ //#endregion
30
+ export { creditOperationMarket, totalLiquidationDiscount };
@@ -4,6 +4,7 @@ import { CreditFacadeV310Contract } from "./CreditFacadeV310Contract.js";
4
4
  import { CreditManagerV310Contract } from "./CreditManagerV310Contract.js";
5
5
  import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./collateralUtils.js";
6
6
  import { CreditSuite } from "./CreditSuite.js";
7
+ import { creditOperationMarket, totalLiquidationDiscount } from "./creditOperationMarket.js";
7
8
  import { expectedBalanceDeltas } from "./expectedBalanceDeltas.js";
8
9
  import "./types.js";
9
- export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, abi as creditFacadeV310Abi, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral };
10
+ export { CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, abi as creditFacadeV310Abi, creditOperationMarket, dominantCollateral, expectedBalanceDeltas, isStrategyCollateral, pickStrategyTargetCollateral, totalLiquidationDiscount };
@@ -92,8 +92,10 @@ import { CreditManagerV310Contract } from "./credit/CreditManagerV310Contract.js
92
92
  import { strategyName } from "./strategyName.js";
93
93
  import { dominantCollateral, isStrategyCollateral, pickStrategyTargetCollateral } from "./credit/collateralUtils.js";
94
94
  import { CreditSuite } from "./credit/CreditSuite.js";
95
+ import { creditOperationMarket, totalLiquidationDiscount } from "./credit/creditOperationMarket.js";
95
96
  import { expectedBalanceDeltas } from "./credit/expectedBalanceDeltas.js";
96
97
  import "./credit/index.js";
98
+ import { collateralPriceInUnderlying } from "./oracle/collateralPriceInUnderlying.js";
97
99
  import { isUpdatablePriceFeed } from "./pricefeeds/isUpdatablePriceFeed.js";
98
100
  import { PriceFeedRef } from "./pricefeeds/PriceFeedRef.js";
99
101
  import { AbstractPriceFeedContract, PartialPriceFeedInitError } from "./pricefeeds/AbstractPriceFeed.js";
@@ -144,4 +146,4 @@ import { RWARegistry } from "./rwa/RWARegistry.js";
144
146
  import { RWA_FACTORY_TYPES, isRWAFactory } from "./rwa/types.js";
145
147
  import "./rwa/index.js";
146
148
  import "./types.js";
147
- export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, dominantCollateral, erc4626ReferralAdapterAbi, expectedBalanceDeltas, fetchRedstonePayloads, fnSigToName, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getRawPriceUpdates, hasAdapterDeployParamsAbi, healthFactorBps, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isLPPriceFeed, isRWAFactory, isStrategyCollateral, isUpdatablePriceFeed, iwstETHAbi, iwstEthv1AdapterAbi, lidoV1_WETHGatewayAbi, mellowDvvAdapterAbi, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parsePosNegAmount, pickStrategyTargetCollateral, rayToBps, rewardsFromTransfers, strategyName, swapFromTransfers, toNetTransfers, usdToNumber };
149
+ export { AbstractAdapterContract, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AccountMigratorAdapterContract, AdapterType, BalancerStablePriceFeedContract, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, BoundedPriceFeedContract, CamelotV3AdapterContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, DEFAULT_QUOTA_BUFFER_BPS, DaiUsdsAdapterContract, ERC4626AdapterContract, ERC4626ReferralAdapterContract, Erc4626PriceFeedContract, ExternalPriceFeedContract, FluidDexAdapterContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LidoV1AdapterContract, LinearInterestRateModelContract, MAX_LEVERAGE_BUFFER_BPS, MarketRegister, MarketSuite, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, PARTIAL_LIQUIDATION_BUFFER_BPS, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PartialPriceFeedInitError, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PoolSuite, PoolV310Contract, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RedstonePriceFeedContract, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRedemptionGatewayAdapterContract, StakingRewardsAdapterContract, TraderJoePoolVersion, TraderJoeRouterAdapterContract, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UnsupportedZapperFunctionError, UpshiftVaultAdapterContract, VelodromeV2RouterAdapterContract, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, bpsToRay, calcBorrowApy, calcEffectiveBorrowApy, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcUtilization, calcUtilizationRaw, classifyCurveOperation, collateralPriceInUnderlying, createAdapter, createPriceOracle, createZapper, abi as creditFacadeV310Abi, creditOperationMarket, 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, totalLiquidationDiscount, usdToNumber };
@@ -0,0 +1,26 @@
1
+ import { PRICE_DECIMALS } from "../../constants/math.js";
2
+ //#region src/onchain/market/oracle/collateralPriceInUnderlying.ts
3
+ /**
4
+ * What one unit of `collateral` costs in `underlying` right now, in the
5
+ * oracle's 8-decimal (`PRICE_DECIMALS`) fixed point — the scale and the
6
+ * denomination `calcLiquidationPrice` answers in, so the two figures are read
7
+ * as a pair.
8
+ *
9
+ * Both sides come from the oracle's **main** feeds: this is the price the
10
+ * market quotes, not the conservative one a hand-over is weighed at.
11
+ *
12
+ * `null` when the oracle cannot answer for either token, or prices the
13
+ * underlying at zero — a screen shows a gap rather than a number derived from
14
+ * a missing feed.
15
+ **/
16
+ function collateralPriceInUnderlying(oracle, collateral, underlying) {
17
+ try {
18
+ const underlyingPrice = oracle.mainPrice(underlying);
19
+ if (underlyingPrice <= 0n) return null;
20
+ return oracle.mainPrice(collateral) * PRICE_DECIMALS / underlyingPrice;
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+ //#endregion
26
+ export { collateralPriceInUnderlying };
@@ -1,4 +1,5 @@
1
+ import { collateralPriceInUnderlying } from "./collateralPriceInUnderlying.js";
1
2
  import { PriceOracleV310Contract } from "./PriceOracleV310Contract.js";
2
3
  import { createPriceOracle } from "./createPriceOracle.js";
3
4
  import "./types.js";
4
- export { PriceOracleV310Contract, createPriceOracle };
5
+ export { PriceOracleV310Contract, collateralPriceInUnderlying, createPriceOracle };
@@ -1,4 +1,3 @@
1
- import { iPausableAbi } from "../../../abi/iPausable.js";
2
1
  import { iPoolV310Abi } from "../../../abi/310/generated.js";
3
2
  import { AddressMap } from "../../utils/AddressMap.js";
4
3
  import { RAY } from "../../constants/math.js";
@@ -8,6 +7,7 @@ import "../../utils/index.js";
8
7
  import { SdkRWADataNotLoadedError } from "../../core/errors.js";
9
8
  import { BaseContract } from "../../base/BaseContract.js";
10
9
  import "../../base/index.js";
10
+ import { iPausableAbi } from "../../../abi/iPausable.js";
11
11
  //#region src/onchain/market/pool/PoolV310Contract.ts
12
12
  const abi = [...iPoolV310Abi, ...iPausableAbi];
13
13
  var PoolV310Contract = class extends BaseContract {
@@ -1,5 +1,5 @@
1
- import { iethZapperAbi } from "../../../abi/iETHZapper.js";
2
1
  import { ZapperContract } from "./ZapperContract.js";
2
+ import { iethZapperAbi } from "../../../abi/iETHZapper.js";
3
3
  //#region src/onchain/market/zapper/IETHZapperContract.ts
4
4
  const abi = iethZapperAbi;
5
5
  var IETHZapperContract = class extends ZapperContract {
@@ -1,6 +1,6 @@
1
- import { iZapperAbi } from "../../../abi/iZapper.js";
2
1
  import { BaseContract } from "../../base/BaseContract.js";
3
2
  import "../../base/index.js";
3
+ import { iZapperAbi } from "../../../abi/iZapper.js";
4
4
  import { UnsupportedZapperFunctionError } from "./errors.js";
5
5
  //#region src/onchain/market/zapper/ZapperContract.ts
6
6
  /**
@@ -7,13 +7,15 @@ import { SDKConstruct } from "../base/SDKConstruct.js";
7
7
  import "../base/index.js";
8
8
  import { bpsToRay, calcBorrowApy, calcPositionLeverage, healthFactorBps, usdToNumber } from "../market/math.js";
9
9
  import { strategyName } from "../market/strategyName.js";
10
+ import { creditOperationMarket } from "../market/credit/creditOperationMarket.js";
10
11
  import { isFilterSet } from "../../model/filters.js";
11
12
  import { STRATEGY_POSITION_COLLATERAL_ERROR, matchesPositionFilter } from "../../model/positions.js";
12
13
  import "../../model/index.js";
14
+ import { collateralPriceInUnderlying } from "../market/oracle/collateralPriceInUnderlying.js";
13
15
  import { borrowRateAtUtilization, utilizationAfterLiquidityChange } from "../market/pool/math.js";
14
16
  import { calcBorrowRate } from "./calcBorrowRate.js";
15
17
  import { calcHealthFactor } from "./calcHealthFactor.js";
16
- import { calcLiquidationPrice } from "./calcLiquidationPrice.js";
18
+ import { calcLiquidationPrice, soleNonUnderlyingCollateral } from "./calcLiquidationPrice.js";
17
19
  import { calcTimeToLiquidationMs } from "./calcTimeToLiquidationMs.js";
18
20
  import { accountSnapshotFromCreditAccountData } from "./types.js";
19
21
  //#region src/onchain/positions/PositionsService.ts
@@ -163,6 +165,20 @@ var PositionsService = class extends SDKConstruct {
163
165
  });
164
166
  }
165
167
  /**
168
+ * What the collateral {@link liquidationPrice} is quoted for costs in the
169
+ * market underlying right now, in the same `PRICE_DECIMALS` fixed point —
170
+ * the pair a form shows beside the liquidation price. `null` under exactly
171
+ * the conditions that leave the liquidation price `null`, plus an oracle
172
+ * that cannot answer for either side.
173
+ **/
174
+ currentPrice(snapshot) {
175
+ const market = this.sdk.marketRegister.findByCreditManager(snapshot.creditManager);
176
+ const underlying = market.pool.underlying;
177
+ const collateral = soleNonUnderlyingCollateral(snapshot, underlying);
178
+ if (!collateral) return null;
179
+ return collateralPriceInUnderlying(market.priceOracle, collateral, underlying);
180
+ }
181
+ /**
166
182
  * Every derived number of an account state at once — the whole
167
183
  * {@link AccountMetrics} half of a projection.
168
184
  *
@@ -228,8 +244,7 @@ var PositionsService = class extends SDKConstruct {
228
244
  const market = this.sdk.marketRegister.findByCreditManager(creditManager);
229
245
  const { priceOracle } = market;
230
246
  return {
231
- creditManager,
232
- name: this.sdk.marketRegister.findCreditManager(creditManager).name,
247
+ ...creditOperationMarket(this.sdk.marketRegister.findCreditManager(creditManager)),
233
248
  totalValue: market.toUnderlyingAmount(totalValue),
234
249
  totalDebt: market.toUnderlyingAmount(totalDebt),
235
250
  netValue: market.toUnderlyingAmount(totalValue - totalDebt),
@@ -10,13 +10,22 @@ import { isAddressEqual } from "viem";
10
10
  * holds exactly one non-dust non-underlying asset; otherwise `null`.
11
11
  **/
12
12
  function calcLiquidationPrice(props) {
13
- const { snapshot, underlying } = props;
14
- const targets = snapshot.assets.filter((a) => a.balance > 10n && !isAddressEqual(a.token, underlying));
15
- if (targets.length !== 1) return null;
13
+ const targetToken = soleNonUnderlyingCollateral(props.snapshot, props.underlying);
14
+ if (!targetToken) return null;
16
15
  return calcLiquidationPriceForTarget({
17
16
  ...props,
18
- targetToken: targets[0].token
17
+ targetToken
19
18
  });
20
19
  }
20
+ /**
21
+ * The one collateral a liquidation price — and the current price beside it —
22
+ * can be quoted for: the account's single non-dust, non-underlying asset.
23
+ * `null` when it holds none or several, which is the case neither figure
24
+ * exists for.
25
+ **/
26
+ function soleNonUnderlyingCollateral(snapshot, underlying) {
27
+ const targets = snapshot.assets.filter((a) => a.balance > 10n && !isAddressEqual(a.token, underlying));
28
+ return targets.length === 1 ? targets[0].token : null;
29
+ }
21
30
  //#endregion
22
- export { calcLiquidationPrice };
31
+ export { calcLiquidationPrice, soleNonUnderlyingCollateral };
@@ -1,9 +1,9 @@
1
1
  import { calcBorrowRate } from "./calcBorrowRate.js";
2
2
  import { calcHealthFactor } from "./calcHealthFactor.js";
3
3
  import { calcLiquidationPriceForTarget } from "./calcLiquidationPriceForTarget.js";
4
- import { calcLiquidationPrice } from "./calcLiquidationPrice.js";
4
+ import { calcLiquidationPrice, soleNonUnderlyingCollateral } from "./calcLiquidationPrice.js";
5
5
  import { calcTimeToLiquidationMs } from "./calcTimeToLiquidationMs.js";
6
6
  import { MultichainPositionsService } from "./MultichainPositionsService.js";
7
7
  import { accountSnapshotFromCreditAccountData } from "./types.js";
8
8
  import { PositionsService } from "./PositionsService.js";
9
- export { MultichainPositionsService, PositionsService, accountSnapshotFromCreditAccountData, calcBorrowRate, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcTimeToLiquidationMs };
9
+ export { MultichainPositionsService, PositionsService, accountSnapshotFromCreditAccountData, calcBorrowRate, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcTimeToLiquidationMs, soleNonUnderlyingCollateral };
@@ -1,6 +1,6 @@
1
1
  import { errorAbis } from "../../../abi/errors.js";
2
- import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
3
2
  import { generateCastTraceCall } from "./cast.js";
3
+ import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
4
4
  import { simulateMulticall } from "./simulateMulticall.js";
5
5
  import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
6
6
  import { getAction, parseAccount } from "viem/utils";
@@ -1,6 +1,7 @@
1
1
  import { AssetsMap } from "../../onchain/utils/AssetsMap.js";
2
2
  import { BigIntMath } from "../../onchain/utils/bigint-math.js";
3
3
  import { DUST_THRESHOLD } from "../../onchain/constants/math.js";
4
+ import { creditOperationMarket } from "../../onchain/market/credit/creditOperationMarket.js";
4
5
  import { ERROR_UNPRICEABLE_TOKEN, asEstimated } from "../../model/previews.js";
5
6
  import "../../model/index.js";
6
7
  import "../../onchain/index.js";
@@ -165,8 +166,7 @@ function buildClosePreview(post, converter, receivedToken, sdk) {
165
166
  return {
166
167
  operation: "CloseCreditAccount",
167
168
  permanent: false,
168
- creditManager: post.creditManager,
169
- name: sdk.marketRegister.findCreditManager(post.creditManager).name,
169
+ ...creditOperationMarket(sdk.marketRegister.findCreditManager(post.creditManager)),
170
170
  creditAccount: post.creditAccount,
171
171
  receivedAmount: oracle.toTokenAmount(receivedToken, BigIntMath.max(totalValue - post.totalDebt, 0n)),
172
172
  error: converter.error
@@ -1,5 +1,6 @@
1
1
  import { AP_WETH_TOKEN } from "../../onchain/constants/address-provider.js";
2
2
  import "../../onchain/constants/math.js";
3
+ import { creditOperationMarket } from "../../onchain/market/credit/creditOperationMarket.js";
3
4
  import "../../onchain/index.js";
4
5
  import { classifyCloseOrRepay } from "./detectCloseOrRepay.js";
5
6
  import { replayMulticall } from "./replayMulticall.js";
@@ -31,8 +32,7 @@ function previewCloseCreditAccount(input, operation, permanent, replay) {
31
32
  return {
32
33
  operation: "CloseCreditAccount",
33
34
  permanent,
34
- creditManager: operation.creditManager,
35
- name: sdk.marketRegister.findCreditManager(operation.creditManager).name,
35
+ ...creditOperationMarket(sdk.marketRegister.findCreditManager(operation.creditManager)),
36
36
  creditAccount: operation.creditAccount,
37
37
  receivedAmount: market.priceOracle.toTokenAmount(receivedToken, after.collateralWithdrawn.getOrZero(receivedToken)),
38
38
  error
@@ -52,8 +52,7 @@ function previewRepayCreditAccount(input, operation, permanent, replay) {
52
52
  return {
53
53
  operation: "RepayCreditAccount",
54
54
  permanent,
55
- creditManager: operation.creditManager,
56
- name: sdk.marketRegister.findCreditManager(operation.creditManager).name,
55
+ ...creditOperationMarket(sdk.marketRegister.findCreditManager(operation.creditManager)),
57
56
  creditAccount: operation.creditAccount,
58
57
  collateralAdded: collateralAdded.map((a) => market.priceOracle.toTokenAmount(a.token, a.balance)),
59
58
  debtRepaid: market.toUnderlyingAmount(before.totalDebt - after.account.totalDebt),
@@ -1,3 +1,5 @@
1
+ import { creditOperationMarket } from "../../onchain/market/credit/creditOperationMarket.js";
2
+ import "../../onchain/index.js";
1
3
  import { parseOperationCalldata } from "../parse/parseOperationCalldata.js";
2
4
  import { isPoolOperation } from "../parse/types.js";
3
5
  import "../parse/index.js";
@@ -66,8 +68,7 @@ async function previewMulticallOperation(input, operation, options) {
66
68
  return {
67
69
  operation: "DelayedCreditAccountOperation",
68
70
  creditAccount: operation.creditAccount,
69
- creditManager: operation.creditManager,
70
- name: sdk.marketRegister.findCreditManager(operation.creditManager).name,
71
+ ...creditOperationMarket(sdk.marketRegister.findCreditManager(operation.creditManager)),
71
72
  intent: delayed.intent,
72
73
  instantPreview,
73
74
  delayedPreview: buildDelayedStrategyVerify(after.account, before, delayed, convert, receivedToken, sdk)
@@ -1,5 +1,5 @@
1
- import { iZapperAbi } from "../../abi/iZapper.js";
2
1
  import { iPoolV310Abi } from "../../abi/310/generated.js";
2
+ import { iZapperAbi } from "../../abi/iZapper.js";
3
3
  import { asPreviewSimulationError } from "./errors.js";
4
4
  //#region src/preview/simulate/simulatePoolOperation.ts
5
5
  function previewRead(operation) {
@@ -1,5 +1,5 @@
1
- import { ierc20Abi } from "../../abi/iERC20.js";
2
1
  import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
2
+ import { ierc20Abi } from "../../abi/iERC20.js";
3
3
  import { AddressMap } from "../../onchain/utils/AddressMap.js";
4
4
  import "../../onchain/index.js";
5
5
  import { UnexpectedFacadeEventOrderError } from "./errors.js";
@@ -15,8 +15,8 @@ import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
15
15
  import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
16
16
  import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
17
17
  import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
18
- import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, OperationPreview, OperationPreviewError, PoolOperationType, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, RoutedField, asEstimated } from "./previews.js";
18
+ import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, CreditOperationMarket, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, OperationPreview, OperationPreviewError, PoolOperationType, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, RoutedField, asEstimated } from "./previews.js";
19
19
  import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
20
20
  import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
21
21
  import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
22
- export { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, RoutedField, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
22
+ export { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CompareTag, CompareTolerance, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, RoutedField, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
@@ -142,6 +142,40 @@ interface PreviewLpVerify {
142
142
  */
143
143
  error?: OperationPreviewError;
144
144
  }
145
+ /**
146
+ * The market a credit operation acts on, reported the same way by every half of
147
+ * the SDK: the calldata previews, the intents engine's projections and the
148
+ * open-strategy walk all carry it, so a screen naming the market needs nothing
149
+ * beside the result it already holds.
150
+ **/
151
+ interface CreditOperationMarket {
152
+ /**
153
+ * Credit manager the account belongs to. Carried on the result itself so a
154
+ * caller weighing one — `checkSimulation` among them — needs nothing beside
155
+ * it to find the market.
156
+ */
157
+ creditManager: Address;
158
+ /**
159
+ * Human-readable credit manager name.
160
+ */
161
+ name: string;
162
+ /**
163
+ * Market configurator of the market {@link creditManager} belongs to — the
164
+ * on-chain identity of the curator, which is what a curator link and a
165
+ * curator name resolve from. Not a personal wallet.
166
+ */
167
+ curator: Address;
168
+ /**
169
+ * What a liquidation takes off the account, in basis points: the premium the
170
+ * liquidator keeps plus the protocol's own fee.
171
+ *
172
+ * Not the credit manager's `liquidationDiscount`, which is the complement of
173
+ * the premium alone (`100% - liquidationPremium`) and says what share of the
174
+ * collateral repays the debt. This is the figure a position screen labels
175
+ * "Liquidation Discount": `liquidationPremium + feeLiquidation`.
176
+ */
177
+ liquidationDiscount: Bps;
178
+ }
145
179
  /**
146
180
  * What an account is worth and what it is made of, once an operation has run.
147
181
  *
@@ -250,18 +284,7 @@ interface AccountMetrics {
250
284
  * what they mean on a {@link StrategyPosition}, down to the token an amount
251
285
  * names — an RWA market reports USDC, not the dcUSDC wrapper the pool holds.
252
286
  **/
253
- interface AccountProjection extends AccountHoldings, AccountMetrics {
254
- /**
255
- * Credit manager the account belongs to. Carried on the projection itself so
256
- * a caller weighing one — `checkSimulation` among them — needs nothing beside
257
- * it to find the market.
258
- */
259
- creditManager: Address;
260
- /**
261
- * Human-readable credit manager name.
262
- */
263
- name: string;
264
- }
287
+ interface AccountProjection extends CreditOperationMarket, AccountHoldings, AccountMetrics {}
265
288
  /**
266
289
  * The fields of an {@link AccountProjection} a routed leg's outcome decides.
267
290
  *
@@ -409,9 +432,9 @@ interface PreviewAdjustStrategyVerify extends EstimatedProjection, AccountStateC
409
432
  *
410
433
  * Carries no {@link AccountProjection}: the account it describes ends up empty,
411
434
  * so there is no position left to weigh — what a caller wants to know is the
412
- * payout.
435
+ * payout. The market it happened in is still named, as everywhere else.
413
436
  **/
414
- interface PreviewExitStrategyVerify {
437
+ interface PreviewExitStrategyVerify extends CreditOperationMarket {
415
438
  operation: "CloseCreditAccount";
416
439
  /**
417
440
  * True when the account is closed permanently (facade `closeCreditAccount`
@@ -419,14 +442,6 @@ interface PreviewExitStrategyVerify {
419
442
  * (plain multicall).
420
443
  */
421
444
  permanent: boolean;
422
- /**
423
- * Credit manager the account belongs to
424
- */
425
- creditManager: Address;
426
- /**
427
- * Human-readable credit manager name
428
- */
429
- name: string;
430
445
  /**
431
446
  * Credit account that is being closed
432
447
  */
@@ -459,7 +474,7 @@ interface PreviewExitStrategyVerify {
459
474
  * Carries no {@link AccountProjection} for the same reason the exit does not:
460
475
  * the loan ends here, so the risk metrics have nothing left to describe.
461
476
  **/
462
- interface PreviewRepayStrategyVerify {
477
+ interface PreviewRepayStrategyVerify extends CreditOperationMarket {
463
478
  operation: "RepayCreditAccount";
464
479
  /**
465
480
  * True when the account is closed permanently (facade `closeCreditAccount`
@@ -467,14 +482,6 @@ interface PreviewRepayStrategyVerify {
467
482
  * (plain multicall).
468
483
  */
469
484
  permanent: boolean;
470
- /**
471
- * Credit manager the account belongs to
472
- */
473
- creditManager: Address;
474
- /**
475
- * Human-readable credit manager name
476
- */
477
- name: string;
478
485
  /**
479
486
  * Credit account that is being repaid
480
487
  */
@@ -524,20 +531,12 @@ type PreviewInstantStrategyVerify = PreviewAdjustStrategyVerify | PreviewExitStr
524
531
  * the actual claim token materializes later, when the withdrawal is claimed and
525
532
  * the recorded (if any) is resumed
526
533
  */
527
- interface PreviewDelayedStrategyVerify {
534
+ interface PreviewDelayedStrategyVerify extends CreditOperationMarket {
528
535
  operation: "DelayedCreditAccountOperation";
529
536
  /**
530
537
  * Credit account the operation is performed on
531
538
  */
532
539
  creditAccount: Address;
533
- /**
534
- * Credit manager the account belongs to
535
- */
536
- creditManager: Address;
537
- /**
538
- * Human-readable credit manager name
539
- */
540
- name: string;
541
540
  /**
542
541
  * Decoded from the withdrawal request's extraData; undefined when the
543
542
  * request carries no intent (e.g. Mellow)
@@ -562,4 +561,4 @@ interface PreviewDelayedStrategyVerify {
562
561
  */
563
562
  type OperationPreview = PreviewLpVerify | PreviewOpenStrategyVerify | PreviewAdjustStrategyVerify | PreviewExitStrategyVerify | PreviewRepayStrategyVerify | PreviewDelayedStrategyVerify;
564
563
  //#endregion
565
- export { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, OperationPreview, OperationPreviewError, PoolOperationType, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, RoutedField, asEstimated };
564
+ export { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, CreditOperationMarket, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, Estimated, EstimatedProjection, OperationPreview, OperationPreviewError, PoolOperationType, PreviewAdjustStrategyVerify, PreviewDelayedStrategyVerify, PreviewExitStrategyVerify, PreviewInstantStrategyVerify, PreviewLpVerify, PreviewOpenStrategyVerify, PreviewOperationInput, PreviewOperationOptions, PreviewRepayStrategyVerify, RoutedField, asEstimated };
@@ -35,6 +35,18 @@ interface OpenStrategyProps {
35
35
  interface OpenStrategyPreview extends Omit<AccountProjection, "assets" | "quotas"> {
36
36
  /** What the routed leg lost to market depth; `undefined` if not measured. */
37
37
  priceImpact: PathLossRate | undefined;
38
+ /**
39
+ * What the position's collateral costs in the market underlying right now, in
40
+ * the oracle's 8-decimal fixed point — the same scale and the same pair as
41
+ * {@link liquidationPrice}, so a screen showing both reads them as one pair.
42
+ *
43
+ * `null` where there is no pair to quote: an account holding zero or several
44
+ * non-underlying assets, or one whose collateral the oracle cannot price.
45
+ *
46
+ * Simulations only. A calldata preview is not asked for it: it reports what a
47
+ * transaction does, not what the market costs while a form is open.
48
+ */
49
+ currentPrice: bigint | null;
38
50
  /** Expected post-open balances. */
39
51
  averageAssets: TokenAmount[];
40
52
  /** Floor post-open balances after slippage. */
@@ -13,6 +13,17 @@ import { Address } from "viem";
13
13
  * from their inputs, so `result.calls` pins down which ops reached the
14
14
  * assembler and in which order.
15
15
  */
16
+ /** Market configurator the mock market is governed by — the curator's address. */
17
+ declare const MOCK_MARKET_CONFIGURATOR: Address;
18
+ /**
19
+ * Liquidation fees of the mock suite: a 3% premium (the manager reports its
20
+ * complement) on top of a 1.5% protocol fee, so the discount a screen shows is
21
+ * 450bps.
22
+ */
23
+ declare const MOCK_LIQUIDATION_FEES: {
24
+ feeLiquidation: number;
25
+ liquidationDiscount: number;
26
+ };
16
27
  /** Recognizable router call embedded in routed leg results. */
17
28
  declare const MOCK_ROUTER_CALL: MultiCall;
18
29
  /** Router call of the many-to-one leg an exit routes. */
@@ -41,6 +41,18 @@ interface OperationState extends AccountProjection {
41
41
  * routed or nothing could be measured — never a manufactured zero.
42
42
  */
43
43
  priceImpact: PathLossRate | undefined;
44
+ /**
45
+ * What the position's collateral costs in the market underlying right now, in
46
+ * the oracle's 8-decimal fixed point — the same scale and the same pair as
47
+ * {@link liquidationPrice}, so a screen showing both reads them as one pair.
48
+ *
49
+ * `null` where there is no pair to quote: an account holding zero or several
50
+ * non-underlying assets, or one whose collateral the oracle cannot price.
51
+ *
52
+ * Simulations only. A calldata preview is not asked for it: it reports what a
53
+ * transaction does, not what the market costs while a form is open.
54
+ */
55
+ currentPrice: bigint | null;
44
56
  }
45
57
  /**
46
58
  * What a preview yields: the operation chain, the state it projects, and the