@gearbox-protocol/sdk 17.0.0-next.4 → 17.1.0-next.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 (376) hide show
  1. package/dist/cjs/dev/abi.js +14 -15
  2. package/dist/cjs/dev/claimFromFaucet.js +4 -8
  3. package/dist/cjs/dev/createAnvilClient.js +35 -17
  4. package/dist/cjs/dev/index.js +7 -2
  5. package/dist/cjs/dev/kycUtils.js +66 -58
  6. package/dist/cjs/dev/midasUtils.js +113 -16
  7. package/dist/cjs/dev/securitizeUtils.js +82 -42
  8. package/dist/cjs/dev/withdrawalUtils.js +3 -6
  9. package/dist/cjs/model/errors/index.js +2 -0
  10. package/dist/cjs/model/errors/operation-errors.js +19 -1
  11. package/dist/cjs/model/index.js +4 -2
  12. package/dist/cjs/model/rwa.js +4 -4
  13. package/dist/cjs/model/rwa.schema.js +4 -4
  14. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +1 -1
  15. package/dist/cjs/onchain/OnchainSDK.js +3 -3
  16. package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +2 -17
  17. package/dist/cjs/onchain/accounts/intents/borrow.js +140 -0
  18. package/dist/cjs/onchain/accounts/intents/collateral-valuation.js +41 -0
  19. package/dist/cjs/onchain/accounts/intents/guards.js +15 -3
  20. package/dist/cjs/onchain/accounts/intents/index.js +107 -20
  21. package/dist/cjs/onchain/accounts/intents/leverage-band.js +2 -12
  22. package/dist/cjs/onchain/accounts/intents/math.js +12 -3
  23. package/dist/cjs/onchain/accounts/intents/maxBorrow.js +89 -0
  24. package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
  25. package/dist/cjs/onchain/accounts/intents/open-strategy.js +8 -46
  26. package/dist/cjs/onchain/accounts/intents/operations.js +0 -1
  27. package/dist/cjs/onchain/accounts/intents/plan.js +1 -8
  28. package/dist/cjs/onchain/accounts/intents/realize.js +61 -4
  29. package/dist/cjs/onchain/accounts/intents/tail.js +1 -1
  30. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -0
  31. package/dist/cjs/onchain/accounts/intents/utils/common.js +19 -0
  32. package/dist/cjs/onchain/accounts/intents/utils/credit-account-slice.js +21 -0
  33. package/dist/cjs/onchain/accounts/intents/utils/index.js +2 -0
  34. package/dist/cjs/onchain/accounts/intents/utils/price-impact.js +12 -9
  35. package/dist/cjs/onchain/accounts/intents/utils/router-path.js +4 -5
  36. package/dist/cjs/onchain/accounts/intents/withdraw-limits.js +97 -0
  37. package/dist/cjs/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  38. package/dist/cjs/onchain/constants/address-provider.js +0 -2
  39. package/dist/cjs/onchain/constants/index.js +0 -1
  40. package/dist/cjs/onchain/core/createAddressProvider.js +2 -5
  41. package/dist/cjs/onchain/index.js +60 -43
  42. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -2
  43. package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
  44. package/dist/cjs/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +49 -5
  45. package/dist/cjs/onchain/market/credit/CreditSuite.js +26 -9
  46. package/dist/cjs/onchain/market/index.js +50 -38
  47. package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +3 -3
  48. package/dist/cjs/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
  49. package/dist/cjs/onchain/market/pricefeeds/PriceFeedRegistry.js +127 -0
  50. package/dist/cjs/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
  51. package/dist/cjs/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
  52. package/dist/cjs/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
  53. package/dist/cjs/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
  54. package/dist/cjs/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
  55. package/dist/cjs/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
  56. package/dist/cjs/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
  57. package/dist/cjs/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
  58. package/dist/cjs/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
  59. package/dist/cjs/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
  60. package/dist/cjs/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
  61. package/dist/cjs/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
  62. package/dist/cjs/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
  63. package/dist/cjs/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
  64. package/dist/cjs/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
  65. package/dist/cjs/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
  66. package/dist/cjs/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
  67. package/dist/cjs/onchain/market/pricefeeds/feeds/index.js +35 -0
  68. package/dist/cjs/onchain/market/pricefeeds/index.js +51 -39
  69. package/dist/cjs/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +189 -0
  70. package/dist/cjs/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
  71. package/dist/cjs/onchain/market/pricefeeds/updates/index.js +8 -0
  72. package/dist/cjs/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
  73. package/dist/cjs/onchain/market/pricefeeds/updates/updatableDependencies.js +14 -0
  74. package/dist/cjs/onchain/market/rwa/RWARegistry.js +4 -7
  75. package/dist/cjs/onchain/market/rwa/index.js +1 -0
  76. package/dist/cjs/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
  77. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +56 -12
  78. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
  79. package/dist/cjs/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
  80. package/dist/cjs/onchain/opportunities/OpportunitiesService.js +16 -4
  81. package/dist/cjs/onchain/pools/PoolService.js +7 -8
  82. package/dist/cjs/onchain/positions/calcHealthFactor.js +3 -3
  83. package/dist/cjs/onchain/preview/index.js +2 -0
  84. package/dist/cjs/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
  85. package/dist/cjs/onchain/preview/preview/index.js +2 -0
  86. package/dist/cjs/onchain/preview/preview/midasGreenlistsAccount.js +17 -0
  87. package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +13 -16
  88. package/dist/cjs/onchain/preview/preview/previewOperation.js +19 -11
  89. package/dist/cjs/onchain/preview/preview/replayMulticall.js +4 -3
  90. package/dist/cjs/onchain/validation/bundles/checkCollateralFunding.js +3 -3
  91. package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +11 -9
  92. package/dist/cjs/onchain/validation/bundles/{checkDraw.js → checkIncreaseDebt.js} +10 -10
  93. package/dist/cjs/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
  94. package/dist/cjs/onchain/validation/bundles/checkMidasAccountGreenlist.js +44 -0
  95. package/dist/cjs/onchain/validation/bundles/checkPoolOperation.js +2 -8
  96. package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
  97. package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +18 -8
  98. package/dist/cjs/onchain/validation/bundles/index.js +6 -4
  99. package/dist/cjs/onchain/validation/checkOperation.js +0 -1
  100. package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +1 -1
  101. package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +2 -9
  102. package/dist/cjs/onchain/validation/checks/checkReservePriceLimited.js +30 -0
  103. package/dist/cjs/onchain/validation/checks/index.js +2 -0
  104. package/dist/cjs/onchain/validation/index.js +8 -4
  105. package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +2 -2
  106. package/dist/cjs/permissionless/utils/price-update/get-updatable-feeds.js +2 -2
  107. package/dist/cjs/sdk/execute/ExecuteApi.js +67 -7
  108. package/dist/cjs/sdk/opportunities/OpportunitiesNamespace.js +9 -3
  109. package/dist/cjs/sdk/prepare/PrepareApi.js +89 -14
  110. package/dist/esm/dev/abi.js +14 -15
  111. package/dist/esm/dev/claimFromFaucet.js +4 -8
  112. package/dist/esm/dev/createAnvilClient.js +36 -19
  113. package/dist/esm/dev/index.js +4 -4
  114. package/dist/esm/dev/kycUtils.js +66 -59
  115. package/dist/esm/dev/midasUtils.js +112 -18
  116. package/dist/esm/dev/securitizeUtils.js +84 -44
  117. package/dist/esm/dev/withdrawalUtils.js +3 -6
  118. package/dist/esm/model/errors/index.js +2 -2
  119. package/dist/esm/model/errors/operation-errors.js +18 -2
  120. package/dist/esm/model/index.js +4 -4
  121. package/dist/esm/model/rwa.js +4 -4
  122. package/dist/esm/model/rwa.schema.js +5 -5
  123. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +1 -1
  124. package/dist/esm/onchain/OnchainSDK.js +3 -3
  125. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -17
  126. package/dist/esm/onchain/accounts/intents/borrow.js +138 -0
  127. package/dist/esm/onchain/accounts/intents/collateral-valuation.js +40 -0
  128. package/dist/esm/onchain/accounts/intents/guards.js +15 -3
  129. package/dist/esm/onchain/accounts/intents/index.js +107 -20
  130. package/dist/esm/onchain/accounts/intents/leverage-band.js +2 -12
  131. package/dist/esm/onchain/accounts/intents/math.js +13 -5
  132. package/dist/esm/onchain/accounts/intents/maxBorrow.js +87 -0
  133. package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +15 -41
  134. package/dist/esm/onchain/accounts/intents/open-strategy.js +8 -46
  135. package/dist/esm/onchain/accounts/intents/operations.js +0 -1
  136. package/dist/esm/onchain/accounts/intents/plan.js +1 -8
  137. package/dist/esm/onchain/accounts/intents/realize.js +61 -4
  138. package/dist/esm/onchain/accounts/intents/tail.js +1 -1
  139. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -0
  140. package/dist/esm/onchain/accounts/intents/utils/common.js +19 -1
  141. package/dist/esm/onchain/accounts/intents/utils/credit-account-slice.js +21 -1
  142. package/dist/esm/onchain/accounts/intents/utils/index.js +3 -3
  143. package/dist/esm/onchain/accounts/intents/utils/price-impact.js +12 -9
  144. package/dist/esm/onchain/accounts/intents/utils/router-path.js +4 -5
  145. package/dist/esm/onchain/accounts/intents/withdraw-limits.js +95 -0
  146. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  147. package/dist/esm/onchain/constants/address-provider.js +1 -2
  148. package/dist/esm/onchain/constants/index.js +2 -2
  149. package/dist/esm/onchain/core/createAddressProvider.js +2 -5
  150. package/dist/esm/onchain/index.js +32 -24
  151. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -2
  152. package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +6 -0
  153. package/dist/esm/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +50 -6
  154. package/dist/esm/onchain/market/credit/CreditSuite.js +26 -9
  155. package/dist/esm/onchain/market/index.js +26 -21
  156. package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
  157. package/dist/esm/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
  158. package/dist/esm/onchain/market/pricefeeds/PriceFeedRegistry.js +126 -0
  159. package/dist/esm/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
  160. package/dist/esm/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
  161. package/dist/esm/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
  162. package/dist/esm/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
  163. package/dist/esm/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
  164. package/dist/esm/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
  165. package/dist/esm/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
  166. package/dist/esm/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
  167. package/dist/esm/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
  168. package/dist/esm/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
  169. package/dist/esm/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
  170. package/dist/esm/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
  171. package/dist/esm/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
  172. package/dist/esm/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
  173. package/dist/esm/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
  174. package/dist/esm/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
  175. package/dist/esm/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
  176. package/dist/esm/onchain/market/pricefeeds/feeds/index.js +18 -0
  177. package/dist/esm/onchain/market/pricefeeds/index.js +27 -21
  178. package/dist/esm/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +188 -0
  179. package/dist/esm/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
  180. package/dist/esm/onchain/market/pricefeeds/updates/index.js +5 -1
  181. package/dist/esm/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
  182. package/dist/esm/onchain/market/pricefeeds/updates/updatableDependencies.js +13 -0
  183. package/dist/esm/onchain/market/rwa/RWARegistry.js +4 -8
  184. package/dist/esm/onchain/market/rwa/index.js +2 -2
  185. package/dist/esm/onchain/market/rwa/midas/MidasDegenNFT.js +45 -5
  186. package/dist/esm/onchain/market/rwa/securitize/SecuritizeDegenNFT.js +55 -10
  187. package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +0 -37
  188. package/dist/esm/onchain/opportunities/MultichainOpportunitiesService.js +8 -2
  189. package/dist/esm/onchain/opportunities/OpportunitiesService.js +16 -4
  190. package/dist/esm/onchain/pools/PoolService.js +7 -8
  191. package/dist/esm/onchain/positions/calcHealthFactor.js +3 -3
  192. package/dist/esm/onchain/preview/index.js +2 -1
  193. package/dist/esm/onchain/preview/parse/parseRWAFactoryOperationCalldata.js +2 -2
  194. package/dist/esm/onchain/preview/preview/index.js +2 -1
  195. package/dist/esm/onchain/preview/preview/midasGreenlistsAccount.js +16 -0
  196. package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +14 -17
  197. package/dist/esm/onchain/preview/preview/previewOperation.js +19 -11
  198. package/dist/esm/onchain/preview/preview/replayMulticall.js +4 -3
  199. package/dist/esm/onchain/validation/bundles/checkCollateralFunding.js +3 -3
  200. package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +11 -9
  201. package/dist/esm/onchain/validation/bundles/checkIncreaseDebt.js +27 -0
  202. package/dist/esm/onchain/validation/bundles/{checkQuotasAsked.js → checkIncreaseQuota.js} +3 -3
  203. package/dist/esm/onchain/validation/bundles/checkMidasAccountGreenlist.js +43 -0
  204. package/dist/esm/onchain/validation/bundles/checkPoolOperation.js +2 -8
  205. package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +9 -9
  206. package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +18 -8
  207. package/dist/esm/onchain/validation/bundles/index.js +4 -3
  208. package/dist/esm/onchain/validation/checkOperation.js +0 -1
  209. package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +1 -1
  210. package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +2 -9
  211. package/dist/esm/onchain/validation/checks/checkReservePriceLimited.js +29 -0
  212. package/dist/esm/onchain/validation/checks/index.js +2 -1
  213. package/dist/esm/onchain/validation/index.js +5 -3
  214. package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +1 -1
  215. package/dist/esm/permissionless/utils/price-update/get-updatable-feeds.js +1 -1
  216. package/dist/esm/sdk/execute/ExecuteApi.js +67 -7
  217. package/dist/esm/sdk/opportunities/OpportunitiesNamespace.js +9 -3
  218. package/dist/esm/sdk/prepare/PrepareApi.js +94 -19
  219. package/dist/types/dev/abi.d.ts +13 -15
  220. package/dist/types/dev/claimFromFaucet.d.ts +0 -1
  221. package/dist/types/dev/createAnvilClient.d.ts +10 -3
  222. package/dist/types/dev/index.d.ts +4 -4
  223. package/dist/types/dev/kycUtils.d.ts +15 -24
  224. package/dist/types/dev/midasUtils.d.ts +35 -4
  225. package/dist/types/dev/securitizeUtils.d.ts +3 -9
  226. package/dist/types/model/errors/index.d.ts +2 -2
  227. package/dist/types/model/errors/operation-errors.d.ts +62 -7
  228. package/dist/types/model/index.d.ts +5 -5
  229. package/dist/types/model/opportunities.d.ts +6 -7
  230. package/dist/types/model/previews.d.ts +25 -19
  231. package/dist/types/model/rwa.d.ts +47 -27
  232. package/dist/types/model/rwa.schema.d.ts +3 -3
  233. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -2
  234. package/dist/types/offchain/opportunities/types.d.ts +1 -4
  235. package/dist/types/onchain/OnchainSDK.d.ts +2 -2
  236. package/dist/types/onchain/accounts/index.d.ts +5 -4
  237. package/dist/types/onchain/accounts/intents/borrow.d.ts +141 -0
  238. package/dist/types/onchain/accounts/intents/collateral-valuation.d.ts +42 -0
  239. package/dist/types/onchain/accounts/intents/guards.d.ts +18 -2
  240. package/dist/types/onchain/accounts/intents/index.d.ts +103 -15
  241. package/dist/types/onchain/accounts/intents/math.d.ts +11 -3
  242. package/dist/types/onchain/accounts/intents/maxBorrow.d.ts +54 -0
  243. package/dist/types/onchain/accounts/intents/maxWithdrawCollateral.d.ts +3 -8
  244. package/dist/types/onchain/accounts/intents/open-strategy.d.ts +3 -17
  245. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +2 -0
  246. package/dist/types/onchain/accounts/intents/tests/open-strategy.fixtures.d.ts +2 -2
  247. package/dist/types/onchain/accounts/intents/types.d.ts +51 -6
  248. package/dist/types/onchain/accounts/intents/utils/common.d.ts +15 -1
  249. package/dist/types/onchain/accounts/intents/utils/credit-account-slice.d.ts +14 -1
  250. package/dist/types/onchain/accounts/intents/utils/index.d.ts +3 -3
  251. package/dist/types/onchain/accounts/intents/utils/price-impact.d.ts +4 -1
  252. package/dist/types/onchain/accounts/intents/utils/router-path.d.ts +2 -5
  253. package/dist/types/onchain/accounts/intents/withdraw-limits.d.ts +80 -0
  254. package/dist/types/onchain/accounts/types.d.ts +4 -2
  255. package/dist/types/onchain/constants/address-provider.d.ts +1 -2
  256. package/dist/types/onchain/constants/index.d.ts +2 -2
  257. package/dist/types/onchain/index.d.ts +40 -31
  258. package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +6 -0
  259. package/dist/types/onchain/market/adapters/contracts/MidasGatewayAdapterContract.d.ts +20 -4
  260. package/dist/types/onchain/market/adapters/types.d.ts +8 -0
  261. package/dist/types/onchain/market/credit/CreditSuite.d.ts +13 -3
  262. package/dist/types/onchain/market/index.d.ts +29 -24
  263. package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +2 -1
  264. package/dist/types/onchain/market/oracle/types.d.ts +2 -1
  265. package/dist/types/onchain/market/pool/types.d.ts +1 -1
  266. package/dist/types/onchain/market/pricefeeds/AbstractPriceFeed.d.ts +1 -2
  267. package/dist/types/onchain/market/pricefeeds/PriceFeedRegistry.d.ts +60 -0
  268. package/dist/types/onchain/market/pricefeeds/feeds/BalancerStablePriceFeed.d.ts +12 -0
  269. package/dist/types/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.d.ts → feeds/BalancerWeightedPriceFeed.d.ts} +7 -7
  270. package/dist/types/onchain/market/pricefeeds/feeds/BoundedPriceFeed.d.ts +15 -0
  271. package/dist/types/onchain/market/pricefeeds/{CompositePriceFeed.d.ts → feeds/CompositePriceFeed.d.ts} +6 -6
  272. package/dist/types/onchain/market/pricefeeds/{ConstantPriceFeed.d.ts → feeds/ConstantPriceFeed.d.ts} +6 -6
  273. package/dist/types/onchain/market/pricefeeds/feeds/CurveCryptoPriceFeed.d.ts +12 -0
  274. package/dist/types/onchain/market/pricefeeds/feeds/CurveStablePriceFeed.d.ts +12 -0
  275. package/dist/types/onchain/market/pricefeeds/feeds/CurveUSDPriceFeed.d.ts +12 -0
  276. package/dist/types/onchain/market/pricefeeds/feeds/Erc4626PriceFeed.d.ts +12 -0
  277. package/dist/types/onchain/market/pricefeeds/feeds/ExternalPriceFeed.d.ts +11 -0
  278. package/dist/types/onchain/market/pricefeeds/feeds/MellowLRTPriceFeed.d.ts +12 -0
  279. package/dist/types/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.d.ts → feeds/PendleTWAPPTPriceFeed.d.ts} +3 -3
  280. package/dist/types/onchain/market/pricefeeds/{PythPriceFeed.d.ts → feeds/PythPriceFeed.d.ts} +3 -3
  281. package/dist/types/onchain/market/pricefeeds/{RedstonePriceFeed.d.ts → feeds/RedstonePriceFeed.d.ts} +9 -9
  282. package/dist/types/onchain/market/pricefeeds/feeds/WstETHPriceFeed.d.ts +12 -0
  283. package/dist/types/onchain/market/pricefeeds/feeds/YearnPriceFeed.d.ts +12 -0
  284. package/dist/types/onchain/market/pricefeeds/feeds/ZeroPriceFeed.d.ts +11 -0
  285. package/dist/types/onchain/market/pricefeeds/feeds/index.d.ts +18 -0
  286. package/dist/types/onchain/market/pricefeeds/index.d.ts +28 -22
  287. package/dist/types/onchain/market/pricefeeds/types.d.ts +1 -31
  288. package/dist/types/onchain/market/pricefeeds/updates/RedstoneUpdater.d.ts +1 -1
  289. package/dist/types/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.d.ts +106 -0
  290. package/dist/types/onchain/market/pricefeeds/updates/getRawPriceUpdates.d.ts +6 -0
  291. package/dist/types/onchain/market/pricefeeds/updates/index.d.ts +7 -3
  292. package/dist/types/onchain/market/pricefeeds/updates/isUpdatablePriceFeed.d.ts +6 -0
  293. package/dist/types/onchain/market/pricefeeds/updates/types.d.ts +56 -2
  294. package/dist/types/onchain/market/pricefeeds/updates/updatableDependencies.d.ts +10 -0
  295. package/dist/types/onchain/market/rwa/RWARegistry.d.ts +2 -1
  296. package/dist/types/onchain/market/rwa/index.d.ts +3 -3
  297. package/dist/types/onchain/market/rwa/midas/MidasDegenNFT.d.ts +19 -4
  298. package/dist/types/onchain/market/rwa/securitize/SecuritizeDegenNFT.d.ts +24 -4
  299. package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +2 -14
  300. package/dist/types/onchain/market/rwa/types.d.ts +39 -37
  301. package/dist/types/onchain/opportunities/MultichainOpportunitiesService.d.ts +5 -1
  302. package/dist/types/onchain/opportunities/OpportunitiesService.d.ts +10 -3
  303. package/dist/types/onchain/opportunities/types.d.ts +6 -1
  304. package/dist/types/onchain/pools/PoolService.d.ts +5 -0
  305. package/dist/types/onchain/pools/types.d.ts +9 -2
  306. package/dist/types/onchain/preview/index.d.ts +2 -1
  307. package/dist/types/onchain/preview/preview/index.d.ts +2 -1
  308. package/dist/types/onchain/preview/preview/midasGreenlistsAccount.d.ts +13 -0
  309. package/dist/types/onchain/preview/preview/previewOpenStrategyPosition.d.ts +5 -3
  310. package/dist/types/onchain/preview/preview/replayMulticall.d.ts +8 -7
  311. package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +5 -4
  312. package/dist/types/onchain/validation/bundles/{checkDraw.d.ts → checkIncreaseDebt.d.ts} +7 -7
  313. package/dist/types/onchain/validation/bundles/{checkQuotasAsked.d.ts → checkIncreaseQuota.d.ts} +3 -3
  314. package/dist/types/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts +22 -0
  315. package/dist/types/onchain/validation/bundles/checkPoolOperation.d.ts +1 -7
  316. package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +2 -2
  317. package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +9 -7
  318. package/dist/types/onchain/validation/bundles/index.d.ts +5 -4
  319. package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +1 -1
  320. package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +2 -2
  321. package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +1 -8
  322. package/dist/types/onchain/validation/checks/checkReservePriceLimited.d.ts +31 -0
  323. package/dist/types/onchain/validation/checks/index.d.ts +2 -1
  324. package/dist/types/onchain/validation/index.d.ts +6 -4
  325. package/dist/types/onchain/validation/raise.d.ts +2 -2
  326. package/dist/types/sdk/execute/index.d.ts +2 -2
  327. package/dist/types/sdk/execute/types.d.ts +48 -6
  328. package/dist/types/sdk/index.d.ts +5 -4
  329. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +5 -1
  330. package/dist/types/sdk/opportunities/types.d.ts +9 -3
  331. package/dist/types/sdk/prepare/PrepareApi.d.ts +16 -4
  332. package/dist/types/sdk/prepare/index.d.ts +4 -3
  333. package/dist/types/sdk/prepare/types.d.ts +200 -66
  334. package/package.json +1 -1
  335. package/dist/cjs/onchain/accounts/utils/midasUtils.js +0 -70
  336. package/dist/cjs/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -301
  337. package/dist/cjs/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -61
  338. package/dist/cjs/plugins/degen-distributors/index.js +0 -4
  339. package/dist/cjs/plugins/degen-distributors/package.json +0 -1
  340. package/dist/cjs/plugins/degen-distributors/types.js +0 -1
  341. package/dist/cjs/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -114
  342. package/dist/cjs/plugins/delayed-withdrawal/index.js +0 -4
  343. package/dist/cjs/plugins/delayed-withdrawal/package.json +0 -1
  344. package/dist/cjs/plugins/delayed-withdrawal/types.js +0 -1
  345. package/dist/esm/onchain/accounts/utils/midasUtils.js +0 -69
  346. package/dist/esm/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -300
  347. package/dist/esm/onchain/validation/bundles/checkDraw.js +0 -27
  348. package/dist/esm/plugins/degen-distributors/DegenDistributorsPlugin.js +0 -60
  349. package/dist/esm/plugins/degen-distributors/index.js +0 -3
  350. package/dist/esm/plugins/degen-distributors/package.json +0 -1
  351. package/dist/esm/plugins/degen-distributors/types.js +0 -1
  352. package/dist/esm/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.js +0 -113
  353. package/dist/esm/plugins/delayed-withdrawal/index.js +0 -3
  354. package/dist/esm/plugins/delayed-withdrawal/package.json +0 -1
  355. package/dist/esm/plugins/delayed-withdrawal/types.js +0 -1
  356. package/dist/types/onchain/accounts/utils/midasUtils.d.ts +0 -38
  357. package/dist/types/onchain/market/pricefeeds/BalancerStablePriceFeed.d.ts +0 -12
  358. package/dist/types/onchain/market/pricefeeds/BoundedPriceFeed.d.ts +0 -15
  359. package/dist/types/onchain/market/pricefeeds/CurveCryptoPriceFeed.d.ts +0 -12
  360. package/dist/types/onchain/market/pricefeeds/CurveStablePriceFeed.d.ts +0 -12
  361. package/dist/types/onchain/market/pricefeeds/CurveUSDPriceFeed.d.ts +0 -12
  362. package/dist/types/onchain/market/pricefeeds/Erc4626PriceFeed.d.ts +0 -12
  363. package/dist/types/onchain/market/pricefeeds/ExternalPriceFeed.d.ts +0 -11
  364. package/dist/types/onchain/market/pricefeeds/MellowLRTPriceFeed.d.ts +0 -12
  365. package/dist/types/onchain/market/pricefeeds/PriceFeedsRegister.d.ts +0 -180
  366. package/dist/types/onchain/market/pricefeeds/WstETHPriceFeed.d.ts +0 -12
  367. package/dist/types/onchain/market/pricefeeds/YearnPriceFeed.d.ts +0 -12
  368. package/dist/types/onchain/market/pricefeeds/ZeroPriceFeed.d.ts +0 -11
  369. package/dist/types/onchain/market/pricefeeds/getRawPriceUpdates.d.ts +0 -5
  370. package/dist/types/onchain/market/pricefeeds/isUpdatablePriceFeed.d.ts +0 -5
  371. package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +0 -25
  372. package/dist/types/plugins/degen-distributors/index.d.ts +0 -3
  373. package/dist/types/plugins/degen-distributors/types.d.ts +0 -8
  374. package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +0 -25
  375. package/dist/types/plugins/delayed-withdrawal/index.d.ts +0 -3
  376. package/dist/types/plugins/delayed-withdrawal/types.d.ts +0 -10
