@morpho-org/morpho-sdk 9.0.0 → 9.1.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 (90) hide show
  1. package/README.md +3 -1
  2. package/lib/cjs/actions/blue/borrow.d.ts +1 -0
  3. package/lib/cjs/actions/blue/borrow.js +1 -0
  4. package/lib/cjs/actions/blue/refinance.d.ts +1 -0
  5. package/lib/cjs/actions/blue/refinance.js +3 -0
  6. package/lib/cjs/actions/blue/repay.d.ts +1 -0
  7. package/lib/cjs/actions/blue/repay.js +1 -0
  8. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +1 -0
  9. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -0
  10. package/lib/cjs/actions/blue/supply.d.ts +1 -0
  11. package/lib/cjs/actions/blue/supply.js +2 -0
  12. package/lib/cjs/actions/blue/supplyCollateral.d.ts +1 -0
  13. package/lib/cjs/actions/blue/supplyCollateral.js +1 -0
  14. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +1 -0
  15. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +2 -0
  16. package/lib/cjs/actions/blue/withdraw.d.ts +1 -0
  17. package/lib/cjs/actions/blue/withdraw.js +2 -0
  18. package/lib/cjs/actions/blue/withdrawCollateral.d.ts +1 -0
  19. package/lib/cjs/actions/blue/withdrawCollateral.js +1 -0
  20. package/lib/cjs/actions/midnight/takeLend.d.ts +1 -0
  21. package/lib/cjs/actions/midnight/takeLend.js +1 -0
  22. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -0
  23. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +1 -0
  24. package/lib/cjs/blue/errors.d.ts +1 -1
  25. package/lib/cjs/blue/errors.js +2 -1
  26. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  27. package/lib/cjs/client/morphoViemExtension.js +1 -7
  28. package/lib/cjs/entities/blue/blue.d.ts +43 -7
  29. package/lib/cjs/entities/blue/blue.js +27 -3
  30. package/lib/cjs/entities/midnight/midnight.d.ts +14 -6
  31. package/lib/cjs/entities/midnight/midnight.js +14 -6
  32. package/lib/cjs/entities/midnight/types.d.ts +9 -2
  33. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +3 -1
  34. package/lib/cjs/entities/vaultV2/vaultV2.js +8 -5
  35. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +40 -13
  36. package/lib/cjs/entities/vaultV2BlueReallocationData.js +207 -70
  37. package/lib/cjs/errors.d.ts +1 -1
  38. package/lib/cjs/errors.js +3 -2
  39. package/lib/cjs/helpers/validate.d.ts +11 -1
  40. package/lib/cjs/helpers/validate.js +17 -1
  41. package/lib/cjs/helpers/validateTakeableOffers.d.ts +4 -2
  42. package/lib/cjs/helpers/validateTakeableOffers.js +12 -1
  43. package/lib/cjs/types/error.d.ts +10 -1
  44. package/lib/cjs/types/error.js +13 -2
  45. package/lib/cjs/types/sharedLiquidity.d.ts +27 -11
  46. package/lib/esm/actions/blue/borrow.d.ts +1 -0
  47. package/lib/esm/actions/blue/borrow.js +1 -0
  48. package/lib/esm/actions/blue/refinance.d.ts +1 -0
  49. package/lib/esm/actions/blue/refinance.js +4 -1
  50. package/lib/esm/actions/blue/repay.d.ts +1 -0
  51. package/lib/esm/actions/blue/repay.js +1 -0
  52. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +1 -0
  53. package/lib/esm/actions/blue/repayWithdrawCollateral.js +3 -1
  54. package/lib/esm/actions/blue/supply.d.ts +1 -0
  55. package/lib/esm/actions/blue/supply.js +3 -1
  56. package/lib/esm/actions/blue/supplyCollateral.d.ts +1 -0
  57. package/lib/esm/actions/blue/supplyCollateral.js +1 -0
  58. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +1 -0
  59. package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -1
  60. package/lib/esm/actions/blue/withdraw.d.ts +1 -0
  61. package/lib/esm/actions/blue/withdraw.js +3 -1
  62. package/lib/esm/actions/blue/withdrawCollateral.d.ts +1 -0
  63. package/lib/esm/actions/blue/withdrawCollateral.js +1 -0
  64. package/lib/esm/actions/midnight/takeLend.d.ts +1 -0
  65. package/lib/esm/actions/midnight/takeLend.js +1 -0
  66. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +1 -0
  67. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +1 -0
  68. package/lib/esm/blue/errors.d.ts +1 -1
  69. package/lib/esm/blue/errors.js +1 -1
  70. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  71. package/lib/esm/client/morphoViemExtension.js +1 -7
  72. package/lib/esm/entities/blue/blue.d.ts +43 -7
  73. package/lib/esm/entities/blue/blue.js +27 -3
  74. package/lib/esm/entities/midnight/midnight.d.ts +14 -6
  75. package/lib/esm/entities/midnight/midnight.js +14 -6
  76. package/lib/esm/entities/midnight/types.d.ts +9 -2
  77. package/lib/esm/entities/vaultV2/vaultV2.d.ts +3 -1
  78. package/lib/esm/entities/vaultV2/vaultV2.js +9 -6
  79. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +40 -13
  80. package/lib/esm/entities/vaultV2BlueReallocationData.js +208 -71
  81. package/lib/esm/errors.d.ts +1 -1
  82. package/lib/esm/errors.js +1 -1
  83. package/lib/esm/helpers/validate.d.ts +11 -1
  84. package/lib/esm/helpers/validate.js +15 -0
  85. package/lib/esm/helpers/validateTakeableOffers.d.ts +4 -2
  86. package/lib/esm/helpers/validateTakeableOffers.js +13 -2
  87. package/lib/esm/types/error.d.ts +10 -1
  88. package/lib/esm/types/error.js +11 -1
  89. package/lib/esm/types/sharedLiquidity.d.ts +27 -11
  90. package/package.json +4 -4
