@gearbox-protocol/sdk 16.1.2 → 16.3.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 (517) hide show
  1. package/dist/cjs/history/assembleOperations.js +3 -3
  2. package/dist/cjs/history/classifyMulticallOperations.js +7 -7
  3. package/dist/cjs/history/index.js +13 -0
  4. package/dist/cjs/history/parseCreditAccountTransaction.js +5 -5
  5. package/dist/cjs/{preview → history}/trace/errors.js +1 -1
  6. package/dist/cjs/{preview → history}/trace/extractAdapterCallTraces.js +1 -1
  7. package/dist/cjs/{preview → history}/trace/extractTransfers.js +3 -3
  8. package/dist/cjs/{preview → history}/trace/findFacadeCalls.js +3 -3
  9. package/dist/cjs/history/trace/index.js +14 -0
  10. package/dist/cjs/model/errors/index.js +37 -0
  11. package/dist/cjs/model/errors/liquidation-errors.js +32 -0
  12. package/dist/cjs/model/errors/operation-errors.js +135 -0
  13. package/dist/cjs/{onchain/market/oracle/errors.js → model/errors/oracle-errors.js} +1 -1
  14. package/dist/cjs/model/errors/prepare-errors.js +108 -0
  15. package/dist/cjs/model/errors/preview-errors.js +12 -0
  16. package/dist/cjs/model/index.js +40 -2
  17. package/dist/cjs/model/positions.js +1 -1
  18. package/dist/cjs/model/result.js +0 -8
  19. package/dist/cjs/model/rwa.js +40 -0
  20. package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  21. package/dist/cjs/onchain/accounts/index.js +0 -2
  22. package/dist/cjs/onchain/accounts/intents/guards.js +42 -66
  23. package/dist/cjs/onchain/accounts/intents/index.js +38 -35
  24. package/dist/cjs/onchain/accounts/intents/leverage-band.js +1 -1
  25. package/dist/cjs/onchain/accounts/intents/math.js +19 -15
  26. package/dist/cjs/onchain/accounts/intents/open-strategy.js +44 -8
  27. package/dist/cjs/onchain/accounts/intents/plan.js +52 -48
  28. package/dist/cjs/onchain/accounts/intents/realize.js +26 -24
  29. package/dist/cjs/onchain/accounts/intents/tail.js +15 -12
  30. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +7 -0
  31. package/dist/cjs/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +6 -6
  32. package/dist/cjs/onchain/accounts/intents/tests/withdraw.fixtures.js +12 -12
  33. package/dist/cjs/onchain/accounts/intents/view.js +1 -1
  34. package/dist/cjs/onchain/accounts/withdrawal-compressor/index.js +0 -1
  35. package/dist/cjs/onchain/index.js +122 -36
  36. package/dist/cjs/onchain/market/MarketSuite.js +7 -1
  37. package/dist/cjs/onchain/market/adapters/index.js +1 -0
  38. package/dist/cjs/onchain/market/credit/CreditSuite.js +47 -15
  39. package/dist/cjs/onchain/market/index.js +0 -6
  40. package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +6 -6
  41. package/dist/cjs/onchain/market/oracle/index.js +0 -2
  42. package/dist/cjs/onchain/market/pool/PoolQuotaKeeperV310Contract.js +8 -0
  43. package/dist/cjs/onchain/market/rwa/RWARegistry.js +3 -2
  44. package/dist/cjs/onchain/market/rwa/index.js +0 -4
  45. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +7 -7
  46. package/dist/cjs/onchain/market/rwa/securitize/constants.js +0 -2
  47. package/dist/cjs/onchain/market/rwa/securitize/index.js +1 -3
  48. package/dist/cjs/onchain/market/rwa/securitize/types.js +0 -29
  49. package/dist/cjs/onchain/market/rwa/types.js +0 -7
  50. package/dist/cjs/onchain/market/zapper/index.js +0 -1
  51. package/dist/cjs/onchain/pools/PoolService.js +10 -16
  52. package/dist/cjs/onchain/preview/index.js +41 -0
  53. package/dist/cjs/{preview → onchain/preview}/parse/classifyInnerOperations.js +2 -3
  54. package/dist/cjs/onchain/preview/parse/index.js +14 -0
  55. package/dist/cjs/{preview → onchain/preview}/parse/parseFacadeOperationCalldata.js +3 -3
  56. package/dist/cjs/{preview → onchain/preview}/parse/parseOperationCalldata.js +16 -17
  57. package/dist/cjs/{preview → onchain/preview}/parse/parsePoolOperationCalldata.js +3 -3
  58. package/dist/cjs/{preview → onchain/preview}/parse/parseRWAFactoryOperationCalldata.js +11 -12
  59. package/dist/cjs/{preview → onchain/preview}/parse/types.js +1 -1
  60. package/dist/cjs/{preview → onchain/preview}/preview/CreditAccountState.js +3 -4
  61. package/dist/cjs/{preview → onchain/preview}/preview/buildDelayedStrategyPositionOperationPreview.js +10 -11
  62. package/dist/cjs/{preview → onchain/preview}/preview/detectCloseOrRepay.js +2 -3
  63. package/dist/cjs/{preview → onchain/preview}/preview/detectDelayedClaim.js +4 -5
  64. package/dist/cjs/{preview → onchain/preview}/preview/detectDelayedOperation.js +5 -6
  65. package/dist/cjs/{preview → onchain/preview}/preview/estimateClaimableAt.js +1 -1
  66. package/dist/cjs/onchain/preview/preview/index.js +26 -0
  67. package/dist/cjs/{preview → onchain/preview}/preview/previewAdjustStrategyPosition.js +18 -22
  68. package/dist/cjs/{preview → onchain/preview}/preview/previewExitOrRepayStrategyPosition.js +22 -28
  69. package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +60 -0
  70. package/dist/cjs/onchain/preview/preview/previewOperation.js +119 -0
  71. package/dist/cjs/{preview/simulate/simulatePoolOperation.js → onchain/preview/preview/previewPoolPositionOperation.js} +46 -32
  72. package/dist/cjs/onchain/preview/preview/replayInnerOperations.js +109 -0
  73. package/dist/cjs/onchain/preview/preview/replayMulticall.js +22 -0
  74. package/dist/cjs/{preview → onchain/preview}/preview/unwrapNativeCollateral.js +11 -14
  75. package/dist/cjs/onchain/validation/bundles/checkAccountQuotas.js +20 -0
  76. package/dist/cjs/onchain/validation/bundles/checkCollateralFunding.js +59 -0
  77. package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +65 -0
  78. package/dist/cjs/onchain/validation/bundles/checkDraw.js +28 -0
  79. package/dist/cjs/onchain/validation/bundles/checkHealthFactors.js +27 -0
  80. package/dist/cjs/onchain/validation/bundles/checkLiquidationEligibility.js +33 -0
  81. package/dist/cjs/onchain/validation/bundles/checkLiquidationFunding.js +29 -0
  82. package/dist/cjs/onchain/validation/bundles/checkMarket.js +24 -0
  83. package/dist/cjs/onchain/validation/bundles/checkObtained.js +13 -0
  84. package/dist/cjs/onchain/validation/bundles/checkPoolFunding.js +22 -0
  85. package/dist/cjs/onchain/validation/bundles/checkPoolOperation.js +35 -0
  86. package/dist/cjs/onchain/validation/bundles/checkQuotasAsked.js +20 -0
  87. package/dist/cjs/onchain/validation/bundles/checkRWAOpenRequirements.js +33 -0
  88. package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +24 -0
  89. package/dist/cjs/onchain/validation/bundles/checkWallet.js +22 -0
  90. package/dist/cjs/onchain/validation/bundles/checkWalletAllowance.js +32 -0
  91. package/dist/cjs/onchain/validation/bundles/checkWalletBalance.js +41 -0
  92. package/dist/cjs/onchain/validation/bundles/index.js +35 -0
  93. package/dist/cjs/onchain/validation/checkLiquidation.js +22 -0
  94. package/dist/cjs/onchain/validation/checkOperation.js +62 -0
  95. package/dist/cjs/onchain/validation/checkSimulation.js +60 -0
  96. package/dist/cjs/onchain/validation/checks/checkBorrowLimit.js +25 -0
  97. package/dist/cjs/onchain/validation/checks/checkCollateralised.js +26 -0
  98. package/dist/cjs/onchain/validation/checks/checkCreditAccountFrozen.js +10 -0
  99. package/dist/cjs/onchain/validation/checks/checkCreditManagerPaused.js +10 -0
  100. package/dist/cjs/onchain/validation/checks/checkDebtLimits.js +18 -0
  101. package/dist/cjs/onchain/validation/checks/checkEmergencyLiquidator.js +13 -0
  102. package/dist/cjs/onchain/validation/checks/checkForbiddenToken.js +10 -0
  103. package/dist/cjs/onchain/validation/checks/checkLeverage.js +13 -0
  104. package/dist/cjs/onchain/validation/checks/checkLiquidatorEligible.js +10 -0
  105. package/dist/cjs/onchain/validation/checks/checkMarketExpired.js +10 -0
  106. package/dist/cjs/onchain/validation/checks/checkPoolLiquidity.js +25 -0
  107. package/dist/cjs/onchain/validation/checks/checkPoolPaused.js +10 -0
  108. package/dist/cjs/onchain/validation/checks/checkPoolSunset.js +10 -0
  109. package/dist/cjs/onchain/validation/checks/checkQuotaCount.js +10 -0
  110. package/dist/cjs/onchain/validation/checks/checkQuotaLimit.js +18 -0
  111. package/dist/cjs/onchain/validation/checks/index.js +31 -0
  112. package/dist/cjs/onchain/validation/helpers/amount.js +12 -0
  113. package/dist/cjs/onchain/validation/helpers/health-factor-limits.js +25 -0
  114. package/dist/cjs/onchain/validation/helpers/index.js +11 -0
  115. package/dist/cjs/onchain/validation/{token.js → helpers/token.js} +4 -4
  116. package/dist/cjs/onchain/validation/index.js +85 -27
  117. package/dist/cjs/onchain/validation/raise.js +33 -0
  118. package/dist/cjs/sdk/execute/ExecuteApi.js +1 -0
  119. package/dist/cjs/sdk/index.js +6 -9
  120. package/dist/cjs/sdk/liquidations/LiquidationsNamespace.js +9 -0
  121. package/dist/cjs/sdk/prepare/PrepareApi.js +55 -48
  122. package/dist/cjs/sdk/prepare/index.js +7 -9
  123. package/dist/cjs/sdk/prepare/types.js +0 -4
  124. package/dist/cjs/sdk/preview/PreviewNamespace.js +24 -13
  125. package/dist/esm/history/assembleOperations.js +2 -2
  126. package/dist/esm/history/classifyMulticallOperations.js +2 -2
  127. package/dist/esm/history/index.js +6 -1
  128. package/dist/esm/history/parseCreditAccountTransaction.js +3 -3
  129. package/dist/esm/{preview → history}/trace/errors.js +1 -1
  130. package/dist/esm/{preview → history}/trace/extractAdapterCallTraces.js +1 -1
  131. package/dist/esm/{preview → history}/trace/extractTransfers.js +1 -1
  132. package/dist/esm/{preview → history}/trace/findFacadeCalls.js +1 -1
  133. package/dist/esm/model/errors/index.js +7 -0
  134. package/dist/esm/model/errors/liquidation-errors.js +29 -0
  135. package/dist/esm/model/errors/operation-errors.js +121 -0
  136. package/dist/esm/{onchain/market/oracle/errors.js → model/errors/oracle-errors.js} +1 -1
  137. package/dist/esm/model/errors/prepare-errors.js +97 -0
  138. package/dist/esm/model/errors/preview-errors.js +11 -0
  139. package/dist/esm/model/index.js +9 -3
  140. package/dist/esm/model/positions.js +1 -1
  141. package/dist/esm/model/result.js +1 -8
  142. package/dist/esm/model/rwa.js +37 -0
  143. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  144. package/dist/esm/onchain/accounts/index.js +1 -2
  145. package/dist/esm/onchain/accounts/intents/guards.js +29 -52
  146. package/dist/esm/onchain/accounts/intents/index.js +39 -35
  147. package/dist/esm/onchain/accounts/intents/leverage-band.js +1 -1
  148. package/dist/esm/onchain/accounts/intents/math.js +18 -14
  149. package/dist/esm/onchain/accounts/intents/open-strategy.js +46 -10
  150. package/dist/esm/onchain/accounts/intents/plan.js +51 -47
  151. package/dist/esm/onchain/accounts/intents/realize.js +26 -24
  152. package/dist/esm/onchain/accounts/intents/tail.js +14 -11
  153. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +7 -0
  154. package/dist/esm/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +6 -6
  155. package/dist/esm/onchain/accounts/intents/tests/withdraw.fixtures.js +12 -12
  156. package/dist/esm/onchain/accounts/intents/view.js +1 -1
  157. package/dist/esm/onchain/accounts/withdrawal-compressor/index.js +0 -1
  158. package/dist/esm/onchain/index.js +61 -10
  159. package/dist/esm/onchain/market/MarketSuite.js +7 -1
  160. package/dist/esm/onchain/market/adapters/index.js +1 -0
  161. package/dist/esm/onchain/market/credit/CreditSuite.js +47 -15
  162. package/dist/esm/onchain/market/index.js +3 -5
  163. package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
  164. package/dist/esm/onchain/market/oracle/index.js +1 -2
  165. package/dist/esm/onchain/market/pool/PoolQuotaKeeperV310Contract.js +8 -0
  166. package/dist/esm/onchain/market/rwa/RWARegistry.js +2 -1
  167. package/dist/esm/onchain/market/rwa/index.js +3 -4
  168. package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +2 -2
  169. package/dist/esm/onchain/market/rwa/securitize/constants.js +1 -2
  170. package/dist/esm/onchain/market/rwa/securitize/index.js +3 -3
  171. package/dist/esm/onchain/market/rwa/securitize/types.js +1 -29
  172. package/dist/esm/onchain/market/rwa/types.js +1 -7
  173. package/dist/esm/onchain/market/zapper/index.js +0 -1
  174. package/dist/esm/onchain/pools/PoolService.js +10 -16
  175. package/dist/esm/onchain/preview/index.js +20 -0
  176. package/dist/esm/{preview → onchain/preview}/parse/classifyInnerOperations.js +2 -3
  177. package/dist/esm/{preview → onchain/preview}/parse/index.js +0 -1
  178. package/dist/esm/{preview → onchain/preview}/parse/parseFacadeOperationCalldata.js +1 -1
  179. package/dist/esm/{preview → onchain/preview}/parse/parseOperationCalldata.js +10 -11
  180. package/dist/esm/{preview → onchain/preview}/parse/parsePoolOperationCalldata.js +3 -3
  181. package/dist/esm/{preview → onchain/preview}/parse/parseRWAFactoryOperationCalldata.js +8 -9
  182. package/dist/esm/{preview → onchain/preview}/parse/types.js +1 -1
  183. package/dist/esm/{preview → onchain/preview}/preview/CreditAccountState.js +3 -4
  184. package/dist/esm/{preview → onchain/preview}/preview/buildDelayedStrategyPositionOperationPreview.js +10 -11
  185. package/dist/esm/{preview → onchain/preview}/preview/detectCloseOrRepay.js +2 -3
  186. package/dist/esm/{preview → onchain/preview}/preview/detectDelayedClaim.js +4 -5
  187. package/dist/esm/{preview → onchain/preview}/preview/detectDelayedOperation.js +5 -6
  188. package/dist/esm/{preview → onchain/preview}/preview/estimateClaimableAt.js +1 -1
  189. package/dist/esm/{preview → onchain/preview}/preview/index.js +3 -4
  190. package/dist/esm/{preview → onchain/preview}/preview/previewAdjustStrategyPosition.js +17 -21
  191. package/dist/esm/{preview → onchain/preview}/preview/previewExitOrRepayStrategyPosition.js +20 -26
  192. package/dist/esm/{preview → onchain/preview}/preview/previewOpenStrategyPosition.js +25 -15
  193. package/dist/esm/{preview → onchain/preview}/preview/previewOperation.js +54 -35
  194. package/dist/esm/{preview/simulate/simulatePoolOperation.js → onchain/preview/preview/previewPoolPositionOperation.js} +46 -30
  195. package/dist/esm/onchain/preview/preview/replayInnerOperations.js +107 -0
  196. package/dist/esm/onchain/preview/preview/replayMulticall.js +21 -0
  197. package/dist/esm/{preview → onchain/preview}/preview/unwrapNativeCollateral.js +11 -14
  198. package/dist/esm/onchain/validation/bundles/checkAccountQuotas.js +19 -0
  199. package/dist/esm/onchain/validation/bundles/checkCollateralFunding.js +58 -0
  200. package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +64 -0
  201. package/dist/esm/onchain/validation/bundles/checkDraw.js +27 -0
  202. package/dist/esm/onchain/validation/bundles/checkHealthFactors.js +26 -0
  203. package/dist/esm/onchain/validation/bundles/checkLiquidationEligibility.js +32 -0
  204. package/dist/esm/onchain/validation/bundles/checkLiquidationFunding.js +28 -0
  205. package/dist/esm/onchain/validation/bundles/checkMarket.js +23 -0
  206. package/dist/esm/onchain/validation/bundles/checkObtained.js +12 -0
  207. package/dist/esm/onchain/validation/bundles/checkPoolFunding.js +21 -0
  208. package/dist/esm/onchain/validation/bundles/checkPoolOperation.js +34 -0
  209. package/dist/esm/onchain/validation/bundles/checkQuotasAsked.js +19 -0
  210. package/dist/esm/onchain/validation/bundles/checkRWAOpenRequirements.js +32 -0
  211. package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +23 -0
  212. package/dist/esm/onchain/validation/bundles/checkWallet.js +21 -0
  213. package/dist/esm/onchain/validation/bundles/checkWalletAllowance.js +31 -0
  214. package/dist/esm/onchain/validation/bundles/checkWalletBalance.js +40 -0
  215. package/dist/esm/onchain/validation/bundles/index.js +18 -0
  216. package/dist/esm/onchain/validation/checkLiquidation.js +21 -0
  217. package/dist/esm/onchain/validation/checkOperation.js +61 -0
  218. package/dist/esm/onchain/validation/checkSimulation.js +59 -0
  219. package/dist/esm/onchain/validation/checks/checkBorrowLimit.js +24 -0
  220. package/dist/esm/onchain/validation/checks/checkCollateralised.js +25 -0
  221. package/dist/esm/onchain/validation/checks/checkCreditAccountFrozen.js +9 -0
  222. package/dist/esm/onchain/validation/checks/checkCreditManagerPaused.js +9 -0
  223. package/dist/esm/onchain/validation/checks/checkDebtLimits.js +17 -0
  224. package/dist/esm/onchain/validation/checks/checkEmergencyLiquidator.js +12 -0
  225. package/dist/esm/onchain/validation/checks/checkForbiddenToken.js +9 -0
  226. package/dist/esm/onchain/validation/checks/checkLeverage.js +12 -0
  227. package/dist/esm/onchain/validation/checks/checkLiquidatorEligible.js +9 -0
  228. package/dist/esm/onchain/validation/checks/checkMarketExpired.js +9 -0
  229. package/dist/esm/onchain/validation/checks/checkPoolLiquidity.js +24 -0
  230. package/dist/esm/onchain/validation/checks/checkPoolPaused.js +9 -0
  231. package/dist/esm/onchain/validation/checks/checkPoolSunset.js +9 -0
  232. package/dist/esm/onchain/validation/checks/checkQuotaCount.js +9 -0
  233. package/dist/esm/onchain/validation/checks/checkQuotaLimit.js +17 -0
  234. package/dist/esm/onchain/validation/checks/index.js +16 -0
  235. package/dist/esm/onchain/validation/helpers/amount.js +11 -0
  236. package/dist/esm/onchain/validation/helpers/health-factor-limits.js +21 -0
  237. package/dist/esm/onchain/validation/helpers/index.js +4 -0
  238. package/dist/esm/onchain/validation/{token.js → helpers/token.js} +3 -3
  239. package/dist/esm/onchain/validation/index.js +43 -4
  240. package/dist/esm/onchain/validation/raise.js +31 -0
  241. package/dist/esm/sdk/execute/ExecuteApi.js +1 -0
  242. package/dist/esm/sdk/index.js +2 -3
  243. package/dist/esm/sdk/liquidations/LiquidationsNamespace.js +9 -0
  244. package/dist/esm/sdk/prepare/PrepareApi.js +43 -36
  245. package/dist/esm/sdk/prepare/index.js +3 -3
  246. package/dist/esm/sdk/prepare/types.js +1 -2
  247. package/dist/esm/sdk/preview/PreviewNamespace.js +24 -13
  248. package/dist/types/history/assembleOperations.d.ts +4 -5
  249. package/dist/types/history/classifyMulticallOperations.d.ts +3 -4
  250. package/dist/types/history/index.d.ts +8 -2
  251. package/dist/types/history/mapOperations.d.ts +1 -1
  252. package/dist/types/{preview → history}/trace/errors.d.ts +1 -1
  253. package/dist/types/{preview → history}/trace/extractAdapterCallTraces.d.ts +1 -1
  254. package/dist/types/{preview → history}/trace/extractTransfers.d.ts +2 -3
  255. package/dist/types/{preview → history}/trace/findFacadeCalls.d.ts +1 -1
  256. package/dist/types/{preview → history}/trace/types.d.ts +1 -1
  257. package/dist/types/history/types.d.ts +2 -3
  258. package/dist/types/model/errors/base.d.ts +28 -0
  259. package/dist/types/model/errors/index.d.ts +7 -0
  260. package/dist/types/model/errors/liquidation-errors.d.ts +45 -0
  261. package/dist/types/model/errors/operation-errors.d.ts +216 -0
  262. package/dist/types/{onchain/market/oracle/errors.d.ts → model/errors/oracle-errors.d.ts} +3 -5
  263. package/dist/types/model/errors/prepare-errors.d.ts +131 -0
  264. package/dist/types/model/errors/preview-errors.d.ts +72 -0
  265. package/dist/types/model/index.d.ts +11 -4
  266. package/dist/types/model/opportunities.d.ts +3 -2
  267. package/dist/types/model/positions.d.ts +2 -2
  268. package/dist/types/model/previews.d.ts +52 -113
  269. package/dist/types/model/result.d.ts +4 -8
  270. package/dist/types/model/rwa.d.ts +143 -0
  271. package/dist/types/onchain/accounts/CreditAccountsServiceV310.d.ts +3 -1
  272. package/dist/types/onchain/accounts/index.d.ts +2 -4
  273. package/dist/types/onchain/accounts/intents/guards.d.ts +8 -18
  274. package/dist/types/onchain/accounts/intents/index.d.ts +20 -19
  275. package/dist/types/onchain/accounts/intents/leverage-band.d.ts +1 -1
  276. package/dist/types/onchain/accounts/intents/math.d.ts +6 -6
  277. package/dist/types/onchain/accounts/intents/open-strategy.d.ts +34 -3
  278. package/dist/types/onchain/accounts/intents/operations.d.ts +2 -2
  279. package/dist/types/onchain/accounts/intents/plan.d.ts +9 -9
  280. package/dist/types/onchain/accounts/intents/tail.d.ts +2 -2
  281. package/dist/types/onchain/accounts/intents/testing/expect.d.ts +3 -3
  282. package/dist/types/onchain/accounts/intents/tests/finish-withdraw.fixtures.d.ts +6 -6
  283. package/dist/types/onchain/accounts/intents/tests/open-strategy.fixtures.d.ts +2 -2
  284. package/dist/types/onchain/accounts/intents/tests/withdraw.fixtures.d.ts +12 -12
  285. package/dist/types/onchain/accounts/intents/types.d.ts +32 -30
  286. package/dist/types/onchain/accounts/types.d.ts +4 -2
  287. package/dist/types/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.d.ts +1 -1
  288. package/dist/types/onchain/accounts/withdrawal-compressor/index.d.ts +1 -2
  289. package/dist/types/onchain/accounts/withdrawal-compressor/types.d.ts +1 -1
  290. package/dist/types/onchain/index.d.ts +68 -13
  291. package/dist/types/onchain/market/MarketSuite.d.ts +5 -1
  292. package/dist/types/onchain/market/adapters/index.d.ts +2 -1
  293. package/dist/types/onchain/market/adapters/transfers.d.ts +0 -7
  294. package/dist/types/onchain/market/credit/CreditSuite.d.ts +20 -8
  295. package/dist/types/onchain/market/credit/index.d.ts +2 -2
  296. package/dist/types/onchain/market/credit/types.d.ts +11 -1
  297. package/dist/types/onchain/market/index.d.ts +6 -7
  298. package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +1 -1
  299. package/dist/types/onchain/market/oracle/index.d.ts +1 -2
  300. package/dist/types/onchain/market/oracle/types.d.ts +1 -1
  301. package/dist/types/onchain/market/pool/PoolQuotaKeeperV310Contract.d.ts +5 -0
  302. package/dist/types/onchain/market/rwa/index.d.ts +4 -4
  303. package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +3 -2
  304. package/dist/types/onchain/market/rwa/securitize/constants.d.ts +1 -2
  305. package/dist/types/onchain/market/rwa/securitize/index.d.ts +3 -3
  306. package/dist/types/onchain/market/rwa/securitize/types.d.ts +4 -110
  307. package/dist/types/onchain/market/rwa/types.d.ts +6 -32
  308. package/dist/types/onchain/market/zapper/ZapperContract.d.ts +1 -1
  309. package/dist/types/onchain/market/zapper/index.d.ts +1 -2
  310. package/dist/types/onchain/market/zapper/types.d.ts +1 -1
  311. package/dist/types/onchain/pools/types.d.ts +2 -2
  312. package/dist/types/onchain/preview/index.d.ts +24 -0
  313. package/dist/types/{preview → onchain/preview}/parse/classifyInnerOperations.d.ts +4 -4
  314. package/dist/types/{preview → onchain/preview}/parse/index.d.ts +2 -4
  315. package/dist/types/{preview → onchain/preview}/parse/parseFacadeOperationCalldata.d.ts +4 -4
  316. package/dist/types/onchain/preview/parse/parseOperationCalldata.d.ts +18 -0
  317. package/dist/types/{preview → onchain/preview}/parse/parsePoolOperationCalldata.d.ts +7 -7
  318. package/dist/types/{preview → onchain/preview}/parse/parseRWAFactoryOperationCalldata.d.ts +4 -4
  319. package/dist/types/{preview → onchain/preview}/parse/types-adapters.d.ts +5 -16
  320. package/dist/types/{preview → onchain/preview}/parse/types-facades.d.ts +3 -3
  321. package/dist/types/{preview → onchain/preview}/parse/types-pools.d.ts +1 -1
  322. package/dist/types/{preview → onchain/preview}/parse/types-rwa.d.ts +3 -3
  323. package/dist/types/{preview → onchain/preview}/parse/types.d.ts +3 -3
  324. package/dist/types/{preview → onchain/preview}/preview/CreditAccountState.d.ts +5 -5
  325. package/dist/types/{preview → onchain/preview}/preview/buildDelayedStrategyPositionOperationPreview.d.ts +5 -5
  326. package/dist/types/{preview → onchain/preview}/preview/detectCloseOrRepay.d.ts +1 -1
  327. package/dist/types/{preview → onchain/preview}/preview/detectDelayedClaim.d.ts +8 -8
  328. package/dist/types/{preview → onchain/preview}/preview/detectDelayedOperation.d.ts +9 -9
  329. package/dist/types/{preview → onchain/preview}/preview/estimateClaimableAt.d.ts +6 -6
  330. package/dist/types/{preview → onchain/preview}/preview/index.d.ts +3 -4
  331. package/dist/types/onchain/preview/preview/previewAdjustStrategyPosition.d.ts +20 -0
  332. package/dist/types/onchain/preview/preview/previewExitOrRepayStrategyPosition.d.ts +21 -0
  333. package/dist/types/onchain/preview/preview/previewOpenStrategyPosition.d.ts +14 -0
  334. package/dist/types/onchain/preview/preview/previewOperation.d.ts +32 -0
  335. package/dist/types/onchain/preview/preview/previewPoolPositionOperation.d.ts +13 -0
  336. package/dist/types/{preview → onchain/preview}/preview/replayInnerOperations.d.ts +11 -11
  337. package/dist/types/{preview → onchain/preview}/preview/replayMulticall.d.ts +10 -10
  338. package/dist/types/{preview → onchain/preview}/preview/unwrapNativeCollateral.d.ts +10 -20
  339. package/dist/types/onchain/validation/bundles/checkAccountQuotas.d.ts +16 -0
  340. package/dist/types/onchain/validation/bundles/checkCollateralFunding.d.ts +22 -0
  341. package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +31 -0
  342. package/dist/types/onchain/validation/bundles/checkDraw.d.ts +20 -0
  343. package/dist/types/onchain/validation/bundles/checkHealthFactors.d.ts +39 -0
  344. package/dist/types/onchain/validation/bundles/checkLiquidationEligibility.d.ts +20 -0
  345. package/dist/types/onchain/validation/bundles/checkLiquidationFunding.d.ts +18 -0
  346. package/dist/types/onchain/validation/bundles/checkMarket.d.ts +15 -0
  347. package/dist/types/onchain/validation/bundles/checkObtained.d.ts +9 -0
  348. package/dist/types/onchain/validation/bundles/checkPoolFunding.d.ts +19 -0
  349. package/dist/types/onchain/validation/bundles/checkPoolOperation.d.ts +31 -0
  350. package/dist/types/onchain/validation/bundles/checkQuotasAsked.d.ts +10 -0
  351. package/dist/types/onchain/validation/bundles/checkRWAOpenRequirements.d.ts +21 -0
  352. package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +19 -0
  353. package/dist/types/onchain/validation/bundles/checkWallet.d.ts +23 -0
  354. package/dist/types/onchain/validation/bundles/checkWalletAllowance.d.ts +18 -0
  355. package/dist/types/onchain/validation/bundles/checkWalletBalance.d.ts +17 -0
  356. package/dist/types/onchain/validation/bundles/index.d.ts +18 -0
  357. package/dist/types/onchain/validation/checkLiquidation.d.ts +23 -0
  358. package/dist/types/onchain/validation/checkOperation.d.ts +32 -0
  359. package/dist/types/onchain/validation/checkSimulation.d.ts +56 -0
  360. package/dist/types/onchain/validation/checks/checkBorrowLimit.d.ts +21 -0
  361. package/dist/types/onchain/validation/checks/checkCollateralised.d.ts +25 -0
  362. package/dist/types/onchain/validation/checks/checkCreditAccountFrozen.d.ts +12 -0
  363. package/dist/types/onchain/validation/checks/checkCreditManagerPaused.d.ts +12 -0
  364. package/dist/types/onchain/validation/checks/checkDebtLimits.d.ts +21 -0
  365. package/dist/types/onchain/validation/checks/checkEmergencyLiquidator.d.ts +17 -0
  366. package/dist/types/onchain/validation/checks/checkForbiddenToken.d.ts +12 -0
  367. package/dist/types/onchain/validation/checks/checkLeverage.d.ts +12 -0
  368. package/dist/types/onchain/validation/checks/checkLiquidatorEligible.d.ts +13 -0
  369. package/dist/types/onchain/validation/checks/checkMarketExpired.d.ts +14 -0
  370. package/dist/types/onchain/validation/checks/checkPoolLiquidity.d.ts +20 -0
  371. package/dist/types/onchain/validation/checks/checkPoolPaused.d.ts +12 -0
  372. package/dist/types/onchain/validation/checks/checkPoolSunset.d.ts +13 -0
  373. package/dist/types/onchain/validation/checks/checkQuotaCount.d.ts +11 -0
  374. package/dist/types/onchain/validation/checks/checkQuotaLimit.d.ts +18 -0
  375. package/dist/types/onchain/validation/checks/index.d.ts +16 -0
  376. package/dist/types/onchain/validation/helpers/amount.d.ts +7 -0
  377. package/dist/types/onchain/validation/helpers/health-factor-limits.d.ts +21 -0
  378. package/dist/types/onchain/validation/helpers/index.d.ts +4 -0
  379. package/dist/types/onchain/validation/{token.d.ts → helpers/token.d.ts} +4 -4
  380. package/dist/types/onchain/validation/index.d.ts +43 -4
  381. package/dist/types/onchain/validation/raise.d.ts +33 -0
  382. package/dist/types/sdk/execute/types.d.ts +2 -2
  383. package/dist/types/sdk/index.d.ts +5 -6
  384. package/dist/types/sdk/liquidations/LiquidationsNamespace.d.ts +5 -0
  385. package/dist/types/sdk/liquidations/types.d.ts +8 -0
  386. package/dist/types/sdk/prepare/PrepareApi.d.ts +6 -5
  387. package/dist/types/sdk/prepare/index.d.ts +5 -5
  388. package/dist/types/sdk/prepare/types.d.ts +65 -23
  389. package/dist/types/sdk/preview/PreviewNamespace.d.ts +13 -3
  390. package/dist/types/sdk/preview/index.d.ts +2 -2
  391. package/dist/types/sdk/preview/types.d.ts +30 -7
  392. package/package.json +1 -6
  393. package/dist/cjs/onchain/accounts/withdrawal-compressor/errors.js +0 -1
  394. package/dist/cjs/onchain/market/zapper/errors.js +0 -1
  395. package/dist/cjs/onchain/validation/checks.js +0 -258
  396. package/dist/cjs/onchain/validation/refusal.js +0 -39
  397. package/dist/cjs/preview/index.js +0 -86
  398. package/dist/cjs/preview/package.json +0 -1
  399. package/dist/cjs/preview/parse/errors.js +0 -1
  400. package/dist/cjs/preview/parse/index.js +0 -15
  401. package/dist/cjs/preview/prerequisites/AllowancePrerequisite.js +0 -38
  402. package/dist/cjs/preview/prerequisites/BalancePrerequisite.js +0 -52
  403. package/dist/cjs/preview/prerequisites/Prerequisite.js +0 -52
  404. package/dist/cjs/preview/prerequisites/RWAOpenRequirementsPrerequisite.js +0 -53
  405. package/dist/cjs/preview/prerequisites/buildCollateralPrerequisites.js +0 -63
  406. package/dist/cjs/preview/prerequisites/buildPartialLiquidationPrerequisites.js +0 -19
  407. package/dist/cjs/preview/prerequisites/buildPoolPrerequisites.js +0 -76
  408. package/dist/cjs/preview/prerequisites/buildRWAPrerequisites.js +0 -39
  409. package/dist/cjs/preview/prerequisites/checkPrerequisites.js +0 -74
  410. package/dist/cjs/preview/prerequisites/helpers.js +0 -23
  411. package/dist/cjs/preview/prerequisites/index.js +0 -12
  412. package/dist/cjs/preview/preview/errors.js +0 -85
  413. package/dist/cjs/preview/preview/index.js +0 -33
  414. package/dist/cjs/preview/preview/previewOpenStrategyPosition.js +0 -50
  415. package/dist/cjs/preview/preview/previewOperation.js +0 -100
  416. package/dist/cjs/preview/preview/previewPoolPositionOperation.js +0 -49
  417. package/dist/cjs/preview/preview/replayInnerOperations.js +0 -109
  418. package/dist/cjs/preview/preview/replayMulticall.js +0 -19
  419. package/dist/cjs/preview/simulate/errors.js +0 -73
  420. package/dist/cjs/preview/simulate/index.js +0 -11
  421. package/dist/cjs/preview/simulate/simulateFacadeOperation.js +0 -15
  422. package/dist/cjs/preview/simulate/simulateOperation.js +0 -29
  423. package/dist/cjs/preview/simulate/simulateRWAOperation.js +0 -15
  424. package/dist/cjs/preview/simulate/types.js +0 -1
  425. package/dist/cjs/preview/trace/index.js +0 -14
  426. package/dist/cjs/preview/trace/types.js +0 -1
  427. package/dist/cjs/preview/types.js +0 -1
  428. package/dist/cjs/preview/validate/checkOperation.js +0 -187
  429. package/dist/cjs/preview/validate/checkSimulation.js +0 -39
  430. package/dist/cjs/preview/validate/index.js +0 -8
  431. package/dist/cjs/sdk/prepare/errors.js +0 -93
  432. package/dist/esm/onchain/accounts/withdrawal-compressor/errors.js +0 -1
  433. package/dist/esm/onchain/market/zapper/errors.js +0 -1
  434. package/dist/esm/onchain/validation/checks.js +0 -238
  435. package/dist/esm/onchain/validation/refusal.js +0 -36
  436. package/dist/esm/preview/index.js +0 -38
  437. package/dist/esm/preview/package.json +0 -1
  438. package/dist/esm/preview/parse/errors.js +0 -1
  439. package/dist/esm/preview/prerequisites/AllowancePrerequisite.js +0 -37
  440. package/dist/esm/preview/prerequisites/BalancePrerequisite.js +0 -51
  441. package/dist/esm/preview/prerequisites/Prerequisite.js +0 -51
  442. package/dist/esm/preview/prerequisites/RWAOpenRequirementsPrerequisite.js +0 -52
  443. package/dist/esm/preview/prerequisites/buildCollateralPrerequisites.js +0 -62
  444. package/dist/esm/preview/prerequisites/buildPartialLiquidationPrerequisites.js +0 -18
  445. package/dist/esm/preview/prerequisites/buildPoolPrerequisites.js +0 -75
  446. package/dist/esm/preview/prerequisites/buildRWAPrerequisites.js +0 -38
  447. package/dist/esm/preview/prerequisites/checkPrerequisites.js +0 -73
  448. package/dist/esm/preview/prerequisites/helpers.js +0 -22
  449. package/dist/esm/preview/prerequisites/index.js +0 -7
  450. package/dist/esm/preview/preview/errors.js +0 -79
  451. package/dist/esm/preview/preview/previewPoolPositionOperation.js +0 -48
  452. package/dist/esm/preview/preview/replayInnerOperations.js +0 -107
  453. package/dist/esm/preview/preview/replayMulticall.js +0 -18
  454. package/dist/esm/preview/simulate/errors.js +0 -71
  455. package/dist/esm/preview/simulate/index.js +0 -6
  456. package/dist/esm/preview/simulate/simulateFacadeOperation.js +0 -14
  457. package/dist/esm/preview/simulate/simulateOperation.js +0 -28
  458. package/dist/esm/preview/simulate/simulateRWAOperation.js +0 -14
  459. package/dist/esm/preview/simulate/types.js +0 -1
  460. package/dist/esm/preview/trace/types.js +0 -1
  461. package/dist/esm/preview/types.js +0 -1
  462. package/dist/esm/preview/validate/checkOperation.js +0 -183
  463. package/dist/esm/preview/validate/checkSimulation.js +0 -38
  464. package/dist/esm/preview/validate/index.js +0 -3
  465. package/dist/esm/sdk/prepare/errors.js +0 -89
  466. package/dist/types/model/errors.d.ts +0 -46
  467. package/dist/types/onchain/accounts/withdrawal-compressor/errors.d.ts +0 -20
  468. package/dist/types/onchain/market/zapper/errors.d.ts +0 -18
  469. package/dist/types/onchain/validation/checks.d.ts +0 -164
  470. package/dist/types/onchain/validation/refusal.d.ts +0 -242
  471. package/dist/types/preview/index.d.ts +0 -47
  472. package/dist/types/preview/parse/errors.d.ts +0 -29
  473. package/dist/types/preview/parse/parseOperationCalldata.d.ts +0 -18
  474. package/dist/types/preview/prerequisites/AllowancePrerequisite.d.ts +0 -26
  475. package/dist/types/preview/prerequisites/BalancePrerequisite.d.ts +0 -29
  476. package/dist/types/preview/prerequisites/Prerequisite.d.ts +0 -26
  477. package/dist/types/preview/prerequisites/RWAOpenRequirementsPrerequisite.d.ts +0 -55
  478. package/dist/types/preview/prerequisites/buildCollateralPrerequisites.d.ts +0 -20
  479. package/dist/types/preview/prerequisites/buildPartialLiquidationPrerequisites.d.ts +0 -12
  480. package/dist/types/preview/prerequisites/buildPoolPrerequisites.d.ts +0 -12
  481. package/dist/types/preview/prerequisites/buildRWAPrerequisites.d.ts +0 -26
  482. package/dist/types/preview/prerequisites/checkPrerequisites.d.ts +0 -28
  483. package/dist/types/preview/prerequisites/helpers.d.ts +0 -10
  484. package/dist/types/preview/prerequisites/index.d.ts +0 -7
  485. package/dist/types/preview/prerequisites/types.d.ts +0 -53
  486. package/dist/types/preview/preview/errors.d.ts +0 -44
  487. package/dist/types/preview/preview/previewAdjustStrategyPosition.d.ts +0 -19
  488. package/dist/types/preview/preview/previewExitOrRepayStrategyPosition.d.ts +0 -18
  489. package/dist/types/preview/preview/previewOpenStrategyPosition.d.ts +0 -12
  490. package/dist/types/preview/preview/previewOperation.d.ts +0 -32
  491. package/dist/types/preview/preview/previewPoolPositionOperation.d.ts +0 -13
  492. package/dist/types/preview/simulate/errors.d.ts +0 -52
  493. package/dist/types/preview/simulate/index.d.ts +0 -7
  494. package/dist/types/preview/simulate/simulateFacadeOperation.d.ts +0 -16
  495. package/dist/types/preview/simulate/simulateOperation.d.ts +0 -12
  496. package/dist/types/preview/simulate/simulatePoolOperation.d.ts +0 -42
  497. package/dist/types/preview/simulate/simulateRWAOperation.d.ts +0 -16
  498. package/dist/types/preview/simulate/types.d.ts +0 -48
  499. package/dist/types/preview/types.d.ts +0 -65
  500. package/dist/types/preview/validate/checkOperation.d.ts +0 -71
  501. package/dist/types/preview/validate/checkSimulation.d.ts +0 -32
  502. package/dist/types/preview/validate/index.d.ts +0 -3
  503. package/dist/types/sdk/prepare/errors.d.ts +0 -319
  504. /package/dist/cjs/{preview/prerequisites → history/trace}/types.js +0 -0
  505. /package/dist/cjs/model/{errors.js → errors/base.js} +0 -0
  506. /package/dist/cjs/{preview → onchain/preview}/parse/types-adapters.js +0 -0
  507. /package/dist/cjs/{preview → onchain/preview}/parse/types-facades.js +0 -0
  508. /package/dist/cjs/{preview → onchain/preview}/parse/types-pools.js +0 -0
  509. /package/dist/cjs/{preview → onchain/preview}/parse/types-rwa.js +0 -0
  510. /package/dist/esm/{preview → history}/trace/index.js +0 -0
  511. /package/dist/esm/{preview/prerequisites → history/trace}/types.js +0 -0
  512. /package/dist/esm/model/{errors.js → errors/base.js} +0 -0
  513. /package/dist/esm/{preview → onchain/preview}/parse/types-adapters.js +0 -0
  514. /package/dist/esm/{preview → onchain/preview}/parse/types-facades.js +0 -0
  515. /package/dist/esm/{preview → onchain/preview}/parse/types-pools.js +0 -0
  516. /package/dist/esm/{preview → onchain/preview}/parse/types-rwa.js +0 -0
  517. /package/dist/types/{preview → history}/trace/index.d.ts +0 -0
