@morpho-org/morpho-sdk 5.8.0 → 5.9.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 (66) hide show
  1. package/README.md +4 -0
  2. package/lib/cjs/abis.d.ts +543 -0
  3. package/lib/cjs/abis.js +738 -0
  4. package/lib/cjs/actions/blue/borrow.d.ts +5 -2
  5. package/lib/cjs/actions/blue/borrow.js +1 -1
  6. package/lib/cjs/actions/blue/refinance.d.ts +7 -2
  7. package/lib/cjs/actions/blue/refinance.js +3 -1
  8. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +6 -2
  9. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +2 -1
  10. package/lib/cjs/actions/blue/withdraw.d.ts +2 -1
  11. package/lib/cjs/actions/blue/withdraw.js +1 -1
  12. package/lib/cjs/blue/types.d.ts +3 -1
  13. package/lib/cjs/blue/utils.d.ts +3 -1
  14. package/lib/cjs/blue/utils.js +1 -0
  15. package/lib/cjs/bundler/actions.d.ts +2 -0
  16. package/lib/cjs/bundler/actions.js +2 -0
  17. package/lib/cjs/bundler/types.d.ts +10 -1
  18. package/lib/cjs/entities/blue/blue.d.ts +30 -5
  19. package/lib/cjs/entities/blue/blue.js +8 -2
  20. package/lib/cjs/entities/vaultV1/vaultV1.js +4 -12
  21. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +18 -3
  22. package/lib/cjs/entities/vaultV1ReallocationData.js +11 -1
  23. package/lib/cjs/entities/vaultV2/vaultV2.js +6 -18
  24. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +4 -1
  25. package/lib/cjs/helpers/computeVaultV1Reallocations.js +4 -1
  26. package/lib/cjs/helpers/validate.d.ts +2 -0
  27. package/lib/cjs/helpers/validate.js +2 -0
  28. package/lib/cjs/types/error.d.ts +34 -6
  29. package/lib/cjs/types/error.js +34 -6
  30. package/lib/cjs/types/sharedLiquidity.d.ts +26 -3
  31. package/lib/cjs/types.d.ts +3 -1
  32. package/lib/cjs/utils.d.ts +3 -1
  33. package/lib/cjs/utils.js +1 -0
  34. package/lib/esm/abis.d.ts +543 -0
  35. package/lib/esm/abis.js +737 -0
  36. package/lib/esm/actions/blue/borrow.d.ts +5 -2
  37. package/lib/esm/actions/blue/borrow.js +1 -1
  38. package/lib/esm/actions/blue/refinance.d.ts +7 -2
  39. package/lib/esm/actions/blue/refinance.js +3 -1
  40. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +6 -2
  41. package/lib/esm/actions/blue/supplyCollateralBorrow.js +2 -1
  42. package/lib/esm/actions/blue/withdraw.d.ts +2 -1
  43. package/lib/esm/actions/blue/withdraw.js +1 -1
  44. package/lib/esm/blue/types.d.ts +3 -1
  45. package/lib/esm/blue/utils.d.ts +3 -1
  46. package/lib/esm/blue/utils.js +3 -1
  47. package/lib/esm/bundler/actions.d.ts +2 -0
  48. package/lib/esm/bundler/actions.js +2 -0
  49. package/lib/esm/bundler/types.d.ts +10 -1
  50. package/lib/esm/entities/blue/blue.d.ts +30 -5
  51. package/lib/esm/entities/blue/blue.js +8 -2
  52. package/lib/esm/entities/vaultV1/vaultV1.js +4 -12
  53. package/lib/esm/entities/vaultV1ReallocationData.d.ts +18 -3
  54. package/lib/esm/entities/vaultV1ReallocationData.js +13 -2
  55. package/lib/esm/entities/vaultV2/vaultV2.js +7 -19
  56. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +4 -1
  57. package/lib/esm/helpers/computeVaultV1Reallocations.js +4 -1
  58. package/lib/esm/helpers/validate.d.ts +2 -0
  59. package/lib/esm/helpers/validate.js +2 -0
  60. package/lib/esm/types/error.d.ts +34 -6
  61. package/lib/esm/types/error.js +34 -6
  62. package/lib/esm/types/sharedLiquidity.d.ts +26 -3
  63. package/lib/esm/types.d.ts +3 -1
  64. package/lib/esm/utils.d.ts +3 -1
  65. package/lib/esm/utils.js +3 -1
  66. package/package.json +4 -4
