@morpho-org/morpho-sdk 10.0.0-next.0 → 10.0.1

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 (282) hide show
  1. package/README.md +104 -12
  2. package/lib/cjs/abis.d.ts +1 -1
  3. package/lib/cjs/abis.js +1 -5
  4. package/lib/cjs/actions/blue/common.js +4 -2
  5. package/lib/cjs/actions/blue/withdrawBuyCallback.js +2 -1
  6. package/lib/cjs/actions/bundles/common.js +20 -14
  7. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +2 -1
  8. package/lib/cjs/actions/midnight/cancelOffers.js +2 -1
  9. package/lib/cjs/actions/midnight/supplyCollateralBatch.js +4 -2
  10. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +2 -1
  11. package/lib/cjs/actions/midnight/takeBorrow.js +2 -1
  12. package/lib/cjs/actions/midnight/takeLend.js +2 -1
  13. package/lib/cjs/actions/midnight/takeRepayWithdrawCollateral.js +2 -1
  14. package/lib/cjs/actions/midnight/takeWithdraw.js +2 -1
  15. package/lib/cjs/actions/midnight/withdrawCollateralBatch.js +4 -2
  16. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +2 -11
  17. package/lib/cjs/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
  18. package/lib/cjs/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
  19. package/lib/cjs/actions/vaultV1/inKindRedeem.js +6 -3
  20. package/lib/cjs/actions/vaultV1/migrateToV2.js +1 -1
  21. package/lib/cjs/actions/vaultV2/forceWithdraw.js +4 -2
  22. package/lib/cjs/actions/vaultV2/inKindRedeem.js +4 -2
  23. package/lib/cjs/blue/abis.d.ts +1 -1
  24. package/lib/cjs/blue/abis.js +1 -5
  25. package/lib/cjs/blue/entities.d.ts +4 -4
  26. package/lib/cjs/blue/entities.js +1 -3
  27. package/lib/cjs/blue/errors.d.ts +2 -2
  28. package/lib/cjs/blue/errors.js +1 -5
  29. package/lib/cjs/blue/fetch.d.ts +2 -2
  30. package/lib/cjs/blue/fetch.js +1 -3
  31. package/lib/cjs/blue/utils.d.ts +1 -1
  32. package/lib/cjs/blue/utils.js +1 -2
  33. package/lib/cjs/entities/blue/blue.js +8 -4
  34. package/lib/cjs/entities/index.d.ts +4 -4
  35. package/lib/cjs/entities/index.js +1 -3
  36. package/lib/cjs/entities/midnight/deadline.js +2 -1
  37. package/lib/cjs/entities/midnight/midnight.js +14 -7
  38. package/lib/cjs/entities/midnight/publication.js +73 -44
  39. package/lib/cjs/entities/requirements/assertContractCode.js +4 -2
  40. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +9 -13
  41. package/lib/cjs/entities/requirements/getErc2612Permit.js +10 -5
  42. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +2 -0
  43. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +7 -1
  44. package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
  45. package/lib/cjs/entities/requirements/getVaultV1InKindRedeemRequirements.js +111 -0
  46. package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
  47. package/lib/cjs/entities/requirements/getVaultV2ForceWithdrawRequirements.js +76 -0
  48. package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
  49. package/lib/cjs/entities/requirements/getVaultV2InKindRedeemRequirements.js +93 -0
  50. package/lib/cjs/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
  51. package/lib/cjs/entities/vaultV1/inKindRedeemQuote.js +85 -0
  52. package/lib/cjs/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
  53. package/lib/cjs/entities/vaultV1/migrateToV2Quote.js +37 -0
  54. package/lib/cjs/entities/vaultV1/vaultV1.js +51 -181
  55. package/lib/cjs/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
  56. package/lib/cjs/entities/vaultV2/forceWithdrawQuote.js +189 -0
  57. package/lib/cjs/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
  58. package/lib/cjs/entities/vaultV2/inKindRedeemQuote.js +110 -0
  59. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +8 -34
  60. package/lib/cjs/entities/vaultV2/vaultV2.js +62 -429
  61. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +2 -3
  62. package/lib/cjs/entities/vaultV2BlueReallocationData.js +346 -234
  63. package/lib/cjs/errors.d.ts +4 -4
  64. package/lib/cjs/errors.js +6 -7
  65. package/lib/cjs/fetch.d.ts +2 -2
  66. package/lib/cjs/fetch.js +1 -3
  67. package/lib/cjs/helpers/deadShares.js +34 -19
  68. package/lib/cjs/helpers/encodeMidnightCalldata.js +4 -2
  69. package/lib/cjs/helpers/metadata.js +12 -6
  70. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +10 -5
  71. package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +6 -3
  72. package/lib/cjs/helpers/utilization.js +10 -5
  73. package/lib/cjs/helpers/validate.js +12 -6
  74. package/lib/cjs/helpers/validateMidnightBounds.js +2 -1
  75. package/lib/cjs/helpers/validateMidnightCollateralBatch.js +2 -1
  76. package/lib/cjs/helpers/validateMidnightPublication.js +4 -2
  77. package/lib/cjs/helpers/validateMidnightTakeFeasibility.js +44 -22
  78. package/lib/cjs/helpers/validatePositiveInput.js +2 -1
  79. package/lib/cjs/helpers/validateTakeableOffers.js +2 -1
  80. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +14 -7
  81. package/lib/cjs/index.d.ts +2 -2
  82. package/lib/cjs/index.js +10 -1
  83. package/lib/cjs/midnight/errors.d.ts +1 -2
  84. package/lib/cjs/midnight/errors.js +4 -5
  85. package/lib/cjs/transactionPlan/approval.js +12 -1
  86. package/lib/cjs/transactionPlan/deposit.d.ts +22 -0
  87. package/lib/cjs/transactionPlan/deposit.js +139 -0
  88. package/lib/cjs/transactionPlan/error.d.ts +10 -8
  89. package/lib/cjs/transactionPlan/error.js +10 -8
  90. package/lib/cjs/transactionPlan/getTokenPermit.js +2 -1
  91. package/lib/cjs/transactionPlan/index.d.ts +18 -0
  92. package/lib/cjs/transactionPlan/index.js +23 -5
  93. package/lib/cjs/transactionPlan/intent.d.ts +3 -3
  94. package/lib/cjs/transactionPlan/intent.js +14 -7
  95. package/lib/cjs/transactionPlan/permit.d.ts +1 -1
  96. package/lib/cjs/transactionPlan/permit.js +86 -20
  97. package/lib/cjs/transactionPlan/plan.d.ts +16 -6
  98. package/lib/cjs/transactionPlan/plan.js +72 -22
  99. package/lib/cjs/transactionPlan/redeem.d.ts +18 -0
  100. package/lib/cjs/transactionPlan/redeem.js +63 -0
  101. package/lib/cjs/transactionPlan/requirements.d.ts +4 -3
  102. package/lib/cjs/transactionPlan/requirements.js +12 -6
  103. package/lib/cjs/transactionPlan/serde.d.ts +2 -2
  104. package/lib/cjs/transactionPlan/serde.js +41 -15
  105. package/lib/cjs/transactionPlan/shareSpending.d.ts +18 -0
  106. package/lib/cjs/transactionPlan/shareSpending.js +50 -0
  107. package/lib/cjs/transactionPlan/types.d.ts +117 -11
  108. package/lib/cjs/transactionPlan/validateActions.js +11 -1
  109. package/lib/cjs/transactionPlan/validation.js +6 -3
  110. package/lib/cjs/transactionPlan/vaultv1/deposit.d.ts +93 -0
  111. package/lib/cjs/transactionPlan/vaultv1/deposit.js +94 -0
  112. package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
  113. package/lib/cjs/transactionPlan/vaultv1/inKindRedeem.js +203 -0
  114. package/lib/cjs/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
  115. package/lib/cjs/transactionPlan/vaultv1/migrateToV2.js +217 -0
  116. package/lib/cjs/transactionPlan/vaultv1/redeem.d.ts +69 -0
  117. package/lib/cjs/transactionPlan/vaultv1/redeem.js +78 -0
  118. package/lib/cjs/transactionPlan/vaultv1/withdraw.d.ts +77 -0
  119. package/lib/cjs/transactionPlan/vaultv1/withdraw.js +88 -0
  120. package/lib/cjs/transactionPlan/vaultv2/deposit.d.ts +14 -31
  121. package/lib/cjs/transactionPlan/vaultv2/deposit.js +15 -141
  122. package/lib/cjs/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
  123. package/lib/cjs/transactionPlan/vaultv2/forceRedeem.js +155 -0
  124. package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
  125. package/lib/cjs/transactionPlan/vaultv2/forceWithdraw.js +206 -0
  126. package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
  127. package/lib/cjs/transactionPlan/vaultv2/inKindRedeem.js +206 -0
  128. package/lib/cjs/transactionPlan/vaultv2/redeem.d.ts +84 -0
  129. package/lib/cjs/transactionPlan/vaultv2/redeem.js +86 -0
  130. package/lib/cjs/transactionPlan/vaultv2/withdraw.d.ts +14 -27
  131. package/lib/cjs/transactionPlan/vaultv2/withdraw.js +17 -124
  132. package/lib/cjs/transactionPlan/version.js +2 -1
  133. package/lib/cjs/transactionPlan/withdraw.d.ts +18 -0
  134. package/lib/cjs/transactionPlan/withdraw.js +94 -0
  135. package/lib/cjs/types/action.js +16 -8
  136. package/lib/cjs/types/error.d.ts +8 -1
  137. package/lib/cjs/types/error.js +10 -1
  138. package/lib/cjs/utils.d.ts +2 -2
  139. package/lib/cjs/utils.js +2 -4
  140. package/lib/cjs/version.d.ts +1 -1
  141. package/lib/cjs/version.js +1 -1
  142. package/lib/esm/abis.d.ts +1 -1
  143. package/lib/esm/abis.js +1 -1
  144. package/lib/esm/actions/blue/common.js +4 -2
  145. package/lib/esm/actions/blue/withdrawBuyCallback.js +2 -1
  146. package/lib/esm/actions/bundles/common.js +20 -14
  147. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +2 -1
  148. package/lib/esm/actions/midnight/cancelOffers.js +2 -1
  149. package/lib/esm/actions/midnight/supplyCollateralBatch.js +4 -2
  150. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +2 -1
  151. package/lib/esm/actions/midnight/takeBorrow.js +2 -1
  152. package/lib/esm/actions/midnight/takeLend.js +2 -1
  153. package/lib/esm/actions/midnight/takeRepayWithdrawCollateral.js +2 -1
  154. package/lib/esm/actions/midnight/takeWithdraw.js +2 -1
  155. package/lib/esm/actions/midnight/withdrawCollateralBatch.js +4 -2
  156. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +4 -13
  157. package/lib/esm/actions/requirements/midnight/getMidnightApprovalRequirements.js +2 -1
  158. package/lib/esm/actions/requirements/midnight/getMidnightAuthorizationRequirement.js +2 -1
  159. package/lib/esm/actions/vaultV1/inKindRedeem.js +6 -3
  160. package/lib/esm/actions/vaultV1/migrateToV2.js +1 -1
  161. package/lib/esm/actions/vaultV2/forceWithdraw.js +4 -2
  162. package/lib/esm/actions/vaultV2/inKindRedeem.js +4 -2
  163. package/lib/esm/blue/abis.d.ts +1 -1
  164. package/lib/esm/blue/abis.js +1 -1
  165. package/lib/esm/blue/entities.d.ts +4 -4
  166. package/lib/esm/blue/entities.js +2 -2
  167. package/lib/esm/blue/errors.d.ts +2 -2
  168. package/lib/esm/blue/errors.js +2 -2
  169. package/lib/esm/blue/fetch.d.ts +2 -2
  170. package/lib/esm/blue/fetch.js +2 -2
  171. package/lib/esm/blue/utils.d.ts +1 -1
  172. package/lib/esm/blue/utils.js +1 -1
  173. package/lib/esm/entities/blue/blue.js +8 -4
  174. package/lib/esm/entities/index.d.ts +4 -4
  175. package/lib/esm/entities/index.js +2 -2
  176. package/lib/esm/entities/midnight/deadline.js +2 -1
  177. package/lib/esm/entities/midnight/midnight.js +14 -7
  178. package/lib/esm/entities/midnight/publication.js +73 -44
  179. package/lib/esm/entities/requirements/assertContractCode.js +4 -2
  180. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +10 -14
  181. package/lib/esm/entities/requirements/getErc2612Permit.js +10 -5
  182. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +2 -0
  183. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +7 -1
  184. package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.d.ts +21 -0
  185. package/lib/esm/entities/requirements/getVaultV1InKindRedeemRequirements.js +108 -0
  186. package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.d.ts +20 -0
  187. package/lib/esm/entities/requirements/getVaultV2ForceWithdrawRequirements.js +73 -0
  188. package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.d.ts +21 -0
  189. package/lib/esm/entities/requirements/getVaultV2InKindRedeemRequirements.js +90 -0
  190. package/lib/esm/entities/vaultV1/inKindRedeemQuote.d.ts +25 -0
  191. package/lib/esm/entities/vaultV1/inKindRedeemQuote.js +82 -0
  192. package/lib/esm/entities/vaultV1/migrateToV2Quote.d.ts +20 -0
  193. package/lib/esm/entities/vaultV1/migrateToV2Quote.js +34 -0
  194. package/lib/esm/entities/vaultV1/vaultV1.js +57 -187
  195. package/lib/esm/entities/vaultV2/forceWithdrawQuote.d.ts +25 -0
  196. package/lib/esm/entities/vaultV2/forceWithdrawQuote.js +186 -0
  197. package/lib/esm/entities/vaultV2/inKindRedeemQuote.d.ts +28 -0
  198. package/lib/esm/entities/vaultV2/inKindRedeemQuote.js +107 -0
  199. package/lib/esm/entities/vaultV2/vaultV2.d.ts +8 -34
  200. package/lib/esm/entities/vaultV2/vaultV2.js +70 -437
  201. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +2 -3
  202. package/lib/esm/entities/vaultV2BlueReallocationData.js +346 -234
  203. package/lib/esm/errors.d.ts +4 -4
  204. package/lib/esm/errors.js +4 -4
  205. package/lib/esm/fetch.d.ts +2 -2
  206. package/lib/esm/fetch.js +2 -2
  207. package/lib/esm/helpers/deadShares.js +35 -20
  208. package/lib/esm/helpers/encodeMidnightCalldata.js +4 -2
  209. package/lib/esm/helpers/metadata.js +12 -6
  210. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +10 -5
  211. package/lib/esm/helpers/previewVaultV2InKindRedeem.js +6 -3
  212. package/lib/esm/helpers/utilization.js +10 -5
  213. package/lib/esm/helpers/validate.js +12 -6
  214. package/lib/esm/helpers/validateMidnightBounds.js +2 -1
  215. package/lib/esm/helpers/validateMidnightCollateralBatch.js +2 -1
  216. package/lib/esm/helpers/validateMidnightPublication.js +4 -2
  217. package/lib/esm/helpers/validateMidnightTakeFeasibility.js +44 -22
  218. package/lib/esm/helpers/validatePositiveInput.js +2 -1
  219. package/lib/esm/helpers/validateTakeableOffers.js +2 -1
  220. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +14 -7
  221. package/lib/esm/index.d.ts +2 -2
  222. package/lib/esm/index.js +1 -1
  223. package/lib/esm/midnight/errors.d.ts +1 -2
  224. package/lib/esm/midnight/errors.js +1 -2
  225. package/lib/esm/transactionPlan/approval.js +13 -2
  226. package/lib/esm/transactionPlan/deposit.d.ts +22 -0
  227. package/lib/esm/transactionPlan/deposit.js +135 -0
  228. package/lib/esm/transactionPlan/error.d.ts +10 -8
  229. package/lib/esm/transactionPlan/error.js +10 -8
  230. package/lib/esm/transactionPlan/getTokenPermit.js +2 -1
  231. package/lib/esm/transactionPlan/index.d.ts +18 -0
  232. package/lib/esm/transactionPlan/index.js +9 -0
  233. package/lib/esm/transactionPlan/intent.d.ts +3 -3
  234. package/lib/esm/transactionPlan/intent.js +14 -7
  235. package/lib/esm/transactionPlan/permit.d.ts +1 -1
  236. package/lib/esm/transactionPlan/permit.js +86 -20
  237. package/lib/esm/transactionPlan/plan.d.ts +16 -6
  238. package/lib/esm/transactionPlan/plan.js +68 -18
  239. package/lib/esm/transactionPlan/redeem.d.ts +18 -0
  240. package/lib/esm/transactionPlan/redeem.js +59 -0
  241. package/lib/esm/transactionPlan/requirements.d.ts +4 -3
  242. package/lib/esm/transactionPlan/requirements.js +12 -6
  243. package/lib/esm/transactionPlan/serde.d.ts +2 -2
  244. package/lib/esm/transactionPlan/serde.js +41 -15
  245. package/lib/esm/transactionPlan/shareSpending.d.ts +18 -0
  246. package/lib/esm/transactionPlan/shareSpending.js +47 -0
  247. package/lib/esm/transactionPlan/types.d.ts +117 -11
  248. package/lib/esm/transactionPlan/validateActions.js +11 -1
  249. package/lib/esm/transactionPlan/validation.js +6 -3
  250. package/lib/esm/transactionPlan/vaultv1/deposit.d.ts +93 -0
  251. package/lib/esm/transactionPlan/vaultv1/deposit.js +90 -0
  252. package/lib/esm/transactionPlan/vaultv1/inKindRedeem.d.ts +96 -0
  253. package/lib/esm/transactionPlan/vaultv1/inKindRedeem.js +198 -0
  254. package/lib/esm/transactionPlan/vaultv1/migrateToV2.d.ts +94 -0
  255. package/lib/esm/transactionPlan/vaultv1/migrateToV2.js +212 -0
  256. package/lib/esm/transactionPlan/vaultv1/redeem.d.ts +69 -0
  257. package/lib/esm/transactionPlan/vaultv1/redeem.js +74 -0
  258. package/lib/esm/transactionPlan/vaultv1/withdraw.d.ts +77 -0
  259. package/lib/esm/transactionPlan/vaultv1/withdraw.js +84 -0
  260. package/lib/esm/transactionPlan/vaultv2/deposit.d.ts +14 -31
  261. package/lib/esm/transactionPlan/vaultv2/deposit.js +17 -142
  262. package/lib/esm/transactionPlan/vaultv2/forceRedeem.d.ts +74 -0
  263. package/lib/esm/transactionPlan/vaultv2/forceRedeem.js +150 -0
  264. package/lib/esm/transactionPlan/vaultv2/forceWithdraw.d.ts +98 -0
  265. package/lib/esm/transactionPlan/vaultv2/forceWithdraw.js +201 -0
  266. package/lib/esm/transactionPlan/vaultv2/inKindRedeem.d.ts +113 -0
  267. package/lib/esm/transactionPlan/vaultv2/inKindRedeem.js +201 -0
  268. package/lib/esm/transactionPlan/vaultv2/redeem.d.ts +84 -0
  269. package/lib/esm/transactionPlan/vaultv2/redeem.js +82 -0
  270. package/lib/esm/transactionPlan/vaultv2/withdraw.d.ts +14 -27
  271. package/lib/esm/transactionPlan/vaultv2/withdraw.js +19 -125
  272. package/lib/esm/transactionPlan/version.js +2 -1
  273. package/lib/esm/transactionPlan/withdraw.d.ts +18 -0
  274. package/lib/esm/transactionPlan/withdraw.js +90 -0
  275. package/lib/esm/types/action.js +16 -8
  276. package/lib/esm/types/error.d.ts +8 -1
  277. package/lib/esm/types/error.js +10 -1
  278. package/lib/esm/utils.d.ts +2 -2
  279. package/lib/esm/utils.js +2 -2
  280. package/lib/esm/version.d.ts +1 -1
  281. package/lib/esm/version.js +1 -1
  282. package/package.json +15 -15
