@morpho-org/morpho-sdk 6.0.0 → 6.2.0

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 (99) hide show
  1. package/MIGRATION-v5-to-v6.md +1 -1
  2. package/README.md +1 -1
  3. package/lib/cjs/abis.d.ts +1 -1
  4. package/lib/cjs/abis.js +3 -1
  5. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +16 -5
  6. package/lib/cjs/actions/vaultV2/forceWithdraw.js +16 -5
  7. package/lib/cjs/blue/errors.d.ts +1 -1
  8. package/lib/cjs/blue/errors.js +2 -1
  9. package/lib/cjs/constants.d.ts +1 -1
  10. package/lib/cjs/constants.js +4 -1
  11. package/lib/cjs/entities/blue/blue.d.ts +28 -0
  12. package/lib/cjs/entities/blue/blue.js +1 -0
  13. package/lib/cjs/entities/index.d.ts +1 -1
  14. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +1 -0
  15. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -2
  16. package/lib/cjs/entities/vaultV1/vaultV1.js +2 -0
  17. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +35 -11
  18. package/lib/cjs/entities/vaultV2/vaultV2.js +1 -0
  19. package/lib/cjs/errors.d.ts +2 -2
  20. package/lib/cjs/errors.js +9 -1
  21. package/lib/cjs/helpers/encodeDeallocation.d.ts +1 -0
  22. package/lib/cjs/helpers/encodeDeallocation.js +1 -0
  23. package/lib/cjs/helpers/metadata.d.ts +13 -0
  24. package/lib/cjs/helpers/metadata.js +13 -0
  25. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +10 -6
  26. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +10 -6
  27. package/lib/cjs/helpers/slippage.d.ts +3 -2
  28. package/lib/cjs/helpers/slippage.js +3 -2
  29. package/lib/cjs/helpers/validate.d.ts +40 -2
  30. package/lib/cjs/helpers/validate.js +42 -3
  31. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +94 -59
  32. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +94 -59
  33. package/lib/cjs/midnight/abis.d.ts +1 -1
  34. package/lib/cjs/midnight/abis.js +3 -1
  35. package/lib/cjs/midnight/constants.d.ts +1 -1
  36. package/lib/cjs/midnight/constants.js +4 -1
  37. package/lib/cjs/midnight/entities.d.ts +1 -1
  38. package/lib/cjs/midnight/errors.d.ts +1 -1
  39. package/lib/cjs/midnight/errors.js +7 -1
  40. package/lib/cjs/midnight/types.d.ts +1 -1
  41. package/lib/cjs/midnight/utils.d.ts +11 -1
  42. package/lib/cjs/midnight/utils.js +13 -1
  43. package/lib/cjs/types/action.d.ts +34 -0
  44. package/lib/cjs/types/action.js +10 -0
  45. package/lib/cjs/types/data.d.ts +3 -0
  46. package/lib/cjs/types/entity.d.ts +3 -0
  47. package/lib/cjs/types/metadata.d.ts +6 -0
  48. package/lib/cjs/types.d.ts +1 -1
  49. package/lib/cjs/utils.d.ts +11 -1
  50. package/lib/cjs/utils.js +14 -2
  51. package/lib/esm/abis.d.ts +1 -1
  52. package/lib/esm/abis.js +1 -1
  53. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +16 -5
  54. package/lib/esm/actions/vaultV2/forceWithdraw.js +16 -5
  55. package/lib/esm/blue/errors.d.ts +1 -1
  56. package/lib/esm/blue/errors.js +1 -1
  57. package/lib/esm/constants.d.ts +1 -1
  58. package/lib/esm/constants.js +1 -1
  59. package/lib/esm/entities/blue/blue.d.ts +28 -0
  60. package/lib/esm/entities/blue/blue.js +1 -0
  61. package/lib/esm/entities/index.d.ts +1 -1
  62. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +1 -0
  63. package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -2
  64. package/lib/esm/entities/vaultV1/vaultV1.js +2 -0
  65. package/lib/esm/entities/vaultV2/vaultV2.d.ts +35 -11
  66. package/lib/esm/entities/vaultV2/vaultV2.js +1 -0
  67. package/lib/esm/errors.d.ts +2 -2
  68. package/lib/esm/errors.js +2 -2
  69. package/lib/esm/helpers/encodeDeallocation.d.ts +1 -0
  70. package/lib/esm/helpers/encodeDeallocation.js +1 -0
  71. package/lib/esm/helpers/metadata.d.ts +13 -0
  72. package/lib/esm/helpers/metadata.js +13 -0
  73. package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +10 -6
  74. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +10 -6
  75. package/lib/esm/helpers/slippage.d.ts +3 -2
  76. package/lib/esm/helpers/slippage.js +3 -2
  77. package/lib/esm/helpers/validate.d.ts +40 -2
  78. package/lib/esm/helpers/validate.js +41 -1
  79. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +94 -59
  80. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +94 -59
  81. package/lib/esm/midnight/abis.d.ts +1 -1
  82. package/lib/esm/midnight/abis.js +1 -1
  83. package/lib/esm/midnight/constants.d.ts +1 -1
  84. package/lib/esm/midnight/constants.js +1 -1
  85. package/lib/esm/midnight/entities.d.ts +1 -1
  86. package/lib/esm/midnight/errors.d.ts +1 -1
  87. package/lib/esm/midnight/errors.js +1 -1
  88. package/lib/esm/midnight/types.d.ts +1 -1
  89. package/lib/esm/midnight/utils.d.ts +11 -1
  90. package/lib/esm/midnight/utils.js +11 -1
  91. package/lib/esm/types/action.d.ts +34 -0
  92. package/lib/esm/types/action.js +10 -0
  93. package/lib/esm/types/data.d.ts +3 -0
  94. package/lib/esm/types/entity.d.ts +3 -0
  95. package/lib/esm/types/metadata.d.ts +6 -0
  96. package/lib/esm/types.d.ts +1 -1
  97. package/lib/esm/utils.d.ts +11 -1
  98. package/lib/esm/utils.js +11 -1
  99. package/package.json +7 -7
@@ -491,7 +491,7 @@ Migration steps:
491
491
  - Replace `InKindRedeemRequiresSingleAdapterError` and `UnsupportedInKindAdapterError` with
492
492
  `VaultV2SingleAdapterRequiredError` and `VaultV2UnsupportedExitAdapterError`.
493
493
 