@@ -37,12 +37,18 @@ var MultichainOpportunitiesService = class extends MultichainConstruct {
37
37
  *
38
38
  * See {@link MultichainOpportunitiesService.getPool}.
39
39
  **/
40
- async getStrategy(key, wallet) {
40
+ async getStrategy(key) {
41
41
  return this.queryChain({
42
42
  network: key.chainId,
43
- run: (sdk) => sdk.opportunities.getStrategy(key, wallet)
43
+ run: (sdk) => sdk.opportunities.getStrategy(key)
44
44
  });
45
45
  }
46
+ /**
47
+ * {@inheritDoc OpportunitiesService.isEligibleForStrategy}
48
+ **/
49
+ async isEligibleForStrategy(key, wallet) {
50
+ return this.sdk.chain(key.chainId).opportunities.isEligibleForStrategy(key, wallet);
51
+ }
46
52
  };
47
53
  //#endregion
48
54
  export { MultichainOpportunitiesService };
@@ -36,22 +36,34 @@ var OpportunitiesService = class extends SDKConstruct {
36
36
  * A single strategy opportunity plus the rate curve of the pool it borrows
37
37
  * from and the price feeds its liquidation price depends on.
38
38
  *
39
- * @param wallet - When given, `kyc` says whether this wallet must register
40
- * with the strategy's KYC provider first; `null` otherwise.
39
+ * `kyc` is the strategy's KYC gate, independent of any wallet.
41
40
  *
42
41
  * @throws If the credit manager is unknown, or does not currently offer a
43
42
  * strategy.
44
43
  **/
45
- async getStrategy(key, wallet) {
44
+ async getStrategy(key) {
46
45
  const suite = this.sdk.marketRegister.findCreditManager(key.creditManager);
47
46
  const detail = suite.strategyOpportunityDetail();
48
47
  if (!detail) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
49
- const kyc = wallet ? await suite.kycRequirement(wallet, detail.targetCollateral.address) : null;
48
+ const kyc = await suite.kycRequirement(detail.targetCollateral.address);
50
49
  return {
51
50
  ...detail,
52
51
  kyc
53
52
  };
54
53
  }
54
+ /**
55
+ * Whether `wallet` may open this strategy today: `true` when it is not
56
+ * KYC-gated or the wallet already passed the gate.
57
+ *
58
+ * @throws If the credit manager is unknown, or does not currently offer a
59
+ * strategy.
60
+ **/
61
+ async isEligibleForStrategy(key, wallet) {
62
+ const suite = this.sdk.marketRegister.findCreditManager(key.creditManager);
63
+ const opportunity = suite.strategyOpportunity();
64
+ if (!opportunity) throw new Error(`credit manager ${key.creditManager} does not currently offer a strategy`);
65
+ return suite.isEligibleForStrategy(wallet, opportunity.targetCollateral.address);
66
+ }
55
67
  };
56
68
  //#endregion
57
69
  export { OpportunitiesService };
@@ -154,7 +154,7 @@ var PoolService = class extends SDKConstruct {
154
154
  tokenIn: toTokenAmount(tokenIn, pool.pool.underlyingToShares(amount * PERCENTAGE_FACTOR / (PERCENTAGE_FACTOR - pool.pool.withdrawFee), true)),
155
155
  tokenOut: toTokenAmount(tokenOut, amount),
156
156
  zapper: zapper?.baseParams.addr,
157
- availableLiquidity: this.#withdrawableLiquidity(market)
157
+ availableLiquidity: this.withdrawableLiquidity(poolAddr)
158
158
  };
159
159
  }
160
160
  /**
@@ -176,7 +176,7 @@ var PoolService = class extends SDKConstruct {
176
176
  tokenIn: toTokenAmount(tokenIn, amount),
177
177
  tokenOut: toTokenAmount(tokenOut, pool.pool.sharesToUnderlying(amount) * (PERCENTAGE_FACTOR - pool.pool.withdrawFee) / PERCENTAGE_FACTOR),
178
178
  zapper: zapper?.baseParams.addr,
179
- availableLiquidity: this.#withdrawableLiquidity(market)
179
+ availableLiquidity: this.withdrawableLiquidity(poolAddr)
180
180
  };
181
181
  }
182
182
  /**
@@ -405,12 +405,11 @@ var PoolService = class extends SDKConstruct {
405
405
  };
406
406
  }
407
407
  /**
408
- * The most the pool can actually hand over right now, trimmed slightly so a
409
- * withdrawal sized against it does not fail on rounding.
410
- **/
411
- #withdrawableLiquidity(market) {
412
- const { pool } = market;
413
- return market.priceOracle.toAmount(pool.underlying, pool.pool.availableLiquidity * 99999n / 100000n);
408
+ * {@inheritDoc IPoolsService.withdrawableLiquidity}
409
+ */
410
+ withdrawableLiquidity(pool) {
411
+ const market = this.sdk.marketRegister.findByPool(pool);
412
+ return market.priceOracle.toAmount(market.pool.underlying, market.pool.pool.availableLiquidity * 99999n / 100000n);
414
413
  }
415
414
  };
