@morpho-org/morpho-sdk 5.5.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +11 -7
  2. package/lib/cjs/abis.d.ts +15 -3
  3. package/lib/cjs/abis.js +15 -1
  4. package/lib/cjs/actions/blue/borrow.d.ts +21 -15
  5. package/lib/cjs/actions/blue/borrow.js +25 -18
  6. package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +1 -1
  7. package/lib/cjs/actions/blue/buildAssetFundingActions.js +1 -1
  8. package/lib/cjs/actions/blue/buildReallocationActions.d.ts +62 -19
  9. package/lib/cjs/actions/blue/buildReallocationActions.js +123 -27
  10. package/lib/cjs/actions/blue/refinance.d.ts +14 -7
  11. package/lib/cjs/actions/blue/refinance.js +18 -10
  12. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +28 -19
  13. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +39 -23
  14. package/lib/cjs/actions/blue/withdraw.d.ts +20 -13
  15. package/lib/cjs/actions/blue/withdraw.js +23 -18
  16. package/lib/cjs/actions/midnight/mempoolSubmitOffers.d.ts +2 -2
  17. package/lib/cjs/actions/midnight/mempoolSubmitOffers.js +2 -2
  18. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
  19. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
  20. package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -1
  21. package/lib/cjs/blue/abis.d.ts +2 -0
  22. package/lib/cjs/blue/abis.js +33 -0
  23. package/lib/cjs/blue/addresses.d.ts +2 -0
  24. package/lib/cjs/blue/addresses.js +19 -0
  25. package/lib/cjs/blue/constants.d.ts +1 -0
  26. package/lib/cjs/blue/constants.js +13 -0
  27. package/lib/cjs/blue/entities.d.ts +2 -0
  28. package/lib/cjs/blue/entities.js +37 -0
  29. package/lib/cjs/blue/errors.d.ts +2 -0
  30. package/lib/cjs/blue/errors.js +29 -0
  31. package/lib/cjs/blue/fetch.d.ts +1 -0
  32. package/lib/cjs/blue/fetch.js +33 -0
  33. package/lib/cjs/blue/types.d.ts +2 -0
  34. package/lib/cjs/blue/types.js +2 -0
  35. package/lib/cjs/blue/utils.d.ts +3 -0
  36. package/lib/cjs/blue/utils.js +29 -0
  37. package/lib/cjs/bundler/actions.d.ts +122 -3
  38. package/lib/cjs/bundler/actions.js +216 -7
  39. package/lib/cjs/bundler/types.d.ts +20 -0
  40. package/lib/cjs/constants.d.ts +37 -3
  41. package/lib/cjs/constants.js +41 -1
  42. package/lib/cjs/entities/blue/blue.d.ts +362 -71
  43. package/lib/cjs/entities/blue/blue.js +286 -52
  44. package/lib/cjs/entities/index.d.ts +64 -4
  45. package/lib/cjs/entities/index.js +37 -22
  46. package/lib/cjs/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
  47. package/lib/cjs/entities/{reallocationData.js → vaultV1ReallocationData.js} +29 -16
  48. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +1 -1
  49. package/lib/cjs/entities/vaultV2/vaultV2.js +1 -1
  50. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +511 -0
  51. package/lib/cjs/entities/vaultV2BlueReallocationData.js +1300 -0
  52. package/lib/cjs/errors.d.ts +48 -3
  53. package/lib/cjs/errors.js +62 -1
  54. package/lib/cjs/fetch.d.ts +16 -1
  55. package/lib/cjs/fetch.js +24 -1
  56. package/lib/{esm/helpers/computeReallocations.d.ts → cjs/helpers/computeVaultV1Reallocations.d.ts} +14 -8
  57. package/lib/cjs/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +27 -13
  58. package/lib/cjs/helpers/constant.d.ts +5 -3
  59. package/lib/cjs/helpers/constant.js +6 -4
  60. package/lib/cjs/helpers/index.d.ts +2 -2
  61. package/lib/cjs/helpers/index.js +6 -3
  62. package/lib/cjs/helpers/validate.d.ts +32 -16
  63. package/lib/cjs/helpers/validate.js +142 -29
  64. package/lib/cjs/midnight/abis.d.ts +1 -0
  65. package/lib/cjs/midnight/abis.js +8 -0
  66. package/lib/cjs/midnight/constants.d.ts +1 -0
  67. package/lib/cjs/midnight/constants.js +19 -0
  68. package/lib/cjs/midnight/entities.d.ts +2 -0
  69. package/lib/cjs/midnight/entities.js +11 -0
  70. package/lib/cjs/midnight/errors.d.ts +1 -0
  71. package/lib/cjs/midnight/errors.js +24 -0
  72. package/lib/cjs/midnight/fetch.d.ts +1 -0
  73. package/lib/cjs/midnight/fetch.js +9 -0
  74. package/lib/cjs/midnight/types.d.ts +1 -0
  75. package/lib/cjs/midnight/types.js +2 -0
  76. package/lib/cjs/midnight/utils.d.ts +1 -0
  77. package/lib/cjs/midnight/utils.js +17 -0
  78. package/lib/cjs/types/action.d.ts +12 -0
  79. package/lib/cjs/types/error.d.ts +224 -5
  80. package/lib/cjs/types/error.js +269 -7
  81. package/lib/cjs/types/sharedLiquidity.d.ts +72 -8
  82. package/lib/cjs/types.d.ts +17 -2
  83. package/lib/cjs/utils.d.ts +31 -4
  84. package/lib/cjs/utils.js +44 -4
  85. package/lib/esm/abis.d.ts +15 -3
  86. package/lib/esm/abis.js +15 -3
  87. package/lib/esm/actions/blue/borrow.d.ts +21 -15
  88. package/lib/esm/actions/blue/borrow.js +26 -19
  89. package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +1 -1
  90. package/lib/esm/actions/blue/buildAssetFundingActions.js +1 -1
  91. package/lib/esm/actions/blue/buildReallocationActions.d.ts +62 -19
  92. package/lib/esm/actions/blue/buildReallocationActions.js +119 -25
  93. package/lib/esm/actions/blue/refinance.d.ts +14 -7
  94. package/lib/esm/actions/blue/refinance.js +19 -11
  95. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +28 -19
  96. package/lib/esm/actions/blue/supplyCollateralBorrow.js +40 -24
  97. package/lib/esm/actions/blue/withdraw.d.ts +20 -13
  98. package/lib/esm/actions/blue/withdraw.js +24 -19
  99. package/lib/esm/actions/midnight/mempoolSubmitOffers.d.ts +2 -2
  100. package/lib/esm/actions/midnight/mempoolSubmitOffers.js +2 -2
  101. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +1 -1
  102. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +1 -1
  103. package/lib/esm/actions/requirements/getRequirementsApproval.js +2 -1
  104. package/lib/esm/blue/abis.d.ts +2 -0
  105. package/lib/esm/blue/abis.js +2 -0
  106. package/lib/esm/blue/addresses.d.ts +2 -0
  107. package/lib/esm/blue/addresses.js +1 -0
  108. package/lib/esm/blue/constants.d.ts +1 -0
  109. package/lib/esm/blue/constants.js +1 -0
  110. package/lib/esm/blue/entities.d.ts +2 -0
  111. package/lib/esm/blue/entities.js +1 -0
  112. package/lib/esm/blue/errors.d.ts +2 -0
  113. package/lib/esm/blue/errors.js +2 -0
  114. package/lib/esm/blue/fetch.d.ts +1 -0
  115. package/lib/esm/blue/fetch.js +1 -0
  116. package/lib/esm/blue/types.d.ts +2 -0
  117. package/lib/esm/blue/types.js +1 -0
  118. package/lib/esm/blue/utils.d.ts +3 -0
  119. package/lib/esm/blue/utils.js +2 -0
  120. package/lib/esm/bundler/actions.d.ts +122 -3
  121. package/lib/esm/bundler/actions.js +219 -10
  122. package/lib/esm/bundler/types.d.ts +20 -0
  123. package/lib/esm/constants.d.ts +37 -3
  124. package/lib/esm/constants.js +37 -3
  125. package/lib/esm/entities/blue/blue.d.ts +362 -71
  126. package/lib/esm/entities/blue/blue.js +289 -55
  127. package/lib/esm/entities/index.d.ts +64 -4
  128. package/lib/esm/entities/index.js +19 -3
  129. package/lib/esm/entities/{reallocationData.d.ts → vaultV1ReallocationData.d.ts} +40 -15
  130. package/lib/esm/entities/{reallocationData.js → vaultV1ReallocationData.js} +32 -14
  131. package/lib/esm/entities/vaultV2/vaultV2.d.ts +1 -1
  132. package/lib/esm/entities/vaultV2/vaultV2.js +1 -1
  133. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +511 -0
  134. package/lib/esm/entities/vaultV2BlueReallocationData.js +1296 -0
  135. package/lib/esm/errors.d.ts +48 -3
  136. package/lib/esm/errors.js +48 -3
  137. package/lib/esm/fetch.d.ts +16 -1
  138. package/lib/esm/fetch.js +16 -1
  139. package/lib/{cjs/helpers/computeReallocations.d.ts → esm/helpers/computeVaultV1Reallocations.d.ts} +14 -8
  140. package/lib/esm/helpers/{computeReallocations.js → computeVaultV1Reallocations.js} +25 -11
  141. package/lib/esm/helpers/constant.d.ts +5 -3
  142. package/lib/esm/helpers/constant.js +5 -3
  143. package/lib/esm/helpers/index.d.ts +2 -2
  144. package/lib/esm/helpers/index.js +2 -2
  145. package/lib/esm/helpers/validate.d.ts +32 -16
  146. package/lib/esm/helpers/validate.js +143 -32
  147. package/lib/esm/midnight/abis.d.ts +1 -0
  148. package/lib/esm/midnight/abis.js +1 -0
  149. package/lib/esm/midnight/constants.d.ts +1 -0
  150. package/lib/esm/midnight/constants.js +1 -0
  151. package/lib/esm/midnight/entities.d.ts +2 -0
  152. package/lib/esm/midnight/entities.js +1 -0
  153. package/lib/esm/midnight/errors.d.ts +1 -0
  154. package/lib/esm/midnight/errors.js +1 -0
  155. package/lib/esm/midnight/fetch.d.ts +1 -0
  156. package/lib/esm/midnight/fetch.js +1 -0
  157. package/lib/esm/midnight/types.d.ts +1 -0
  158. package/lib/esm/midnight/types.js +1 -0
  159. package/lib/esm/midnight/utils.d.ts +1 -0
  160. package/lib/esm/midnight/utils.js +1 -0
  161. package/lib/esm/types/action.d.ts +12 -0
  162. package/lib/esm/types/error.d.ts +224 -5
  163. package/lib/esm/types/error.js +253 -4
  164. package/lib/esm/types/sharedLiquidity.d.ts +72 -8
  165. package/lib/esm/types.d.ts +17 -2
  166. package/lib/esm/utils.d.ts +31 -4
  167. package/lib/esm/utils.js +31 -4
  168. package/package.json +23 -7
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WrappedToken = exports.VaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1Adapter = exports.VaultV2BluePublicAllocatorConfig = exports.VaultV2BlueMarketPublicAllocatorConfig = exports.VaultV2Adapter = exports.VaultV2 = exports.VaultUser = exports.VaultToken = exports.VaultMarketPublicAllocatorConfig = exports.VaultMarketConfig = exports.VaultMarketAllocation = exports.VaultConfig = exports.Vault = exports.User = exports.Token = exports.PreLiquidationPosition = exports.PreLiquidationParams = exports.Position = exports.MarketParams = exports.Market = exports.Holding = exports.ExchangeRateWrappedToken = exports.Eip5267Domain = exports.ConstantWrappedToken = exports.AssetBalances = exports.AccrualVaultV2MorphoVaultV1Adapter = exports.AccrualVaultV2MorphoMarketV1AdapterV2 = exports.AccrualVaultV2MorphoMarketV1Adapter = exports.AccrualVaultV2 = exports.AccrualVault = exports.AccrualPosition = void 0;
4
+ var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
+ Object.defineProperty(exports, "AccrualPosition", { enumerable: true, get: function () { return blue_sdk_1.AccrualPosition; } });
6
+ Object.defineProperty(exports, "AccrualVault", { enumerable: true, get: function () { return blue_sdk_1.AccrualVault; } });
7
+ Object.defineProperty(exports, "AccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2; } });
8
+ Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter; } });
9
+ Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2; } });
10
+ Object.defineProperty(exports, "AccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter; } });
11
+ Object.defineProperty(exports, "AssetBalances", { enumerable: true, get: function () { return blue_sdk_1.AssetBalances; } });
12
+ Object.defineProperty(exports, "ConstantWrappedToken", { enumerable: true, get: function () { return blue_sdk_1.ConstantWrappedToken; } });
13
+ Object.defineProperty(exports, "Eip5267Domain", { enumerable: true, get: function () { return blue_sdk_1.Eip5267Domain; } });
14
+ Object.defineProperty(exports, "ExchangeRateWrappedToken", { enumerable: true, get: function () { return blue_sdk_1.ExchangeRateWrappedToken; } });
15
+ Object.defineProperty(exports, "Holding", { enumerable: true, get: function () { return blue_sdk_1.Holding; } });
16
+ Object.defineProperty(exports, "Market", { enumerable: true, get: function () { return blue_sdk_1.Market; } });
17
+ Object.defineProperty(exports, "MarketParams", { enumerable: true, get: function () { return blue_sdk_1.MarketParams; } });
18
+ Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return blue_sdk_1.Position; } });
19
+ Object.defineProperty(exports, "PreLiquidationParams", { enumerable: true, get: function () { return blue_sdk_1.PreLiquidationParams; } });
20
+ Object.defineProperty(exports, "PreLiquidationPosition", { enumerable: true, get: function () { return blue_sdk_1.PreLiquidationPosition; } });
21
+ Object.defineProperty(exports, "Token", { enumerable: true, get: function () { return blue_sdk_1.Token; } });
22
+ Object.defineProperty(exports, "User", { enumerable: true, get: function () { return blue_sdk_1.User; } });
23
+ Object.defineProperty(exports, "Vault", { enumerable: true, get: function () { return blue_sdk_1.Vault; } });
24
+ Object.defineProperty(exports, "VaultConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultConfig; } });
25
+ Object.defineProperty(exports, "VaultMarketAllocation", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketAllocation; } });
26
+ Object.defineProperty(exports, "VaultMarketConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketConfig; } });
27
+ Object.defineProperty(exports, "VaultMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultMarketPublicAllocatorConfig; } });
28
+ Object.defineProperty(exports, "VaultToken", { enumerable: true, get: function () { return blue_sdk_1.VaultToken; } });
29
+ Object.defineProperty(exports, "VaultUser", { enumerable: true, get: function () { return blue_sdk_1.VaultUser; } });
30
+ Object.defineProperty(exports, "VaultV2", { enumerable: true, get: function () { return blue_sdk_1.VaultV2; } });
31
+ Object.defineProperty(exports, "VaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Adapter; } });
32
+ Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfig; } });
33
+ Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfig; } });
34
+ Object.defineProperty(exports, "VaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1Adapter; } });
35
+ Object.defineProperty(exports, "VaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1AdapterV2; } });
36
+ Object.defineProperty(exports, "VaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoVaultV1Adapter; } });
37
+ Object.defineProperty(exports, "WrappedToken", { enumerable: true, get: function () { return blue_sdk_1.WrappedToken; } });
@@ -0,0 +1,2 @@
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
2
+ export { getUnsupportedVaultV2Adapter, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedPermitDomainExtensionsError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
4
+ var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
+ Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
6
+ Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return blue_sdk_1.DivisionByZeroError; } });
7
+ Object.defineProperty(exports, "IncompleteChainRegistryError", { enumerable: true, get: function () { return blue_sdk_1.IncompleteChainRegistryError; } });
8
+ Object.defineProperty(exports, "InvalidBitLengthError", { enumerable: true, get: function () { return blue_sdk_1.InvalidBitLengthError; } });
9
+ Object.defineProperty(exports, "InvalidMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidMarketParamsError; } });
10
+ Object.defineProperty(exports, "RegistryValueAlreadyRegisteredError", { enumerable: true, get: function () { return blue_sdk_1.RegistryValueAlreadyRegisteredError; } });
11
+ Object.defineProperty(exports, "UnknownAddressError", { enumerable: true, get: function () { return blue_sdk_1.UnknownAddressError; } });
12
+ Object.defineProperty(exports, "UnknownDataError", { enumerable: true, get: function () { return blue_sdk_1.UnknownDataError; } });
13
+ Object.defineProperty(exports, "UnknownFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownFactory; } });
14
+ Object.defineProperty(exports, "UnknownMarketAllocationError", { enumerable: true, get: function () { return blue_sdk_1.UnknownMarketAllocationError; } });
15
+ Object.defineProperty(exports, "UnknownMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.UnknownMarketParamsError; } });
16
+ Object.defineProperty(exports, "UnknownOfFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownOfFactory; } });
17
+ Object.defineProperty(exports, "UnknownTokenError", { enumerable: true, get: function () { return blue_sdk_1.UnknownTokenError; } });
18
+ Object.defineProperty(exports, "UnknownTokenPriceError", { enumerable: true, get: function () { return blue_sdk_1.UnknownTokenPriceError; } });
19
+ Object.defineProperty(exports, "UnknownVaultConfigError", { enumerable: true, get: function () { return blue_sdk_1.UnknownVaultConfigError; } });
20
+ Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedChainIdError; } });
21
+ Object.defineProperty(exports, "UnsupportedPreLiquidationParamsError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedPreLiquidationParamsError; } });
22
+ Object.defineProperty(exports, "UnsupportedVaultV2AdapterError", { enumerable: true, get: function () { return blue_sdk_1.UnsupportedVaultV2AdapterError; } });
23
+ Object.defineProperty(exports, "VaultV2Errors", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Errors; } });
24
+ var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
25
+ Object.defineProperty(exports, "getUnsupportedVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.getUnsupportedVaultV2Adapter; } });
26
+ Object.defineProperty(exports, "InvalidPermitDomainChainIdError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainChainIdError; } });
27
+ Object.defineProperty(exports, "InvalidPermitDomainVerifyingContractError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainVerifyingContractError; } });
28
+ Object.defineProperty(exports, "isUnknownOfFactoryError", { enumerable: true, get: function () { return blue_sdk_viem_1.isUnknownOfFactoryError; } });
29
+ Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
@@ -0,0 +1 @@
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition, fetchPreLiquidationParams, fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultMarketPublicAllocatorConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketPublicAllocatorConfig = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchUser = exports.fetchToken = exports.fetchPreLiquidationPosition = exports.fetchPreLiquidationParams = exports.fetchPosition = exports.fetchMarketParams = exports.fetchMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchAccrualPosition = void 0;
4
+ var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
5
+ Object.defineProperty(exports, "fetchAccrualPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualPosition; } });
6
+ Object.defineProperty(exports, "fetchAccrualVault", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVault; } });
7
+ Object.defineProperty(exports, "fetchAccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2; } });
8
+ Object.defineProperty(exports, "fetchAccrualVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2Adapter; } });
9
+ Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1Adapter; } });
10
+ Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1AdapterV2; } });
11
+ Object.defineProperty(exports, "fetchAccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoVaultV1Adapter; } });
12
+ Object.defineProperty(exports, "fetchHolding", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchHolding; } });
13
+ Object.defineProperty(exports, "fetchMarket", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchMarket; } });
14
+ Object.defineProperty(exports, "fetchMarketParams", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchMarketParams; } });
15
+ Object.defineProperty(exports, "fetchPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPosition; } });
16
+ Object.defineProperty(exports, "fetchPreLiquidationParams", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPreLiquidationParams; } });
17
+ Object.defineProperty(exports, "fetchPreLiquidationPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchPreLiquidationPosition; } });
18
+ Object.defineProperty(exports, "fetchToken", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchToken; } });
19
+ Object.defineProperty(exports, "fetchUser", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchUser; } });
20
+ Object.defineProperty(exports, "fetchVault", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVault; } });
21
+ Object.defineProperty(exports, "fetchVaultConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultConfig; } });
22
+ Object.defineProperty(exports, "fetchVaultMarketAllocation", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketAllocation; } });
23
+ Object.defineProperty(exports, "fetchVaultMarketConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketConfig; } });
24
+ Object.defineProperty(exports, "fetchVaultMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultMarketPublicAllocatorConfig; } });
25
+ Object.defineProperty(exports, "fetchVaultUser", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultUser; } });
26
+ Object.defineProperty(exports, "fetchVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2; } });
27
+ Object.defineProperty(exports, "fetchVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2Adapter; } });
28
+ Object.defineProperty(exports, "fetchVaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BlueMarketPublicAllocatorConfig; } });
29
+ Object.defineProperty(exports, "fetchVaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorConfig; } });
30
+ Object.defineProperty(exports, "fetchVaultV2BluePublicAllocatorData", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorData; } });
31
+ Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1Adapter; } });
32
+ Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1AdapterV2; } });
33
+ Object.defineProperty(exports, "fetchVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoVaultV1Adapter; } });
@@ -0,0 +1,2 @@
1
+ export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams, IPermit2Allowance, Loadable, MarketId, MaxBorrowOptions, MaxPositionCapacities, MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
2
+ export type { AuthorizationArgs, DaiPermitArgs, DeploylessFetchParameters, FetchParameters, InputAllocation, MetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs, } from "@morpho-org/blue-sdk-viem";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
2
+ export { AdaptiveCurveIrmLib, CapacityLimitReason, defaultPreLiquidationParamsRegistry, getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
3
+ export { decodeBytes32String, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.MetaMorphoAction = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getDaiPermitTypedData = exports.getAuthorizationTypedData = exports.decodeBytes32String = exports.VaultV2Utils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.SharesMath = exports.MathLib = exports.MarketUtils = exports.getDefaultPreLiquidationParams = exports.defaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.AdaptiveCurveIrmLib = void 0;
4
+ var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
+ Object.defineProperty(exports, "AdaptiveCurveIrmLib", { enumerable: true, get: function () { return blue_sdk_1.AdaptiveCurveIrmLib; } });
6
+ Object.defineProperty(exports, "CapacityLimitReason", { enumerable: true, get: function () { return blue_sdk_1.CapacityLimitReason; } });
7
+ Object.defineProperty(exports, "defaultPreLiquidationParamsRegistry", { enumerable: true, get: function () { return blue_sdk_1.defaultPreLiquidationParamsRegistry; } });
8
+ Object.defineProperty(exports, "getDefaultPreLiquidationParams", { enumerable: true, get: function () { return blue_sdk_1.getDefaultPreLiquidationParams; } });
9
+ Object.defineProperty(exports, "MarketUtils", { enumerable: true, get: function () { return blue_sdk_1.MarketUtils; } });
10
+ Object.defineProperty(exports, "MathLib", { enumerable: true, get: function () { return blue_sdk_1.MathLib; } });
11
+ Object.defineProperty(exports, "SharesMath", { enumerable: true, get: function () { return blue_sdk_1.SharesMath; } });
12
+ Object.defineProperty(exports, "VaultUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultUtils; } });
13
+ Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfigUtils; } });
14
+ Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils; } });
15
+ Object.defineProperty(exports, "VaultV2Utils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Utils; } });
16
+ var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
17
+ Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return blue_sdk_viem_1.decodeBytes32String; } });
18
+ Object.defineProperty(exports, "getAuthorizationTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getAuthorizationTypedData; } });
19
+ Object.defineProperty(exports, "getDaiPermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getDaiPermitTypedData; } });
20
+ Object.defineProperty(exports, "getPermit2PermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2PermitTypedData; } });
21
+ Object.defineProperty(exports, "getPermit2TransferFromTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2TransferFromTypedData; } });
22
+ Object.defineProperty(exports, "getPermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermitTypedData; } });
23
+ Object.defineProperty(exports, "MetaMorphoAction", { enumerable: true, get: function () { return blue_sdk_viem_1.MetaMorphoAction; } });
24
+ Object.defineProperty(exports, "optionalBoolean", { enumerable: true, get: function () { return blue_sdk_viem_1.optionalBoolean; } });
25
+ Object.defineProperty(exports, "readContractRestructured", { enumerable: true, get: function () { return blue_sdk_viem_1.readContractRestructured; } });
26
+ Object.defineProperty(exports, "restructure", { enumerable: true, get: function () { return blue_sdk_viem_1.restructure; } });
27
+ Object.defineProperty(exports, "safeGetAddress", { enumerable: true, get: function () { return blue_sdk_viem_1.safeGetAddress; } });
28
+ Object.defineProperty(exports, "safeParseNumber", { enumerable: true, get: function () { return blue_sdk_viem_1.safeParseNumber; } });
29
+ Object.defineProperty(exports, "safeParseUnits", { enumerable: true, get: function () { return blue_sdk_viem_1.safeParseUnits; } });
@@ -50,7 +50,7 @@ export declare namespace BundlerAction {
50
50
  *
51
51
  * @example
52
52
  * ```ts
53
- * import { getChainAddresses } from "@morpho-org/blue-sdk";
53
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
54
54
  * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
55
55
  *
56
56
  * const { generalAdapter1 } = getChainAddresses(1).bundler3;
@@ -137,7 +137,7 @@ export declare namespace BundlerAction {
137
137
  *
138
138
  * @example
139
139
  * ```ts
140
- * import { getChainAddresses } from "@morpho-org/blue-sdk";
140
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
141
141
  * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
142
142
  *
143
143
  * const adapter = getChainAddresses(1).bundler3.generalAdapter1;
@@ -351,7 +351,7 @@ export declare namespace BundlerAction {
351
351
  *
352
352
  * @example
353
353
  * ```ts
354
- * import { getChainAddresses } from "@morpho-org/blue-sdk";
354
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
355
355
  * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
356
356
  *
357
357
  * const { generalAdapter1 } = getChainAddresses(1).bundler3;
@@ -650,6 +650,125 @@ export declare namespace BundlerAction {
650
650
  * ```
651
651
  */
652
652
  function publicAllocatorReallocateTo(chainId: number, vault: Address, fee: bigint, withdrawals: InputReallocation[], supplyMarketParams: InputMarketParams, skipRevert?: boolean): BundlerCall[];
653
+ /**
654
+ * Encodes a Vault V2 Blue Public Allocator market-to-market reallocation.
655
+ *
656
+ * @remarks Bundler3 must already hold the computed penalty assets. The
657
+ * high-level Blue builders add the corresponding GeneralAdapter1 transfer.
658
+ *
659
+ * @param chainId - Chain whose canonical Blue Public Allocator is called.
660
+ * @param vault - Vault whose liquidity is reallocated.
661
+ * @param deallocateAdapter - Vault V2 adapter supplying the source market.
662
+ * @param deallocateMarket - Source Morpho Blue market parameters.
663
+ * @param allocateAdapter - Vault V2 adapter supplying the target market.
664
+ * @param allocateMarket - Target Morpho Blue market parameters.
665
+ * @param assets - Assets to reallocate, bounded by `uint128` by the high-level action.
666
+ * @param penalty - Vault-configured proportional penalty, scaled by WAD.
667
+ * @param skipRevert - Whether Bundler3 should tolerate a revert.
668
+ * @returns A zero reset and exact approval when needed, then the allocator call.
669
+ * @throws {BundlerErrors.UnexpectedAction} when the chain has no Blue Public Allocator deployment.
670
+ * @throws {BundlerErrors.SkippableAllocatorPenalty} when `skipRevert` is true and a token approval is required.
671
+ * @example
672
+ * ```ts
673
+ * import { ChainId } from "@morpho-org/morpho-sdk/constants";
674
+ * import type { BlueInputMarketParams } from "@morpho-org/morpho-sdk/types";
675
+ * import {
676
+ * BundlerAction,
677
+ * type BundlerCall,
678
+ * } from "@morpho-org/morpho-sdk/bundler";
679
+ * import type { Address } from "viem";
680
+ *
681
+ * const keyrockUsdcVault =
682
+ * "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145" satisfies Address;
683
+ * const sourceAdapterFixture =
684
+ * "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" satisfies Address;
685
+ * const targetAdapterFixture =
686
+ * "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" satisfies Address;
687
+ * const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" satisfies Address;
688
+ * const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" satisfies Address;
689
+ * const wbtc = "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" satisfies Address;
690
+ * const ethUsdOracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" satisfies Address;
691
+ * const adaptiveCurveIrm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC" satisfies Address;
692
+ * const sourceMarket = {
693
+ * loanToken: usdc,
694
+ * collateralToken: weth,
695
+ * oracle: ethUsdOracle,
696
+ * irm: adaptiveCurveIrm,
697
+ * lltv: 860_000_000_000_000_000n,
698
+ * } satisfies BlueInputMarketParams;
699
+ * const targetMarket = {
700
+ * ...sourceMarket,
701
+ * collateralToken: wbtc,
702
+ * } satisfies BlueInputMarketParams;
703
+ *
704
+ * const calls: BundlerCall[] = BundlerAction.vaultV2BluePublicAllocatorReallocate(
705
+ * ChainId.EthMainnet,
706
+ * keyrockUsdcVault,
707
+ * sourceAdapterFixture,
708
+ * sourceMarket,
709
+ * targetAdapterFixture,
710
+ * targetMarket,
711
+ * 1_000_000n,
712
+ * 1_000_000_000_000_000n,
713
+ * );
714
+ * // Bundler3 resets and approves 1_000 USDC units, then calls `reallocate` with zero native value.
715
+ * ```
716
+ */
717
+ function vaultV2BluePublicAllocatorReallocate(chainId: number, vault: Address, deallocateAdapter: Address, deallocateMarket: InputMarketParams, allocateAdapter: Address, allocateMarket: InputMarketParams, assets: bigint, penalty: bigint, skipRevert?: boolean): BundlerCall[];
718
+ /**
719
+ * Encodes a Vault V2 Blue Public Allocator allocation from vault idle liquidity.
720
+ *
721
+ * @remarks Bundler3 must already hold the computed penalty assets. The
722
+ * high-level Blue builders add the corresponding GeneralAdapter1 transfer.
723
+ *
724
+ * @param chainId - Chain whose canonical Blue Public Allocator is called.
725
+ * @param vault - Vault whose idle liquidity is allocated.
726
+ * @param adapter - Vault V2 adapter supplying the target market.
727
+ * @param market - Target Morpho Blue market parameters.
728
+ * @param assets - Assets to allocate, bounded by `uint128` by the high-level action.
729
+ * @param penalty - Vault-configured proportional penalty, scaled by WAD.
730
+ * @param skipRevert - Whether Bundler3 should tolerate a revert.
731
+ * @returns A zero reset and exact approval when needed, then the allocator call.
732
+ * @throws {BundlerErrors.UnexpectedAction} when the chain has no Blue Public Allocator deployment.
733
+ * @throws {BundlerErrors.SkippableAllocatorPenalty} when `skipRevert` is true and a token approval is required.
734
+ * @example
735
+ * ```ts
736
+ * import { ChainId } from "@morpho-org/morpho-sdk/constants";
737
+ * import type { BlueInputMarketParams } from "@morpho-org/morpho-sdk/types";
738
+ * import {
739
+ * BundlerAction,
740
+ * type BundlerCall,
741
+ * } from "@morpho-org/morpho-sdk/bundler";
742
+ * import type { Address } from "viem";
743
+ *
744
+ * const keyrockUsdcVault =
745
+ * "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145" satisfies Address;
746
+ * const targetAdapterFixture =
747
+ * "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" satisfies Address;
748
+ * const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" satisfies Address;
749
+ * const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" satisfies Address;
750
+ * const ethUsdOracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" satisfies Address;
751
+ * const adaptiveCurveIrm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC" satisfies Address;
752
+ * const targetMarket = {
753
+ * loanToken: usdc,
754
+ * collateralToken: weth,
755
+ * oracle: ethUsdOracle,
756
+ * irm: adaptiveCurveIrm,
757
+ * lltv: 860_000_000_000_000_000n,
758
+ * } satisfies BlueInputMarketParams;
759
+ *
760
+ * const calls: BundlerCall[] = BundlerAction.vaultV2BluePublicAllocatorAllocateFromIdle(
761
+ * ChainId.EthMainnet,
762
+ * keyrockUsdcVault,
763
+ * targetAdapterFixture,
764
+ * targetMarket,
765
+ * 1_000_000n,
766
+ * 1_000_000_000_000_000n,
767
+ * );
768
+ * // Bundler3 resets and approves 1_000 USDC units, then calls `allocateFromIdle` with zero native value.
769
+ * ```
770
+ */
771
+ function vaultV2BluePublicAllocatorAllocateFromIdle(chainId: number, vault: Address, adapter: Address, market: InputMarketParams, assets: bigint, penalty: bigint, skipRevert?: boolean): BundlerCall[];
653
772
  /**
654
773
  * Encodes a GeneralAdapter1 native-token wrap call.
655
774
  *
@@ -74,7 +74,7 @@ var BundlerAction;
74
74
  *
75
75
  * @example
76
76
  * ```ts
77
- * import { getChainAddresses } from "@morpho-org/blue-sdk";
77
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
78
78
  * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
79
79
  *
80
80
  * const { generalAdapter1 } = getChainAddresses(1).bundler3;
@@ -196,6 +196,12 @@ var BundlerAction;
196
196
  case "reallocateTo": {
197
197
  return BundlerAction.publicAllocatorReallocateTo(chainId, ...args);
198
198
  }
199
+ case "vaultV2BluePublicAllocatorReallocate": {
200
+ return BundlerAction.vaultV2BluePublicAllocatorReallocate(chainId, ...args);
201
+ }
202
+ case "vaultV2BluePublicAllocatorAllocateFromIdle": {
203
+ return BundlerAction.vaultV2BluePublicAllocatorAllocateFromIdle(chainId, ...args);
204
+ }
199
205
  case "wrapNative": {
200
206
  return BundlerAction.wrapNative(chainId, ...args);
201
207
  }
@@ -329,7 +335,7 @@ var BundlerAction;
329
335
  *
330
336
  * @example
331
337
  * ```ts
332
- * import { getChainAddresses } from "@morpho-org/blue-sdk";
338
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
333
339
  * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
334
340
  *
335
341
  * const adapter = getChainAddresses(1).bundler3.generalAdapter1;
@@ -672,7 +678,7 @@ var BundlerAction;
672
678
  *
673
679
  * @example
674
680
  * ```ts
675
- * import { getChainAddresses } from "@morpho-org/blue-sdk";
681
+ * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
676
682
  * import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
677
683
  *
678
684
  * const { generalAdapter1 } = getChainAddresses(1).bundler3;
@@ -1098,15 +1104,15 @@ var BundlerAction;
1098
1104
  */
1099
1105
  // biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
1100
1106
  function publicAllocatorReallocateTo(chainId, vault, fee, withdrawals, supplyMarketParams, skipRevert = false) {
1101
- const { publicAllocator } = (0, blue_sdk_1.getChainAddresses)(chainId);
1102
- if (publicAllocator == null) {
1107
+ const { vaultV1PublicAllocator } = (0, blue_sdk_1.getChainAddresses)(chainId);
1108
+ if (vaultV1PublicAllocator == null) {
1103
1109
  throw new error_js_1.BundlerErrors.UnexpectedAction("reallocateTo", chainId);
1104
1110
  }
1105
1111
  return [
1106
1112
  {
1107
- to: publicAllocator,
1113
+ to: vaultV1PublicAllocator,
1108
1114
  data: (0, viem_1.encodeFunctionData)({
1109
- abi: blue_sdk_viem_1.publicAllocatorAbi,
1115
+ abi: blue_sdk_viem_1.vaultV1PublicAllocatorAbi,
1110
1116
  functionName: "reallocateTo",
1111
1117
  args: [vault, withdrawals, supplyMarketParams],
1112
1118
  }),
@@ -1117,6 +1123,209 @@ var BundlerAction;
1117
1123
  ];
1118
1124
  }
1119
1125
  BundlerAction.publicAllocatorReallocateTo = publicAllocatorReallocateTo;
1126
+ /**
1127
+ * Encodes a Vault V2 Blue Public Allocator market-to-market reallocation.
1128
+ *
1129
+ * @remarks Bundler3 must already hold the computed penalty assets. The
1130
+ * high-level Blue builders add the corresponding GeneralAdapter1 transfer.
1131
+ *
1132
+ * @param chainId - Chain whose canonical Blue Public Allocator is called.
1133
+ * @param vault - Vault whose liquidity is reallocated.
1134
+ * @param deallocateAdapter - Vault V2 adapter supplying the source market.
1135
+ * @param deallocateMarket - Source Morpho Blue market parameters.
1136
+ * @param allocateAdapter - Vault V2 adapter supplying the target market.
1137
+ * @param allocateMarket - Target Morpho Blue market parameters.
1138
+ * @param assets - Assets to reallocate, bounded by `uint128` by the high-level action.
1139
+ * @param penalty - Vault-configured proportional penalty, scaled by WAD.
1140
+ * @param skipRevert - Whether Bundler3 should tolerate a revert.
1141
+ * @returns A zero reset and exact approval when needed, then the allocator call.
1142
+ * @throws {BundlerErrors.UnexpectedAction} when the chain has no Blue Public Allocator deployment.
1143
+ * @throws {BundlerErrors.SkippableAllocatorPenalty} when `skipRevert` is true and a token approval is required.
1144
+ * @example
1145
+ * ```ts
1146
+ * import { ChainId } from "@morpho-org/morpho-sdk/constants";
1147
+ * import type { BlueInputMarketParams } from "@morpho-org/morpho-sdk/types";
1148
+ * import {
1149
+ * BundlerAction,
1150
+ * type BundlerCall,
1151
+ * } from "@morpho-org/morpho-sdk/bundler";
1152
+ * import type { Address } from "viem";
1153
+ *
1154
+ * const keyrockUsdcVault =
1155
+ * "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145" satisfies Address;
1156
+ * const sourceAdapterFixture =
1157
+ * "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" satisfies Address;
1158
+ * const targetAdapterFixture =
1159
+ * "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" satisfies Address;
1160
+ * const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" satisfies Address;
1161
+ * const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" satisfies Address;
1162
+ * const wbtc = "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" satisfies Address;
1163
+ * const ethUsdOracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" satisfies Address;
1164
+ * const adaptiveCurveIrm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC" satisfies Address;
1165
+ * const sourceMarket = {
1166
+ * loanToken: usdc,
1167
+ * collateralToken: weth,
1168
+ * oracle: ethUsdOracle,
1169
+ * irm: adaptiveCurveIrm,
1170
+ * lltv: 860_000_000_000_000_000n,
1171
+ * } satisfies BlueInputMarketParams;
1172
+ * const targetMarket = {
1173
+ * ...sourceMarket,
1174
+ * collateralToken: wbtc,
1175
+ * } satisfies BlueInputMarketParams;
1176
+ *
1177
+ * const calls: BundlerCall[] = BundlerAction.vaultV2BluePublicAllocatorReallocate(
1178
+ * ChainId.EthMainnet,
1179
+ * keyrockUsdcVault,
1180
+ * sourceAdapterFixture,
1181
+ * sourceMarket,
1182
+ * targetAdapterFixture,
1183
+ * targetMarket,
1184
+ * 1_000_000n,
1185
+ * 1_000_000_000_000_000n,
1186
+ * );
1187
+ * // Bundler3 resets and approves 1_000 USDC units, then calls `reallocate` with zero native value.
1188
+ * ```
1189
+ */
1190
+ // biome-ignore lint/complexity/useMaxParams: mirrors the protocol call
1191
+ function vaultV2BluePublicAllocatorReallocate(chainId, vault, deallocateAdapter, deallocateMarket, allocateAdapter, allocateMarket, assets, penalty, skipRevert = false) {
1192
+ const { vaultV2BluePublicAllocator: allocator } = (0, blue_sdk_1.getChainAddresses)(chainId);
1193
+ if (allocator == null) {
1194
+ throw new error_js_1.BundlerErrors.UnexpectedAction("vaultV2BluePublicAllocatorReallocate", chainId);
1195
+ }
1196
+ const calls = [];
1197
+ const penaltyAssets = blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils.getPenaltyAssets({ penalty }, assets);
1198
+ if (skipRevert && penaltyAssets > 0n) {
1199
+ throw new error_js_1.BundlerErrors.SkippableAllocatorPenalty(penaltyAssets);
1200
+ }
1201
+ if (penaltyAssets > 0n) {
1202
+ for (const amount of [0n, penaltyAssets])
1203
+ calls.push({
1204
+ to: allocateMarket.loanToken,
1205
+ data: (0, viem_1.encodeFunctionData)({
1206
+ abi: viem_1.erc20Abi,
1207
+ functionName: "approve",
1208
+ args: [allocator, amount],
1209
+ }),
1210
+ value: 0n,
1211
+ skipRevert,
1212
+ callbackHash: viem_1.zeroHash,
1213
+ });
1214
+ }
1215
+ calls.push({
1216
+ to: allocator,
1217
+ data: (0, viem_1.encodeFunctionData)({
1218
+ abi: blue_sdk_viem_1.vaultV2BluePublicAllocatorAbi,
1219
+ functionName: "reallocate",
1220
+ args: [
1221
+ vault,
1222
+ deallocateAdapter,
1223
+ deallocateMarket,
1224
+ allocateAdapter,
1225
+ allocateMarket,
1226
+ assets,
1227
+ penalty,
1228
+ ],
1229
+ }),
1230
+ value: 0n,
1231
+ skipRevert,
1232
+ callbackHash: viem_1.zeroHash,
1233
+ });
1234
+ return calls;
1235
+ }
1236
+ BundlerAction.vaultV2BluePublicAllocatorReallocate = vaultV2BluePublicAllocatorReallocate;
1237
+ /**
1238
+ * Encodes a Vault V2 Blue Public Allocator allocation from vault idle liquidity.
1239
+ *
1240
+ * @remarks Bundler3 must already hold the computed penalty assets. The
1241
+ * high-level Blue builders add the corresponding GeneralAdapter1 transfer.
1242
+ *
1243
+ * @param chainId - Chain whose canonical Blue Public Allocator is called.
1244
+ * @param vault - Vault whose idle liquidity is allocated.
1245
+ * @param adapter - Vault V2 adapter supplying the target market.
1246
+ * @param market - Target Morpho Blue market parameters.
1247
+ * @param assets - Assets to allocate, bounded by `uint128` by the high-level action.
1248
+ * @param penalty - Vault-configured proportional penalty, scaled by WAD.
1249
+ * @param skipRevert - Whether Bundler3 should tolerate a revert.
1250
+ * @returns A zero reset and exact approval when needed, then the allocator call.
1251
+ * @throws {BundlerErrors.UnexpectedAction} when the chain has no Blue Public Allocator deployment.
1252
+ * @throws {BundlerErrors.SkippableAllocatorPenalty} when `skipRevert` is true and a token approval is required.
1253
+ * @example
1254
+ * ```ts
1255
+ * import { ChainId } from "@morpho-org/morpho-sdk/constants";
1256
+ * import type { BlueInputMarketParams } from "@morpho-org/morpho-sdk/types";
1257
+ * import {
1258
+ * BundlerAction,
1259
+ * type BundlerCall,
1260
+ * } from "@morpho-org/morpho-sdk/bundler";
1261
+ * import type { Address } from "viem";
1262
+ *
1263
+ * const keyrockUsdcVault =
1264
+ * "0x04422053aDDbc9bB2759b248B574e3FCA76Bc145" satisfies Address;
1265
+ * const targetAdapterFixture =
1266
+ * "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" satisfies Address;
1267
+ * const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" satisfies Address;
1268
+ * const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" satisfies Address;
1269
+ * const ethUsdOracle = "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" satisfies Address;
1270
+ * const adaptiveCurveIrm = "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC" satisfies Address;
1271
+ * const targetMarket = {
1272
+ * loanToken: usdc,
1273
+ * collateralToken: weth,
1274
+ * oracle: ethUsdOracle,
1275
+ * irm: adaptiveCurveIrm,
1276
+ * lltv: 860_000_000_000_000_000n,
1277
+ * } satisfies BlueInputMarketParams;
1278
+ *
1279
+ * const calls: BundlerCall[] = BundlerAction.vaultV2BluePublicAllocatorAllocateFromIdle(
1280
+ * ChainId.EthMainnet,
1281
+ * keyrockUsdcVault,
1282
+ * targetAdapterFixture,
1283
+ * targetMarket,
1284
+ * 1_000_000n,
1285
+ * 1_000_000_000_000_000n,
1286
+ * );
1287
+ * // Bundler3 resets and approves 1_000 USDC units, then calls `allocateFromIdle` with zero native value.
1288
+ * ```
1289
+ */
1290
+ // biome-ignore lint/complexity/useMaxParams: mirrors the protocol call
1291
+ function vaultV2BluePublicAllocatorAllocateFromIdle(chainId, vault, adapter, market, assets, penalty, skipRevert = false) {
1292
+ const { vaultV2BluePublicAllocator: allocator } = (0, blue_sdk_1.getChainAddresses)(chainId);
1293
+ if (allocator == null) {
1294
+ throw new error_js_1.BundlerErrors.UnexpectedAction("vaultV2BluePublicAllocatorAllocateFromIdle", chainId);
1295
+ }
1296
+ const calls = [];
1297
+ const penaltyAssets = blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils.getPenaltyAssets({ penalty }, assets);
1298
+ if (skipRevert && penaltyAssets > 0n) {
1299
+ throw new error_js_1.BundlerErrors.SkippableAllocatorPenalty(penaltyAssets);
1300
+ }
1301
+ if (penaltyAssets > 0n) {
1302
+ for (const amount of [0n, penaltyAssets])
1303
+ calls.push({
1304
+ to: market.loanToken,
1305
+ data: (0, viem_1.encodeFunctionData)({
1306
+ abi: viem_1.erc20Abi,
1307
+ functionName: "approve",
1308
+ args: [allocator, amount],
1309
+ }),
1310
+ value: 0n,
1311
+ skipRevert,
1312
+ callbackHash: viem_1.zeroHash,
1313
+ });
1314
+ }
1315
+ calls.push({
1316
+ to: allocator,
1317
+ data: (0, viem_1.encodeFunctionData)({
1318
+ abi: blue_sdk_viem_1.vaultV2BluePublicAllocatorAbi,
1319
+ functionName: "allocateFromIdle",
1320
+ args: [vault, adapter, market, assets, penalty],
1321
+ }),
1322
+ value: 0n,
1323
+ skipRevert,
1324
+ callbackHash: viem_1.zeroHash,
1325
+ });
1326
+ return calls;
1327
+ }
1328
+ BundlerAction.vaultV2BluePublicAllocatorAllocateFromIdle = vaultV2BluePublicAllocatorAllocateFromIdle;
1120
1329
  /**
1121
1330
  * Encodes a GeneralAdapter1 native-token wrap call.
1122
1331
  *
@@ -180,6 +180,26 @@ export interface ActionArgs {
180
180
  supplyMarket: InputMarketParams,
181
181
  skipRevert?: boolean
182
182
  ];
183
+ /** Vault V2 Blue Public Allocator market-to-market reallocation with a WAD-scaled penalty. */
184
+ readonly vaultV2BluePublicAllocatorReallocate: [
185
+ vault: Address,
186
+ deallocateAdapter: Address,
187
+ deallocateMarket: InputMarketParams,
188
+ allocateAdapter: Address,
189
+ allocateMarket: InputMarketParams,
190
+ assets: bigint,
191
+ penalty: bigint,
192
+ skipRevert?: boolean
193
+ ];
194
+ /** Vault V2 Blue Public Allocator idle-to-market allocation with a WAD-scaled penalty. */
195
+ readonly vaultV2BluePublicAllocatorAllocateFromIdle: [
196
+ vault: Address,
197
+ adapter: Address,
198
+ market: InputMarketParams,
199
+ assets: bigint,
200
+ penalty: bigint,
201
+ skipRevert?: boolean
202
+ ];
183
203
  /** GeneralAdapter1 native wrap of `amount` to `recipient`; `skipRevert` controls Bundler3 revert handling. */
184
204
  readonly wrapNative: [
185
205
  amount: bigint,