@morpho-org/morpho-sdk 5.5.0 → 5.7.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 (168) hide show
  1. package/README.md +11 -7
  2. package/lib/cjs/abis.d.ts +15 -3
  3. package/lib/cjs/abis.js +15 -1
  4. package/lib/cjs/actions/blue/borrow.d.ts +21 -15
  5. package/lib/cjs/actions/blue/borrow.js +25 -18
  6. package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +1 -1
  7. package/lib/cjs/actions/blue/buildAssetFundingActions.js +1 -1
  8. package/lib/cjs/actions/blue/buildReallocationActions.d.ts +62 -19
  9. package/lib/cjs/actions/blue/buildReallocationActions.js +123 -27
  10. package/lib/cjs/actions/blue/refinance.d.ts +14 -7
  11. package/lib/cjs/actions/blue/refinance.js +18 -10
  12. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +28 -19
  13. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +39 -23
  14. package/lib/cjs/actions/blue/withdraw.d.ts +20 -13
  15. package/lib/cjs/actions/blue/withdraw.js +23 -18
  16. package/lib/cjs/actions/midnight/mempoolSubmitOffers.d.ts +2 -2
  17. package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +2 -2
  18. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
  19. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
  20. package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -1
  21. package/lib/cjs/blue/abis.d.ts +2 -0
  22. package/lib/cjs/blue/abis.js +33 -0
  23. package/lib/cjs/blue/addresses.d.ts +2 -0
  24. package/lib/cjs/blue/addresses.js +19 -0
  25. package/lib/cjs/blue/constants.d.ts +1 -0
  26. package/lib/cjs/blue/constants.js +13 -0
  27. package/lib/cjs/blue/entities.d.ts +2 -0
  28. package/lib/cjs/blue/entities.js +37 -0
  29. package/lib/cjs/blue/errors.d.ts +2 -0
  30. package/lib/cjs/blue/errors.js +29 -0
  31. package/lib/cjs/blue/fetch.d.ts +1 -0
  32. package/lib/cjs/blue/fetch.js +33 -0
  33. package/lib/cjs/blue/types.d.ts +2 -0
  34. package/lib/cjs/blue/types.js +2 -0
  35. package/lib/cjs/blue/utils.d.ts +3 -0
  36. package/lib/cjs/blue/utils.js +29 -0
  37. package/lib/cjs/bundler/actions.d.ts +122 -3
  38. package/lib/cjs/bundler/actions.js +216 -7
  39. package/lib/cjs/bundler/types.d.ts +20 -0
  40. package/lib/cjs/constants.d.ts +37 -3
  41. package/lib/cjs/constants.js +41 -1
  42. package/lib/cjs/entities/blue/blue.d.ts +362 -71
  43. package/lib/cjs/entities/blue/blue.js +286 -52
  44. package/lib/cjs/entities/index.d.ts +64 -4
  45. package/lib/cjs/entities/index.js +37 -22
  46. package/lib/cjs/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
  47. package/lib/cjs/entities/{reallocationData.js → vaultV1ReallocationData.js} +29 -16
  48. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +1 -1
  49. package/lib/cjs/entities/vaultV2/vaultV2.js +1 -1
  50. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +511 -0
  51. package/lib/cjs/entities/vaultV2BlueReallocationData.js +1300 -0
  52. package/lib/cjs/errors.d.ts +48 -3
  53. package/lib/cjs/errors.js +62 -1
  54. package/lib/cjs/fetch.d.ts +16 -1
  55. package/lib/cjs/fetch.js +24 -1
  56. package/lib/{esm/helpers/computeReallocations.d.ts → cjs/helpers/computeVaultV1Reallocations.d.ts} +14 -8
  57. package/lib/cjs/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +27 -13
  58. package/lib/cjs/helpers/constant.d.ts +5 -3
  59. package/lib/cjs/helpers/constant.js +6 -4
  60. package/lib/cjs/helpers/index.d.ts +2 -2
  61. package/lib/cjs/helpers/index.js +6 -3
  62. package/lib/cjs/helpers/validate.d.ts +32 -16
  63. package/lib/cjs/helpers/validate.js +142 -29
  64. package/lib/cjs/midnight/abis.d.ts +1 -0
  65. package/lib/cjs/midnight/abis.js +8 -0
  66. package/lib/cjs/midnight/constants.d.ts +1 -0
  67. package/lib/cjs/midnight/constants.js +19 -0
  68. package/lib/cjs/midnight/entities.d.ts +2 -0
  69. package/lib/cjs/midnight/entities.js +11 -0
  70. package/lib/cjs/midnight/errors.d.ts +1 -0
  71. package/lib/cjs/midnight/errors.js +24 -0
  72. package/lib/cjs/midnight/fetch.d.ts +1 -0
  73. package/lib/cjs/midnight/fetch.js +9 -0
  74. package/lib/cjs/midnight/types.d.ts +1 -0
  75. package/lib/cjs/midnight/types.js +2 -0
  76. package/lib/cjs/midnight/utils.d.ts +1 -0
  77. package/lib/cjs/midnight/utils.js +17 -0
  78. package/lib/cjs/types/action.d.ts +12 -0
  79. package/lib/cjs/types/error.d.ts +224 -5
  80. package/lib/cjs/types/error.js +269 -7
  81. package/lib/cjs/types/sharedLiquidity.d.ts +72 -8
  82. package/lib/cjs/types.d.ts +17 -2
  83. package/lib/cjs/utils.d.ts +31 -4
  84. package/lib/cjs/utils.js +44 -4
  85. package/lib/esm/abis.d.ts +15 -3
  86. package/lib/esm/abis.js +15 -3
  87. package/lib/esm/actions/blue/borrow.d.ts +21 -15
  88. package/lib/esm/actions/blue/borrow.js +26 -19
  89. package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +1 -1
  90. package/lib/esm/actions/blue/buildAssetFundingActions.js +1 -1
  91. package/lib/esm/actions/blue/buildReallocationActions.d.ts +62 -19
  92. package/lib/esm/actions/blue/buildReallocationActions.js +119 -25
  93. package/lib/esm/actions/blue/refinance.d.ts +14 -7
  94. package/lib/esm/actions/blue/refinance.js +19 -11
  95. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +28 -19
  96. package/lib/esm/actions/blue/supplyCollateralBorrow.js +40 -24
  97. package/lib/esm/actions/blue/withdraw.d.ts +20 -13
  98. package/lib/esm/actions/blue/withdraw.js +24 -19
  99. package/lib/esm/actions/midnight/mempoolSubmitOffers.d.ts +2 -2
  100. package/lib/esm/actions/midnight/mempoolSubmitOffers.js +2 -2
  101. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
  102. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
  103. package/lib/esm/actions/requirements/getRequirementsApproval.js +2 -1
  104. package/lib/esm/blue/abis.d.ts +2 -0
  105. package/lib/esm/blue/abis.js +2 -0
  106. package/lib/esm/blue/addresses.d.ts +2 -0
  107. package/lib/esm/blue/addresses.js +1 -0
  108. package/lib/esm/blue/constants.d.ts +1 -0
  109. package/lib/esm/blue/constants.js +1 -0
  110. package/lib/esm/blue/entities.d.ts +2 -0
  111. package/lib/esm/blue/entities.js +1 -0
  112. package/lib/esm/blue/errors.d.ts +2 -0
  113. package/lib/esm/blue/errors.js +2 -0
  114. package/lib/esm/blue/fetch.d.ts +1 -0
  115. package/lib/esm/blue/fetch.js +1 -0
  116. package/lib/esm/blue/types.d.ts +2 -0
  117. package/lib/esm/blue/types.js +1 -0
  118. package/lib/esm/blue/utils.d.ts +3 -0
  119. package/lib/esm/blue/utils.js +2 -0
  120. package/lib/esm/bundler/actions.d.ts +122 -3
  121. package/lib/esm/bundler/actions.js +219 -10
  122. package/lib/esm/bundler/types.d.ts +20 -0
  123. package/lib/esm/constants.d.ts +37 -3
  124. package/lib/esm/constants.js +37 -3
  125. package/lib/esm/entities/blue/blue.d.ts +362 -71
  126. package/lib/esm/entities/blue/blue.js +289 -55
  127. package/lib/esm/entities/index.d.ts +64 -4
  128. package/lib/esm/entities/index.js +19 -3
  129. package/lib/esm/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
  130. package/lib/esm/entities/{reallocationData.js → vaultV1ReallocationData.js} +32 -14
  131. package/lib/esm/entities/vaultV2/vaultV2.d.ts +1 -1
  132. package/lib/esm/entities/vaultV2/vaultV2.js +1 -1
  133. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +511 -0
  134. package/lib/esm/entities/vaultV2BlueReallocationData.js +1296 -0
  135. package/lib/esm/errors.d.ts +48 -3
  136. package/lib/esm/errors.js +48 -3
  137. package/lib/esm/fetch.d.ts +16 -1
  138. package/lib/esm/fetch.js +16 -1
  139. package/lib/{cjs/helpers/computeReallocations.d.ts → esm/helpers/computeVaultV1Reallocations.d.ts} +14 -8
  140. package/lib/esm/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +25 -11
  141. package/lib/esm/helpers/constant.d.ts +5 -3
  142. package/lib/esm/helpers/constant.js +5 -3
  143. package/lib/esm/helpers/index.d.ts +2 -2
  144. package/lib/esm/helpers/index.js +2 -2
  145. package/lib/esm/helpers/validate.d.ts +32 -16
  146. package/lib/esm/helpers/validate.js +143 -32
  147. package/lib/esm/midnight/abis.d.ts +1 -0
  148. package/lib/esm/midnight/abis.js +1 -0
  149. package/lib/esm/midnight/constants.d.ts +1 -0
  150. package/lib/esm/midnight/constants.js +1 -0
  151. package/lib/esm/midnight/entities.d.ts +2 -0
  152. package/lib/esm/midnight/entities.js +1 -0
  153. package/lib/esm/midnight/errors.d.ts +1 -0
  154. package/lib/esm/midnight/errors.js +1 -0
  155. package/lib/esm/midnight/fetch.d.ts +1 -0
  156. package/lib/esm/midnight/fetch.js +1 -0
  157. package/lib/esm/midnight/types.d.ts +1 -0
  158. package/lib/esm/midnight/types.js +1 -0
  159. package/lib/esm/midnight/utils.d.ts +1 -0
  160. package/lib/esm/midnight/utils.js +1 -0
  161. package/lib/esm/types/action.d.ts +12 -0
  162. package/lib/esm/types/error.d.ts +224 -5
  163. package/lib/esm/types/error.js +253 -4
  164. package/lib/esm/types/sharedLiquidity.d.ts +72 -8
  165. package/lib/esm/types.d.ts +17 -2
  166. package/lib/esm/utils.d.ts +31 -4
  167. package/lib/esm/utils.js +31 -4
  168. package/package.json +23 -7
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateWithdrawShares = exports.validateWithdrawAmount = exports.validateSlippageTolerance = exports.validateReallocations = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validateNativeAsset = exports.validateChainId = exports.validatePositionHealth = exports.validateAccrualPosition = exports.validateMidnightMarketChainId = exports.compareMarketIds = void 0;
3
+ exports.validateWithdrawShares = exports.validateWithdrawAmount = exports.validateSlippageTolerance = exports.validateAndNormalizeReallocations = exports.validateVaultV2BlueReallocations = exports.validateReallocations = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validateNativeAsset = exports.validateChainId = exports.validatePositionHealth = exports.validateAccrualPosition = exports.validateMidnightMarketChainId = exports.compareMarketIds = void 0;
4
4
  exports.validateUserAddress = validateUserAddress;