@@ -14,7 +14,10 @@ export interface BlueBorrowParams {
14
14
  receiver: Address;
15
15
  /** Minimum borrow share price (in ray). Protects against share price manipulation. */
16
16
  minSharePrice: bigint;
17
- /** Homogeneous Vault V1 or Vault V2 reallocations to execute before borrowing. */
17
+ /**
18
+ * Homogeneous Vault V1 or Vault V2 reallocations to execute before borrowing.
19
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
20
+ */
18
21
  reallocations?: BlueReallocationPlan;
19
22
  /**
20
23
  * Optional signed Morpho authorization. When provided, a `setAuthorizationWithSig` call is
@@ -43,7 +46,7 @@ export interface BlueBorrowParams {
43
46
  * @param params.args.receiver - Address that receives the borrowed assets.
44
47
  * @param params.args.minSharePrice - Minimum borrow share price (in ray). Slippage protection.
45
48
  * @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
46
- * execute before borrowing.
49
+ * execute before borrowing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
47
50
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
48
51
  * a `setAuthorizationWithSig` call is prepended to the bundle.
49
52
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -25,7 +25,7 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
25
25
  * @param params.args.receiver - Address that receives the borrowed assets.
26
26
  * @param params.args.minSharePrice - Minimum borrow share price (in ray). Slippage protection.
27
27
  * @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
28
- * execute before borrowing.
28
+ * execute before borrowing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
29
29
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
30
30
  * a `setAuthorizationWithSig` call is prepended to the bundle.
31
31
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -27,7 +27,10 @@ export interface BlueRefinanceParams {
27
27
  minBorrowSharePrice: bigint;
28
28
  /** Maximum repay share price on the source market (in ray); must be > 0 when a repay leg exists. */
29
29
  maxRepaySharePrice: bigint;
30
- /** Homogeneous Vault V1 or Vault V2 reallocations into the target market. */
30
+ /**
31
+ * Homogeneous Vault V1 or Vault V2 reallocations into the target market.
32
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
33
+ */
31
34
  targetReallocations?: BlueReallocationPlan;
32
35
  /**
33
36
  * Optional signed Morpho authorization. When provided, a `setAuthorizationWithSig` call is
@@ -85,7 +88,9 @@ export interface BlueRefinanceParams {
85
88
  * @param params.args.minBorrowSharePrice - Minimum borrow share price (ray) on the target.
86
89
  * @param params.args.maxRepaySharePrice - Maximum repay share price (ray) on the source.
87
90
  * @param params.args.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
88
- * target, run before the supply leg. V1 fees add to `tx.value`; V2 penalties are paid in the target loan token.
91
+ * target, run before the supply leg. Vault V1 inputs are deprecated for high-level Blue writes;
92
+ * use Vault V2 for new integrations. V1 fees add to `tx.value`; V2 penalties are paid in the
93
+ * target loan token.
89
94
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
90
95
  * a `setAuthorizationWithSig` call is prepended to the bundle.
91
96
  * @param params.metadata - Optional analytics metadata appended to `tx.data`.
@@ -56,7 +56,9 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
56
56
  * @param params.args.minBorrowSharePrice - Minimum borrow share price (ray) on the target.
57
57
  * @param params.args.maxRepaySharePrice - Maximum repay share price (ray) on the source.
58
58
  * @param params.args.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
59
- * target, run before the supply leg. V1 fees add to `tx.value`; V2 penalties are paid in the target loan token.
59
+ * target, run before the supply leg. Vault V1 inputs are deprecated for high-level Blue writes;
60
+ * use Vault V2 for new integrations. V1 fees add to `tx.value`; V2 penalties are paid in the
61
+ * target loan token.
60
62
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
61
63
  * a `setAuthorizationWithSig` call is prepended to the bundle.
62
64
  * @param params.metadata - Optional analytics metadata appended to `tx.data`.
@@ -18,7 +18,10 @@ export interface BlueSupplyCollateralBorrowParams {
18
18
  minSharePrice: bigint;
19
19
  /** Optional pre-signed permit/permit2 approval for the collateral transfer. */
20
20
  requirementSignature?: PermitRequirementSignature;
21
- /** Homogeneous Vault V1 or Vault V2 reallocations to execute before borrowing. */
21
+ /**
22
+ * Homogeneous Vault V1 or Vault V2 reallocations to execute before borrowing.
23
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
24
+ */
22
25
  reallocations?: BlueReallocationPlan;
23
26
  /**
24
27
  * Optional signed Morpho authorization. When provided, a `setAuthorizationWithSig` call is
@@ -59,7 +62,8 @@ export interface BlueSupplyCollateralBorrowParams {
59
62
  * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
60
63
  * collateral supply. Requires the collateral token to be the chain's wNative.
61
64
  * @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
62
- * execute between the supply and borrow legs.
65
+ * execute between the supply and borrow legs. Vault V1 inputs are deprecated; use Vault V2 for
66
+ * new integrations.
63
67
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
64
68
  * a `setAuthorizationWithSig` call is prepended to the bundle.
65
69
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -39,7 +39,8 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
39
39
  * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
40
40
  * collateral supply. Requires the collateral token to be the chain's wNative.
41
41
  * @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
42
- * execute between the supply and borrow legs.
42
+ * execute between the supply and borrow legs. Vault V1 inputs are deprecated; use Vault V2 for
43
+ * new integrations.
43
44
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
44
45
  * a `setAuthorizationWithSig` call is prepended to the bundle.
45
46
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -20,6 +20,7 @@ export interface BlueWithdrawParams {
20
20
  * Homogeneous Vault V1 or Vault V2 reallocations to execute before withdrawing. V1 entries can be
21
21
  * computed via `MorphoBlue.getVaultV1Reallocations({ operation: "withdraw", amount })` or directly
22
22
  * via `computeVaultV1Reallocations({ operation: "withdraw", amount, ... })`.
23
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2 for new integrations.
23
24
  */
24
25
  reallocations?: BlueReallocationPlan;
25
26
  /**
@@ -59,7 +60,7 @@ export interface BlueWithdrawParams {
59
60
  * @param params.args.minSharePrice - Minimum acceptable withdraw share price (in ray). Slippage
60
61
  * protection.
61
62
  * @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
62
- * execute before withdrawing.
63
+ * execute before withdrawing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
63
64
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
64
65
  * a `setAuthorizationWithSig` call is prepended to the bundle.
65
66
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -35,7 +35,7 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
35
35
  * @param params.args.minSharePrice - Minimum acceptable withdraw share price (in ray). Slippage
36
36
  * protection.
37
37
  * @param params.args.reallocations - Optional homogeneous Vault V1 or Vault V2 reallocations to
38
- * execute before withdrawing.
38
+ * execute before withdrawing. Vault V1 inputs are deprecated; use Vault V2 for new integrations.
39
39
  * @param params.args.authorizationSignature - Optional signed Morpho authorization; when present,
40
40
  * a `setAuthorizationWithSig` call is prepended to the bundle.
41
41
  * @param params.metadata - Optional analytics metadata attached to the bundle.
@@ -1,2 +1,4 @@
1
1
  export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams, IPermit2Allowance, Loadable, MarketId, MaxBorrowOptions, MaxPositionCapacities, MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
2
- export type { AuthorizationArgs, DaiPermitArgs, DeploylessFetchParameters, FetchParameters, InputAllocation, MetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs, } from "@morpho-org/blue-sdk-viem";
2
+ export type { AuthorizationArgs,
3
+ /** @deprecated Args for the deprecated getDaiPermitTypedData; scheduled for removal in the next major. */
4
+ DaiPermitArgs, DeploylessFetchParameters, FetchParameters, InputAllocation, MetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs, } from "@morpho-org/blue-sdk-viem";
@@ -1,3 +1,5 @@
1
1
  export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
