@morpho-org/morpho-sdk 9.3.0-next.0 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +6 -4
  2. package/lib/cjs/abis.d.ts +2 -2
  3. package/lib/cjs/abis.js +4 -5
  4. package/lib/cjs/actions/blue/index.d.ts +1 -0
  5. package/lib/cjs/actions/blue/index.js +1 -0
  6. package/lib/cjs/actions/blue/withdrawBuyCallback.d.ts +60 -0
  7. package/lib/cjs/actions/blue/withdrawBuyCallback.js +79 -0
  8. package/lib/cjs/blue/abis.d.ts +1 -1
  9. package/lib/cjs/blue/abis.js +3 -5
  10. package/lib/cjs/blue/entities.d.ts +4 -4
  11. package/lib/cjs/blue/entities.js +1 -3
  12. package/lib/cjs/blue/errors.d.ts +2 -2
  13. package/lib/cjs/blue/errors.js +1 -5
  14. package/lib/cjs/blue/fetch.d.ts +2 -2
  15. package/lib/cjs/blue/fetch.js +1 -3
  16. package/lib/cjs/blue/utils.d.ts +1 -1
  17. package/lib/cjs/blue/utils.js +1 -2
  18. package/lib/cjs/entities/blue/blue.d.ts +85 -9
  19. package/lib/cjs/entities/blue/blue.js +85 -3
  20. package/lib/cjs/entities/index.d.ts +4 -4
  21. package/lib/cjs/entities/index.js +1 -3
  22. package/lib/cjs/entities/midnight/midnight.d.ts +1 -2
  23. package/lib/cjs/entities/midnight/midnight.js +4 -5
  24. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +5 -4
  25. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +15 -12
  26. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +0 -8
  27. package/lib/cjs/entities/vaultV1/vaultV1.js +0 -4
  28. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +9 -37
  29. package/lib/cjs/entities/vaultV2/vaultV2.js +1 -36
  30. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +3 -5
  31. package/lib/cjs/entities/vaultV2BlueReallocationData.js +3 -9
  32. package/lib/cjs/errors.d.ts +4 -4
  33. package/lib/cjs/errors.js +7 -10
  34. package/lib/cjs/fetch.d.ts +2 -2
  35. package/lib/cjs/fetch.js +1 -3
  36. package/lib/cjs/helpers/deadShares.d.ts +5 -4
  37. package/lib/cjs/helpers/deadShares.js +5 -6
  38. package/lib/cjs/midnight/abis.d.ts +1 -1
  39. package/lib/cjs/midnight/abis.js +2 -1
  40. package/lib/cjs/midnight/errors.d.ts +1 -2
  41. package/lib/cjs/midnight/errors.js +4 -5
  42. package/lib/cjs/types/action.d.ts +15 -1
  43. package/lib/cjs/types/error.d.ts +35 -6
  44. package/lib/cjs/types/error.js +42 -7
  45. package/lib/cjs/utils.d.ts +2 -2
  46. package/lib/cjs/utils.js +2 -4
  47. package/lib/esm/abis.d.ts +2 -2
  48. package/lib/esm/abis.js +2 -2
  49. package/lib/esm/actions/blue/index.d.ts +1 -0
  50. package/lib/esm/actions/blue/index.js +1 -0
  51. package/lib/esm/actions/blue/withdrawBuyCallback.d.ts +60 -0
  52. package/lib/esm/actions/blue/withdrawBuyCallback.js +75 -0
  53. package/lib/esm/blue/abis.d.ts +1 -1
  54. package/lib/esm/blue/abis.js +1 -1
  55. package/lib/esm/blue/entities.d.ts +4 -4
  56. package/lib/esm/blue/entities.js +2 -2
  57. package/lib/esm/blue/errors.d.ts +2 -2
  58. package/lib/esm/blue/errors.js +2 -2
  59. package/lib/esm/blue/fetch.d.ts +2 -2
  60. package/lib/esm/blue/fetch.js +2 -2
  61. package/lib/esm/blue/utils.d.ts +1 -1
  62. package/lib/esm/blue/utils.js +1 -1
  63. package/lib/esm/entities/blue/blue.d.ts +85 -9
  64. package/lib/esm/entities/blue/blue.js +87 -5
  65. package/lib/esm/entities/index.d.ts +4 -4
  66. package/lib/esm/entities/index.js +2 -2
  67. package/lib/esm/entities/midnight/midnight.d.ts +1 -2
  68. package/lib/esm/entities/midnight/midnight.js +5 -6
  69. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +5 -4
  70. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +15 -12
  71. package/lib/esm/entities/vaultV1/vaultV1.d.ts +0 -8
  72. package/lib/esm/entities/vaultV1/vaultV1.js +0 -4
  73. package/lib/esm/entities/vaultV2/vaultV2.d.ts +9 -37
  74. package/lib/esm/entities/vaultV2/vaultV2.js +1 -36
  75. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +3 -5
  76. package/lib/esm/entities/vaultV2BlueReallocationData.js +3 -9
  77. package/lib/esm/errors.d.ts +4 -4
  78. package/lib/esm/errors.js +4 -4
  79. package/lib/esm/fetch.d.ts +2 -2
  80. package/lib/esm/fetch.js +2 -2
  81. package/lib/esm/helpers/deadShares.d.ts +5 -4
  82. package/lib/esm/helpers/deadShares.js +6 -7
  83. package/lib/esm/midnight/abis.d.ts +1 -1
  84. package/lib/esm/midnight/abis.js +1 -1
  85. package/lib/esm/midnight/errors.d.ts +1 -2
  86. package/lib/esm/midnight/errors.js +1 -2
  87. package/lib/esm/types/action.d.ts +15 -1
  88. package/lib/esm/types/error.d.ts +35 -6
  89. package/lib/esm/types/error.js +36 -6
  90. package/lib/esm/utils.d.ts +2 -2
  91. package/lib/esm/utils.js +2 -2
  92. package/package.json +6 -6
