@morpho-org/morpho-sdk 6.0.0-next.1 → 6.0.0-next.3

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 (305) hide show
  1. package/MIGRATION-v5-to-v6.md +199 -34
  2. package/README.md +23 -15
  3. package/lib/cjs/abis.d.ts +3 -2829
  4. package/lib/cjs/abis.js +1 -1938
  5. package/lib/cjs/actions/blue/borrow.d.ts +3 -2
  6. package/lib/cjs/actions/blue/borrow.js +3 -2
  7. package/lib/cjs/actions/blue/common.js +6 -35
  8. package/lib/cjs/actions/blue/refinance.d.ts +2 -2
  9. package/lib/cjs/actions/blue/refinance.js +2 -2
  10. package/lib/cjs/actions/blue/repay.d.ts +1 -1
  11. package/lib/cjs/actions/blue/repay.js +1 -1
  12. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  13. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +2 -2
  14. package/lib/cjs/actions/blue/supply.d.ts +2 -2
  15. package/lib/cjs/actions/blue/supply.js +4 -9
  16. package/lib/cjs/actions/blue/supplyCollateral.d.ts +2 -2
  17. package/lib/cjs/actions/blue/supplyCollateral.js +2 -2
  18. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  19. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +3 -2
  20. package/lib/cjs/actions/blue/withdraw.d.ts +3 -3
  21. package/lib/cjs/actions/blue/withdraw.js +3 -3
  22. package/lib/cjs/actions/blue/withdrawCollateral.d.ts +2 -2
  23. package/lib/cjs/actions/blue/withdrawCollateral.js +2 -2
  24. package/lib/cjs/actions/bundles/common.d.ts +38 -4
  25. package/lib/cjs/actions/bundles/common.js +91 -35
  26. package/lib/cjs/actions/index.d.ts +0 -1
  27. package/lib/cjs/actions/index.js +0 -1
  28. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
  29. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +17 -26
  30. package/lib/cjs/actions/requirements/blue/index.d.ts +0 -1
  31. package/lib/cjs/actions/requirements/blue/index.js +0 -1
  32. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
  33. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +24 -25
  34. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  35. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +4 -5
  36. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
  37. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +39 -38
  38. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
  39. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
  40. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
  41. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
  42. package/lib/cjs/actions/requirements/encode/index.d.ts +0 -1
  43. package/lib/cjs/actions/requirements/encode/index.js +0 -1
  44. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +5 -6
  45. package/lib/cjs/actions/requirements/getRequirementsApproval.js +5 -6
  46. package/lib/cjs/actions/requirements/index.d.ts +0 -1
  47. package/lib/cjs/actions/requirements/index.js +0 -1
  48. package/lib/cjs/actions/vaultV1/deposit.d.ts +1 -2
  49. package/lib/cjs/actions/vaultV1/deposit.js +1 -2
  50. package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +6 -4
  51. package/lib/cjs/actions/vaultV1/inKindRedeem.js +12 -8
  52. package/lib/cjs/actions/vaultV2/deposit.d.ts +1 -2
  53. package/lib/cjs/actions/vaultV2/deposit.js +1 -2
  54. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
  55. package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
  56. package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +6 -4
  57. package/lib/cjs/actions/vaultV2/inKindRedeem.js +12 -8
  58. package/lib/cjs/augment.d.ts +0 -1
  59. package/lib/cjs/augment.js +0 -1
  60. package/lib/cjs/blue/abis.d.ts +1 -1
  61. package/lib/cjs/blue/abis.js +1 -5
  62. package/lib/cjs/blue/entities.d.ts +2 -2
  63. package/lib/cjs/blue/entities.js +1 -2
  64. package/lib/cjs/blue/errors.d.ts +1 -1
  65. package/lib/cjs/blue/errors.js +2 -1
  66. package/lib/cjs/blue/fetch.d.ts +1 -1
  67. package/lib/cjs/blue/fetch.js +1 -2
  68. package/lib/cjs/blue/types.d.ts +2 -4
  69. package/lib/cjs/blue/utils.d.ts +1 -3
  70. package/lib/cjs/blue/utils.js +1 -3
  71. package/lib/cjs/client/morphoViemExtension.d.ts +1 -1
  72. package/lib/cjs/client/morphoViemExtension.js +1 -1
  73. package/lib/cjs/constants.d.ts +3 -37
  74. package/lib/cjs/constants.js +1 -39
  75. package/lib/cjs/entities/blue/blue.d.ts +38 -264
  76. package/lib/cjs/entities/blue/blue.js +2 -203
  77. package/lib/cjs/entities/index.d.ts +3 -60
  78. package/lib/cjs/entities/index.js +1 -20
  79. package/lib/cjs/entities/midnight/midnight.js +20 -24
  80. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
  81. package/lib/cjs/entities/requirements/getBundlesTokenRequirements.js +19 -14
  82. package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
  83. package/lib/cjs/entities/requirements/index.d.ts +1 -0
  84. package/lib/cjs/entities/requirements/index.js +1 -0
  85. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +18 -6
  86. package/lib/cjs/entities/vaultV1/vaultV1.js +25 -8
  87. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +154 -35
  88. package/lib/cjs/entities/vaultV2/vaultV2.js +249 -23
  89. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
  90. package/lib/cjs/entities/vaultV2BlueReallocationData.js +50 -34
  91. package/lib/cjs/errors.d.ts +2 -46
  92. package/lib/cjs/errors.js +2 -46
  93. package/lib/cjs/fetch.d.ts +1 -15
  94. package/lib/cjs/fetch.js +1 -16
  95. package/lib/cjs/helpers/constant.d.ts +0 -2
  96. package/lib/cjs/helpers/constant.js +0 -2
  97. package/lib/cjs/helpers/index.d.ts +4 -3
  98. package/lib/cjs/helpers/index.js +10 -9
  99. package/lib/cjs/helpers/metadata.d.ts +3 -5
  100. package/lib/cjs/helpers/metadata.js +4 -6
  101. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
  102. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
  103. package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  104. package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
  105. package/lib/cjs/helpers/slippage.d.ts +34 -90
  106. package/lib/cjs/helpers/slippage.js +52 -137
  107. package/lib/cjs/helpers/utilization.d.ts +12 -10
  108. package/lib/cjs/helpers/utilization.js +27 -12
  109. package/lib/cjs/helpers/validate.d.ts +66 -32
  110. package/lib/cjs/helpers/validate.js +84 -57
  111. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  112. package/lib/cjs/helpers/validateRequirementSpender.js +1 -3
  113. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
  114. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
  115. package/lib/cjs/types/action.d.ts +102 -68
  116. package/lib/cjs/types/action.js +11 -4
  117. package/lib/cjs/types/error.d.ts +332 -385
  118. package/lib/cjs/types/error.js +369 -412
  119. package/lib/cjs/types/sharedLiquidity.d.ts +1 -117
  120. package/lib/cjs/types.d.ts +2 -18
  121. package/lib/cjs/utils.d.ts +8 -35
  122. package/lib/cjs/utils.js +11 -36
  123. package/lib/esm/abis.d.ts +3 -2829
  124. package/lib/esm/abis.js +3 -1935
  125. package/lib/esm/actions/blue/borrow.d.ts +3 -2
  126. package/lib/esm/actions/blue/borrow.js +3 -2
  127. package/lib/esm/actions/blue/common.js +8 -37
  128. package/lib/esm/actions/blue/refinance.d.ts +2 -2
  129. package/lib/esm/actions/blue/refinance.js +2 -2
  130. package/lib/esm/actions/blue/repay.d.ts +1 -1
  131. package/lib/esm/actions/blue/repay.js +1 -1
  132. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +2 -2
  133. package/lib/esm/actions/blue/repayWithdrawCollateral.js +2 -2
  134. package/lib/esm/actions/blue/supply.d.ts +2 -2
  135. package/lib/esm/actions/blue/supply.js +6 -11
  136. package/lib/esm/actions/blue/supplyCollateral.d.ts +2 -2
  137. package/lib/esm/actions/blue/supplyCollateral.js +2 -2
  138. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -2
  139. package/lib/esm/actions/blue/supplyCollateralBorrow.js +3 -2
  140. package/lib/esm/actions/blue/withdraw.d.ts +3 -3
  141. package/lib/esm/actions/blue/withdraw.js +3 -3
  142. package/lib/esm/actions/blue/withdrawCollateral.d.ts +2 -2
  143. package/lib/esm/actions/blue/withdrawCollateral.js +2 -2
  144. package/lib/esm/actions/bundles/common.d.ts +38 -4
  145. package/lib/esm/actions/bundles/common.js +91 -36
  146. package/lib/esm/actions/index.d.ts +0 -1
  147. package/lib/esm/actions/index.js +0 -1
  148. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +9 -8
  149. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +20 -29
  150. package/lib/esm/actions/requirements/blue/index.d.ts +0 -1
  151. package/lib/esm/actions/requirements/blue/index.js +0 -1
  152. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +20 -14
  153. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +25 -26
  154. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +4 -4
  155. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +4 -5
  156. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +21 -12
  157. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +40 -39
  158. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts +4 -2
  159. package/lib/esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.js +14 -9
  160. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +9 -6
  161. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +22 -17
  162. package/lib/esm/actions/requirements/encode/index.d.ts +0 -1
  163. package/lib/esm/actions/requirements/encode/index.js +0 -1
  164. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +5 -6
  165. package/lib/esm/actions/requirements/getRequirementsApproval.js +5 -6
  166. package/lib/esm/actions/requirements/index.d.ts +0 -1
  167. package/lib/esm/actions/requirements/index.js +0 -1
  168. package/lib/esm/actions/vaultV1/deposit.d.ts +1 -2
  169. package/lib/esm/actions/vaultV1/deposit.js +1 -2
  170. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +6 -4
  171. package/lib/esm/actions/vaultV1/inKindRedeem.js +12 -8
  172. package/lib/esm/actions/vaultV2/deposit.d.ts +1 -2
  173. package/lib/esm/actions/vaultV2/deposit.js +1 -2
  174. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
  175. package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
  176. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +6 -4
  177. package/lib/esm/actions/vaultV2/inKindRedeem.js +12 -8
  178. package/lib/esm/augment.d.ts +0 -1
  179. package/lib/esm/augment.js +0 -1
  180. package/lib/esm/blue/abis.d.ts +1 -1
  181. package/lib/esm/blue/abis.js +1 -1
  182. package/lib/esm/blue/entities.d.ts +2 -2
  183. package/lib/esm/blue/entities.js +1 -1
  184. package/lib/esm/blue/errors.d.ts +1 -1
  185. package/lib/esm/blue/errors.js +1 -1
  186. package/lib/esm/blue/fetch.d.ts +1 -1
  187. package/lib/esm/blue/fetch.js +1 -1
  188. package/lib/esm/blue/types.d.ts +2 -4
  189. package/lib/esm/blue/utils.d.ts +1 -3
  190. package/lib/esm/blue/utils.js +1 -3
  191. package/lib/esm/client/morphoViemExtension.d.ts +1 -1
  192. package/lib/esm/client/morphoViemExtension.js +1 -1
  193. package/lib/esm/constants.d.ts +3 -37
  194. package/lib/esm/constants.js +3 -37
  195. package/lib/esm/entities/blue/blue.d.ts +38 -264
  196. package/lib/esm/entities/blue/blue.js +5 -206
  197. package/lib/esm/entities/index.d.ts +3 -60
  198. package/lib/esm/entities/index.js +1 -16
  199. package/lib/esm/entities/midnight/midnight.js +20 -24
  200. package/lib/esm/entities/requirements/getBundlesTokenRequirements.d.ts +7 -6
  201. package/lib/esm/entities/requirements/getBundlesTokenRequirements.js +20 -15
  202. package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +3 -3
  203. package/lib/esm/entities/requirements/index.d.ts +1 -0
  204. package/lib/esm/entities/requirements/index.js +1 -0
  205. package/lib/esm/entities/vaultV1/vaultV1.d.ts +18 -6
  206. package/lib/esm/entities/vaultV1/vaultV1.js +29 -12
  207. package/lib/esm/entities/vaultV2/vaultV2.d.ts +154 -35
  208. package/lib/esm/entities/vaultV2/vaultV2.js +256 -30
  209. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
  210. package/lib/esm/entities/vaultV2BlueReallocationData.js +48 -32
  211. package/lib/esm/errors.d.ts +2 -46
  212. package/lib/esm/errors.js +2 -46
  213. package/lib/esm/fetch.d.ts +1 -15
  214. package/lib/esm/fetch.js +1 -15
  215. package/lib/esm/helpers/constant.d.ts +0 -2
  216. package/lib/esm/helpers/constant.js +0 -2
  217. package/lib/esm/helpers/index.d.ts +4 -3
  218. package/lib/esm/helpers/index.js +4 -3
  219. package/lib/esm/helpers/metadata.d.ts +3 -5
  220. package/lib/esm/helpers/metadata.js +4 -6
  221. package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
  222. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
  223. package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  224. package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
  225. package/lib/esm/helpers/slippage.d.ts +34 -90
  226. package/lib/esm/helpers/slippage.js +52 -134
  227. package/lib/esm/helpers/utilization.d.ts +12 -10
  228. package/lib/esm/helpers/utilization.js +26 -11
  229. package/lib/esm/helpers/validate.d.ts +66 -32
  230. package/lib/esm/helpers/validate.js +83 -57
  231. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  232. package/lib/esm/helpers/validateRequirementSpender.js +1 -3
  233. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
  234. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
  235. package/lib/esm/types/action.d.ts +102 -68
  236. package/lib/esm/types/action.js +12 -5
  237. package/lib/esm/types/error.d.ts +332 -385
  238. package/lib/esm/types/error.js +355 -392
  239. package/lib/esm/types/sharedLiquidity.d.ts +1 -117
  240. package/lib/esm/types.d.ts +2 -18
  241. package/lib/esm/utils.d.ts +8 -35
  242. package/lib/esm/utils.js +7 -34
  243. package/package.json +7 -15
  244. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
  245. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -83
  246. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  247. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -151
  248. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
  249. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -50
  250. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  251. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -74
  252. package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +0 -3
  253. package/lib/cjs/actions/requirements/generalAdapter/index.js +0 -19
  254. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  255. package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +0 -48
  256. package/lib/cjs/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  257. package/lib/cjs/actions/signatures/getTokenRequirementActions.js +0 -119
  258. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
  259. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -43
  260. package/lib/cjs/actions/signatures/index.d.ts +0 -3
  261. package/lib/cjs/actions/signatures/index.js +0 -19
  262. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
  263. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +0 -8
  264. package/lib/cjs/bundler/actions.d.ts +0 -797
  265. package/lib/cjs/bundler/actions.js +0 -1371
  266. package/lib/cjs/bundler/index.d.ts +0 -2
  267. package/lib/cjs/bundler/index.js +0 -18
  268. package/lib/cjs/bundler/types.d.ts +0 -235
  269. package/lib/cjs/bundler/types.js +0 -2
  270. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +0 -326
  271. package/lib/cjs/entities/vaultV1ReallocationData.js +0 -542
  272. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +0 -78
  273. package/lib/cjs/helpers/computeVaultV1Reallocations.js +0 -243
  274. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +0 -42
  275. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +0 -79
  276. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.d.ts +0 -88
  277. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +0 -147
  278. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +0 -37
  279. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +0 -46
  280. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +0 -57
  281. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +0 -70
  282. package/lib/esm/actions/requirements/generalAdapter/index.d.ts +0 -3
  283. package/lib/esm/actions/requirements/generalAdapter/index.js +0 -3
  284. package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +0 -29
  285. package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +0 -44
  286. package/lib/esm/actions/signatures/getTokenRequirementActions.d.ts +0 -58
  287. package/lib/esm/actions/signatures/getTokenRequirementActions.js +0 -115
  288. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +0 -44
  289. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +0 -39
  290. package/lib/esm/actions/signatures/index.d.ts +0 -3
  291. package/lib/esm/actions/signatures/index.js +0 -3
  292. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +0 -8
  293. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +0 -5
  294. package/lib/esm/bundler/actions.d.ts +0 -797
  295. package/lib/esm/bundler/actions.js +0 -1368
  296. package/lib/esm/bundler/index.d.ts +0 -2
  297. package/lib/esm/bundler/index.js +0 -2
  298. package/lib/esm/bundler/types.d.ts +0 -235
  299. package/lib/esm/bundler/types.js +0 -1
  300. package/lib/esm/entities/vaultV1ReallocationData.d.ts +0 -326
  301. package/lib/esm/entities/vaultV1ReallocationData.js +0 -544
  302. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +0 -78
  303. package/lib/esm/helpers/computeVaultV1Reallocations.js +0 -239
  304. /package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
  305. /package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.d.ts +0 -0
