@morpho-org/morpho-sdk 9.5.1 → 9.6.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 (92) hide show
  1. package/README.md +59 -0
  2. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
  3. package/lib/cjs/actions/bundles/common.js +39 -32
  4. package/lib/cjs/actions/midnight/cancelAndMake.js +20 -98
  5. package/lib/cjs/actions/midnight/index.d.ts +2 -0
  6. package/lib/cjs/actions/midnight/index.js +2 -0
  7. package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +5 -6
  8. package/lib/cjs/actions/midnight/supplyCollateralBatch.d.ts +39 -0
  9. package/lib/cjs/actions/midnight/supplyCollateralBatch.js +91 -0
  10. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +31 -32
  11. package/lib/cjs/actions/midnight/takeBorrow.js +24 -23
  12. package/lib/cjs/actions/midnight/takeLend.js +24 -23
  13. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +20 -19
  14. package/lib/cjs/actions/midnight/takeWithdraw.js +24 -23
  15. package/lib/cjs/actions/midnight/withdrawCollateralBatch.d.ts +44 -0
  16. package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +104 -0
  17. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +1 -0
  18. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +1 -0
  19. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +1 -0
  20. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +1 -0
  21. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +1 -0
  22. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
  23. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -0
  24. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +1 -0
  25. package/lib/cjs/actions/vaultV1/migrateToV2.js +7 -7
  26. package/lib/cjs/entities/index.d.ts +1 -1
  27. package/lib/cjs/entities/midnight/midnight.d.ts +77 -3
  28. package/lib/cjs/entities/midnight/midnight.js +174 -0
  29. package/lib/cjs/entities/midnight/types.d.ts +16 -0
  30. package/lib/cjs/errors.d.ts +1 -1
  31. package/lib/cjs/errors.js +3 -2
  32. package/lib/cjs/helpers/signAndVerifyTypedData.d.ts +1 -0
  33. package/lib/cjs/helpers/signAndVerifyTypedData.js +12 -5
  34. package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.d.ts +68 -0
  35. package/lib/cjs/helpers/validateMidnightCancelAndMakePublication.js +129 -0
  36. package/lib/cjs/helpers/validateMidnightCollateralBatch.d.ts +14 -0
  37. package/lib/cjs/helpers/validateMidnightCollateralBatch.js +27 -0
  38. package/lib/cjs/helpers/validateMidnightCollateralSupplies.d.ts +17 -0
  39. package/lib/cjs/helpers/validateMidnightCollateralSupplies.js +28 -0
  40. package/lib/cjs/helpers/validatePositiveInput.d.ts +10 -0
  41. package/lib/cjs/helpers/validatePositiveInput.js +18 -0
  42. package/lib/cjs/midnight/errors.d.ts +1 -1
  43. package/lib/cjs/midnight/errors.js +2 -1
  44. package/lib/cjs/types/action.d.ts +18 -3
  45. package/lib/cjs/types/error.d.ts +23 -2
  46. package/lib/cjs/types/error.js +45 -5
  47. package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
  48. package/lib/esm/actions/bundles/common.js +39 -32
  49. package/lib/esm/actions/midnight/cancelAndMake.js +25 -103
  50. package/lib/esm/actions/midnight/index.d.ts +2 -0
  51. package/lib/esm/actions/midnight/index.js +2 -0
  52. package/lib/esm/actions/midnight/repayWithdrawCollateral.js +5 -6
  53. package/lib/esm/actions/midnight/supplyCollateralBatch.d.ts +39 -0
  54. package/lib/esm/actions/midnight/supplyCollateralBatch.js +87 -0
  55. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +33 -34
  56. package/lib/esm/actions/midnight/takeBorrow.js +25 -24
  57. package/lib/esm/actions/midnight/takeLend.js +25 -24
  58. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +20 -19
  59. package/lib/esm/actions/midnight/takeWithdraw.js +25 -24
  60. package/lib/esm/actions/midnight/withdrawCollateralBatch.d.ts +44 -0
  61. package/lib/esm/actions/midnight/withdrawCollateralBatch.js +100 -0
  62. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +1 -0
  63. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +1 -0
  64. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +1 -0
  65. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +1 -0
  66. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +1 -0
  67. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
  68. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +1 -0
  69. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +1 -0
  70. package/lib/esm/actions/vaultV1/migrateToV2.js +8 -8
  71. package/lib/esm/entities/index.d.ts +1 -1
  72. package/lib/esm/entities/midnight/midnight.d.ts +77 -3
  73. package/lib/esm/entities/midnight/midnight.js +176 -2
  74. package/lib/esm/entities/midnight/types.d.ts +16 -0
  75. package/lib/esm/errors.d.ts +1 -1
  76. package/lib/esm/errors.js +1 -1
  77. package/lib/esm/helpers/signAndVerifyTypedData.d.ts +1 -0
  78. package/lib/esm/helpers/signAndVerifyTypedData.js +13 -6
  79. package/lib/esm/helpers/validateMidnightCancelAndMakePublication.d.ts +68 -0
  80. package/lib/esm/helpers/validateMidnightCancelAndMakePublication.js +124 -0
  81. package/lib/esm/helpers/validateMidnightCollateralBatch.d.ts +14 -0
  82. package/lib/esm/helpers/validateMidnightCollateralBatch.js +24 -0
  83. package/lib/esm/helpers/validateMidnightCollateralSupplies.d.ts +17 -0
  84. package/lib/esm/helpers/validateMidnightCollateralSupplies.js +24 -0
  85. package/lib/esm/helpers/validatePositiveInput.d.ts +10 -0
  86. package/lib/esm/helpers/validatePositiveInput.js +14 -0
  87. package/lib/esm/midnight/errors.d.ts +1 -1
  88. package/lib/esm/midnight/errors.js +1 -1
  89. package/lib/esm/types/action.d.ts +18 -3
  90. package/lib/esm/types/error.d.ts +23 -2
  91. package/lib/esm/types/error.js +40 -3
  92. package/package.json +5 -5