2
2
  export { AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
3
- export { decodeBytes32String, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
3
+ export { decodeBytes32String, getAuthorizationTypedData,
4
+ /** @deprecated DAI is routed through Permit2 internally; scheduled for removal in the next major. */
5
+ getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "VaultV2Utils", { enumerable: true, get: function
16
16
  var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
17
17
  Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return blue_sdk_viem_1.decodeBytes32String; } });
18
18
  Object.defineProperty(exports, "getAuthorizationTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getAuthorizationTypedData; } });
19
+ /** @deprecated DAI is routed through Permit2 internally; scheduled for removal in the next major. */
19
20
  Object.defineProperty(exports, "getDaiPermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getDaiPermitTypedData; } });
20
21
  Object.defineProperty(exports, "getPermit2PermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2PermitTypedData; } });
21
22
  Object.defineProperty(exports, "getPermit2TransferFromTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2TransferFromTypedData; } });
@@ -622,6 +622,8 @@ export declare namespace BundlerAction {
622
622
  * @param skipRevert - Whether Bundler3 should tolerate a revert.
623
623
  * @returns Encoded Bundler3 calls.
624
624
  * @throws {BundlerErrors.UnexpectedAction} when the PublicAllocator is unavailable on the chain.
625
+ * @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use
626
+ * `vaultV2BluePublicAllocatorReallocate` or `vaultV2BluePublicAllocatorAllocateFromIdle`.
625
627
  *
626
628
  * @example
627
629
  * ```ts
@@ -1075,6 +1075,8 @@ var BundlerAction;
1075
1075
  * @param skipRevert - Whether Bundler3 should tolerate a revert.
1076
1076
  * @returns Encoded Bundler3 calls.
1077
1077
  * @throws {BundlerErrors.UnexpectedAction} when the PublicAllocator is unavailable on the chain.
1078
+ * @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use
1079
+ * `vaultV2BluePublicAllocatorReallocate` or `vaultV2BluePublicAllocatorAllocateFromIdle`.
1078
1080
  *
1079
1081
  * @example
1080
1082
  * ```ts
@@ -18,6 +18,9 @@ export interface Authorization {
18
18
  }
19
19
  /**
20
20
  * Public allocator withdrawal input used by a `reallocateTo` Bundler3 action.
21
+ *
22
+ * @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use Vault V2
23
+ * BluePublicAllocator actions.
21
24
  */
22
25
  export interface InputReallocation {
23
26
  /** Market to withdraw liquidity from. */
@@ -172,7 +175,13 @@ export interface ActionArgs {
172
175
  receiver: Address,
173
176
  skipRevert?: boolean
174
177
  ];
175
- /** PublicAllocator reallocation to `supplyMarket` from `vault` withdrawals while paying `fee`; `skipRevert` controls Bundler3 revert handling. */
178
+ /**
179
+ * PublicAllocator reallocation to `supplyMarket` from `vault` withdrawals while paying `fee`;
180
+ * `skipRevert` controls Bundler3 revert handling.
181
+ *
182
+ * @deprecated Vault V1 PublicAllocator composition will be removed in the next major. Use Vault V2
183
+ * BluePublicAllocator actions.
184
+ */
176
185
  readonly reallocateTo: [
177
186
  vault: Address,
178
187
  fee: bigint,
@@ -106,6 +106,8 @@ export interface BlueActions {
106
106
  * When `reallocations` is provided, its homogeneous V1 or V2 actions are
107
107
  * prepended to move liquidity before withdrawing. V1 fees add
108
108
  * to the transaction value; V2 penalties are paid in the loan token.
109
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
110
+ * reallocations for new integrations.
109
111
  *
110
112
  * `getRequirements` returns the loan-token approval needed for V2 penalties
111
113
  * and `morpho.setAuthorization(generalAdapter1, true)` when GA1 is not yet
@@ -128,6 +130,7 @@ export interface BlueActions {
128
130
  receiver?: Address;
129
131
  positionData: AccrualPosition;
130
132
  slippageTolerance?: bigint;
133
+ /** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
131
134
  reallocations?: BlueReallocationPlan;
132
135
  } & AssetsOrSharesArgs) => {
133
136
  buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueWithdrawAction>>;
@@ -143,6 +146,8 @@ export interface BlueActions {
143
146
  * When `reallocations` is provided, its homogeneous V1 or V2 actions are
144
147
  * prepended before borrowing. V1 fees add to the transaction
145
148
  * value; V2 penalties are paid in the loan token.
149
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
150
+ * reallocations for new integrations.
146
151
  *
147
152
  * `getRequirements` returns the loan-token approval needed for V2 penalties
148
153
  * and Morpho authorization for GeneralAdapter1 when needed.
@@ -164,6 +169,7 @@ export interface BlueActions {
164
169
  amount: bigint;
165
170
  positionData: AccrualPosition;
166
171
  slippageTolerance?: bigint;
172
+ /** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
167
173
  reallocations?: BlueReallocationPlan;
168
174
  }) => {
169
175
  buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueBorrowAction>>;
@@ -265,6 +271,8 @@ export interface BlueActions {
265
271
  * When `reallocations` is provided, its homogeneous V1 or V2 actions run
266
272
  * between the collateral supply and `morphoBorrow`. V1 fees add
267
273
  * to the transaction value; V2 penalties are paid in the loan token.
274
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
275
+ * reallocations for new integrations.
268
276
  *
269
277
  * `getRequirements` returns in parallel:
270
278
  * - ERC20 approval or permit for collateral token (to GeneralAdapter1).
@@ -288,6 +296,7 @@ export interface BlueActions {
288
296
  positionData: AccrualPosition;
289
297
  borrowAmount: bigint;
290
298
  slippageTolerance?: bigint;
299
+ /** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
291
300
  reallocations?: BlueReallocationPlan;
292
301
  } & DepositAmountArgs) => {
293
302
  buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyCollateralBorrowAction>>;
@@ -311,6 +320,8 @@ export interface BlueActions {
311
320
  * A homogeneous V1 or V2 target reallocation plan runs first; V1 fees add
312
321
  * to the transaction value and V2 penalties are paid
313
322
  * in the loan token.
323
+ * Vault V1 inputs are deprecated for high-level Blue writes; use Vault V2
324
+ * reallocations for new integrations.
314
325
  *
315
326
  * `getRequirements` returns the loan-token approval needed for V2 penalties
316
327
  * and Morpho authorization for GeneralAdapter1 when needed.
@@ -323,7 +334,8 @@ export interface BlueActions {
323
334
  * @param params.borrowAssets - Loan assets to repay on source; exclusive with `borrowShares`.
324
335
  * @param params.borrowShares - Borrow shares to repay on source; exclusive with `borrowAssets`.
325
336
  * @param params.slippageTolerance - WAD slippage tolerance. Defaults to `DEFAULT_SLIPPAGE_TOLERANCE`.
326
- * @param params.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the target market.
337
+ * @param params.targetReallocations - Homogeneous Vault V1 or Vault V2 reallocations into the
338
+ * target market. Vault V1 inputs are deprecated; prefer Vault V2.
327
339
  * @returns Object with `buildTx` and `getRequirements`.
328
340
  * @throws {BundlerErrors.UnexpectedAction} when a V2 plan is unsupported on the chain.
329
341
  * @throws {InputExceedsMaxError} when a V2 reallocation asset amount exceeds `uint128` or its penalty exceeds WAD.
@@ -344,6 +356,7 @@ export interface BlueActions {
344
356
  borrowAssets?: bigint;
345
357
  borrowShares?: bigint;
346
358
  slippageTolerance?: bigint;
359
+ /** Vault V1 inputs are deprecated for high-level Blue writes; prefer Vault V2. */
347
360
  targetReallocations?: BlueReallocationPlan;
348
361
  }) => {
349
362
  buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRefinanceAction>>;
@@ -369,6 +382,8 @@ export interface BlueActions {
369
382
  * @param params.block - The block to fetch data at (number and timestamp).
370
383
  * @returns A VaultV1ReallocationData instance populated with all required data.
371
384
  * @throws {ChainIdMismatchError} when the client chain does not match this market.
385
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
386
+ * {@link getVaultV2BlueReallocationData}.
372
387
  */
373
388
  getVaultV1ReallocationData: (params: {
374
389
  vaultAddresses: readonly Address[];
@@ -385,7 +400,8 @@ export interface BlueActions {
385
400
  * @param params.block.timestamp - Timestamp corresponding to the fetched block.
386
401
  * @returns A `VaultV1ReallocationData` snapshot populated from one block.
387
402
  * @throws {ChainIdMismatchError} when the client chain does not match this market.
388
- * @deprecated Use {@link getVaultV1ReallocationData} instead.
403
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
404
+ * {@link getVaultV2BlueReallocationData}.
389
405
  */
390
406
  getReallocationData: (params: {
391
407
  vaultAddresses: readonly Address[];
@@ -444,6 +460,8 @@ export interface BlueActions {
444
460
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds the target market supply.
445
461
  * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
446
462
  * @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
463
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
464
+ * {@link getVaultV2BlueReallocations}.
447
465
  * @example
448
466
  * ```ts
449
467
  * const reallocations = market.getVaultV1Reallocations({
@@ -468,7 +486,8 @@ export interface BlueActions {
468
486
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
469
487
  * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
470
488
  * @throws {UnknownReallocationMarketError} when the target market is absent.
471
- * @deprecated Use {@link getVaultV1Reallocations} instead.
489
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
490
+ * {@link getVaultV2BlueReallocations}.
472
491
  * @example
473
492
  * ```ts
474
493
  * const reallocations = market.getReallocations({
@@ -622,6 +641,8 @@ export declare class MorphoBlue implements BlueActions {
622
641
  * @param params.block.timestamp - Timestamp corresponding to the fetched block.
623
642
  * @returns Reallocation data ready for {@link getVaultV1Reallocations}.
624
643
  * @throws {ChainIdMismatchError} when the client chain does not match this market.
644
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
645
+ * {@link getVaultV2BlueReallocationData}.
625
646
  * @example
626
647
  * ```ts
627
648
  * import { markets, vaults } from "@morpho-org/morpho-test";
@@ -655,7 +676,8 @@ export declare class MorphoBlue implements BlueActions {
655
676
  * @param params.block.timestamp - Timestamp corresponding to the fetched block.
656
677
  * @returns A `VaultV1ReallocationData` snapshot populated from one block.
657
678
  * @throws {ChainIdMismatchError} when the client chain does not match this market.
658
- * @deprecated Use {@link getVaultV1ReallocationData} instead.
679
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
680
+ * {@link getVaultV2BlueReallocationData}.
659
681
  * @example
660
682
  * ```ts
661
683
  * const data = await market.getReallocationData({ vaultAddresses, block });
@@ -731,6 +753,8 @@ export declare class MorphoBlue implements BlueActions {
731
753
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
732
754
  * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
733
755
  * @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
756
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
757
+ * {@link getVaultV2BlueReallocations}.
734
758
  * @example
735
759
  * ```ts
736
760
  * const reallocations = market.getVaultV1Reallocations({
@@ -755,7 +779,8 @@ export declare class MorphoBlue implements BlueActions {
755
779
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
756
780
  * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
757
781
  * @throws {UnknownReallocationMarketError} when the target market is absent.
758
- * @deprecated Use {@link getVaultV1Reallocations} instead.
782
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
783
+ * {@link getVaultV2BlueReallocations}.
759
784
  * @example
760
785
  * ```ts
761
786
  * const reallocations = market.getReallocations({
@@ -917,6 +917,8 @@ class MorphoBlue {
917
917
  * @param params.block.timestamp - Timestamp corresponding to the fetched block.
918
918
  * @returns Reallocation data ready for {@link getVaultV1Reallocations}.
919
919
  * @throws {ChainIdMismatchError} when the client chain does not match this market.
920
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
921
+ * {@link getVaultV2BlueReallocationData}.
920
922
  * @example
921
923
  * ```ts
922
924
  * import { markets, vaults } from "@morpho-org/morpho-test";
@@ -1010,7 +1012,8 @@ class MorphoBlue {
1010
1012
  * @param params.block.timestamp - Timestamp corresponding to the fetched block.
1011
1013
  * @returns A `VaultV1ReallocationData` snapshot populated from one block.
1012
1014
  * @throws {ChainIdMismatchError} when the client chain does not match this market.
1013
- * @deprecated Use {@link getVaultV1ReallocationData} instead.
1015
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
1016
+ * {@link getVaultV2BlueReallocationData}.
1014
1017
  * @example
1015
1018
  * ```ts
1016
1019
  * const data = await market.getReallocationData({ vaultAddresses, block });
@@ -1116,6 +1119,8 @@ class MorphoBlue {
1116
1119
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when `operation === "withdraw"` and `amount` exceeds the target market's `totalSupplyAssets`.
1117
1120
  * @throws {MissingPublicAllocatorConfigError} when a selected vault is missing its public allocator config.
1118
1121
  * @throws {UnknownReallocationMarketError} when the target market is absent from the reallocation data.
1122
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
1123
+ * {@link getVaultV2BlueReallocations}.
1119
1124
  * @example
1120
1125
  * ```ts
1121
1126
  * const reallocations = market.getVaultV1Reallocations({
@@ -1160,7 +1165,8 @@ class MorphoBlue {
1160
1165
  * @throws {ReallocationWithdrawExceedsMarketSupplyError} when a withdrawal exceeds market supply.
1161
1166
  * @throws {MissingPublicAllocatorConfigError} when a selected vault lacks allocator state.
1162
1167
  * @throws {UnknownReallocationMarketError} when the target market is absent.
1163
- * @deprecated Use {@link getVaultV1Reallocations} instead.
1168
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
1169
+ * {@link getVaultV2BlueReallocations}.
1164
1170
  * @example
1165
1171
  * ```ts
1166
1172
  * const reallocations = market.getReallocations({
@@ -32,9 +32,7 @@ class MorphoVaultV1 {
32
32
  });
33
33
  }
34
34
  deposit({ amount = 0n, userAddress, vaultData, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, nativeAmount, }) {
35
- if (this.client.viemClient.chain?.id !== this.chainId) {
36
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
37
- }
35
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
38
36
  if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
39
37
  throw new index_js_3.VaultAddressMismatchError(this.vault, vaultData.address);
40
38
  }
@@ -101,9 +99,7 @@ class MorphoVaultV1 {
101
99
  };
102
100
  }
103
101
  withdraw({ amount, userAddress }) {
104
- if (this.client.viemClient.chain?.id !== this.chainId) {
105
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
106
- }
102
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
107
103
  return {
108
104
  buildTx: () => (0, index_js_1.vaultV1Withdraw)({
109
105
  vault: { address: this.vault },
@@ -117,9 +113,7 @@ class MorphoVaultV1 {
117
113
  };
118
114
  }
119
115
  redeem({ shares, userAddress }) {
120
- if (this.client.viemClient.chain?.id !== this.chainId) {
121
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
122
- }
116
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
123
117
  return {
124
118
  buildTx: () => (0, index_js_1.vaultV1Redeem)({
125
119
  vault: { address: this.vault },
@@ -134,9 +128,7 @@ class MorphoVaultV1 {
134
128
  }
135
129
  /** {@inheritDoc VaultV1Actions.inKindRedeem} */
136
130
  inKindRedeem({ amount, marketParamsList, vaultData, userAddress, deadline: deadlineOverride, }) {
137
- if (this.client.viemClient.chain?.id !== this.chainId) {
138
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
139
- }
131
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
140
132
  if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
141
133
  throw new index_js_3.VaultAddressMismatchError(this.vault, vaultData.address);
142
134
  }
@@ -3,6 +3,9 @@ import type { Address } from "viem";
3
3
  import type { PublicAllocatorOptions, PublicReallocation, ReallocationComputeOptions } from "../types/index.js";
4
4
  /**
5
5
  * Input state required to construct {@link VaultV1ReallocationData}.
6
+ *
7
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
8
+ * `InputVaultV2BlueReallocationData`.
6
9
  */
7
10
  export interface InputVaultV1ReallocationData {
8
11
  /** Chain id associated with the fetched state. */
@@ -19,7 +22,8 @@ export interface InputVaultV1ReallocationData {
19
22
  /**
20
23
  * Deprecated input name for Vault V1 reallocation data.
21
24
  *
22
- * @deprecated Use {@link InputVaultV1ReallocationData} instead.
25
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
26
+ * `InputVaultV2BlueReallocationData`.
23
27
  */
24
28
  export type InputReallocationData = InputVaultV1ReallocationData;
25
29
  /**
@@ -35,6 +39,9 @@ export type InputReallocationData = InputVaultV1ReallocationData;
35
39
  * `markets`, `vaults`, `positions`, and `vaultMarketConfigs` as a read
36
40
  * contract keyed by market id or address; use the getters for typed absence
37
41
  * errors and use simulation methods to produce updated state.
42
+ *
43
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
44
+ * `VaultV2BlueReallocationData`.
38
45
  */
39
46
  export declare class VaultV1ReallocationData implements InputVaultV1ReallocationData {
40
47
  /** Chain id associated with the fetched reallocation data. */
@@ -128,6 +135,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
128
135
  * @param options - Optional allocator discovery options.
129
136
  * @returns Computed source-market withdrawals and the post-reallocation state.
130
137
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
138
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
139
+ * `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
131
140
  * @example
132
141
  * ```ts
133
142
  * import { createPublicClient, http } from "viem";
@@ -171,7 +180,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
171
180
  * @param options - Optional allocator discovery options.
172
181
  * @returns Computed source-market withdrawals and the post-reallocation state.
173
182
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
174
- * @deprecated Use {@link computeVaultV1Reallocations} instead.
183
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
184
+ * `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
175
185
  */
176
186
  getMarketPublicReallocations(marketId: MarketId, options?: PublicAllocatorOptions): {
177
187
  readonly withdrawals: readonly PublicReallocation[];
@@ -190,6 +200,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
190
200
  * @param options - Optional allocator discovery options.
191
201
  * @returns Total reallocatable assets in loan-token units; `0n` when none is available.
192
202
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
203
+ * @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
204
+ * `VaultV2BlueReallocationData.getPublicReallocationLiquidity`.
193
205
  * @example
194
206
  * ```ts
195
207
  * import { createPublicClient, http } from "viem";
@@ -241,6 +253,8 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
241
253
  * @param options - Optional reallocation options (supply target utilization trigger, timestamp, withdrawal caps).
242
254
  * @returns Available liquidity to the given utilization in loan-token units; `0n` when none is available.
243
255
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
256
+ * @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
257
+ * `VaultV2BlueReallocationData.getAvailableLiquidityToUtilization`.
244
258
  * @example
245
259
  * ```ts
246
260
  * import { createPublicClient, http, parseEther } from "viem";
@@ -306,6 +320,7 @@ export declare class VaultV1ReallocationData implements InputVaultV1Reallocation
306
320
  /**
307
321
  * Deprecated class name for Vault V1 reallocation data.
308
322
  *
309
- * @deprecated Use {@link VaultV1ReallocationData} instead.
323
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
324
+ * `VaultV2BlueReallocationData`.
310
325
  */
311
326
  export { VaultV1ReallocationData as ReallocationData };
@@ -60,6 +60,9 @@ const cloneVaultMarketConfig = (config) => new blue_sdk_1.VaultMarketConfig({
60
60
  * `markets`, `vaults`, `positions`, and `vaultMarketConfigs` as a read
61
61
  * contract keyed by market id or address; use the getters for typed absence
62
62
  * errors and use simulation methods to produce updated state.
63
+ *
64
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
65
+ * `VaultV2BlueReallocationData`.
63
66
  */
64
67
  class VaultV1ReallocationData {
65
68
  /** Chain id associated with the fetched reallocation data. */
@@ -215,6 +218,8 @@ class VaultV1ReallocationData {
215
218
  * @param options - Optional allocator discovery options.
216
219
  * @returns Computed source-market withdrawals and the post-reallocation state.
217
220
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
221
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
222
+ * `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
218
223
  * @example
219
224
  * ```ts
220
225
  * import { createPublicClient, http } from "viem";
@@ -310,7 +315,8 @@ class VaultV1ReallocationData {
310
315
  * @param options - Optional allocator discovery options.
311
316
  * @returns Computed source-market withdrawals and the post-reallocation state.
312
317
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
313
- * @deprecated Use {@link computeVaultV1Reallocations} instead.
318
+ * @deprecated Vault V1 shared-liquidity planning will be removed in the next major. Use
319
+ * `VaultV2BlueReallocationData.computeVaultV2BlueReallocations`.
314
320
  */
315
321
  getMarketPublicReallocations(marketId, options = {}) {
316
322
  return this.computeVaultV1Reallocations(marketId, options);
@@ -328,6 +334,8 @@ class VaultV1ReallocationData {
328
334
  * @param options - Optional allocator discovery options.
329
335
  * @returns Total reallocatable assets in loan-token units; `0n` when none is available.
330
336
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
337
+ * @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
338
+ * `VaultV2BlueReallocationData.getPublicReallocationLiquidity`.
331
339
  * @example
332
340
  * ```ts
333
341
  * import { createPublicClient, http } from "viem";
@@ -382,6 +390,8 @@ class VaultV1ReallocationData {
382
390
  * @param options - Optional reallocation options (supply target utilization trigger, timestamp, withdrawal caps).
383
391
  * @returns Available liquidity to the given utilization in loan-token units; `0n` when none is available.
384
392
  * @throws {@link UnknownReallocationMarketError} when the target market is absent.
393
+ * @deprecated Vault V1 shared-liquidity metrics will be removed in the next major. Use
394
+ * `VaultV2BlueReallocationData.getAvailableLiquidityToUtilization`.
385
395
  * @example
386
396
  * ```ts
387
397
  * import { createPublicClient, http, parseEther } from "viem";
@@ -31,9 +31,7 @@ class MorphoVaultV2 {
31
31
  });
32
32
  }
33
33
  deposit({ amount = 0n, userAddress, vaultData, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, nativeAmount, }) {
34
- if (this.client.viemClient.chain?.id !== this.chainId) {
35
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
36
- }
34
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
37
35
  if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
38
36
  throw new index_js_3.VaultAddressMismatchError(this.vault, vaultData.address);
39
37
  }
@@ -104,9 +102,7 @@ class MorphoVaultV2 {
104
102
  };
105
103
  }
106
104
  withdraw({ amount, userAddress }) {
107
- if (this.client.viemClient.chain?.id !== this.chainId) {
108
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
109
- }
105
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
110
106
  return {
111
107
  buildTx: () => (0, index_js_1.vaultV2Withdraw)({
112
108
  vault: { address: this.vault },
@@ -120,9 +116,7 @@ class MorphoVaultV2 {
120
116
  };
121
117
  }
122
118
  redeem({ shares, userAddress }) {
123
- if (this.client.viemClient.chain?.id !== this.chainId) {
124
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
125
- }
119
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
126
120
  return {
127
121
  buildTx: () => (0, index_js_1.vaultV2Redeem)({
128
122
  vault: { address: this.vault },
@@ -137,9 +131,7 @@ class MorphoVaultV2 {
137
131
  }
138
132
  /** {@inheritDoc VaultV2Actions.inKindRedeem} */
139
133
  inKindRedeem({ amount, marketParamsList, vaultData, userAddress, adapter: adapterOverride, deadline: deadlineOverride, }) {
140
- if (this.client.viemClient.chain?.id !== this.chainId) {
141
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
142
- }
134
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
143
135
  if (!(0, viem_1.isAddressEqual)(vaultData.address, this.vault)) {
144
136
  throw new index_js_3.VaultAddressMismatchError(this.vault, vaultData.address);
145
137
  }
@@ -316,9 +308,7 @@ class MorphoVaultV2 {
316
308
  };
317
309
  }
318
310
  forceWithdraw({ deallocations, withdraw, userAddress, }) {
319
- if (this.client.viemClient.chain?.id !== this.chainId) {
320
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
321
- }
311
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
322
312
  return {
323
313
  buildTx: () => (0, index_js_1.vaultV2ForceWithdraw)({
324
314
  vault: { address: this.vault },
@@ -335,9 +325,7 @@ class MorphoVaultV2 {
335
325
  };
336
326
  }
337
327
  forceRedeem({ deallocations, redeem, userAddress, }) {
338
- if (this.client.viemClient.chain?.id !== this.chainId) {
339
- throw new index_js_3.ChainIdMismatchError(this.client.viemClient.chain?.id, this.chainId);
340
- }
328
+ (0, index_js_2.validateChainId)(this.client.viemClient.chain?.id, this.chainId);
341
329
  return {
342
330
  buildTx: () => (0, index_js_1.vaultV2ForceRedeem)({
343
331
  vault: { address: this.vault },