@morpho-org/morpho-sdk 6.0.0-next.0 → 6.0.0-next.2

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 (296) hide show
  1. package/MIGRATION-v5-to-v6.md +329 -15
  2. package/README.md +93 -47
  3. package/lib/cjs/abis.d.ts +227 -2
  4. package/lib/cjs/abis.js +156 -3
  5. package/lib/cjs/actions/blue/borrow.d.ts +1 -1
  6. package/lib/cjs/actions/blue/borrow.js +1 -1
  7. package/lib/cjs/actions/blue/common.d.ts +6 -19
  8. package/lib/cjs/actions/blue/common.js +28 -162
  9. package/lib/cjs/actions/blue/refinance.d.ts +1 -1
  10. package/lib/cjs/actions/blue/refinance.js +1 -1
  11. package/lib/cjs/actions/blue/repay.d.ts +3 -3
  12. package/lib/cjs/actions/blue/repay.js +1 -1
  13. package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +3 -3
  14. package/lib/cjs/actions/blue/repayWithdrawCollateral.js +1 -1
  15. package/lib/cjs/actions/blue/supply.d.ts +3 -3
  16. package/lib/cjs/actions/blue/supply.js +3 -8
  17. package/lib/cjs/actions/blue/supplyCollateral.d.ts +3 -3
  18. package/lib/cjs/actions/blue/supplyCollateral.js +1 -1
  19. package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +3 -3
  20. package/lib/cjs/actions/blue/supplyCollateralBorrow.js +1 -1
  21. package/lib/cjs/actions/blue/withdraw.d.ts +1 -1
  22. package/lib/cjs/actions/blue/withdraw.js +1 -1
  23. package/lib/cjs/actions/blue/withdrawCollateral.d.ts +1 -1
  24. package/lib/cjs/actions/blue/withdrawCollateral.js +1 -1
  25. package/lib/cjs/actions/bundles/common.d.ts +230 -0
  26. package/lib/cjs/actions/bundles/common.js +507 -0
  27. package/lib/cjs/actions/bundles/index.d.ts +3 -0
  28. package/lib/cjs/actions/bundles/index.js +23 -0
  29. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
  30. package/lib/cjs/actions/bundles/resolveBundlesTokenRequirements.js +125 -0
  31. package/lib/cjs/actions/index.d.ts +1 -0
  32. package/lib/cjs/actions/index.js +1 -0
  33. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
  34. package/lib/cjs/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
  35. package/lib/cjs/actions/midnight/takeBorrow.d.ts +2 -2
  36. package/lib/cjs/actions/midnight/takeBorrow.js +2 -2
  37. package/lib/cjs/actions/midnight/takeLend.d.ts +2 -2
  38. package/lib/cjs/actions/midnight/takeLend.js +2 -2
  39. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
  40. package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +6 -10
  41. package/lib/cjs/actions/requirements/blue/index.d.ts +0 -2
  42. package/lib/cjs/actions/requirements/blue/index.js +0 -2
  43. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +15 -8
  44. package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +21 -21
  45. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
  46. package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +2 -1
  47. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +19 -10
  48. package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +43 -31
  49. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
  50. package/lib/cjs/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
  51. package/lib/{esm/actions/requirements/encode/encodeErc20Permit2TransferFrom.d.ts → cjs/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts} +16 -14
  52. package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2TransferFrom.js → encodeErc20Permit2SignatureTransfer.js} +27 -22
  53. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +12 -9
  54. package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +27 -21
  55. package/lib/cjs/actions/requirements/encode/index.d.ts +1 -1
  56. package/lib/cjs/actions/requirements/encode/index.js +1 -1
  57. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +1 -0
  58. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
  59. package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
  60. package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +4 -3
  61. package/lib/cjs/actions/requirements/getRequirementsApproval.js +4 -3
  62. package/lib/cjs/actions/signatures/getTokenRequirementActions.js +2 -2
  63. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +28 -30
  64. package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +20 -66
  65. package/lib/cjs/actions/vaultV1/deposit.d.ts +73 -57
  66. package/lib/cjs/actions/vaultV1/deposit.js +110 -109
  67. package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +1 -0
  68. package/lib/cjs/actions/vaultV1/inKindRedeem.js +3 -2
  69. package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +43 -66
  70. package/lib/cjs/actions/vaultV1/migrateToV2.js +91 -104
  71. package/lib/cjs/actions/vaultV1/redeem.d.ts +30 -23
  72. package/lib/cjs/actions/vaultV1/redeem.js +56 -33
  73. package/lib/cjs/actions/vaultV1/withdraw.d.ts +58 -24
  74. package/lib/cjs/actions/vaultV1/withdraw.js +86 -34
  75. package/lib/cjs/actions/vaultV2/deposit.d.ts +74 -57
  76. package/lib/cjs/actions/vaultV2/deposit.js +111 -109
  77. package/lib/cjs/actions/vaultV2/forceWithdraw.d.ts +58 -39
  78. package/lib/cjs/actions/vaultV2/forceWithdraw.js +87 -60
  79. package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +1 -0
  80. package/lib/cjs/actions/vaultV2/inKindRedeem.js +3 -2
  81. package/lib/cjs/actions/vaultV2/redeem.d.ts +30 -24
  82. package/lib/cjs/actions/vaultV2/redeem.js +56 -34
  83. package/lib/cjs/actions/vaultV2/withdraw.d.ts +58 -25
  84. package/lib/cjs/actions/vaultV2/withdraw.js +86 -35
  85. package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
  86. package/lib/cjs/blue/abis.d.ts +5 -1
  87. package/lib/cjs/blue/abis.js +2 -0
  88. package/lib/cjs/blue/entities.d.ts +8 -2
  89. package/lib/cjs/blue/entities.js +1 -0
  90. package/lib/cjs/blue/errors.d.ts +1 -1
  91. package/lib/cjs/blue/errors.js +2 -1
  92. package/lib/cjs/blue/fetch.d.ts +3 -1
  93. package/lib/cjs/blue/fetch.js +1 -0
  94. package/lib/cjs/entities/blue/blue.d.ts +29 -20
  95. package/lib/cjs/entities/blue/blue.js +6 -1
  96. package/lib/cjs/entities/index.d.ts +9 -2
  97. package/lib/cjs/entities/index.js +16 -0
  98. package/lib/cjs/entities/midnight/midnight.d.ts +2 -2
  99. package/lib/cjs/entities/midnight/midnight.js +20 -24
  100. package/lib/cjs/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.d.ts → entities/requirements/getBundlesTokenRequirements.d.ts} +27 -19
  101. package/lib/cjs/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.js → entities/requirements/getBundlesTokenRequirements.js} +76 -75
  102. package/lib/{esm/actions/requirements/blue → cjs/entities/requirements}/getUnusedPermit2Nonce.d.ts +1 -1
  103. package/lib/cjs/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +4 -4
  104. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
  105. package/lib/cjs/entities/requirements/getVaultBundlesSharesRequirements.js +74 -0
  106. package/lib/cjs/entities/requirements/index.d.ts +2 -0
  107. package/lib/cjs/entities/requirements/index.js +18 -0
  108. package/lib/cjs/entities/vaultV1/vaultV1.d.ts +356 -101
  109. package/lib/cjs/entities/vaultV1/vaultV1.js +334 -120
  110. package/lib/cjs/entities/vaultV1ReallocationData.d.ts +6 -0
  111. package/lib/cjs/entities/vaultV1ReallocationData.js +20 -5
  112. package/lib/cjs/entities/vaultV2/vaultV2.d.ts +359 -100
  113. package/lib/cjs/entities/vaultV2/vaultV2.js +448 -93
  114. package/lib/cjs/entities/vaultV2BlueReallocationData.d.ts +8 -1
  115. package/lib/cjs/entities/vaultV2BlueReallocationData.js +46 -13
  116. package/lib/cjs/errors.d.ts +1 -1
  117. package/lib/cjs/errors.js +3 -2
  118. package/lib/cjs/fetch.d.ts +3 -1
  119. package/lib/cjs/fetch.js +1 -0
  120. package/lib/cjs/helpers/computeVaultV1Reallocations.d.ts +2 -0
  121. package/lib/cjs/helpers/computeVaultV1Reallocations.js +2 -0
  122. package/lib/cjs/helpers/index.d.ts +4 -1
  123. package/lib/cjs/helpers/index.js +14 -1
  124. package/lib/cjs/helpers/metadata.d.ts +3 -5
  125. package/lib/cjs/helpers/metadata.js +4 -6
  126. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
  127. package/lib/cjs/helpers/previewVaultV2ForceWithdraw.js +164 -0
  128. package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  129. package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +2 -0
  130. package/lib/cjs/helpers/referralFee.d.ts +21 -0
  131. package/lib/cjs/helpers/referralFee.js +35 -0
  132. package/lib/cjs/helpers/slippage.d.ts +136 -1
  133. package/lib/cjs/helpers/slippage.js +188 -0
  134. package/lib/cjs/helpers/validate.d.ts +67 -8
  135. package/lib/cjs/helpers/validate.js +94 -9
  136. package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
  137. package/lib/cjs/helpers/validateRequirementSpender.js +1 -0
  138. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
  139. package/lib/cjs/helpers/vaultV2ForceWithdrawPlan.js +369 -0
  140. package/lib/cjs/index.d.ts +1 -0
  141. package/lib/cjs/index.js +1 -0
  142. package/lib/cjs/types/action.d.ts +273 -82
  143. package/lib/cjs/types/action.js +12 -12
  144. package/lib/cjs/types/error.d.ts +349 -23
  145. package/lib/cjs/types/error.js +393 -39
  146. package/lib/cjs/types/sharedLiquidity.d.ts +2 -2
  147. package/lib/cjs/utils.d.ts +3 -1
  148. package/lib/cjs/utils.js +10 -1
  149. package/lib/esm/abis.d.ts +227 -2
  150. package/lib/esm/abis.js +157 -2
  151. package/lib/esm/actions/blue/borrow.d.ts +1 -1
  152. package/lib/esm/actions/blue/borrow.js +1 -1
  153. package/lib/esm/actions/blue/common.d.ts +6 -19
  154. package/lib/esm/actions/blue/common.js +30 -164
  155. package/lib/esm/actions/blue/refinance.d.ts +1 -1
  156. package/lib/esm/actions/blue/refinance.js +1 -1
  157. package/lib/esm/actions/blue/repay.d.ts +3 -3
  158. package/lib/esm/actions/blue/repay.js +1 -1
  159. package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +3 -3
  160. package/lib/esm/actions/blue/repayWithdrawCollateral.js +1 -1
  161. package/lib/esm/actions/blue/supply.d.ts +3 -3
  162. package/lib/esm/actions/blue/supply.js +5 -10
  163. package/lib/esm/actions/blue/supplyCollateral.d.ts +3 -3
  164. package/lib/esm/actions/blue/supplyCollateral.js +1 -1
  165. package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +3 -3
  166. package/lib/esm/actions/blue/supplyCollateralBorrow.js +1 -1
  167. package/lib/esm/actions/blue/withdraw.d.ts +1 -1
  168. package/lib/esm/actions/blue/withdraw.js +1 -1
  169. package/lib/esm/actions/blue/withdrawCollateral.d.ts +1 -1
  170. package/lib/esm/actions/blue/withdrawCollateral.js +1 -1
  171. package/lib/esm/actions/bundles/common.d.ts +230 -0
  172. package/lib/esm/actions/bundles/common.js +494 -0
  173. package/lib/esm/actions/bundles/index.d.ts +3 -0
  174. package/lib/esm/actions/bundles/index.js +2 -0
  175. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.d.ts +76 -0
  176. package/lib/esm/actions/bundles/resolveBundlesTokenRequirements.js +121 -0
  177. package/lib/esm/actions/index.d.ts +1 -0
  178. package/lib/esm/actions/index.js +1 -0
  179. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.d.ts +2 -2
  180. package/lib/esm/actions/midnight/supplyCollateralTakeBorrow.js +2 -2
  181. package/lib/esm/actions/midnight/takeBorrow.d.ts +2 -2
  182. package/lib/esm/actions/midnight/takeBorrow.js +2 -2
  183. package/lib/esm/actions/midnight/takeLend.d.ts +2 -2
  184. package/lib/esm/actions/midnight/takeLend.js +2 -2
  185. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +3 -0
  186. package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +8 -12
  187. package/lib/esm/actions/requirements/blue/index.d.ts +0 -2
  188. package/lib/esm/actions/requirements/blue/index.js +0 -2
  189. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +15 -8
  190. package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +22 -22
  191. package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
  192. package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +2 -1
  193. package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +19 -10
  194. package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +44 -32
  195. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.d.ts +4 -2
  196. package/lib/esm/actions/requirements/encode/encodeErc20Permit2Approve.js +15 -10
  197. package/lib/{cjs/actions/requirements/encode/encodeErc20Permit2TransferFrom.d.ts → esm/actions/requirements/encode/encodeErc20Permit2SignatureTransfer.d.ts} +16 -14
  198. package/lib/esm/actions/requirements/encode/{encodeErc20Permit2TransferFrom.js → encodeErc20Permit2SignatureTransfer.js} +25 -20
  199. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +12 -9
  200. package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +27 -21
  201. package/lib/esm/actions/requirements/encode/index.d.ts +1 -1
  202. package/lib/esm/actions/requirements/encode/index.js +1 -1
  203. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +1 -0
  204. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts +4 -1
  205. package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +5 -2
  206. package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +4 -3
  207. package/lib/esm/actions/requirements/getRequirementsApproval.js +4 -3
  208. package/lib/esm/actions/signatures/getTokenRequirementActions.js +3 -3
  209. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +28 -30
  210. package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +21 -67
  211. package/lib/esm/actions/vaultV1/deposit.d.ts +73 -57
  212. package/lib/esm/actions/vaultV1/deposit.js +112 -111
  213. package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +1 -0
  214. package/lib/esm/actions/vaultV1/inKindRedeem.js +3 -2
  215. package/lib/esm/actions/vaultV1/migrateToV2.d.ts +43 -66
  216. package/lib/esm/actions/vaultV1/migrateToV2.js +93 -106
  217. package/lib/esm/actions/vaultV1/redeem.d.ts +30 -23
  218. package/lib/esm/actions/vaultV1/redeem.js +56 -33
  219. package/lib/esm/actions/vaultV1/withdraw.d.ts +58 -24
  220. package/lib/esm/actions/vaultV1/withdraw.js +86 -34
  221. package/lib/esm/actions/vaultV2/deposit.d.ts +74 -57
  222. package/lib/esm/actions/vaultV2/deposit.js +113 -111
  223. package/lib/esm/actions/vaultV2/forceWithdraw.d.ts +58 -39
  224. package/lib/esm/actions/vaultV2/forceWithdraw.js +89 -62
  225. package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +1 -0
  226. package/lib/esm/actions/vaultV2/inKindRedeem.js +3 -2
  227. package/lib/esm/actions/vaultV2/redeem.d.ts +30 -24
  228. package/lib/esm/actions/vaultV2/redeem.js +56 -34
  229. package/lib/esm/actions/vaultV2/withdraw.d.ts +58 -25
  230. package/lib/esm/actions/vaultV2/withdraw.js +86 -35
  231. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +4 -1
  232. package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +3 -1
  233. package/lib/esm/blue/abis.d.ts +5 -1
  234. package/lib/esm/blue/abis.js +5 -1
  235. package/lib/esm/blue/entities.d.ts +8 -2
  236. package/lib/esm/blue/entities.js +3 -1
  237. package/lib/esm/blue/errors.d.ts +1 -1
  238. package/lib/esm/blue/errors.js +1 -1
  239. package/lib/esm/blue/fetch.d.ts +3 -1
  240. package/lib/esm/blue/fetch.js +3 -1
  241. package/lib/esm/entities/blue/blue.d.ts +29 -20
  242. package/lib/esm/entities/blue/blue.js +7 -2
  243. package/lib/esm/entities/index.d.ts +9 -2
  244. package/lib/esm/entities/index.js +4 -1
  245. package/lib/esm/entities/midnight/midnight.d.ts +2 -2
  246. package/lib/esm/entities/midnight/midnight.js +20 -24
  247. package/lib/esm/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.d.ts → entities/requirements/getBundlesTokenRequirements.d.ts} +27 -19
  248. package/lib/esm/{actions/requirements/blue/getBlueBundlesV1TokenRequirements.js → entities/requirements/getBundlesTokenRequirements.js} +67 -66
  249. package/lib/{cjs/actions/requirements/blue → esm/entities/requirements}/getUnusedPermit2Nonce.d.ts +1 -1
  250. package/lib/esm/{actions/requirements/blue → entities/requirements}/getUnusedPermit2Nonce.js +4 -4
  251. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.d.ts +28 -0
  252. package/lib/esm/entities/requirements/getVaultBundlesSharesRequirements.js +70 -0
  253. package/lib/esm/entities/requirements/index.d.ts +2 -0
  254. package/lib/esm/entities/requirements/index.js +2 -0
  255. package/lib/esm/entities/vaultV1/vaultV1.d.ts +356 -101
  256. package/lib/esm/entities/vaultV1/vaultV1.js +338 -124
  257. package/lib/esm/entities/vaultV1ReallocationData.d.ts +6 -0
  258. package/lib/esm/entities/vaultV1ReallocationData.js +20 -5
  259. package/lib/esm/entities/vaultV2/vaultV2.d.ts +359 -100
  260. package/lib/esm/entities/vaultV2/vaultV2.js +452 -97
  261. package/lib/esm/entities/vaultV2BlueReallocationData.d.ts +8 -1
  262. package/lib/esm/entities/vaultV2BlueReallocationData.js +46 -13
  263. package/lib/esm/errors.d.ts +1 -1
  264. package/lib/esm/errors.js +1 -1
  265. package/lib/esm/fetch.d.ts +3 -1
  266. package/lib/esm/fetch.js +3 -1
  267. package/lib/esm/helpers/computeVaultV1Reallocations.d.ts +2 -0
  268. package/lib/esm/helpers/computeVaultV1Reallocations.js +2 -0
  269. package/lib/esm/helpers/index.d.ts +4 -1
  270. package/lib/esm/helpers/index.js +4 -1
  271. package/lib/esm/helpers/metadata.d.ts +3 -5
  272. package/lib/esm/helpers/metadata.js +4 -6
  273. package/lib/esm/helpers/previewVaultV2ForceWithdraw.d.ts +107 -0
  274. package/lib/esm/helpers/previewVaultV2ForceWithdraw.js +161 -0
  275. package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +1 -0
  276. package/lib/esm/helpers/previewVaultV2InKindRedeem.js +2 -0
  277. package/lib/esm/helpers/referralFee.d.ts +21 -0
  278. package/lib/esm/helpers/referralFee.js +31 -0
  279. package/lib/esm/helpers/slippage.d.ts +136 -1
  280. package/lib/esm/helpers/slippage.js +186 -2
  281. package/lib/esm/helpers/validate.d.ts +67 -8
  282. package/lib/esm/helpers/validate.js +92 -10
  283. package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
  284. package/lib/esm/helpers/validateRequirementSpender.js +1 -0
  285. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.d.ts +274 -0
  286. package/lib/esm/helpers/vaultV2ForceWithdrawPlan.js +362 -0
  287. package/lib/esm/index.d.ts +1 -0
  288. package/lib/esm/index.js +1 -0
  289. package/lib/esm/types/action.d.ts +273 -82
  290. package/lib/esm/types/action.js +11 -11
  291. package/lib/esm/types/error.d.ts +349 -23
  292. package/lib/esm/types/error.js +377 -31
  293. package/lib/esm/types/sharedLiquidity.d.ts +2 -2
  294. package/lib/esm/utils.d.ts +3 -1
  295. package/lib/esm/utils.js +3 -1
  296. package/package.json +7 -7