@@ -1,7 +1,7 @@
1
- export { BlueErrors, IncompleteChainRegistryError, InvalidMarketParamsError as InvalidBlueMarketParamsError, InvalidVaultV2MidnightAdapterMarketsError as InvalidBlueVaultV2MidnightAdapterMarketsError, UnknownAddressError, UnknownDataError as UnknownBlueDataError, UnknownFactory as UnknownBlueFactory, UnknownMarketAllocationError as UnknownBlueMarketAllocationError, UnknownMarketParamsError as UnknownBlueMarketParamsError, UnknownOfFactory as UnknownBlueOfFactory, UnknownTokenError as UnknownBlueTokenError, UnknownTokenPriceError as UnknownBlueTokenPriceError, UnknownVaultConfigError as UnknownBlueVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError as UnsupportedBlueMarketIrmError,
1
+ export { BlueErrors, IncompleteChainRegistryError, InvalidMarketParamsError as InvalidBlueMarketParamsError, UnknownAddressError, UnknownDataError as UnknownBlueDataError, UnknownFactory as UnknownBlueFactory, UnknownMarketAllocationError as UnknownBlueMarketAllocationError, UnknownMarketParamsError as UnknownBlueMarketParamsError, UnknownOfFactory as UnknownBlueOfFactory, UnknownTokenError as UnknownBlueTokenError, UnknownTokenPriceError as UnknownBlueTokenPriceError, UnknownVaultConfigError as UnknownBlueVaultConfigError, UnsupportedChainIdError, UnsupportedMarketIrmError as UnsupportedBlueMarketIrmError,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  UnsupportedPreLiquidationParamsError as UnsupportedBluePreLiquidationParamsError, UnsupportedVaultV2AdapterError as UnsupportedBlueVaultV2AdapterError, VaultV2Errors, } from "@morpho-org/blue-sdk";
4
- export { getUnsupportedVaultV2Adapter as getBlueUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError as isBlueUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError as BlueMarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnresolvedBlockNumberError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
5
- export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureError as InvalidMidnightEcrecoverSignatureError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError, InvalidRateRatifierV1RateError as InvalidMidnightRateRatifierV1RateError, InvalidRateRatifierV1TickError as InvalidMidnightRateRatifierV1TickError, InvalidRateRatifierV1TimeError as InvalidMidnightRateRatifierV1TimeError, InvalidRatifierV1AddressError as InvalidMidnightRatifierV1AddressError, InvalidTickSpacingError as InvalidMidnightTickSpacingError, InvalidTreeError as InvalidMidnightTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError, RateRatifierV1BoundOverflowError as MidnightRateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError as MidnightRatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError, } from "@morpho-org/midnight-sdk";
4
+ export { getUnsupportedVaultV2Adapter as getBlueUnsupportedVaultV2Adapter, InvalidNumberError, InvalidPermitDomainChainIdError, InvalidPermitDomainVerifyingContractError, isUnknownOfFactoryError as isBlueUnknownOfFactoryError, MalformedTokenMetadataError, MarketParamsIdMismatchError as BlueMarketParamsIdMismatchError, MissingPermitDomainNameError, NonTupleReturnValueError, Permit2ExpirationOutOfRangeError, UnknownAbiFunctionError, UnnamedAbiOutputsError, UnsupportedPermitDomainExtensionsError, } from "@morpho-org/blue-sdk-viem";
5
+ export { ChainIdMismatchError as MidnightChainIdMismatchError, InvalidEcrecoverSignatureError as InvalidMidnightEcrecoverSignatureError, InvalidEcrecoverSignatureVError as InvalidMidnightEcrecoverSignatureVError, InvalidMarketParameterError as InvalidMidnightMarketParameterError, InvalidMidnightApiQuoteTargetError, InvalidMidnightApiResponseError, InvalidOfferGroupError as InvalidMidnightOfferGroupError, InvalidOfferParameterError as InvalidMidnightOfferParameterError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError, InvalidRateRatifierV1RateError as InvalidMidnightRateRatifierV1RateError, InvalidRateRatifierV1TickError as InvalidMidnightRateRatifierV1TickError, InvalidRateRatifierV1TimeError as InvalidMidnightRateRatifierV1TimeError, InvalidRatifierV1AddressError as InvalidMidnightRatifierV1AddressError, InvalidTickSpacingError as InvalidMidnightTickSpacingError, InvalidTreeError as InvalidMidnightTreeError, InvalidTreeHeightError as InvalidMidnightTreeHeightError, InvalidTypedDataSignatureError as InvalidMidnightTypedDataSignatureError, MidnightApiError, MidnightMempoolValidationError, PayloadDecodeError as MidnightPayloadDecodeError, PriceGreaterThanOneError as MidnightPriceGreaterThanOneError, RateRatifierV1BoundOverflowError as MidnightRateRatifierV1BoundOverflowError, RatifierV1TakerNotAllowedError as MidnightRatifierV1TakerNotAllowedError, SettlementFeeExceedsPriceError as MidnightSettlementFeeExceedsPriceError, TickOutOfRangeError as MidnightTickOutOfRangeError, UnknownCollateralIndexError as UnknownMidnightCollateralIndexError, } from "@morpho-org/midnight-sdk";
6
6
  export type { ErrorClass } from "@morpho-org/morpho-ts";
7
- export { _try, DivisionByZeroError, InvalidAddressError, InvalidBitLengthError, InvalidPositionAccrualStateError as InvalidMidnightPositionAccrualStateError, InvalidPositionAccrualTimestampError as InvalidMidnightPositionAccrualTimestampError, InvalidPositionLossFactorError as InvalidMidnightPositionLossFactorError, NegativeValueError, RegistryValueAlreadyRegisteredError, RetriesExhaustedError, RetryStoppedError, } from "@morpho-org/morpho-ts";
7
+ export { _try, DivisionByZeroError, InvalidAddressError, InvalidBitLengthError, MissingLocalePartError, NegativeValueError, RegistryValueAlreadyRegisteredError, RetriesExhaustedError, RetryStoppedError, } from "@morpho-org/morpho-ts";
package/lib/cjs/errors.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MidnightMempoolValidationError = exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidMidnightTreeHeightError = exports.InvalidMidnightTreeError = exports.InvalidMidnightTickSpacingError = exports.InvalidMidnightRatifierV1AddressError = exports.InvalidMidnightRateRatifierV1TimeError = exports.InvalidMidnightRateRatifierV1TickError = exports.InvalidMidnightRateRatifierV1RateError = exports.InvalidMidnightOfferParameterError = exports.InvalidMidnightOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightMarketParameterError = exports.InvalidMidnightEcrecoverSignatureVError = exports.InvalidMidnightEcrecoverSignatureError = exports.MidnightChainIdMismatchError = exports.UnsupportedPermitDomainExtensionsError = exports.UnresolvedBlockNumberError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.Permit2ExpirationOutOfRangeError = exports.NonTupleReturnValueError = exports.MissingPermitDomainNameError = exports.BlueMarketParamsIdMismatchError = exports.MalformedTokenMetadataError = exports.isBlueUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getBlueUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedBlueVaultV2AdapterError = exports.UnsupportedBluePreLiquidationParamsError = exports.UnsupportedBlueMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownBlueVaultConfigError = exports.UnknownBlueTokenPriceError = exports.UnknownBlueTokenError = exports.UnknownBlueOfFactory = exports.UnknownBlueMarketParamsError = exports.UnknownBlueMarketAllocationError = exports.UnknownBlueFactory = exports.UnknownBlueDataError = exports.UnknownAddressError = exports.InvalidBlueVaultV2MidnightAdapterMarketsError = exports.InvalidBlueMarketParamsError = exports.IncompleteChainRegistryError = exports.BlueErrors = void 0;
4
- exports.RetryStoppedError = exports.RetriesExhaustedError = exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.InvalidMidnightPositionLossFactorError = exports.InvalidMidnightPositionAccrualTimestampError = exports.InvalidMidnightPositionAccrualStateError = exports.InvalidBitLengthError = exports.InvalidAddressError = exports.DivisionByZeroError = exports._try = exports.UnknownMidnightCollateralIndexError = exports.MidnightTickOutOfRangeError = exports.MidnightSettlementFeeExceedsPriceError = exports.MidnightRatifierV1TakerNotAllowedError = exports.MidnightRateRatifierV1BoundOverflowError = exports.MidnightPriceGreaterThanOneError = exports.MidnightPayloadDecodeError = void 0;
3
+ exports.MidnightApiError = exports.InvalidMidnightTypedDataSignatureError = exports.InvalidMidnightTreeHeightError = exports.InvalidMidnightTreeError = exports.InvalidMidnightTickSpacingError = exports.InvalidMidnightRatifierV1AddressError = exports.InvalidMidnightRateRatifierV1TimeError = exports.InvalidMidnightRateRatifierV1TickError = exports.InvalidMidnightRateRatifierV1RateError = exports.InvalidMidnightPositionLossFactorError = exports.InvalidMidnightPositionAccrualTimestampError = exports.InvalidMidnightPositionAccrualStateError = exports.InvalidMidnightOfferParameterError = exports.InvalidMidnightOfferGroupError = exports.InvalidMidnightApiResponseError = exports.InvalidMidnightApiQuoteTargetError = exports.InvalidMidnightMarketParameterError = exports.InvalidMidnightEcrecoverSignatureVError = exports.InvalidMidnightEcrecoverSignatureError = exports.MidnightChainIdMismatchError = exports.UnsupportedPermitDomainExtensionsError = exports.UnnamedAbiOutputsError = exports.UnknownAbiFunctionError = exports.Permit2ExpirationOutOfRangeError = exports.NonTupleReturnValueError = exports.MissingPermitDomainNameError = exports.BlueMarketParamsIdMismatchError = exports.MalformedTokenMetadataError = exports.isBlueUnknownOfFactoryError = exports.InvalidPermitDomainVerifyingContractError = exports.InvalidPermitDomainChainIdError = exports.InvalidNumberError = exports.getBlueUnsupportedVaultV2Adapter = exports.VaultV2Errors = exports.UnsupportedBlueVaultV2AdapterError = exports.UnsupportedBluePreLiquidationParamsError = exports.UnsupportedBlueMarketIrmError = exports.UnsupportedChainIdError = exports.UnknownBlueVaultConfigError = exports.UnknownBlueTokenPriceError = exports.UnknownBlueTokenError = exports.UnknownBlueOfFactory = exports.UnknownBlueMarketParamsError = exports.UnknownBlueMarketAllocationError = exports.UnknownBlueFactory = exports.UnknownBlueDataError = exports.UnknownAddressError = exports.InvalidBlueMarketParamsError = exports.IncompleteChainRegistryError = exports.BlueErrors = void 0;
4
+ exports.RetryStoppedError = exports.RetriesExhaustedError = exports.RegistryValueAlreadyRegisteredError = exports.NegativeValueError = exports.MissingLocalePartError = exports.InvalidBitLengthError = exports.InvalidAddressError = exports.DivisionByZeroError = exports._try = exports.UnknownMidnightCollateralIndexError = exports.MidnightTickOutOfRangeError = exports.MidnightSettlementFeeExceedsPriceError = exports.MidnightRatifierV1TakerNotAllowedError = exports.MidnightRateRatifierV1BoundOverflowError = exports.MidnightPriceGreaterThanOneError = exports.MidnightPayloadDecodeError = exports.MidnightMempoolValidationError = void 0;
5
5
  var blue_sdk_1 = require("@morpho-org/blue-sdk");
6
6
  Object.defineProperty(exports, "BlueErrors", { enumerable: true, get: function () { return blue_sdk_1.BlueErrors; } });
7
7
  Object.defineProperty(exports, "IncompleteChainRegistryError", { enumerable: true, get: function () { return blue_sdk_1.IncompleteChainRegistryError; } });
8
8
  Object.defineProperty(exports, "InvalidBlueMarketParamsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidMarketParamsError; } });
9
- Object.defineProperty(exports, "InvalidBlueVaultV2MidnightAdapterMarketsError", { enumerable: true, get: function () { return blue_sdk_1.InvalidVaultV2MidnightAdapterMarketsError; } });
10
9
  Object.defineProperty(exports, "UnknownAddressError", { enumerable: true, get: function () { return blue_sdk_1.UnknownAddressError; } });
11
10
  Object.defineProperty(exports, "UnknownBlueDataError", { enumerable: true, get: function () { return blue_sdk_1.UnknownDataError; } });
12
11
  Object.defineProperty(exports, "UnknownBlueFactory", { enumerable: true, get: function () { return blue_sdk_1.UnknownFactory; } });
@@ -35,7 +34,6 @@ Object.defineProperty(exports, "NonTupleReturnValueError", { enumerable: true, g
35
34
  Object.defineProperty(exports, "Permit2ExpirationOutOfRangeError", { enumerable: true, get: function () { return blue_sdk_viem_1.Permit2ExpirationOutOfRangeError; } });
36
35
  Object.defineProperty(exports, "UnknownAbiFunctionError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnknownAbiFunctionError; } });
37
36
  Object.defineProperty(exports, "UnnamedAbiOutputsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnnamedAbiOutputsError; } });
38
- Object.defineProperty(exports, "UnresolvedBlockNumberError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnresolvedBlockNumberError; } });
39
37
  Object.defineProperty(exports, "UnsupportedPermitDomainExtensionsError", { enumerable: true, get: function () { return blue_sdk_viem_1.UnsupportedPermitDomainExtensionsError; } });
40
38
  var midnight_sdk_1 = require("@morpho-org/midnight-sdk");
41
39
  Object.defineProperty(exports, "MidnightChainIdMismatchError", { enumerable: true, get: function () { return midnight_sdk_1.ChainIdMismatchError; } });
@@ -46,6 +44,9 @@ Object.defineProperty(exports, "InvalidMidnightApiQuoteTargetError", { enumerabl
46
44
  Object.defineProperty(exports, "InvalidMidnightApiResponseError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidMidnightApiResponseError; } });
47
45
  Object.defineProperty(exports, "InvalidMidnightOfferGroupError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferGroupError; } });
48
46
  Object.defineProperty(exports, "InvalidMidnightOfferParameterError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidOfferParameterError; } });
47
+ Object.defineProperty(exports, "InvalidMidnightPositionAccrualStateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualStateError; } });
48
+ Object.defineProperty(exports, "InvalidMidnightPositionAccrualTimestampError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionAccrualTimestampError; } });
49
+ Object.defineProperty(exports, "InvalidMidnightPositionLossFactorError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidPositionLossFactorError; } });
49
50
  Object.defineProperty(exports, "InvalidMidnightRateRatifierV1RateError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1RateError; } });
50
51
  Object.defineProperty(exports, "InvalidMidnightRateRatifierV1TickError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TickError; } });
51
52
  Object.defineProperty(exports, "InvalidMidnightRateRatifierV1TimeError", { enumerable: true, get: function () { return midnight_sdk_1.InvalidRateRatifierV1TimeError; } });
@@ -68,9 +69,7 @@ Object.defineProperty(exports, "_try", { enumerable: true, get: function () { re
68
69
  Object.defineProperty(exports, "DivisionByZeroError", { enumerable: true, get: function () { return morpho_ts_1.DivisionByZeroError; } });
69
70
  Object.defineProperty(exports, "InvalidAddressError", { enumerable: true, get: function () { return morpho_ts_1.InvalidAddressError; } });
70
71
  Object.defineProperty(exports, "InvalidBitLengthError", { enumerable: true, get: function () { return morpho_ts_1.InvalidBitLengthError; } });
71
- Object.defineProperty(exports, "InvalidMidnightPositionAccrualStateError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionAccrualStateError; } });
72
- Object.defineProperty(exports, "InvalidMidnightPositionAccrualTimestampError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionAccrualTimestampError; } });
73
- Object.defineProperty(exports, "InvalidMidnightPositionLossFactorError", { enumerable: true, get: function () { return morpho_ts_1.InvalidPositionLossFactorError; } });
72
+ Object.defineProperty(exports, "MissingLocalePartError", { enumerable: true, get: function () { return morpho_ts_1.MissingLocalePartError; } });
74
73
  Object.defineProperty(exports, "NegativeValueError", { enumerable: true, get: function () { return morpho_ts_1.NegativeValueError; } });
75
74
  Object.defineProperty(exports, "RegistryValueAlreadyRegisteredError", { enumerable: true, get: function () { return morpho_ts_1.RegistryValueAlreadyRegisteredError; } });
76
75
  Object.defineProperty(exports, "RetriesExhaustedError", { enumerable: true, get: function () { return morpho_ts_1.RetriesExhaustedError; } });
@@ -1,6 +1,6 @@
1
- export { fetchAccrualPosition as fetchBlueAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MidnightAdapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket as fetchBlueMarket, fetchMarketParams as fetchBlueMarketParams, fetchPosition as fetchBluePosition,
1
+ export { fetchAccrualPosition as fetchBlueAccrualPosition, fetchAccrualVault, fetchAccrualVaultV2, fetchAccrualVaultV2Adapter, fetchAccrualVaultV2MorphoMarketV1Adapter, fetchAccrualVaultV2MorphoMarketV1AdapterV2, fetchAccrualVaultV2MorphoVaultV1Adapter, fetchHolding, fetchMarket as fetchBlueMarket, fetchMarketParams as fetchBlueMarketParams, fetchPosition as fetchBluePosition,
2
2
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
3
3
  fetchPreLiquidationParams as fetchBluePreLiquidationParams,
4
4
  /** @deprecated Pre-liquidation support is deprecated and will be removed in the next major. */
5
- fetchPreLiquidationPosition as fetchBluePreLiquidationPosition, fetchToken, fetchUser as fetchBlueUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MidnightAdapter, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
5
+ fetchPreLiquidationPosition as fetchBluePreLiquidationPosition, fetchToken, fetchUser as fetchBlueUser, fetchVault, fetchVaultConfig, fetchVaultMarketAllocation, fetchVaultMarketConfig, fetchVaultUser, fetchVaultV2, fetchVaultV2Adapter, fetchVaultV2BlueMarketPublicAllocatorConfig, fetchVaultV2BluePublicAllocatorConfig, fetchVaultV2BluePublicAllocatorData, fetchVaultV2MorphoMarketV1Adapter, fetchVaultV2MorphoMarketV1AdapterV2, fetchVaultV2MorphoVaultV1Adapter, } from "@morpho-org/blue-sdk-viem";
6
6
  export { fetchAccrualPosition as fetchMidnightAccrualPosition, fetchMarket as fetchMidnightMarket, fetchMarketParams as fetchMidnightMarketParams, fetchPosition as fetchMidnightPosition, fetchRatifierInfo as fetchMidnightRatifierInfo, } from "@morpho-org/midnight-sdk";
package/lib/cjs/fetch.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchMidnightRatifierInfo = exports.fetchMidnightPosition = exports.fetchMidnightMarketParams = exports.fetchMidnightMarket = exports.fetchMidnightAccrualPosition = exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2MidnightAdapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchBlueUser = exports.fetchToken = exports.fetchBluePreLiquidationPosition = exports.fetchBluePreLiquidationParams = exports.fetchBluePosition = exports.fetchBlueMarketParams = exports.fetchBlueMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2MidnightAdapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchBlueAccrualPosition = void 0;
3
+ exports.fetchMidnightRatifierInfo = exports.fetchMidnightPosition = exports.fetchMidnightMarketParams = exports.fetchMidnightMarket = exports.fetchMidnightAccrualPosition = exports.fetchVaultV2MorphoVaultV1Adapter = exports.fetchVaultV2MorphoMarketV1AdapterV2 = exports.fetchVaultV2MorphoMarketV1Adapter = exports.fetchVaultV2BluePublicAllocatorData = exports.fetchVaultV2BluePublicAllocatorConfig = exports.fetchVaultV2BlueMarketPublicAllocatorConfig = exports.fetchVaultV2Adapter = exports.fetchVaultV2 = exports.fetchVaultUser = exports.fetchVaultMarketConfig = exports.fetchVaultMarketAllocation = exports.fetchVaultConfig = exports.fetchVault = exports.fetchBlueUser = exports.fetchToken = exports.fetchBluePreLiquidationPosition = exports.fetchBluePreLiquidationParams = exports.fetchBluePosition = exports.fetchBlueMarketParams = exports.fetchBlueMarket = exports.fetchHolding = exports.fetchAccrualVaultV2MorphoVaultV1Adapter = exports.fetchAccrualVaultV2MorphoMarketV1AdapterV2 = exports.fetchAccrualVaultV2MorphoMarketV1Adapter = exports.fetchAccrualVaultV2Adapter = exports.fetchAccrualVaultV2 = exports.fetchAccrualVault = exports.fetchBlueAccrualPosition = void 0;
4
4
  var blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
5
5
  Object.defineProperty(exports, "fetchBlueAccrualPosition", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualPosition; } });
6
6
  Object.defineProperty(exports, "fetchAccrualVault", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVault; } });
7
7
  Object.defineProperty(exports, "fetchAccrualVaultV2", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2; } });
8
8
  Object.defineProperty(exports, "fetchAccrualVaultV2Adapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2Adapter; } });
9
- Object.defineProperty(exports, "fetchAccrualVaultV2MidnightAdapter", { enumerable: true, get: function () { return blue_sdk_viem_1.fetchAccrualVaultV2MidnightAdapter; } });
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; } });
@@ -30,15 +30,17 @@ const constant_js_1 = require("./constant.js");
30
30
  */
31
31
  function validateBlueMarketDeadShares(market, path = []) {
32
32
  const entity = [...path, market.id];
33
- if (market.deadSupplyShares == null)
33
+ if (market.deadSupplyShares == null) {
34
34
  throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadSupplyShares" });
35
- if (market.deadSupplyShares < constant_js_1.MIN_DEAD_SHARES)
35
+ }
36
+ if (market.deadSupplyShares < constant_js_1.MIN_DEAD_SHARES) {
36
37
  throw new error_js_1.InsufficientDeadSharesError({
37
38
  entity,
38
39
  reason: "deadShares",
39
40
  observed: market.deadSupplyShares,
40
41
  required: constant_js_1.MIN_DEAD_SHARES,
41
42
  });
43
+ }
42
44
  }
43
45
  /**
44
46
  * Checks that a Vault V1 holds at least `MIN_DEAD_SHARES` shares at `DEAD_ADDRESS` and that every
@@ -67,22 +69,25 @@ function validateBlueMarketDeadShares(market, path = []) {
67
69
  */
68
70
  function validateVaultV1DeadShares(vault, path = []) {
69
71
  const entity = [...path, vault.address];
70
- if (vault.deadShares == null)
72
+ if (vault.deadShares == null) {
71
73
  throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadShares" });
72
- if (vault.deadShares < constant_js_1.MIN_DEAD_SHARES)
74
+ }
75
+ if (vault.deadShares < constant_js_1.MIN_DEAD_SHARES) {
73
76
  throw new error_js_1.InsufficientDeadSharesError({
74
77
  entity,
75
78
  reason: "deadShares",
76
79
  observed: vault.deadShares,
77
80
  required: constant_js_1.MIN_DEAD_SHARES,
78
81
  });
82
+ }
79
83
  for (const marketId of vault.withdrawQueue) {
80
84
  const allocation = vault.allocations.get(marketId);
81
- if (allocation == null)
85
+ if (allocation == null) {
82
86
  throw new error_js_1.MissingDeadSharesDataError({
83
87
  entity: [...entity, marketId],
84
88
  field: "allocation",
85
89
  });
90
+ }
86
91
  validateBlueMarketDeadShares(allocation.position.market, entity);
87
92
  }
88
93
  }
@@ -116,36 +121,42 @@ function validateVaultV1DeadShares(vault, path = []) {
116
121
  function validateVaultV2DeadShares(vault, path = []) {
117
122
  const entity = [...path, vault.address];
118
123
  const { deadShares, deadAssets, absoluteCaps } = vault;
119
- if (deadShares == null)
124
+ if (deadShares == null) {
120
125
  throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadShares" });
121
- if (deadAssets == null)
126
+ }
127
+ if (deadAssets == null) {
122
128
  throw new error_js_1.MissingDeadSharesDataError({ entity, field: "deadAssets" });
123
- if (absoluteCaps == null)
129
+ }
130
+ if (absoluteCaps == null) {
124
131
  throw new error_js_1.MissingDeadSharesDataError({ entity, field: "absoluteCaps" });
125
- if (deadShares < constant_js_1.MIN_DEAD_SHARES)
132
+ }
133
+ if (deadShares < constant_js_1.MIN_DEAD_SHARES) {
126
134
  throw new error_js_1.InsufficientDeadSharesError({
127
135
  entity,
128
136
  reason: "deadShares",
129
137
  observed: deadShares,
130
138
  required: constant_js_1.MIN_DEAD_SHARES,
131
139
  });
132
- if (deadAssets < constant_js_1.MIN_VAULT_V2_DEAD_ASSETS)
140
+ }
141
+ if (deadAssets < constant_js_1.MIN_VAULT_V2_DEAD_ASSETS) {
133
142
  throw new error_js_1.InsufficientDeadSharesError({
134
143
  entity,
135
144
  reason: "deadAssets",
136
145
  observed: deadAssets,
137
146
  required: constant_js_1.MIN_VAULT_V2_DEAD_ASSETS,
138
147
  });
148
+ }
139
149
  // Share price (totalAssets + 1) / (totalSupply + virtualShares) must exceed 1 / (10 * virtualShares).
140
150
  const priceNumerator = (vault._totalAssets + 1n) * 10n * vault.virtualShares;
141
151
  const priceDenominator = vault.totalSupply + vault.virtualShares;
142
- if (priceNumerator <= priceDenominator)
152
+ if (priceNumerator <= priceDenominator) {
143
153
  throw new error_js_1.InsufficientDeadSharesError({
144
154
  entity,
145
155
  reason: "sharePrice",
146
156
  observed: priceNumerator,
147
157
  required: priceDenominator + 1n,
148
158
  });
159
+ }
149
160
  for (const adapter of vault.accrualAdapters) {
150
161
  // Reject incomplete or underfunded adapter snapshots before checking liquidity.
151
162
  assertAdapterDeadShares(adapter, { absoluteCaps, entity });
@@ -155,40 +166,42 @@ function validateVaultV2DeadShares(vault, path = []) {
155
166
  const liquidityAdapter = vault.accrualLiquidityAdapter;
156
167
  if (vault.liquidityData === "0x" ||
157
168
  !(liquidityAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter ||
158
- liquidityAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2))
169
+ liquidityAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1AdapterV2)) {
159
170
  return;
171
+ }
160
172
  const liquidityMarketId = blue_sdk_1.MarketParams.fromHex(vault.liquidityData).id;
161
173
  const markets = liquidityAdapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter
162
174
  ? liquidityAdapter.positions.map(({ market }) => market)
163
175
  : liquidityAdapter.markets;
164
- if (!markets.some(({ id }) => id === liquidityMarketId))
176
+ if (!markets.some(({ id }) => id === liquidityMarketId)) {
165
177
  throw new error_js_1.MissingDeadSharesDataError({
166
178
  entity: [...entity, liquidityAdapter.address, liquidityMarketId],
167
179
  field: "liquidityMarket",
168
180
  });
181
+ }
169
182
  }
170
183
  /** Reads a fetched adapter cap before applying the dead-share rule. @internal */
171
184
  function getDeadSharesAbsoluteCap(id, { absoluteCaps, entity, adapter, }) {
172
185
  const cap = absoluteCaps[id];
173
- if (cap == null)
186
+ if (cap == null) {
174
187
  throw new error_js_1.MissingDeadSharesDataError({
175
188
  entity: [...entity, adapter],
176
189
  field: "absoluteCaps",
177
190
  });
191
+ }
178
192
  return cap;
179
193
  }
180
194
  /** Checks the currently allocated positions of one supported adapter. @internal */
181
195
  function assertAdapterDeadShares(adapter, { absoluteCaps, entity, }) {
182
- if (adapter instanceof blue_sdk_1.AccrualVaultV2MidnightAdapter)
183
- return;
184
196
  if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoVaultV1Adapter) {
185
197
  const id = blue_sdk_1.VaultV2MorphoVaultV1Adapter.adapterCapId(adapter.address);
186
198
  if (getDeadSharesAbsoluteCap(id, {
187
199
  absoluteCaps,
188
200
  entity,
189
201
  adapter: adapter.address,
190
- }) > 0n)
202
+ }) > 0n) {
191
203
  validateVaultV1DeadShares(adapter.accrualVaultV1, entity);
204
+ }
192
205
  return;
193
206
  }
194
207
  if (adapter instanceof blue_sdk_1.AccrualVaultV2MorphoMarketV1Adapter) {
@@ -198,8 +211,9 @@ function assertAdapterDeadShares(adapter, { absoluteCaps, entity, }) {
198
211
  absoluteCaps,
199
212
  entity,
200
213
  adapter: adapter.address,
201
- }) > 0n)
214
+ }) > 0n) {
202
215
  validateBlueMarketDeadShares(market, entity);
216
+ }
203
217
  }
204
218
  return;
205
219
  }
@@ -210,8 +224,9 @@ function assertAdapterDeadShares(adapter, { absoluteCaps, entity, }) {
210
224
  absoluteCaps,
211
225
  entity,
212
226
  adapter: adapter.address,
213
- }) > 0n)
227
+ }) > 0n) {
214
228
  validateBlueMarketDeadShares(market, entity);
229
+ }
215
230
  }
216
231
  return;
217
232
  }