@@ -1585,12 +1585,7 @@ export class MidnightOfferCallbackDataMismatchError extends Error {
1585
1585
  this.name = "MidnightOfferCallbackDataMismatchError";
1586
1586
  }
1587
1587
  }
1588
- /**
1589
- * Thrown when loan assets would be parked in a Morpho Blue market with no existing supply.
1590
- *
1591
- * @deprecated `supplyBlueMakeLend` now throws `InsufficientDeadSharesError` or
1592
- * `MissingDeadSharesDataError` instead; kept exported so existing `instanceof` checks compile.
1593
- */
1588
+ /** Thrown when loan assets would be parked in a Morpho Blue market with no existing supply. */
1594
1589
  export class EmptyBlueParkingMarketError extends Error {
1595
1590
  constructor(params) {
1596
1591
  super(`Morpho Blue market "${params.marketId}" has no supply shares. Parking assets in an empty market is exposed to supply-share-price inflation; choose a market with existing supply.`);
@@ -1776,6 +1771,41 @@ export class WithdrawSharesExceedSupplyError extends Error {
1776
1771
  this.name = "WithdrawSharesExceedSupplyError";
1777
1772
  }
1778
1773
  }
1774
+ /** Thrown when a Blue withdrawal finds no supply shares to withdraw for the position owner. */
1775
+ export class EmptyBlueSupplyPositionError extends Error {
1776
+ constructor(params) {
1777
+ super(`Supply position of "${params.user}" is empty on market "${params.market}". Refresh the position data or skip the withdrawal.`);
1778
+ this.name = "EmptyBlueSupplyPositionError";
1779
+ }
1780
+ }
1781
+ /** Thrown when a Blue withdrawal needs more assets than the market's available liquidity. */
1782
+ export class InsufficientBlueLiquidityError extends Error {
1783
+ constructor(params) {
1784
+ super(`Blue liquidity is insufficient on market "${params.market}": assets "${params.assets}", liquidity "${params.liquidity}". Try again when liquidity returns.`);
1785
+ this.name = "InsufficientBlueLiquidityError";
1786
+ }
1787
+ }
1788
+ /** Thrown when an address is not a BlueBuyCallback created by the chain's registered factory. */
1789
+ export class NotBlueBuyCallbackError extends Error {
1790
+ constructor(callback) {
1791
+ super(`Address "${callback}" is not a BlueBuyCallback created by the registered factory. Pass a callback created by midnightBlueBuyCallbackFactory.`);
1792
+ this.name = "NotBlueBuyCallbackError";
1793
+ }
1794
+ }
1795
+ /** Thrown when a BlueBuyCallback's `OWNER()` is not the account withdrawing its Blue position. */
1796
+ export class BlueBuyCallbackOwnerMismatchError extends Error {
1797
+ constructor(params) {
1798
+ super(`BlueBuyCallback "${params.callback}" is owned by "${params.owner}", not "${params.userAddress}". Withdraw from the owner's account.`);
1799
+ this.name = "BlueBuyCallbackOwnerMismatchError";
1800
+ }
1801
+ }
1802
+ /** Thrown when Morpho Blue does not authorize an account to withdraw a BlueBuyCallback's position. */
1803
+ export class BlueBuyCallbackUnauthorizedError extends Error {
1804
+ constructor(params) {
1805
+ super(`"${params.userAddress}" is not authorized on Morpho Blue to withdraw for BlueBuyCallback "${params.callback}". Call setAuthorization on the callback from its owner, then retry.`);
1806
+ this.name = "BlueBuyCallbackUnauthorizedError";
1807
+ }
1808
+ }
1779
1809
  /**
1780
1810
  * Thrown when a Vault V2 reallocation planner receives a withdraw `amount` greater
1781
1811
  * than the target market's current `totalSupplyAssets` — the post-withdraw
@@ -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, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
6
+ getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, 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, MidnightPositionLib, 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, 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/esm/utils.js CHANGED
@@ -2,7 +2,7 @@ export { AdaptiveCurveIrmLib as BlueAdaptiveCurveIrmLib, CapacityLimitReason,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  defaultPreLiquidationParamsRegistry as blueDefaultPreLiquidationParamsRegistry,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
5
+ getDefaultPreLiquidationParams as getBlueDefaultPreLiquidationParams, MarketUtils as BlueMarketUtils, MathLib, SharesMath as BlueSharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
6
6
  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";
7
7
  export { EcrecoverRatifier as MidnightEcrecoverRatifier,
8
8
  /** @deprecated Use MidnightEcrecoverRatifier with a tagged tree. */
@@ -15,7 +15,7 @@ RateRatifierV1Utils as MidnightRateRatifierV1Utils, Ratifier as MidnightRatifier
15
15
  RatifierUtils as MidnightRatifierUtils, SetterRatifier as MidnightSetterRatifier,
16
16
  /** @deprecated Use MidnightSetterRatifier with a tagged tree. */
17
17
  SetterRatifierUtils as MidnightSetterRatifierUtils, TakeAmountsLib as MidnightTakeAmountsLib, TickLib as MidnightTickLib, TreeUtils as MidnightTreeUtils, } from "@morpho-org/midnight-sdk";