416
415
  //#endregion
@@ -35,7 +35,7 @@ function calcHealthFactor(props) {
35
35
  const scale = 10n ** BigInt(decimalsByToken.get(token) ?? 18);
36
36
  return amount * price / scale;
37
37
  };
38
- const assetMoney = snapshot.assets.reduce((acc, { token, balance }) => {
38
+ const assetValue = snapshot.assets.reduce((acc, { token, balance }) => {
39
39
  if (balance <= 10n) return acc;
40
40
  const lt = BigInt(lts.get(token) ?? 0);
41
41
  const tokenLtWeighted = (convertToUSD(token, balance, true) ?? 0n) * lt;
@@ -44,8 +44,8 @@ function calcHealthFactor(props) {
44
44
  const quotaWeighted = (convertToUSD(underlying, quotaBalance) ?? 0n) * PERCENTAGE_FACTOR;
45
45
  return acc + (quota ? BigIntMath.min(quotaWeighted, tokenLtWeighted) : tokenLtWeighted);
46
46
  }, 0n);
47
- const borrowedMoney = convertToUSD(underlying, snapshot.totalDebt) ?? 0n;
48
- const hf = borrowedMoney > 0n ? assetMoney / borrowedMoney : 0n;
47
+ const borrowedValue = convertToUSD(underlying, snapshot.totalDebt) ?? 0n;
48
+ const hf = borrowedValue > 0n ? assetValue / borrowedValue : 0n;
49
49
  return Number(hf);
50
50
  }
51
51
  //#endregion
@@ -11,10 +11,11 @@ import { classifyCloseOrRepay, isCloseOrRepay } from "./preview/detectCloseOrRep
11
11
  import { detectDelayedClaim, resolveDelayedClaimIntent } from "./preview/detectDelayedClaim.js";
12
12
  import { detectDelayedOperation } from "./preview/detectDelayedOperation.js";
13
13
  import { estimateClaimableAt } from "./preview/estimateClaimableAt.js";
14
+ import { midasGreenlistsAccount } from "./preview/midasGreenlistsAccount.js";
14
15
  import { previewAdjustStrategyPosition } from "./preview/previewAdjustStrategyPosition.js";
15
16
  import { previewExitOrRepayStrategyPosition } from "./preview/previewExitOrRepayStrategyPosition.js";
16
17
  import { makeReplayState, replayInnerOperations } from "./preview/replayInnerOperations.js";
17
18
  import { replayMulticall } from "./preview/replayMulticall.js";
18
19
  import { previewOperation } from "./preview/previewOperation.js";
19
20
  import "./preview/index.js";
20
- export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
21
+ export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, classifyInnerOperations, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, isPoolOperation, isRWAOperation, makeReplayState, midasGreenlistsAccount, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parseRWAFactoryOperationCalldata, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -1,7 +1,7 @@
1
1
  import { hexEq } from "../../utils/hex.js";
2
2
  import { AbstractAdapterContract } from "../../market/adapters/contracts/AbstractAdapter.js";
3
3
  import { CreditFacadeV310Contract } from "../../market/credit/CreditFacadeV310Contract.js";
4
- import { RWA_FACTORY_SECURITIZE } from "../../../model/rwa.js";
4
+ import "../../../model/rwa.js";
5
5
  import "../../../model/index.js";
6
6
  import { isRWAFactory } from "../../market/rwa/types.js";
7
7
  import { classifyInnerOperations } from "./classifyInnerOperations.js";
@@ -32,7 +32,7 @@ function parseSecuritizeOperationCalldata(sdk, factory, calldata) {
32
32
  const { rawArgs } = parsed;
33
33
  const innerCalls = rawArgs.calls ?? [];
34
34
  const args = {
35
- type: RWA_FACTORY_SECURITIZE,
35
+ protocol: "securitize",
36
36
  tokensToRegister: [...rawArgs.tokensToRegister ?? []],
37
37
  signaturesToCache: [...rawArgs.signaturesToCache ?? []]
38
38
  };
@@ -4,9 +4,10 @@ import { classifyCloseOrRepay, isCloseOrRepay } from "./detectCloseOrRepay.js";
4
4
  import { detectDelayedClaim, resolveDelayedClaimIntent } from "./detectDelayedClaim.js";
5
5
  import { detectDelayedOperation } from "./detectDelayedOperation.js";
6
6
  import { estimateClaimableAt } from "./estimateClaimableAt.js";
7
+ import { midasGreenlistsAccount } from "./midasGreenlistsAccount.js";
7
8
  import { previewAdjustStrategyPosition } from "./previewAdjustStrategyPosition.js";
8
9
  import { previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategyPosition.js";
9
10
  import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
10
11
  import { replayMulticall } from "./replayMulticall.js";
11
12
  import { previewOperation } from "./previewOperation.js";
12
- export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
13
+ export { CreditAccountState, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, midasGreenlistsAccount, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
@@ -0,0 +1,16 @@
1
+ import { MidasGatewayAdapterContract } from "../../market/adapters/contracts/MidasGatewayAdapterContract.js";
2
+ //#region src/onchain/preview/preview/midasGreenlistsAccount.ts
3
+ /**
4
+ * Whether the multicall grants the Midas greenlisted role to the credit
5
+ * account via `receiveGreenlist()`.
6
+ */
7
+ function midasGreenlistsAccount(sdk, multicall) {
8
+ for (const op of multicall) {
9
+ if (op.operation !== "Execute") continue;
10
+ const adapter = sdk.getContract(op.adapter);
11
+ if (adapter instanceof MidasGatewayAdapterContract && adapter.isReceiveGreenlist(op.calldata)) return true;
12
+ }
13
+ return false;
14
+ }
15
+ //#endregion
16
+ export { midasGreenlistsAccount };
@@ -1,26 +1,24 @@
1
1
  import { AP_WETH_TOKEN } from "../../constants/address-provider.js";
2
2
  import { asEstimated } from "../../../model/previews.js";
3
- import { sdkErr, sdkOk } from "../../../model/result.js";
3
+ import { sdkOk } from "../../../model/result.js";
4
4
  import "../../../model/index.js";
5
- import { CreditAccountState } from "./CreditAccountState.js";
5
+ import { midasGreenlistsAccount } from "./midasGreenlistsAccount.js";
6
6
  import { unwrapNativeCollateral } from "./unwrapNativeCollateral.js";
7
- import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
8
7
  //#region src/onchain/preview/preview/previewOpenStrategyPosition.ts
9
- function previewOpenStrategyPosition(sdk, input, operation) {
8
+ function previewOpenStrategyPosition(sdk, input, operation, replay) {
10
9
  const { value = 0n } = input;
11
10
  const market = sdk.marketRegister.findByCreditManager(operation.creditManager);
12
11
  const oracle = market.priceOracle;
13
- const state = makeReplayState(CreditAccountState.beforeOpen(operation.creditManager, market.underlying));
14
- const replayError = replayInnerOperations(sdk, operation.multicall, state);
15
- if (replayError) return sdkErr(replayError);
16
- const account = state.account;
12
+ const { before, after } = replay;
13
+ const account = after.account;
17
14
  let warning;
18
- const netValue = state.collateralAdded.sum((token, balance) => {
15
+ const price = (token, balance) => {
19
16
  const priced = oracle.safeConvert(token, market.underlying, balance);
20
17
  warning ??= priced.error;
21
18
  return priced.value;
22
- });
23
- const unwrapped = unwrapNativeCollateral(state.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
19
+ };
20
+ const netValue = before.balances.sum(price) + after.collateralAdded.sum(price) - after.collateralWithdrawn.sum(price);
21
+ const unwrapped = unwrapNativeCollateral(after.collateralAdded.toAssets(), value, sdk.addressProvider.getAddress(AP_WETH_TOKEN, 0));
24
22
  if (!unwrapped.ok) return unwrapped;
25
23
  const collateral = unwrapped.data;
26
24
  const snap = account.toSnapshot(netValue + account.totalDebt);
@@ -29,16 +27,15 @@ function previewOpenStrategyPosition(sdk, input, operation) {
29
27
  ...asEstimated(sdk.positions.projection(snap, { availableLiquidityChange: -account.totalDebt })),
30
28
  targetCollateral: targetAsset ? oracle.toTokenAmount(targetAsset.token, targetAsset.balance) : void 0,
31
29
  collateralAdded: collateral.map((a) => oracle.toTokenAmount(a.token, a.balance)),
30
+ collateralWithdrawn: after.collateralWithdrawn.toAssets().map((a) => oracle.toTokenAmount(a.token, a.balance)),
32
31
  warning
33
32
  };
34
- if (operation.operation === "RWAOpenCreditAccount") return sdkOk({
35
- ...projection,
36
- operation: "RWAOpenCreditAccount",
37
- rwaArgs: operation.args
38
- });
39
33
  return sdkOk({
40
34
  ...projection,
41
- operation: "OpenCreditAccount"
35
+ operation: "OpenCreditAccount",
36
+ ...operation.operation === "MultiCall" || operation.operation === "BotMulticall" || operation.operation === "RWAMulticall" ? { creditAccount: operation.creditAccount } : {},
37
+ ..."args" in operation ? { rwaArgs: operation.args } : {},
38
+ midasGreenlistsAccount: midasGreenlistsAccount(sdk, operation.multicall)
42
39
  });
43
40
  }
44
41
  /**
@@ -33,9 +33,13 @@ async function previewOperation(sdk, input, options, creditAccount) {
33
33
  if (!parsed.ok) return parsed;
34
34
  const operation = parsed.data;
35
35
  if (isPoolOperation(operation)) return previewPoolPositionOperation(sdk, operation, options);
36
- if (operation.operation === "OpenCreditAccount" || operation.operation === "RWAOpenCreditAccount") return previewOpenStrategyPosition(sdk, input, operation);
36
+ if (operation.operation === "OpenCreditAccount" || operation.operation === "RWAOpenCreditAccount") {
37
+ const replayed = replayMulticall(sdk, operation);
38
+ if (!replayed.ok) return replayed;
39
+ return previewOpenStrategyPosition(sdk, input, operation, replayed.data);
40
+ }
37
41
  if (operation.operation === "CloseCreditAccount") {
38
- const resolved = await resolveCreditAccount(sdk, operation, options, creditAccount);
42
+ const resolved = await resolveCreditAccount(sdk, operation.creditAccount, options, creditAccount);
39
43
  if (!resolved.ok) return resolved;
40
44
  const replayed = replayMulticall(sdk, operation, resolved.data);
41
45
  if (!replayed.ok) return replayed;
@@ -47,7 +51,7 @@ async function previewOperation(sdk, input, options, creditAccount) {
47
51
  return preview;
48
52
  }
49
53
  if (operation.operation === "MultiCall" || operation.operation === "BotMulticall" || operation.operation === "RWAMulticall") {
50
- const resolved = await resolveCreditAccount(sdk, operation, options, creditAccount);
54
+ const resolved = await resolveCreditAccount(sdk, operation.creditAccount, options, creditAccount);
51
55
  if (!resolved.ok) return resolved;
52
56
  const replayed = replayMulticall(sdk, operation, resolved.data);
53
57
  if (!replayed.ok) return replayed;
@@ -64,20 +68,24 @@ async function previewOperation(sdk, input, options, creditAccount) {
64
68
  * injected state when present, otherwise fetches it from the credit account
65
69
  * compressor.
66
70
  */
67
- async function resolveCreditAccount(sdk, operation, options, creditAccount) {
68
- let resolved = creditAccount;
69
- if (!resolved) resolved = await sdk.accounts.getCreditAccountData(operation.creditAccount, options?.blockNumber);
70
- if (!resolved) return sdkErr(creditAccountNotFound(operation.creditAccount));
71
+ async function resolveCreditAccount(sdk, address, options, data) {
72
+ let resolved = data;
73
+ if (!resolved) resolved = await sdk.accounts.getCreditAccountData(address, options?.blockNumber);
74
+ if (!resolved) return sdkErr(creditAccountNotFound(address));
71
75
  return sdkOk(resolved);
72
76
  }
73
77
  /**
74
78
  * Previews a plain/bot/RWA multicall: classifies the instant preview
75
- * (zero-debt closure/repay vs adjustment) and, when the multicall requests a
76
- * delayed withdrawal, wraps the instant preview into a
77
- * `DelayedCreditAccountOperation` together with the best-effort preview of
78
- * the state after the withdrawal is claimed.
79
+ * (reopening a zero-debt account, zero-debt closure/repay, or adjustment)
80
+ * and, when the multicall requests a delayed withdrawal, wraps the instant
81
+ * preview into a `DelayedCreditAccountOperation` together with the
82
+ * best-effort preview of the state after the withdrawal is claimed.
83
+ *
84
+ * A reopening is reported as `OpenCreditAccount` and never as a delayed
85
+ * withdrawal: an opening requests no redemption.
79
86
  */
80
87
  async function previewMulticallOperation(sdk, input, operation, replay, blockNumber) {
88
+ if (replay.before.totalDebt === 0n && replay.before.quotas.toAssets(0n).length === 0 && replay.after.account.totalDebt > 0n) return previewOpenStrategyPosition(sdk, input, operation, replay);
81
89
  let instantPreview;
82
90
  if (isCloseOrRepay(operation.multicall)) {
83
91
  const instant = previewExitOrRepayStrategyPosition(sdk, input, operation, false, replay);
@@ -4,11 +4,12 @@ import { CreditAccountState } from "./CreditAccountState.js";
4
4
  import { makeReplayState, replayInnerOperations } from "./replayInnerOperations.js";
5
5
  //#region src/onchain/preview/preview/replayMulticall.ts
6
6
  /**
7
- * Replays the operation's multicall over the account's pre-resolved
8
- * pre-state via {@link replayInnerOperations}.
7
+ * Replays the operation's multicall via {@link replayInnerOperations}.
8
+ * When `creditAccount` is omitted, the seed is
9
+ * {@link CreditAccountState.beforeOpen} (a fresh opening).
9
10
  */
10
11
  function replayMulticall(sdk, operation, creditAccount) {
11
- const before = CreditAccountState.fromCreditAccountData(creditAccount);
12
+ const before = creditAccount ? CreditAccountState.fromCreditAccountData(creditAccount) : CreditAccountState.beforeOpen(operation.creditManager, sdk.marketRegister.findByCreditManager(operation.creditManager).underlying);
12
13
  const after = makeReplayState(before.clone());
13
14
  const error = replayInnerOperations(sdk, operation.multicall, after);
14
15
  if (error) return sdkErr(error);
@@ -22,13 +22,13 @@ async function checkCollateralFunding(input) {
22
22
  if (held.size === 0) return [];
23
23
  let spender;
24
24
  try {
25
- if (preview.operation === "OpenCreditAccount" || preview.operation === "RWAOpenCreditAccount") spender = await sdk.accounts.getApprovalAddress({
25
+ if (preview.creditAccount) spender = await sdk.accounts.getApprovalAddress({
26
26
  creditManager: preview.creditManager,
27
- borrower: sender
27
+ creditAccount: preview.creditAccount
28
28
  });
29
29
  else spender = await sdk.accounts.getApprovalAddress({
30
30
  creditManager: preview.creditManager,
31
- creditAccount: preview.creditAccount
31
+ borrower: sender
32
32
  });
33
33
  } catch (cause) {
34
34
  return [unexpectedFailure(cause, "resolve the approval address")];
@@ -4,11 +4,11 @@ import { checkDebtLimits } from "../checks/checkDebtLimits.js";
4
4
  import "../checks/index.js";
5
5
  import { checkAccountQuotas } from "./checkAccountQuotas.js";
6
6
  import { checkCollateralFunding } from "./checkCollateralFunding.js";
7
- import { checkDraw } from "./checkDraw.js";
8
7
  import { checkHealthFactors } from "./checkHealthFactors.js";
8
+ import { checkIncreaseDebt } from "./checkIncreaseDebt.js";
9
+ import { checkIncreaseQuota } from "./checkIncreaseQuota.js";
9
10
  import { checkMarket } from "./checkMarket.js";
10
11
  import { checkObtained } from "./checkObtained.js";
11
- import { checkQuotasAsked } from "./checkQuotasAsked.js";
12
12
  import { checkRWAOpening } from "./checkRWAOpening.js";
13
13
  //#region src/onchain/validation/bundles/checkCreditOperation.ts
14
14
  /**
@@ -16,15 +16,17 @@ import { checkRWAOpening } from "./checkRWAOpening.js";
16
16
  * has to hold, approve or sign.
17
17
  *
18
18
  * The array is in check order, most fundamental first: the market's own state,
19
- * then what the facade would revert on, then what the operation asks the
20
- * market for, then the account it leaves behind, and last the wallet's side.
19
+ * then what the facade would revert on, then what the operation borrows and the
20
+ * quota it increases, then the account it leaves behind, and last the wallet's
21
+ * side.
21
22
  */
22
23
  async function checkCreditOperation(args) {
23
24
  const { sdk, preview, sender, blockNumber, ...thresholds } = args;
24
25
  const suite = sdk.marketRegister.findCreditManager(preview.creditManager);
25
26
  const market = suite.market;
26
27
  const underlying = toToken(sdk, market.pool.underlying);
27
- const isOpening = preview.operation === "OpenCreditAccount" || preview.operation === "RWAOpenCreditAccount";
28
+ const isOpening = preview.operation === "OpenCreditAccount";
29
+ const isEmptyOpening = preview.operation === "OpenCreditAccount" && preview.totalDebt.value === 0n && preview.collateralAdded.length === 0 && preview.quotas.length === 0;
28
30
  const protocol = [
29
31
  ...checkMarket(suite),
30
32
  ...checkDebtLimits({
@@ -32,13 +34,13 @@ async function checkCreditOperation(args) {
32
34
  minDebt: suite.creditFacade.minDebt,
33
35
  maxDebt: suite.creditFacade.maxDebt,
34
36
  underlying,
35
- allowZero: !isOpening,
37
+ allowZero: !isOpening || isEmptyOpening,
36
38
  maxBorrowAmount: suite.maxBorrowAmount()
37
39
  }),
38
- ...checkDraw(suite, preview, underlying),
40
+ ...checkIncreaseDebt(suite, preview, underlying),
39
41
  ...checkObtained(suite, preview),
40
42
  ...checkAccountQuotas(suite, preview),
41
- ...checkQuotasAsked(market, preview, underlying),
43
+ ...checkIncreaseQuota(market, preview, underlying),
42
44
  ...checkHealthFactors({
43
45
  totalDebt: preview.totalDebt,
44
46
  healthFactor: preview.estHealthFactor,
@@ -50,7 +52,7 @@ async function checkCreditOperation(args) {
50
52
  preview,
51
53
  sender,
52
54
  blockNumber
53
- }), preview.operation === "RWAOpenCreditAccount" ? checkRWAOpening({
55
+ }), isOpening ? checkRWAOpening({
54
56
  sdk,
55
57
  preview,
56
58
  sender
@@ -0,0 +1,27 @@
1
+ import { checkBorrowLimit } from "../checks/checkBorrowLimit.js";
2
+ import "../checks/index.js";
3
+ //#region src/onchain/validation/bundles/checkIncreaseDebt.ts
4
+ /**
5
+ * What the transaction borrows, against what the market can lend right now.
6
+ *
7
+ * Only a debt increase is weighed: repaying, or leaving the debt alone, can
8
+ * never exceed the borrow limit. Opening borrows the whole debt; adjusting
9
+ * borrows `totalDebtChange`.
10
+ *
11
+ * The engine holds every simulation to this already (`assertCanBorrow`), so
12
+ * this is here for the transactions it never saw — a pasted calldata reaches
13
+ * the confirm screen with nothing else standing between it and a revert.
14
+ */
15
+ function checkIncreaseDebt(suite, preview, underlying) {
16
+ const debtIncrease = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
17
+ if (debtIncrease <= 0n) return [];
18
+ const maxBorrowAmount = suite.maxBorrowAmount();
19
+ return checkBorrowLimit({
20
+ requested: debtIncrease,
21
+ available: maxBorrowAmount.amount.value,
22
+ limit: maxBorrowAmount.limit,
23
+ underlying
24
+ });
25
+ }
26
+ //#endregion
27
+ export { checkIncreaseDebt };
@@ -1,8 +1,8 @@
1
1
  import { checkQuotaLimit } from "../checks/checkQuotaLimit.js";
2
2
  import "../checks/index.js";
3
- //#region src/onchain/validation/bundles/checkQuotasAsked.ts
3
+ //#region src/onchain/validation/bundles/checkIncreaseQuota.ts
4
4
  /** Every quota the operation raises, against the room the keeper has left. */
5
- function checkQuotasAsked(market, preview, underlying) {
5
+ function checkIncreaseQuota(market, preview, underlying) {
6
6
  const increases = preview.operation === "AdjustCreditAccount" ? preview.quotasChange : preview.quotas;
7
7
  const { pqk } = market.pool;
8
8
  return increases.filter((q) => q.value > 0n).flatMap((q) => {
@@ -16,4 +16,4 @@ function checkQuotasAsked(market, preview, underlying) {
16
16
  });
17
17
  }
18
18
  //#endregion
19
- export { checkQuotasAsked };
19
+ export { checkIncreaseQuota };
@@ -0,0 +1,43 @@
1
+ import { accountNotMidasGreenlisted } from "../../../model/errors/operation-errors.js";
2
+ import { unexpectedFailure } from "../../../model/errors/prepare-errors.js";
3
+ import "../../../model/index.js";
4
+ import { toToken } from "../helpers/token.js";
5
+ import "../helpers/index.js";
6
+ //#region src/onchain/validation/bundles/checkMidasAccountGreenlist.ts
7
+ /**
8
+ * Whether the credit account already holds the Midas greenlisted role
9
+ * this permissioned mToken requires of its holder.
10
+ */
11
+ async function checkMidasAccountGreenlist(input) {
12
+ const { sdk, preview, nft, tokens } = input;
13
+ if (nft.protocol !== "midas") return [];
14
+ if (tokens.length === 0) return [];
15
+ const account = preview.creditAccount;
16
+ if (!account) return tokens.map((token) => accountNotMidasGreenlisted({
17
+ token: toToken(sdk, token),
18
+ creditManager: preview.creditManager
19
+ }));
20
+ return (await Promise.all(tokens.map((token) => checkAccountRole({
21
+ sdk,
22
+ nft,
23
+ account,
24
+ token,
25
+ preview
26
+ })))).flat();
27
+ }
28
+ async function checkAccountRole(input) {
29
+ const { sdk, nft, account, token, preview } = input;
30
+ try {
31
+ const requirements = await nft.getOpenAccountRequirements(account, { tokenOutAddress: token });
32
+ if (nft.isRegistered(requirements)) return [];
33
+ return [accountNotMidasGreenlisted({
34
+ token: toToken(sdk, token),
35
+ creditManager: preview.creditManager,
36
+ creditAccount: account
37
+ })];
38
+ } catch (cause) {
39
+ return [unexpectedFailure(cause, "read the Midas account greenlist")];
40
+ }
41
+ }
42
+ //#endregion
43
+ export { checkMidasAccountGreenlist };
@@ -3,13 +3,7 @@ import { checkPoolPaused } from "../checks/checkPoolPaused.js";
3
3
  import { checkPoolSunset } from "../checks/checkPoolSunset.js";
4
4
  import "../checks/index.js";
5
5
  //#region src/onchain/validation/bundles/checkPoolOperation.ts
6
- /**
7
- * What the pool's own state stops, whichever side of it the wallet is on.
8
- *
9
- * The liquidity read is the market's rather than the trimmed figure a
10
- * simulation carries: a withdrawal sized against that figure has to pass the
11
- * check that follows it.
12
- */
6
+ /** What the pool's own state stops, whichever side of it the wallet is on. */
13
7
  function checkPoolOperation(args) {
14
8
  const { sdk, pool, isDeposit, tokenOut } = args;
15
9
  const market = sdk.marketRegister.findByPool(pool);
@@ -25,7 +19,7 @@ function checkPoolOperation(args) {
25
19
  }),
26
20
  ...isDeposit ? [] : checkPoolLiquidity({
27
21
  requested: tokenOut.value,
28
- available: market.pool.pool.availableLiquidity,
22
+ available: sdk.pools.withdrawableLiquidity(pool).value,
29
23
  underlying: tokenOut.token
30
24
  })
31
25
  ];
@@ -5,24 +5,24 @@ import { toToken } from "../helpers/token.js";
5
5
  import "../helpers/index.js";
6
6
  //#region src/onchain/validation/bundles/checkRWAOpenRequirements.ts
7
7
  /**
8
- * The RWA factory is satisfied that `wallet` may open on `token` with the
8
+ * The degen NFT is satisfied that `wallet` may open on `token` with the
9
9
  * registration args already on the transaction.
10
10
  */
11
11
  async function checkRWAOpenRequirements(input) {
12
12
  const { sdk, wallet, creditManager, token, providedArgs } = input;
13
13
  try {
14
- const requirements = await sdk.accounts.getOpenAccountRequirements(wallet, creditManager, { tokenOutAddress: token });
15
- if (!requirements) return [];
16
- const { rwaFactory } = sdk.marketRegister.findByCreditManager(creditManager);
17
- if (!rwaFactory) throw new Error(`no RWA factory for credit manager ${creditManager}`);
18
- const missing = rwaFactory.getMissingRequirements(requirements, providedArgs);
19
- if (!missing && requirements.securitizeTokensToRegister.length === 0) return [];
14
+ const nft = await sdk.marketRegister.findCreditManager(creditManager).degenNFT();
15
+ if (!nft) return [];
16
+ const requirements = await nft.getOpenAccountRequirements(wallet, { tokenOutAddress: token });
17
+ const missing = nft.getMissingRequirements(requirements, providedArgs);
18
+ if (!missing && nft.isRegistered(requirements)) return [];
20
19
  return [rwaOpenRequirementsNotMet({
21
20
  token: toToken(sdk, token),
22
21
  creditManager,
23
- factory: rwaFactory.address,
22
+ protocol: nft.protocol,
23
+ registrationLink: nft.registrationLink,
24
24
  requirements,
25
- ...missing === void 0 ? {} : { missing }
25
+ missing
26
26
  })];
27
27
  } catch (cause) {
28
28
  return [unexpectedFailure(cause, "read the RWA opening requirements")];
@@ -1,23 +1,33 @@
1
1
  import { AddressSet } from "../../utils/AddressSet.js";
2
+ import { checkMidasAccountGreenlist } from "./checkMidasAccountGreenlist.js";
2
3
  import { checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
3
4
  //#region src/onchain/validation/bundles/checkRWAOpening.ts
4
5
  /**
5
- * Per factory-gated token among `collateralAdded ∪ quotas`, whether the
6
- * borrower still has to register or sign before this opening can land.
6
+ * Per KYC-gated token among `collateralAdded ∪ quotas`, whether the
7
+ * borrower still has to register or sign before this opening can land,
8
+ * and whether a Midas credit account may hold the mToken.
7
9
  */
8
10
  async function checkRWAOpening(input) {
9
11
  const { sdk, preview, sender } = input;
10
- const { rwaFactory } = sdk.marketRegister.findByCreditManager(preview.creditManager);
11
- if (!rwaFactory) return [];
12
- const gated = new AddressSet(rwaFactory.getTokens());
13
- const candidates = new AddressSet([...preview.collateralAdded.map((a) => a.token.address), ...preview.quotas.map((q) => q.token.address)]);
14
- return (await Promise.all([...candidates].filter((token) => gated.has(token)).map((token) => checkRWAOpenRequirements({
12
+ const nft = await sdk.marketRegister.findCreditManager(preview.creditManager).degenNFT();
13
+ if (!nft) return [];
14
+ const nftTokens = new AddressSet(await nft.getTokens());
15
+ let candidates = new AddressSet([...preview.collateralAdded.map((a) => a.token.address), ...preview.quotas.map((q) => q.token.address)]).asArray();
16
+ candidates = candidates.filter((token) => nftTokens.has(token));
17
+ let tokensToCheck = candidates;
18
+ if (tokensToCheck.length === 0 && !preview.creditAccount && nft.protocol === "midas") tokensToCheck = nftTokens.asArray();
19
+ return (await Promise.all([...tokensToCheck.map((token) => checkRWAOpenRequirements({
15
20
  sdk,
16
21
  wallet: sender,
17
22
  creditManager: preview.creditManager,
18
23
  token,
19
24
  providedArgs: preview.rwaArgs
20
- })))).flat();
25
+ })), checkMidasAccountGreenlist({
26
+ sdk,
27
+ preview,
28
+ nft,
29
+ tokens: candidates
30
+ })])).flat();
21
31
  }
22
32
  //#endregion
23
33
  export { checkRWAOpening };
@@ -2,11 +2,12 @@ import { checkAccountQuotas } from "./checkAccountQuotas.js";
2
2
  import { checkWalletAllowance } from "./checkWalletAllowance.js";
3
3
  import { checkWalletBalance } from "./checkWalletBalance.js";
4
4
  import { checkCollateralFunding } from "./checkCollateralFunding.js";
5
- import { checkDraw } from "./checkDraw.js";
6
5
  import { checkHealthFactors } from "./checkHealthFactors.js";
6
+ import { checkIncreaseDebt } from "./checkIncreaseDebt.js";
7
+ import { checkIncreaseQuota } from "./checkIncreaseQuota.js";
7
8
  import { checkMarket } from "./checkMarket.js";
8
9
  import { checkObtained } from "./checkObtained.js";
9
- import { checkQuotasAsked } from "./checkQuotasAsked.js";
10
+ import { checkMidasAccountGreenlist } from "./checkMidasAccountGreenlist.js";
10
11
  import { checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
11
12
  import { checkRWAOpening } from "./checkRWAOpening.js";
12
13
  import { checkCreditOperation } from "./checkCreditOperation.js";
@@ -15,4 +16,4 @@ import { checkLiquidationFunding } from "./checkLiquidationFunding.js";
15
16
  import { checkWallet } from "./checkWallet.js";
16
17
  import { checkPoolFunding } from "./checkPoolFunding.js";
17
18
  import { checkPoolOperation } from "./checkPoolOperation.js";
18
- export { checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkDraw, checkHealthFactors, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotasAsked, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
19
+ export { checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
@@ -42,7 +42,6 @@ async function checkOperation(input, options = {}) {
42
42
  sender
43
43
  }, options);
44
44
  case "OpenCreditAccount":
45
- case "RWAOpenCreditAccount":
46
45
  case "AdjustCreditAccount": return checkCreditOperation({
47
46
  sdk,
48
47
  preview,
@@ -4,7 +4,7 @@ import { amountOf } from "../helpers/amount.js";
4
4
  import "../helpers/index.js";
5
5
  //#region src/onchain/validation/checks/checkBorrowLimit.ts
6
6
  /**
7
- * What the pool will hand over, against what is asked for.
7
+ * What the pool will hand over, against the amount requested.
8
8
  *
9
9
  * `available` and `limit` are the caller's reading of which limit is in the
10
10
  * way; this check only compares. `maxBorrowAmount` is the largest debt still