494
- See the [`TIB-2026-08-28-vault-exit-force-withdraw`](https://github.com/morpho-org/sdks/blob/main/docs/tibs/TIB-2026-08-28-vault-exit-force-withdraw.md)
494
+ See the [`ADR-2026-08-28-vault-exit-force-withdraw`](https://github.com/morpho-org/sdks/blob/main/docs/adrs/ADR-2026-08-28-vault-exit-force-withdraw.md)
495
495
  decision record for the full rationale.
496
496
 
497
497
  ## Update Vault V1 and Vault V2 writes
package/README.md CHANGED
@@ -42,7 +42,7 @@ BlueBundlesV1, and the remaining rows identify their destination.
42
42
  | | `inKindRedeem` | VaultExitBundlesV1 |
43
43
  | **Blue** | `supply`, `withdraw`, `supplyCollateral`, `borrow`, `supplyCollateralBorrow`, `repay`, `withdrawCollateral`, `repayWithdrawCollateral`, `refinance` | BlueBundlesV1 |
44
44
  | **Midnight** | `takeLend`, `takeBorrow`, `supplyCollateralTakeBorrow`, `repayWithdrawCollateral` | Midnight Bundles |
45
- | | `makeLend`, `makeBorrow` | Midnight mempool |
45
+ | | `makeLend`, `makeBorrow`, `supplyCollateralMakeBorrow` | Midnight mempool |
46
46
  | | `supplyCollateral`, `redeem`, `cancelOffer` | Direct call |
47
47
 
48
48
  `VaultExitBundlesV1`, `VaultBundlesV1`, and `BlueBundlesV1` are registered on Ethereum, Base,
package/lib/cjs/abis.d.ts CHANGED
@@ -4,7 +4,7 @@ export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi,
4
4
  preLiquidationAbi as bluePreLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
6
  preLiquidationFactoryAbi as bluePreLiquidationFactoryAbi, vaultV2Abi, vaultV2BluePublicAllocatorAbi, vaultV2FactoryAbi, whitelistControllerAggregatorV2Abi, wrappedBackedTokenAbi, wstEthAbi, } from "@morpho-org/blue-sdk-viem";
7
- export { ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi as midnightSetterRatifierAbi, } from "@morpho-org/midnight-sdk";
7
+ export { ecrecoverRatifierAbi as midnightEcrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, priceRatifierV1Abi as midnightPriceRatifierV1Abi, rateRatifierV1Abi as midnightRateRatifierV1Abi, setterRatifierAbi as midnightSetterRatifierAbi, } from "@morpho-org/midnight-sdk";
8
8
  /** ABI for the VaultExitBundlesV1 periphery contract. */
9
9
  export declare const vaultExitBundlesV1Abi: readonly [{
10
10
  readonly type: "constructor";
package/lib/cjs/abis.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.blueBundlesV1Abi = exports.vaultBundlesV1Abi = exports.vaultExitBundlesV1Abi = exports.midnightSetterRatifierAbi = exports.midnightBundlesAbi = exports.midnightAbi = exports.midnightEcrecoverRatifierAbi = exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.bluePreLiquidationFactoryAbi = exports.bluePreLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.blueAdaptiveCurveIrmAbi = exports.blueMarketParamsAbi = void 0;
3
+ exports.blueBundlesV1Abi = exports.vaultBundlesV1Abi = exports.vaultExitBundlesV1Abi = exports.midnightSetterRatifierAbi = exports.midnightRateRatifierV1Abi = exports.midnightPriceRatifierV1Abi = exports.midnightBundlesAbi = exports.midnightAbi = exports.midnightEcrecoverRatifierAbi = exports.wstEthAbi = exports.wrappedBackedTokenAbi = exports.whitelistControllerAggregatorV2Abi = exports.vaultV2FactoryAbi = exports.vaultV2BluePublicAllocatorAbi = exports.vaultV2Abi = exports.bluePreLiquidationFactoryAbi = exports.bluePreLiquidationAbi = exports.permit2Abi = exports.permissionedErc20WrapperAbi = exports.morphoVaultV1AdapterFactoryAbi = exports.morphoVaultV1AdapterAbi = exports.morphoMarketV1AdapterV2FactoryAbi = exports.morphoMarketV1AdapterV2Abi = exports.morphoMarketV1AdapterFactoryAbi = exports.morphoMarketV1AdapterAbi = exports.metaMorphoFactoryAbi = exports.metaMorphoAbi = exports.erc5267Abi = exports.erc2612Abi = exports.blueOracleAbi = exports.blueAbi = exports.blueAdaptiveCurveIrmAbi = exports.blueMarketParamsAbi = void 0;
4
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "blueMarketParamsAbi", { enumerable: true, get: function () { return blue_sdk_1.marketParamsAbi; } });
6
6
  var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
@@ -33,6 +33,8 @@ var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
33
33
  Object.defineProperty(exports, "midnightEcrecoverRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.ecrecoverRatifierAbi; } });
34
34
  Object.defineProperty(exports, "midnightAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightAbi; } });
35
35
  Object.defineProperty(exports, "midnightBundlesAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightBundlesAbi; } });
36
+ Object.defineProperty(exports, "midnightPriceRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.priceRatifierV1Abi; } });
37
+ Object.defineProperty(exports, "midnightRateRatifierV1Abi", { enumerable: true, get: function () { return midnight_sdk_1.rateRatifierV1Abi; } });
36
38
  Object.defineProperty(exports, "midnightSetterRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.setterRatifierAbi; } });
37
39
  /** ABI for the VaultExitBundlesV1 periphery contract. */
38
40
  exports.vaultExitBundlesV1Abi = [
@@ -67,12 +67,23 @@ export interface VaultV2ForceWithdrawParams {
67
67
  * @example
68
68
  * ```ts
69
69
  * import { vaultV2ForceWithdraw } from "@morpho-org/morpho-sdk";
70
+ * import type { Address } from "viem";
71
+ * import { mainnet } from "viem/chains";
70
72
  *
71
- * const tx = vaultV2ForceWithdraw({
72
- * vault: { chainId: 1, address: vault },
73
- * args: { adapter, exitAssets: 1_000_000n, minSharePriceE27, userAddress, deadline },
74
- * });
75
- * // tx satisfies Readonly<Transaction<VaultV2ForceWithdrawAction>>
73
+ * export function buildForceWithdraw(
74
+ * vault: Address,
75
+ * adapter: Address,
76
+ * minSharePriceE27: bigint,
77
+ * userAddress: Address,
78
+ * deadline: bigint,
79
+ * ) {
80
+ * const tx = vaultV2ForceWithdraw({
81
+ * vault: { chainId: mainnet.id, address: vault },
82
+ * args: { adapter, exitAssets: 1_000_000n, minSharePriceE27, userAddress, deadline },
83
+ * });
84
+ * // tx satisfies Readonly<Transaction<VaultV2ForceWithdrawAction>>
85
+ * return tx;
86
+ * }
76
87
  * ```
77
88
  */
78
89
  export declare const vaultV2ForceWithdraw: ({ vault, args, metadata, }: VaultV2ForceWithdrawParams) => Readonly<Transaction<VaultV2ForceWithdrawAction>>;
@@ -57,12 +57,23 @@ const common_js_1 = require("../bundles/common.js");
57
57
  * @example
58
58
  * ```ts
59
59
  * import { vaultV2ForceWithdraw } from "@morpho-org/morpho-sdk";
60
+ * import type { Address } from "viem";
61
+ * import { mainnet } from "viem/chains";
60
62
  *
61
- * const tx = vaultV2ForceWithdraw({
62
- * vault: { chainId: 1, address: vault },
63
- * args: { adapter, exitAssets: 1_000_000n, minSharePriceE27, userAddress, deadline },
64
- * });
65
- * // tx satisfies Readonly<Transaction<VaultV2ForceWithdrawAction>>
63
+ * export function buildForceWithdraw(
64
+ * vault: Address,
65
+ * adapter: Address,
66
+ * minSharePriceE27: bigint,
67
+ * userAddress: Address,
68
+ * deadline: bigint,
69
+ * ) {
70
+ * const tx = vaultV2ForceWithdraw({
71
+ * vault: { chainId: mainnet.id, address: vault },
72
+ * args: { adapter, exitAssets: 1_000_000n, minSharePriceE27, userAddress, deadline },
73
+ * });
74
+ * // tx satisfies Readonly<Transaction<VaultV2ForceWithdrawAction>>
75
+ * return tx;
76
+ * }
66
77
  * ```
67
78
  */
68
79
  const vaultV2ForceWithdraw = ({ vault, args, metadata, }) => {
@@ -1,4 +1,4 @@
1
1
  export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MarketParamsIdMismatchError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedPermitDomainExtensionsError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
3
+ exports.UnsupportedPermitDomainExtensionsError = exports.MarketParamsIdMismatchError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
4
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
6
6
  Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return blue_sdk_1.DivisionByZeroError; } });
@@ -29,4 +29,5 @@ Object.defineProperty(exports, "InvalidNumberError", { enumerable: true, get: fu
29
29
  Object.defineProperty(exports, "InvalidPermitDomainChainIdError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainChainIdError; } });
30
30
  Object.defineProperty(exports, "InvalidPermitDomainVerifyingContractError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainVerifyingContractError; } });
31
31
  Object.defineProperty(exports, "isUnknownOfFactoryError", { enumerable: true, get: function () { return blue_sdk_viem_1.isUnknownOfFactoryError; } });
32
+ Object.defineProperty(exports, "MarketParamsIdMismatchError", { enumerable: true, get: function () { return blue_sdk_viem_1.MarketParamsIdMismatchError; } });
32
33
  Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
@@ -1,4 +1,4 @@
1
1
  export { DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, ERC20_ALLOWANCE_RECIPIENTS, isMarketId as isBlueMarketId, LIQUIDATION_CURSOR as BLUE_LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR as BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType as BlueTransactionType, } from "@morpho-org/blue-sdk";
2
- export { CBP as MIDNIGHT_CBP, COLLATERAL_PARAMS_TYPEHASH as MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING as MIDNIGHT_DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH as MIDNIGHT_EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH as MIDNIGHT_MARKET_TYPEHASH, MAX_COLLATERALS as MIDNIGHT_MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER as MIDNIGHT_MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE as MIDNIGHT_MAX_CONTINUOUS_FEE, MAX_OFFER_CAP as MIDNIGHT_MAX_OFFER_CAP, MAX_SETTLEMENT_FEES as MIDNIGHT_MAX_SETTLEMENT_FEES, MAX_TICK as MIDNIGHT_MAX_TICK, OFFER_TYPEHASH as MIDNIGHT_OFFER_TYPEHASH, PRICE_ROUNDING_STEP as MIDNIGHT_PRICE_ROUNDING_STEP, SETTLEMENT_FEE_BREAKPOINTS as MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF as MIDNIGHT_TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
2
+ export { CBP as MIDNIGHT_CBP, COLLATERAL_PARAMS_TYPEHASH as MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING as MIDNIGHT_DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH as MIDNIGHT_EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH as MIDNIGHT_MARKET_TYPEHASH, MAX_COLLATERALS as MIDNIGHT_MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER as MIDNIGHT_MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE as MIDNIGHT_MAX_CONTINUOUS_FEE, MAX_OFFER_CAP as MIDNIGHT_MAX_OFFER_CAP, MAX_SETTLEMENT_FEES as MIDNIGHT_MAX_SETTLEMENT_FEES, MAX_TICK as MIDNIGHT_MAX_TICK, MAX_TREE_HEIGHT as MIDNIGHT_MAX_TREE_HEIGHT, OFFER_TYPEHASH as MIDNIGHT_OFFER_TYPEHASH, PRICE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH, PRICE_ROUNDING_STEP as MIDNIGHT_PRICE_ROUNDING_STEP, RATE_RATIFIER_V1_OFFER_TYPEHASH as MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH, SETTLEMENT_FEE_BREAKPOINTS as MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF as MIDNIGHT_TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
3
3
  export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, ChainId, ChainUtils, DOCS_BASE_URL, MORPHO_DOMAIN, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
4
4
  export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_LLTV_BUFFER, DEFAULT_MAX_REALLOCATION_PENALTY, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_REALLOCATION_PENALTY, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, } from "./helpers/constant.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_REALLOCATION_PENALTY = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_MAX_REALLOCATION_PENALTY = exports.DEFAULT_LLTV_BUFFER = exports.APPROVE_ONLY_ONCE_TOKENS = exports.ZERO_ADDRESS = exports.REWARDS_BASE_URL = exports.MORPHO_DOMAIN = exports.DOCS_BASE_URL = exports.ChainUtils = exports.ChainId = exports.BLUE_API_GRAPHQL_URL = exports.BLUE_API_BASE_URL = exports.MIDNIGHT_TIME_TO_MAX_LIF = exports.MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS = exports.MIDNIGHT_PRICE_ROUNDING_STEP = exports.MIDNIGHT_OFFER_TYPEHASH = exports.MIDNIGHT_MAX_TICK = exports.MIDNIGHT_MAX_SETTLEMENT_FEES = exports.MIDNIGHT_MAX_OFFER_CAP = exports.MIDNIGHT_MAX_CONTINUOUS_FEE = exports.MIDNIGHT_MAX_COLLATERALS_PER_BORROWER = exports.MIDNIGHT_MAX_COLLATERALS = exports.MIDNIGHT_MARKET_TYPEHASH = exports.MIDNIGHT_EIP712_DOMAIN_TYPEHASH = exports.MIDNIGHT_DEFAULT_TICK_SPACING = exports.MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH = exports.MIDNIGHT_CBP = exports.BlueTransactionType = exports.SECONDS_PER_YEAR = exports.ORACLE_PRICE_SCALE = exports.BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR = exports.BLUE_LIQUIDATION_CURSOR = exports.isBlueMarketId = exports.ERC20_ALLOWANCE_RECIPIENTS = exports.EIP_712_FIELDS = exports.DEFAULT_SLIPPAGE_TOLERANCE = void 0;
3
+ exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_REALLOCATION_PENALTY = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_MAX_REALLOCATION_PENALTY = exports.DEFAULT_LLTV_BUFFER = exports.APPROVE_ONLY_ONCE_TOKENS = exports.ZERO_ADDRESS = exports.REWARDS_BASE_URL = exports.MORPHO_DOMAIN = exports.DOCS_BASE_URL = exports.ChainUtils = exports.ChainId = exports.BLUE_API_GRAPHQL_URL = exports.BLUE_API_BASE_URL = exports.MIDNIGHT_TIME_TO_MAX_LIF = exports.MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS = exports.MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH = exports.MIDNIGHT_PRICE_ROUNDING_STEP = exports.MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH = exports.MIDNIGHT_OFFER_TYPEHASH = exports.MIDNIGHT_MAX_TREE_HEIGHT = exports.MIDNIGHT_MAX_TICK = exports.MIDNIGHT_MAX_SETTLEMENT_FEES = exports.MIDNIGHT_MAX_OFFER_CAP = exports.MIDNIGHT_MAX_CONTINUOUS_FEE = exports.MIDNIGHT_MAX_COLLATERALS_PER_BORROWER = exports.MIDNIGHT_MAX_COLLATERALS = exports.MIDNIGHT_MARKET_TYPEHASH = exports.MIDNIGHT_EIP712_DOMAIN_TYPEHASH = exports.MIDNIGHT_DEFAULT_TICK_SPACING = exports.MIDNIGHT_COLLATERAL_PARAMS_TYPEHASH = exports.MIDNIGHT_CBP = exports.BlueTransactionType = exports.SECONDS_PER_YEAR = exports.ORACLE_PRICE_SCALE = exports.BLUE_MAX_LIQUIDATION_INCENTIVE_FACTOR = exports.BLUE_LIQUIDATION_CURSOR = exports.isBlueMarketId = exports.ERC20_ALLOWANCE_RECIPIENTS = exports.EIP_712_FIELDS = exports.DEFAULT_SLIPPAGE_TOLERANCE = void 0;
4
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "DEFAULT_SLIPPAGE_TOLERANCE", { enumerable: true, get: function () { return blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE; } });
6
6
  Object.defineProperty(exports, "EIP_712_FIELDS", { enumerable: true, get: function () { return blue_sdk_1.EIP_712_FIELDS; } });
@@ -23,8 +23,11 @@ Object.defineProperty(exports, "MIDNIGHT_MAX_CONTINUOUS_FEE", { enumerable: true
23
23
  Object.defineProperty(exports, "MIDNIGHT_MAX_OFFER_CAP", { enumerable: true, get: function () { return midnight_sdk_1.MAX_OFFER_CAP; } });
24
24
  Object.defineProperty(exports, "MIDNIGHT_MAX_SETTLEMENT_FEES", { enumerable: true, get: function () { return midnight_sdk_1.MAX_SETTLEMENT_FEES; } });
25
25
  Object.defineProperty(exports, "MIDNIGHT_MAX_TICK", { enumerable: true, get: function () { return midnight_sdk_1.MAX_TICK; } });
26
+ Object.defineProperty(exports, "MIDNIGHT_MAX_TREE_HEIGHT", { enumerable: true, get: function () { return midnight_sdk_1.MAX_TREE_HEIGHT; } });
26
27
  Object.defineProperty(exports, "MIDNIGHT_OFFER_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.OFFER_TYPEHASH; } });
28
+ Object.defineProperty(exports, "MIDNIGHT_PRICE_RATIFIER_V1_OFFER_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.PRICE_RATIFIER_V1_OFFER_TYPEHASH; } });
27
29
  Object.defineProperty(exports, "MIDNIGHT_PRICE_ROUNDING_STEP", { enumerable: true, get: function () { return midnight_sdk_1.PRICE_ROUNDING_STEP; } });
30
+ Object.defineProperty(exports, "MIDNIGHT_RATE_RATIFIER_V1_OFFER_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.RATE_RATIFIER_V1_OFFER_TYPEHASH; } });
28
31
  Object.defineProperty(exports, "MIDNIGHT_SETTLEMENT_FEE_BREAKPOINTS", { enumerable: true, get: function () { return midnight_sdk_1.SETTLEMENT_FEE_BREAKPOINTS; } });
29
32
  Object.defineProperty(exports, "MIDNIGHT_TIME_TO_MAX_LIF", { enumerable: true, get: function () { return midnight_sdk_1.TIME_TO_MAX_LIF; } });
30
33
  var morpho_ts_1 = require("@morpho-org/morpho-ts");
@@ -24,12 +24,26 @@ export interface BlueTokenRequirementsParams {
24
24
  */
25
25
  readonly approvalAmount?: bigint;
26
26
  }
27
+ /** Action surface for Morpho Blue reads and writes; writes route through BlueBundlesV1. */
27
28
  export interface BlueActions {
28
29
  /**
29
30
  * Fetches the latest market data with accrued interest.
30
31
  *
31
32
  * @param parameters - Optional fetch parameters (block number, state overrides).
32
33
  * @returns Market state including total supply/borrow assets and shares.
34
+ * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
35
+ * @example
36
+ * ```ts
37
+ * import { markets } from "@morpho-org/morpho-test";
38
+ * import { createPublicClient, http } from "viem";
39
+ * import { mainnet } from "viem/chains";
40
+ * import { morphoViemExtension } from "@morpho-org/morpho-sdk";
41
+ *
42
+ * const client = createPublicClient({ chain: mainnet, transport: http() })
43
+ * .extend(morphoViemExtension());
44
+ * const market = client.morpho.blue(markets[mainnet.id].usdc_wbtc, mainnet.id);
45
+ * const marketData = await market.getMarketData();
46
+ * ```
33
47
  */
34
48
  getMarketData: (parameters?: FetchParameters) => Promise<Market>;
35
49
  /**
@@ -38,6 +52,19 @@ export interface BlueActions {
38
52
  * @param userAddress - The user whose position to fetch.
39
53
  * @param parameters - Optional fetch parameters (block number, state overrides).
40
54
  * @returns Accrual position with health metrics (maxBorrowAssets, ltv, isHealthy).
55
+ * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
56
+ * @example
57
+ * ```ts
58
+ * import { markets } from "@morpho-org/morpho-test";
59
+ * import { createPublicClient, http, zeroAddress } from "viem";
60
+ * import { mainnet } from "viem/chains";
61
+ * import { morphoViemExtension } from "@morpho-org/morpho-sdk";
62
+ *
63
+ * const client = createPublicClient({ chain: mainnet, transport: http() })
64
+ * .extend(morphoViemExtension());
65
+ * const market = client.morpho.blue(markets[mainnet.id].usdc_wbtc, mainnet.id);
66
+ * const position = await market.getPositionData(zeroAddress);
67
+ * ```
41
68
  */
42
69
  getPositionData: (userAddress: Address, parameters?: FetchParameters) => Promise<AccrualPosition>;
43
70
  /**
@@ -819,6 +846,7 @@ export interface BlueActions {
819
846
  readonly data: VaultV2BlueReallocationData;
820
847
  };
821
848
  }
849
+ /** Binds a viem client to a Morpho Blue market's action builders. */
822
850
  export declare class MorphoBlue implements BlueActions {
823
851
  private readonly client;
824
852
  readonly marketParams: MarketParams;
@@ -11,6 +11,7 @@ const index_js_2 = require("../../helpers/index.js");
11
11
  const index_js_3 = require("../../types/index.js");
12
12
  const index_js_4 = require("../requirements/index.js");
13
13
  const vaultV2BlueReallocationData_js_1 = require("../vaultV2BlueReallocationData.js");
14
+ /** Binds a viem client to a Morpho Blue market's action builders. */
14
15
  class MorphoBlue {
15
16
  client;
16
17
  marketParams;
@@ -8,7 +8,7 @@ export { AccrualPosition as BlueAccrualPosition, AccrualVault, AccrualVaultV2, A
8
8
  PreLiquidationParams as BluePreLiquidationParams,
9
9
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
10
10
  PreLiquidationPosition as BluePreLiquidationPosition, Token, User as BlueUser, Vault, VaultConfig, VaultMarketAllocation, VaultMarketConfig, VaultToken, VaultUser, VaultV2, VaultV2Adapter, VaultV2BlueMarketPublicAllocatorConfig, VaultV2BluePublicAllocatorConfig, VaultV2MorphoMarketV1Adapter, VaultV2MorphoMarketV1AdapterV2, VaultV2MorphoVaultV1Adapter, WrappedToken, } from "@morpho-org/blue-sdk";
11
- export type { BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, GroupInput as MidnightGroupInput, IAccrualPosition as IMidnightAccrualPosition, ICollateralParams as IMidnightCollateralParams, IGroup as IMidnightGroup, IMarket as IMidnightMarket, IMarketParams as IMidnightMarketParams, IOffer as IMidnightOffer, IPosition as IMidnightPosition, MarketInput as MidnightMarketInput, OfferStruct as MidnightOfferStruct, RatifierTreeInput as MidnightRatifierTreeInput, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeDescriptor as MidnightTreeDescriptor, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, } from "@morpho-org/midnight-sdk";
11
+ export type { AnyTree as MidnightAnyTree, AnyTreeSnapshot as MidnightAnyTreeSnapshot, BuildOfferParams as MidnightBuildOfferParams, CollateralParams as MidnightCollateralParams, EcrecoverTreeCreateRequest as MidnightEcrecoverTreeCreateRequest, GroupInput as MidnightGroupInput, IAccrualPosition as IMidnightAccrualPosition, ICollateralParams as IMidnightCollateralParams, IGroup as IMidnightGroup, IMarket as IMidnightMarket, IMarketParams as IMidnightMarketParams, IOffer as IMidnightOffer, IPosition as IMidnightPosition, MarketInput as MidnightMarketInput, OfferStruct as MidnightOfferStruct, PriceRatifierV1TreeCreateRequest as MidnightPriceRatifierV1TreeCreateRequest, RateRatifierV1TreeCreateRequest as MidnightRateRatifierV1TreeCreateRequest, RatifierKind as MidnightRatifierKind, RatifierTreeInput as MidnightRatifierTreeInput, RatifierTypes as MidnightRatifierTypes, SetterTreeCreateRequest as MidnightSetterTreeCreateRequest, SettlementFeeCbps as MidnightSettlementFeeCbps, TreeCreateParams as MidnightTreeCreateParams, TreeCreateRequest as MidnightTreeCreateRequest, TreeData as MidnightTreeData, TreeDescriptor as MidnightTreeDescriptor, TreeEntry as MidnightTreeEntry, TreeInput as MidnightTreeInput, TreeLike as MidnightTreeLike, TreeMempoolValidateParams as MidnightTreeMempoolValidateParams, TreeMempoolValidateRatification as MidnightTreeMempoolValidateRatification, TreeProof as MidnightTreeProof, TreeSnapshot as MidnightTreeSnapshot, TypedRatifierTreeInput as MidnightTypedRatifierTreeInput, TypedTreeMempoolValidateParams as MidnightTypedTreeMempoolValidateParams, } from "@morpho-org/midnight-sdk";
12
12
  export { AccrualPosition as MidnightAccrualPosition, Group as MidnightGroup, Market as MidnightMarket, MarketParams as MidnightMarketParams, Offer as MidnightOffer, Position as MidnightPosition, Tree as MidnightTree, } from "@morpho-org/midnight-sdk";
13
13
  export type { BlueActions, BlueTokenRequirementsParams, } from "./blue/index.js";
14
14
  export { MorphoBlue } from "./blue/index.js";
@@ -34,6 +34,7 @@ const getVaultBundlesSharesRequirements = async (viemClient, params) => {
34
34
  throw new index_js_3.ExpiredDeadlineError(params.deadline, now);
35
35
  }
36
36
  const spender = (0, morpho_ts_1.getChainAddress)(params.chainId, "bundles.vaultBundlesV1");
37
+ // The allowance is trusted as returned by the RPC. See THREAT_MODEL.md, RPC.
37
38
  const allowance = await (0, actions_1.readContract)(viemClient, {
38
39
  address: params.vaultData.address,
39
40
  abi: viem_1.erc20Abi,
@@ -3,13 +3,19 @@ import { fetchAccrualVault } from "@morpho-org/blue-sdk-viem";
3
3
  import { type Address } from "viem";
4
4
  import type { FetchParameters } from "../../types/data.js";
5
5
  import { type ActionOutput, type ActionRequirement, type BundlesFundingArgs, type BundlesTokenRequirementsOptions, type MorphoClientType, type RequirementSignature, type VaultV1DepositAction, type VaultV1InKindRedeemAction, type VaultV1MigrateToV2Action, type VaultV1MigrateToV2AmountArgs, type VaultV1RedeemAction, type VaultV1WithdrawAction } from "../../types/index.js";
6
+ /** Action surface for Vault V1 reads and writes; writes route through VaultBundlesV1 and VaultExitBundlesV1. */
6
7
  export interface VaultV1Actions {
7
8
  /**
8
9
  * Fetches direct onchain vault and allocation state without applying virtual interest.
9
10
  *
10
- * @param {FetchParameters} [parameters] - Optional fetch parameters (block number, state overrides, etc.).
11
- * @returns {Promise<Awaited<ReturnType<typeof fetchAccrualVault>>>} The requested vault state.
11
+ * Reads the Vault V1 state through `fetchAccrualVault` on the entity's client.
12
+ *
13
+ * @param parameters - Optional viem fetch parameters (block number, block tag, state override).
14
+ * @returns The hydrated `AccrualVault` snapshot.
12
15
  * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
16
+ * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
17
+ * @throws {UnknownBlueFactory} when the configured chain has no MetaMorpho factory.
18
+ * @throws {UnknownBlueOfFactory} when the vault is not a MetaMorpho vault from the configured factory.
13
19
  */
14
20
  getData: (parameters?: FetchParameters) => Promise<Awaited<ReturnType<typeof fetchAccrualVault>>>;
15
21
  /**
@@ -414,6 +420,7 @@ export interface VaultV1Actions {
414
420
  readonly deadline?: bigint;
415
421
  } & VaultV1MigrateToV2AmountArgs) => ActionOutput<VaultV1MigrateToV2Action, readonly RequirementSignature[], undefined>;
416
422
  }
423
+ /** Binds a viem client to a Vault V1 (MetaMorpho) vault's action builders. */
417
424
  export declare class MorphoVaultV1 implements VaultV1Actions {
418
425
  private readonly client;
419
426
  private readonly vault;
@@ -13,6 +13,7 @@ const validate_js_1 = require("../../helpers/validate.js");
13
13
  const index_js_3 = require("../../types/index.js");
14
14
  const getVaultBundlesSharesRequirements_js_1 = require("../requirements/getVaultBundlesSharesRequirements.js");
15
15
  const index_js_4 = require("../requirements/index.js");
16
+ /** Binds a viem client to a Vault V1 (MetaMorpho) vault's action builders. */
16
17
  class MorphoVaultV1 {
17
18
  client;
18
19
  vault;
@@ -339,6 +340,7 @@ class MorphoVaultV1 {
339
340
  abi: blue_sdk_viem_1.metaMorphoAbi,
340
341
  functionName: "MORPHO",
341
342
  },
343
+ // feeRecipient() is trusted as returned by the RPC. See THREAT_MODEL.md, RPC.
342
344
  {
343
345
  address: blue,
344
346
  abi: blue_sdk_viem_1.blueAbi,
@@ -3,15 +3,24 @@ import { fetchAccrualVaultV2 } from "@morpho-org/blue-sdk-viem";
3
3
  import { type Address } from "viem";
4
4
  import type { FetchParameters } from "../../types/data.js";
5
5
  import { type ActionOutput, type ActionRequirement, type BundlesFundingArgs, type BundlesTokenRequirementsOptions, type Deallocation, type MorphoClientType, type RequirementSignature, type Transaction, type VaultV2DepositAction, type VaultV2ForceRedeemAction, type VaultV2ForceWithdrawAction, type VaultV2InKindRedeemAction, type VaultV2RedeemAction, type VaultV2WithdrawAction } from "../../types/index.js";
6
+ /**
7
+ * Action surface for Vault V2 reads and writes; writes route through VaultBundlesV1 and
8
+ * VaultExitBundlesV1, except `forceRedeem`, which uses the vault's native multicall.
9
+ */
6
10
  export interface VaultV2Actions {
7
11
  /**
8
- * Fetches the latest vault data.
12
+ * Fetches the latest accrual snapshot of the vault.
9
13
  *
10
- * This function fetches the latest vault data from the blockchain.
11
- * @param {FetchParameters} [parameters] - The parameters for the fetch operation.
14
+ * Reads the Vault V2 state through `fetchAccrualVaultV2` on the entity's client.
12
15
  *
13
- * @returns {Promise<Awaited<ReturnType<typeof fetchAccrualVaultV2>>>} The latest vault data.
16
+ * @param parameters - Optional viem fetch parameters (block number, block tag, state override).
17
+ * @returns The hydrated `AccrualVaultV2` snapshot.
14
18
  * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
19
+ * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
20
+ * @throws {UnknownBlueFactory} when the configured chain has no VaultV2 factory.
21
+ * @throws {UnknownBlueOfFactory} when the vault is not a VaultV2 from the configured factory.
22
+ * @throws {UnsupportedBlueVaultV2AdapterError} when the vault or one of its adapters uses an
23
+ * unsupported adapter class.
15
24
  */
16
25
  getData: (parameters?: FetchParameters) => Promise<Awaited<ReturnType<typeof fetchAccrualVaultV2>>>;
17
26
  /**
@@ -463,13 +472,27 @@ export interface VaultV2Actions {
463
472
  * asset-equivalent of the redeemed shares. The caller should apply a buffer on the deallocated
464
473
  * amounts to account for share-price drift between submission and execution.
465
474
  *
466
- * @param {Object} params - The force redeem parameters.
467
- * @param {readonly Deallocation[]} params.deallocations - The typed list of deallocations to perform.
468
- * @param {Object} params.redeem - The redeem parameters applied after deallocations.
469
- * @param {bigint} params.redeem.shares - The amount of shares to redeem.
470
- * @param {Address} params.userAddress - User address (penalty source and redeem recipient).
471
- * @returns {Object} The result object.
472
- * @returns {Readonly<Transaction<VaultV2ForceRedeemAction>>} returns.buildTx The prepared multicall transaction.
475
+ * @param params.deallocations - Typed list of `forceDeallocate` calls to perform before the redeem.
476
+ * @param params.redeem.shares - Amount of vault shares to redeem after the deallocations.
477
+ * @param params.userAddress - Account that pays the deallocation penalties and receives the redeemed assets.
478
+ * @returns An object whose `buildTx()` returns a deep-frozen `Transaction<VaultV2ForceRedeemAction>`
479
+ * encoding the vault `multicall`.
480
+ * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
481
+ * @throws {EmptyDeallocationsError} from `buildTx()` when `deallocations` is empty.
482
+ * @throws {NonPositiveInputError} from `buildTx()` when `redeem.shares <= 0n` or any deallocation
483
+ * amount is non-positive.
484
+ * @example
485
+ * ```ts
486
+ * const vault = client.morpho.vaultV2(vaultAddress, 1);
487
+ * const tx = vault
488
+ * .forceRedeem({
489
+ * deallocations: [{ adapter, marketParams, amount: 1_000_000n }],
490
+ * redeem: { shares: 500_000n },
491
+ * userAddress,
492
+ * })
493
+ * .buildTx();
494
+ * // tx satisfies Readonly<Transaction<VaultV2ForceRedeemAction>>
495
+ * ```
473
496
  */
474
497
  forceRedeem: (params: {
475
498
  deallocations: readonly Deallocation[];
@@ -481,6 +504,7 @@ export interface VaultV2Actions {
481
504
  buildTx: () => Readonly<Transaction<VaultV2ForceRedeemAction>>;
482
505
  };
483
506
  }
507
+ /** Binds a viem client to a Vault V2 vault's action builders. */
484
508
  export declare class MorphoVaultV2 implements VaultV2Actions {
485
509
  private readonly client;
486
510
  private readonly vault;
@@ -16,6 +16,7 @@ const index_js_4 = require("../requirements/index.js");
16
16
  // Maximum accepted deadline horizon; the on-chain management fee is capped at 5%/yr so the
17
17
  // accrual model stays well-defined inside it.
18
18
  const VAULT_V2_FEE_PROJECTION_HORIZON = morpho_ts_1.Time.s.from.y(1n);
19
+ /** Binds a viem client to a Vault V2 vault's action builders. */
19
20
  class MorphoVaultV2 {
20
21
  client;
21
22
  vault;
@@ -1,7 +1,7 @@
1
1
  export { BlueErrors, IncompleteChainRegistryError, InvalidMarketParamsError as InvalidBlueMarketParamsError, UnknownAddressError, UnknownDataError as UnknownBlueDataError, UnknownFactory as UnknownBlueFactory, UnknownMarketAllocationError as UnknownBlueMarketAllocationError, UnknownMarketParamsError as UnknownBlueMarketParamsError, UnknownOfFactory as UnknownBlueOfFactory, UnknownTokenError as UnknownBlueTokenError, UnknownTokenPriceError as UnknownBlueTokenPriceError, UnknownVaultConfigError as UnknownBlueVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError as UnsupportedBlueMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError as UnsupportedBluePreLiquidationParamsError, UnsupportedVaultV2AdapterError as UnsupportedBlueVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter as getBlueUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError as isBlueUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
5
- export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError, InvalidTickSpacingError as InvalidMidnightTickSpacingError, InvalidTreeError as InvalidMidnightTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError, } from "@morpho-org/midnight-sdk";
4
+ export { getUnsupportedVaultV2Adapter as getBlueUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError as isBlueUnknownOfFactoryError, MarketParamsIdMismatchError as BlueMarketParamsIdMismatchError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
5
+ export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError, InvalidRateRatifierV1RateError as InvalidMidnightRateRatifierV1RateError, InvalidRateRatifierV1TickError as InvalidMidnightRateRatifierV1TickError, InvalidRateRatifierV1TimeError as InvalidMidnightRateRatifierV1TimeError, InvalidRatifierV1AddressError as InvalidMidnightRatifierV1AddressError, InvalidTickSpacingError as InvalidMidnightTickSpacingError, InvalidTreeError as InvalidMidnightTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError, RateRatifierV1BoundOverflowError as MidnightRateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError as MidnightRatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError, } from "@morpho-org/midnight-sdk";
6
6
  export type { ErrorClass } from "@morpho-org/morpho-ts";
7
7
  export { _try, DivisionByZeroError, InvalidBitLengthError, NegativeValueError, RegistryValueAlreadyRegisteredError, } from "@morpho-org/morpho-ts";
package/lib/cjs/errors.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.InvalidBitLengthError = exports.DivisionByZeroError = exports._try = exports.UnknownMidnightCollateralIndexError = exports.MidnightTickOutOfRangeError = exports.MidnightSettlementFeeExceedsPriceError = exports.MidnightPriceGreaterThanOneError = exports.MidnightPayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidMidnightTreeHeightError = exports.InvalidMidnightTreeError = exports.InvalidMidnightTickSpacingError = exports.InvalidMidnightPositionLossFactorError = exports.InvalidMidnightPositionAccrualTimestampError = exports.InvalidMidnightPositionAccrualStateError = exports.InvalidMidnightOfferParameterError = exports.InvalidMidnightOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightMarketParameterError = exports.InvalidMidnightEcrecoverSignatureVError = exports.MidnightChainIdMismatchError = exports.UnsupportedPermitDomainExtensionsError = exports.isBlueUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getBlueUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedBlueVaultV2AdapterError = exports.UnsupportedBluePreLiquidationParamsError = exports.UnsupportedBlueMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownBlueVaultConfigError = exports.UnknownBlueTokenPriceError = exports.UnknownBlueTokenError = exports.UnknownBlueOfFactory = exports.UnknownBlueMarketParamsError = exports.UnknownBlueMarketAllocationError = exports.UnknownBlueFactory = exports.UnknownBlueDataError = exports.UnknownAddressError = exports.InvalidBlueMarketParamsError = exports.IncompleteChainRegistryError = exports.BlueErrors = void 0;
3
+ exports.MidnightTickOutOfRangeError = exports.MidnightSettlementFeeExceedsPriceError = exports.MidnightRatifierV1TakerNotAllowedError = exports.MidnightRateRatifierV1BoundOverflowError = exports.MidnightPriceGreaterThanOneError = exports.MidnightPayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidMidnightTreeHeightError = exports.InvalidMidnightTreeError = exports.InvalidMidnightTickSpacingError = exports.InvalidMidnightRatifierV1AddressError = exports.InvalidMidnightRateRatifierV1TimeError = exports.InvalidMidnightRateRatifierV1TickError = exports.InvalidMidnightRateRatifierV1RateError = exports.InvalidMidnightPositionLossFactorError = exports.InvalidMidnightPositionAccrualTimestampError = exports.InvalidMidnightPositionAccrualStateError = exports.InvalidMidnightOfferParameterError = exports.InvalidMidnightOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightMarketParameterError = exports.InvalidMidnightEcrecoverSignatureVError = exports.MidnightChainIdMismatchError = exports.UnsupportedPermitDomainExtensionsError = exports.BlueMarketParamsIdMismatchError = exports.isBlueUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getBlueUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedBlueVaultV2AdapterError = exports.UnsupportedBluePreLiquidationParamsError = exports.UnsupportedBlueMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownBlueVaultConfigError = exports.UnknownBlueTokenPriceError = exports.UnknownBlueTokenError = exports.UnknownBlueOfFactory = exports.UnknownBlueMarketParamsError = exports.UnknownBlueMarketAllocationError = exports.UnknownBlueFactory = exports.UnknownBlueDataError = exports.UnknownAddressError = exports.InvalidBlueMarketParamsError = exports.IncompleteChainRegistryError = exports.BlueErrors = void 0;
4
+ exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.InvalidBitLengthError = exports.DivisionByZeroError = exports._try = exports.UnknownMidnightCollateralIndexError = void 0;
4
5
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
6
  Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
6
7
  Object.defineProperty(exports, "IncompleteChainRegistryError", { enumerable: true, get: function () { return blue_sdk_1.IncompleteChainRegistryError; } });
@@ -26,6 +27,7 @@ Object.defineProperty(exports, "InvalidNumberError", { enumerable: true, get: fu
26
27
  Object.defineProperty(exports, "InvalidPermitDomainChainIdError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainChainIdError; } });
27
28
  Object.defineProperty(exports, "InvalidPermitDomainVerifyingContractError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainVerifyingContractError; } });
28
29
  Object.defineProperty(exports, "isBlueUnknownOfFactoryError", { enumerable: true, get: function () { return blue_sdk_viem_1.isUnknownOfFactoryError; } });
30
+ Object.defineProperty(exports, "BlueMarketParamsIdMismatchError", { enumerable: true, get: function () { return blue_sdk_viem_1.MarketParamsIdMismatchError; } });
29
31
  Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
30
32
  var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
31
33
  Object.defineProperty(exports, "MidnightChainIdMismatchError", { enumerable: true, get: function () { return midnight_sdk_1.ChainIdMismatchError; } });
@@ -38,6 +40,10 @@ Object.defineProperty(exports, "InvalidMidnightOfferParameterError", { enumerabl
38
40
  Object.defineProperty(exports, "InvalidMidnightPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
39
41
  Object.defineProperty(exports, "InvalidMidnightPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
40
42
  Object.defineProperty(exports, "InvalidMidnightPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
43
+ Object.defineProperty(exports, "InvalidMidnightRateRatifierV1RateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1RateError; } });
44
+ Object.defineProperty(exports, "InvalidMidnightRateRatifierV1TickError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TickError; } });
45
+ Object.defineProperty(exports, "InvalidMidnightRateRatifierV1TimeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TimeError; } });
46
+ Object.defineProperty(exports, "InvalidMidnightRatifierV1AddressError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRatifierV1AddressError; } });
41
47
  Object.defineProperty(exports, "InvalidMidnightTickSpacingError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTickSpacingError; } });
42
48
  Object.defineProperty(exports, "InvalidMidnightTreeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeError; } });
43
49
  Object.defineProperty(exports, "InvalidMidnightTreeHeightError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeHeightError; } });
@@ -46,6 +52,8 @@ Object.defineProperty(exports, "MidnightApiError", { enumerable: true, get: func
46
52
  Object.defineProperty(exports, "MidnightMempoolValidationError", { enumerable: true, get: function () { return midnight_sdk_1.MidnightMempoolValidationError; } });
47
53
  Object.defineProperty(exports, "MidnightPayloadDecodeError", { enumerable: true, get: function () { return midnight_sdk_1.PayloadDecodeError; } });
48
54
  Object.defineProperty(exports, "MidnightPriceGreaterThanOneError", { enumerable: true, get: function () { return midnight_sdk_1.PriceGreaterThanOneError; } });
55
+ Object.defineProperty(exports, "MidnightRateRatifierV1BoundOverflowError", { enumerable: true, get: function () { return midnight_sdk_1.RateRatifierV1BoundOverflowError; } });
56
+ Object.defineProperty(exports, "MidnightRatifierV1TakerNotAllowedError", { enumerable: true, get: function () { return midnight_sdk_1.RatifierV1TakerNotAllowedError; } });
49
57
  Object.defineProperty(exports, "MidnightSettlementFeeExceedsPriceError", { enumerable: true, get: function () { return midnight_sdk_1.SettlementFeeExceedsPriceError; } });
50
58
  Object.defineProperty(exports, "MidnightTickOutOfRangeError", { enumerable: true, get: function () { return midnight_sdk_1.TickOutOfRangeError; } });
51
59
  Object.defineProperty(exports, "UnknownMidnightCollateralIndexError", { enumerable: true, get: function () { return midnight_sdk_1.UnknownCollateralIndexError; } });
@@ -7,5 +7,6 @@ import { type Deallocation } from "../types/index.js";
7
7
  * @param onBehalf - The address from which the penalty is taken (share owner).
8
8
  * @returns The ABI-encoded calldata for `VaultV2.forceDeallocate`.
9
9
  * @throws {NonPositiveInputError} when `deallocation.amount <= 0n`.
10
+ * @internal
10
11
  */
11
12
  export declare function encodeForceDeallocateCall(deallocation: Deallocation, onBehalf: Address): Hex;
@@ -24,6 +24,7 @@ function encodeDeallocateData(deallocation) {
24
24
  * @param onBehalf - The address from which the penalty is taken (share owner).
25
25
  * @returns The ABI-encoded calldata for `VaultV2.forceDeallocate`.
26
26
  * @throws {NonPositiveInputError} when `deallocation.amount <= 0n`.
27
+ * @internal
27
28
  */
28
29
  function encodeForceDeallocateCall(deallocation, onBehalf) {
29
30
  if (deallocation.amount <= 0n) {
@@ -29,6 +29,19 @@ import type { Metadata } from "../types/index.js";
29
29
  * @returns The same `tx` object when `data` is missing, an empty string, or
30
30
  * canonical empty calldata (`"0x"`); otherwise, a new transaction object
31
31
  * with `data` containing any appended metadata. The input is never mutated.
32
+ * @example
33
+ * ```ts
34
+ * import { addTransactionMetadata } from "@morpho-org/morpho-sdk";
35
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
36
+ * import type { Address, Hex } from "viem";
37
+ * import { mainnet } from "viem/chains";
38
+ *
39
+ * const { blue } = getChainAddresses(mainnet.id);
40
+ * const tx = { to: blue, value: 0n, data: "0x1234" as Hex };
41
+ * const result: { to: Address; value: bigint; data: Hex } =
42
+ * addTransactionMetadata(tx, { origin: "deadbeef", timestamp: true });
43
+ * // => { to: blue, value: 0n, data: "0x1234" + <4-byte timestamp> + "deadbeef" }
44
+ * ```
32
45
  */
33
46
  export declare function addTransactionMetadata(tx: {
34
47
  data: Hex;
@@ -32,6 +32,19 @@ const viem_1 = require("viem");
32
32
  * @returns The same `tx` object when `data` is missing, an empty string, or
33
33
  * canonical empty calldata (`"0x"`); otherwise, a new transaction object
34
34
  * with `data` containing any appended metadata. The input is never mutated.
35
+ * @example
36
+ * ```ts
37
+ * import { addTransactionMetadata } from "@morpho-org/morpho-sdk";
38
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
39
+ * import type { Address, Hex } from "viem";
40
+ * import { mainnet } from "viem/chains";
41
+ *
42
+ * const { blue } = getChainAddresses(mainnet.id);
43
+ * const tx = { to: blue, value: 0n, data: "0x1234" as Hex };
44
+ * const result: { to: Address; value: bigint; data: Hex } =
45
+ * addTransactionMetadata(tx, { origin: "deadbeef", timestamp: true });
46
+ * // => { to: blue, value: 0n, data: "0x1234" + <4-byte timestamp> + "deadbeef" }
47
+ * ```
35
48
  */
36
49
  function addTransactionMetadata(tx, metadata) {
37
50
  const { data, ..._tx } = tx;
@@ -94,14 +94,18 @@ export interface VaultV2ForceWithdrawPreview {
94
94
  * floor cannot fit `uint256`.
95
95
  * @example
96
96
  * ```ts
97
+ * import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
97
98
  * import { previewVaultV2ForceWithdraw } from "@morpho-org/morpho-sdk";
98
99
  *
99
- * const preview = previewVaultV2ForceWithdraw(vaultData, {
100
- * requestedExitAssets: 1_000_000n,
101
- * timestamp: block.timestamp,
102
- * });
103
- * // preview?.exitAssets is ready to pass to vault.forceWithdraw(...)
104
- * // preview?.netAssets is what the user receives
100
+ * export function preview(vaultData: AccrualVaultV2, timestamp: bigint) {
101
+ * const preview = previewVaultV2ForceWithdraw(vaultData, {
102
+ * requestedExitAssets: 1_000_000n,
103
+ * timestamp,
104
+ * });
105
+ * // preview?.exitAssets is ready to pass to vault.forceWithdraw(...)
106
+ * // preview?.netAssets is what the user receives
107
+ * return preview;
108
+ * }
105
109
  * ```
106
110
  */
107
111
  export declare function previewVaultV2ForceWithdraw(vaultData: AccrualVaultV2, params: PreviewVaultV2ForceWithdrawParams): VaultV2ForceWithdrawPreview | undefined;
@@ -43,14 +43,18 @@ const vaultV2ForceWithdrawPlan_js_1 = require("./vaultV2ForceWithdrawPlan.js");
43
43
  * floor cannot fit `uint256`.
44
44
  * @example
45
45
  * ```ts
46
+ * import type { AccrualVaultV2 } from "@morpho-org/blue-sdk";
46
47
  * import { previewVaultV2ForceWithdraw } from "@morpho-org/morpho-sdk";
47
48
  *
48
- * const preview = previewVaultV2ForceWithdraw(vaultData, {
49
- * requestedExitAssets: 1_000_000n,
50
- * timestamp: block.timestamp,
51
- * });
52
- * // preview?.exitAssets is ready to pass to vault.forceWithdraw(...)
53
- * // preview?.netAssets is what the user receives
49
+ * export function preview(vaultData: AccrualVaultV2, timestamp: bigint) {
50
+ * const preview = previewVaultV2ForceWithdraw(vaultData, {
51
+ * requestedExitAssets: 1_000_000n,
52
+ * timestamp,
53
+ * });
54
+ * // preview?.exitAssets is ready to pass to vault.forceWithdraw(...)
55
+ * // preview?.netAssets is what the user receives
56
+ * return preview;
57
+ * }
54
58
  * ```
55
59
  */
56
60
  function previewVaultV2ForceWithdraw(vaultData, params) {
@@ -32,10 +32,11 @@ import { type AccrualVault, AccrualVaultV2 } from "@morpho-org/blue-sdk";
32
32
  * @example
33
33
  * ```ts
34
34
  * import { computeMinForceWithdrawSharePrice } from "@morpho-org/morpho-sdk";
35
+ * import { DEFAULT_SLIPPAGE_TOLERANCE } from "@morpho-org/morpho-sdk/constants";
35
36
  *
36
37
  * const minSharePriceE27 = computeMinForceWithdrawSharePrice({
37
- * withdrawnAssets: plan.withdrawnAssets,
38
- * sharesBurnt,
38
+ * withdrawnAssets: 1_000_000n,
39
+ * sharesBurnt: 900_000n,
39
40
  * slippageTolerance: DEFAULT_SLIPPAGE_TOLERANCE,
40
41
  * });
41
42
  * ```
@@ -39,10 +39,11 @@ const validate_js_1 = require("./validate.js");
39
39
  * @example
40
40
  * ```ts
41
41
  * import { computeMinForceWithdrawSharePrice } from "@morpho-org/morpho-sdk";
42
+ * import { DEFAULT_SLIPPAGE_TOLERANCE } from "@morpho-org/morpho-sdk/constants";
42
43
  *
43
44
  * const minSharePriceE27 = computeMinForceWithdrawSharePrice({
44
- * withdrawnAssets: plan.withdrawnAssets,
45
- * sharesBurnt,
45
+ * withdrawnAssets: 1_000_000n,
46
+ * sharesBurnt: 900_000n,
46
47
  * slippageTolerance: DEFAULT_SLIPPAGE_TOLERANCE,
47
48
  * });
48
49
  * ```