@@ -1,46 +0,0 @@
1
- import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { encodeErc20Permit } from "../encode/index.js";
3
- /**
4
- * Computes the EIP-2612 permit `Requirement` an integrator must sign so that `GeneralAdapter1`
5
- * can pull `amount` of `token`.
6
- *
7
- * @param viemClient - Connected viem `Client` (used by the returned `Requirement.sign()`).
8
- * @param params.token - ERC-20 token address (must support EIP-2612).
9
- * @param params.chainId - The chain the bundle targets.
10
- * @param params.args.amount - Required token amount.
11
- * @param params.nonce - The user's current EIP-2612 nonce on `token`.
12
- * @param params.supportDeployless - Whether to fetch token metadata via deployless multicall.
13
- * @returns A single-element array containing the exact-amount `Requirement` to sign.
14
- * @example
15
- * ```ts
16
- * import { createWalletClient, http } from "viem";
17
- * import { mainnet } from "viem/chains";
18
- * import { getGeneralAdapterRequirementsPermit } from "@morpho-org/morpho-sdk";
19
- *
20
- * const client = createWalletClient({ chain: mainnet, transport: http() });
21
- * const reqs = await getGeneralAdapterRequirementsPermit(client, {
22
- * token: USDC, // an ERC-2612-compatible token; DAI is excluded by getGeneralAdapterRequirements
23
- * chainId: 1,
24
- * args: { amount: 1_000_000n },
25
- * nonce: 0n,
26
- * });
27
- * // reqs satisfies Requirement[]
28
- * ```
29
- */
30
- export const getGeneralAdapterRequirementsPermit = async (viemClient, params) => {
31
- const { token, chainId, args: { amount }, nonce, supportDeployless, } = params;
32
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
33
- // Existing direct ERC-20 allowance is intentionally not an input here. ERC-2612 overwrites the
34
- // allowance with the signed amount, and the bundle spends exactly `amount`, leaving no residual
35
- // allowance after inclusion.
36
- return [
37
- await encodeErc20Permit(viemClient, {
38
- token,
39
- spender: generalAdapter1,
40
- amount,
41
- chainId,
42
- nonce,
43
- supportDeployless,
44
- }),
45
- ];
46
- };
@@ -1,57 +0,0 @@
1
- import { type Address } from "@morpho-org/blue-sdk";
2
- import type { Bundler3TokenSignatureRequirement, ERC20ApprovalAction, Transaction } from "../../../types/index.js";
3
- interface GeneralAdapterPermit2Erc20Allowances {
4
- readonly permit2: bigint;
5
- }
6
- /**
7
- * Computes the Permit2 prerequisites for `GeneralAdapter1` to pull `amount` of `address`.
8
- *
9
- * Emits two ordered prerequisites:
10
- *
11
- * 1. A classic ERC-20 approval to the Permit2 contract (infinite, if not already in place).
12
- * 2. A Permit2 `Requirement` signed against `GeneralAdapter1`.
13
- *
14
- * The Permit2 signature is always requested for the exact transfer amount when this path is
15
- * selected. Permit2 allowance signatures overwrite the existing allowance, so relying on
16
- * residual Permit2-managed allowance would make the final transfer path depend on stale state and
17
- * could leave allowance behind after a partial spend.
18
- *
19
- * @param params.address - ERC-20 token address.
20
- * @param params.chainId - The chain the bundle targets.
21
- * @param params.permit2 - The Permit2 contract address for the chain.
22
- * @param params.args.amount - Required token amount.
23
- * @param params.erc20Allowances - Current ERC-20 allowances keyed by spender contract name.
24
- * @param params.permit2Nonce - Current Permit2 nonce for the token owner / token / GeneralAdapter1 tuple.
25
- * @returns Ordered list of approval transactions and/or `Requirement` objects to satisfy before
26
- * bundling.
27
- * @throws {ApprovalAmountLessThanSpendAmountError} from the inner approval helper when its
28
- * bookkeeping invariants break (should not happen with the values this function passes).
29
- * @example
30
- * ```ts
31
- * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
32
- * import { getGeneralAdapterRequirementsPermit2 } from "@morpho-org/morpho-sdk";
33
- *
34
- * const { permit2 } = getChainAddresses(1);
35
- * if (!permit2) throw new Error("Permit2 not configured for this chain");
36
- * const requirements = getGeneralAdapterRequirementsPermit2({
37
- * address: USDC,
38
- * chainId: 1,
39
- * permit2,
40
- * args: { amount: 1_000_000n },
41
- * erc20Allowances: { permit2: 0n },
42
- * permit2Nonce: 0n,
43
- * });
44
- * // requirements satisfies (Readonly<Transaction<ERC20ApprovalAction> | Bundler3TokenSignatureRequirement>)[]
45
- * ```
46
- */
47
- export declare const getGeneralAdapterRequirementsPermit2: (params: {
48
- address: Address;
49
- chainId: number;
50
- permit2: Address;
51
- args: {
52
- amount: bigint;
53
- };
54
- erc20Allowances: GeneralAdapterPermit2Erc20Allowances;
55
- permit2Nonce: bigint;
56
- }) => Readonly<Transaction<ERC20ApprovalAction> | Bundler3TokenSignatureRequirement>[];
57
- export {};
@@ -1,70 +0,0 @@
1
- import { MathLib } from "@morpho-org/blue-sdk";
2
- import { encodeErc20Permit2Approve } from "../encode/encodeErc20Permit2Approve.js";
3
- import { getRequirementsApproval } from "../getRequirementsApproval.js";
4
- /**
5
- * Computes the Permit2 prerequisites for `GeneralAdapter1` to pull `amount` of `address`.
6
- *
7
- * Emits two ordered prerequisites:
8
- *
9
- * 1. A classic ERC-20 approval to the Permit2 contract (infinite, if not already in place).
10
- * 2. A Permit2 `Requirement` signed against `GeneralAdapter1`.
11
- *
12
- * The Permit2 signature is always requested for the exact transfer amount when this path is
13
- * selected. Permit2 allowance signatures overwrite the existing allowance, so relying on
14
- * residual Permit2-managed allowance would make the final transfer path depend on stale state and
15
- * could leave allowance behind after a partial spend.
16
- *
17
- * @param params.address - ERC-20 token address.
18
- * @param params.chainId - The chain the bundle targets.
19
- * @param params.permit2 - The Permit2 contract address for the chain.
20
- * @param params.args.amount - Required token amount.
21
- * @param params.erc20Allowances - Current ERC-20 allowances keyed by spender contract name.
22
- * @param params.permit2Nonce - Current Permit2 nonce for the token owner / token / GeneralAdapter1 tuple.
23
- * @returns Ordered list of approval transactions and/or `Requirement` objects to satisfy before
24
- * bundling.
25
- * @throws {ApprovalAmountLessThanSpendAmountError} from the inner approval helper when its
26
- * bookkeeping invariants break (should not happen with the values this function passes).
27
- * @example
28
- * ```ts
29
- * import { getChainAddresses } from "@morpho-org/morpho-sdk/addresses";
30
- * import { getGeneralAdapterRequirementsPermit2 } from "@morpho-org/morpho-sdk";
31
- *
32
- * const { permit2 } = getChainAddresses(1);
33
- * if (!permit2) throw new Error("Permit2 not configured for this chain");
34
- * const requirements = getGeneralAdapterRequirementsPermit2({
35
- * address: USDC,
36
- * chainId: 1,
37
- * permit2,
38
- * args: { amount: 1_000_000n },
39
- * erc20Allowances: { permit2: 0n },
40
- * permit2Nonce: 0n,
41
- * });
42
- * // requirements satisfies (Readonly<Transaction<ERC20ApprovalAction> | Bundler3TokenSignatureRequirement>)[]
43
- * ```
44
- */
45
- export const getGeneralAdapterRequirementsPermit2 = (params) => {
46
- const { address, chainId, permit2, args: { amount }, erc20Allowances, permit2Nonce, } = params;
47
- const requirements = [];
48
- const approvalRequirements = getRequirementsApproval({
49
- address,
50
- chainId,
51
- args: {
52
- approvalAmount: MathLib.MAX_UINT_160, // Always approve infinite.
53
- spendAmount: amount,
54
- spender: permit2,
55
- },
56
- allowances: erc20Allowances.permit2,
57
- });
58
- requirements.push(...approvalRequirements);
59
- // Existing Permit2-managed allowance is intentionally not checked for sufficiency. Permit2
60
- // overwrites the allowance with this signed amount, and the bundle spends exactly `amount`,
61
- // leaving no residual Permit2 allowance after inclusion.
62
- requirements.push(encodeErc20Permit2Approve({
63
- token: address,
64
- amount,
65
- chainId,
66
- nonce: permit2Nonce,
67
- expiration: MathLib.MAX_UINT_48, // Always approve indefinitely.
68
- }));
69
- return requirements;
70
- };
@@ -1,3 +0,0 @@
1
- export * from "./getGeneralAdapterRequirements.js";
2
- export * from "./getGeneralAdapterRequirementsPermit.js";
3
- export * from "./getGeneralAdapterRequirementsPermit2.js";
@@ -1,3 +0,0 @@
1
- export * from "./getGeneralAdapterRequirements.js";
2
- export * from "./getGeneralAdapterRequirementsPermit.js";
3
- export * from "./getGeneralAdapterRequirementsPermit2.js";
@@ -1,29 +0,0 @@
1
- import type { Action } from "../../bundler/index.js";
2
- import { type AuthorizationRequirementSignature } from "../../types/index.js";
3
- /**
4
- * Encodes the bundler action that consumes a signed Morpho authorization, granting
5
- * `authorized` (GeneralAdapter1) operator rights on behalf of the signer via
6
- * `setAuthorizationWithSig` — replacing a standalone `setAuthorization` transaction.
7
- *
8
- * The signature's `authorized` is pinned to the chain's `GeneralAdapter1`: an authorization
9
- * targeting any other account is rejected so the bundle can never hand operator rights over the
10
- * user's Morpho position to an unintended address. The action is emitted with `skipRevert: false`
11
- * so a rejected or stale authorization fails the whole bundle rather than letting a later
12
- * on-behalf Morpho call revert opaquely.
13
- *
14
- * @param chainId - Chain whose `GeneralAdapter1` the signature must authorize.
15
- * @param signature - The signed authorization produced by `Requirement.sign()`.
16
- * @returns A single `morphoSetAuthorizationWithSig` bundler `Action`.
17
- * @throws {BundlerErrors.UnexpectedSignature} when `signature.args.authorized` is not the chain's
18
- * `GeneralAdapter1`.
19
- * @example
20
- * ```ts
21
- * import { getBlueAuthorizationAction } from "@morpho-org/morpho-sdk";
22
- *
23
- * // `requirement` comes from `getBlueAuthorizationRequirement` with `supportSignature: true`.
24
- * const signed = await requirement.sign(walletClient, borrower);
25
- * const action = getBlueAuthorizationAction(1, signed);
26
- * // action satisfies { type: "morphoSetAuthorizationWithSig"; args: [...] }
27
- * ```
28
- */
29
- export declare const getBlueAuthorizationAction: (chainId: number, signature: AuthorizationRequirementSignature) => Action;
@@ -1,44 +0,0 @@
1
- import { getChainAddresses } from "@morpho-org/blue-sdk";
2
- import { isAddressEqual } from "viem";
3
- import { BundlerErrors, } from "../../types/index.js";
4
- /**
5
- * Encodes the bundler action that consumes a signed Morpho authorization, granting
6
- * `authorized` (GeneralAdapter1) operator rights on behalf of the signer via
7
- * `setAuthorizationWithSig` — replacing a standalone `setAuthorization` transaction.
8
- *
9
- * The signature's `authorized` is pinned to the chain's `GeneralAdapter1`: an authorization
10
- * targeting any other account is rejected so the bundle can never hand operator rights over the
11
- * user's Morpho position to an unintended address. The action is emitted with `skipRevert: false`
12
- * so a rejected or stale authorization fails the whole bundle rather than letting a later
13
- * on-behalf Morpho call revert opaquely.
14
- *
15
- * @param chainId - Chain whose `GeneralAdapter1` the signature must authorize.
16
- * @param signature - The signed authorization produced by `Requirement.sign()`.
17
- * @returns A single `morphoSetAuthorizationWithSig` bundler `Action`.
18
- * @throws {BundlerErrors.UnexpectedSignature} when `signature.args.authorized` is not the chain's
19
- * `GeneralAdapter1`.
20
- * @example
21
- * ```ts
22
- * import { getBlueAuthorizationAction } from "@morpho-org/morpho-sdk";
23
- *
24
- * // `requirement` comes from `getBlueAuthorizationRequirement` with `supportSignature: true`.
25
- * const signed = await requirement.sign(walletClient, borrower);
26
- * const action = getBlueAuthorizationAction(1, signed);
27
- * // action satisfies { type: "morphoSetAuthorizationWithSig"; args: [...] }
28
- * ```
29
- */
30
- export const getBlueAuthorizationAction = (chainId, signature) => {
31
- const { owner, authorized, isAuthorized, nonce, deadline } = signature.args;
32
- const { bundler3: { generalAdapter1 }, } = getChainAddresses(chainId);
33
- if (!isAddressEqual(authorized, generalAdapter1)) {
34
- throw new BundlerErrors.UnexpectedSignature(authorized);
35
- }
36
- return {
37
- type: "morphoSetAuthorizationWithSig",
38
- args: [
39
- { authorizer: owner, authorized, isAuthorized, nonce, deadline },
40
- signature.args.signature,
41
- false /* skipRevert */,
42
- ],
43
- };
44
- };
@@ -1,58 +0,0 @@
1
- import { type Address } from "viem";
2
- import type { Action } from "../../bundler/index.js";
3
- import { type PermitRequirementSignature } from "../../types/index.js";
4
- interface GetTokenRequirementActionsParams {
5
- asset: Address;
6
- amount: bigint;
7
- recipient: Address;
8
- requirementSignature?: PermitRequirementSignature;
9
- }
10
- /**
11
- * Encodes the bundler actions that pull the asset to `recipient`, optionally consuming a
12
- * pre-signed permit / permit2 requirement first.
13
- *
14
- * Permit2 path emits `approve2` + `transferFrom2`; classic permit path emits `permit` +
15
- * `erc20TransferFrom`. When no signature is provided, the function emits a plain
16
- * `erc20TransferFrom` against an existing ERC-20 allowance.
17
- *
18
- * The signed `asset` and `amount` must match the pulled `asset` and `amount` exactly, otherwise
19
- * the function throws so the caller does not silently spend a wider-than-expected approval.
20
- *
21
- * @param params.asset - The ERC-20 to pull.
22
- * @param params.amount - The amount to pull, in the asset's smallest unit.
23
- * @param params.recipient - The address that receives the transfer.
24
- * @param params.requirementSignature - Optional signed permit / permit2 to apply before the transfer.
25
- * @returns Bundler `Action`s needed to pull the token.
26
- * @throws {DepositAssetMismatchError} when the signed asset differs from `asset`.
27
- * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
28
- * @throws {UnexpectedRequirementSignatureError} when passed a BlueBundlesV1-only SignatureTransfer result.
29
- * @throws {Permit2ExpirationMissingError} when `action.type === "permit2"` but `args.expiration` is missing.
30
- * @example
31
- * ```ts
32
- * import { createWalletClient, http } from "viem";
33
- * import { mainnet } from "viem/chains";
34
- * import { getTokenRequirementActions } from "@morpho-org/morpho-sdk";
35
- *
36
- * const walletClient = createWalletClient({
37
- * chain: mainnet,
38
- * transport: http(),
39
- * account: borrower,
40
- * });
41
- *
42
- * // `requirement` comes from a requirement helper; signing produces a `RequirementSignature`.
43
- * const requirementSignature = await requirement.sign(walletClient, borrower);
44
- *
45
- * const actions = getTokenRequirementActions({
46
- * asset: loanToken,
47
- * amount: 1_000_000n,
48
- * recipient: generalAdapter1,
49
- * requirementSignature,
50
- * });
51
- * // actions satisfies Action[]
52
- * // - permit2 path: [{ type: "approve2", ... }, { type: "transferFrom2", ... }]
53
- * // - classic permit path: [{ type: "permit", ... }, { type: "erc20TransferFrom", ... }]
54
- * // - no signature: [{ type: "erc20TransferFrom", ... }]
55
- * ```
56
- */
57
- export declare const getTokenRequirementActions: ({ asset, amount, recipient, requirementSignature, }: GetTokenRequirementActionsParams) => Action[];
58
- export {};
@@ -1,115 +0,0 @@
1
- import { isAddressEqual } from "viem";
2
- import { DepositAmountMismatchError, DepositAssetMismatchError, isPermit2SignatureTransferSignature, Permit2ExpirationMissingError, UnexpectedRequirementSignatureError, } from "../../types/index.js";
3
- /**
4
- * Encodes the bundler actions that pull the asset to `recipient`, optionally consuming a
5
- * pre-signed permit / permit2 requirement first.
6
- *
7
- * Permit2 path emits `approve2` + `transferFrom2`; classic permit path emits `permit` +
8
- * `erc20TransferFrom`. When no signature is provided, the function emits a plain
9
- * `erc20TransferFrom` against an existing ERC-20 allowance.
10
- *
11
- * The signed `asset` and `amount` must match the pulled `asset` and `amount` exactly, otherwise
12
- * the function throws so the caller does not silently spend a wider-than-expected approval.
13
- *
14
- * @param params.asset - The ERC-20 to pull.
15
- * @param params.amount - The amount to pull, in the asset's smallest unit.
16
- * @param params.recipient - The address that receives the transfer.
17
- * @param params.requirementSignature - Optional signed permit / permit2 to apply before the transfer.
18
- * @returns Bundler `Action`s needed to pull the token.
19
- * @throws {DepositAssetMismatchError} when the signed asset differs from `asset`.
20
- * @throws {DepositAmountMismatchError} when the signed amount differs from `amount`.
21
- * @throws {UnexpectedRequirementSignatureError} when passed a BlueBundlesV1-only SignatureTransfer result.
22
- * @throws {Permit2ExpirationMissingError} when `action.type === "permit2"` but `args.expiration` is missing.
23
- * @example
24
- * ```ts
25
- * import { createWalletClient, http } from "viem";
26
- * import { mainnet } from "viem/chains";
27
- * import { getTokenRequirementActions } from "@morpho-org/morpho-sdk";
28
- *
29
- * const walletClient = createWalletClient({
30
- * chain: mainnet,
31
- * transport: http(),
32
- * account: borrower,
33
- * });
34
- *
35
- * // `requirement` comes from a requirement helper; signing produces a `RequirementSignature`.
36
- * const requirementSignature = await requirement.sign(walletClient, borrower);
37
- *
38
- * const actions = getTokenRequirementActions({
39
- * asset: loanToken,
40
- * amount: 1_000_000n,
41
- * recipient: generalAdapter1,
42
- * requirementSignature,
43
- * });
44
- * // actions satisfies Action[]
45
- * // - permit2 path: [{ type: "approve2", ... }, { type: "transferFrom2", ... }]
46
- * // - classic permit path: [{ type: "permit", ... }, { type: "erc20TransferFrom", ... }]
47
- * // - no signature: [{ type: "erc20TransferFrom", ... }]
48
- * ```
49
- */
50
- export const getTokenRequirementActions = ({ asset, amount, recipient, requirementSignature, }) => {
51
- if (requirementSignature == null) {
52
- return [
53
- {
54
- type: "erc20TransferFrom",
55
- args: [asset, amount, recipient, false /* skipRevert */],
56
- },
57
- ];
58
- }
59
- if (isPermit2SignatureTransferSignature(requirementSignature)) {
60
- throw new UnexpectedRequirementSignatureError("permit2SignatureTransfer");
61
- }
62
- if (!isAddressEqual(requirementSignature.args.asset, asset)) {
63
- throw new DepositAssetMismatchError(asset, requirementSignature.args.asset);
64
- }
65
- // Permit2 and ERC-2612 overwrite the previous allowance with the signed amount.
66
- // It must exactly cover the transfer: less would fail, more would leave residual allowance.
67
- if (requirementSignature.args.amount !== amount) {
68
- throw new DepositAmountMismatchError(amount, requirementSignature.args.amount);
69
- }
70
- if (requirementSignature.action.type === "permit2") {
71
- if (!("expiration" in requirementSignature.args)) {
72
- throw new Permit2ExpirationMissingError();
73
- }
74
- return [
75
- {
76
- type: "approve2",
77
- args: [
78
- requirementSignature.args.owner,
79
- {
80
- details: {
81
- token: requirementSignature.args.asset,
82
- amount: requirementSignature.args.amount,
83
- nonce: Number(requirementSignature.args.nonce),
84
- expiration: Number(requirementSignature.args.expiration),
85
- },
86
- sigDeadline: requirementSignature.args.deadline,
87
- },
88
- requirementSignature.args.signature,
89
- false /* skipRevert */,
90
- ],
91
- },
92
- {
93
- type: "transferFrom2",
94
- args: [asset, amount, recipient, false /* skipRevert */],
95
- },
96
- ];
97
- }
98
- return [
99
- {
100
- type: "permit",
101
- args: [
102
- requirementSignature.args.owner,
103
- requirementSignature.args.asset,
104
- requirementSignature.args.amount,
105
- requirementSignature.args.deadline,
106
- requirementSignature.args.signature,
107
- false /* skipRevert */,
108
- ],
109
- },
110
- {
111
- type: "erc20TransferFrom",
112
- args: [asset, amount, recipient, false /* skipRevert */],
113
- },
114
- ];
115
- };
@@ -1,44 +0,0 @@
1
- import type { Address } from "viem";
2
- import { type PermitRequirementSignature } from "../../types/index.js";
3
- import { type BundleSharesPermit } from "../bundles/common.js";
4
- /**
5
- * Compatibility alias for the canonical {@link BundleSharesPermit} tuple consumed by VaultExitBundlesV1.
6
- *
7
- * @deprecated Use {@link BundleSharesPermit}.
8
- */
9
- export type VaultExitBundlesV1PermitStruct = BundleSharesPermit;
10
- /**
11
- * Parameters for {@link getVaultExitBundlesV1PermitStruct}.
12
- *
13
- * @deprecated Use the parameters of `getBundlesSharesPermit`.
14
- */
15
- export interface GetVaultExitBundlesV1PermitStructParams {
16
- /** Vault share token authorized by the permit. */
17
- readonly vault: Address;
18
- /** Bundle deadline used by the empty-permit sentinel. */
19
- readonly deadline: bigint;
20
- /** Optional signed bounded ERC-2612 requirement. */
21
- readonly requirementSignature?: PermitRequirementSignature;
22
- }
23
- /**
24
- * Compatibility wrapper for the former VaultExitBundlesV1-specific permit reshaper.
25
- *
26
- * @param params.vault - Vault share token authorized by the permit.
27
- * @param params.deadline - Bundle deadline used by the empty-permit sentinel.
28
- * @param params.requirementSignature - Optional signed ERC-2612 vault-share requirement.
29
- * @returns The shared bundles share-permit tuple.
30
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement is incompatible.
31
- * @deprecated Use `getBundlesSharesPermit`; this wrapper preserves the legacy error identity.
32
- * @example
33
- * ```ts
34
- * import { getVaultExitBundlesV1PermitStruct } from "@morpho-org/morpho-sdk";
35
- * import { zeroAddress } from "viem";
36
- *
37
- * const permit = getVaultExitBundlesV1PermitStruct({
38
- * vault: zeroAddress,
39
- * deadline: 1_900_000_000n,
40
- * });
41
- * // permit.value === 0n
42
- * ```
43
- */
44
- export declare const getVaultExitBundlesV1PermitStruct: (params: GetVaultExitBundlesV1PermitStructParams) => VaultExitBundlesV1PermitStruct;
@@ -1,39 +0,0 @@
1
- import { BundlesPermitMismatchError, VaultExitBundlesV1PermitMismatchError, } from "../../types/index.js";
2
- import { getBundlesSharesPermit, } from "../bundles/common.js";
3
- /**
4
- * Compatibility wrapper for the former VaultExitBundlesV1-specific permit reshaper.
5
- *
6
- * @param params.vault - Vault share token authorized by the permit.
7
- * @param params.deadline - Bundle deadline used by the empty-permit sentinel.
8
- * @param params.requirementSignature - Optional signed ERC-2612 vault-share requirement.
9
- * @returns The shared bundles share-permit tuple.
10
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement is incompatible.
11
- * @deprecated Use `getBundlesSharesPermit`; this wrapper preserves the legacy error identity.
12
- * @example
13
- * ```ts
14
- * import { getVaultExitBundlesV1PermitStruct } from "@morpho-org/morpho-sdk";
15
- * import { zeroAddress } from "viem";
16
- *
17
- * const permit = getVaultExitBundlesV1PermitStruct({
18
- * vault: zeroAddress,
19
- * deadline: 1_900_000_000n,
20
- * });
21
- * // permit.value === 0n
22
- * ```
23
- */
24
- export const getVaultExitBundlesV1PermitStruct = (params) => {
25
- try {
26
- return getBundlesSharesPermit(params);
27
- }
28
- catch (cause) {
29
- if (cause instanceof BundlesPermitMismatchError) {
30
- throw new VaultExitBundlesV1PermitMismatchError({
31
- field: cause.field,
32
- expected: cause.expected,
33
- actual: cause.actual,
34
- cause,
35
- });
36
- }
37
- throw cause;
38
- }
39
- };
@@ -1,3 +0,0 @@
1
- export * from "./getBlueAuthorizationAction.js";
2
- export * from "./getTokenRequirementActions.js";
3
- export * from "./getVaultExitBundlesV1PermitStruct.js";
@@ -1,3 +0,0 @@
1
- export * from "./getBlueAuthorizationAction.js";
2
- export * from "./getTokenRequirementActions.js";
3
- export * from "./getVaultExitBundlesV1PermitStruct.js";
@@ -1,8 +0,0 @@
1
- import { VaultMarketPublicAllocatorConfig as BlueVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk";
2
- import { fetchVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk-viem";
3
- declare module "@morpho-org/blue-sdk" {
4
- namespace VaultMarketPublicAllocatorConfig {
5
- let fetch: typeof fetchVaultMarketPublicAllocatorConfig;
6
- }
7
- }
8
- export { BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };
@@ -1,5 +0,0 @@
1
- import { VaultMarketPublicAllocatorConfig as BlueVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk";
2
- import { fetchVaultMarketPublicAllocatorConfig } from "@morpho-org/blue-sdk-viem";
3
- BlueVaultMarketPublicAllocatorConfig.fetch =
4
- fetchVaultMarketPublicAllocatorConfig;
5
- export { BlueVaultMarketPublicAllocatorConfig as VaultMarketPublicAllocatorConfig, };