@@ -5,12 +5,15 @@ export interface VaultV2BluePublicAllocatorOptions {
5
5
  /** Whether Vault V2 public allocator discovery is enabled. */
6
6
  readonly enabled?: boolean;
7
7
  /**
8
- * Timestamp at which market and Vault V2 state is evaluated. Canonical state
9
- * and the returned post-state stay at this timestamp; only target-market cap
10
- * checks reserve interest on the vault's existing allocation through this
11
- * timestamp plus `capAccrualBuffer`. For market-source reallocations the
12
- * source position's interest is also reserved on cap ids shared with the
13
- * target, and reserves persist across every leg of a plan.
8
+ * Timestamp at which market and Vault V2 state is evaluated. Defaults to the
9
+ * snapshot's timestamp (the fetched block's timestamp), never earlier than
10
+ * the latest market/vault `lastUpdate`; when the snapshot has no timestamp,
11
+ * defaults to the latest market/vault `lastUpdate`. Canonical state and the
12
+ * returned post-state stay at this timestamp; only target-market cap checks
13
+ * reserve interest on the vault's existing allocation through this timestamp
14
+ * plus `capAccrualBuffer`. For market-source reallocations the source
15
+ * position's interest is also reserved on cap ids shared with the target, and
16
+ * reserves persist across every leg of a plan.
14
17
  */
15
18
  readonly timestamp?: BigIntish;
16
19
  /**
@@ -53,16 +56,29 @@ export interface VaultV2BluePublicAllocatorOptions {
53
56
  readonly reallocatableVaults?: Iterable<Address>;
54
57
  /**
55
58
  * Maximum utilization source markets may reach during friendly discovery,
56
- * scaled by WAD. The amount-aware planner falls back to 100% only when the
57
- * friendly phase cannot cover the operation's absolute shortfall.
59
+ * scaled by WAD. Within each penalty tier, the amount-aware planner falls
60
+ * back to 100% only when that tier's friendly pass leaves an absolute
61
+ * shortfall.
58
62
  *
59
63
  * @default 90% (900000000000000000n)
60
64
  */
61
65
  readonly maxWithdrawalUtilization?: bigint;
62
66
  /**
63
- * Maximum proportional vault-asset penalty accepted for each
64
- * BluePublicAllocator call, scaled by WAD. Vaults with a higher configured
65
- * penalty are ignored. Must not exceed WAD (100%).
67
+ * Maximum proportional vault-asset penalty accepted per call, scaled by
68
+ * WAD; higher-penalty vaults are ignored. Must not exceed WAD. Operation
69
+ * plans consider penalty tiers ascending, free first. Each tier uses friendly
70
+ * source utilization (90% by default) before 100%; positive tiers cover only
71
+ * the remaining absolute shortfall. Free capacity inside
72
+ * `allocatorCapHeadroom` stays unused, so a penalized leg can cover it.
73
+ * Getters count all vaults up to this limit. For `refinance`, compute the
74
+ * plan on the destination-market handle (for example,
75
+ * `client.morpho.blue(destination.marketParams, chainId)`), not the source
76
+ * handle. Pass the source position's `borrowAssets` accrued to
77
+ * `max(now, source.lastUpdate, destination.lastUpdate) + 2h` as
78
+ * `operation.amount`; the optional `operation.referralFeePct` is WAD-scaled.
79
+ * The planner includes the referral fee and its own allocator-leg penalties
80
+ * in destination debt, so penalized legs also cover their own penalty.
81
+ * Refinance never uses vaults with a 100% penalty.
66
82
  *
67
83
  * @default 0n
68
84
  */
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.0.0",
4
+ "version": "9.1.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -153,9 +153,9 @@
153
153
  "MIGRATION-v8-to-v9.md"
154
154
  ],
155
155
  "dependencies": {
156
- "@morpho-org/blue-sdk": "^8.0.1",
157
- "@morpho-org/blue-sdk-viem": "^7.0.0",
158
- "@morpho-org/midnight-sdk": "^2.2.0",
156
+ "@morpho-org/blue-sdk": "^8.0.2",
157
+ "@morpho-org/blue-sdk-viem": "^7.1.0",
158
+ "@morpho-org/midnight-sdk": "^2.2.1",
159
159
  "@morpho-org/morpho-ts": "^4.1.0"
160
160
  },
161
161
  "peerDependencies": {