18
- 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";
18
+ 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";
19
19
  export { validateClientChainId } from "./actions/requirements/validateClientChainId.js";
20
20
  export { addTransactionMetadata } from "./helpers/metadata.js";
21
21
  export { previewVaultV2ForceWithdraw, } from "./helpers/previewVaultV2ForceWithdraw.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/morpho-sdk",
3
3
  "description": "Abstraction layer for Morpho's complexity.",
4
- "version": "9.3.0-next.0",
4
+ "version": "9.4.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -154,17 +154,17 @@
154
154
  "DEAD-SHARE-PROTECTION.md"
155
155
  ],
156
156
  "dependencies": {
157
- "@morpho-org/blue-sdk": "^8.2.0-next.0",
158
- "@morpho-org/blue-sdk-viem": "^7.3.0-next.0",
159
- "@morpho-org/midnight-sdk": "^2.4.0-next.0",
160
- "@morpho-org/morpho-ts": "^4.2.0-next.1"
157
+ "@morpho-org/blue-sdk": "^8.2.0",
158
+ "@morpho-org/blue-sdk-viem": "^7.3.0",
159
+ "@morpho-org/midnight-sdk": "^2.4.0",
160
+ "@morpho-org/morpho-ts": "^4.2.0"
161
161
  },
162
162
  "peerDependencies": {
163
163
  "viem": "^2.0.0"
164
164
  },
165
165
  "devDependencies": {
166
166
  "@morpho-org/morpho-test": "^4.2.0",
167
- "@morpho-org/test": "^2.13.0-next.0",
167
+ "@morpho-org/test": "^2.12.0",
168
168
  "fast-check": "^4.9.0",
169
169
  "typescript": "7.0.2",
170
170
  "viem": "^2.55.10",