5
5
  const blue_sdk_1 = require("@morpho-org/blue-sdk");
6
6
  const morpho_ts_1 = require("@morpho-org/morpho-ts");
@@ -231,18 +231,10 @@ const validateRepayShares = (params) => {
231
231
  };
232
232
  exports.validateRepayShares = validateRepayShares;
233
233
  /**
234
- * Validates that vault reallocations are well-formed.
234
+ * Validates that Vault V1 PublicAllocator reallocations are well-formed.
235
235
  *
236
- * Enforces the following invariants for each {@link VaultReallocation}:
237
- * - `fee` must be non-negative.
238
- * - `withdrawals` must be non-empty.
239
- * - Every withdrawal `amount` must be strictly positive.
240
- * - No withdrawal may target `targetMarketId` (the operation's target market — the market being
241
- * borrowed from for `borrow`, or being withdrawn from for `withdraw`).
242
- * - Withdrawal market IDs must be strictly ascending (required by `PublicAllocator.reallocateTo`).
243
- *
244
- * @param reallocations - The reallocations to validate.
245
- * @param targetMarketId - The ID of the operation's target market. No withdrawal may reference this market.
236
+ * @param reallocations - Vault V1 reallocations to validate.
237
+ * @param targetMarketId - The operation's target market ID.
246
238
  * @returns Nothing when every reallocation is valid.
247
239
  * @throws {NegativeInputError} when a reallocation fee is negative.
248
240
  * @throws {EmptyReallocationWithdrawalsError} when a reallocation has no withdrawals.
@@ -251,38 +243,159 @@ exports.validateRepayShares = validateRepayShares;
251
243
  * @throws {UnsortedReallocationWithdrawalsError} when withdrawals are not strictly market-id sorted.
252
244
  * @example
253
245
  * ```ts
254
- * import type { MarketId } from "@morpho-org/blue-sdk";
246
+ * import type { BlueMarketId } from "@morpho-org/morpho-sdk/types";
255
247
  * import { validateReallocations } from "@morpho-org/morpho-sdk";
256
248
  * import { zeroHash } from "viem";
257
249
  *
258
- * const result: void = validateReallocations([], zeroHash as MarketId);
250
+ * const result: void = validateReallocations([], zeroHash as BlueMarketId);
259
251
  * ```
260
252
  */
