@morpho-org/morpho-sdk 7.1.0-next.1 → 8.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 (217) hide show
  1. package/MIGRATION-v7-to-v8.md +290 -0
  2. package/README.md +11 -6
  3. package/lib/cjs/abis.d.ts +1 -1
  4. package/lib/cjs/abis.js +1 -5
  5. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +2 -0
  6. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +2 -0
  7. package/lib/cjs/actions/midnight/cancelAndMake.d.ts +17 -71
  8. package/lib/cjs/actions/midnight/cancelAndMake.js +41 -29
  9. package/lib/cjs/actions/midnight/redeem.d.ts +8 -1
  10. package/lib/cjs/actions/midnight/redeem.js +18 -1
  11. package/lib/cjs/actions/midnight/repayWithdrawCollateral.d.ts +19 -3
  12. package/lib/cjs/actions/midnight/repayWithdrawCollateral.js +24 -2
  13. package/lib/cjs/actions/midnight/supplyCollateral.d.ts +1 -0
  14. package/lib/cjs/actions/midnight/supplyCollateral.js +3 -0
  15. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +21 -6
  16. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +49 -14
  17. package/lib/cjs/actions/midnight/takeBorrow.d.ts +18 -5
  18. package/lib/cjs/actions/midnight/takeBorrow.js +44 -12
  19. package/lib/cjs/actions/midnight/takeLend.d.ts +10 -5
  20. package/lib/cjs/actions/midnight/takeLend.js +27 -9
  21. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -7
  22. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +51 -27
  23. package/lib/cjs/actions/midnight/takeWithdraw.d.ts +14 -5
  24. package/lib/cjs/actions/midnight/takeWithdraw.js +40 -9
  25. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -2
  26. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +11 -6
  27. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +3 -0
  28. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +2 -1
  29. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +13 -2
  30. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +17 -6
  31. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +3 -0
  32. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +2 -1
  33. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +5 -0
  34. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +4 -1
  35. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +3 -1
  36. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +5 -1
  37. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +3 -1
  38. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -1
  39. package/lib/cjs/actions/requirements/validateClientChainId.d.ts +26 -0
  40. package/lib/cjs/actions/requirements/validateClientChainId.js +34 -0
  41. package/lib/cjs/blue/abis.d.ts +1 -1
  42. package/lib/cjs/blue/abis.js +1 -5
  43. package/lib/cjs/blue/entities.d.ts +4 -4
  44. package/lib/cjs/blue/entities.js +1 -3
  45. package/lib/cjs/blue/errors.d.ts +2 -2
  46. package/lib/cjs/blue/errors.js +3 -5
  47. package/lib/cjs/blue/fetch.d.ts +2 -2
  48. package/lib/cjs/blue/fetch.js +1 -3
  49. package/lib/cjs/blue/types.d.ts +1 -1
  50. package/lib/cjs/blue/utils.d.ts +2 -2
  51. package/lib/cjs/blue/utils.js +5 -2
  52. package/lib/cjs/entities/blue/blue.d.ts +109 -27
  53. package/lib/cjs/entities/blue/blue.js +103 -28
  54. package/lib/cjs/entities/index.d.ts +5 -5
  55. package/lib/cjs/entities/index.js +1 -3
  56. package/lib/cjs/entities/midnight/deadline.d.ts +15 -0
  57. package/lib/cjs/entities/midnight/deadline.js +24 -0
  58. package/lib/cjs/entities/midnight/midnight.d.ts +427 -72
  59. package/lib/cjs/entities/midnight/midnight.js +864 -186
  60. package/lib/cjs/entities/midnight/publication.d.ts +134 -0
  61. package/lib/cjs/entities/midnight/publication.js +404 -0
  62. package/lib/cjs/entities/midnight/types.d.ts +26 -5
  63. package/lib/cjs/entities/requirements/assertContractCode.d.ts +49 -0
  64. package/lib/cjs/entities/requirements/assertContractCode.js +79 -0
  65. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +19 -4
  66. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +45 -18
  67. package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.d.ts +3 -2
  68. package/lib/cjs/entities/requirements/getUnusedPermit2Nonce.js +5 -2
  69. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -1
  70. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
  71. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +63 -11
  72. package/lib/cjs/entities/vaultV1/vaultV1.js +52 -15
  73. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +62 -44
  74. package/lib/cjs/entities/vaultV2/vaultV2.js +53 -48
  75. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +3 -5
  76. package/lib/cjs/entities/vaultV2BlueReallocationData.js +3 -9
  77. package/lib/cjs/errors.d.ts +4 -4
  78. package/lib/cjs/errors.js +7 -10
  79. package/lib/cjs/fetch.d.ts +2 -2
  80. package/lib/cjs/fetch.js +1 -3
  81. package/lib/cjs/helpers/constant.d.ts +5 -0
  82. package/lib/cjs/helpers/constant.js +6 -1
  83. package/lib/cjs/helpers/index.d.ts +1 -1
  84. package/lib/cjs/helpers/index.js +2 -1
  85. package/lib/cjs/helpers/validate.d.ts +163 -8
  86. package/lib/cjs/helpers/validate.js +179 -8
  87. package/lib/cjs/helpers/validateMidnightBounds.d.ts +47 -0
  88. package/lib/cjs/helpers/validateMidnightBounds.js +79 -0
  89. package/lib/cjs/helpers/validateMidnightPublication.d.ts +12 -0
  90. package/lib/cjs/helpers/validateMidnightPublication.js +144 -0
  91. package/lib/cjs/helpers/validateMidnightReceiver.d.ts +29 -0
  92. package/lib/cjs/helpers/validateMidnightReceiver.js +84 -0
  93. package/lib/cjs/helpers/validateMidnightTakeFeasibility.d.ts +102 -0
  94. package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +231 -0
  95. package/lib/cjs/index.d.ts +1 -0
  96. package/lib/cjs/index.js +3 -0
  97. package/lib/cjs/midnight/errors.d.ts +1 -2
  98. package/lib/cjs/midnight/errors.js +4 -5
  99. package/lib/cjs/types/error.d.ts +197 -4
  100. package/lib/cjs/types/error.js +265 -5
  101. package/lib/cjs/types/index.d.ts +1 -0
  102. package/lib/cjs/types/index.js +1 -0
  103. package/lib/cjs/types/midnightCancelAndMake.d.ts +70 -0
  104. package/lib/cjs/types/midnightCancelAndMake.js +2 -0
  105. package/lib/cjs/types/midnightPublicationError.d.ts +332 -0
  106. package/lib/cjs/types/midnightPublicationError.js +376 -0
  107. package/lib/cjs/types.d.ts +1 -1
  108. package/lib/cjs/utils.d.ts +4 -3
  109. package/lib/cjs/utils.js +8 -4
  110. package/lib/esm/abis.d.ts +1 -1
  111. package/lib/esm/abis.js +1 -1
  112. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +2 -0
  113. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +2 -0
  114. package/lib/esm/actions/midnight/cancelAndMake.d.ts +17 -71
  115. package/lib/esm/actions/midnight/cancelAndMake.js +42 -30
  116. package/lib/esm/actions/midnight/redeem.d.ts +8 -1
  117. package/lib/esm/actions/midnight/redeem.js +18 -1
  118. package/lib/esm/actions/midnight/repayWithdrawCollateral.d.ts +19 -3
  119. package/lib/esm/actions/midnight/repayWithdrawCollateral.js +24 -2
  120. package/lib/esm/actions/midnight/supplyCollateral.d.ts +1 -0
  121. package/lib/esm/actions/midnight/supplyCollateral.js +3 -0
  122. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +21 -6
  123. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +52 -17
  124. package/lib/esm/actions/midnight/takeBorrow.d.ts +18 -5
  125. package/lib/esm/actions/midnight/takeBorrow.js +47 -15
  126. package/lib/esm/actions/midnight/takeLend.d.ts +10 -5
  127. package/lib/esm/actions/midnight/takeLend.js +27 -9
  128. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.d.ts +22 -7
  129. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +52 -28
  130. package/lib/esm/actions/midnight/takeWithdraw.d.ts +14 -5
  131. package/lib/esm/actions/midnight/takeWithdraw.js +41 -10
  132. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +6 -2
  133. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +13 -8
  134. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +3 -0
  135. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +2 -1
  136. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +13 -2
  137. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +17 -6
  138. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +3 -0
  139. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +2 -1
  140. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +5 -0
  141. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +4 -1
  142. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.d.ts +3 -1
  143. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +5 -1
  144. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.d.ts +3 -1
  145. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +5 -1
  146. package/lib/esm/actions/requirements/validateClientChainId.d.ts +26 -0
  147. package/lib/esm/actions/requirements/validateClientChainId.js +30 -0
  148. package/lib/esm/blue/abis.d.ts +1 -1
  149. package/lib/esm/blue/abis.js +1 -1
  150. package/lib/esm/blue/entities.d.ts +4 -4
  151. package/lib/esm/blue/entities.js +2 -2
  152. package/lib/esm/blue/errors.d.ts +2 -2
  153. package/lib/esm/blue/errors.js +2 -2
  154. package/lib/esm/blue/fetch.d.ts +2 -2
  155. package/lib/esm/blue/fetch.js +2 -2
  156. package/lib/esm/blue/types.d.ts +1 -1
  157. package/lib/esm/blue/utils.d.ts +2 -2
  158. package/lib/esm/blue/utils.js +2 -2
  159. package/lib/esm/entities/blue/blue.d.ts +109 -27
  160. package/lib/esm/entities/blue/blue.js +104 -29
  161. package/lib/esm/entities/index.d.ts +5 -5
  162. package/lib/esm/entities/index.js +2 -2
  163. package/lib/esm/entities/midnight/deadline.d.ts +15 -0
  164. package/lib/esm/entities/midnight/deadline.js +20 -0
  165. package/lib/esm/entities/midnight/midnight.d.ts +427 -72
  166. package/lib/esm/entities/midnight/midnight.js +865 -187
  167. package/lib/esm/entities/midnight/publication.d.ts +134 -0
  168. package/lib/esm/entities/midnight/publication.js +397 -0
  169. package/lib/esm/entities/midnight/types.d.ts +26 -5
  170. package/lib/esm/entities/requirements/assertContractCode.d.ts +49 -0
  171. package/lib/esm/entities/requirements/assertContractCode.js +74 -0
  172. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +19 -4
  173. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +47 -20
  174. package/lib/esm/entities/requirements/getUnusedPermit2Nonce.d.ts +3 -2
  175. package/lib/esm/entities/requirements/getUnusedPermit2Nonce.js +5 -2
  176. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +5 -1
  177. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +8 -2
  178. package/lib/esm/entities/vaultV1/vaultV1.d.ts +63 -11
  179. package/lib/esm/entities/vaultV1/vaultV1.js +53 -16
  180. package/lib/esm/entities/vaultV2/vaultV2.d.ts +62 -44
  181. package/lib/esm/entities/vaultV2/vaultV2.js +54 -49
  182. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +3 -5
  183. package/lib/esm/entities/vaultV2BlueReallocationData.js +3 -9
  184. package/lib/esm/errors.d.ts +4 -4
  185. package/lib/esm/errors.js +4 -4
  186. package/lib/esm/fetch.d.ts +2 -2
  187. package/lib/esm/fetch.js +2 -2
  188. package/lib/esm/helpers/constant.d.ts +5 -0
  189. package/lib/esm/helpers/constant.js +5 -0
  190. package/lib/esm/helpers/index.d.ts +1 -1
  191. package/lib/esm/helpers/index.js +1 -1
  192. package/lib/esm/helpers/validate.d.ts +163 -8
  193. package/lib/esm/helpers/validate.js +177 -7
  194. package/lib/esm/helpers/validateMidnightBounds.d.ts +47 -0
  195. package/lib/esm/helpers/validateMidnightBounds.js +72 -0
  196. package/lib/esm/helpers/validateMidnightPublication.d.ts +12 -0
  197. package/lib/esm/helpers/validateMidnightPublication.js +139 -0
  198. package/lib/esm/helpers/validateMidnightReceiver.d.ts +29 -0
  199. package/lib/esm/helpers/validateMidnightReceiver.js +80 -0
  200. package/lib/esm/helpers/validateMidnightTakeFeasibility.d.ts +102 -0
  201. package/lib/esm/helpers/validateMidnightTakeFeasibility.js +226 -0
  202. package/lib/esm/index.d.ts +1 -0
  203. package/lib/esm/index.js +1 -0
  204. package/lib/esm/midnight/errors.d.ts +1 -2
  205. package/lib/esm/midnight/errors.js +1 -2
  206. package/lib/esm/types/error.d.ts +197 -4
  207. package/lib/esm/types/error.js +253 -2
  208. package/lib/esm/types/index.d.ts +1 -0
  209. package/lib/esm/types/index.js +1 -0
  210. package/lib/esm/types/midnightCancelAndMake.d.ts +70 -0
  211. package/lib/esm/types/midnightCancelAndMake.js +1 -0
  212. package/lib/esm/types/midnightPublicationError.d.ts +332 -0
  213. package/lib/esm/types/midnightPublicationError.js +359 -0
  214. package/lib/esm/types.d.ts +1 -1
  215. package/lib/esm/utils.d.ts +4 -3
  216. package/lib/esm/utils.js +4 -3
  217. package/package.json +9 -8
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WrappedToken = exports.VaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1Adapter = exports.VaultV2MidnightAdapter = exports.VaultV2BluePublicAllocatorConfig = exports.VaultV2BlueMarketPublicAllocatorConfig = exports.VaultV2Adapter = exports.VaultV2 = exports.VaultUser = exports.VaultToken = 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.AccrualVaultV2MidnightAdapter = exports.AccrualVaultV2 = exports.AccrualVault = exports.AccrualPosition = void 0;
3
+ exports.WrappedToken = exports.VaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoMarketV1AdapterV2 = exports.VaultV2MorphoMarketV1Adapter = exports.VaultV2BluePublicAllocatorConfig = exports.VaultV2BlueMarketPublicAllocatorConfig = exports.VaultV2Adapter = exports.VaultV2 = exports.VaultUser = exports.VaultToken = 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
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "AccrualPosition", { enumerable: true, get: function () { return blue_sdk_1.AccrualPosition; } });
6
6
  Object.defineProperty(exports, "AccrualVault", { enumerable: true, get: function () { return blue_sdk_1.AccrualVault; } });