@@ -29,8 +29,9 @@ function encodeMidnightCalldata(parameters) {
29
29
  return (0, viem_1.encodeFunctionData)(parameters);
30
30
  }
31
31
  catch (error) {
32
- if (!(error instanceof viem_1.BaseError))
32
+ if (!(error instanceof viem_1.BaseError)) {
33
33
  throw error;
34
+ }
34
35
  throw new index_js_1.MidnightCalldataEncodingError(String(parameters.functionName), error);
35
36
  }
36
37
  }
@@ -52,8 +53,9 @@ function wrapMidnightEncoding(name, encode) {
52
53
  return encode();
53
54
  }
54
55
  catch (error) {
55
- if (!(error instanceof viem_1.BaseError))
56
+ if (!(error instanceof viem_1.BaseError)) {
56
57
  throw error;
58
+ }
57
59
  throw new index_js_1.MidnightCalldataEncodingError(name, error);
58
60
  }
59
61
  }
@@ -7,10 +7,12 @@ const viem_1 = require("viem");
7
7
  const error_js_1 = require("../types/error.js");
8
8
  const MAX_METADATA_TIMESTAMP = (1n << 32n) - 1n;
9
9
  function validateMetadataTimestamp(timestamp) {
10
- if (typeof timestamp !== "bigint")
10
+ if (typeof timestamp !== "bigint") {
11
11
  return;
12
- if (timestamp < 0n)
12
+ }
13
+ if (timestamp < 0n) {
13
14
  throw new error_js_1.NegativeInputError("metadata.timestamp", timestamp);
15
+ }
14
16
  if (timestamp > MAX_METADATA_TIMESTAMP) {
15
17
  throw new error_js_1.InputExceedsMaxError({
16
18
  field: "metadata.timestamp",
@@ -83,8 +85,9 @@ function resolveTransactionMetadata(metadata, now) {
83
85
  function addTransactionMetadata(tx, metadata) {
84
86
  validateMetadataTimestamp(metadata.timestamp);
85
87
  const { data, ..._tx } = tx;
86
- if (!data || data === "0x")
88
+ if (!data || data === "0x") {
87
89
  return tx;
90
+ }
88
91
  const concatItems = [data];
89
92
  if (metadata.timestamp === true || typeof metadata.timestamp === "bigint") {
90
93
  concatItems.push((0, viem_1.numberToHex)(metadata.timestamp === true ? morpho_ts_1.Time.timestamp() : metadata.timestamp, { size: 4 }));
@@ -95,15 +98,18 @@ function addTransactionMetadata(tx, metadata) {
95
98
  // origin. The case-insensitive form prevents "0Xcafe" from falling
96
99
  // through to `isHex("0x0Xcafe")` and being silently dropped.
97
100
  const origin = metadata.origin.replace(/^0x/i, "");
98
- if (!(0, viem_1.isHex)(`0x${origin}`))
101
+ if (!(0, viem_1.isHex)(`0x${origin}`)) {
99
102
  throw Error("Calldata origin must consists of only hex characters");
100
- if (origin.length > 8)
103
+ }
104
+ if (origin.length > 8) {
101
105
  throw Error("Calldata origin must be at most 8 characters long");
106
+ }
102
107
  // Reject odd-length raw fragments. viem's `concatHex` would pad the
103
108
  // stray nibble to a whole byte at broadcast, corrupting the trailing
104
109
  // analytics byte on-chain.
105
- if (origin.length % 2 !== 0)
110
+ if (origin.length % 2 !== 0) {
106
111
  throw Error("Calldata origin must have an even number of hex characters");
112
+ }
107
113
  concatItems.push(`0x${origin}`);
108
114
  }
109
115
  catch (error) {
@@ -59,20 +59,23 @@ const vaultV2ForceWithdrawPlan_js_1 = require("./vaultV2ForceWithdrawPlan.js");
59
59
  */
60
60
  function previewVaultV2ForceWithdraw(vaultData, params) {
61
61
  const { requestedExitAssets, timestamp, adapter: adapterOverride, userAddress, feeProjectionTimestamp = timestamp, referralFeePct = 0n, referralFeeRecipient, } = params;
62
- if (requestedExitAssets <= 0n)
62
+ if (requestedExitAssets <= 0n) {
63
63
  return undefined;
64
+ }
64
65
  // Out of the range the action accepts, `netAssets` would quote a payout the contract can never
65
66
  // deliver — above `withdrawnAssets` for a negative fee, non-positive at or beyond WAD.
66
- if (referralFeePct < 0n || referralFeePct >= blue_sdk_1.MathLib.WAD)
67
+ if (referralFeePct < 0n || referralFeePct >= blue_sdk_1.MathLib.WAD) {
67
68
  return undefined;
69
+ }
68
70
  if (referralFeePct > 0n &&
69
71
  (referralFeeRecipient == null ||
70
72
  (0, viem_1.isAddressEqual)(referralFeeRecipient, viem_1.zeroAddress))) {
71
73
  return undefined;
72
74
  }
73
75
  const eligibility = (0, vaultV2ForceWithdrawPlan_js_1.resolveVaultV2ForceWithdrawEligibility)(vaultData, adapterOverride);
74
- if (eligibility.type !== "eligible")
76
+ if (eligibility.type !== "eligible") {
75
77
  return undefined;
78
+ }
76
79
  const capacity = (0, vaultV2ForceWithdrawPlan_js_1.computeVaultV2ForceWithdrawPlan)({
77
80
  vaultData,
78
81
  adapter: eligibility.adapter,
@@ -83,8 +86,9 @@ function previewVaultV2ForceWithdraw(vaultData, params) {
83
86
  const exitAssets = blue_sdk_1.MathLib.min(requestedExitAssets, capacity.maxExitAssets);
84
87
  // A vault with no exitable capacity caps `maxExitAssets` to `0`; the planner rejects a
85
88
  // non-positive amount, so short-circuit to the "not previewable" verdict before re-planning.
86
- if (exitAssets <= 0n)
89
+ if (exitAssets <= 0n) {
87
90
  return undefined;
91
+ }
88
92
  // Re-plan at the capped amount so every returned leg describes the same exit.
89
93
  const plan = exitAssets === requestedExitAssets
90
94
  ? capacity
@@ -95,8 +99,9 @@ function previewVaultV2ForceWithdraw(vaultData, params) {
95
99
  exitAssets,
96
100
  timestamp,
97
101
  });
98
- if (plan.withdrawnAssets <= 0n)
102
+ if (plan.withdrawnAssets <= 0n) {
99
103
  return undefined;
104
+ }
100
105
  const defaultMinSharePriceE27 = computePreviewMinSharePrice(vaultData, {
101
106
  timestamp,
102
107
  feeProjectionTimestamp,
@@ -50,10 +50,12 @@ function previewVaultV2InKindRedeem(vaultData, params) {
50
50
  }))
51
51
  .filter(({ allocationAssets }) => allocationAssets > 0n)
52
52
  .toSorted(({ allocationAssets: a }, { allocationAssets: b }) => {
53
- if (a === b)
53
+ if (a === b) {
54
54
  return 0;
55
- if (a > b)
55
+ }
56
+ if (a > b) {
56
57
  return -1;
58
+ }
57
59
  return 1;
58
60
  });
59
61
  return allocations.flatMap(({ market, allocationAssets }) => {
@@ -64,8 +66,9 @@ function previewVaultV2InKindRedeem(vaultData, params) {
64
66
  const idleAssets = blue_sdk_1.MathLib.min(exitAssets, availableIdleAssets);
65
67
  const inKindExitAssets = exitAssets - idleAssets;
66
68
  const netAssets = blue_sdk_1.MathLib.wDivDown(inKindExitAssets, blue_sdk_1.MathLib.WAD + penalty);
67
- if (idleAssets === 0n && netAssets === 0n)
69
+ if (idleAssets === 0n && netAssets === 0n) {
68
70
  return [];
71
+ }
69
72
  return [
70
73
  {
71
74
  marketParams: market.params,
@@ -17,8 +17,9 @@ const constant_js_1 = require("./constant.js");
17
17
  */
18
18
  const resolveCapAccrualBuffer = (value) => {
19
19
  const buffer = value == null ? constant_js_1.DEFAULT_CAP_ACCRUAL_BUFFER : BigInt(value);
20
- if (buffer < 0n)
20
+ if (buffer < 0n) {
21
21
  throw new index_js_1.NegativeInputError("capAccrualBuffer", buffer);
22
+ }
22
23
  return buffer;
23
24
  };
24
25
  exports.resolveCapAccrualBuffer = resolveCapAccrualBuffer;
@@ -36,14 +37,16 @@ exports.resolveCapAccrualBuffer = resolveCapAccrualBuffer;
36
37
  */
37
38
  const resolveAllocatorCapHeadroom = (value) => {
38
39
  const headroom = value ?? constant_js_1.DEFAULT_ALLOCATOR_CAP_HEADROOM;
39
- if (headroom < 0n)
40
+ if (headroom < 0n) {
40
41
  throw new index_js_1.NegativeInputError("allocatorCapHeadroom", headroom);
41
- if (headroom > blue_sdk_1.MathLib.WAD)
42
+ }
43
+ if (headroom > blue_sdk_1.MathLib.WAD) {
42
44
  throw new index_js_1.InputExceedsMaxError({
43
45
  field: "allocatorCapHeadroom",
44
46
  value: headroom,
45
47
  max: blue_sdk_1.MathLib.WAD,
46
48
  });
49
+ }
47
50
  return headroom;
48
51
  };
49
52
  exports.resolveAllocatorCapHeadroom = resolveAllocatorCapHeadroom;
@@ -62,14 +65,16 @@ exports.resolveAllocatorCapHeadroom = resolveAllocatorCapHeadroom;
62
65
  */
63
66
  const resolveMaxWithdrawalUtilization = (value, field = "maxWithdrawalUtilization") => {
64
67
  const utilization = value ?? constant_js_1.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION;
65
- if (utilization < 0n)
68
+ if (utilization < 0n) {
66
69
  throw new index_js_1.NegativeInputError(field, utilization);
67
- if (utilization > blue_sdk_1.MathLib.WAD)
70
+ }
71
+ if (utilization > blue_sdk_1.MathLib.WAD) {
68
72
  throw new index_js_1.InputExceedsMaxError({
69
73
  field,
70
74
  value: utilization,
71
75
  max: blue_sdk_1.MathLib.WAD,
72
76
  });
77
+ }
73
78
  return utilization;
74
79
  };
75
80
  exports.resolveMaxWithdrawalUtilization = resolveMaxWithdrawalUtilization;
@@ -13,10 +13,12 @@ const validateMidnightAccount_js_1 = require("./validateMidnightAccount.js");
13
13
  const compareMarketIds = (idA, idB) => {
14
14
  const normalizedIdA = idA.toLowerCase();
15
15
  const normalizedIdB = idB.toLowerCase();
16
- if (normalizedIdA > normalizedIdB)
16
+ if (normalizedIdA > normalizedIdB) {
17
17
  return 1;
18
- if (normalizedIdA < normalizedIdB)
18
+ }
19
+ if (normalizedIdA < normalizedIdB) {
19
20
  return -1;
21
+ }
20
22
  return 0;
21
23
  };
22
24
  /**
@@ -32,8 +34,9 @@ const compareMarketIds = (idA, idB) => {
32
34
  * @internal
33
35
  */
34
36
  const validateUint256Field = (field, value) => {
35
- if (value < 0n)
37
+ if (value < 0n) {
36
38
  throw new index_js_1.NegativeInputError(field, value);
39
+ }
37
40
  if (value > viem_1.maxUint256) {
38
41
  throw new index_js_1.InputExceedsMaxError({ field, value, max: viem_1.maxUint256 });
39
42
  }
@@ -67,8 +70,9 @@ exports.validateMarketParamsId = validateMarketParamsId;
67
70
  * @internal
68
71
  */
69
72
  const validateDeadline = (deadline) => {
70
- if (deadline <= 0n)
73
+ if (deadline <= 0n) {
71
74
  throw new index_js_1.NonPositiveInputError("deadline", deadline);
75
+ }
72
76
  (0, exports.validateUint256Field)("deadline", deadline);
73
77
  };
74
78
  exports.validateDeadline = validateDeadline;
@@ -261,8 +265,9 @@ const getMidnightMaxSafeDebt = (params) => {
261
265
  let maxSafeDebt = 0n;
262
266
  for (let index = 0; index < params.collateral.length; index += 1) {
263
267
  const amount = params.collateral[index] ?? 0n;
264
- if (amount === 0n)
268
+ if (amount === 0n) {
265
269
  continue;
270
+ }
266
271
  const collateral = midnight_sdk_1.MarketUtils.getCollateralByIndex(params.market.params, BigInt(index));
267
272
  const price = params.collateralPrices[index];
268
273
  if (price === undefined) {
@@ -428,8 +433,9 @@ const validateMidnightNativeAmount = (params) => {
428
433
  throw new index_js_1.ChainWNativeMissingError(chainId);
429
434
  }
430
435
  // Reject a malformed address before viem compares it with wNative.
431
- for (const pull of pulls)
436
+ for (const pull of pulls) {
432
437
  (0, validateMidnightAccount_js_1.validateMidnightAddress)("token", pull.token);
438
+ }
433
439
  const wNativePulled = pulls.reduce((total, pull) => (0, viem_1.isAddressEqual)(pull.token, wNative) ? total + pull.assets : total, 0n);
434
440
  const firstPull = pulls[0];
435
441
  if (firstPull && !pulls.some((pull) => (0, viem_1.isAddressEqual)(pull.token, wNative))) {
@@ -15,8 +15,9 @@ const constant_js_1 = require("./constant.js");
15
15
  * @internal
16
16
  */
17
17
  const validateMidnightUint128Field = (field, value) => {
18
- if (value < 0n)
18
+ if (value < 0n) {
19
19
  throw new error_js_1.NegativeInputError(field, value);
20
+ }
20
21
  if (value > viem_1.maxUint128) {
21
22
  throw new error_js_1.InputExceedsMaxError({ field, value, max: viem_1.maxUint128 });
22
23
  }
@@ -16,8 +16,9 @@ const error_js_1 = require("../types/error.js");
16
16
  * ```
17
17
  */
18
18
  function validateMidnightCollateralBatch(transfers, emptyError) {
19
- if (transfers.length === 0)
19
+ if (transfers.length === 0) {
20
20
  throw emptyError;
21
+ }
21
22
  const indexes = new Set();
22
23
  for (const { collateralIndex } of transfers) {
23
24
  if (indexes.has(collateralIndex)) {
@@ -84,8 +84,9 @@ const validateMidnightPublication = (params) => {
84
84
  });
85
85
  }
86
86
  const publication = params.publication;
87
- if (publication == null)
87
+ if (publication == null) {
88
88
  return;
89
+ }
89
90
  validateHexInput(publication.root, "publication.root", { exactBytes: 32 });
90
91
  for (const [index, group] of publication.groups.entries()) {
91
92
  validateHexInput(group, `publication.groups[${index}]`, {
@@ -103,8 +104,9 @@ const validateMidnightPublication = (params) => {
103
104
  exactBytes: 32,
104
105
  });
105
106
  }
106
- if (publication.payload === "0x")
107
+ if (publication.payload === "0x") {
107
108
  return;
109
+ }
108
110
  validateHexInput(publication.payload, "publication.payload", {
109
111
  maxBytes: midnight_sdk_1.Payload.MAX_PAYLOAD_BYTES,
110
112
  });