261
253
  const validateReallocations = (reallocations, targetMarketId) => {
262
- for (const r of reallocations) {
263
- if (r.fee < 0n) {
264
- throw new index_js_1.NegativeInputError("reallocation.fee", r.fee);
254
+ for (const reallocation of reallocations) {
255
+ if (reallocation.fee < 0n) {
256
+ throw new index_js_1.NegativeInputError("reallocation.fee", reallocation.fee);
265
257
  }
266
- if (r.withdrawals.length === 0) {
267
- throw new index_js_1.EmptyReallocationWithdrawalsError(r.vault);
258
+ if (reallocation.withdrawals.length === 0) {
259
+ throw new index_js_1.EmptyReallocationWithdrawalsError(reallocation.vault);
268
260
  }
269
- let prevId;
270
- for (const w of r.withdrawals) {
271
- if (w.amount <= 0n) {
272
- throw new index_js_1.NonPositiveInputError(`reallocation.withdrawals[${w.marketParams.id}].amount`, w.amount);
261
+ let previousMarketId;
262
+ for (const withdrawal of reallocation.withdrawals) {
263
+ if (withdrawal.amount <= 0n) {
264
+ throw new index_js_1.NonPositiveInputError(`reallocation.withdrawals[${withdrawal.marketParams.id}].amount`, withdrawal.amount);
273
265
  }
274
- if (w.marketParams.id === targetMarketId) {
275
- throw new index_js_1.ReallocationWithdrawalOnTargetMarketError(r.vault, w.marketParams.id);
266
+ if (withdrawal.marketParams.id === targetMarketId) {
267
+ throw new index_js_1.ReallocationWithdrawalOnTargetMarketError(reallocation.vault, withdrawal.marketParams.id);
276
268
  }
277
- if (prevId !== undefined &&
278
- (0, exports.compareMarketIds)(w.marketParams.id, prevId) <= 0) {
279
- throw new index_js_1.UnsortedReallocationWithdrawalsError(r.vault, w.marketParams.id);
269
+ if (previousMarketId !== undefined &&
270
+ (0, exports.compareMarketIds)(withdrawal.marketParams.id, previousMarketId) <= 0) {
271
+ throw new index_js_1.UnsortedReallocationWithdrawalsError(reallocation.vault, withdrawal.marketParams.id);
280
272
  }
281
- prevId = w.marketParams.id;
273
+ previousMarketId = withdrawal.marketParams.id;
282
274
  }
283
275
  }
284
276
  };
285
277
  exports.validateReallocations = validateReallocations;
278
+ /** @internal */
279
+ const validateVaultV2BlueReallocations = (reallocations, targetMarketId) => {
280
+ const penaltyByVault = new Map();
281
+ for (const reallocation of reallocations) {
282
+ if (typeof reallocation.vault !== "string" ||
283
+ !(0, viem_1.isAddress)(reallocation.vault)) {
284
+ throw new index_js_1.InvalidReallocationAddressError("vault");
285
+ }
286
+ if (reallocation.to == null ||
287
+ typeof reallocation.to.adapter !== "string" ||
288
+ !(0, viem_1.isAddress)(reallocation.to.adapter)) {
289
+ throw new index_js_1.InvalidReallocationAddressError("to.adapter");
290
+ }
291
+ const source = reallocation.from;
292
+ if (source == null) {
293
+ throw new index_js_1.InvalidReallocationSourceTypeError(undefined);
294
+ }
295
+ const sourceType = source.type;
296
+ if (sourceType !== "market" && sourceType !== "idle") {
297
+ throw new index_js_1.InvalidReallocationSourceTypeError(sourceType);
298
+ }
299
+ let sourceMarketId;
300
+ if (source.type === "market") {
301
+ if (typeof source.adapter !== "string" || !(0, viem_1.isAddress)(source.adapter)) {
302
+ throw new index_js_1.InvalidReallocationAddressError("from.adapter");
303
+ }
304
+ if (source.marketParams == null ||
305
+ !(0, viem_1.isAddress)(source.marketParams.loanToken) ||
306
+ !(0, viem_1.isAddress)(source.marketParams.collateralToken) ||
307
+ !(0, viem_1.isAddress)(source.marketParams.oracle) ||
308
+ !(0, viem_1.isAddress)(source.marketParams.irm) ||
309
+ typeof source.marketParams.lltv !== "bigint") {
310
+ throw new index_js_1.InvalidReallocationSourceTypeError("market", "marketParams");
311
+ }
312
+ sourceMarketId = blue_sdk_1.MarketUtils.getMarketId(source.marketParams);
313
+ }
314
+ if (reallocation.penalty < 0n) {
315
+ throw new index_js_1.NegativeInputError("reallocation.penalty", reallocation.penalty);
316
+ }
317
+ if (reallocation.penalty > constant_js_1.MAX_REALLOCATION_PENALTY) {
318
+ throw new index_js_1.InputExceedsMaxError({
319
+ field: "reallocation.penalty",
320
+ value: reallocation.penalty,
321
+ max: constant_js_1.MAX_REALLOCATION_PENALTY,
322
+ });
323
+ }
324
+ if (reallocation.assets <= 0n) {
325
+ throw new index_js_1.NonPositiveInputError("reallocation.assets", reallocation.assets);
326
+ }
327
+ if (reallocation.assets > viem_1.maxUint128) {
328
+ throw new index_js_1.InputExceedsMaxError({
329
+ field: "reallocation.assets",
330
+ value: reallocation.assets,
331
+ max: viem_1.maxUint128,
332
+ });
333
+ }
334
+ const penaltyKey = reallocation.vault.toLowerCase();
335
+ const expectedPenalty = penaltyByVault.get(penaltyKey);
336
+ if (expectedPenalty !== undefined &&
337
+ expectedPenalty !== reallocation.penalty) {
338
+ throw new index_js_1.InconsistentReallocationPenaltyError({
339
+ vault: reallocation.vault,
340
+ expected: expectedPenalty,
341
+ actual: reallocation.penalty,
342
+ });
343
+ }
344
+ penaltyByVault.set(penaltyKey, reallocation.penalty);
345
+ if (sourceMarketId !== undefined &&
346
+ (0, exports.compareMarketIds)(sourceMarketId, targetMarketId) === 0) {
347
+ throw new index_js_1.ReallocationWithdrawalOnTargetMarketError(reallocation.vault, sourceMarketId);
348
+ }
349
+ }
350
+ };
351
+ exports.validateVaultV2BlueReallocations = validateVaultV2BlueReallocations;
352
+ /**
353
+ * Validates and normalizes a homogeneous Blue reallocation plan.
354
+ *
355
+ * @param params - Validation parameters.
356
+ * @param params.reallocations - Optional Vault V1 or Vault V2 reallocation plan.
357
+ * @param params.targetMarketId - Morpho Blue market receiving the liquidity.
358
+ * @param params.chainId - Chain whose allocator deployment is required for a V2 plan.
359
+ * @returns The validated plan tagged with its allocator version.
360
+ * @throws {BundlerErrors.UnexpectedAction} when a V2 plan is unsupported on the chain.
361
+ * @internal
362
+ */
363
+ const validateAndNormalizeReallocations = ({ reallocations, targetMarketId, chainId, }) => {
364
+ const vaultV1Reallocations = [];
365
+ const vaultV2Reallocations = [];
366
+ for (const reallocation of reallocations ?? []) {
367
+ if (typeof reallocation !== "object" || reallocation === null) {
368
+ throw new index_js_1.InvalidReallocationShapeError();
369
+ }
370
+ if ("from" in reallocation === "withdrawals" in reallocation) {
371
+ throw new index_js_1.InvalidReallocationShapeError();
372
+ }
373
+ if ("withdrawals" in reallocation) {
374
+ vaultV1Reallocations.push(reallocation);
375
+ }
376
+ else {
377
+ vaultV2Reallocations.push(reallocation);
378
+ }
379
+ }
380
+ if (vaultV1Reallocations.length > 0 && vaultV2Reallocations.length > 0) {
381
+ throw new index_js_1.MixedReallocationVersionsError();
382
+ }
383
+ if (vaultV2Reallocations.length > 0) {
384
+ (0, exports.validateVaultV2BlueReallocations)(vaultV2Reallocations, targetMarketId);
385
+ if ((0, blue_sdk_1.getChainAddresses)(chainId).vaultV2BluePublicAllocator == null) {
386
+ throw new index_js_1.BundlerErrors.UnexpectedAction(vaultV2Reallocations[0]?.from.type === "market"
387
+ ? "vaultV2BluePublicAllocatorReallocate"
388
+ : "vaultV2BluePublicAllocatorAllocateFromIdle", chainId);
389
+ }
390
+ return {
391
+ type: "vaultV2Blue",
392
+ reallocations: vaultV2Reallocations,
393
+ };
394
+ }
395
+ (0, exports.validateReallocations)(vaultV1Reallocations, targetMarketId);
396
+ return { type: "vaultV1", reallocations: vaultV1Reallocations };
397
+ };
398
+ exports.validateAndNormalizeReallocations = validateAndNormalizeReallocations;
286
399
  /**
287
400
  * Validates that a slippage tolerance is within an acceptable range.
288
401
  *
@@ -0,0 +1 @@
1
+ export { ecrecoverRatifierAbi, midnightAbi, midnightBundlesAbi, setterRatifierAbi, } from "@morpho-org/midnight-sdk";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setterRatifierAbi = exports.midnightBundlesAbi = exports.midnightAbi = exports.ecrecoverRatifierAbi = void 0;
4
+ var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ Object.defineProperty(exports, "ecrecoverRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.ecrecoverRatifierAbi; } });
6
+ Object.defineProperty(exports, "midnightAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightAbi; } });
7
+ Object.defineProperty(exports, "midnightBundlesAbi", { enumerable: true, get: function () { return midnight_sdk_1.midnightBundlesAbi; } });
8
+ Object.defineProperty(exports, "setterRatifierAbi", { enumerable: true, get: function () { return midnight_sdk_1.setterRatifierAbi; } });
@@ -0,0 +1 @@
1
+ export { CBP, COLLATERAL_PARAMS_TYPEHASH, DEFAULT_TICK_SPACING, EIP712_DOMAIN_TYPEHASH, MARKET_TYPEHASH, MAX_COLLATERALS, MAX_COLLATERALS_PER_BORROWER, MAX_CONTINUOUS_FEE, MAX_OFFER_CAP, MAX_SETTLEMENT_FEES, MAX_TICK, OFFER_TYPEHASH, PRICE_ROUNDING_STEP, SETTLEMENT_FEE_BREAKPOINTS, TIME_TO_MAX_LIF, } from "@morpho-org/midnight-sdk";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TIME_TO_MAX_LIF = exports.SETTLEMENT_FEE_BREAKPOINTS = exports.PRICE_ROUNDING_STEP = exports.OFFER_TYPEHASH = exports.MAX_TICK = exports.MAX_SETTLEMENT_FEES = exports.MAX_OFFER_CAP = exports.MAX_CONTINUOUS_FEE = exports.MAX_COLLATERALS_PER_BORROWER = exports.MAX_COLLATERALS = exports.MARKET_TYPEHASH = exports.EIP712_DOMAIN_TYPEHASH = exports.DEFAULT_TICK_SPACING = exports.COLLATERAL_PARAMS_TYPEHASH = exports.CBP = void 0;
4
+ var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ Object.defineProperty(exports, "CBP", { enumerable: true, get: function () { return midnight_sdk_1.CBP; } });
6
+ Object.defineProperty(exports, "COLLATERAL_PARAMS_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.COLLATERAL_PARAMS_TYPEHASH; } });
7
+ Object.defineProperty(exports, "DEFAULT_TICK_SPACING", { enumerable: true, get: function () { return midnight_sdk_1.DEFAULT_TICK_SPACING; } });
8
+ Object.defineProperty(exports, "EIP712_DOMAIN_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.EIP712_DOMAIN_TYPEHASH; } });
9
+ Object.defineProperty(exports, "MARKET_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.MARKET_TYPEHASH; } });
10
+ Object.defineProperty(exports, "MAX_COLLATERALS", { enumerable: true, get: function () { return midnight_sdk_1.MAX_COLLATERALS; } });
11
+ Object.defineProperty(exports, "MAX_COLLATERALS_PER_BORROWER", { enumerable: true, get: function () { return midnight_sdk_1.MAX_COLLATERALS_PER_BORROWER; } });
12
+ Object.defineProperty(exports, "MAX_CONTINUOUS_FEE", { enumerable: true, get: function () { return midnight_sdk_1.MAX_CONTINUOUS_FEE; } });
13
+ Object.defineProperty(exports, "MAX_OFFER_CAP", { enumerable: true, get: function () { return midnight_sdk_1.MAX_OFFER_CAP; } });
14
+ Object.defineProperty(exports, "MAX_SETTLEMENT_FEES", { enumerable: true, get: function () { return midnight_sdk_1.MAX_SETTLEMENT_FEES; } });
15
+ Object.defineProperty(exports, "MAX_TICK", { enumerable: true, get: function () { return midnight_sdk_1.MAX_TICK; } });
16
+ Object.defineProperty(exports, "OFFER_TYPEHASH", { enumerable: true, get: function () { return midnight_sdk_1.OFFER_TYPEHASH; } });
17
+ Object.defineProperty(exports, "PRICE_ROUNDING_STEP", { enumerable: true, get: function () { return midnight_sdk_1.PRICE_ROUNDING_STEP; } });
18
+ Object.defineProperty(exports, "SETTLEMENT_FEE_BREAKPOINTS", { enumerable: true, get: function () { return midnight_sdk_1.SETTLEMENT_FEE_BREAKPOINTS; } });
19
+ Object.defineProperty(exports, "TIME_TO_MAX_LIF", { enumerable: true, get: function () { return midnight_sdk_1.TIME_TO_MAX_LIF; } });
@@ -0,0 +1,2 @@
1
+ export type { BuildOfferParams, CollateralParams, GroupInput, IAccrualPosition, ICollateralParams, IGroup, IMarket, IMarketParams, IOffer, IPosition, MarketInput, OfferStruct, RatifierTreeInput, SettlementFeeCbps, TreeCreateParams, TreeDescriptor, TreeInput, TreeLike, TreeMempoolValidateParams, TreeMempoolValidateRatification, TreeProof, } from "@morpho-org/midnight-sdk";
2
+ export { AccrualPosition, Group, Market, MarketParams, Offer, Position, Tree, } from "@morpho-org/midnight-sdk";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tree = exports.Position = exports.Offer = exports.MarketParams = exports.Market = exports.Group = exports.AccrualPosition = void 0;
4
+ var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ Object.defineProperty(exports, "AccrualPosition", { enumerable: true, get: function () { return midnight_sdk_1.AccrualPosition; } });
6
+ Object.defineProperty(exports, "Group", { enumerable: true, get: function () { return midnight_sdk_1.Group; } });
7
+ Object.defineProperty(exports, "Market", { enumerable: true, get: function () { return midnight_sdk_1.Market; } });
8
+ Object.defineProperty(exports, "MarketParams", { enumerable: true, get: function () { return midnight_sdk_1.MarketParams; } });
9
+ Object.defineProperty(exports, "Offer", { enumerable: true, get: function () { return midnight_sdk_1.Offer; } });
10
+ Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return midnight_sdk_1.Position; } });
11
+ Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return midnight_sdk_1.Tree; } });
@@ -0,0 +1 @@
1
+ export { ChainIdMismatchError, InvalidEcrecoverSignatureVError, InvalidMarketParameterError, InvalidMidnightApiResponseError, InvalidOfferGroupError, InvalidOfferParameterError, InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError, InvalidTickSpacingError, InvalidTreeError, InvalidTreeHeightError, InvalidTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError, PriceGreaterThanOneError, SettlementFeeExceedsPriceError, TickOutOfRangeError, UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnknownCollateralIndexError = exports.TickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.PriceGreaterThanOneError = exports.PayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidTypedDataSignatureError = exports.InvalidTreeHeightError = exports.InvalidTreeError = exports.InvalidTickSpacingError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.InvalidPositionAccrualStateError = exports.InvalidOfferParameterError = exports.InvalidOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMarketParameterError = exports.InvalidEcrecoverSignatureVError = exports.ChainIdMismatchError = void 0;
4
+ var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ Object.defineProperty(exports, "ChainIdMismatchError", { enumerable: true, get: function () { return midnight_sdk_1.ChainIdMismatchError; } });
6
+ Object.defineProperty(exports, "InvalidEcrecoverSignatureVError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidEcrecoverSignatureVError; } });
7
+ Object.defineProperty(exports, "InvalidMarketParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMarketParameterError; } });
8
+ Object.defineProperty(exports, "InvalidMidnightApiResponseError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMidnightApiResponseError; } });
9
+ Object.defineProperty(exports, "InvalidOfferGroupError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferGroupError; } });
10
+ Object.defineProperty(exports, "InvalidOfferParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferParameterError; } });
11
+ Object.defineProperty(exports, "InvalidPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
12
+ Object.defineProperty(exports, "InvalidPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
13
+ Object.defineProperty(exports, "InvalidPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
14
+ Object.defineProperty(exports, "InvalidTickSpacingError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTickSpacingError; } });
15
+ Object.defineProperty(exports, "InvalidTreeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeError; } });
16
+ Object.defineProperty(exports, "InvalidTreeHeightError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTreeHeightError; } });
17
+ Object.defineProperty(exports, "InvalidTypedDataSignatureError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidTypedDataSignatureError; } });
18
+ Object.defineProperty(exports, "MidnightApiError", { enumerable: true, get: function () { return midnight_sdk_1.MidnightApiError; } });
19
+ Object.defineProperty(exports, "MidnightMempoolValidationError", { enumerable: true, get: function () { return midnight_sdk_1.MidnightMempoolValidationError; } });
20
+ Object.defineProperty(exports, "PayloadDecodeError", { enumerable: true, get: function () { return midnight_sdk_1.PayloadDecodeError; } });
21
+ Object.defineProperty(exports, "PriceGreaterThanOneError", { enumerable: true, get: function () { return midnight_sdk_1.PriceGreaterThanOneError; } });
22
+ Object.defineProperty(exports, "SettlementFeeExceedsPriceError", { enumerable: true, get: function () { return midnight_sdk_1.SettlementFeeExceedsPriceError; } });
23
+ Object.defineProperty(exports, "TickOutOfRangeError", { enumerable: true, get: function () { return midnight_sdk_1.TickOutOfRangeError; } });
24
+ Object.defineProperty(exports, "UnknownCollateralIndexError", { enumerable: true, get: function () { return midnight_sdk_1.UnknownCollateralIndexError; } });
@@ -0,0 +1 @@
1
+ export { fetchAccrualPosition, fetchMarket, fetchMarketParams, fetchPosition, fetchRatifierInfo, } from "@morpho-org/midnight-sdk";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchRatifierInfo = exports.fetchPosition = exports.fetchMarketParams = exports.fetchMarket = exports.fetchAccrualPosition = void 0;
4
+ var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ Object.defineProperty(exports, "fetchAccrualPosition", { enumerable: true, get: function () { return midnight_sdk_1.fetchAccrualPosition; } });
6
+ Object.defineProperty(exports, "fetchMarket", { enumerable: true, get: function () { return midnight_sdk_1.fetchMarket; } });
7
+ Object.defineProperty(exports, "fetchMarketParams", { enumerable: true, get: function () { return midnight_sdk_1.fetchMarketParams; } });
8
+ Object.defineProperty(exports, "fetchPosition", { enumerable: true, get: function () { return midnight_sdk_1.fetchPosition; } });
9
+ Object.defineProperty(exports, "fetchRatifierInfo", { enumerable: true, get: function () { return midnight_sdk_1.fetchRatifierInfo; } });
@@ -0,0 +1 @@
1
+ export type { BuildFixedRateOfferChainParams, DecodedEcrecoverRatifierData, DecodedSetterRatifierData, DeploylessFetchParameters, EcrecoverRatificationTypedData, EcrecoverRatifierDataDigestParams, EcrecoverRatifierDataParams, EcrecoverRatifierDataVerificationParams, EcrecoverRatifierRatifyParams, EcrecoverRatifierRootDigestParams, EcrecoverRatifierTypedDataParams, EcrecoverSignatureInput, FixedRateOfferChainLeg, GetRatifierInfoParams, MidnightCallParameters, MidnightFetchParams, RatifierInfo, SetterRatifierDataParams, SetterRatifierDataVerificationParams, VerifiedEcrecoverRatifierData, } from "@morpho-org/midnight-sdk";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export { EcrecoverRatifierUtils, eip712Digest, GroupUtils, MarketUtils, OfferChainUtils, OfferUtils, Payload, PositionUtils, RatifierUtils, SetterRatifierUtils, TakeAmountsLib, TickLib, TreeUtils, } from "@morpho-org/midnight-sdk";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TreeUtils = exports.TickLib = exports.TakeAmountsLib = exports.SetterRatifierUtils = exports.RatifierUtils = exports.PositionUtils = exports.Payload = exports.OfferUtils = exports.OfferChainUtils = exports.MarketUtils = exports.GroupUtils = exports.eip712Digest = exports.EcrecoverRatifierUtils = void 0;
4
+ var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
+ Object.defineProperty(exports, "EcrecoverRatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.EcrecoverRatifierUtils; } });
6
+ Object.defineProperty(exports, "eip712Digest", { enumerable: true, get: function () { return midnight_sdk_1.eip712Digest; } });
7
+ Object.defineProperty(exports, "GroupUtils", { enumerable: true, get: function () { return midnight_sdk_1.GroupUtils; } });
8
+ Object.defineProperty(exports, "MarketUtils", { enumerable: true, get: function () { return midnight_sdk_1.MarketUtils; } });
9
+ Object.defineProperty(exports, "OfferChainUtils", { enumerable: true, get: function () { return midnight_sdk_1.OfferChainUtils; } });
10
+ Object.defineProperty(exports, "OfferUtils", { enumerable: true, get: function () { return midnight_sdk_1.OfferUtils; } });
11
+ Object.defineProperty(exports, "Payload", { enumerable: true, get: function () { return midnight_sdk_1.Payload; } });
12
+ Object.defineProperty(exports, "PositionUtils", { enumerable: true, get: function () { return midnight_sdk_1.PositionUtils; } });
13
+ Object.defineProperty(exports, "RatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.RatifierUtils; } });
14
+ Object.defineProperty(exports, "SetterRatifierUtils", { enumerable: true, get: function () { return midnight_sdk_1.SetterRatifierUtils; } });
15
+ Object.defineProperty(exports, "TakeAmountsLib", { enumerable: true, get: function () { return midnight_sdk_1.TakeAmountsLib; } });
16
+ Object.defineProperty(exports, "TickLib", { enumerable: true, get: function () { return midnight_sdk_1.TickLib; } });
17
+ Object.defineProperty(exports, "TreeUtils", { enumerable: true, get: function () { return midnight_sdk_1.TreeUtils; } });
@@ -115,7 +115,10 @@ export interface BlueWithdrawAction extends BaseAction<"blueWithdraw", {
115
115
  shares: bigint;
116
116
  receiver: Address;
117
117
  minSharePrice: bigint;
118
+ /** Native-token fees paid to PublicAllocator V1. */
118
119
  reallocationFee: bigint;
120
+ /** Loan-token assets donated as BluePublicAllocator V2 penalties. */
121
+ readonly reallocationPenaltyAssets: bigint;
119
122
  }> {
120
123
  }
121
124
  export interface BlueSupplyCollateralAction extends BaseAction<"blueSupplyCollateral", {
@@ -130,7 +133,10 @@ export interface BlueBorrowAction extends BaseAction<"blueBorrow", {
130
133
  amount: bigint;
131
134
  receiver: Address;
132
135
  minSharePrice: bigint;
136
+ /** Native-token fees paid to PublicAllocator V1. */
133
137
  reallocationFee: bigint;
138
+ /** Loan-token assets donated as BluePublicAllocator V2 penalties. */
139
+ readonly reallocationPenaltyAssets: bigint;
134
140
  }> {
135
141
  }
136
142
  export interface BlueSupplyCollateralBorrowAction extends BaseAction<"blueSupplyCollateralBorrow", {
@@ -141,7 +147,10 @@ export interface BlueSupplyCollateralBorrowAction extends BaseAction<"blueSupply
141
147
  onBehalf: Address;
142
148
  receiver: Address;
143
149
  nativeAmount?: bigint;
150
+ /** Native-token fees paid to PublicAllocator V1. */
144
151
  reallocationFee: bigint;
152
+ /** Loan-token assets donated as BluePublicAllocator V2 penalties. */
153
+ readonly reallocationPenaltyAssets: bigint;
145
154
  }> {
146
155
  }
147
156
  export interface BlueRepayAction extends BaseAction<"blueRepay", {
@@ -185,7 +194,10 @@ export interface BlueRefinanceAction extends BaseAction<"blueRefinance", {
185
194
  readonly minBorrowSharePrice: bigint;
186
195
  readonly maxRepaySharePrice: bigint;
187
196
  readonly user: Address;
197
+ /** Native-token fees paid to PublicAllocator V1. */
188
198
  readonly reallocationFee: bigint;
199
+ /** Loan-token assets donated as BluePublicAllocator V2 penalties. */
200
+ readonly reallocationPenaltyAssets: bigint;
189
201
  }> {
190
202
  }
191
203
  /**