@morpho-org/morpho-sdk 9.4.0 → 9.6.0-next.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 (97) hide show
  1. package/MIGRATION-v5-to-v6.md +7 -0
  2. package/MIGRATION-v7-to-v8.md +7 -0
  3. package/MIGRATION-v8-to-v9.md +7 -0
  4. package/README.md +6 -4
  5. package/lib/cjs/abis.d.ts +1 -1
  6. package/lib/cjs/abis.js +5 -1
  7. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -0
  8. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +4 -1
  9. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +4 -1
  10. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -1
  11. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
  12. package/lib/cjs/blue/abis.d.ts +1 -1
  13. package/lib/cjs/blue/abis.js +5 -1
  14. package/lib/cjs/blue/entities.d.ts +4 -4
  15. package/lib/cjs/blue/entities.js +3 -1
  16. package/lib/cjs/blue/errors.d.ts +2 -2
  17. package/lib/cjs/blue/errors.js +5 -1
  18. package/lib/cjs/blue/fetch.d.ts +2 -2
  19. package/lib/cjs/blue/fetch.js +3 -1
  20. package/lib/cjs/blue/utils.d.ts +1 -1
  21. package/lib/cjs/blue/utils.js +2 -1
  22. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  23. package/lib/cjs/client/morphoViemExtension.js +1 -1
  24. package/lib/cjs/entities/blue/blue.d.ts +7 -21
  25. package/lib/cjs/entities/blue/blue.js +4 -22
  26. package/lib/cjs/entities/index.d.ts +4 -4
  27. package/lib/cjs/entities/index.js +3 -1
  28. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +21 -26
  29. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +42 -80
  30. package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +6 -3
  31. package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +2 -2
  32. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +5 -11
  33. package/lib/cjs/entities/vaultV1/vaultV1.js +3 -11
  34. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +37 -18
  35. package/lib/cjs/entities/vaultV2/vaultV2.js +36 -12
  36. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -3
  37. package/lib/cjs/entities/vaultV2BlueReallocationData.js +49 -7
  38. package/lib/cjs/errors.d.ts +4 -4
  39. package/lib/cjs/errors.js +7 -5
  40. package/lib/cjs/fetch.d.ts +2 -2
  41. package/lib/cjs/fetch.js +3 -1
  42. package/lib/cjs/helpers/deadShares.js +2 -0
  43. package/lib/cjs/midnight/errors.d.ts +2 -1
  44. package/lib/cjs/midnight/errors.js +5 -4
  45. package/lib/cjs/types/action.d.ts +11 -4
  46. package/lib/cjs/types/action.js +1 -0
  47. package/lib/cjs/types/error.d.ts +8 -2
  48. package/lib/cjs/types/error.js +8 -2
  49. package/lib/cjs/utils.d.ts +2 -2
  50. package/lib/cjs/utils.js +4 -2
  51. package/lib/esm/abis.d.ts +1 -1
  52. package/lib/esm/abis.js +1 -1
  53. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +1 -0
  54. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +4 -1
  55. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +4 -1
  56. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +5 -1
  57. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +1 -0
  58. package/lib/esm/blue/abis.d.ts +1 -1
  59. package/lib/esm/blue/abis.js +1 -1
  60. package/lib/esm/blue/entities.d.ts +4 -4
  61. package/lib/esm/blue/entities.js +2 -2
  62. package/lib/esm/blue/errors.d.ts +2 -2
  63. package/lib/esm/blue/errors.js +2 -2
  64. package/lib/esm/blue/fetch.d.ts +2 -2
  65. package/lib/esm/blue/fetch.js +2 -2
  66. package/lib/esm/blue/utils.d.ts +1 -1
  67. package/lib/esm/blue/utils.js +1 -1
  68. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  69. package/lib/esm/client/morphoViemExtension.js +1 -1
  70. package/lib/esm/entities/blue/blue.d.ts +7 -21
  71. package/lib/esm/entities/blue/blue.js +4 -22
  72. package/lib/esm/entities/index.d.ts +4 -4
  73. package/lib/esm/entities/index.js +2 -2
  74. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +21 -26
  75. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +44 -82
  76. package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +6 -3
  77. package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +2 -2
  78. package/lib/esm/entities/vaultV1/vaultV1.d.ts +5 -11
  79. package/lib/esm/entities/vaultV1/vaultV1.js +4 -12
  80. package/lib/esm/entities/vaultV2/vaultV2.d.ts +37 -18
  81. package/lib/esm/entities/vaultV2/vaultV2.js +37 -13
  82. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -3
  83. package/lib/esm/entities/vaultV2BlueReallocationData.js +49 -7
  84. package/lib/esm/errors.d.ts +4 -4
  85. package/lib/esm/errors.js +4 -4
  86. package/lib/esm/fetch.d.ts +2 -2
  87. package/lib/esm/fetch.js +2 -2
  88. package/lib/esm/helpers/deadShares.js +3 -1
  89. package/lib/esm/midnight/errors.d.ts +2 -1
  90. package/lib/esm/midnight/errors.js +2 -1
  91. package/lib/esm/types/action.d.ts +11 -4
  92. package/lib/esm/types/action.js +1 -0
  93. package/lib/esm/types/error.d.ts +8 -2
  94. package/lib/esm/types/error.js +8 -2
  95. package/lib/esm/utils.d.ts +2 -2
  96. package/lib/esm/utils.js +2 -2
  97. package/package.json +6 -6
@@ -18,6 +18,11 @@ const index_js_4 = require("../requirements/index.js");
18
18
  // Maximum accepted deadline horizon; the on-chain management fee is capped at 5%/yr so the
19
19
  // accrual model stays well-defined inside it.
20
20
  const VAULT_V2_FEE_PROJECTION_HORIZON = morpho_ts_1.Time.s.from.y(1n);
21
+ /**
22
+ * Midnight adapters revert vault-initiated `allocate` and `deallocate` (`SelfAllocationOnly`), so a
23
+ * vault routing liquidity through one accepts no deposit and serves exits from idle assets only.
24
+ */
25
+ const isMidnightLiquidityAdapter = (vaultData) => vaultData.accrualLiquidityAdapter?.type === "VaultV2MidnightAdapter";
21
26
  /** Binds a viem client to a Vault V2 vault's action builders. */