@@ -9,9 +9,10 @@ const index_js_1 = require("../encode/index.js");
9
9
  *
10
10
  * @param viemClient - Connected viem `Client` (used by the returned `Requirement.sign()`).
11
11
  * @param params.token - ERC-20 token address (must support EIP-2612).
12
+ * @param params.owner - Account that owns the tokens and signs the permit.
12
13
  * @param params.chainId - The chain the bundle targets.
13
14
  * @param params.args.amount - Required token amount.
14
- * @param params.nonce - The user's current EIP-2612 nonce on `token`.
15
+ * @param params.nonce - The owner's current EIP-2612 nonce on `token`.
15
16
  * @param params.supportDeployless - Whether to fetch token metadata via deployless multicall.
16
17
  * @returns A single-element array containing the exact-amount `Requirement` to sign.
17
18
  * @example
@@ -23,6 +24,7 @@ const index_js_1 = require("../encode/index.js");
23
24
  * const client = createWalletClient({ chain: mainnet, transport: http() });
24
25
  * const reqs = await getGeneralAdapterRequirementsPermit(client, {
25
26
  * token: USDC, // an ERC-2612-compatible token; DAI is excluded by getGeneralAdapterRequirements
27
+ * owner,
26
28
  * chainId: 1,
27
29
  * args: { amount: 1_000_000n },
28
30
  * nonce: 0n,
@@ -31,7 +33,7 @@ const index_js_1 = require("../encode/index.js");
31
33
  * ```
32
34
  */
33
35
  const getGeneralAdapterRequirementsPermit = async (viemClient, params) => {
34
- const { token, chainId, args: { amount }, nonce, supportDeployless, } = params;
36
+ const { token, owner, chainId, args: { amount }, nonce, supportDeployless, } = params;
35
37
  const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
36
38
  // Existing direct ERC-20 allowance is intentionally not an input here. ERC-2612 overwrites the
37
39
  // allowance with the signed amount, and the bundle spends exactly `amount`, leaving no residual
@@ -39,6 +41,7 @@ const getGeneralAdapterRequirementsPermit = async (viemClient, params) => {
39
41
  return [
40
42
  await (0, index_js_1.encodeErc20Permit)(viemClient, {
41
43
  token,
44
+ owner,
42
45
  spender: generalAdapter1,
43
46
  amount,
44
47
  chainId,
@@ -5,8 +5,8 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
5
5
  * allowance.
6
6
  *
7
7
  * The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
8
- * GeneralAdapter1, Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, and BlueBundlesV1
9
- * addresses when configured.
8
+ * GeneralAdapter1, Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and
9
+ * BlueBundlesV1 addresses when configured.
10
10
  *
11
11
  * Returns an empty array when the allowance already covers `spendAmount`. When the token is in
12
12
  * `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
@@ -20,7 +20,8 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
20
20
  * @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
21
21
  * may be `maxUint256` for reusable Permit2 or saturated-share-repay approvals).
22
22
  * @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1,
23
- * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, or BlueBundlesV1 for `chainId`.
23
+ * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for
24
+ * `chainId`.
24
25
  * @param params.allowances - The user's current allowance of `address` for `spender`.
25
26
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
26
27
  * followed by the new approval. Empty when no approval is needed.
@@ -10,8 +10,8 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
10
10
  * allowance.
11
11
  *
12
12
  * The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
13
- * GeneralAdapter1, Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, and BlueBundlesV1
14
- * addresses when configured.
13
+ * GeneralAdapter1, Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, and
14
+ * BlueBundlesV1 addresses when configured.
15
15
  *
16
16
  * Returns an empty array when the allowance already covers `spendAmount`. When the token is in
17
17
  * `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
@@ -25,7 +25,8 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
25
25
  * @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
26
26
  * may be `maxUint256` for reusable Permit2 or saturated-share-repay approvals).
27
27
  * @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1,
28
- * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, or BlueBundlesV1 for `chainId`.
28
+ * Permit2, Midnight, MidnightBundles, VaultExitBundlesV1, VaultBundlesV1, or BlueBundlesV1 for
29
+ * `chainId`.
29
30
  * @param params.allowances - The user's current allowance of `address` for `spender`.
30
31
  * @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
31
32
  * followed by the new approval. Empty when no approval is needed.
@@ -59,8 +59,8 @@ const getTokenRequirementActions = ({ asset, amount, recipient, requirementSigna
59
59
  },
60
60
  ];
61
61
  }
62
- if ((0, index_js_1.isPermit2TransferFromSignature)(requirementSignature)) {
63
- throw new index_js_1.UnexpectedRequirementSignatureError("permit2TransferFrom");
62
+ if ((0, index_js_1.isPermit2SignatureTransferSignature)(requirementSignature)) {
63
+ throw new index_js_1.UnexpectedRequirementSignatureError("permit2SignatureTransfer");
64
64
  }
65
65
  if (!(0, viem_1.isAddressEqual)(requirementSignature.args.asset, asset)) {
66
66
  throw new index_js_1.DepositAssetMismatchError(asset, requirementSignature.args.asset);
@@ -1,52 +1,50 @@
1
- import { type Address, type Hex } from "viem";
1
+ import type { Address } from "viem";
2
2
  import { type PermitRequirementSignature } from "../../types/index.js";
3
- /** Permit tuple consumed by VaultExitBundlesV1. */
4
- export interface VaultExitBundlesV1PermitStruct {
5
- /** Vault-share allowance authorized by the permit. */
6
- readonly value: bigint;
7
- /** Vault permit nonce signed by the owner. */
8
- readonly nonce: bigint;
9
- /** Timestamp after which the permit is invalid. */
10
- readonly deadline: bigint;
11
- /** ECDSA recovery identifier, or zero for the empty-permit sentinel. */
12
- readonly v: number;
13
- /** ECDSA signature `r`, or zero for the empty-permit sentinel. */
14
- readonly r: Hex;
15
- /** ECDSA signature `s`, or zero for the empty-permit sentinel. */
16
- readonly s: Hex;
17
- }
18
- /** Parameters for {@link getVaultExitBundlesV1PermitStruct}. */
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
+ */
19
15
  export interface GetVaultExitBundlesV1PermitStructParams {
20
16
  /** Vault share token authorized by the permit. */
21
17
  readonly vault: Address;
22
18
  /** Bundle deadline used by the empty-permit sentinel. */
23
19
  readonly deadline: bigint;
20
+ /** Optional expected owner of the signed permit. */
21
+ readonly owner?: Address;
22
+ /** Optional expected spender of the signed permit. */
23
+ readonly spender?: Address;
24
24
  /** Optional signed bounded ERC-2612 requirement. */
25
25
  readonly requirementSignature?: PermitRequirementSignature;
26
26
  }
27
27
  /**
28
- * Returns the permit struct consumed by VaultExitBundlesV1 from an optional vault-share
29
- * requirement signature.
30
- *
31
- * Without a signature, returns the contract's empty-permit sentinel. With a signature, validates
32
- * the ERC-2612 kind and vault asset before splitting the serialized signature.
33
- * Owner, spender, deadline, nonce, and cryptographic validity are verified onchain by the vault.
28
+ * Compatibility wrapper for the former VaultExitBundlesV1-specific permit reshaper.
34
29
  *
35
30
  * @param params.vault - Vault share token authorized by the permit.
36
31
  * @param params.deadline - Bundle deadline used by the empty-permit sentinel.
37
- * @param params.requirementSignature - Optional signed bounded ERC-2612 requirement.
38
- * @returns The VaultExitBundlesV1 permit tuple.
39
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
32
+ * @param params.owner - Optional expected owner of the signed permit.
33
+ * @param params.spender - Optional expected spender of the signed permit.
34
+ * @param params.requirementSignature - Optional signed ERC-2612 vault-share requirement.
35
+ * @returns The shared bundles share-permit tuple.
36
+ * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement is incompatible.
37
+ * @deprecated Use `getBundlesSharesPermit`; this wrapper preserves the legacy error identity.
40
38
  * @example
41
39
  * ```ts
42
40
  * import { getVaultExitBundlesV1PermitStruct } from "@morpho-org/morpho-sdk";
41
+ * import { zeroAddress } from "viem";
43
42
  *
44
43
  * const permit = getVaultExitBundlesV1PermitStruct({
45
- * vault,
46
- * deadline,
47
- * requirementSignature,
44
+ * vault: zeroAddress,
45
+ * deadline: 1_900_000_000n,
48
46
  * });
49
- * // permit satisfies VaultExitBundlesV1PermitStruct
47
+ * // permit.value === 0n
50
48
  * ```
51
49
  */
52
50
  export declare const getVaultExitBundlesV1PermitStruct: (params: GetVaultExitBundlesV1PermitStructParams) => VaultExitBundlesV1PermitStruct;
@@ -1,91 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getVaultExitBundlesV1PermitStruct = void 0;
4
- const viem_1 = require("viem");
5
4
  const index_js_1 = require("../../types/index.js");
5
+ const common_js_1 = require("../bundles/common.js");
6
6
  /**
7
- * Returns the permit struct consumed by VaultExitBundlesV1 from an optional vault-share
8
- * requirement signature.
9
- *
10
- * Without a signature, returns the contract's empty-permit sentinel. With a signature, validates
11
- * the ERC-2612 kind and vault asset before splitting the serialized signature.
12
- * Owner, spender, deadline, nonce, and cryptographic validity are verified onchain by the vault.
7
+ * Compatibility wrapper for the former VaultExitBundlesV1-specific permit reshaper.
13
8
  *
14
9
  * @param params.vault - Vault share token authorized by the permit.
15
10
  * @param params.deadline - Bundle deadline used by the empty-permit sentinel.
16
- * @param params.requirementSignature - Optional signed bounded ERC-2612 requirement.
17
- * @returns The VaultExitBundlesV1 permit tuple.
18
- * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
11
+ * @param params.owner - Optional expected owner of the signed permit.
12
+ * @param params.spender - Optional expected spender of the signed permit.
13
+ * @param params.requirementSignature - Optional signed ERC-2612 vault-share requirement.
14
+ * @returns The shared bundles share-permit tuple.
15
+ * @throws {VaultExitBundlesV1PermitMismatchError} when the requirement is incompatible.
16
+ * @deprecated Use `getBundlesSharesPermit`; this wrapper preserves the legacy error identity.
19
17
  * @example
20
18
  * ```ts
21
19
  * import { getVaultExitBundlesV1PermitStruct } from "@morpho-org/morpho-sdk";
20
+ * import { zeroAddress } from "viem";
22
21
  *
23
22
  * const permit = getVaultExitBundlesV1PermitStruct({
24
- * vault,
25
- * deadline,
26
- * requirementSignature,
23
+ * vault: zeroAddress,
24
+ * deadline: 1_900_000_000n,
27
25
  * });
28
- * // permit satisfies VaultExitBundlesV1PermitStruct
26
+ * // permit.value === 0n
29
27
  * ```
30
28
  */
31
29
  const getVaultExitBundlesV1PermitStruct = (params) => {
32
- const { requirementSignature } = params;
33
- if (requirementSignature == null) {
34
- return {
35
- value: 0n,
36
- nonce: 0n,
37
- deadline: params.deadline,
38
- v: 0,
39
- r: viem_1.zeroHash,
40
- s: viem_1.zeroHash,
41
- };
42
- }
43
- if (requirementSignature.action.type !== "permit") {
44
- throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
45
- field: "type",
46
- expected: "permit",
47
- actual: requirementSignature.action.type,
48
- });
30
+ try {
31
+ return (0, common_js_1.getBundlesSharesPermit)(params);
49
32
  }
50
- if (!(0, viem_1.isAddressEqual)(requirementSignature.args.asset, params.vault)) {
51
- throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
52
- field: "asset",
53
- expected: params.vault,
54
- actual: requirementSignature.args.asset,
55
- });
56
- }
57
- const signature = (() => {
58
- try {
59
- const serializedSignature = requirementSignature.args.signature;
60
- return (0, viem_1.size)(serializedSignature) === 64
61
- ? (0, viem_1.compactSignatureToSignature)((0, viem_1.parseCompactSignature)(serializedSignature))
62
- : (0, viem_1.parseSignature)(serializedSignature);
63
- }
64
- catch (cause) {
33
+ catch (cause) {
34
+ if (cause instanceof index_js_1.BundlesPermitMismatchError) {
65
35
  throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
66
- field: "signature",
67
- expected: "a 64-byte compact or 65-byte serialized ECDSA signature",
68
- actual: requirementSignature.args.signature,
36
+ field: cause.field,
37
+ expected: cause.expected,
38
+ actual: cause.actual,
69
39
  cause,
70
40
  });
71
41
  }
72
- })();
73
- const { r, s, v, yParity } = signature;
74
- const normalizedV = v ?? (yParity == null ? undefined : BigInt(yParity + 27));
75
- if (normalizedV == null) {
76
- throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
77
- field: "signature",
78
- expected: "a signature containing v or yParity",
79
- actual: requirementSignature.args.signature,
80
- });
42
+ throw cause;
81
43
  }
82
- return {
83
- value: requirementSignature.args.amount,
84
- nonce: requirementSignature.args.nonce,
85
- deadline: requirementSignature.args.deadline,
86
- v: Number(normalizedV),
87
- r,
88
- s,
89
- };
90
44
  };
91
45
  exports.getVaultExitBundlesV1PermitStruct = getVaultExitBundlesV1PermitStruct;
@@ -1,71 +1,87 @@
1
1
  import { type Address } from "viem";
2
- import { type DepositAmountArgs, type Metadata, type PermitRequirementSignature, type Transaction, type VaultV1DepositAction } from "../../types/index.js";
2
+ import { type BundlesFundingArgs, type BundlesTokenRequirementSignature, type Metadata, type Transaction, type VaultV1DepositAction } from "../../types/index.js";
3
3
  /** Parameters for {@link vaultV1Deposit}. */
4
4
  export interface VaultV1DepositParams {
5
- vault: {
6
- chainId: number;
7
- address: Address;
8
- asset: Address;
5
+ readonly vault: {
6
+ readonly chainId: number;
7
+ readonly address: Address;
8
+ readonly asset: Address;
9
9
  };
10
- args: DepositAmountArgs & {
11
- maxSharePrice: bigint;
12
- recipient: Address;
13
- requirementSignature?: PermitRequirementSignature;
10
+ readonly args: BundlesFundingArgs & {
11
+ readonly maxSharePrice: bigint;
12
+ readonly userAddress: Address;
13
+ readonly recipient?: never;
14
+ readonly requirementSignature?: BundlesTokenRequirementSignature;
15
+ readonly referralFeePct?: bigint;
16
+ readonly referralFeeRecipient?: Address;
17
+ readonly deadline: bigint;
14
18
  };
15
- metadata?: Metadata;
19
+ readonly metadata?: Metadata;
16
20
  }
17
21
  /**
18
- * Prepares a deposit transaction for a VaultV1 (MetaMorpho) contract.
22
+ * Encodes a Vault V1 deposit through the registered VaultBundlesV1 contract.
19
23
  *
20
- * Routed through bundler3 to atomically execute the asset transfer and vault deposit. The
21
- * `GeneralAdapter1` enforces `maxSharePrice` on-chain to prevent inflation attacks. Never bypass
22
- * the general adapter.
23
- *
24
- * When `nativeAmount > 0`, that amount of native ETH is sent as `msg.value` to the bundler3
25
- * multicall and wrapped into wNative via `GeneralAdapter1.wrapNative()`. The vault's underlying
26
- * asset must be the chain's wrapped native token.
27
- *
28
- * @param params.vault.chainId - The chain the vault lives on.
29
- * @param params.vault.address - The VaultV1 (MetaMorpho) address.
30
- * @param params.vault.asset - The vault's underlying ERC-20 asset.
31
- * @param params.args.amount - Amount of ERC-20 assets to deposit. At least one of `amount` or
32
- * `nativeAmount` must be positive. Defaults to `0n`.
33
- * @param params.args.maxSharePrice - Maximum acceptable share price (in RAY, slippage
34
- * protection enforced on-chain by `GeneralAdapter1`).
35
- * @param params.args.recipient - Address that receives the minted vault shares.
36
- * @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval.
37
- * @param params.args.nativeAmount - Optional amount of native token to wrap into wNative for the
38
- * deposit. Requires the vault asset to be the chain's wNative.
39
- * @param params.metadata - Optional analytics metadata attached to the bundle.
40
- * @returns A deep-frozen `Transaction<VaultV1DepositAction>` with `to`, `value`, `data`, and the
41
- * typed `action` discriminator the simulation layer consumes.
42
- * @throws {NegativeInputError} when `amount < 0n` or `nativeAmount < 0n`.
43
- * @throws {NonPositiveInputError} when `maxSharePrice <= 0n`, or when both `amount` and
44
- * `nativeAmount` resolve to zero.
45
- * @throws {ChainWNativeMissingError} when `nativeAmount` is provided but the chain has no
46
- * configured wNative.
47
- * @throws {NativeAmountOnNonWNativeVaultError} when `nativeAmount` is provided but the vault
48
- * asset is not the chain's wNative.
49
- * @throws {DepositAssetMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
50
- * `requirementSignature` is provided and the signed asset differs from `vault.asset`. The
51
- * signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
52
- * @throws {DepositAmountMismatchError} from `getTokenRequirementActions` when `amount > 0n` and
53
- * `requirementSignature` is provided and the signed amount differs from `args.amount`.
54
- * @throws {Permit2ExpirationMissingError} from `getTokenRequirementActions` when `amount > 0n` and a
55
- * Permit2 requirement signature is missing its expiration.
24
+ * @param params.vault.chainId - Chain containing the vault and its registered VaultBundlesV1 contract.
25
+ * @param params.vault.address - Vault V1 contract receiving the net deposit.
26
+ * @param params.vault.asset - Underlying ERC-20 asset; must be the chain's wNative for native funding.
27
+ * @param params.args.amount - Positive gross ERC-20 amount in asset base units, exclusive with `nativeAmount`.
28
+ * @param params.args.nativeAmount - Positive gross native amount in wei, exclusive with `amount` and
29
+ * `requirementSignature`; sent as `tx.value` and wrapped by VaultBundlesV1.
30
+ * @param params.args.maxSharePrice - Positive maximum asset base units per share base unit, scaled
31
+ * by RAY (1e27). Compute it for the net deposit after referral fees to bound slippage.
32
+ * @param params.args.userAddress - Permit owner and transaction sender; VaultBundlesV1 mints shares to this account.
33
+ * @param params.args.recipient - Unsupported; shares are always minted to the transaction sender.
34
+ * @param params.args.requirementSignature - Optional ERC-2612 or Permit2 SignatureTransfer signature
35
+ * for the gross amount, vault asset, `userAddress`, and VaultBundlesV1 spender.
36
+ * @param params.args.referralFeePct - Optional WAD-scaled fee in [0, 1e18), defaulting to zero.
37
+ * The fee is rounded down and deducted from gross assets before depositing.
38
+ * @param params.args.referralFeeRecipient - Optional fee recipient; a nonzero address is required
39
+ * when `referralFeePct > 0n`.
40
+ * @param params.args.deadline - Positive uint256 Unix timestamp in seconds after which execution
41
+ * reverts. The caller must supply it; the builder chooses no default.
42
+ * @param params.metadata - Optional analytics metadata appended to the transaction calldata.
43
+ * @param params.metadata.origin - Hex origin identifier of at most four bytes, with an optional `0x` prefix.
44
+ * @param params.metadata.timestamp - Optional flag to append the current timestamp; defaults to false.
45
+ * @returns A deep-frozen `Transaction<VaultV1DepositAction>` targeting VaultBundlesV1, with
46
+ * `to`, `value`, `data`, and gross/fee/net deposit action metadata.
47
+ * @throws {MixedBundlesFundingError} when ERC-20 and native funding are both supplied.
48
+ * @throws {NegativeInputError} when the selected funding amount or `referralFeePct` is negative.
49
+ * @throws {NonPositiveInputError} when funding, `maxSharePrice`, or `deadline` is not positive.
50
+ * @throws {ChainWNativeMissingError} when native funding is requested on a chain without wNative.
51
+ * @throws {NativeAmountOnNonWNativeVaultError} when native funding targets a non-wNative vault.
52
+ * @throws {ReferralFeePctExceededError} when `referralFeePct` is at least WAD; it extends
53
+ * {@link InputExceedsMaxError}, so either class catches it.
54
+ * @throws {ReferralFeeRecipientMissingError} when a positive `referralFeePct` has no recipient.
55
+ * @throws {UnexpectedRequirementSignatureError} when native funding carries a token permit or a
56
+ * Permit2 AllowanceTransfer signature is supplied.
57
+ * @throws {InputExceedsMaxError} when funding, `maxSharePrice`, or `deadline` exceeds uint256.
58
+ * @throws {DepositOwnerMismatchError} when the signed owner differs from `userAddress`.
59
+ * @throws {DepositAssetMismatchError} when the signed asset differs from the vault asset.
60
+ * @throws {DepositAmountMismatchError} when the signed amount differs from the gross funding amount.
61
+ * @throws {DepositSpenderMismatchError} when the signed spender is not VaultBundlesV1.
62
+ * @throws {BundlesRequirementSignatureMismatchError} when the signature deadline, nonce, or encoding is invalid.
63
+ * @throws {UnsupportedChainIdError} when the chain is absent from the address registry.
64
+ * @throws {UnknownAddressError} when VaultBundlesV1 is not registered on the target chain.
56
65
  * @example
57
66
  * ```ts
67
+ * import { vaults } from "@morpho-org/morpho-test";
58
68
  * import { vaultV1Deposit } from "@morpho-org/morpho-sdk";
69
+ * import type { Address } from "viem";
70
+ * import { mainnet } from "viem/chains";
59
71
  *
60
- * const tx = vaultV1Deposit({
61
- * vault: { chainId: 1, address: vaultAddress, asset: USDC },
62
- * args: {
63
- * amount: 1_000_000n,
64
- * maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
65
- * recipient: depositor,
66
- * },
67
- * });
68
- * // tx satisfies Readonly<Transaction<VaultV1DepositAction>>
72
+ * export function buildSteakUsdcDeposit(
73
+ * userAddress: Address,
74
+ * maxSharePrice: bigint,
75
+ * deadline: bigint,
76
+ * ) {
77
+ * const vault = vaults[mainnet.id].steakUsdc;
78
+ * const tx = vaultV1Deposit({
79
+ * vault: { chainId: mainnet.id, address: vault.address, asset: vault.asset },
80
+ * args: { amount: 1_000_000n, maxSharePrice, userAddress, deadline },
81
+ * });
82
+ * // tx satisfies Readonly<Transaction<VaultV1DepositAction>>
83
+ * return tx;
84
+ * }
69
85
  * ```
70
86
  */
71
- export declare const vaultV1Deposit: ({ vault: { chainId, address: vaultAddress, asset }, args: { amount, maxSharePrice, recipient, requirementSignature, nativeAmount, }, metadata, }: VaultV1DepositParams) => Readonly<Transaction<VaultV1DepositAction>>;
87
+ export declare const vaultV1Deposit: (params: VaultV1DepositParams) => Readonly<Transaction<VaultV1DepositAction>>;