@@ -9,9 +9,11 @@ const index_js_1 = require("../../helpers/index.js");
9
9
  const validate_js_1 = require("../../helpers/validate.js");
10
10
  const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAccount.js");
11
11
  const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBounds.js");
12
+ const validateMidnightCollateralSupplies_js_1 = require("../../helpers/validateMidnightCollateralSupplies.js");
12
13
  const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
13
14
  const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
14
15
  const validateMidnightTakeFeasibility_js_1 = require("../../helpers/validateMidnightTakeFeasibility.js");
16
+ const validatePositiveInput_js_1 = require("../../helpers/validatePositiveInput.js");
15
17
  const validateTakeableOffers_js_1 = require("../../helpers/validateTakeableOffers.js");
16
18
  const index_js_2 = require("../../types/index.js");
17
19
  /**
@@ -98,15 +100,12 @@ const midnightSupplyCollateralTakeBorrow = (params) => {
98
100
  if (params.collateralSupplies.length === 0) {
99
101
  throw new index_js_2.EmptyMidnightCollateralSuppliesError();
100
102
  }
101
- for (const [index, { collateralIndex, assets },] of params.collateralSupplies.entries()) {
102
- if (assets <= 0n) {
103
- throw new index_js_2.NonPositiveInputError(`collateralSupplies[${index}].assets`, assets);
104
- }
105
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)(`collateralSupplies[${index}].assets`, assets);
106
- // Throws UnknownCollateralIndexError when the index is not configured on the market.
107
- midnight_sdk_1.MarketUtils.getCollateralByIndex(params.market, collateralIndex);
108
- }
109
- (0, validateMidnightBounds_js_1.validateMidnightCollateralSupplySums)("collateralSupplies", params.collateralSupplies);
103
+ // Validation only; checks supply entries and their per-index totals.
104
+ (0, validateMidnightCollateralSupplies_js_1.validateMidnightCollateralSupplies)({
105
+ market: params.market,
106
+ field: "collateralSupplies",
107
+ supplies: params.collateralSupplies,
108
+ });
110
109
  const marketId = (0, validateTakeableOffers_js_1.validateTakeableOffers)({
111
110
  market: params.market,
112
111
  takeableOffers: params.takeableOffers,
@@ -121,31 +120,31 @@ const midnightSupplyCollateralTakeBorrow = (params) => {
121
120
  receiver: params.receiver,
122
121
  });
123
122
  const { target } = params;
124
- if (target.type === "assets") {
125
- if (target.assets <= 0n) {
126
- throw new index_js_2.NonPositiveInputError("target.assets", target.assets);
127
- }
128
- if (target.maxUnits === viem_1.maxUint256) {
129
- throw new index_js_2.UnboundedMidnightTakeInputError("target.maxUnits");
130
- }
131
- if (target.maxUnits <= 0n) {
132
- throw new index_js_2.NonPositiveInputError("target.maxUnits", target.maxUnits);
133
- }
134
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
135
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxUnits", target.maxUnits);
136
- }
137
- else {
138
- if (target.units === viem_1.maxUint256) {
139
- throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
140
- }
141
- if (target.units <= 0n) {
142
- throw new index_js_2.NonPositiveInputError("target.units", target.units);
123
+ switch (target.type) {
124
+ case "assets": {
125
+ // Validation only; rejects non-positive amounts.
126
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.assets", target.assets);
127
+ if (target.maxUnits === viem_1.maxUint256) {
128
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.maxUnits");
129
+ }
130
+ // Validation only; rejects non-positive amounts.
131
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.maxUnits", target.maxUnits);
132
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
133
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxUnits", target.maxUnits);
134
+ break;
143
135
  }
144
- if (target.minSellerAssets <= 0n) {
145
- throw new index_js_2.NonPositiveInputError("target.minSellerAssets", target.minSellerAssets);
136
+ default: {
137
+ if (target.units === viem_1.maxUint256) {
138
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
139
+ }
140
+ // Validation only; rejects non-positive amounts.
141
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.units", target.units);
142
+ // Validation only; rejects non-positive amounts.
143
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.minSellerAssets", target.minSellerAssets);
144
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
145
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minSellerAssets", target.minSellerAssets);
146
+ break;
146
147
  }
147
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
148
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minSellerAssets", target.minSellerAssets);
149
148
  }
150
149
  if (params.deadline === viem_1.maxUint256) {
151
150
  throw new index_js_2.UnboundedMidnightTakeInputError("deadline");
@@ -12,6 +12,7 @@ const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBound
12
12
  const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
13
13
  const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
14
14
  const validateMidnightTakeFeasibility_js_1 = require("../../helpers/validateMidnightTakeFeasibility.js");
15
+ const validatePositiveInput_js_1 = require("../../helpers/validatePositiveInput.js");
15
16
  const validateTakeableOffers_js_1 = require("../../helpers/validateTakeableOffers.js");
16
17
  const index_js_2 = require("../../types/index.js");
17
18
  /**
@@ -97,31 +98,31 @@ const midnightTakeBorrow = (params) => {
97
98
  receiver: params.receiver,
98
99
  });
99
100
  const { target } = params;
100
- if (target.type === "assets") {
101
- if (target.assets <= 0n) {
102
- throw new index_js_2.NonPositiveInputError("target.assets", target.assets);
101
+ switch (target.type) {
102
+ case "assets": {
103
+ // Validation only; rejects non-positive amounts.
104
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.assets", target.assets);
105
+ if (target.maxUnits === viem_1.maxUint256) {
106
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.maxUnits");
107
+ }
108
+ // Validation only; rejects non-positive amounts.
109
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.maxUnits", target.maxUnits);
110
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
111
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxUnits", target.maxUnits);
112
+ break;
103
113
  }
104
- if (target.maxUnits === viem_1.maxUint256) {
105
- throw new index_js_2.UnboundedMidnightTakeInputError("target.maxUnits");
114
+ default: {
115
+ if (target.units === viem_1.maxUint256) {
116
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
117
+ }
118
+ // Validation only; rejects non-positive amounts.
119
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.units", target.units);
120
+ // Validation only; rejects non-positive amounts.
121
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.minSellerAssets", target.minSellerAssets);
122
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
123
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minSellerAssets", target.minSellerAssets);
124
+ break;
106
125
  }
107
- if (target.maxUnits <= 0n) {
108
- throw new index_js_2.NonPositiveInputError("target.maxUnits", target.maxUnits);
109
- }
110
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
111
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxUnits", target.maxUnits);
112
- }
113
- else {
114
- if (target.units === viem_1.maxUint256) {
115
- throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
116
- }
117
- if (target.units <= 0n) {
118
- throw new index_js_2.NonPositiveInputError("target.units", target.units);
119
- }
120
- if (target.minSellerAssets <= 0n) {
121
- throw new index_js_2.NonPositiveInputError("target.minSellerAssets", target.minSellerAssets);
122
- }
123
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
124
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minSellerAssets", target.minSellerAssets);
125
126
  }
126
127
  if (params.deadline === viem_1.maxUint256) {
127
128
  throw new index_js_2.UnboundedMidnightTakeInputError("deadline");
@@ -11,6 +11,7 @@ const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAcco
11
11
  const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBounds.js");
12
12
  const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
13
13
  const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
14
+ const validatePositiveInput_js_1 = require("../../helpers/validatePositiveInput.js");
14
15
  const validateTakeableOffers_js_1 = require("../../helpers/validateTakeableOffers.js");
15
16
  const index_js_2 = require("../../types/index.js");
16
17
  /**
@@ -87,31 +88,31 @@ const midnightTakeLend = (params) => {
87
88
  });
88
89
  (0, validateMidnightBounds_js_1.validateMidnightTakeableOfferBounds)(params.takeableOffers);
89
90
  const { target } = params;
90
- if (target.type === "assets") {
91
- if (target.assets <= 0n) {
92
- throw new index_js_2.NonPositiveInputError("target.assets", target.assets);
91
+ switch (target.type) {
92
+ case "assets": {
93
+ // Validation only; rejects non-positive amounts.
94
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.assets", target.assets);
95
+ // Validation only; rejects non-positive amounts.
96
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.minUnits", target.minUnits);
97
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
98
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minUnits", target.minUnits);
99
+ break;
93
100
  }
94
- if (target.minUnits <= 0n) {
95
- throw new index_js_2.NonPositiveInputError("target.minUnits", target.minUnits);
101
+ default: {
102
+ if (target.units === viem_1.maxUint256) {
103
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
104
+ }
105
+ if (target.maxBuyerAssets === viem_1.maxUint256) {
106
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.maxBuyerAssets");
107
+ }
108
+ // Validation only; rejects non-positive amounts.
109
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.units", target.units);
110
+ // Validation only; rejects non-positive amounts.
111
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.maxBuyerAssets", target.maxBuyerAssets);
112
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
113
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxBuyerAssets", target.maxBuyerAssets);
114
+ break;
96
115
  }
97
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
98
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minUnits", target.minUnits);
99
- }
100
- else {
101
- if (target.units === viem_1.maxUint256) {
102
- throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
103
- }
104
- if (target.maxBuyerAssets === viem_1.maxUint256) {
105
- throw new index_js_2.UnboundedMidnightTakeInputError("target.maxBuyerAssets");
106
- }
107
- if (target.units <= 0n) {
108
- throw new index_js_2.NonPositiveInputError("target.units", target.units);
109
- }
110
- if (target.maxBuyerAssets <= 0n) {
111
- throw new index_js_2.NonPositiveInputError("target.maxBuyerAssets", target.maxBuyerAssets);
112
- }
113
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
114
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxBuyerAssets", target.maxBuyerAssets);
115
116
  }
116
117
  (0, validate_js_1.validateUint256Field)("maxContinuousFee", params.maxContinuousFee);
117
118
  if (params.deadline === viem_1.maxUint256) {
@@ -11,6 +11,7 @@ const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAcco
11
11
  const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBounds.js");
12
12
  const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
13
13
  const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
14
+ const validatePositiveInput_js_1 = require("../../helpers/validatePositiveInput.js");
14
15
  const validateTakeableOffers_js_1 = require("../../helpers/validateTakeableOffers.js");
15
16
  const index_js_2 = require("../../types/index.js");
16
17
  /**
@@ -103,9 +104,8 @@ const midnightTakeRepayWithdrawCollateral = (params) => {
103
104
  // Reject markets from another chain deployment before checking offers against them.
104
105
  (0, validateMidnightMarket_js_1.validateMidnightMarket)({ market: params.market, chainId: params.chainId });
105
106
  for (const [index, { collateralIndex, assets },] of params.collateralWithdrawals.entries()) {
106
- if (assets <= 0n) {
107
- throw new index_js_2.NonPositiveInputError(`collateralWithdrawals[${index}].assets`, assets);
108
- }
107
+ // Validation only; rejects non-positive amounts.
108
+ (0, validatePositiveInput_js_1.validatePositiveInput)(`collateralWithdrawals[${index}].assets`, assets);
109
109
  if (assets !== viem_1.maxUint256) {
110
110
  (0, validateMidnightBounds_js_1.validateMidnightUint128Field)(`collateralWithdrawals[${index}].assets`, assets);
111
111
  }
@@ -129,24 +129,25 @@ const midnightTakeRepayWithdrawCollateral = (params) => {
129
129
  });
130
130
  (0, validateMidnightBounds_js_1.validateMidnightTakeableOfferBounds)(params.takeableOffers);
131
131
  const { target } = params;
132
- if (target.type === "assets") {
133
- if (target.minUnits <= 0n) {
134
- throw new index_js_2.NonPositiveInputError("target.minUnits", target.minUnits);
135
- }
136
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
137
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minUnits", target.minUnits);
138
- }
139
- else {
140
- if (target.units <= 0n) {
141
- throw new index_js_2.NonPositiveInputError("target.units", target.units);
142
- }
143
- if (target.maxBuyerAssets <= 0n) {
144
- throw new index_js_2.NonPositiveInputError("target.maxBuyerAssets", target.maxBuyerAssets);
132
+ switch (target.type) {
133
+ case "assets": {
134
+ // Validation only; rejects non-positive amounts.
135
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.minUnits", target.minUnits);
136
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
137
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minUnits", target.minUnits);
138
+ break;
145
139
  }
146
- if (target.units !== viem_1.maxUint256) {
147
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
140
+ default: {
141
+ // Validation only; rejects non-positive amounts.
142
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.units", target.units);
143
+ // Validation only; rejects non-positive amounts.
144
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.maxBuyerAssets", target.maxBuyerAssets);
145
+ if (target.units !== viem_1.maxUint256) {
146
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
147
+ }
148
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxBuyerAssets", target.maxBuyerAssets);
149
+ break;
148
150
  }
149
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxBuyerAssets", target.maxBuyerAssets);
150
151
  }
151
152
  (0, validate_js_1.validateUint256Field)("maxContinuousFee", params.maxContinuousFee);
152
153
  if (params.deadline === viem_1.maxUint256) {
@@ -12,6 +12,7 @@ const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBound
12
12
  const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
13
13
  const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
14
14
  const validateMidnightTakeFeasibility_js_1 = require("../../helpers/validateMidnightTakeFeasibility.js");
15
+ const validatePositiveInput_js_1 = require("../../helpers/validatePositiveInput.js");
15
16
  const validateTakeableOffers_js_1 = require("../../helpers/validateTakeableOffers.js");
16
17
  const index_js_2 = require("../../types/index.js");
17
18
  const validateParams = (params) => {
@@ -32,31 +33,31 @@ const validateParams = (params) => {
32
33
  receiver: params.receiver,
33
34
  });
34
35
  const { target } = params;
35
- if (target.type === "assets") {
36
- if (target.assets <= 0n) {
37
- throw new index_js_2.NonPositiveInputError("target.assets", target.assets);
36
+ switch (target.type) {
37
+ case "assets": {
38
+ // Validation only; rejects non-positive amounts.
39
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.assets", target.assets);
40
+ if (target.maxUnits === viem_1.maxUint256) {
41
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.maxUnits");
42
+ }
43
+ // Validation only; rejects non-positive amounts.
44
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.maxUnits", target.maxUnits);
45
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
46
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxUnits", target.maxUnits);
47
+ break;
38
48
  }
39
- if (target.maxUnits === viem_1.maxUint256) {
40
- throw new index_js_2.UnboundedMidnightTakeInputError("target.maxUnits");
49
+ default: {
50
+ if (target.units === viem_1.maxUint256) {
51
+ throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
52
+ }
53
+ // Validation only; rejects non-positive amounts.
54
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.units", target.units);
55
+ // Validation only; rejects non-positive amounts.
56
+ (0, validatePositiveInput_js_1.validatePositiveInput)("target.minSellerAssets", target.minSellerAssets);
57
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
58
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minSellerAssets", target.minSellerAssets);
59
+ break;
41
60
  }
42
- if (target.maxUnits <= 0n) {
43
- throw new index_js_2.NonPositiveInputError("target.maxUnits", target.maxUnits);
44
- }
45
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.assets", target.assets);
46
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.maxUnits", target.maxUnits);
47
- }
48
- else {
49
- if (target.units === viem_1.maxUint256) {
50
- throw new index_js_2.UnboundedMidnightTakeInputError("target.units");
51
- }
52
- if (target.units <= 0n) {
53
- throw new index_js_2.NonPositiveInputError("target.units", target.units);
54
- }
55
- if (target.minSellerAssets <= 0n) {
56
- throw new index_js_2.NonPositiveInputError("target.minSellerAssets", target.minSellerAssets);
57
- }
58
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.units", target.units);
59
- (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("target.minSellerAssets", target.minSellerAssets);
60
61
  }
61
62
  if (params.deadline === viem_1.maxUint256) {
62
63
  throw new index_js_2.UnboundedMidnightTakeInputError("deadline");
@@ -0,0 +1,44 @@
1
+ import { type MarketInput } from "@morpho-org/midnight-sdk";
2
+ import { type Address } from "viem";
3
+ import { type Metadata, type MidnightCollateralTransfer, type MidnightWithdrawCollateralBatchAction, type Transaction } from "../../types/index.js";
4
+ /** Parameters for an atomic direct Midnight collateral withdrawal batch. */
5
+ export interface MidnightWithdrawCollateralBatchParams {
6
+ readonly chainId: number;
7
+ readonly market: MarketInput;
8
+ readonly collateralWithdrawals: readonly MidnightCollateralTransfer[];
9
+ readonly onBehalf: Address;
10
+ readonly receiver: Address;
11
+ readonly metadata?: Metadata;
12
+ }
13
+ /**
14
+ * Encodes ordered collateral withdrawals in one Midnight multicall, even for one entry.
15
+ * Duplicates are rejected: pass one entry per index, unlike bundle flows which sum them.
16
+ *
17
+ * @param params - Market, ordered withdrawals, owner, shared receiver and optional metadata.
18
+ * @param params.chainId - Chain containing Midnight.
19
+ * @param params.market - Market holding collateral.
20
+ * @param params.collateralWithdrawals - Nonempty ordered withdrawals, with unique collateral indexes.
21
+ * @param params.onBehalf - Collateral owner; this account or an authorized operator must send the transaction.
22
+ * @param params.receiver - Shared recipient of all withdrawn collateral.
23
+ * @param params.metadata - Optional analytics metadata appended to calldata.
24
+ * @returns A deep-frozen transaction targeting Midnight.
25
+ * @throws {EmptyMidnightCollateralWithdrawalsError} when the list is empty.
26
+ * @throws {DuplicateMidnightCollateralIndexError} when an index repeats.
27
+ * @throws {MidnightZeroReceiverError} when receiver is zero.
28
+ * @throws {MidnightContractReceiverError} when receiver cannot safely receive collateral.
29
+ * @throws {NonPositiveInputError} when assets are not positive.
30
+ * @throws {InputExceedsMaxError} when assets exceed uint128.
31
+ * @throws {MidnightZeroOnBehalfError} when onBehalf is zero.
32
+ * @throws {ChainIdMismatchError} when the market targets another chain.
33
+ * @throws {MidnightMarketAddressMismatchError} when the deployment differs.
34
+ * @throws {UnknownCollateralIndexError} when an index is not configured.
35
+ * @throws {MidnightCalldataEncodingError} when an address or ABI input is malformed.
36
+ * @example
37
+ * ```ts
38
+ * const tx = midnightWithdrawCollateralBatch({
39
+ * chainId: 8453, market: marketData.params, onBehalf: user, receiver: user,
40
+ * collateralWithdrawals: [{ collateralIndex: 0n, assets: 100n }],
41
+ * });
42
+ * ```
43
+ */
44
+ export declare const midnightWithdrawCollateralBatch: (params: MidnightWithdrawCollateralBatchParams) => Readonly<Transaction<MidnightWithdrawCollateralBatchAction>>;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.midnightWithdrawCollateralBatch = void 0;
4
+ const midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ const morpho_ts_1 = require("@morpho-org/morpho-ts");
6
+ const viem_1 = require("viem");
7
+ const encodeMidnightCalldata_js_1 = require("../../helpers/encodeMidnightCalldata.js");
8
+ const index_js_1 = require("../../helpers/index.js");
9
+ const validateMidnightAccount_js_1 = require("../../helpers/validateMidnightAccount.js");
10
+ const validateMidnightBounds_js_1 = require("../../helpers/validateMidnightBounds.js");
11
+ const validateMidnightCollateralBatch_js_1 = require("../../helpers/validateMidnightCollateralBatch.js");
12
+ const validateMidnightMarket_js_1 = require("../../helpers/validateMidnightMarket.js");
13
+ const validateMidnightReceiver_js_1 = require("../../helpers/validateMidnightReceiver.js");
14
+ const index_js_2 = require("../../types/index.js");
15
+ /**
16
+ * Encodes ordered collateral withdrawals in one Midnight multicall, even for one entry.
17
+ * Duplicates are rejected: pass one entry per index, unlike bundle flows which sum them.
18
+ *
19
+ * @param params - Market, ordered withdrawals, owner, shared receiver and optional metadata.
20
+ * @param params.chainId - Chain containing Midnight.
21
+ * @param params.market - Market holding collateral.
22
+ * @param params.collateralWithdrawals - Nonempty ordered withdrawals, with unique collateral indexes.
23
+ * @param params.onBehalf - Collateral owner; this account or an authorized operator must send the transaction.
24
+ * @param params.receiver - Shared recipient of all withdrawn collateral.
25
+ * @param params.metadata - Optional analytics metadata appended to calldata.
26
+ * @returns A deep-frozen transaction targeting Midnight.
27
+ * @throws {EmptyMidnightCollateralWithdrawalsError} when the list is empty.
28
+ * @throws {DuplicateMidnightCollateralIndexError} when an index repeats.
29
+ * @throws {MidnightZeroReceiverError} when receiver is zero.
30
+ * @throws {MidnightContractReceiverError} when receiver cannot safely receive collateral.
31
+ * @throws {NonPositiveInputError} when assets are not positive.
32
+ * @throws {InputExceedsMaxError} when assets exceed uint128.
33
+ * @throws {MidnightZeroOnBehalfError} when onBehalf is zero.
34
+ * @throws {ChainIdMismatchError} when the market targets another chain.
35
+ * @throws {MidnightMarketAddressMismatchError} when the deployment differs.
36
+ * @throws {UnknownCollateralIndexError} when an index is not configured.
37
+ * @throws {MidnightCalldataEncodingError} when an address or ABI input is malformed.
38
+ * @example
39
+ * ```ts
40
+ * const tx = midnightWithdrawCollateralBatch({
41
+ * chainId: 8453, market: marketData.params, onBehalf: user, receiver: user,
42
+ * collateralWithdrawals: [{ collateralIndex: 0n, assets: 100n }],
43
+ * });
44
+ * ```
45
+ */
46
+ const midnightWithdrawCollateralBatch = (params) => {
47
+ // Reject malformed addresses before comparing with zero.
48
+ (0, validateMidnightAccount_js_1.validateMidnightAddress)("onBehalf", params.onBehalf);
49
+ if ((0, viem_1.isAddressEqual)(params.onBehalf, viem_1.zeroAddress)) {
50
+ throw new index_js_2.MidnightZeroOnBehalfError("onBehalf");
51
+ }
52
+ // Reject markets from another deployment before encoding.
53
+ (0, validateMidnightMarket_js_1.validateMidnightMarket)({ market: params.market, chainId: params.chainId });
54
+ (0, validateMidnightReceiver_js_1.validateMidnightReceiver)({
55
+ chainId: params.chainId,
56
+ market: params.market,
57
+ field: "receiver",
58
+ receiver: params.receiver,
59
+ });
60
+ // Direct batches require one entry per index rather than summing duplicates.
61
+ (0, validateMidnightCollateralBatch_js_1.validateMidnightCollateralBatch)(params.collateralWithdrawals, new index_js_2.EmptyMidnightCollateralWithdrawalsError());
62
+ const calls = params.collateralWithdrawals.map(({ collateralIndex, assets }) => {
63
+ if (assets <= 0n)
64
+ throw new index_js_2.NonPositiveInputError("assets", assets);
65
+ (0, validateMidnightBounds_js_1.validateMidnightUint128Field)("assets", assets);
66
+ // Reject indexes not configured on the market.
67
+ midnight_sdk_1.MarketUtils.getCollateralByIndex(params.market, collateralIndex);
68
+ return (0, encodeMidnightCalldata_js_1.encodeMidnightCalldata)({
69
+ abi: midnight_sdk_1.midnightAbi,
70
+ functionName: "withdrawCollateral",
71
+ args: [
72
+ midnight_sdk_1.MarketUtils.toStruct(params.market),
73
+ collateralIndex,
74
+ assets,
75
+ params.onBehalf,
76
+ params.receiver,
77
+ ],
78
+ });
79
+ });
80
+ let tx = {
81
+ to: (0, morpho_ts_1.getChainAddress)(params.chainId, "midnight"),
82
+ value: 0n,
83
+ data: (0, encodeMidnightCalldata_js_1.encodeMidnightCalldata)({
84
+ abi: midnight_sdk_1.midnightAbi,
85
+ functionName: "multicall",
86
+ args: [calls],
87
+ }),
88
+ };
89
+ if (params.metadata)
90
+ tx = (0, index_js_1.addTransactionMetadata)(tx, params.metadata);
91
+ return (0, morpho_ts_1.deepFreeze)({
92
+ ...tx,
93
+ action: {
94
+ type: "midnightWithdrawCollateralBatch",
95
+ args: {
96
+ market: (0, encodeMidnightCalldata_js_1.encodeMidnightMarketId)(params.market),
97
+ collateralWithdrawals: params.collateralWithdrawals.map(({ collateralIndex, assets }) => ({ collateralIndex, assets })),
98
+ onBehalf: params.onBehalf,
99
+ receiver: params.receiver,
100
+ },
101
+ },
102
+ });
103
+ };
104
+ exports.midnightWithdrawCollateralBatch = midnightWithdrawCollateralBatch;
@@ -55,6 +55,7 @@ interface EncodeBlueSignatureAuthorizationParams {
55
55
  * @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
56
56
  * client account differs from `userAddress`.
57
57
  * @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
58
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
58
59
  * @example
59
60
  * ```ts
60
61
  * import { createWalletClient, http } from "viem";
@@ -44,6 +44,7 @@ const index_js_1 = require("../../../types/index.js");
44
44
  * @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
45
45
  * client account differs from `userAddress`.
46
46
  * @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
47
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
47
48
  * @example
48
49
  * ```ts
49
50
  * import { createWalletClient, http } from "viem";
@@ -62,6 +62,7 @@ interface EncodeErc20PermitParams {
62
62
  * @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
63
63
  * client account differs from `userAddress`.
64
64
  * @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
65
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
65
66
  * @example
66
67
  * ```ts
67
68
  * import { createWalletClient, http } from "viem";
@@ -55,6 +55,7 @@ const validateClientChainId_js_1 = require("../validateClientChainId.js");
55
55
  * @throws {AddressMismatchError} from `sign()` when `userAddress` differs from `owner`, or when the
56
56
  * client account differs from `userAddress`.
57
57
  * @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
58
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
58
59
  * @example
59
60
  * ```ts
60
61
  * import { createWalletClient, http } from "viem";
@@ -48,6 +48,7 @@ export interface EncodeErc20Permit2SignatureTransferParams {
48
48
  * @throws {AddressMismatchError} from `sign()` when the wallet account differs from `userAddress`.
49
49
  * @throws {ChainIdMismatchError} from `sign()` when the wallet chain differs from `chainId`.
50
50
  * @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
51
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
51
52
  * @example
52
53
  * ```ts
53
54
  * import { addressesRegistry } from "@morpho-org/blue-sdk";
@@ -36,6 +36,7 @@ const index_js_1 = require("../../../types/index.js");
36
36
  * @throws {AddressMismatchError} from `sign()` when the wallet account differs from `userAddress`.
37
37
  * @throws {ChainIdMismatchError} from `sign()` when the wallet chain differs from `chainId`.
38
38
  * @throws {InvalidSignatureError} from `sign()` when EIP-712 verification fails.
39
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
39
40
  * @example
40
41
  * ```ts
41
42
  * import { addressesRegistry } from "@morpho-org/blue-sdk";
@@ -46,6 +46,7 @@ export interface EncodeVaultSharesPermitParams {
46
46
  * wallet account differs from `userAddress`.
47
47
  * @throws {ChainIdMismatchError} from `sign()` when the wallet targets another chain.
48
48
  * @throws {InvalidSignatureError} from `sign()` when signature recovery fails.
49
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
49
50
  * @throws {InvalidPermitDomainChainIdError} when a Vault V1 permit domain targets another chain or omits `chainId`.
50
51
  * @throws {InvalidPermitDomainVerifyingContractError} when a Vault V1 permit domain targets another token or omits `verifyingContract`.
51
52
  * @throws {UnsupportedPermitDomainExtensionsError} when a Vault V1 permit domain advertises unsupported extensions.
@@ -36,6 +36,7 @@ const index_js_1 = require("../../../types/index.js");
36
36
  * wallet account differs from `userAddress`.
37
37
  * @throws {ChainIdMismatchError} from `sign()` when the wallet targets another chain.
38
38
  * @throws {InvalidSignatureError} from `sign()` when signature recovery fails.
39
+ * @throws {MalformedSignatureError} from `sign()` when the wallet returns a malformed signature.
39
40
  * @throws {InvalidPermitDomainChainIdError} when a Vault V1 permit domain targets another chain or omits `chainId`.
40
41
  * @throws {InvalidPermitDomainVerifyingContractError} when a Vault V1 permit domain targets another token or omits `verifyingContract`.
41
42
  * @throws {UnsupportedPermitDomainExtensionsError} when a Vault V1 permit domain advertises unsupported extensions.
@@ -5,6 +5,7 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
5
5
  const viem_1 = require("viem");
6
6
  const abis_js_1 = require("../../abis.js");
7
7
  const validate_js_1 = require("../../helpers/validate.js");
8
+ const validatePositiveInput_js_1 = require("../../helpers/validatePositiveInput.js");
8
9
  const index_js_1 = require("../../types/index.js");
9
10
  const common_js_1 = require("../bundles/common.js");
10
11
  /**
@@ -89,14 +90,13 @@ const vaultV1MigrateToV2 = (params) => {
89
90
  throw new index_js_1.AmountAndSharesExclusiveError();
90
91
  }
91
92
  const selectedAmount = assets ?? shares ?? 0n;
92
- if (selectedAmount <= 0n) {
93
- throw new index_js_1.NonPositiveInputError(assets != null ? "assets" : "shares", selectedAmount);
94
- }
95
- if (params.args.maxSharePriceVaultV2 <= 0n) {
96
- throw new index_js_1.NonPositiveInputError("maxSharePriceVaultV2", params.args.maxSharePriceVaultV2);
97
- }
93
+ const amountField = assets != null ? "assets" : "shares";
94
+ // Validation only; rejects non-positive migration amounts.
95
+ (0, validatePositiveInput_js_1.validatePositiveInput)(amountField, selectedAmount);
96
+ // Validation only; rejects non-positive share-price bounds.
97
+ (0, validatePositiveInput_js_1.validatePositiveInput)("maxSharePriceVaultV2", params.args.maxSharePriceVaultV2);
98
98
  // Reject ABI overflow with SDK errors before calldata encoding.
99
- (0, validate_js_1.validateUint256Field)(assets != null ? "assets" : "shares", selectedAmount);
99
+ (0, validate_js_1.validateUint256Field)(amountField, selectedAmount);
100
100
  (0, validate_js_1.validateUint256Field)("maxSharePriceVaultV2", params.args.maxSharePriceVaultV2);
101
101
  const common = (0, common_js_1.normalizeBundlesCommonParams)(params.args);
102
102
  const spender = (0, morpho_ts_1.getChainAddress)(params.vault.chainId, "bundles.vaultBundlesV1");
@@ -12,7 +12,7 @@ export type { AnyTree as MidnightAnyTree, AnyTreeSnapshot as MidnightAnyTreeSnap
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";
15
- export type { GetOffersDataParams as MidnightGetOffersDataParams, GetPositionDataParams as MidnightGetPositionDataParams, MakeLendParams as MidnightMakeLendParams, MakeOffersOutput as MidnightMakeOffersOutput, MakeOffersParams as MidnightMakeOffersParams, MarketActionParams as MidnightMarketActionParams, MidnightMakerTreeInput, MidnightPositionHealthParams, OffersData as MidnightOffersData, OfferValidationParams as MidnightOfferValidationParams, RedeemParams as MidnightRedeemParams, RepayWithdrawCollateralParams as MidnightRepayWithdrawCollateralParams, SupplyBlueMakeLendParams as MidnightSupplyBlueMakeLendParams, SupplyCollateralMakeBorrowParams as MidnightSupplyCollateralMakeBorrowParams, SupplyCollateralParams as MidnightSupplyCollateralParams, SupplyCollateralTakeBorrowParams as MidnightSupplyCollateralTakeBorrowParams, TakeBorrowParams as MidnightTakeBorrowParams, TakeLendParams as MidnightTakeLendParams, TakeRepayWithdrawCollateralParams as MidnightTakeRepayWithdrawCollateralParams, TakeWithdrawParams as MidnightTakeWithdrawParams, WithdrawCollateralParams as MidnightWithdrawCollateralParams, } from "./midnight/index.js";
15
+ export type { GetOffersDataParams as MidnightGetOffersDataParams, GetPositionDataParams as MidnightGetPositionDataParams, MakeLendParams as MidnightMakeLendParams, MakeOffersOutput as MidnightMakeOffersOutput, MakeOffersParams as MidnightMakeOffersParams, MarketActionParams as MidnightMarketActionParams, MidnightMakerTreeInput, MidnightPositionHealthParams, OffersData as MidnightOffersData, OfferValidationParams as MidnightOfferValidationParams, RedeemParams as MidnightRedeemParams, RepayWithdrawCollateralParams as MidnightRepayWithdrawCollateralParams, SupplyBlueMakeLendParams as MidnightSupplyBlueMakeLendParams, SupplyCollateralBatchParams as MidnightSupplyCollateralBatchParams, SupplyCollateralMakeBorrowParams as MidnightSupplyCollateralMakeBorrowParams, SupplyCollateralParams as MidnightSupplyCollateralParams, SupplyCollateralTakeBorrowParams as MidnightSupplyCollateralTakeBorrowParams, TakeBorrowParams as MidnightTakeBorrowParams, TakeLendParams as MidnightTakeLendParams, TakeRepayWithdrawCollateralParams as MidnightTakeRepayWithdrawCollateralParams, TakeWithdrawParams as MidnightTakeWithdrawParams, WithdrawCollateralBatchParams as MidnightWithdrawCollateralBatchParams, WithdrawCollateralParams as MidnightWithdrawCollateralParams, } from "./midnight/index.js";
16
16
  export { type MidnightActionOutput, type MidnightActions, type MidnightRequirementsParams, MorphoMidnight, } from "./midnight/index.js";
17
17
  export * from "./requirements/index.js";
18
18
  export { MorphoVaultV1 } from "./vaultV1/index.js";