7
7
  Object.defineProperty(exports, "AccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2; } });
8
- Object.defineProperty(exports, "AccrualVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MidnightAdapter; } });
9
8
  Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter; } });
10
9
  Object.defineProperty(exports, "AccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2; } });
11
10
  Object.defineProperty(exports, "AccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter; } });
@@ -33,7 +32,6 @@ Object.defineProperty(exports, "VaultV2", { enumerable: true, get: function () {
33
32
  Object.defineProperty(exports, "VaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Adapter; } });
34
33
  Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfig; } });
35
34
  Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfig; } });
36
- Object.defineProperty(exports, "VaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MidnightAdapter; } });
37
35
  Object.defineProperty(exports, "VaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1Adapter; } });
38
36
  Object.defineProperty(exports, "VaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoMarketV1AdapterV2; } });
39
37
  Object.defineProperty(exports, "VaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MorphoVaultV1Adapter; } });
@@ -1,4 +1,4 @@
1
- export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, InvalidPositionAccrualStateError, InvalidPositionLossFactorError, InvalidVaultV2MidnightAdapterMarketsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
1
+ export { BlueErrors, DivisionByZeroError, IncompleteChainRegistryError, InvalidAddressError, InvalidBitLengthError, InvalidMarketParamsError, RegistryValueAlreadyRegisteredError, UnknownAddressError, UnknownDataError, UnknownFactory, UnknownMarketAllocationError, UnknownMarketParamsError, UnknownOfFactory, UnknownTokenError, UnknownTokenPriceError, UnknownVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError, UnsupportedVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MarketParamsIdMismatchError, NonTupleReturnValueError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
4
+ export { getUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsupportedPermitDomainExtensionsError = exports.UnresolvedBlockNumberError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.NonTupleReturnValueError = exports.MarketParamsIdMismatchError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownOfFactory = exports.UnknownMarketParamsError = exports.UnknownMarketAllocationError = exports.UnknownFactory = exports.UnknownDataError = exports.UnknownAddressError = exports.RegistryValueAlreadyRegisteredError = exports.InvalidVaultV2MidnightAdapterMarketsError = exports.InvalidPositionLossFactorError = exports.InvalidPositionAccrualStateError = exports.InvalidMarketParamsError = exports.InvalidBitLengthError = exports.InvalidAddressError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
3
+ exports.UnsupportedPermitDomainExtensionsError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.NonTupleReturnValueError = exports.MissingPermitDomainNameError = exports.MarketParamsIdMismatchError = exports.MalformedTokenMetadataError = exports.isUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedMarketIrmError = 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.InvalidAddressError = exports.IncompleteChainRegistryError = exports.DivisionByZeroError = exports.BlueErrors = void 0;
4
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
6
6
  Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return blue_sdk_1.DivisionByZeroError; } });
@@ -8,9 +8,6 @@ Object.defineProperty(exports, "IncompleteChainRegistryError", { enumerable: tru
8
8
  Object.defineProperty(exports, "InvalidAddressError", { enumerable: true, get: function () { return blue_sdk_1.InvalidAddressError; } });
9
9
  Object.defineProperty(exports, "InvalidBitLengthError", { enumerable: true, get: function () { return blue_sdk_1.InvalidBitLengthError; } });
10
10
  Object.defineProperty(exports, "InvalidMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidMarketParamsError; } });
11
- Object.defineProperty(exports, "InvalidPositionAccrualStateError", { enumerable: true, get: function () { return blue_sdk_1.InvalidPositionAccrualStateError; } });
12
- Object.defineProperty(exports, "InvalidPositionLossFactorError", { enumerable: true, get: function () { return blue_sdk_1.InvalidPositionLossFactorError; } });
13
- Object.defineProperty(exports, "InvalidVaultV2MidnightAdapterMarketsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidVaultV2MidnightAdapterMarketsError; } });
14
11
  Object.defineProperty(exports, "RegistryValueAlreadyRegisteredError", { enumerable: true, get: function () { return blue_sdk_1.RegistryValueAlreadyRegisteredError; } });
15
12
  Object.defineProperty(exports, "UnknownAddressError", { enumerable: true, get: function () { return blue_sdk_1.UnknownAddressError; } });
16
13
  Object.defineProperty(exports, "UnknownDataError", { enumerable: true, get: function () { return blue_sdk_1.UnknownDataError; } });
@@ -33,9 +30,10 @@ Object.defineProperty(exports, "InvalidNumberError", { enumerable: true, get: fu
33
30
  Object.defineProperty(exports, "InvalidPermitDomainChainIdError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainChainIdError; } });
34
31
  Object.defineProperty(exports, "InvalidPermitDomainVerifyingContractError", { enumerable: true, get: function () { return blue_sdk_viem_1.InvalidPermitDomainVerifyingContractError; } });
35
32
  Object.defineProperty(exports, "isUnknownOfFactoryError", { enumerable: true, get: function () { return blue_sdk_viem_1.isUnknownOfFactoryError; } });
33
+ Object.defineProperty(exports, "MalformedTokenMetadataError", { enumerable: true, get: function () { return blue_sdk_viem_1.MalformedTokenMetadataError; } });
36
34
  Object.defineProperty(exports, "MarketParamsIdMismatchError", { enumerable: true, get: function () { return blue_sdk_viem_1.MarketParamsIdMismatchError; } });
35
+ Object.defineProperty(exports, "MissingPermitDomainNameError", { enumerable: true, get: function () { return blue_sdk_viem_1.MissingPermitDomainNameError; } });
37
36
  Object.defineProperty(exports, "NonTupleReturnValueError", { enumerable: true, get: function () { return blue_sdk_viem_1.NonTupleReturnValueError; } });
38
37
  Object.defineProperty(exports, "UnknownAbiFunctionError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnknownAbiFunctionError; } });
39
38
  Object.defineProperty(exports, "UnnamedAbiOutputsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnnamedAbiOutputsError; } });
40
- Object.defineProperty(exports, "UnresolvedBlockNumberError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnresolvedBlockNumberError; } });
41
39
  Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
@@ -1,5 +1,5 @@
1
- export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
1
+ export { fetchAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket, fetchMarketParams, fetchPosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  fetchPreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
5
+ fetchPreLiquidationPosition, fetchToken, fetchUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.fetchUser = exports.fetchToken = exports.fetchPreLiquidationPosition = exports.fetchPreLiquidationParams = exports.fetchPosition = exports.fetchMarketParams = exports.fetchMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2MidnightAdapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchAccrualPosition = void 0;
3
+ 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.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
4
  var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
5
5
  Object.defineProperty(exports, "fetchAccrualPosition", { 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; } });
10
9
  Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1Adapter; } });
11
10
  Object.defineProperty(exports, "fetchAccrualVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoMarketV1AdapterV2; } });
12
11
  Object.defineProperty(exports, "fetchAccrualVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MorphoVaultV1Adapter; } });
@@ -30,7 +29,6 @@ Object.defineProperty(exports, "fetchVaultV2Adapter", { enumerable: true, get: f
30
29
  Object.defineProperty(exports, "fetchVaultV2BlueMarketPublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BlueMarketPublicAllocatorConfig; } });
31
30
  Object.defineProperty(exports, "fetchVaultV2BluePublicAllocatorConfig", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2BluePublicAllocatorConfig; } });
32
31
  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; } });
34
32
  Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1Adapter; } });
35
33
  Object.defineProperty(exports, "fetchVaultV2MorphoMarketV1AdapterV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoMarketV1AdapterV2; } });
36
34
  Object.defineProperty(exports, "fetchVaultV2MorphoVaultV1Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchVaultV2MorphoVaultV1Adapter; } });
@@ -1,2 +1,2 @@
1
1
  export type { BigIntish, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams, Loadable, MarketId, MaxBorrowOptions, MaxPositionCapacities, MaxWithdrawCollateralOptions, Pending, } from "@morpho-org/blue-sdk";
2
- export type { AuthorizationArgs, DeploylessFetchParameters, FetchParameters, InputAllocation, MetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs, } from "@morpho-org/blue-sdk-viem";
2
+ export type { AuthorizationArgs, DeploylessFetchParameters, FetchParameters, InputAllocation, MetaMorphoCall, Permit2PermitArgs, Permit2TransferFromArgs, PermitArgs, TokenMetadataField, } from "@morpho-org/blue-sdk-viem";
@@ -3,5 +3,5 @@ export { AdaptiveCurveIrmLib, CapacityLimitReason,
3
3
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
4
4
  defaultPreLiquidationParamsRegistry,
5
5
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
6
- getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2MidnightAdapterUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
7
- export { decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
6
+ getDefaultPreLiquidationParams, MarketUtils, MathLib, SharesMath, VaultUtils, VaultV2BlueMarketPublicAllocatorConfigUtils, VaultV2BluePublicAllocatorConfigUtils, VaultV2Utils, } from "@morpho-org/blue-sdk";
7
+ export { catchRevertOnly, decodeBytes32String, getAuthorizationTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, isContractRevertError, isTransportError, isUndecodableResultError, MetaMorphoAction, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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.getAuthorizationTypedData = exports.decodeBytes32String = exports.VaultV2Utils = exports.VaultV2MidnightAdapterUtils = exports.VaultV2BluePublicAllocatorConfigUtils = exports.VaultV2BlueMarketPublicAllocatorConfigUtils = exports.VaultUtils = exports.SharesMath = exports.MathLib = exports.MarketUtils = exports.getDefaultPreLiquidationParams = exports.defaultPreLiquidationParamsRegistry = exports.CapacityLimitReason = exports.AdaptiveCurveIrmLib = void 0;
3
+ exports.safeParseUnits = exports.safeParseNumber = exports.safeGetAddress = exports.restructure = exports.readContractRestructured = exports.optionalBoolean = exports.MetaMorphoAction = exports.isUndecodableResultError = exports.isTransportError = exports.isContractRevertError = exports.getPermitTypedData = exports.getPermit2TransferFromTypedData = exports.getPermit2PermitTypedData = exports.getAuthorizationTypedData = exports.decodeBytes32String = exports.catchRevertOnly = 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
4
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
5
5
  Object.defineProperty(exports, "AdaptiveCurveIrmLib", { enumerable: true, get: function () { return blue_sdk_1.AdaptiveCurveIrmLib; } });
6
6
  Object.defineProperty(exports, "CapacityLimitReason", { enumerable: true, get: function () { return blue_sdk_1.CapacityLimitReason; } });
@@ -14,14 +14,17 @@ Object.defineProperty(exports, "SharesMath", { enumerable: true, get: function (
14
14
  Object.defineProperty(exports, "VaultUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultUtils; } });
15
15
  Object.defineProperty(exports, "VaultV2BlueMarketPublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BlueMarketPublicAllocatorConfigUtils; } });
16
16
  Object.defineProperty(exports, "VaultV2BluePublicAllocatorConfigUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2BluePublicAllocatorConfigUtils; } });
17
- Object.defineProperty(exports, "VaultV2MidnightAdapterUtils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2MidnightAdapterUtils; } });
18
17
  Object.defineProperty(exports, "VaultV2Utils", { enumerable: true, get: function () { return blue_sdk_1.VaultV2Utils; } });
19
18
  var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
19
+ Object.defineProperty(exports, "catchRevertOnly", { enumerable: true, get: function () { return blue_sdk_viem_1.catchRevertOnly; } });
20
20
  Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return blue_sdk_viem_1.decodeBytes32String; } });
21
21
  Object.defineProperty(exports, "getAuthorizationTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getAuthorizationTypedData; } });
22
22
  Object.defineProperty(exports, "getPermit2PermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2PermitTypedData; } });
23
23
  Object.defineProperty(exports, "getPermit2TransferFromTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermit2TransferFromTypedData; } });
24
24
  Object.defineProperty(exports, "getPermitTypedData", { enumerable: true, get: function () { return blue_sdk_viem_1.getPermitTypedData; } });
25
+ Object.defineProperty(exports, "isContractRevertError", { enumerable: true, get: function () { return blue_sdk_viem_1.isContractRevertError; } });
26
+ Object.defineProperty(exports, "isTransportError", { enumerable: true, get: function () { return blue_sdk_viem_1.isTransportError; } });
27
+ Object.defineProperty(exports, "isUndecodableResultError", { enumerable: true, get: function () { return blue_sdk_viem_1.isUndecodableResultError; } });
25
28
  Object.defineProperty(exports, "MetaMorphoAction", { enumerable: true, get: function () { return blue_sdk_viem_1.MetaMorphoAction; } });
26
29
  Object.defineProperty(exports, "optionalBoolean", { enumerable: true, get: function () { return blue_sdk_viem_1.optionalBoolean; } });
27
30
  Object.defineProperty(exports, "readContractRestructured", { enumerable: true, get: function () { return blue_sdk_viem_1.readContractRestructured; } });
@@ -31,7 +31,8 @@ export interface BlueActions {
31
31
  *
32
32
  * @param parameters - Optional fetch parameters (block number, state overrides).
33
33
  * @returns Market state including total supply/borrow assets and shares.
34
- * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
34
+ * @throws {ChainIdMismatchError} when the connected client declares another chain or none, or its RPC reports another chain via `eth_chainId`.
35
+ * @throws {viem.BaseError} when the `eth_chainId` request or a state read fails.
35
36
  * @example
36
37
  * ```ts
37
38
  * import { markets } from "@morpho-org/morpho-test";
@@ -52,7 +53,8 @@ export interface BlueActions {
52
53
  * @param userAddress - The user whose position to fetch.
53
54
  * @param parameters - Optional fetch parameters (block number, state overrides).
54
55
  * @returns Accrual position with health metrics (maxBorrowAssets, ltv, isHealthy).
55
- * @throws {ChainIdMismatchError} when the connected client targets another chain or has no chain.
56
+ * @throws {ChainIdMismatchError} when the connected client declares another chain or none, or its RPC reports another chain via `eth_chainId`.
57
+ * @throws {viem.BaseError} when the `eth_chainId` request or a state read fails.
56
58
  * @example
57
59
  * ```ts
58
60
  * import { markets } from "@morpho-org/morpho-test";
@@ -81,7 +83,8 @@ export interface BlueActions {
81
83
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
82
84
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
83
85
  * @returns Lazy token prerequisite resolution and a synchronous deep-frozen transaction.
84
- * @throws {ChainIdMismatchError} when the client targets another chain.
86
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
87
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
85
88
  * @throws {ExpiredDeadlineError} when the deadline is stale.
86
89
  * @throws {NonPositiveInputError} when `collateralAssets` is not positive.
87
90
  * @throws {NegativeInputError} when collateral, native funding, or the referral fee is negative.
@@ -101,7 +104,14 @@ export interface BlueActions {
101
104
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when a signature cannot be encoded safely.
102
105
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
103
106
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
104
- * @throws {viem.BaseError} from `getRequirements()` when an allowance, nonce, or token metadata read fails.
107
+ * @throws {UnknownTokenError} from `getRequirements()` when the funded token's `decimals()` is unusable.
108
+ * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
109
+ * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
110
+ * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
111
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
112
+ * contract has no code at its registered address.
113
+ * @throws {viem.BaseError} from `getRequirements()` when an allowance, nonce, or token metadata
114
+ * read or `eth_chainId` request fails.
105
115
  * @example
106
116
  * ```ts
107
117
  * import { markets } from "@morpho-org/morpho-test";
@@ -132,9 +142,11 @@ export interface BlueActions {
132
142
  /**
133
143
  * Prepares a direct BlueBundlesV1 loan-asset supply.
134
144
  *
135
- * `getRequirements()` reads only the loan-token allowance and selected ERC-2612 or Permit2
136
- * nonce state. Direct approvals and ERC-2612 name BlueBundlesV1 as spender; Permit2 keeps its
137
- * ERC-20 approval on canonical Permit2. Native funding is exclusive and skips token requirements.
145
+ * `getRequirements()` first checks that BlueBundlesV1, Blue and, for ERC-20 funding with
146
+ * signatures enabled, Permit2 hold code at their registered addresses, then reads the loan-token
147
+ * allowance and selected ERC-2612 or Permit2 nonce state. Direct approvals and ERC-2612 name
148
+ * BlueBundlesV1 as spender; Permit2 keeps its ERC-20 approval on canonical Permit2. Native
149
+ * funding is exclusive and skips token requirements (the code check still runs).
138
150
  * The referral fee is deducted from the gross `assets` supplied. This route exposes no
139
151
  * share-price bound or `slippageTolerance`.
140
152
  *
@@ -145,7 +157,8 @@ export interface BlueActions {
145
157
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
146
158
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
147
159
  * @returns Lazy prerequisite resolution and a synchronous deep-frozen transaction builder.
148
- * @throws {ChainIdMismatchError} when the client targets another chain.
160
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
161
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
149
162
  * @throws {ExpiredDeadlineError} when the deadline is not in the future at creation or requirement resolution.
150
163
  * @throws {NonPositiveInputError} when `assets` is not positive.
151
164
  * @throws {NegativeInputError} when native funding or the referral fee is negative, or from `getRequirements()` when an explicit `permit2Nonce` is negative.
@@ -166,7 +179,14 @@ export interface BlueActions {
166
179
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when a signature cannot be encoded safely.
167
180
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
168
181
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
169
- * @throws {viem.BaseError} from `getRequirements()` when a required allowance, nonce, or token metadata read fails.
182
+ * @throws {UnknownTokenError} from `getRequirements()` when the funded token's `decimals()` is unusable.
183
+ * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
184
+ * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
185
+ * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
186
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
187
+ * contract has no code at its registered address.
188
+ * @throws {viem.BaseError} from `getRequirements()` when a required allowance, nonce, or token
189
+ * metadata read or `eth_chainId` request fails.
170
190
  * @example
171
191
  * ```ts
172
192
  * import { markets } from "@morpho-org/morpho-test";
@@ -213,7 +233,8 @@ export interface BlueActions {
213
233
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
214
234
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
215
235
  * @returns Lazy authorization resolution and a synchronous deep-frozen transaction builder.
216
- * @throws {ChainIdMismatchError} when the client targets another chain.
236
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
237
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
217
238
  * @throws {ExpiredDeadlineError} when the deadline is stale.
218
239
  * @throws {MissingAccrualPositionError} when no position snapshot is provided at runtime.
219
240
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
@@ -237,7 +258,10 @@ export interface BlueActions {
237
258
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when authorization cannot be encoded safely.
238
259
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
239
260
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
240
- * @throws {viem.BaseError} from `getRequirements()` when authorization reads fail.
261
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
262
+ * contract has no code at its registered address.
263
+ * @throws {viem.BaseError} from `getRequirements()` when an authorization read or
264
+ * `eth_chainId` request fails.
241
265
  * @example
242
266
  * ```ts
243
267
  * import { AccrualPosition } from "@morpho-org/blue-sdk";
@@ -288,7 +312,8 @@ export interface BlueActions {
288
312
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
289
313
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
290
314
  * @returns Lazy Blue authorization resolution and a synchronous deep-frozen transaction.
291
- * @throws {ChainIdMismatchError} when the client targets another chain.
315
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
316
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
292
317
  * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
293
318
  * @throws {ExpiredDeadlineError} when the deadline is stale.
294
319
  * @throws {MissingAccrualPositionError} when no position snapshot is provided.
@@ -312,7 +337,10 @@ export interface BlueActions {
312
337
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when authorization cannot be encoded safely.
313
338
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
314
339
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
315
- * @throws {viem.BaseError} from `getRequirements()` when authorization reads fail.
340
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
341
+ * contract has no code at its registered address.
342
+ * @throws {viem.BaseError} from `getRequirements()` when an authorization read or
343
+ * `eth_chainId` request fails.
316
344
  * @example
317
345
  * ```ts
318
346
  * import { AccrualPosition } from "@morpho-org/blue-sdk";
@@ -364,7 +392,8 @@ export interface BlueActions {
364
392
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
365
393
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
366
394
  * @returns Lazy token prerequisite resolution and a synchronous deep-frozen transaction.
367
- * @throws {ChainIdMismatchError} when the client targets another chain.
395
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
396
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
368
397
  * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
369
398
  * @throws {ExpiredDeadlineError} when the deadline is stale.
370
399
  * @throws {MissingAccrualPositionError} when no position snapshot is provided.
@@ -394,7 +423,14 @@ export interface BlueActions {
394
423
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when a signature cannot be encoded safely.
395
424
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
396
425
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
397
- * @throws {viem.BaseError} from `getRequirements()` when an allowance, nonce, or token metadata read fails.
426
+ * @throws {UnknownTokenError} from `getRequirements()` when the funded token's `decimals()` is unusable.
427
+ * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
428
+ * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
429
+ * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
430
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
431
+ * contract has no code at its registered address.
432
+ * @throws {viem.BaseError} from `getRequirements()` when an allowance, nonce, token metadata,
433
+ * or `eth_chainId` read fails.
398
434
  * @example
399
435
  * ```ts
400
436
  * import { AccrualPosition } from "@morpho-org/blue-sdk";
@@ -449,7 +485,8 @@ export interface BlueActions {
449
485
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
450
486
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
451
487
  * @returns Lazy Blue authorization resolution and a synchronous deep-frozen transaction.
452
- * @throws {ChainIdMismatchError} when the client targets another chain.
488
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
489
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
453
490
  * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
454
491
  * @throws {ExpiredDeadlineError} when the deadline is stale.
455
492
  * @throws {MissingAccrualPositionError} when no position snapshot is provided.
@@ -468,7 +505,10 @@ export interface BlueActions {
468
505
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when authorization cannot be encoded safely.
469
506
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
470
507
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
471
- * @throws {viem.BaseError} from `getRequirements()` when authorization reads fail.
508
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
509
+ * contract has no code at its registered address.
510
+ * @throws {viem.BaseError} from `getRequirements()` when an authorization read or
511
+ * `eth_chainId` request fails.
472
512
  * @example
473
513
  * ```ts
474
514
  * import { AccrualPosition } from "@morpho-org/blue-sdk";
@@ -526,7 +566,8 @@ export interface BlueActions {
526
566
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
527
567
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
528
568
  * @returns Lazy funding/authorization resolution and a synchronous deep-frozen transaction builder.
529
- * @throws {ChainIdMismatchError} when the client targets another chain.
569
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
570
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
530
571
  * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
531
572
  * @throws {MissingAccrualPositionError} when no position snapshot is provided at runtime.
532
573
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
@@ -559,7 +600,14 @@ export interface BlueActions {
559
600
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when a signature cannot be encoded safely.
560
601
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
561
602
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
562
- * @throws {viem.BaseError} from `getRequirements()` when a required allowance, nonce, token metadata, or authorization read fails.
603
+ * @throws {UnknownTokenError} from `getRequirements()` when the funded token's `decimals()` is unusable.
604
+ * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
605
+ * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
606
+ * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
607
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
608
+ * contract has no code at its registered address.
609
+ * @throws {viem.BaseError} from `getRequirements()` when a required allowance, nonce, token
610
+ * metadata, authorization, or `eth_chainId` read fails.
563
611
  * @example
564
612
  * ```ts
565
613
  * import { AccrualPosition } from "@morpho-org/blue-sdk";
@@ -625,7 +673,8 @@ export interface BlueActions {
625
673
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
626
674
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
627
675
  * @returns Lazy funding/authorization resolution and a synchronous deep-frozen transaction builder.
628
- * @throws {ChainIdMismatchError} when the client targets another chain.
676
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
677
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
629
678
  * @throws {UnsupportedBlueMarketIrmError} when positive debt requires an unsupported IRM projection.
630
679
  * @throws {MissingAccrualPositionError} when a borrow has no position snapshot.
631
680
  * @throws {MarketIdMismatchError} when `positionData` belongs to another market.
@@ -658,7 +707,14 @@ export interface BlueActions {
658
707
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when a signature cannot be encoded safely.
659
708
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
660
709
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
661
- * @throws {viem.BaseError} from `getRequirements()` when a required allowance, nonce, token metadata, or authorization read fails.
710
+ * @throws {UnknownTokenError} from `getRequirements()` when the funded token's `decimals()` is unusable.
711
+ * @throws {MalformedTokenMetadataError} when the token's `eip712Domain()` or
712
+ * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
713
+ * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
714
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
715
+ * contract has no code at its registered address.
716
+ * @throws {viem.BaseError} from `getRequirements()` when a required allowance, nonce, token
717
+ * metadata, authorization, or `eth_chainId` read fails.
662
718
  * @example
663
719
  * ```ts
664
720
  * import { markets } from "@morpho-org/morpho-test";
@@ -714,7 +770,8 @@ export interface BlueActions {
714
770
  * @param params.referralFeePct - Optional WAD-scaled referral fee below 100%.
715
771
  * @param params.referralFeeRecipient - Recipient required for a positive fee.
716
772
  * @returns Lazy Blue authorization resolution and a synchronous deep-frozen transaction builder.
717
- * @throws {ChainIdMismatchError} when the client targets another chain.
773
+ * @throws {ChainIdMismatchError} when the client targets another chain, or from
774
+ * `getRequirements()` when the RPC reports another chain via `eth_chainId`.
718
775
  * @throws {UnsupportedBlueMarketIrmError} when positive source or destination debt requires an unsupported IRM projection.
719
776
  * @throws {MissingAccrualPositionError} when either position snapshot is absent at runtime.
720
777
  * @throws {MarketIdMismatchError} when a position snapshot belongs to another market.
@@ -740,7 +797,10 @@ export interface BlueActions {
740
797
  * @throws {BundlesRequirementSignatureMismatchError} from `buildTx()` when authorization cannot be encoded safely.
741
798
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
742
799
  * @throws {UnknownAddressError} when BlueBundlesV1 is not registered.
743
- * @throws {viem.BaseError} from `getRequirements()` when authorization reads fail.
800
+ * @throws {MissingContractCodeError} from `getRequirements()` when a fixed bundles or protocol
801
+ * contract has no code at its registered address.
802
+ * @throws {viem.BaseError} from `getRequirements()` when an authorization read or
803
+ * `eth_chainId` request fails.
744
804
  * @example
745
805
  * ```ts
746
806
  * import { AccrualPosition } from "@morpho-org/blue-sdk";
@@ -797,13 +857,19 @@ export interface BlueActions {
797
857
  * @param params.block.number - Block number used for every RPC read.
798
858
  * @param params.block.timestamp - Timestamp corresponding to the fetched block.
799
859
  * @returns A `VaultV2BlueReallocationData` snapshot ready for {@link getVaultV2BlueReallocations}.
800
- * @throws {ChainIdMismatchError} when the client chain does not match this market.
860
+ * @throws {ChainIdMismatchError} when the client declares another chain or its RPC reports another
861
+ * chain via `eth_chainId`.
801
862
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
802
863
  * @throws {UnknownAddressError} when the chain has no BluePublicAllocator deployment.
803
864
  * @throws {UnknownBlueFactory} when the chain has no Vault V2 factory.
804
865
  * @throws {UnknownBlueOfFactory} when a requested address is not a Vault V2 from that factory.
805
866
  * @throws {UnsupportedBlueVaultV2AdapterError} when a vault contains an unsupported adapter.
806
- * @throws {viem.BaseError} when an RPC or contract read fails with no fallback left.
867
+ * @throws {UnknownTokenError} when a vault's share token has unusable decimals.
868
+ * @throws {MalformedTokenMetadataError} when the share token's `eip712Domain()` or
869
+ * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
870
+ * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
871
+ * @throws {viem.BaseError} when the `eth_chainId` request fails or a later RPC or contract read
872
+ * fails with no fallback left.
807
873
  */
808
874
  getVaultV2BlueReallocationData: (params: {
809
875
  vaultAddresses: readonly Address[];
@@ -862,6 +928,16 @@ export declare class MorphoBlue implements BlueActions {
862
928
  constructor(client: MorphoClientType, marketParams: MarketParams, chainId: number);
863
929
  private validateDeadline;
864
930
  private validateWriteCommon;
931
+ /**
932
+ * Asserts that every registry contract this flow's transaction targets or names as
933
+ * spender/authorized operator holds code, with one `eth_getCode` per distinct address
934
+ * before any other requirement read. Blue write flows probe `eth_chainId` only after a target
935
+ * has no code and report a chain mismatch when the RPC serves another chain.
936
+ *
937
+ * @param params.erc20Funding - Whether the flow resolves an ERC-20 funding leg, which
938
+ * may name canonical Permit2 when signatures are supported.
939
+ */
940
+ private assertWriteTargets;
865
941
  private getMaxLtv;
866
942
  private getBlueBundlesV1QuoteTimestamp;
867
943
  private getTokenRequirements;
@@ -998,13 +1074,19 @@ export declare class MorphoBlue implements BlueActions {
998
1074
  * @param params.block.number - Block number used for every RPC read.
999
1075
  * @param params.block.timestamp - Timestamp corresponding to the fetched block.
1000
1076
  * @returns A `VaultV2BlueReallocationData` snapshot ready for {@link getVaultV2BlueReallocations}.
1001
- * @throws {ChainIdMismatchError} when the client chain does not match this market.
1077
+ * @throws {ChainIdMismatchError} when the client declares another chain or its RPC reports another
1078
+ * chain via `eth_chainId`.
1002
1079
  * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
1003
1080
  * @throws {UnknownAddressError} when the chain has no BluePublicAllocator deployment.
1004
1081
  * @throws {UnknownBlueFactory} when the chain has no Vault V2 factory.
1005
1082
  * @throws {UnknownBlueOfFactory} when a requested address is not a Vault V2 from that factory.
1006
1083
  * @throws {UnsupportedBlueVaultV2AdapterError} when a vault contains an unsupported adapter.
1007
- * @throws {viem.BaseError} when an RPC or contract read fails with no fallback left.
1084
+ * @throws {UnknownTokenError} when a vault's share token has unusable decimals.
1085
+ * @throws {MalformedTokenMetadataError} when the share token's `eip712Domain()` or
1086
+ * `bytes32` `name`/`symbol` retry returns non-empty data that does not decode, or when the
1087
+ * deployless query reports malformed `name()`/`symbol()`/`eip712Domain()` returndata (no fallback).
1088
+ * @throws {viem.BaseError} when the `eth_chainId` request fails or a later RPC or contract read
1089
+ * fails with no fallback left.
1008
1090
  * @example
1009
1091
  * ```ts
1010
1092
  * import { markets } from "@morpho-org/morpho-test";