@@ -32,7 +32,7 @@ interface LeverageBandProps {
32
32
  * A credit manager's `maxLeverage` follows from the liquidation threshold
33
33
  * alone, so it is the same for a hundred dollars and for a million. What a
34
34
  * given deposit reaches is decided by the debt it implies —
35
- * `debt = netValue × (leverage − 1)` — and by the band the market puts that
35
+ * `debt = netValue × (leverage − 1)` — and by the `debtLimits` the market puts that
36
36
  * debt in. This inverts that relation.
37
37
  *
38
38
  * Rounding is asymmetric because the forward direction truncates: the floor
@@ -13,8 +13,8 @@ interface Position {
13
13
  debt: bigint;
14
14
  collateral: bigint;
15
15
  }
16
- /** Facade limits a non-zero debt must respect. */
17
- interface DebtBand {
16
+ /** Facade `debtLimits`: a non-zero debt must sit in `[minDebt, maxDebt]`. */
17
+ interface DebtLimits {
18
18
  minDebt: bigint;
19
19
  maxDebt: bigint;
20
20
  }
@@ -32,17 +32,17 @@ declare function proportionalDebt(position: Position, collateralDelta: bigint):
32
32
  * Largest withdrawal (in underlying) that {@link proportionalDebt} can still
33
33
  * pay for: the repayment it implies leaves debt at or above `minDebt`, and
34
34
  * strictly less than the collateral goes — the last unit closes the account
35
- * rather than shrinks it. `0n` when the debt already sits below the band.
35
+ * rather than shrinks it. `0n` when the debt already sits below `minDebt`.
36
36
  *
37
37
  * Solves `floor(D0 · W / C0) ≤ D0 − minDebt` for `W`.
38
38
  */
39
- declare function maxProportionalWithdrawal(position: Position, band: DebtBand): bigint;
39
+ declare function maxProportionalWithdrawal(position: Position, debtLimits: DebtLimits): bigint;
40
40
  /** Total leverage cannot drop below 1x — that would be negative debt. */
41
41
  declare function assertLeverageAtLeastOne(leverage: bigint): void;
42
42
  /**
43
43
  * Rejects a debt the facade would revert on: zero is always fine (no loan at
44
44
  * all), anything else has to sit inside `[minDebt, maxDebt]`.
45
45
  */
46
- declare function assertDebtInBand(sdk: OnchainSDK, debt: bigint, band: DebtBand, underlying: Address): void;
46
+ declare function assertDebtLimits(sdk: OnchainSDK, debt: bigint, debtLimits: DebtLimits, underlying: Address): void;
47
47
  //#endregion
48
- export { DebtBand, Position, assertDebtInBand, assertLeverageAtLeastOne, debtForLeverage, maxProportionalWithdrawal, proportionalDebt };
48
+ export { DebtLimits, Position, assertDebtLimits, assertLeverageAtLeastOne, debtForLeverage, maxProportionalWithdrawal, proportionalDebt };
@@ -4,11 +4,19 @@ import "../../../model/index.js";
4
4
  import { Asset } from "../../base/types.js";
5
5
  import { MultiCall } from "../../types/transactions.js";
6
6
  import { OnchainSDK } from "../../OnchainSDK.js";
7
- import { SimulationPrices } from "./types.js";
7
+ import { CreditAccountSlice, SimulationPrices } from "./types.js";
8
8
  import "../../index.js";
9
9
  import { Address } from "viem";
10
10
  //#region src/onchain/accounts/intents/open-strategy.d.ts
11
- interface OpenStrategyProps {
11
+ /**
12
+ * Opening an account and putting a position on it in one transaction.
13
+ *
14
+ * The union says which of the two openings this is: {@link OpenStrategyEmpty}
15
+ * takes only the market, because an account holding nothing has nothing to
16
+ * route, no leverage to reach and no target to reach it in.
17
+ */
18
+ type OpenStrategyProps = OpenStrategyFunded | OpenStrategyEmpty;
19
+ interface OpenStrategyFunded {
12
20
  sdk: OnchainSDK;
13
21
  /** Credit manager to open the account in. */
14
22
  creditManager: Address;
@@ -24,6 +32,20 @@ interface OpenStrategyProps {
24
32
  quotaReserve: number | undefined;
25
33
  /** Balances to leave unswapped; everything else is routed into the target. */
26
34
  leftoverBalances?: Asset[];
35
+ /**
36
+ * Existing credit account to put the position on, instead of opening one.
37
+ *
38
+ * Must carry no debt and no quotas. Growing a position that already exists
39
+ * is what the `DEPOSIT` intent is for.
40
+ **/
41
+ creditAccount?: CreditAccountSlice;
42
+ empty?: false;
43
+ }
44
+ /** Opening an account that holds nothing, for a position to land on later. */
45
+ interface OpenStrategyEmpty {
46
+ sdk: OnchainSDK;
47
+ creditManager: Address;
48
+ empty: true;
27
49
  }
28
50
  /**
29
51
  * Projected result of opening a brand-new leveraged position.
@@ -49,6 +71,15 @@ interface OpenStrategyState extends Omit<AccountProjection, "assets" | "quotas">
49
71
  minQuota: Asset[];
50
72
  /** Router path; feeds `openCA.calls`. */
51
73
  calls: MultiCall[];
74
+ /**
75
+ * The account this opening was simulated against and must be executed on,
76
+ * when it reuses one; `undefined` for an opening that creates its own.
77
+ *
78
+ * Carried here rather than asked of the caller again at `buildTx`, so the
79
+ * transaction cannot be built against an account the numbers were not
80
+ * computed for.
81
+ **/
82
+ creditAccount?: Address;
52
83
  }
53
84
  /**
54
85
  * Builds the state opening a leveraged position out of wallet collateral would
@@ -64,4 +95,4 @@ interface OpenStrategyState extends Omit<AccountProjection, "assets" | "quotas">
64
95
  */
65
96
  declare function buildOpenStrategyState(props: OpenStrategyProps): Promise<OpenStrategyState>;
66
97
  //#endregion
67
- export { OpenStrategyProps, OpenStrategyState, buildOpenStrategyState };
98
+ export { OpenStrategyEmpty, OpenStrategyFunded, OpenStrategyProps, OpenStrategyState, buildOpenStrategyState };
@@ -165,7 +165,7 @@ declare function buildWrapRwaCollateralOperation(input: RwaLegInput): Promise<Wr
165
165
  declare function buildUnwrapRwaCollateralOperation(input: RwaLegInput): Promise<UnwrapRwaCollateralOperation>;
166
166
  /**
167
167
  * The request that starts a redemption: spends the source token and receives
168
- * the phantom token standing in for the payout until it matures.
168
+ * the phantom token standing in for the claim until it matures.
169
169
  */
170
170
  interface StartDelayedWithdrawalOperation {
171
171
  type: "startDelayedWithdrawal";
@@ -173,7 +173,7 @@ interface StartDelayedWithdrawalOperation {
173
173
  token: Address;
174
174
  /** Amount of `token` the issuer burns; capped at the account balance. */
175
175
  amountIn: bigint;
176
- /** Request outputs; a delayed one is the phantom token, not the payout. */
176
+ /** Request outputs; a delayed one is the phantom token, not the claim. */
177
177
  outputs: WithdrawalOutput[];
178
178
  /** Whether anything at all has to be waited for. */
179
179
  settlement: "instant" | "delayed";
@@ -3,7 +3,7 @@ import "../../../model/index.js";
3
3
  import { ClaimableWithdrawal } from "../withdrawal-compressor/types.js";
4
4
  import { OnchainSDK } from "../../OnchainSDK.js";
5
5
  import { AddCollateralIntent, AdjustLeverageIntent, DepositStrategyIntent, RepayStrategyIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
6
- import { DebtBand } from "./math.js";
6
+ import { DebtLimits } from "./math.js";
7
7
  import { Address } from "viem";
8
8
  //#region src/onchain/accounts/intents/plan.d.ts
9
9
  /**
@@ -108,7 +108,7 @@ interface AccountView {
108
108
  debt: bigint;
109
109
  /** TVL − debt, in underlying. */
110
110
  collateral: bigint;
111
- band: DebtBand;
111
+ debtLimits: DebtLimits;
112
112
  balanceOf(token: Address): bigint;
113
113
  /** Oracle conversion; unpriceable tokens contribute 0n. */
114
114
  price(from: Address, to: Address, amount: bigint): bigint;
@@ -146,8 +146,8 @@ declare function planWithdraw(intent: Omit<WithdrawStrategyIntent, "type">, view
146
146
  * Intent 2.1 against a source that cannot be sold on a DEX.
147
147
  *
148
148
  * Some collateral only converts through its issuer — a Securitize dsToken, a
149
- * Mellow share — which answers a redemption request now and pays out days
150
- * later. The trade is unchanged; what changes is that the proceeds do not exist
149
+ * Mellow share — which answers a redemption request now and settles days
150
+ * later. The trade is unchanged; what changes is that the money does not exist
151
151
  * yet, so this half only requests the redemption:
152
152
  *
153
153
  * ```
@@ -174,10 +174,10 @@ declare function planFinishDecreaseLeverage(claimable: ClaimableWithdrawal, clai
174
174
  amount: bigint;
175
175
  }, view: AccountView): Step[];
176
176
  /**
177
- * The claim is split between the promised payout `W` and the debt the leading
178
- * half deferred: the payout is served first, the debt gets what is left, so a
179
- * routing shortfall shows as leverage a touch above target rather than as a
180
- * payout the wallet was promised and did not get.
177
+ * The claim is split between the promised withdrawal `W` and the debt the
178
+ * leading half deferred: `W` is served first, the debt gets what is left, so a
179
+ * bad quote shows as leverage a touch above target rather than as a wallet paid
180
+ * less than it was promised.
181
181
  */
182
182
  declare function planFinishWithdraw(intent: {
183
183
  withdrawToken: Address;
@@ -191,7 +191,7 @@ declare function planFinishWithdraw(intent: {
191
191
  }, view: AccountView): Step[];
192
192
  /**
193
193
  * The tail of an exit: the claim lands, everything the account holds is sold
194
- * into the underlying, the loan is settled out of the proceeds and the rest
194
+ * into the underlying, the loan is settled out of what it sells for and the rest
195
195
  * goes to the wallet. The account survives it, empty and owing nothing.
196
196
  *
197
197
  * Nothing is quoted from the request — the same shape {@link planWithdraw}
@@ -20,7 +20,7 @@ interface TailPlan {
20
20
  * tail as it is projected the moment the request is made.
21
21
  *
22
22
  * A claim that brought only part of what was queued is served in proportion,
23
- * see {@link partialTail}: the intent's payout and its repayment are cut to the
23
+ * see {@link partialTail}: the intent's withdrawal and its repayment are cut to the
24
24
  * share that arrived, and the rest of both is handed to the next claim.
25
25
  */
26
26
  declare function planTail(args: {
@@ -33,7 +33,7 @@ declare function planTail(args: {
33
33
  *
34
34
  * A request is only half a withdrawal, so the state it lands in is not the
35
35
  * answer to "what does this do to my position": the debt is still there, the
36
- * payout has not been made, and the position sits in a phantom token. What the
36
+ * withdrawal has not been made, and the position sits in a phantom token. What the
37
37
  * caller means is the far side — and that side can be walked now, because the
38
38
  * request already fixes the claim it will be finished from.
39
39
  *
@@ -38,10 +38,10 @@ declare function expectAdjustPreview(result: IntentPreviewResult | DelayedStartR
38
38
  expectedOps: ExpectedFlowOp[];
39
39
  expectedCalls?: MultiCall[];
40
40
  }): OperationState;
41
- /** Asserts the preview failed for a specific reason. */
42
- declare function expectPreviewError(result: IntentPreviewResult | DelayedStartResult, reason: Extract<IntentPreviewResult, {
41
+ /** Asserts the preview failed with a specific error code. */
42
+ declare function expectPreviewError(result: IntentPreviewResult | DelayedStartResult, code: Extract<IntentPreviewResult, {
43
43
  ok: false;
44
- }>["reason"]): void;
44
+ }>["error"]["code"]): void;
45
45
  /**
46
46
  * What a priced list — holdings or quotas — says the account stands at for
47
47
  * `token`. A quota is denominated in the market underlying, so this reads the
@@ -63,11 +63,11 @@ declare function buildWithdrawFinishProps(args: {
63
63
  };
64
64
  /** Matrix baseline debt: 8U. */
65
65
  declare const M4_DEBT = 800000000n;
66
- /** Matrix payout W: 1U. */
66
+ /** Matrix withdrawal W: 1U. */
67
67
  declare const M4_W = 100000000n;
68
68
  /** Proportional repayment `dD = D0 * W / C0` = 4U. */
69
69
  declare const M4_DD = 400000000n;
70
- /** Payout plus repayment: 5U redeemed by the leading half. */
70
+ /** Withdrawal plus repayment: 5U redeemed by the leading half. */
71
71
  declare const M4_SPEND: bigint;
72
72
  /** Quotable withdrawal phantom: `POS2`, 1:1 with `POS`. */
73
73
  declare const M4_PHANTOM: `0x${string}`;
@@ -85,10 +85,10 @@ interface MatrixWithdrawTailCase {
85
85
  /**
86
86
  * Matrix 4.3 tail — the claim pays `UND` directly.
87
87
  *
88
- * MATRIX MISMATCH: the matrix pays out first — `claim →
88
+ * MATRIX MISMATCH: the matrix withdraws first — `claim →
89
89
  * withdrawCollateral(min(W, claim.amount)) → decreaseDebt(rest) →
90
- * changeQuota`. The engine repays before paying out (`repay(debtRepaid,
91
- * keep: W)` precedes the payout leg in `planFinishWithdraw`):
90
+ * changeQuota`. The engine repays before withdrawing (`repay(debtRepaid,
91
+ * keep: W)` precedes the withdrawal leg in `planFinishWithdraw`):
92
92
  * `claim → decreaseDebt(dD) → withdrawCollateral(W) → changeQuota`.
93
93
  * Amounts are identical; only the order differs.
94
94
  */
@@ -103,7 +103,7 @@ declare const case_matrix_4_3_tail: MatrixWithdrawTailCase;
103
103
  */
104
104
  declare const case_matrix_4_4_tail: MatrixWithdrawTailCase;
105
105
  /**
106
- * Matrix 4.5 tail — 4.3 on the RWA market: unwrap before the payout.
106
+ * Matrix 4.5 tail — 4.3 on the RWA market: unwrap before the withdrawal.
107
107
  *
108
108
  * MATRIX MISMATCH: same ordering divergence as 4.3 — the matrix expects
109
109
  * `claim → unwrapRwaCollateral → withdrawCollateral(RWA) → decreaseDebt →
@@ -1,6 +1,6 @@
1
1
  import { Asset } from "../../../base/types.js";
2
2
  import { OnchainSDK } from "../../../OnchainSDK.js";
3
- import { OpenStrategyProps } from "../open-strategy.js";
3
+ import { OpenStrategyFunded } from "../open-strategy.js";
4
4
  import "../../../index.js";
5
5
  import { MarketSdkExtras } from "../testing/market.js";
6
6
  import { Address } from "viem";
@@ -51,6 +51,6 @@ declare const case_underlying_1x: OpenStrategyCase;
51
51
  */
52
52
  declare const case_mixed_with_leftover: OpenStrategyCase;
53
53
  declare function buildOpenStrategySdk(extras?: MarketSdkExtras): OnchainSDK;
54
- declare function buildOpenStrategyProps(c: OpenStrategyCase, sdk: OnchainSDK): OpenStrategyProps;
54
+ declare function buildOpenStrategyProps(c: OpenStrategyCase, sdk: OnchainSDK): OpenStrategyFunded;
55
55
  //#endregion
56
56
  export { COLLATERAL_ANY, HALF_UND, KEEP_ANY, LEVERAGE_1X, LEVERAGE_2X, LEVERAGE_3X, LT, MARGIN_UND, OpenStrategyCase, buildOpenStrategyProps, buildOpenStrategySdk, case_mixed_with_leftover, case_underlying_1x, case_underlying_3x, quotaFor };
@@ -7,7 +7,7 @@ import { Address } from "viem";
7
7
  //#region src/onchain/accounts/intents/tests/withdraw.fixtures.d.ts
8
8
  /** 100 UND of value leaving the account. */
9
9
  declare const W = 10000000000n;
10
- /** Payout plus proportional repayment. */
10
+ /** Withdrawal plus proportional repayment. */
11
11
  declare const SPEND: bigint;
12
12
  declare const TVL_BEFORE = 200000000000n;
13
13
  declare const DEBT_BEFORE = 100000000000n;
@@ -28,7 +28,7 @@ interface WithdrawCase {
28
28
  }
29
29
  /** Row 1 — S = U, T = U: repay, then hand over the underlying. */
30
30
  declare const case_und_und: WithdrawCase;
31
- /** Row 2 — S = U, T = POS: repay, then route the payout out of the underlying. */
31
+ /** Row 2 — S = U, T = POS: repay, then route the withdrawal out of the underlying. */
32
32
  declare const case_und_pos: WithdrawCase;
33
33
  /** Row 3 — S = POS, T = U: both legs land in the underlying, so one swap covers them. */
34
34
  declare const case_pos_und: WithdrawCase;
@@ -36,29 +36,29 @@ declare const case_pos_und: WithdrawCase;
36
36
  declare const case_pos_pos: WithdrawCase;
37
37
  /** Row 5 — S = POS, T = POS2: two independent legs out of the same source. */
38
38
  declare const case_pos_pos2: WithdrawCase;
39
- /** RWA market: the underlying payout is force-unwrapped to the asset. */
40
- declare const case_rwa_payout: WithdrawCase;
39
+ /** RWA market: the underlying withdrawal is force-unwrapped to the asset. */
40
+ declare const case_rwa_pos_und: WithdrawCase;
41
41
  /** Matrix baseline: 10A of position against 8U of debt (2U collateral at 5x). */
42
42
  declare const M4_BALANCE = 1000000000n;
43
43
  declare const M4_DEBT = 800000000n;
44
- /** Matrix payout W: 1U. */
44
+ /** Matrix withdrawal W: 1U. */
45
45
  declare const M4_W = 100000000n;
46
46
  /** Proportional repayment `dD = D0 * W / C0` = 4U. */
47
47
  declare const M4_DD = 400000000n;
48
- /** Payout plus repayment: 5U liquidated in total. */
48
+ /** Withdrawal plus repayment: 5U liquidated in total. */
49
49
  declare const M4_SPEND: bigint;
50
50
  /**
51
- * Matrix 4.1 — withdraw 1U, source `POS`, payout `UND`.
51
+ * Matrix 4.1 — withdraw 1U, source `POS`, tokenOut `UND`.
52
52
  *
53
- * MATRIX MISMATCH: the matrix pays out first — `swap → withdrawCollateral →
54
- * decreaseDebt → changeQuota`. The engine repays before paying out
55
- * (`repay(dD, keep: W)` precedes the payout leg in `planWithdraw`):
53
+ * MATRIX MISMATCH: the matrix withdraws first — `swap → withdrawCollateral →
54
+ * decreaseDebt → changeQuota`. The engine repays before withdrawing
55
+ * (`repay(dD, keep: W)` precedes the withdrawal leg in `planWithdraw`):
56
56
  * `swap → decreaseDebt → withdrawCollateral → changeQuota`. Amounts are
57
57
  * identical; only the order differs.
58
58
  */
59
59
  declare const case_matrix_4_1: WithdrawCase;
60
60
  /**
61
- * Matrix 4.2 — 4.1 on the RWA market: the payout is unwrapped on the way out.
61
+ * Matrix 4.2 — 4.1 on the RWA market: the withdrawal is unwrapped on the way out.
62
62
  *
63
63
  * MATRIX MISMATCH: same ordering divergence as 4.1 — the matrix expects
64
64
  * `swap → unwrapRwaCollateral → withdrawCollateral(RWA) → decreaseDebt →
@@ -76,4 +76,4 @@ declare function buildWithdrawProps(c: WithdrawCase, sdk: OnchainSDK): {
76
76
  slippage: undefined;
77
77
  };
78
78
  //#endregion
79
- export { DEBT_AFTER, DEBT_BEFORE, M4_BALANCE, M4_DD, M4_DEBT, M4_SPEND, M4_W, QUOTA_AFTER, QUOTA_BEFORE, QUOTA_DELTA, SPEND, TVL_AFTER, TVL_BEFORE, W, WithdrawCase, buildWithdrawProps, buildWithdrawSdk, case_matrix_4_1, case_matrix_4_2, case_pos_pos, case_pos_pos2, case_pos_und, case_rwa_payout, case_und_pos, case_und_und };
79
+ export { DEBT_AFTER, DEBT_BEFORE, M4_BALANCE, M4_DD, M4_DEBT, M4_SPEND, M4_W, QUOTA_AFTER, QUOTA_BEFORE, QUOTA_DELTA, SPEND, TVL_AFTER, TVL_BEFORE, W, WithdrawCase, buildWithdrawProps, buildWithdrawSdk, case_matrix_4_1, case_matrix_4_2, case_pos_pos, case_pos_pos2, case_pos_und, case_rwa_pos_und, case_und_pos, case_und_und };
@@ -1,12 +1,13 @@
1
1
  import { TokenAmount } from "../../../model/primitives.js";
2
2
  import { DelayedIntent } from "../../../model/delayed-intents.js";
3
3
  import { AccountProjection } from "../../../model/previews.js";
4
+ import { SDKError } from "../../../model/result.js";
4
5
  import "../../../model/index.js";
5
6
  import { ClaimableWithdrawal } from "../withdrawal-compressor/types.js";
6
7
  import { RouterCASlice } from "../../router/types.js";
7
8
  import { MultiCall } from "../../types/transactions.js";
8
9
  import { OnchainSDK } from "../../OnchainSDK.js";
9
- import { PreviewErrorReason, PreviewRefusal } from "../../validation/refusal.js";
10
+ import { IntentValidationError } from "../../validation/raise.js";
10
11
  import { AccountCalculatorOperation } from "./operations.js";
11
12
  import "../../index.js";
12
13
  import { Address } from "viem";
@@ -64,14 +65,14 @@ interface SimulationPrices {
64
65
  interface OperationState extends AccountProjection, SimulationPrices {}
65
66
  /**
66
67
  * What planning an intent yields: the operation chain, the state it projects,
67
- * and the calldata that realises it — or the reason the request is not viable.
68
+ * and the calldata that realises it — or the error that stopped the plan.
68
69
  */
69
70
  type IntentPreviewResult = {
70
71
  ok: true;
71
72
  operations: AccountCalculatorOperation[];
72
73
  state: OperationState;
73
74
  calls: MultiCall[];
74
- } | PreviewRefusal;
75
+ } | SDKError<IntentValidationError>;
75
76
  /**
76
77
  * What a claim did not bring, when the venue served part of a matured
77
78
  * withdrawal and left the rest of it queued.
@@ -109,7 +110,7 @@ type FinishIntentResult = (Extract<IntentPreviewResult, {
109
110
  * {@link ClaimRemainder}.
110
111
  */
111
112
  remainder: ClaimRemainder | undefined;
112
- }) | PreviewRefusal;
113
+ }) | SDKError<IntentValidationError>;
113
114
  /** What the request recorded, and when the tail can be run. */
114
115
  interface DelayedStart {
115
116
  /**
@@ -123,17 +124,17 @@ interface DelayedStart {
123
124
  /**
124
125
  * `instant` when the venue served the whole request on the spot, so no claim
125
126
  * will ever arrive to carry the tail. The intent is then left half-done —
126
- * nothing repaid, nothing paid out — and the caller wants `startIntent`
127
+ * nothing repaid, nothing withdrawn — and the caller wants `startIntent`
127
128
  * instead, which settles all of it in one transaction.
128
129
  */
129
130
  settlement: "instant" | "delayed";
130
131
  /**
131
132
  * What the claim is expected to credit the account with once the redemption
132
- * matures: the venue's payout token and the amount the request queued.
133
+ * matures: the token the redemption settles in and the amount the request queued.
133
134
  * `undefined` when the request settled on the spot and nothing is coming.
134
135
  *
135
- * An estimate, not a quote — the issuer prices the redemption when it pays
136
- * out, and the state the intent is previewed against was read now.
136
+ * An estimate, not a quote — the issuer prices the redemption when it settles,
137
+ * and the state the intent is previewed against was read now.
137
138
  */
138
139
  claim: {
139
140
  token: Address;
@@ -172,7 +173,7 @@ type DelayedStartResult = {
172
173
  state: OperationState;
173
174
  calls: MultiCall[];
174
175
  delayed: DelayedStart;
175
- } | PreviewRefusal;
176
+ } | SDKError<IntentValidationError>;
176
177
  /** An intent previewed through the router: one transaction, settled now. */
177
178
  type InstantRoute = Extract<IntentPreviewResult, {
178
179
  ok: true;
@@ -184,35 +185,35 @@ type DelayedRoute = Extract<DelayedStartResult, {
184
185
  /**
185
186
  * Why a route is missing from an {@link IntentRoutesResult}.
186
187
  *
187
- * A reason is the engine's refusal — `noDelayedRoute` for a source with no
188
+ * An error is the engine's verdict — `noDelayedRoute` for a source with no
188
189
  * redemption venue or for a leverage move that settles at once,
189
- * `insufficientSourceBalance` for a payout the account cannot fund. `undefined`
190
+ * `insufficientBalance` for a withdrawal the account cannot fund. A missing key
190
191
  * next to a missing route means the route could not be quoted at all: the
191
192
  * pathfinder found no way out of the source, or the read behind it failed.
192
193
  */
193
- interface RouteRefusals {
194
- instant: PreviewErrorReason | undefined;
195
- delayed: PreviewErrorReason | undefined;
194
+ interface RouteErrors {
195
+ instant?: IntentValidationError;
196
+ delayed?: IntentValidationError;
196
197
  }
197
198
  /**
198
199
  * Both ways one intent can be served, previewed side by side: traded through
199
200
  * the router, which settles in a single transaction, or redeemed through the
200
- * source's issuer, which answers now and pays out days later.
201
+ * source's issuer, which answers now and settles days later.
201
202
  *
202
203
  * Which of them an account can take depends on the intent and the token it
203
204
  * sells, so both are quoted and a route it cannot take comes back `undefined`
204
- * with its refusal in `refused`. Only when neither answers is the request itself
205
- * unviable, and then `reason` is the instant route's refusal — the route every
206
- * account is expected to have — falling back to the delayed one's.
205
+ * with its error in `errors`. Only when neither answers is the request itself
206
+ * unviable, and then `error` is the instant route's — the route every account
207
+ * is expected to have — falling back to the delayed one's.
207
208
  */
208
209
  type IntentRoutesResult = {
209
210
  ok: true;
210
211
  instant: InstantRoute | undefined;
211
212
  delayed: DelayedRoute | undefined;
212
- refused: RouteRefusals;
213
- } | (PreviewRefusal & {
214
- /** {@inheritDoc IntentRoutesResult.refused} */
215
- refused: RouteRefusals;
213
+ errors: RouteErrors;
214
+ } | (SDKError<IntentValidationError> & {
215
+ /** {@inheritDoc IntentRoutesResult.errors} */
216
+ errors: RouteErrors;
216
217
  });
217
218
  /**
218
219
  * The intents the engine previews.
@@ -368,12 +369,13 @@ interface RepayStrategyIntent {
368
369
  * Intent 2.1 — withdraw part of the position's net value at fixed leverage.
369
370
  *
370
371
  * The requested amount leaves the account, and debt is repaid in the same
371
- * proportion so leverage is unchanged: `dD = D0 * W / C0`. Both the payout and
372
- * the repayment are funded by liquidating the source token, which means the
372
+ * proportion so leverage is unchanged: `dD = D0 * W / C0`. Both the withdrawal
373
+ * and the repayment are funded by liquidating the source token, which means the
373
374
  * account must give up `W + dD` of value in total.
374
375
  *
375
- * The payout leg and the repayment leg are quoted separately and do not share a
376
- * pool, so a shortfall on the payout leg does not eat into the repayment.
376
+ * The withdrawal leg and the repayment leg are quoted separately and do not
377
+ * share a pool, so a bad quote on the withdrawal leg does not eat into the
378
+ * repayment.
377
379
  *
378
380
  * Asking for the whole net value is the exit instead — there is no leverage
379
381
  * left to hold — and the shape changes with it: the quotas are dropped, the
@@ -388,7 +390,7 @@ interface WithdrawStrategyIntent {
388
390
  type: "WITHDRAW";
389
391
  /**
390
392
  * Amount the wallet receives, denominated in `tokenOut`. At or above the
391
- * account's net value this is an exit, which pays out the underlying the
393
+ * account's net value this is an exit, which hands over the underlying the
392
394
  * position was sold into rather than in `tokenOut`.
393
395
  *
394
396
  * `MAX_UINT256` is that exit stated outright, and the amount a "close
@@ -396,7 +398,7 @@ interface WithdrawStrategyIntent {
396
398
  * rounding can turn it back into a withdrawal that leaves dust behind.
397
399
  */
398
400
  amount: bigint;
399
- /** Wallet receiving the payout. */
401
+ /** Token recipient. */
400
402
  to: Address;
401
403
  /**
402
404
  * Token the wallet receives. Defaults to the market underlying — which, on an
@@ -439,7 +441,7 @@ interface WithdrawCeilings {
439
441
  * has caught up with its collateral.
440
442
  *
441
443
  * A Max button is better served by sending `MAX_UINT256` than this figure —
442
- * the exit is then named outright, and no rounding in the payout token's
444
+ * the exit is then named outright, and no rounding in the withdrawal token's
443
445
  * price can drop the request back into the refused gap.
444
446
  */
445
447
  exit: bigint;
@@ -468,4 +470,4 @@ type FinishIntentProps = StartIntentProps & {
468
470
  claimable: ClaimableWithdrawal;
469
471
  };
470
472
  //#endregion
471
- export { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, SimulationPrices, StartIntent, StartIntentProps, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent };
473
+ export { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteErrors, SimulationPrices, StartIntent, StartIntentProps, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent };
@@ -1,8 +1,9 @@
1
1
  import { DelayedIntent } from "../../model/delayed-intents.js";
2
+ import { RWAOpenAccountRequirements, RWAOperationArgs } from "../../model/rwa.js";
2
3
  import "../../model/index.js";
3
4
  import { ClaimableWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
4
5
  import { Asset, CreditAccountData, CreditAccountTokensSlice, PermitResult } from "../base/types.js";
5
- import { GetOpenAccountRequirementsProps, RWAOpenAccountRequirements, RWAOperationArgs } from "../market/rwa/types.js";
6
+ import { GetOpenAccountRequirementsProps } from "../market/rwa/types.js";
6
7
  import "../market/rwa/index.js";
7
8
  import { PriceUpdate } from "../market/pricefeeds/types.js";
8
9
  import { PartialLiquidationParams, PrepareUpdateQuotasProps } from "../market/credit/types.js";
@@ -214,7 +215,8 @@ interface OpenCAProps extends PrepareUpdateQuotasProps {
214
215
  */
215
216
  creditManager: Address;
216
217
  /**
217
- * Optional address of credit account to reopen
218
+ * Optional address of an existing credit account to run the opening on,
219
+ * instead of opening a new one.
218
220
  */
219
221
  reopenCreditAccount?: Address;
220
222
  /**
@@ -1,7 +1,7 @@
1
1
  import { DelayedIntent } from "../../../model/delayed-intents.js";
2
+ import { InvalidDelayedIntentError } from "../../../model/errors/preview-errors.js";
2
3
  import { SDKReturn } from "../../../model/result.js";
3
4
  import "../../../model/index.js";
4
- import { InvalidDelayedIntentError } from "./errors.js";
5
5
  import { IRedemptionLoggerContract, RedemptionLog } from "./types.js";
6
6
  import { OnchainSDK } from "../../OnchainSDK.js";
7
7
  import { BaseContract } from "../../base/BaseContract.js";
@@ -1,4 +1,3 @@
1
- import { InvalidDelayedIntentError } from "./errors.js";
2
1
  import { ClaimableWithdrawal, CurrentWithdrawals, DelayedIntentExtended, GetExternalAccountCurrentWithdrawalsProps, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./types.js";
3
2
  import { AbstractWithdrawalCompressorContract, OnchainRequestableWithdrawal, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
4
3
  import { WithdrawalCompressorLocation, WithdrawalCompressorVersion, getWithdrawalCompressorAddress } from "./addresses.js";
@@ -9,4 +8,4 @@ import { RedemptionLoggerV310Contract } from "./RedemptionLoggerV310Contract.js"
9
8
  import { WithdrawalCompressorV310Contract } from "./WithdrawalCompressorV310Contract.js";
10
9
  import { WithdrawalCompressorV311Contract } from "./WithdrawalCompressorV311Contract.js";
11
10
  import { WithdrawalCompressorV313Contract } from "./WithdrawalCompressorV313Contract.js";
12
- export { AbstractWithdrawalCompressorContract, ClaimableWithdrawal, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedIntentExtended, GetExternalAccountCurrentWithdrawalsProps, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, InvalidDelayedIntentError, OnchainRequestableWithdrawal, PendingWithdrawal, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
11
+ export { AbstractWithdrawalCompressorContract, ClaimableWithdrawal, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedIntentExtended, GetExternalAccountCurrentWithdrawalsProps, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, OnchainRequestableWithdrawal, PendingWithdrawal, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -1,9 +1,9 @@
1
1
  import { DelayedIntent } from "../../../model/delayed-intents.js";
2
+ import { InvalidDelayedIntentError } from "../../../model/errors/preview-errors.js";
2
3
  import { SDKReturn } from "../../../model/result.js";
3
4
  import "../../../model/index.js";
4
5
  import { MulticallBatch } from "../../utils/viem/executeMulticallBatches.js";
5
6
  import "../../utils/viem/index.js";
6
- import { InvalidDelayedIntentError } from "./errors.js";
7
7
  import { IBaseContract } from "../../base/types.js";
8
8
  import { MultiCall } from "../../types/transactions.js";
9
9
  import "../../types/index.js";