22
27
  class MorphoVaultV2 {
23
28
  client;
@@ -42,17 +47,12 @@ class MorphoVaultV2 {
42
47
  * before any other requirement read. The `inKindRedeem` and `forceWithdraw` paths validate the
43
48
  * client chain before this code check.
44
49
  *
45
- * @param roles - Registry labels to resolve and check; `permit2` is skipped when the
46
- * chain registers none.
50
+ * @param roles - Registry labels to resolve and check.
47
51
  */
48
52
  async assertWriteTargets(roles) {
49
53
  const targets = [];
50
54
  for (const role of roles) {
51
- const address = role === "permit2"
52
- ? (0, morpho_ts_1.getChainAddresses)(this.chainId).permit2
53
- : (0, morpho_ts_1.getChainAddress)(this.chainId, role);
54
- if (address == null)
55
- continue;
55
+ const address = (0, morpho_ts_1.getChainAddress)(this.chainId, role);
56
56
  targets.push({ role, address });
57
57
  }
58
58
  await (0, assertContractCode_js_1.assertRegistryTargetsHaveCode)(this.client.viemClient, this.chainId, targets);
@@ -81,6 +81,13 @@ class MorphoVaultV2 {
81
81
  // The native path must target the chain's registered wrapped-native asset.
82
82
  (0, validate_js_1.validateNativeVaultAsset)(this.chainId, vaultAsset);
83
83
  }
84
+ if (isMidnightLiquidityAdapter(vaultData)) {
85
+ throw new index_js_3.InputExceedsMaxError({
86
+ field: funding.value > 0n ? "nativeAmount" : "amount",
87
+ value: funding.assets,
88
+ max: 0n,
89
+ });
90
+ }
84
91
  const referralFeeAssets = (0, common_js_1.getBundlesReferralFeeAssets)(funding.assets, common.referralFeePct);
85
92
  const maxSharePrice = (0, index_js_2.computeVaultMaxSharePrice)({
86
93
  vaultData,
@@ -100,9 +107,7 @@ class MorphoVaultV2 {
100
107
  // Memoize the in-flight promise so concurrent callers share one round of
101
108
  // allowance/nonce reads.
102
109
  const pending = (async () => {
103
- await this.assertWriteTargets(funding.value === 0n && this.client.options.supportSignature
104
- ? ["bundles.vaultBundlesV1", "permit2"]
105
- : ["bundles.vaultBundlesV1"]);
110
+ await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
106
111
  return funding.value > 0n
107
112
  ? []
108
113
  : (0, index_js_4.getBundlesTokenRequirements)(this.client.viemClient, {
@@ -115,7 +120,6 @@ class MorphoVaultV2 {
115
120
  supportSignature: this.client.options.supportSignature,
116
121
  supportDeployless: this.client.options.supportDeployless,
117
122
  useSimplePermit: requirementOptions?.useSimplePermit,
118
- permit2Nonce: requirementOptions?.permit2Nonce,
119
123
  now,
120
124
  });
121
125
  })();
@@ -164,6 +168,14 @@ class MorphoVaultV2 {
164
168
  throw new index_js_3.NonPositiveInputError("amount", amount);
165
169
  // Reject values outside the ABI range before resolving any requirements.
166
170
  (0, validate_js_1.validateUint256Field)("amount", amount);
171
+ if (isMidnightLiquidityAdapter(vaultData) &&
172
+ amount > vaultData.assetBalance) {
173
+ throw new index_js_3.InputExceedsMaxError({
174
+ field: "amount",
175
+ value: amount,
176
+ max: vaultData.assetBalance,
177
+ });
178
+ }
167
179
  const createdAt = morpho_ts_1.Time.timestamp();
168
180
  const deadline = params.deadline ?? createdAt + morpho_ts_1.Time.s.from.h(2n);
169
181
  if (deadline <= createdAt)
@@ -244,8 +256,20 @@ class MorphoVaultV2 {
244
256
  if (deadline <= now)
245
257
  throw new index_js_3.ExpiredDeadlineError(deadline, now);
246
258
  await this.assertWriteTargets(["bundles.vaultBundlesV1"]);
259
+ const vaultData = await this.getData();
260
+ if (isMidnightLiquidityAdapter(vaultData)) {
261
+ // Onchain redeem accrues interest before converting shares to assets.
262
+ const { vault: accrued } = vaultData.accrueInterest(now);
263
+ if (accrued.toAssets(shares) > accrued.assetBalance) {
264
+ throw new index_js_3.InputExceedsMaxError({
265
+ field: "shares",
266
+ value: shares,
267
+ max: accrued.toShares(accrued.assetBalance),
268
+ });
269
+ }
270
+ }
247
271
  return (0, getVaultBundlesSharesRequirements_js_1.getVaultBundlesSharesRequirements)(this.client.viemClient, {
248
- vaultData: await this.getData(),
272
+ vaultData,
249
273
  version: "vaultV2",
250
274
  owner: userAddress,
251
275
  chainId: this.chainId,
@@ -56,8 +56,9 @@ export interface InputVaultV2BlueReallocationData {
56
56
  /**
57
57
  * Immutable-by-convention state container for Vault V2 BluePublicAllocator simulations.
58
58
  *
59
- * Constructor inputs are cloned. Every simulated reallocation returns a new
60
- * instance. Planning keeps the transaction-scoped `firstTotalAssets`
59
+ * Constructor inputs are cloned, except Midnight adapter snapshots: those are
60
+ * shared by reference and must be treated as read-only. Every simulated
61
+ * reallocation returns a new instance. Planning keeps the transaction-scoped `firstTotalAssets`
61
62
  * denominator outside the durable snapshot while applying reallocations in
62
63
  * contract order. Penalty donations update simulated vault accounting but are
63
64
  * excluded from same-plan idle liquidity so round-up dust cannot create
@@ -131,7 +132,8 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
131
132
  /**
132
133
  * Clones the complete simulation snapshot.
133
134
  *
134
- * @returns A deep clone of this simulation state.
135
+ * @returns A deep clone of this simulation state. Midnight adapter snapshots are
136
+ * shared by reference and must be treated as read-only.
135
137
  * @example
136
138
  * ```ts
137
139
  * import { markets } from "@morpho-org/morpho-test";
@@ -450,6 +452,9 @@ export declare class VaultV2BlueReallocationData implements InputVaultV2BlueReal
450
452
  * Full-liquidity discovery omits a candidate when its non-shared maximum
451
453
  * violates a shared cap instead of scanning smaller base-unit amounts. These
452
454
  * bounds can understate executable liquidity in rounding-only edge cases.
455
+ * With an explicit Blue balance, a paid operation may retry the same search
456
+ * from a physical-funding budget and keep a strictly cheaper feasible plan.
457
+ * This bounded refinement does not guarantee globally minimal penalties.
453
458
  *
454
459
  * @param marketId - Target Blue market id.
455
460
  * @param options - Optional discovery controls and operation to support.
@@ -90,6 +90,10 @@ const cloneAccrualVault = (vault, markets) => new blue_sdk_1.AccrualVault({
90
90
  position: clonePosition(position, markets),
91
91
  })));
92
92
  const cloneAdapter = (adapter, markets) => {
93
+ // BluePublicAllocator never moves Midnight liquidity, and reallocation never mutates a Midnight
94
+ // adapter, so its read-only snapshot is shared as-is.
95
+ if (adapter.type === "VaultV2MidnightAdapter")
96
+ return adapter;
93
97
  const base = {
94
98
  address: adapter.address,
95
99
  parentVault: adapter.parentVault,
@@ -137,8 +141,9 @@ const cloneVault = (vault, { markets, adapterKeysToClone, }) => {
137
141
  /**
138
142
  * Immutable-by-convention state container for Vault V2 BluePublicAllocator simulations.
139
143
  *
140
- * Constructor inputs are cloned. Every simulated reallocation returns a new
141
- * instance. Planning keeps the transaction-scoped `firstTotalAssets`
144
+ * Constructor inputs are cloned, except Midnight adapter snapshots: those are
145
+ * shared by reference and must be treated as read-only. Every simulated
146
+ * reallocation returns a new instance. Planning keeps the transaction-scoped `firstTotalAssets`
142
147
  * denominator outside the durable snapshot while applying reallocations in
143
148
  * contract order. Penalty donations update simulated vault accounting but are
144
149
  * excluded from same-plan idle liquidity so round-up dust cannot create
@@ -282,7 +287,8 @@ class VaultV2BlueReallocationData {
282
287
  /**
283
288
  * Clones the complete simulation snapshot.
284
289
  *
285
- * @returns A deep clone of this simulation state.
290
+ * @returns A deep clone of this simulation state. Midnight adapter snapshots are
291
+ * shared by reference and must be treated as read-only.
286
292
  * @example
287
293
  * ```ts
288
294
  * import { markets } from "@morpho-org/morpho-test";
@@ -654,6 +660,9 @@ class VaultV2BlueReallocationData {
654
660
  * Full-liquidity discovery omits a candidate when its non-shared maximum
655
661
  * violates a shared cap instead of scanning smaller base-unit amounts. These
656
662
  * bounds can understate executable liquidity in rounding-only edge cases.
663
+ * With an explicit Blue balance, a paid operation may retry the same search
664
+ * from a physical-funding budget and keep a strictly cheaper feasible plan.
665
+ * This bounded refinement does not guarantee globally minimal penalties.
657
666
  *
658
667
  * @param marketId - Target Blue market id.
659
668
  * @param options - Optional discovery controls and operation to support.
@@ -808,7 +817,7 @@ class VaultV2BlueReallocationData {
808
817
  ? [config.penalty]
809
818
  : [])),
810
819
  ].sort((0, morpho_ts_1.bigIntComparator)((tier) => tier));
811
- const plan = (maxAssets, headroom) => {
820
+ const plan = (maxAssets, { headroom, usePhysicalBalance = false, }) => {
812
821
  let reserves = createCapReserveState(this.mutableMarkets);
813
822
  const reallocations = [];
814
823
  let data = this.clone();
@@ -832,6 +841,19 @@ class VaultV2BlueReallocationData {
832
841
  : isFreeFriendlyPass
833
842
  ? maxAssets
834
843
  : remainingShortfall;
844
+ if (usePhysicalBalance && penalty > 0n) {
845
+ const penaltyMultiplier = type === "refinance" ? 2n : 1n;
846
+ const physicalPenalty = penaltyMultiplier * penalty;
847
+ if (physicalPenalty < blue_sdk_1.MathLib.WAD) {
848
+ const idleAssets = reallocations.reduce((total, { from, assets }) => from.type === "idle" ? total + assets : total, 0n);
849
+ // Idle must fund both the operation and its penalty flash loan.
850
+ const physicalShortfall = blue_sdk_1.MathLib.zeroFloorSub(amount +
851
+ feeAssets +
852
+ penaltyMultiplier *
853
+ (0, common_js_1.getBlueBundlesV1PenaltyAssets)(reallocations), blueBalance + idleAssets);
854
+ passMaxAssets = blue_sdk_1.MathLib.max(passMaxAssets, blue_sdk_1.MathLib.mulDivUp(physicalShortfall, blue_sdk_1.MathLib.WAD, blue_sdk_1.MathLib.WAD - physicalPenalty));
855
+ }
856
+ }
835
857
  const retryPaidPass = penalty > 0n;
836
858
  let lo = retryPaidPass ? passMaxAssets - 1n : 0n;
837
859
  let tryFullCapacityAttempt = false;
@@ -1022,6 +1044,8 @@ class VaultV2BlueReallocationData {
1022
1044
  ? reallocatedAssets >= absoluteShortfall + penaltyAssets
1023
1045
  : reallocatedAssets >= absoluteShortfall;
1024
1046
  return {
1047
+ maxAssets,
1048
+ headroom,
1025
1049
  reallocations,
1026
1050
  data,
1027
1051
  liquidityBound: allocatorCapBoundTargets.size > 0 || idleBoundVaults.size > 0,
@@ -1038,12 +1062,12 @@ class VaultV2BlueReallocationData {
1038
1062
  // (nearly) all of a source vault's starting idle, revert once another
1039
1063
  // allocation lands first. A bound plan therefore moves only the operation's
1040
1064
  // shortfall, or what unbound legs moved.
1041
- const target = plan(requiredAssets, allocatorCapHeadroom);
1065
+ const target = plan(requiredAssets, { headroom: allocatorCapHeadroom });
1042
1066
  let selected = target;
1043
1067
  if (allocatorCapHeadroom > 0n && target.liquidityBound) {
1044
1068
  selected = plan(absoluteShortfall > target.unboundAssets
1045
1069
  ? absoluteShortfall
1046
- : target.unboundAssets, allocatorCapHeadroom);
1070
+ : target.unboundAssets, { headroom: allocatorCapHeadroom });
1047
1071
  // Shared-cap fitting is not monotonic in the budget.
1048
1072
  if (!selected.coversShortfall && target.coversShortfall)
1049
1073
  selected = target;
@@ -1054,7 +1078,7 @@ class VaultV2BlueReallocationData {
1054
1078
  for (const maxAssets of fullCapBudgets) {
1055
1079
  if (selected.coversShortfall)
1056
1080
  break;
1057
- selected = plan(maxAssets, 0n);
1081
+ selected = plan(maxAssets, { headroom: 0n });
1058
1082
  if (selected.reallocatedAssets > available)
1059
1083
  available = selected.reallocatedAssets;
1060
1084
  }
@@ -1086,6 +1110,24 @@ class VaultV2BlueReallocationData {
1086
1110
  available,
1087
1111
  });
1088
1112
  }
1113
+ const selectedPenaltyAssets = (0, common_js_1.getBlueBundlesV1PenaltyAssets)(selected.reallocations);
1114
+ if (hasExplicitBlueBalance &&
1115
+ selectedPenaltyAssets > 1n &&
1116
+ blueBalance <
1117
+ amount +
1118
+ feeAssets +
1119
+ (type === "refinance" ? 2n : 1n) * selectedPenaltyAssets) {
1120
+ // Amount feasibility is not monotonic: retain the original plan unless
1121
+ // the physical-balance seed finds a fully funded, strictly cheaper one.
1122
+ const alternative = plan(selected.maxAssets, {
1123
+ headroom: selected.headroom,
1124
+ usePhysicalBalance: true,
1125
+ });
1126
+ if (alternative.coversShortfall &&
1127
+ (0, common_js_1.getBlueBundlesV1PenaltyAssets)(alternative.reallocations) <
1128
+ (0, common_js_1.getBlueBundlesV1PenaltyAssets)(selected.reallocations))
1129
+ selected = alternative;
1130
+ }
1089
1131
  return { reallocations: selected.reallocations, data: selected.data };
1090
1132
  }
1091
1133
  computeVaultV2BlueReallocationsAtUtilizationInPlace({ context, reserves, marketId, maxWithdrawalUtilization, maxAssets, capAccrualBuffer, allocatorCapHeadroom = 0n, penalty, options = {}, }) {
@@ -1,7 +1,7 @@
1
- export { BlueErrors, IncompleteChainRegistryError, InvalidMarketParamsError as InvalidBlueMarketParamsError, UnknownAddressError, UnknownDataError as UnknownBlueDataError, UnknownFactory as UnknownBlueFactory, UnknownMarketAllocationError as UnknownBlueMarketAllocationError, UnknownMarketParamsError as UnknownBlueMarketParamsError, UnknownOfFactory as UnknownBlueOfFactory, UnknownTokenError as UnknownBlueTokenError, UnknownTokenPriceError as UnknownBlueTokenPriceError, UnknownVaultConfigError as UnknownBlueVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError as UnsupportedBlueMarketIrmError,
1
+ export { BlueErrors, IncompleteChainRegistryError, InvalidMarketParamsError as InvalidBlueMarketParamsError, InvalidVaultV2MidnightAdapterMarketsError as InvalidBlueVaultV2MidnightAdapterMarketsError, UnknownAddressError, UnknownDataError as UnknownBlueDataError, UnknownFactory as UnknownBlueFactory, UnknownMarketAllocationError as UnknownBlueMarketAllocationError, UnknownMarketParamsError as UnknownBlueMarketParamsError, UnknownOfFactory as UnknownBlueOfFactory, UnknownTokenError as UnknownBlueTokenError, UnknownTokenPriceError as UnknownBlueTokenPriceError, UnknownVaultConfigError as UnknownBlueVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError as UnsupportedBlueMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError as UnsupportedBluePreLiquidationParamsError, UnsupportedVaultV2AdapterError as UnsupportedBlueVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter as getBlueUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError as isBlueUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError as BlueMarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
5
- export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError, InvalidRateRatifierV1RateError as InvalidMidnightRateRatifierV1RateError, InvalidRateRatifierV1TickError as InvalidMidnightRateRatifierV1TickError, InvalidRateRatifierV1TimeError as InvalidMidnightRateRatifierV1TimeError, InvalidRatifierV1AddressError as InvalidMidnightRatifierV1AddressError, InvalidTickSpacingError as InvalidMidnightTickSpacingError, InvalidTreeError as InvalidMidnightTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError, RateRatifierV1BoundOverflowError as MidnightRateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError as MidnightRatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError, } from "@morpho-org/midnight-sdk";
4
+ export { getUnsupportedVaultV2Adapter as getBlueUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError as isBlueUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError as BlueMarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
5
+ export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError, InvalidRateRatifierV1RateError as InvalidMidnightRateRatifierV1RateError, InvalidRateRatifierV1TickError as InvalidMidnightRateRatifierV1TickError, InvalidRateRatifierV1TimeError as InvalidMidnightRateRatifierV1TimeError, InvalidRatifierV1AddressError as InvalidMidnightRatifierV1AddressError, InvalidTickSpacingError as InvalidMidnightTickSpacingError, InvalidTreeError as InvalidMidnightTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError, RateRatifierV1BoundOverflowError as MidnightRateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError as MidnightRatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError, } from "@morpho-org/midnight-sdk";
6
6
  export type { ErrorClass } from "@morpho-org/morpho-ts";
7
- export { _try, DivisionByZeroError, InvalidAddressError, InvalidBitLengthError, NegativeValueError, RegistryValueAlreadyRegisteredError, RetriesExhaustedError, RetryStoppedError, } from "@morpho-org/morpho-ts";
7
+ export { _try, DivisionByZeroError, InvalidAddressError, InvalidBitLengthError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError, NegativeValueError, RegistryValueAlreadyRegisteredError, RetriesExhaustedError, RetryStoppedError, } from "@morpho-org/morpho-ts";
package/lib/cjs/errors.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidMidnightTreeHeightError = exports.InvalidMidnightTreeError = exports.InvalidMidnightTickSpacingError = exports.InvalidMidnightRatifierV1AddressError = exports.InvalidMidnightRateRatifierV1TimeError = exports.InvalidMidnightRateRatifierV1TickError = exports.InvalidMidnightRateRatifierV1RateError = exports.InvalidMidnightPositionLossFactorError = exports.InvalidMidnightPositionAccrualTimestampError = exports.InvalidMidnightPositionAccrualStateError = exports.InvalidMidnightOfferParameterError = exports.InvalidMidnightOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightMarketParameterError = exports.InvalidMidnightEcrecoverSignatureVError = exports.MidnightChainIdMismatchError = exports.UnsupportedPermitDomainExtensionsError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.Permit2ExpirationOutOfRangeError = exports.NonTupleReturnValueError = exports.MissingPermitDomainNameError = exports.BlueMarketParamsIdMismatchError = exports.MalformedTokenMetadataError = exports.isBlueUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getBlueUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedBlueVaultV2AdapterError = exports.UnsupportedBluePreLiquidationParamsError = exports.UnsupportedBlueMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownBlueVaultConfigError = exports.UnknownBlueTokenPriceError = exports.UnknownBlueTokenError = exports.UnknownBlueOfFactory = exports.UnknownBlueMarketParamsError = exports.UnknownBlueMarketAllocationError = exports.UnknownBlueFactory = exports.UnknownBlueDataError = exports.UnknownAddressError = exports.InvalidBlueMarketParamsError = exports.IncompleteChainRegistryError = exports.BlueErrors = void 0;
4
- exports.RetryStoppedError = exports.RetriesExhaustedError = exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.InvalidBitLengthError = exports.InvalidAddressError = exports.DivisionByZeroError = exports._try = exports.UnknownMidnightCollateralIndexError = exports.MidnightTickOutOfRangeError = exports.MidnightSettlementFeeExceedsPriceError = exports.MidnightRatifierV1TakerNotAllowedError = exports.MidnightRateRatifierV1BoundOverflowError = exports.MidnightPriceGreaterThanOneError = exports.MidnightPayloadDecodeError = void 0;
3
+ exports.MidnightPayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidMidnightTreeHeightError = exports.InvalidMidnightTreeError = exports.InvalidMidnightTickSpacingError = exports.InvalidMidnightRatifierV1AddressError = exports.InvalidMidnightRateRatifierV1TimeError = exports.InvalidMidnightRateRatifierV1TickError = exports.InvalidMidnightRateRatifierV1RateError = exports.InvalidMidnightOfferParameterError = exports.InvalidMidnightOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightMarketParameterError = exports.InvalidMidnightEcrecoverSignatureVError = exports.MidnightChainIdMismatchError = exports.UnsupportedPermitDomainExtensionsError = exports.UnresolvedBlockNumberError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.Permit2ExpirationOutOfRangeError = exports.NonTupleReturnValueError = exports.MissingPermitDomainNameError = exports.BlueMarketParamsIdMismatchError = exports.MalformedTokenMetadataError = exports.isBlueUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getBlueUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedBlueVaultV2AdapterError = exports.UnsupportedBluePreLiquidationParamsError = exports.UnsupportedBlueMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownBlueVaultConfigError = exports.UnknownBlueTokenPriceError = exports.UnknownBlueTokenError = exports.UnknownBlueOfFactory = exports.UnknownBlueMarketParamsError = exports.UnknownBlueMarketAllocationError = exports.UnknownBlueFactory = exports.UnknownBlueDataError = exports.UnknownAddressError = exports.InvalidBlueVaultV2MidnightAdapterMarketsError = exports.InvalidBlueMarketParamsError = exports.IncompleteChainRegistryError = exports.BlueErrors = void 0;
4
+ exports.RetryStoppedError = exports.RetriesExhaustedError = exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.InvalidMidnightPositionLossFactorError = exports.InvalidMidnightPositionAccrualTimestampError = exports.InvalidMidnightPositionAccrualStateError = exports.InvalidBitLengthError = exports.InvalidAddressError = exports.DivisionByZeroError = exports._try = exports.UnknownMidnightCollateralIndexError = exports.MidnightTickOutOfRangeError = exports.MidnightSettlementFeeExceedsPriceError = exports.MidnightRatifierV1TakerNotAllowedError = exports.MidnightRateRatifierV1BoundOverflowError = exports.MidnightPriceGreaterThanOneError = void 0;
5
5
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
6
6
  Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
7
7
  Object.defineProperty(exports, "IncompleteChainRegistryError", { enumerable: true, get: function () { return blue_sdk_1.IncompleteChainRegistryError; } });
8
8
  Object.defineProperty(exports, "InvalidBlueMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidMarketParamsError; } });
9
+ Object.defineProperty(exports, "InvalidBlueVaultV2MidnightAdapterMarketsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidVaultV2MidnightAdapterMarketsError; } });
9
10
  Object.defineProperty(exports, "UnknownAddressError", { enumerable: true, get: function () { return blue_sdk_1.UnknownAddressError; } });
10
11
  Object.defineProperty(exports, "UnknownBlueDataError", { enumerable: true, get: function () { return blue_sdk_1.UnknownDataError; } });
11
12
  Object.defineProperty(exports, "UnknownBlueFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownFactory; } });
@@ -34,6 +35,7 @@ Object.defineProperty(exports, "NonTupleReturnValueError", { enumerable: true, g
34
35
  Object.defineProperty(exports, "Permit2ExpirationOutOfRangeError", { enumerable: true, get: function () { return blue_sdk_viem_1.Permit2ExpirationOutOfRangeError; } });
35
36
  Object.defineProperty(exports, "UnknownAbiFunctionError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnknownAbiFunctionError; } });
36
37
  Object.defineProperty(exports, "UnnamedAbiOutputsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnnamedAbiOutputsError; } });
38
+ Object.defineProperty(exports, "UnresolvedBlockNumberError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnresolvedBlockNumberError; } });
37
39
  Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
38
40
  var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
39
41
  Object.defineProperty(exports, "MidnightChainIdMismatchError", { enumerable: true, get: function () { return midnight_sdk_1.ChainIdMismatchError; } });
@@ -43,9 +45,6 @@ Object.defineProperty(exports, "InvalidMidnightApiQuoteTargetError", { enumerabl
43
45
  Object.defineProperty(exports, "InvalidMidnightApiResponseError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMidnightApiResponseError; } });
44
46
  Object.defineProperty(exports, "InvalidMidnightOfferGroupError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferGroupError; } });
45
47
  Object.defineProperty(exports, "InvalidMidnightOfferParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferParameterError; } });
46
- Object.defineProperty(exports, "InvalidMidnightPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
47
- Object.defineProperty(exports, "InvalidMidnightPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
48
- Object.defineProperty(exports, "InvalidMidnightPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
49
48
  Object.defineProperty(exports, "InvalidMidnightRateRatifierV1RateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1RateError; } });
50
49
  Object.defineProperty(exports, "InvalidMidnightRateRatifierV1TickError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TickError; } });
51
50
  Object.defineProperty(exports, "InvalidMidnightRateRatifierV1TimeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TimeError; } });
@@ -68,6 +67,9 @@ Object.defineProperty(exports, "_try", { enumerable: true, get: function () { re
68
67
  Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return morpho_ts_1.DivisionByZeroError; } });
69
68
  Object.defineProperty(exports, "InvalidAddressError", { enumerable: true, get: function () { return morpho_ts_1.InvalidAddressError; } });
70
69
  Object.defineProperty(exports, "InvalidBitLengthError", { enumerable: true, get: function () { return morpho_ts_1.InvalidBitLengthError; } });
70
+ Object.defineProperty(exports, "InvalidMidnightPositionAccrualStateError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionAccrualStateError; } });
71
+ Object.defineProperty(exports, "InvalidMidnightPositionAccrualTimestampError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionAccrualTimestampError; } });
72
+ Object.defineProperty(exports, "InvalidMidnightPositionLossFactorError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionLossFactorError; } });
71
73
  Object.defineProperty(exports, "NegativeValueError", { enumerable: true, get: function () { return morpho_ts_1.NegativeValueError; } });
72
74
  Object.defineProperty(exports, "RegistryValueAlreadyRegisteredError", { enumerable: true, get: function () { return morpho_ts_1.RegistryValueAlreadyRegisteredError; } });
73
75
  Object.defineProperty(exports, "RetriesExhaustedError", { enumerable: true, get: function () { return morpho_ts_1.RetriesExhaustedError; } });
@@ -1,6 +1,6 @@
1
- export { fetchAccrualPosition as fetchBlueAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket as fetchBlueMarket, fetchMarketParams as fetchBlueMarketParams, fetchPosition as fetchBluePosition,
1
+ export { fetchAccrualPosition as fetchBlueAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket as fetchBlueMarket, fetchMarketParams as fetchBlueMarketParams, fetchPosition as fetchBluePosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  fetchPreLiquidationParams as fetchBluePreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- fetchPreLiquidationPosition as fetchBluePreLiquidationPosition, fetchToken, fetchUser as fetchBlueUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
5
+ fetchPreLiquidationPosition as fetchBluePreLiquidationPosition, fetchToken, fetchUser as fetchBlueUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
6
6
  export { fetchAccrualPosition as fetchMidnightAccrualPosition, fetchMarket as fetchMidnightMarket, fetchMarketParams as fetchMidnightMarketParams, fetchPosition as fetchMidnightPosition, fetchRatifierInfo as fetchMidnightRatifierInfo, } from "@morpho-org/midnight-sdk";
package/lib/cjs/fetch.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchMidnightRatifierInfo = exports.fetchMidnightPosition = exports.fetchMidnightMarketParams = exports.fetchMidnightMarket = exports.fetchMidnightAccrualPosition = exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchBlueUser = exports.fetchToken = exports.fetchBluePreLiquidationPosition = exports.fetchBluePreLiquidationParams = exports.fetchBluePosition = exports.fetchBlueMarketParams = exports.fetchBlueMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchBlueAccrualPosition = void 0;
3
+ exports.fetchMidnightRatifierInfo = exports.fetchMidnightPosition = exports.fetchMidnightMarketParams = exports.fetchMidnightMarket = exports.fetchMidnightAccrualPosition = exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2MidnightAdapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchBlueUser = exports.fetchToken = exports.fetchBluePreLiquidationPosition = exports.fetchBluePreLiquidationParams = exports.fetchBluePosition = exports.fetchBlueMarketParams = exports.fetchBlueMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2MidnightAdapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchBlueAccrualPosition = void 0;
4
4
  var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
5
5
  Object.defineProperty(exports, "fetchBlueAccrualPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualPosition; } });
6
6
  Object.defineProperty(exports, "fetchAccrualVault", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVault; } });
7
7
  Object.defineProperty(exports, "fetchAccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2; } });
8
8
  Object.defineProperty(exports, "fetchAccrualVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2Adapter; } });
9
+ Object.defineProperty(exports, "fetchAccrualVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MidnightAdapter; } });
9
10
  Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1Adapter; } });
10
11
  Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1AdapterV2; } });
11
12
  Object.defineProperty(exports, "fetchAccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoVaultV1Adapter; } });
@@ -29,6 +30,7 @@ Object.defineProperty(exports, "fetchVaultV2Adapter", { enumerable: true, get: f
29
30
  Object.defineProperty(exports, "fetchVaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BlueMarketPublicAllocatorConfig; } });
30
31
  Object.defineProperty(exports, "fetchVaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorConfig; } });
31
32
  Object.defineProperty(exports, "fetchVaultV2BluePublicAllocatorData", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorData; } });
33
+ Object.defineProperty(exports, "fetchVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MidnightAdapter; } });
32
34
  Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1Adapter; } });
33
35
  Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1AdapterV2; } });
34
36
  Object.defineProperty(exports, "fetchVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoVaultV1Adapter; } });
@@ -156,6 +156,8 @@ function validateVaultV2DeadShares(vault, path = []) {
156
156
  return cap;
157
157
  };
158
158
  for (const adapter of vault.accrualAdapters) {
159
+ if (adapter instanceof blue_sdk_1.AccrualVaultV2MidnightAdapter)
160
+ continue;
159
161
  if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter) {
160
162
  const id = blue_sdk_1.VaultV2MorphoVaultV1Adapter.adapterCapId(adapter.address);
161
163
  if (capOf(id, adapter.address) > 0n)
@@ -1 +1,2 @@
1
- export { ChainIdMismatchError, InvalidEcrecoverSignatureVError, InvalidMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError, InvalidOfferParameterError, InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError, InvalidRateRatifierV1RateError, InvalidRateRatifierV1TickError, InvalidRateRatifierV1TimeError, InvalidRatifierV1AddressError, InvalidTickSpacingError, InvalidTreeError, InvalidTreeHeightError, InvalidTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError, PriceGreaterThanOneError, RateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError, TickOutOfRangeError, UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
1
+ export { ChainIdMismatchError, InvalidEcrecoverSignatureVError, InvalidMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError, InvalidOfferParameterError, InvalidRateRatifierV1RateError, InvalidRateRatifierV1TickError, InvalidRateRatifierV1TimeError, InvalidRatifierV1AddressError, InvalidTickSpacingError, InvalidTreeError, InvalidTreeHeightError, InvalidTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError, PriceGreaterThanOneError, RateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError, TickOutOfRangeError, UnknownCollateralIndexError, } from "@morpho-org/midnight-sdk";
2
+ export { InvalidPositionAccrualStateError, InvalidPositionAccrualTimestampError, InvalidPositionLossFactorError, } from "@morpho-org/morpho-ts";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnknownCollateralIndexError = exports.TickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.RatifierV1TakerNotAllowedError = exports.RateRatifierV1BoundOverflowError = exports.PriceGreaterThanOneError = exports.PayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidTypedDataSignatureError = exports.InvalidTreeHeightError = exports.InvalidTreeError = exports.InvalidTickSpacingError = exports.InvalidRatifierV1AddressError = exports.InvalidRateRatifierV1TimeError = exports.InvalidRateRatifierV1TickError = exports.InvalidRateRatifierV1RateError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.InvalidPositionAccrualStateError = exports.InvalidOfferParameterError = exports.InvalidOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMarketParameterError = exports.InvalidEcrecoverSignatureVError = exports.ChainIdMismatchError = void 0;
3
+ exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualTimestampError = exports.InvalidPositionAccrualStateError = exports.UnknownCollateralIndexError = exports.TickOutOfRangeError = exports.SettlementFeeExceedsPriceError = exports.RatifierV1TakerNotAllowedError = exports.RateRatifierV1BoundOverflowError = exports.PriceGreaterThanOneError = exports.PayloadDecodeError = exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidTypedDataSignatureError = exports.InvalidTreeHeightError = exports.InvalidTreeError = exports.InvalidTickSpacingError = exports.InvalidRatifierV1AddressError = exports.InvalidRateRatifierV1TimeError = exports.InvalidRateRatifierV1TickError = exports.InvalidRateRatifierV1RateError = exports.InvalidOfferParameterError = exports.InvalidOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMarketParameterError = exports.InvalidEcrecoverSignatureVError = exports.ChainIdMismatchError = void 0;
4
4
  var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
5
5
  Object.defineProperty(exports, "ChainIdMismatchError", { enumerable: true, get: function () { return midnight_sdk_1.ChainIdMismatchError; } });
6
6
  Object.defineProperty(exports, "InvalidEcrecoverSignatureVError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidEcrecoverSignatureVError; } });
@@ -9,9 +9,6 @@ Object.defineProperty(exports, "InvalidMidnightApiQuoteTargetError", { enumerabl
9
9
  Object.defineProperty(exports, "InvalidMidnightApiResponseError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMidnightApiResponseError; } });
10
10
  Object.defineProperty(exports, "InvalidOfferGroupError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferGroupError; } });
11
11
  Object.defineProperty(exports, "InvalidOfferParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferParameterError; } });
12
- Object.defineProperty(exports, "InvalidPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
13
- Object.defineProperty(exports, "InvalidPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
14
- Object.defineProperty(exports, "InvalidPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
15
12
  Object.defineProperty(exports, "InvalidRateRatifierV1RateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1RateError; } });
16
13
  Object.defineProperty(exports, "InvalidRateRatifierV1TickError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TickError; } });
17
14
  Object.defineProperty(exports, "InvalidRateRatifierV1TimeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TimeError; } });
@@ -29,3 +26,7 @@ Object.defineProperty(exports, "RatifierV1TakerNotAllowedError", { enumerable: t
29
26
  Object.defineProperty(exports, "SettlementFeeExceedsPriceError", { enumerable: true, get: function () { return midnight_sdk_1.SettlementFeeExceedsPriceError; } });
30
27
  Object.defineProperty(exports, "TickOutOfRangeError", { enumerable: true, get: function () { return midnight_sdk_1.TickOutOfRangeError; } });
31
28
  Object.defineProperty(exports, "UnknownCollateralIndexError", { enumerable: true, get: function () { return midnight_sdk_1.UnknownCollateralIndexError; } });
29
+ var morpho_ts_1 = require("@morpho-org/morpho-ts");
30
+ Object.defineProperty(exports, "InvalidPositionAccrualStateError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionAccrualStateError; } });
31
+ Object.defineProperty(exports, "InvalidPositionAccrualTimestampError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionAccrualTimestampError; } });
32
+ Object.defineProperty(exports, "InvalidPositionLossFactorError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionLossFactorError; } });
@@ -548,9 +548,9 @@ export type BundlesFundingArgs = {
548
548
  };
549
549
  /** Controls token requirements generated for a bundles-funded action. */
550
550
  export interface BundlesTokenRequirementsOptions {
551
- /** Prefer ERC-2612 when the funded token exposes a compatible nonce. */
551
+ /** Prefer ERC-2612 when the funded token exposes a compatible nonce; defaults to true when signatures are supported. */
552
552
  readonly useSimplePermit?: boolean;
553
- /** Explicit unused Permit2 SignatureTransfer unordered nonce; defaults to the lowest unused nonce. */
553
+ /** @deprecated Ignored. The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals. */
554
554
  readonly permit2Nonce?: bigint;
555
555
  }
556
556
  /** Mutually exclusive source amount accepted by a Vault V1 to Vault V2 migration. */
@@ -612,7 +612,10 @@ export interface PermitAction extends BaseAction<"permit", {
612
612
  */
613
613
  readonly typedData?: RequirementTypedData;
614
614
  }
615
- /** Signable Permit2 SignatureTransfer requirement for a fixed bundles token pull. */
615
+ /**
616
+ * Signable Permit2 SignatureTransfer requirement for a fixed bundles token pull.
617
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
618
+ */
616
619
  export interface Permit2SignatureTransferAction extends BaseAction<"permit2SignatureTransfer", {
617
620
  readonly spender: Address;
618
621
  readonly amount: bigint;
@@ -644,7 +647,10 @@ export interface Erc2612RequirementSignature {
644
647
  }
645
648
  /** A signed ERC-2612 permit requirement accepted by vault-share bundle calls. */
646
649
  export type PermitRequirementSignature = Erc2612RequirementSignature;
647
- /** A signed Permit2 SignatureTransfer requirement used by fixed bundles contracts. */
650
+ /**
651
+ * A signed Permit2 SignatureTransfer requirement used by fixed bundles contracts.
652
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
653
+ */
648
654
  export interface Permit2SignatureTransferRequirementSignature {
649
655
  readonly args: Readonly<PermitArgs>;
650
656
  readonly action: Permit2SignatureTransferAction;
@@ -874,6 +880,7 @@ export declare function isPermitSignature(signature: RequirementSignature): sign
874
880
  * const getPermit2Nonce = (signature: RequirementSignature): bigint | undefined =>
875
881
  * isPermit2SignatureTransferSignature(signature) ? signature.args.nonce : undefined;
876
882
  * ```
883
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
877
884
  */
878
885
  export declare function isPermit2SignatureTransferSignature(signature: RequirementSignature): signature is Permit2SignatureTransferRequirementSignature;
879
886
  /**
@@ -165,6 +165,7 @@ function isPermitSignature(signature) {
165
165
  * const getPermit2Nonce = (signature: RequirementSignature): bigint | undefined =>
166
166
  * isPermit2SignatureTransferSignature(signature) ? signature.args.nonce : undefined;
167
167
  * ```
168
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
168
169
  */
169
170
  function isPermit2SignatureTransferSignature(signature) {
170
171
  return signature.action.type === "permit2SignatureTransfer";
@@ -538,7 +538,10 @@ export declare class BundlesRequirementSignatureMismatchError extends Error {
538
538
  cause?: unknown;
539
539
  });
540
540
  }
541
- /** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
541
+ /**
542
+ * Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed.
543
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
544
+ */
542
545
  export declare class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
543
546
  readonly owner: Address;
544
547
  readonly nonce: bigint;
@@ -548,7 +551,10 @@ export declare class Permit2SignatureTransferNonceAlreadyUsedError extends Error
548
551
  */
549
552
  constructor(owner: Address, nonce: bigint);
550
553
  }
551
- /** Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce. */
554
+ /**
555
+ * Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce.
556
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
557
+ */
552
558
  export declare class NoUnusedPermit2NonceError extends Error {
553
559
  readonly owner: Address;
554
560
  readonly startNonce: bigint;
@@ -627,7 +627,10 @@ class BundlesRequirementSignatureMismatchError extends Error {
627
627
  }
628
628
  }
629
629
  exports.BundlesRequirementSignatureMismatchError = BundlesRequirementSignatureMismatchError;
630
- /** Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed. */
630
+ /**
631
+ * Thrown when an explicit Permit2 SignatureTransfer unordered nonce is already consumed.
632
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
633
+ */
631
634
  class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
632
635
  owner;
633
636
  nonce;
@@ -643,7 +646,10 @@ class Permit2SignatureTransferNonceAlreadyUsedError extends Error {
643
646
  }
644
647
  }
645
648
  exports.Permit2SignatureTransferNonceAlreadyUsedError = Permit2SignatureTransferNonceAlreadyUsedError;
646
- /** Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce. */
649
+ /**
650
+ * Thrown when no unused Permit2 unordered nonce exists at or after the requested start nonce.
651
+ * @deprecated The SDK no longer requests Permit2 funding; use ERC-2612 permits or ERC-20 approvals.
652
+ */
647
653
  class NoUnusedPermit2NonceError extends Error {
648
654
  owner;
649
655
  startNonce;
@@ -3,7 +3,7 @@ export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib, CapacityLimitReason,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  defaultPreLiquidationParamsRegistry as blueDefaultPreLiquidationParamsRegistry,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
- getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
6
+ getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
7
7
  export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData as getBlueAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction as BlueMetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
8
8
  export { EcrecoverRatifier as MidnightEcrecoverRatifier,
9
9
  /** @deprecated Use MidnightEcrecoverRatifier with a tagged tree. */
@@ -17,7 +17,7 @@ RatifierUtils as MidnightRatifierUtils, SetterRatifier as MidnightSetterRatifier
17
17
  /** @deprecated Use MidnightSetterRatifier with a tagged tree. */
18
18
  SetterRatifierUtils as MidnightSetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib, TickLib as MidnightTickLib, TreeUtils as MidnightTreeUtils, } from "@morpho-org/midnight-sdk";
19
19
  export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, } from "@morpho-org/morpho-ts";
20
- export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
20
+ export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, MidnightPositionLib, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
21
21
  export { validateClientChainId } from "./actions/requirements/validateClientChainId.js";
22
22
  export { addTransactionMetadata } from "./helpers/metadata.js";
23
23
  export { type PreviewVaultV2ForceWithdrawParams, previewVaultV2ForceWithdraw, type VaultV2ForceWithdrawPreview, } from "./helpers/previewVaultV2ForceWithdraw.js";
package/lib/cjs/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createHasValue = exports.createGetValue = exports.bigIntComparator = exports.MidnightTreeUtils = exports.MidnightTickLib = exports.MidnightTakeAmountsLib = exports.MidnightSetterRatifierUtils = exports.MidnightSetterRatifier = exports.MidnightRatifierUtils = exports.MidnightRatifier = exports.MidnightRateRatifierV1Utils = exports.MidnightRateRatifierV1 = exports.MidnightPriceRatifierV1Utils = exports.MidnightPriceRatifierV1 = exports.MidnightPositionUtils = exports.MidnightPayload = exports.MidnightOfferUtils = exports.MidnightOfferChainUtils = exports.MidnightMarketUtils = exports.MidnightGroupUtils = exports.eip712Digest = exports.MidnightEcrecoverRatifierUtils = exports.MidnightEcrecoverRatifier = exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.BlueMetaMorphoAction = exports.isUndecodableResultError = exports.isTransportError = exports.isContractRevertError = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getBlueAuthorizationTypedData = exports.decodeBytes32String = exports.catchRevertOnly = exports.VaultV2Utils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.BlueSharesMath = exports.MathLib = exports.BlueMarketUtils = exports.getBlueDefaultPreLiquidationParams = exports.blueDefaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.BlueAdaptiveCurveIrmLib = void 0;
4
- exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateChainId = exports.validateAccrualPosition = exports.computeMinForceWithdrawSharePrice = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.validateClientChainId = exports.values = exports.transformValue = exports.Time = exports.retryPromiseLinearBackoff = exports.mergeEntries = exports.keys = exports.isNotUndefined = exports.isNotNull = exports.isDefined = exports.hasValue = exports.getValue = exports.getSubdomainBaseUrl = exports.getLastDefined = exports.getLast = exports.fromEntries = exports.filterDefined = exports.entries = exports.deepFreeze = void 0;
3
+ exports.createGetValue = exports.bigIntComparator = exports.MidnightTreeUtils = exports.MidnightTickLib = exports.MidnightTakeAmountsLib = exports.MidnightSetterRatifierUtils = exports.MidnightSetterRatifier = exports.MidnightRatifierUtils = exports.MidnightRatifier = exports.MidnightRateRatifierV1Utils = exports.MidnightRateRatifierV1 = exports.MidnightPriceRatifierV1Utils = exports.MidnightPriceRatifierV1 = exports.MidnightPositionUtils = exports.MidnightPayload = exports.MidnightOfferUtils = exports.MidnightOfferChainUtils = exports.MidnightMarketUtils = exports.MidnightGroupUtils = exports.eip712Digest = exports.MidnightEcrecoverRatifierUtils = exports.MidnightEcrecoverRatifier = exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.BlueMetaMorphoAction = exports.isUndecodableResultError = exports.isTransportError = exports.isContractRevertError = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getBlueAuthorizationTypedData = exports.decodeBytes32String = exports.catchRevertOnly = exports.VaultV2Utils = exports.VaultV2MidnightAdapterUtils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.BlueSharesMath = exports.MathLib = exports.BlueMarketUtils = exports.getBlueDefaultPreLiquidationParams = exports.blueDefaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.BlueAdaptiveCurveIrmLib = void 0;
4
+ exports.resolveVaultV2ForceWithdrawEligibility = exports.computeVaultV2ForceWithdrawSharesBurnt = exports.computeVaultV2ForceWithdrawPlan = exports.computeVaultV2ForceWithdrawMinSharesBurnt = exports.computeVaultV2ForceWithdrawFeeSharesMinted = exports.validateUserAddress = exports.validateSlippageTolerance = exports.validateRepayShares = exports.validateRepayAmount = exports.validatePositionHealthAfterWithdraw = exports.validatePositionHealth = exports.validateNativeAsset = exports.validateChainId = exports.validateAccrualPosition = exports.computeMinForceWithdrawSharePrice = exports.previewVaultV2InKindRedeem = exports.previewVaultV2ForceWithdraw = exports.addTransactionMetadata = exports.validateClientChainId = exports.values = exports.transformValue = exports.Time = exports.retryPromiseLinearBackoff = exports.mergeEntries = exports.MidnightPositionLib = exports.keys = exports.isNotUndefined = exports.isNotNull = exports.isDefined = exports.hasValue = exports.getValue = exports.getSubdomainBaseUrl = exports.getLastDefined = exports.getLast = exports.fromEntries = exports.filterDefined = exports.entries = exports.deepFreeze = exports.createHasValue = void 0;
5
5
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
6
6
  Object.defineProperty(exports, "BlueAdaptiveCurveIrmLib", { enumerable: true, get: function () { return blue_sdk_1.AdaptiveCurveIrmLib; } });
7
7
  Object.defineProperty(exports, "CapacityLimitReason", { enumerable: true, get: function () { return blue_sdk_1.CapacityLimitReason; } });
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "BlueSharesMath", { enumerable: true, get: functi
15
15
  Object.defineProperty(exports, "VaultUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultUtils; } });
16
16
  Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfigUtils; } });
17
17
  Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils; } });
18
+ Object.defineProperty(exports, "VaultV2MidnightAdapterUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MidnightAdapterUtils; } });
18
19
  Object.defineProperty(exports, "VaultV2Utils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Utils; } });
19
20
  var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
20
21
  Object.defineProperty(exports, "catchRevertOnly", { enumerable: true, get: function () { return blue_sdk_viem_1.catchRevertOnly; } });
@@ -76,6 +77,7 @@ Object.defineProperty(exports, "isDefined", { enumerable: true, get: function ()
76
77
  Object.defineProperty(exports, "isNotNull", { enumerable: true, get: function () { return morpho_ts_1.isNotNull; } });
77
78
  Object.defineProperty(exports, "isNotUndefined", { enumerable: true, get: function () { return morpho_ts_1.isNotUndefined; } });
78
79
  Object.defineProperty(exports, "keys", { enumerable: true, get: function () { return morpho_ts_1.keys; } });
80
+ Object.defineProperty(exports, "MidnightPositionLib", { enumerable: true, get: function () { return morpho_ts_1.MidnightPositionLib; } });
79
81
  Object.defineProperty(exports, "mergeEntries", { enumerable: true, get: function () { return morpho_ts_1.mergeEntries; } });
80
82
  Object.defineProperty(exports, "retryPromiseLinearBackoff", { enumerable: true, get: function () { return morpho_ts_1.retryPromiseLinearBackoff; } });
81
83
  Object.defineProperty(exports, "Time", { enumerable: true, get: function () { return morpho_ts_1.Time; } });
package/lib/esm/abis.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { marketParamsAbi as blueMarketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
2
+ export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, midnightAdapterAbi, midnightAdapterFactoryAbi, midnightAdapterPriceRatifierV1Abi, midnightAdapterRateRatifierV1Abi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  preLiquidationAbi as bluePreLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
package/lib/esm/abis.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { marketParamsAbi as blueMarketParamsAbi } from "@morpho-org/blue-sdk";
2
- export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
2
+ export { adaptiveCurveIrmAbi as blueAdaptiveCurveIrmAbi, blueAbi, blueOracleAbi, erc2612Abi, erc3643Abi, erc3643IdentityRegistryAbi, erc5267Abi, metaMorphoAbi, metaMorphoFactoryAbi, midnightAdapterAbi, midnightAdapterFactoryAbi, midnightAdapterPriceRatifierV1Abi, midnightAdapterRateRatifierV1Abi, morphoMarketV1AdapterAbi, morphoMarketV1AdapterFactoryAbi, morphoMarketV1AdapterV2Abi, morphoMarketV1AdapterV2FactoryAbi, morphoVaultV1AdapterAbi, morphoVaultV1AdapterFactoryAbi, permissionedErc20WrapperAbi, permit2Abi,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  preLiquidationAbi as bluePreLiquidationAbi,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */