@gearbox-protocol/sdk 16.0.0-next.21 → 16.0.0-next.23

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 (607) hide show
  1. package/dist/cjs/onchain/accounts/index.js +5 -0
  2. package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +2 -2
  3. package/dist/cjs/onchain/accounts/intents/open-strategy.js +7 -4
  4. package/dist/cjs/onchain/accounts/intents/realize.js +10 -6
  5. package/dist/cjs/onchain/accounts/intents/tail.js +3 -2
  6. package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -1
  7. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +18 -1
  8. package/dist/cjs/onchain/accounts/intents/tests/add-collateral.fixtures.js +4 -4
  9. package/dist/cjs/onchain/accounts/intents/tests/adjust-leverage.fixtures.js +15 -15
  10. package/dist/cjs/onchain/accounts/intents/tests/deposit.fixtures.js +13 -13
  11. package/dist/cjs/onchain/accounts/intents/tests/finish-decrease-leverage.fixtures.js +2 -2
  12. package/dist/cjs/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +2 -2
  13. package/dist/cjs/onchain/accounts/intents/tests/withdraw-asset.fixtures.js +4 -4
  14. package/dist/cjs/onchain/accounts/intents/tests/withdraw.fixtures.js +7 -7
  15. package/dist/cjs/onchain/accounts/intents/utils/adjust-state-to-snapshot.js +8 -5
  16. package/dist/cjs/onchain/accounts/intents/utils/common.js +2 -2
  17. package/dist/cjs/onchain/accounts/intents/utils/credit-account-slice.js +4 -4
  18. package/dist/cjs/onchain/accounts/intents/utils/quotas-for-update.js +2 -2
  19. package/dist/cjs/onchain/accounts/intents/view.js +2 -2
  20. package/dist/cjs/{common-utils/utils/creditAccount → onchain/accounts}/quota-utils.js +3 -3
  21. package/dist/cjs/onchain/index.js +12 -0
  22. package/dist/cjs/onchain/market/MarketSuite.js +15 -0
  23. package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +2 -2
  24. package/dist/cjs/onchain/market/math.js +6 -2
  25. package/dist/cjs/onchain/pools/PoolService.js +25 -29
  26. package/dist/cjs/onchain/utils/index.js +7 -0
  27. package/dist/cjs/{common-utils → onchain}/utils/trace.js +1 -1
  28. package/dist/cjs/preview/index.js +3 -1
  29. package/dist/cjs/preview/preview/buildDelayedPreview.js +4 -5
  30. package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +3 -3
  31. package/dist/cjs/preview/preview/previewCloseOrRepayCreditAccount.js +1 -1
  32. package/dist/cjs/preview/preview/previewOpenCreditAccount.js +7 -7
  33. package/dist/cjs/preview/trace/extractAdapterCallTraces.js +2 -2
  34. package/dist/cjs/preview/trace/findFacadeCalls.js +2 -2
  35. package/dist/cjs/preview/validate/checkOperation.js +47 -37
  36. package/dist/cjs/preview/validate/checkSimulation.js +3 -16
  37. package/dist/cjs/preview/validate/index.js +3 -1
  38. package/dist/cjs/rewards/rewards/api.js +0 -1
  39. package/dist/cjs/rewards/rewards/extra-apy.js +0 -1
  40. package/dist/cjs/sdk/execute/ExecuteApi.js +9 -6
  41. package/dist/cjs/sdk/prepare/PrepareApi.js +4 -1
  42. package/dist/esm/dev/AccountOpener.js +1 -1
  43. package/dist/esm/dev/withdrawalUtils.js +1 -1
  44. package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
  45. package/dist/esm/onchain/accounts/index.js +2 -1
  46. package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +2 -2
  47. package/dist/esm/onchain/accounts/intents/open-strategy.js +7 -4
  48. package/dist/esm/onchain/accounts/intents/realize.js +10 -6
  49. package/dist/esm/onchain/accounts/intents/tail.js +3 -2
  50. package/dist/esm/onchain/accounts/intents/testing/market.js +1 -1
  51. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +18 -1
  52. package/dist/esm/onchain/accounts/intents/tests/add-collateral.fixtures.js +4 -4
  53. package/dist/esm/onchain/accounts/intents/tests/adjust-leverage.fixtures.js +15 -15
  54. package/dist/esm/onchain/accounts/intents/tests/deposit.fixtures.js +13 -13
  55. package/dist/esm/onchain/accounts/intents/tests/finish-decrease-leverage.fixtures.js +2 -2
  56. package/dist/esm/onchain/accounts/intents/tests/finish-withdraw.fixtures.js +2 -2
  57. package/dist/esm/onchain/accounts/intents/tests/withdraw-asset.fixtures.js +4 -4
  58. package/dist/esm/onchain/accounts/intents/tests/withdraw.fixtures.js +7 -7
  59. package/dist/esm/onchain/accounts/intents/utils/adjust-state-to-snapshot.js +8 -5
  60. package/dist/esm/onchain/accounts/intents/utils/common.js +2 -2
  61. package/dist/esm/onchain/accounts/intents/utils/credit-account-slice.js +4 -4
  62. package/dist/esm/onchain/accounts/intents/utils/quotas-for-update.js +1 -1
  63. package/dist/esm/onchain/accounts/intents/view.js +2 -2
  64. package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
  65. package/dist/esm/{common-utils/utils/creditAccount → onchain/accounts}/quota-utils.js +3 -3
  66. package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  67. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  68. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  69. package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  70. package/dist/esm/onchain/base/TokensMeta.js +3 -3
  71. package/dist/esm/onchain/chain/detectNetwork.js +1 -1
  72. package/dist/esm/onchain/core/createAddressProvider.js +1 -1
  73. package/dist/esm/onchain/index.js +3 -1
  74. package/dist/esm/onchain/market/MarketSuite.js +15 -0
  75. package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +1 -1
  76. package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
  77. package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
  78. package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
  79. package/dist/esm/onchain/market/math.js +6 -2
  80. package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
  81. package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
  82. package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
  83. package/dist/esm/onchain/pools/PoolService.js +26 -30
  84. package/dist/esm/onchain/utils/index.js +2 -1
  85. package/dist/esm/{common-utils → onchain}/utils/trace.js +1 -1
  86. package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
  87. package/dist/esm/preview/index.js +2 -2
  88. package/dist/esm/preview/preview/buildDelayedPreview.js +4 -5
  89. package/dist/esm/preview/preview/previewAdjustCreditAccount.js +3 -3
  90. package/dist/esm/preview/preview/previewCloseOrRepayCreditAccount.js +1 -1
  91. package/dist/esm/preview/preview/previewOpenCreditAccount.js +7 -7
  92. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  93. package/dist/esm/preview/trace/extractAdapterCallTraces.js +1 -1
  94. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  95. package/dist/esm/preview/trace/findFacadeCalls.js +1 -1
  96. package/dist/esm/preview/validate/checkOperation.js +45 -37
  97. package/dist/esm/preview/validate/checkSimulation.js +5 -18
  98. package/dist/esm/preview/validate/index.js +2 -2
  99. package/dist/esm/rewards/rewards/api.js +0 -1
  100. package/dist/esm/rewards/rewards/extra-apy.js +0 -1
  101. package/dist/esm/sdk/execute/ExecuteApi.js +9 -6
  102. package/dist/esm/sdk/prepare/PrepareApi.js +4 -1
  103. package/dist/types/history/classifyMulticallOperations.d.ts +1 -1
  104. package/dist/types/model/index.d.ts +2 -2
  105. package/dist/types/model/previews.d.ts +59 -109
  106. package/dist/types/onchain/accounts/index.d.ts +2 -1
  107. package/dist/types/onchain/accounts/intents/open-strategy.d.ts +15 -29
  108. package/dist/types/onchain/accounts/intents/operations.d.ts +1 -1
  109. package/dist/types/onchain/accounts/intents/testing/expect.d.ts +6 -2
  110. package/dist/types/onchain/accounts/intents/testing/market.d.ts +1 -1
  111. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +1 -1
  112. package/dist/types/onchain/accounts/intents/tests/add-collateral.fixtures.d.ts +1 -1
  113. package/dist/types/onchain/accounts/intents/tests/adjust-leverage.fixtures.d.ts +2 -2
  114. package/dist/types/onchain/accounts/intents/tests/deposit.fixtures.d.ts +2 -2
  115. package/dist/types/onchain/accounts/intents/tests/withdraw-asset.fixtures.d.ts +1 -1
  116. package/dist/types/onchain/accounts/intents/tests/withdraw.fixtures.d.ts +2 -2
  117. package/dist/types/onchain/accounts/intents/types.d.ts +8 -59
  118. package/dist/types/onchain/accounts/intents/utils/adjust-state-to-snapshot.d.ts +2 -2
  119. package/dist/types/onchain/accounts/intents/utils/credit-account-slice.d.ts +3 -3
  120. package/dist/types/{common-utils/utils/creditAccount → onchain/accounts}/quota-utils.d.ts +3 -4
  121. package/dist/types/onchain/base/index.d.ts +2 -2
  122. package/dist/types/onchain/base/types.d.ts +5 -1
  123. package/dist/types/onchain/index.d.ts +5 -3
  124. package/dist/types/onchain/market/MarketSuite.d.ts +13 -1
  125. package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +1 -1
  126. package/dist/types/onchain/market/adapters/contracts/AccountMigratorAdapterContract.d.ts +1 -1
  127. package/dist/types/onchain/market/credit/index.d.ts +2 -2
  128. package/dist/types/onchain/market/credit/types.d.ts +10 -1
  129. package/dist/types/onchain/market/index.d.ts +2 -2
  130. package/dist/types/onchain/market/math.d.ts +5 -1
  131. package/dist/types/onchain/pools/types.d.ts +6 -4
  132. package/dist/types/onchain/utils/index.d.ts +2 -1
  133. package/dist/types/{common-utils → onchain}/utils/trace.d.ts +1 -1
  134. package/dist/types/preview/index.d.ts +2 -2
  135. package/dist/types/preview/preview/buildDelayedPreview.d.ts +1 -1
  136. package/dist/types/preview/trace/extractAdapterCallTraces.d.ts +1 -1
  137. package/dist/types/preview/trace/findFacadeCalls.d.ts +1 -1
  138. package/dist/types/preview/trace/types.d.ts +1 -1
  139. package/dist/types/preview/validate/checkOperation.d.ts +24 -7
  140. package/dist/types/preview/validate/index.d.ts +2 -2
  141. package/dist/types/rewards/rewards/extra-apy.d.ts +1 -1
  142. package/package.json +1 -6
  143. package/dist/cjs/common-utils/axios-cache/AxiosCache.js +0 -98
  144. package/dist/cjs/common-utils/axios-cache/index.js +0 -3
  145. package/dist/cjs/common-utils/charts/credit-manager-payload.js +0 -1
  146. package/dist/cjs/common-utils/charts/credit-manager.js +0 -100
  147. package/dist/cjs/common-utils/charts/credit-session.js +0 -211
  148. package/dist/cjs/common-utils/charts/credit-sessions-payload.js +0 -1
  149. package/dist/cjs/common-utils/charts/graph-payload.js +0 -1
  150. package/dist/cjs/common-utils/charts/index.js +0 -18
  151. package/dist/cjs/common-utils/charts/pool-payload.js +0 -1
  152. package/dist/cjs/common-utils/charts/pool.js +0 -177
  153. package/dist/cjs/common-utils/charts/token-data.js +0 -68
  154. package/dist/cjs/common-utils/index.js +0 -191
  155. package/dist/cjs/common-utils/package.json +0 -1
  156. package/dist/cjs/common-utils/static/index.js +0 -5
  157. package/dist/cjs/common-utils/static/migration-config.js +0 -1
  158. package/dist/cjs/common-utils/static/pool-config.js +0 -1
  159. package/dist/cjs/common-utils/static/strategy.js +0 -1
  160. package/dist/cjs/common-utils/static/trading-pair.js +0 -1
  161. package/dist/cjs/common-utils/test-utils/index.js +0 -105
  162. package/dist/cjs/common-utils/utils/apy/bonus-apy-from-points.js +0 -5
  163. package/dist/cjs/common-utils/utils/apy/calculate-borrow-rate-from-utilization.js +0 -22
  164. package/dist/cjs/common-utils/utils/apy/calculate-borrow-rate-from-utilization.spec.js +0 -34
  165. package/dist/cjs/common-utils/utils/apy/calculate-earnings.js +0 -23
  166. package/dist/cjs/common-utils/utils/apy/calculate-earnings.spec.js +0 -68
  167. package/dist/cjs/common-utils/utils/apy/calculate-effective-borrow-rate.js +0 -8
  168. package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.js +0 -20
  169. package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.spec.js +0 -39
  170. package/dist/cjs/common-utils/utils/apy/get-complex-apy-list.js +0 -18
  171. package/dist/cjs/common-utils/utils/apy/get-rate-with-fee.js +0 -16
  172. package/dist/cjs/common-utils/utils/apy/get-safe-base-borrow-rate.js +0 -14
  173. package/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +0 -16
  174. package/dist/cjs/common-utils/utils/apy/index.js +0 -21
  175. package/dist/cjs/common-utils/utils/apy/max-apy-formula.js +0 -14
  176. package/dist/cjs/common-utils/utils/assets-math.js +0 -185
  177. package/dist/cjs/common-utils/utils/constants.js +0 -9
  178. package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +0 -41
  179. package/dist/cjs/common-utils/utils/creditAccount/calc-overall-apy.js +0 -46
  180. package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +0 -22
  181. package/dist/cjs/common-utils/utils/creditAccount/calc-relative-base-borrow-rate.js +0 -16
  182. package/dist/cjs/common-utils/utils/creditAccount/debt.js +0 -46
  183. package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +0 -24
  184. package/dist/cjs/common-utils/utils/creditAccount/index.js +0 -27
  185. package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +0 -39
  186. package/dist/cjs/common-utils/utils/creditAccount/sort.js +0 -95
  187. package/dist/cjs/common-utils/utils/creditAccount/types.js +0 -1
  188. package/dist/cjs/common-utils/utils/index.js +0 -175
  189. package/dist/cjs/common-utils/utils/price-math.js +0 -51
  190. package/dist/cjs/common-utils/utils/strategies/assets/assets.js +0 -7
  191. package/dist/cjs/common-utils/utils/strategies/assets/index.js +0 -3
  192. package/dist/cjs/common-utils/utils/strategies/availability/check-boolean.js +0 -10
  193. package/dist/cjs/common-utils/utils/strategies/availability/check-degen-nft.js +0 -13
  194. package/dist/cjs/common-utils/utils/strategies/availability/index.js +0 -5
  195. package/dist/cjs/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.js +0 -23
  196. package/dist/cjs/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.spec.js +0 -109
  197. package/dist/cjs/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list-core.js +0 -31
  198. package/dist/cjs/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.js +0 -15
  199. package/dist/cjs/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.js +0 -23
  200. package/dist/cjs/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.js +0 -29
  201. package/dist/cjs/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.spec.js +0 -95
  202. package/dist/cjs/common-utils/utils/strategies/credit-managers/index.js +0 -13
  203. package/dist/cjs/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.js +0 -9
  204. package/dist/cjs/common-utils/utils/strategies/eligibility/index.js +0 -5
  205. package/dist/cjs/common-utils/utils/strategies/eligibility/is-strategy-eligible.js +0 -20
  206. package/dist/cjs/common-utils/utils/strategies/eligibility/is-strategy-released.js +0 -8
  207. package/dist/cjs/common-utils/utils/strategies/index.js +0 -121
  208. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-loss-coefficient.js +0 -10
  209. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +0 -16
  210. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +0 -21
  211. package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.spec.js +0 -304
  212. package/dist/cjs/common-utils/utils/strategies/leverage/get-collateral-by-debt.js +0 -10
  213. package/dist/cjs/common-utils/utils/strategies/leverage/get-collateral-by-debt.spec.js +0 -30
  214. package/dist/cjs/common-utils/utils/strategies/leverage/get-factor-from-leverage.js +0 -9
  215. package/dist/cjs/common-utils/utils/strategies/leverage/get-leverage-from-factor.js +0 -9
  216. package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-debt.js +0 -47
  217. package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-debt.spec.js +0 -222
  218. package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.js +0 -7
  219. package/dist/cjs/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.spec.js +0 -19
  220. package/dist/cjs/common-utils/utils/strategies/leverage/index.js +0 -21
  221. package/dist/cjs/common-utils/utils/strategies/leverage/max-leverage-threshold.js +0 -17
  222. package/dist/cjs/common-utils/utils/strategies/leverage/max-leverage.js +0 -17
  223. package/dist/cjs/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.js +0 -16
  224. package/dist/cjs/common-utils/utils/strategies/lists/get-available-strategies.js +0 -32
  225. package/dist/cjs/common-utils/utils/strategies/lists/get-disabled-strategies.js +0 -33
  226. package/dist/cjs/common-utils/utils/strategies/lists/get-released-strategies-list-core.js +0 -24
  227. package/dist/cjs/common-utils/utils/strategies/lists/get-released-strategies-list.js +0 -16
  228. package/dist/cjs/common-utils/utils/strategies/lists/index.js +0 -7
  229. package/dist/cjs/common-utils/utils/strategies/points/get-complex-points-list.js +0 -15
  230. package/dist/cjs/common-utils/utils/strategies/points/get-points-info.js +0 -12
  231. package/dist/cjs/common-utils/utils/strategies/points/get-points-rates.js +0 -8
  232. package/dist/cjs/common-utils/utils/strategies/points/get-strategy-points.js +0 -41
  233. package/dist/cjs/common-utils/utils/strategies/points/index.js +0 -9
  234. package/dist/cjs/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.js +0 -3
  235. package/dist/cjs/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.js +0 -18
  236. package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-apy.js +0 -63
  237. package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-apy.spec.js +0 -184
  238. package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.js +0 -38
  239. package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.spec.js +0 -126
  240. package/dist/cjs/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +0 -43
  241. package/dist/cjs/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +0 -135
  242. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +0 -297
  243. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-info-core.js +0 -70
  244. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-info.js +0 -33
  245. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.js +0 -66
  246. package/dist/cjs/common-utils/utils/strategies/strategy-info/get-strategy-you-can-earn.js +0 -58
  247. package/dist/cjs/common-utils/utils/strategies/strategy-info/index.js +0 -23
  248. package/dist/cjs/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.js +0 -9
  249. package/dist/cjs/common-utils/utils/strategies/strategy-info/types.js +0 -1
  250. package/dist/cjs/common-utils/utils/strategies/strategy-state/index.js +0 -3
  251. package/dist/cjs/common-utils/utils/strategies/strategy-state/is-strategy-disabled.js +0 -14
  252. package/dist/cjs/common-utils/utils/strategies/tokens/add-amount-in-target.js +0 -18
  253. package/dist/cjs/common-utils/utils/strategies/tokens/add-amount-in-target.spec.js +0 -29
  254. package/dist/cjs/common-utils/utils/strategies/tokens/get-chain-phantom-tokens.js +0 -10
  255. package/dist/cjs/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.js +0 -12
  256. package/dist/cjs/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.spec.js +0 -37
  257. package/dist/cjs/common-utils/utils/strategies/tokens/get-native-token-address.js +0 -8
  258. package/dist/cjs/common-utils/utils/strategies/tokens/index.js +0 -26
  259. package/dist/cjs/common-utils/utils/strategies/tokens/is-activated-token.js +0 -9
  260. package/dist/cjs/common-utils/utils/strategies/tokens/is-apy-with-points-exception.js +0 -10
  261. package/dist/cjs/common-utils/utils/strategies/tokens/is-collateral-token.js +0 -28
  262. package/dist/cjs/common-utils/utils/strategies/tokens/is-collateral-token.spec.js +0 -143
  263. package/dist/cjs/common-utils/utils/strategies/tokens/is-forbidden-token.js +0 -7
  264. package/dist/cjs/common-utils/utils/strategies/tokens/is-obtainable-token.js +0 -13
  265. package/dist/cjs/common-utils/utils/strategies/tokens/is-obtainable-token.spec.js +0 -148
  266. package/dist/cjs/common-utils/utils/strategies/tokens/is-usable-token.js +0 -15
  267. package/dist/cjs/common-utils/utils/strategies/tokens/is-valid-extra-collateral-token.js +0 -22
  268. package/dist/cjs/common-utils/utils/strategies/tokens/wrap-token-address.js +0 -8
  269. package/dist/cjs/common-utils/utils/strategies/tokens/wrap-token-address.spec.js +0 -15
  270. package/dist/cjs/common-utils/utils/strategies/types/chains.js +0 -1
  271. package/dist/cjs/common-utils/utils/strategies/types/credit-manager-data-legacy.js +0 -1
  272. package/dist/cjs/common-utils/utils/strategies/types/curator-filter.js +0 -1
  273. package/dist/cjs/common-utils/utils/strategies/types/index.js +0 -14
  274. package/dist/cjs/common-utils/utils/strategies/types/legacy-strategy-data-source.js +0 -30
  275. package/dist/cjs/common-utils/utils/strategies/types/points-slices.js +0 -1
  276. package/dist/cjs/common-utils/utils/strategies/types/sdk-state.js +0 -1
  277. package/dist/cjs/common-utils/utils/strategies/types/strategies-cm-list.js +0 -1
  278. package/dist/cjs/common-utils/utils/strategies/types/strategy-data-source.js +0 -1
  279. package/dist/cjs/common-utils/utils/strategies/types/strategy-data.js +0 -1
  280. package/dist/cjs/common-utils/utils/strategies/types/strategy-earnings.js +0 -1
  281. package/dist/cjs/common-utils/utils/strategies/types/strategy.js +0 -1
  282. package/dist/cjs/common-utils/utils/strategies/types/targetable.js +0 -1
  283. package/dist/cjs/common-utils/utils/strategies/types.js +0 -4
  284. package/dist/cjs/plugins/apy/ApyPlugin.js +0 -248
  285. package/dist/cjs/plugins/apy/apy-parser.js +0 -129
  286. package/dist/cjs/plugins/apy/constants.js +0 -7
  287. package/dist/cjs/plugins/apy/index.js +0 -18
  288. package/dist/cjs/plugins/apy/package.json +0 -1
  289. package/dist/cjs/plugins/apy/pool-apy-types.js +0 -1
  290. package/dist/cjs/plugins/apy/pool-apy-utils.js +0 -121
  291. package/dist/cjs/plugins/apy/strategy-data-source.js +0 -163
  292. package/dist/cjs/plugins/apy/types.js +0 -1
  293. package/dist/cjs/plugins/remote-configs/CustomConfigSource.js +0 -18
  294. package/dist/cjs/plugins/remote-configs/RemoteConfigSource.js +0 -26
  295. package/dist/cjs/plugins/remote-configs/RemoteConfigsPlugin.js +0 -127
  296. package/dist/cjs/plugins/remote-configs/index.js +0 -8
  297. package/dist/cjs/plugins/remote-configs/package.json +0 -1
  298. package/dist/cjs/plugins/remote-configs/types.js +0 -1
  299. package/dist/esm/common-utils/axios-cache/AxiosCache.js +0 -95
  300. package/dist/esm/common-utils/axios-cache/index.js +0 -2
  301. package/dist/esm/common-utils/charts/credit-manager-payload.js +0 -1
  302. package/dist/esm/common-utils/charts/credit-manager.js +0 -99
  303. package/dist/esm/common-utils/charts/credit-session.js +0 -206
  304. package/dist/esm/common-utils/charts/credit-sessions-payload.js +0 -1
  305. package/dist/esm/common-utils/charts/graph-payload.js +0 -1
  306. package/dist/esm/common-utils/charts/index.js +0 -9
  307. package/dist/esm/common-utils/charts/pool-payload.js +0 -1
  308. package/dist/esm/common-utils/charts/pool.js +0 -175
  309. package/dist/esm/common-utils/charts/token-data.js +0 -67
  310. package/dist/esm/common-utils/index.js +0 -87
  311. package/dist/esm/common-utils/package.json +0 -1
  312. package/dist/esm/common-utils/static/index.js +0 -5
  313. package/dist/esm/common-utils/static/migration-config.js +0 -1
  314. package/dist/esm/common-utils/static/pool-config.js +0 -1
  315. package/dist/esm/common-utils/static/strategy.js +0 -1
  316. package/dist/esm/common-utils/static/trading-pair.js +0 -1
  317. package/dist/esm/common-utils/test-utils/index.js +0 -93
  318. package/dist/esm/common-utils/utils/apy/bonus-apy-from-points.js +0 -4
  319. package/dist/esm/common-utils/utils/apy/calculate-borrow-rate-from-utilization.js +0 -21
  320. package/dist/esm/common-utils/utils/apy/calculate-borrow-rate-from-utilization.spec.js +0 -34
  321. package/dist/esm/common-utils/utils/apy/calculate-earnings.js +0 -22
  322. package/dist/esm/common-utils/utils/apy/calculate-earnings.spec.js +0 -68
  323. package/dist/esm/common-utils/utils/apy/calculate-effective-borrow-rate.js +0 -7
  324. package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.js +0 -19
  325. package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.spec.js +0 -39
  326. package/dist/esm/common-utils/utils/apy/get-complex-apy-list.js +0 -17
  327. package/dist/esm/common-utils/utils/apy/get-rate-with-fee.js +0 -15
  328. package/dist/esm/common-utils/utils/apy/get-safe-base-borrow-rate.js +0 -13
  329. package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +0 -15
  330. package/dist/esm/common-utils/utils/apy/index.js +0 -11
  331. package/dist/esm/common-utils/utils/apy/max-apy-formula.js +0 -13
  332. package/dist/esm/common-utils/utils/assets-math.js +0 -184
  333. package/dist/esm/common-utils/utils/constants.js +0 -6
  334. package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +0 -40
  335. package/dist/esm/common-utils/utils/creditAccount/calc-overall-apy.js +0 -45
  336. package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +0 -21
  337. package/dist/esm/common-utils/utils/creditAccount/calc-relative-base-borrow-rate.js +0 -15
  338. package/dist/esm/common-utils/utils/creditAccount/debt.js +0 -44
  339. package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +0 -23
  340. package/dist/esm/common-utils/utils/creditAccount/index.js +0 -10
  341. package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +0 -38
  342. package/dist/esm/common-utils/utils/creditAccount/sort.js +0 -90
  343. package/dist/esm/common-utils/utils/creditAccount/types.js +0 -1
  344. package/dist/esm/common-utils/utils/index.js +0 -81
  345. package/dist/esm/common-utils/utils/price-math.js +0 -50
  346. package/dist/esm/common-utils/utils/strategies/assets/assets.js +0 -6
  347. package/dist/esm/common-utils/utils/strategies/assets/index.js +0 -2
  348. package/dist/esm/common-utils/utils/strategies/availability/check-boolean.js +0 -9
  349. package/dist/esm/common-utils/utils/strategies/availability/check-degen-nft.js +0 -12
  350. package/dist/esm/common-utils/utils/strategies/availability/index.js +0 -3
  351. package/dist/esm/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.js +0 -22
  352. package/dist/esm/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.spec.js +0 -109
  353. package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list-core.js +0 -30
  354. package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.js +0 -14
  355. package/dist/esm/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.js +0 -22
  356. package/dist/esm/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.js +0 -28
  357. package/dist/esm/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.spec.js +0 -95
  358. package/dist/esm/common-utils/utils/strategies/credit-managers/index.js +0 -7
  359. package/dist/esm/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.js +0 -8
  360. package/dist/esm/common-utils/utils/strategies/eligibility/index.js +0 -3
  361. package/dist/esm/common-utils/utils/strategies/eligibility/is-strategy-eligible.js +0 -19
  362. package/dist/esm/common-utils/utils/strategies/eligibility/is-strategy-released.js +0 -7
  363. package/dist/esm/common-utils/utils/strategies/index.js +0 -66
  364. package/dist/esm/common-utils/utils/strategies/leverage/calculate-loss-coefficient.js +0 -9
  365. package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +0 -15
  366. package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +0 -20
  367. package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.spec.js +0 -304
  368. package/dist/esm/common-utils/utils/strategies/leverage/get-collateral-by-debt.js +0 -9
  369. package/dist/esm/common-utils/utils/strategies/leverage/get-collateral-by-debt.spec.js +0 -30
  370. package/dist/esm/common-utils/utils/strategies/leverage/get-factor-from-leverage.js +0 -8
  371. package/dist/esm/common-utils/utils/strategies/leverage/get-leverage-from-factor.js +0 -8
  372. package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-debt.js +0 -46
  373. package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-debt.spec.js +0 -222
  374. package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.js +0 -6
  375. package/dist/esm/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.spec.js +0 -19
  376. package/dist/esm/common-utils/utils/strategies/leverage/index.js +0 -11
  377. package/dist/esm/common-utils/utils/strategies/leverage/max-leverage-threshold.js +0 -16
  378. package/dist/esm/common-utils/utils/strategies/leverage/max-leverage.js +0 -16
  379. package/dist/esm/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.js +0 -15
  380. package/dist/esm/common-utils/utils/strategies/lists/get-available-strategies.js +0 -31
  381. package/dist/esm/common-utils/utils/strategies/lists/get-disabled-strategies.js +0 -32
  382. package/dist/esm/common-utils/utils/strategies/lists/get-released-strategies-list-core.js +0 -23
  383. package/dist/esm/common-utils/utils/strategies/lists/get-released-strategies-list.js +0 -15
  384. package/dist/esm/common-utils/utils/strategies/lists/index.js +0 -4
  385. package/dist/esm/common-utils/utils/strategies/points/get-complex-points-list.js +0 -14
  386. package/dist/esm/common-utils/utils/strategies/points/get-points-info.js +0 -11
  387. package/dist/esm/common-utils/utils/strategies/points/get-points-rates.js +0 -7
  388. package/dist/esm/common-utils/utils/strategies/points/get-strategy-points.js +0 -40
  389. package/dist/esm/common-utils/utils/strategies/points/index.js +0 -5
  390. package/dist/esm/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.js +0 -2
  391. package/dist/esm/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.js +0 -17
  392. package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-apy.js +0 -62
  393. package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-apy.spec.js +0 -184
  394. package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.js +0 -37
  395. package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.spec.js +0 -124
  396. package/dist/esm/common-utils/utils/strategies/strategy-info/cm-availability-condition.js +0 -42
  397. package/dist/esm/common-utils/utils/strategies/strategy-info/credit-manager-issues.js +0 -133
  398. package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +0 -296
  399. package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-info-core.js +0 -69
  400. package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-info.js +0 -32
  401. package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.js +0 -65
  402. package/dist/esm/common-utils/utils/strategies/strategy-info/get-strategy-you-can-earn.js +0 -57
  403. package/dist/esm/common-utils/utils/strategies/strategy-info/index.js +0 -12
  404. package/dist/esm/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.js +0 -8
  405. package/dist/esm/common-utils/utils/strategies/strategy-info/types.js +0 -1
  406. package/dist/esm/common-utils/utils/strategies/strategy-state/index.js +0 -2
  407. package/dist/esm/common-utils/utils/strategies/strategy-state/is-strategy-disabled.js +0 -13
  408. package/dist/esm/common-utils/utils/strategies/tokens/add-amount-in-target.js +0 -17
  409. package/dist/esm/common-utils/utils/strategies/tokens/add-amount-in-target.spec.js +0 -29
  410. package/dist/esm/common-utils/utils/strategies/tokens/get-chain-phantom-tokens.js +0 -9
  411. package/dist/esm/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.js +0 -11
  412. package/dist/esm/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.spec.js +0 -37
  413. package/dist/esm/common-utils/utils/strategies/tokens/get-native-token-address.js +0 -7
  414. package/dist/esm/common-utils/utils/strategies/tokens/index.js +0 -13
  415. package/dist/esm/common-utils/utils/strategies/tokens/is-activated-token.js +0 -8
  416. package/dist/esm/common-utils/utils/strategies/tokens/is-apy-with-points-exception.js +0 -8
  417. package/dist/esm/common-utils/utils/strategies/tokens/is-collateral-token.js +0 -27
  418. package/dist/esm/common-utils/utils/strategies/tokens/is-collateral-token.spec.js +0 -143
  419. package/dist/esm/common-utils/utils/strategies/tokens/is-forbidden-token.js +0 -6
  420. package/dist/esm/common-utils/utils/strategies/tokens/is-obtainable-token.js +0 -12
  421. package/dist/esm/common-utils/utils/strategies/tokens/is-obtainable-token.spec.js +0 -148
  422. package/dist/esm/common-utils/utils/strategies/tokens/is-usable-token.js +0 -14
  423. package/dist/esm/common-utils/utils/strategies/tokens/is-valid-extra-collateral-token.js +0 -21
  424. package/dist/esm/common-utils/utils/strategies/tokens/wrap-token-address.js +0 -7
  425. package/dist/esm/common-utils/utils/strategies/tokens/wrap-token-address.spec.js +0 -15
  426. package/dist/esm/common-utils/utils/strategies/types/chains.js +0 -1
  427. package/dist/esm/common-utils/utils/strategies/types/credit-manager-data-legacy.js +0 -1
  428. package/dist/esm/common-utils/utils/strategies/types/curator-filter.js +0 -1
  429. package/dist/esm/common-utils/utils/strategies/types/index.js +0 -13
  430. package/dist/esm/common-utils/utils/strategies/types/legacy-strategy-data-source.js +0 -29
  431. package/dist/esm/common-utils/utils/strategies/types/points-slices.js +0 -1
  432. package/dist/esm/common-utils/utils/strategies/types/sdk-state.js +0 -1
  433. package/dist/esm/common-utils/utils/strategies/types/strategies-cm-list.js +0 -1
  434. package/dist/esm/common-utils/utils/strategies/types/strategy-data-source.js +0 -1
  435. package/dist/esm/common-utils/utils/strategies/types/strategy-data.js +0 -1
  436. package/dist/esm/common-utils/utils/strategies/types/strategy-earnings.js +0 -1
  437. package/dist/esm/common-utils/utils/strategies/types/strategy.js +0 -1
  438. package/dist/esm/common-utils/utils/strategies/types/targetable.js +0 -1
  439. package/dist/esm/common-utils/utils/strategies/types.js +0 -3
  440. package/dist/esm/plugins/apy/ApyPlugin.js +0 -247
  441. package/dist/esm/plugins/apy/apy-parser.js +0 -126
  442. package/dist/esm/plugins/apy/constants.js +0 -5
  443. package/dist/esm/plugins/apy/index.js +0 -7
  444. package/dist/esm/plugins/apy/package.json +0 -1
  445. package/dist/esm/plugins/apy/pool-apy-types.js +0 -1
  446. package/dist/esm/plugins/apy/pool-apy-utils.js +0 -116
  447. package/dist/esm/plugins/apy/strategy-data-source.js +0 -162
  448. package/dist/esm/plugins/apy/types.js +0 -1
  449. package/dist/esm/plugins/remote-configs/CustomConfigSource.js +0 -17
  450. package/dist/esm/plugins/remote-configs/RemoteConfigSource.js +0 -25
  451. package/dist/esm/plugins/remote-configs/RemoteConfigsPlugin.js +0 -126
  452. package/dist/esm/plugins/remote-configs/index.js +0 -5
  453. package/dist/esm/plugins/remote-configs/package.json +0 -1
  454. package/dist/esm/plugins/remote-configs/types.js +0 -1
  455. package/dist/types/common-utils/axios-cache/AxiosCache.d.ts +0 -31
  456. package/dist/types/common-utils/axios-cache/index.d.ts +0 -2
  457. package/dist/types/common-utils/charts/credit-manager-payload.d.ts +0 -53
  458. package/dist/types/common-utils/charts/credit-manager.d.ts +0 -51
  459. package/dist/types/common-utils/charts/credit-session.d.ts +0 -113
  460. package/dist/types/common-utils/charts/credit-sessions-payload.d.ts +0 -113
  461. package/dist/types/common-utils/charts/graph-payload.d.ts +0 -12
  462. package/dist/types/common-utils/charts/index.d.ts +0 -9
  463. package/dist/types/common-utils/charts/pool-payload.d.ts +0 -114
  464. package/dist/types/common-utils/charts/pool.d.ts +0 -94
  465. package/dist/types/common-utils/charts/token-data.d.ts +0 -47
  466. package/dist/types/common-utils/index.d.ts +0 -107
  467. package/dist/types/common-utils/static/index.d.ts +0 -5
  468. package/dist/types/common-utils/static/migration-config.d.ts +0 -13
  469. package/dist/types/common-utils/static/pool-config.d.ts +0 -14
  470. package/dist/types/common-utils/static/strategy.d.ts +0 -86
  471. package/dist/types/common-utils/static/trading-pair.d.ts +0 -18
  472. package/dist/types/common-utils/test-utils/index.d.ts +0 -19
  473. package/dist/types/common-utils/utils/apy/bonus-apy-from-points.d.ts +0 -7
  474. package/dist/types/common-utils/utils/apy/calculate-borrow-rate-from-utilization.d.ts +0 -5
  475. package/dist/types/common-utils/utils/apy/calculate-borrow-rate-from-utilization.spec.d.ts +0 -1
  476. package/dist/types/common-utils/utils/apy/calculate-earnings.d.ts +0 -19
  477. package/dist/types/common-utils/utils/apy/calculate-earnings.spec.d.ts +0 -1
  478. package/dist/types/common-utils/utils/apy/calculate-effective-borrow-rate.d.ts +0 -9
  479. package/dist/types/common-utils/utils/apy/calculate-safe-borrow-rate.d.ts +0 -14
  480. package/dist/types/common-utils/utils/apy/calculate-safe-borrow-rate.spec.d.ts +0 -1
  481. package/dist/types/common-utils/utils/apy/get-complex-apy-list.d.ts +0 -8
  482. package/dist/types/common-utils/utils/apy/get-rate-with-fee.d.ts +0 -10
  483. package/dist/types/common-utils/utils/apy/get-safe-base-borrow-rate.d.ts +0 -7
  484. package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +0 -14
  485. package/dist/types/common-utils/utils/apy/index.d.ts +0 -11
  486. package/dist/types/common-utils/utils/apy/max-apy-formula.d.ts +0 -9
  487. package/dist/types/common-utils/utils/assets-math.d.ts +0 -117
  488. package/dist/types/common-utils/utils/constants.d.ts +0 -7
  489. package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +0 -32
  490. package/dist/types/common-utils/utils/creditAccount/calc-overall-apy.d.ts +0 -41
  491. package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +0 -24
  492. package/dist/types/common-utils/utils/creditAccount/calc-relative-base-borrow-rate.d.ts +0 -18
  493. package/dist/types/common-utils/utils/creditAccount/debt.d.ts +0 -39
  494. package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +0 -24
  495. package/dist/types/common-utils/utils/creditAccount/index.d.ts +0 -10
  496. package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +0 -31
  497. package/dist/types/common-utils/utils/creditAccount/sort.d.ts +0 -59
  498. package/dist/types/common-utils/utils/creditAccount/types.d.ts +0 -22
  499. package/dist/types/common-utils/utils/index.d.ts +0 -93
  500. package/dist/types/common-utils/utils/price-math.d.ts +0 -49
  501. package/dist/types/common-utils/utils/strategies/assets/assets.d.ts +0 -7
  502. package/dist/types/common-utils/utils/strategies/assets/index.d.ts +0 -2
  503. package/dist/types/common-utils/utils/strategies/availability/check-boolean.d.ts +0 -4
  504. package/dist/types/common-utils/utils/strategies/availability/check-degen-nft.d.ts +0 -8
  505. package/dist/types/common-utils/utils/strategies/availability/index.d.ts +0 -3
  506. package/dist/types/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.d.ts +0 -21
  507. package/dist/types/common-utils/utils/strategies/credit-managers/get-cm-allowed-collaterals.spec.d.ts +0 -1
  508. package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list-core.d.ts +0 -14
  509. package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers-list.d.ts +0 -10
  510. package/dist/types/common-utils/utils/strategies/credit-managers/get-strategy-credit-managers.d.ts +0 -12
  511. package/dist/types/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.d.ts +0 -17
  512. package/dist/types/common-utils/utils/strategies/credit-managers/get-wallet-balances-allowed-on-cm.spec.d.ts +0 -1
  513. package/dist/types/common-utils/utils/strategies/credit-managers/index.d.ts +0 -7
  514. package/dist/types/common-utils/utils/strategies/credit-managers/is-credit-manager-usable.d.ts +0 -6
  515. package/dist/types/common-utils/utils/strategies/eligibility/index.d.ts +0 -3
  516. package/dist/types/common-utils/utils/strategies/eligibility/is-strategy-eligible.d.ts +0 -16
  517. package/dist/types/common-utils/utils/strategies/eligibility/is-strategy-released.d.ts +0 -4
  518. package/dist/types/common-utils/utils/strategies/index.d.ts +0 -78
  519. package/dist/types/common-utils/utils/strategies/leverage/calculate-loss-coefficient.d.ts +0 -4
  520. package/dist/types/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.d.ts +0 -15
  521. package/dist/types/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.d.ts +0 -14
  522. package/dist/types/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.spec.d.ts +0 -1
  523. package/dist/types/common-utils/utils/strategies/leverage/get-collateral-by-debt.d.ts +0 -5
  524. package/dist/types/common-utils/utils/strategies/leverage/get-collateral-by-debt.spec.d.ts +0 -1
  525. package/dist/types/common-utils/utils/strategies/leverage/get-factor-from-leverage.d.ts +0 -7
  526. package/dist/types/common-utils/utils/strategies/leverage/get-leverage-from-factor.d.ts +0 -5
  527. package/dist/types/common-utils/utils/strategies/leverage/get-recommended-debt.d.ts +0 -24
  528. package/dist/types/common-utils/utils/strategies/leverage/get-recommended-debt.spec.d.ts +0 -1
  529. package/dist/types/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.d.ts +0 -7
  530. package/dist/types/common-utils/utils/strategies/leverage/get-recommended-leverage-factor.spec.d.ts +0 -1
  531. package/dist/types/common-utils/utils/strategies/leverage/index.d.ts +0 -11
  532. package/dist/types/common-utils/utils/strategies/leverage/max-leverage-threshold.d.ts +0 -8
  533. package/dist/types/common-utils/utils/strategies/leverage/max-leverage.d.ts +0 -12
  534. package/dist/types/common-utils/utils/strategies/lists/get-available-and-disabled-strategies.d.ts +0 -14
  535. package/dist/types/common-utils/utils/strategies/lists/get-available-strategies.d.ts +0 -11
  536. package/dist/types/common-utils/utils/strategies/lists/get-disabled-strategies.d.ts +0 -12
  537. package/dist/types/common-utils/utils/strategies/lists/get-released-strategies-list-core.d.ts +0 -16
  538. package/dist/types/common-utils/utils/strategies/lists/get-released-strategies-list.d.ts +0 -10
  539. package/dist/types/common-utils/utils/strategies/lists/index.d.ts +0 -4
  540. package/dist/types/common-utils/utils/strategies/points/get-complex-points-list.d.ts +0 -7
  541. package/dist/types/common-utils/utils/strategies/points/get-points-info.d.ts +0 -12
  542. package/dist/types/common-utils/utils/strategies/points/get-points-rates.d.ts +0 -6
  543. package/dist/types/common-utils/utils/strategies/points/get-strategy-points.d.ts +0 -27
  544. package/dist/types/common-utils/utils/strategies/points/index.d.ts +0 -5
  545. package/dist/types/common-utils/utils/strategies/sort-strategy-cms-by-availability/index.d.ts +0 -2
  546. package/dist/types/common-utils/utils/strategies/sort-strategy-cms-by-availability/sort-strategy-cms-by-availability.d.ts +0 -31
  547. package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-apy.d.ts +0 -31
  548. package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-apy.spec.d.ts +0 -1
  549. package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-points.d.ts +0 -26
  550. package/dist/types/common-utils/utils/strategies/strategy-info/calculate-total-points.spec.d.ts +0 -1
  551. package/dist/types/common-utils/utils/strategies/strategy-info/cm-availability-condition.d.ts +0 -6
  552. package/dist/types/common-utils/utils/strategies/strategy-info/credit-manager-issues.d.ts +0 -34
  553. package/dist/types/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.d.ts +0 -22
  554. package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-info-core.d.ts +0 -21
  555. package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-info.d.ts +0 -5
  556. package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-max-apy.d.ts +0 -17
  557. package/dist/types/common-utils/utils/strategies/strategy-info/get-strategy-you-can-earn.d.ts +0 -31
  558. package/dist/types/common-utils/utils/strategies/strategy-info/index.d.ts +0 -12
  559. package/dist/types/common-utils/utils/strategies/strategy-info/is-strategy-cm-disabled.d.ts +0 -5
  560. package/dist/types/common-utils/utils/strategies/strategy-info/types.d.ts +0 -113
  561. package/dist/types/common-utils/utils/strategies/strategy-state/index.d.ts +0 -2
  562. package/dist/types/common-utils/utils/strategies/strategy-state/is-strategy-disabled.d.ts +0 -7
  563. package/dist/types/common-utils/utils/strategies/tokens/add-amount-in-target.d.ts +0 -10
  564. package/dist/types/common-utils/utils/strategies/tokens/add-amount-in-target.spec.d.ts +0 -1
  565. package/dist/types/common-utils/utils/strategies/tokens/get-chain-phantom-tokens.d.ts +0 -8
  566. package/dist/types/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.d.ts +0 -16
  567. package/dist/types/common-utils/utils/strategies/tokens/get-list-with-amount-in-target.spec.d.ts +0 -1
  568. package/dist/types/common-utils/utils/strategies/tokens/get-native-token-address.d.ts +0 -4
  569. package/dist/types/common-utils/utils/strategies/tokens/index.d.ts +0 -13
  570. package/dist/types/common-utils/utils/strategies/tokens/is-activated-token.d.ts +0 -10
  571. package/dist/types/common-utils/utils/strategies/tokens/is-apy-with-points-exception.d.ts +0 -6
  572. package/dist/types/common-utils/utils/strategies/tokens/is-collateral-token.d.ts +0 -17
  573. package/dist/types/common-utils/utils/strategies/tokens/is-collateral-token.spec.d.ts +0 -1
  574. package/dist/types/common-utils/utils/strategies/tokens/is-forbidden-token.d.ts +0 -9
  575. package/dist/types/common-utils/utils/strategies/tokens/is-obtainable-token.d.ts +0 -11
  576. package/dist/types/common-utils/utils/strategies/tokens/is-obtainable-token.spec.d.ts +0 -1
  577. package/dist/types/common-utils/utils/strategies/tokens/is-usable-token.d.ts +0 -6
  578. package/dist/types/common-utils/utils/strategies/tokens/is-valid-extra-collateral-token.d.ts +0 -20
  579. package/dist/types/common-utils/utils/strategies/tokens/wrap-token-address.d.ts +0 -5
  580. package/dist/types/common-utils/utils/strategies/tokens/wrap-token-address.spec.d.ts +0 -1
  581. package/dist/types/common-utils/utils/strategies/types/chains.d.ts +0 -6
  582. package/dist/types/common-utils/utils/strategies/types/credit-manager-data-legacy.d.ts +0 -34
  583. package/dist/types/common-utils/utils/strategies/types/curator-filter.d.ts +0 -5
  584. package/dist/types/common-utils/utils/strategies/types/index.d.ts +0 -13
  585. package/dist/types/common-utils/utils/strategies/types/legacy-strategy-data-source.d.ts +0 -7
  586. package/dist/types/common-utils/utils/strategies/types/points-slices.d.ts +0 -24
  587. package/dist/types/common-utils/utils/strategies/types/sdk-state.d.ts +0 -17
  588. package/dist/types/common-utils/utils/strategies/types/strategies-cm-list.d.ts +0 -9
  589. package/dist/types/common-utils/utils/strategies/types/strategy-data-source.d.ts +0 -22
  590. package/dist/types/common-utils/utils/strategies/types/strategy-data.d.ts +0 -19
  591. package/dist/types/common-utils/utils/strategies/types/strategy-earnings.d.ts +0 -47
  592. package/dist/types/common-utils/utils/strategies/types/strategy.d.ts +0 -20
  593. package/dist/types/common-utils/utils/strategies/types/targetable.d.ts +0 -9
  594. package/dist/types/common-utils/utils/strategies/types.d.ts +0 -14
  595. package/dist/types/plugins/apy/ApyPlugin.d.ts +0 -59
  596. package/dist/types/plugins/apy/apy-parser.d.ts +0 -10
  597. package/dist/types/plugins/apy/constants.d.ts +0 -5
  598. package/dist/types/plugins/apy/index.d.ts +0 -7
  599. package/dist/types/plugins/apy/pool-apy-types.d.ts +0 -45
  600. package/dist/types/plugins/apy/pool-apy-utils.d.ts +0 -77
  601. package/dist/types/plugins/apy/strategy-data-source.d.ts +0 -21
  602. package/dist/types/plugins/apy/types.d.ts +0 -64
  603. package/dist/types/plugins/remote-configs/CustomConfigSource.d.ts +0 -16
  604. package/dist/types/plugins/remote-configs/RemoteConfigSource.d.ts +0 -35
  605. package/dist/types/plugins/remote-configs/RemoteConfigsPlugin.d.ts +0 -29
  606. package/dist/types/plugins/remote-configs/index.d.ts +0 -8
  607. package/dist/types/plugins/remote-configs/types.d.ts +0 -26
@@ -30,7 +30,7 @@ function checkOperation(input, options = {}) {
30
30
  case "RWAOpenCreditAccount":
31
31
  case "AdjustCreditAccount": return creditIssues(sdk, preview, options);
32
32
  case "CloseCreditAccount":
33
- case "RepayCreditAccount": return marketIssues(sdk, preview.creditManager);
33
+ case "RepayCreditAccount": return marketIssues(sdk.marketRegister.findCreditManager(preview.creditManager));
34
34
  }
35
35
  }
36
36
  function poolIssues(sdk, preview, options, isDeposit) {
@@ -49,8 +49,8 @@ function poolIssues(sdk, preview, options, isDeposit) {
49
49
  })) || fundingIssue(options, [preview.tokenIn]);
50
50
  }
51
51
  /** What the market itself refuses, whatever the operation does. */
52
- function marketIssues(sdk, creditManager) {
53
- const suite = sdk.marketRegister.findCreditManager(creditManager);
52
+ function marketIssues(suite) {
53
+ const creditManager = suite.creditManager.address;
54
54
  return checkCreditManagerPaused({
55
55
  isPaused: suite.isPaused,
56
56
  creditManager
@@ -65,29 +65,42 @@ function creditIssues(sdk, preview, options) {
65
65
  const market = suite.market;
66
66
  const underlying = toToken(sdk, market.pool.underlying);
67
67
  const isOpening = preview.operation === "OpenCreditAccount" || preview.operation === "RWAOpenCreditAccount";
68
- return marketIssues(sdk, preview.creditManager) || checkDebtInBand({
69
- debt: preview.debt,
68
+ return marketIssues(suite) || checkDebtInBand({
69
+ debt: preview.totalDebt.value,
70
70
  minDebt: suite.creditFacade.minDebt,
71
71
  maxDebt: suite.creditFacade.maxDebt,
72
72
  underlying,
73
73
  allowZero: !isOpening
74
- }) || borrowIssue(suite, preview, underlying) || forbiddenIssue(suite, preview) || checkQuotaCount({
75
- count: preview.quotas.filter((q) => q.value > 0n).length,
74
+ }) || borrowIssue(suite, preview, underlying) || forbiddenIssue(suite, preview) || quotaCountIssue(suite, preview) || quotaIssue(market, preview, underlying) || collateralIssue(preview, options) || fundingIssue(options, preview.collateralAdded);
75
+ }
76
+ /**
77
+ * A bar that reads nothing but the projected account, so a parsed transaction
78
+ * and a simulated one are held to it by the same code.
79
+ *
80
+ * These stay separate functions rather than one block because the order the
81
+ * checks run in is the answer: `checkOperation` interleaves the checks that
82
+ * need an operation's *delta* between them, and the caller acts on the first
83
+ * issue reported.
84
+ */
85
+ function quotaCountIssue(suite, projection) {
86
+ return checkQuotaCount({
87
+ count: projection.quotas.filter((q) => q.value > 0n).length,
76
88
  max: suite.creditManager.maxEnabledTokens
77
- }) || quotaIssue(market, preview, underlying) || (preview.debt === 0n ? null : collateralIssue(preview, options)) || fundingIssue(options, collateralOf(preview));
89
+ });
78
90
  }
79
91
  /**
80
92
  * What the transaction draws, against what the market can lend right now.
81
93
  *
82
94
  * Only a draw is weighed: repaying, or leaving the debt alone, can never exceed
83
- * a ceiling. Opening borrows the whole debt; adjusting borrows `debtChange`.
95
+ * a ceiling. Opening borrows the whole debt; adjusting borrows
96
+ * `totalDebtChange`.
84
97
  *
85
98
  * The engine holds every simulation to this already (`assertCanBorrow`), so
86
99
  * this is here for the transactions it never saw — a pasted calldata reaches
87
100
  * the confirm screen with nothing else standing between it and a revert.
88
101
  */
89
102
  function borrowIssue(suite, preview, underlying) {
90
- const drawn = preview.operation === "AdjustCreditAccount" ? preview.debtChange : preview.debt;
103
+ const drawn = preview.operation === "AdjustCreditAccount" ? preview.totalDebtChange.value : preview.totalDebt.value;
91
104
  if (drawn <= 0n) return null;
92
105
  const { limit, binding } = borrowable(suite);
93
106
  return checkBorrowLimit({
@@ -97,12 +110,27 @@ function borrowIssue(suite, preview, underlying) {
97
110
  underlying
98
111
  });
99
112
  }
100
- /** The account against whichever bars the caller holds it to. */
101
- function collateralIssue(preview, options) {
102
- return collateralIssuesOf({
103
- healthFactor: preview.healthFactor,
104
- safeHealthFactor: preview.safeHealthFactor
105
- }, options);
113
+ /**
114
+ * The account against whichever bars the caller holds it to.
115
+ *
116
+ * A loan-free account is nothing to weigh: the health factor reports its
117
+ * zero-debt sentinel and no bar applies.
118
+ *
119
+ * {@inheritDoc quotaCountIssue}
120
+ */
121
+ function collateralIssue(projection, options) {
122
+ const { minHealthFactor, minSafeHealthFactor, currentHealthFactor } = options;
123
+ if (projection.totalDebt.value === 0n) return null;
124
+ return (minHealthFactor === void 0 ? null : checkCollateralised({
125
+ healthFactor: projection.healthFactor,
126
+ required: minHealthFactor,
127
+ safePrices: false,
128
+ improvesFrom: currentHealthFactor
129
+ })) || (minSafeHealthFactor === void 0 || projection.safeHealthFactor === void 0 ? null : checkCollateralised({
130
+ healthFactor: projection.safeHealthFactor,
131
+ required: minSafeHealthFactor,
132
+ safePrices: true
133
+ }));
106
134
  }
107
135
  /** The wallet's side of the operation, against the balances it was given. */
108
136
  function fundingIssue(options, puts) {
@@ -118,12 +146,6 @@ function fundingIssue(options, puts) {
118
146
  }
119
147
  return null;
120
148
  }
121
- /** What the wallet puts in, which is what its balances have to cover. */
122
- function collateralOf(preview) {
123
- if ("collateral" in preview) return preview.collateral;
124
- if ("collateralAdded" in preview) return preview.collateralAdded;
125
- return [];
126
- }
127
149
  function forbiddenIssue(suite, preview) {
128
150
  const obtained = preview.operation === "AdjustCreditAccount" ? preview.assetsChange : preview.assets;
129
151
  const forbidden = suite.forbiddenTokens;
@@ -153,19 +175,5 @@ function quotaIssue(market, preview, underlying) {
153
175
  }
154
176
  return null;
155
177
  }
156
- /** The two collateral bars, shared by the preview and the simulation paths. */
157
- function collateralIssuesOf(factors, options) {
158
- const { minHealthFactor, minSafeHealthFactor, currentHealthFactor } = options;
159
- return (minHealthFactor === void 0 ? null : checkCollateralised({
160
- healthFactor: factors.healthFactor,
161
- required: minHealthFactor,
162
- safePrices: false,
163
- improvesFrom: currentHealthFactor
164
- })) || (minSafeHealthFactor === void 0 || factors.safeHealthFactor === void 0 ? null : checkCollateralised({
165
- healthFactor: factors.safeHealthFactor,
166
- required: minSafeHealthFactor,
167
- safePrices: true
168
- }));
169
- }
170
178
  //#endregion
171
- export { checkOperation, collateralIssuesOf };
179
+ export { checkOperation, collateralIssue, marketIssues, quotaCountIssue };
@@ -1,7 +1,7 @@
1
- import { checkCreditManagerPaused, checkDebtInBand, checkMarketExpired, checkQuotaCount } from "../../onchain/validation/checks.js";
1
+ import { checkDebtInBand } from "../../onchain/validation/checks.js";
2
2
  import { toToken } from "../../onchain/validation/token.js";
3
3
  import "../../onchain/index.js";
4
- import { collateralIssuesOf } from "./checkOperation.js";
4
+ import { collateralIssue, marketIssues, quotaCountIssue } from "./checkOperation.js";
5
5
  //#region src/preview/validate/checkSimulation.ts
6
6
  /**
7
7
  * Whether a simulated operation clears the caller's own bars.
@@ -26,26 +26,13 @@ import { collateralIssuesOf } from "./checkOperation.js";
26
26
  function checkSimulation(input, options = {}) {
27
27
  const { sdk, state, creditManager } = input;
28
28
  const suite = sdk.marketRegister.findCreditManager(creditManager);
29
- return checkCreditManagerPaused({
30
- isPaused: suite.isPaused,
31
- creditManager
32
- }) || checkMarketExpired({
33
- isExpired: suite.isExpired,
34
- creditManager,
35
- expirationDate: suite.creditFacade.expirationDate
36
- }) || checkDebtInBand({
37
- debt: state.accountDebt,
29
+ return marketIssues(suite) || checkDebtInBand({
30
+ debt: state.totalDebt.value,
38
31
  minDebt: suite.creditFacade.minDebt,
39
32
  maxDebt: suite.creditFacade.maxDebt,
40
33
  underlying: toToken(sdk, suite.market.pool.underlying),
41
34
  allowZero: true
42
- }) || checkQuotaCount({
43
- count: Object.values(state.quotas).filter((q) => q.balance > 0n).length,
44
- max: suite.creditManager.maxEnabledTokens
45
- }) || (state.accountDebt === 0n ? null : collateralIssuesOf({
46
- healthFactor: state.healthFactor,
47
- safeHealthFactor: state.safeHealthFactor
48
- }, options));
35
+ }) || quotaCountIssue(suite, state) || collateralIssue(state, options);
49
36
  }
50
37
  //#endregion
51
38
  export { checkSimulation };
@@ -1,3 +1,3 @@
1
- import { checkOperation, collateralIssuesOf } from "./checkOperation.js";
1
+ import { checkOperation, collateralIssue, marketIssues, quotaCountIssue } from "./checkOperation.js";
2
2
  import { checkSimulation } from "./checkSimulation.js";
3
- export { checkOperation, checkSimulation, collateralIssuesOf };
3
+ export { checkOperation, checkSimulation, collateralIssue, marketIssues, quotaCountIssue };
@@ -2,7 +2,6 @@ import { AddressMap } from "../../onchain/utils/AddressMap.js";
2
2
  import { BigIntMath } from "../../onchain/utils/bigint-math.js";
3
3
  import { toBigInt } from "../../onchain/utils/formatter.js";
4
4
  import "../../onchain/index.js";
5
- import "../../common-utils/index.js";
6
5
  import { MerkleXYZApi } from "./merkl-api.js";
7
6
  import { getAddress, isAddress } from "viem";
8
7
  //#region src/rewards/rewards/api.ts
@@ -3,7 +3,6 @@ import { chains } from "../../onchain/chain/chains.js";
3
3
  import { PERCENTAGE_FACTOR } from "../../onchain/constants/math.js";
4
4
  import { toBN } from "../../onchain/utils/formatter.js";
5
5
  import "../../onchain/index.js";
6
- import "../../common-utils/index.js";
7
6
  import axios from "axios";
8
7
  //#region src/rewards/rewards/extra-apy.ts
9
8
  function getKeyForPoolPointsInfo(i) {
@@ -24,21 +24,24 @@ function poolTx(sdk, request) {
24
24
  const { pool, wallet, sim } = request;
25
25
  const { tokenIn, tokenOut } = sim.preview;
26
26
  if (request.op === "deposit") {
27
- const meta = sdk.pools.getDepositMetadata(pool, tokenIn.token, tokenOut.token);
27
+ const meta = sdk.pools.getDepositMetadata(pool, tokenIn.token.address, tokenOut.token.address);
28
28
  const result = sdk.pools.addLiquidity({
29
29
  pool,
30
30
  wallet,
31
- collateral: tokenIn,
31
+ collateral: {
32
+ token: tokenIn.token.address,
33
+ balance: tokenIn.value
34
+ },
32
35
  meta
33
36
  });
34
- if (!result) throw new Error(`pool ${pool} takes no deposit transaction for ${tokenIn.token} (${meta.type})`);
37
+ if (!result) throw new Error(`pool ${pool} takes no deposit transaction for ${tokenIn.token.address} (${meta.type})`);
35
38
  return result.tx;
36
39
  }
37
- const meta = sdk.pools.getWithdrawalMetadata(pool, tokenIn.token, tokenOut.token);
40
+ const meta = sdk.pools.getWithdrawalMetadata(pool, tokenIn.token.address, tokenOut.token.address);
38
41
  return sdk.pools.removeLiquidity({
39
42
  pool,
40
43
  wallet,
41
- amount: request.op === "withdraw" ? tokenOut.balance : tokenIn.balance,
44
+ amount: request.op === "withdraw" ? tokenOut.value : tokenIn.value,
42
45
  permit: void 0,
43
46
  meta,
44
47
  mode: request.op === "withdraw" ? "withdraw" : "redeem"
@@ -52,7 +55,7 @@ async function openTx(sdk, request) {
52
55
  to: wallet,
53
56
  collateral,
54
57
  ethAmount,
55
- debt: preview.debt,
58
+ debt: preview.totalDebt.value,
56
59
  calls: preview.calls,
57
60
  averageQuota: preview.averageQuota,
58
61
  minQuota: preview.minQuota,
@@ -65,7 +65,10 @@ var PrepareApi = class extends MultichainConstruct {
65
65
  tokenOut
66
66
  });
67
67
  const call = pools.addLiquidity({
68
- collateral: preview.tokenIn,
68
+ collateral: {
69
+ token: preview.tokenIn.token.address,
70
+ balance: preview.tokenIn.value
71
+ },
69
72
  pool: pool.pool,
70
73
  wallet: params.wallet,
71
74
  meta: pools.getDepositMetadata(pool.pool, tokenIn, tokenOut)
@@ -1,6 +1,6 @@
1
1
  import { AddressMap } from "../onchain/utils/AddressMap.js";
2
2
  import { ParsedCallV2 } from "../onchain/base/types.js";
3
- import { CallTrace } from "../common-utils/utils/trace.js";
3
+ import { CallTrace } from "../onchain/utils/trace.js";
4
4
  import { ChainContractsRegister } from "../onchain/base/ChainContractsRegister.js";
5
5
  import "../onchain/index.js";
6
6
  import { TokenTransfer } from "../preview/parse/types-adapters.js";
@@ -15,8 +15,8 @@ import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
15
15
  import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
16
16
  import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
17
17
  import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
18
- import { AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview } from "./previews.js";
18
+ import { AccountProjection, AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview } from "./previews.js";
19
19
  import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
20
20
  import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
21
21
  import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
22
- export { AdjustCreditAccountPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreview, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayCreditAccountPreview, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
22
+ export { AccountProjection, AdjustCreditAccountPreview, Amount, ApyBreakdown, Asset, AssetType, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CloseCreditAccountPreview, CompareTag, CompareTolerance, Curator, CuratorName, DataResponse, DataSource, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedCreditAccountOperationPreview, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedWithdrawCollateralIntent, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantOperationPreview, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOperationPreview, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, RepayCreditAccountPreview, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, amountSchema, apyBreakdownSchema, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema };
@@ -137,8 +137,16 @@ interface PoolOperationPreview {
137
137
  */
138
138
  error?: OperationPreviewError;
139
139
  }
140
- interface OpenCreditAccountPreview {
141
- operation: "OpenCreditAccount" | "RWAOpenCreditAccount";
140
+ /**
141
+ * A credit account as an operation leaves it, answered by both halves of the
142
+ * SDK: `prepare`, which walks a request forward into the calls that realise it,
143
+ * and `preview`, which decodes calls that already exist and replays them back.
144
+ *
145
+ * `totalDebt`, `totalValue`, `leverage` and `healthFactor` mean here exactly
146
+ * what they mean on a {@link StrategyPosition}, down to the token an amount
147
+ * names — an RWA market reports USDC, not the dcUSDC wrapper the pool holds.
148
+ **/
149
+ interface AccountProjection {
142
150
  /**
143
151
  * Health factor in basis points: below `10000` the account is liquidatable.
144
152
  *
@@ -150,12 +158,14 @@ interface OpenCreditAccountPreview {
150
158
  * token's main and reserve oracle feeds, which is what the credit manager
151
159
  * switches to for a call that hands funds over.
152
160
  *
153
- * Always reported, so a caller that needs the stricter reading does not have
154
- * to recompute it; whether to hold the account to it is the caller's call.
161
+ * Absent only where the walk had no reason to weigh it: the intents engine
162
+ * computes it for an operation that hands funds over, which is the one the
163
+ * credit manager holds to safe prices on-chain. Both preview builders and
164
+ * `openNewStrategy` always report it.
155
165
  *
156
166
  * @example `11800` where `healthFactor` is `12500`
157
167
  **/
158
- safeHealthFactor: Bps;
168
+ safeHealthFactor?: Bps;
159
169
  /**
160
170
  * Cost of the debt, broken down by source.
161
171
  **/
@@ -177,6 +187,29 @@ interface OpenCreditAccountPreview {
177
187
  * unleveraged; `0` if underwater.
178
188
  **/
179
189
  leverage: Leverage;
190
+ /**
191
+ * Everything the account holds, denominated in the market's underlying.
192
+ **/
193
+ totalValue: TokenAmount;
194
+ /**
195
+ * What it would take to settle the loan: principal plus accrued interest and
196
+ * fees, in the market's underlying.
197
+ **/
198
+ totalDebt: TokenAmount;
199
+ /**
200
+ * What the account holds, token by token.
201
+ **/
202
+ assets: TokenAmount[];
203
+ /**
204
+ * Quota bought for each collateral, denominated in the market's underlying
205
+ * rather than in the collateral token — the same convention as
206
+ * {@link PositionCollateral.quota}. A token the account leaves unquoted is
207
+ * absent rather than present at zero.
208
+ **/
209
+ quotas: TokenAmount[];
210
+ }
211
+ interface OpenCreditAccountPreview extends AccountProjection {
212
+ operation: "OpenCreditAccount" | "RWAOpenCreditAccount";
180
213
  /**
181
214
  * Credit manager the account is opened in
182
215
  */
@@ -186,10 +219,10 @@ interface OpenCreditAccountPreview {
186
219
  */
187
220
  name: string;
188
221
  /**
189
- * Target token of strategy: the first quoted token, with its balance taken
190
- * from `assets`. Undefined when nothing is quoted.
222
+ * Collateral token this position is a strategy in: the first quoted token,
223
+ * with its balance taken from `assets`. Undefined when nothing is quoted.
191
224
  */
192
- target?: TokenAmount;
225
+ targetCollateral?: TokenAmount;
193
226
  /**
194
227
  * Tokens that were added as collateral during account opening.
195
228
  *
@@ -197,81 +230,21 @@ interface OpenCreditAccountPreview {
197
230
  * `NATIVE_ADDRESS` entry, with the wrapped native token amount reduced
198
231
  * accordingly (omitted entirely when it reaches zero).
199
232
  */
200
- collateral: TokenAmount[];
201
- /**
202
- * Sum of collateral tokens in underlying
203
- */
204
- collateralValue: bigint;
205
- /**
206
- * Total account value after opening: collateral plus borrowed amount, in
207
- * underlying.
208
- */
209
- totalValue: bigint;
210
- /**
211
- * Borrowed amount in underlying
212
- */
213
- debt: bigint;
214
- /**
215
- * WARNING: unlike every other `TokenAmount` in this model, `value` is
216
- * denominated in the market underlying, NOT in `token`. `token` only
217
- * identifies which collateral the quota applies to; `valueUsd` prices the
218
- * underlying amount.
219
- *
220
- * Desired quotas
221
- */
222
- quotas: TokenAmount[];
233
+ collateralAdded: TokenAmount[];
223
234
  /**
224
- * Minimum amount of assets on credit account after it's opened,
225
- * as estimated by router
235
+ * Own funds in the position: what the wallet put in, valued in underlying.
236
+ * `totalValue` is this plus the borrowed amount.
226
237
  */
227
- assets: TokenAmount[];
238
+ netValue: TokenAmount;
228
239
  /**
229
240
  * Set when preview encountered non-fatal errors, all fields are
230
- * still computed best-effort, but derived fields (`assets`, `target`,
231
- * `collateralValue`) may be unreliable in that case.
241
+ * still computed best-effort, but derived fields (`assets`,
242
+ * `targetCollateral`, `netValue`) may be unreliable in that case.
232
243
  */
233
244
  error?: OperationPreviewError;
234
245
  }
235
- interface AdjustCreditAccountPreview {
246
+ interface AdjustCreditAccountPreview extends AccountProjection {
236
247
  operation: "AdjustCreditAccount";
237
- /**
238
- * Health factor in basis points: below `10000` the account is liquidatable.
239
- *
240
- * @example `12500` for a health factor of 1.25
241
- **/
242
- healthFactor: Bps;
243
- /**
244
- * The same factor with collateral valued at safe prices — the lower of each
245
- * token's main and reserve oracle feeds, which is what the credit manager
246
- * switches to for a call that hands funds over.
247
- *
248
- * Always reported, so a caller that needs the stricter reading does not have
249
- * to recompute it; whether to hold the account to it is the caller's call.
250
- *
251
- * @example `11800` where `healthFactor` is `12500`
252
- **/
253
- safeHealthFactor: Bps;
254
- /**
255
- * Cost of the debt, broken down by source.
256
- **/
257
- borrowRate: BorrowRateBreakdown;
258
- /**
259
- * Estimated milliseconds until the health factor decays to `10000` under
260
- * the current borrow rate, or `null` when the debt carries no rate (or the
261
- * account is already liquidatable).
262
- **/
263
- timeToLiquidation: bigint | null;
264
- /**
265
- * Price of the single non-underlying collateral at which the account
266
- * becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
267
- * when the account holds zero or several non-underlying assets.
268
- **/
269
- liquidationPrice: bigint | null;
270
- /**
271
- * Total-value leverage: `totalValue / (totalValue − totalDebt)`. `1` =
272
- * unleveraged; `0` if underwater.
273
- **/
274
- leverage: Leverage;
275
248
  /**
276
249
  * Credit manager the account is opened in
277
250
  */
@@ -296,45 +269,18 @@ interface AdjustCreditAccountPreview {
296
269
  * Tokens that were withdrawn as collateral during account adjustment.
297
270
  */
298
271
  collateralWithdrawn: TokenAmount[];
299
- /**
300
- * Sum of collateral tokens in underlying
301
- */
302
- totalValue: bigint;
303
- /**
304
- * What the account owes in underlying once the operation lands: principal
305
- * plus accrued interest and fees, which is the amount it would take to
306
- * settle the loan — the same quantity `prepare` projects as `accountDebt`.
307
- */
308
- debt: bigint;
309
272
  /**
310
273
  * Debt after minus debt before. A repayment settles interest and fees
311
274
  * before principal, so this is the payment itself rather than the part of
312
275
  * it the principal happened to absorb.
313
276
  */
314
- debtChange: bigint;
277
+ totalDebtChange: TokenAmount;
315
278
  /**
316
- * WARNING: unlike every other `TokenAmount` in this model, `value` is
317
- * denominated in the market underlying, NOT in `token`. `token` only
318
- * identifies which collateral the quota applies to; `valueUsd` prices the
319
- * underlying amount.
320
- *
321
- * Desired quotas
322
- */
323
- quotas: TokenAmount[];
324
- /**
325
- * WARNING: unlike every other `TokenAmount` in this model, `value` is
326
- * denominated in the market underlying, NOT in `token`. `token` only
327
- * identifies which collateral the quota applies to; `valueUsd` prices the
328
- * underlying amount.
329
- *
330
- * Quotas after minus quotas before
279
+ * Quotas after minus quotas before. Denominated in the market's underlying
280
+ * like {@link AccountProjection.quotas}, so `token` names the collateral the
281
+ * quota applies to rather than the amount's own unit.
331
282
  */
332
283
  quotasChange: TokenAmount[];
333
- /**
334
- * Minimum amount of assets on credit account after the operation,
335
- * as estimated by router
336
- */
337
- assets: TokenAmount[];
338
284
  /**
339
285
  * Assets after minus assets before
340
286
  */
@@ -425,9 +371,13 @@ interface RepayCreditAccountPreview {
425
371
  */
426
372
  collateralWithdrawn: TokenAmount[];
427
373
  /**
428
- * Total debt repaid: principal + accrued interest + fees, in underlying
374
+ * Total debt repaid: principal + accrued interest + fees, in underlying.
375
+ *
376
+ * The same quantity an {@link AdjustCreditAccountPreview} reports as
377
+ * `totalDebtChange`, with the sign a repayment screen reads: positive for
378
+ * what the wallet parted with.
429
379
  */
430
- debtRepaid: bigint;
380
+ debtRepaid: TokenAmount;
431
381
  /**
432
382
  * Intent of the delayed withdrawal this transaction claims; set when the
433
383
  * multicall claims a delayed withdrawal
@@ -490,4 +440,4 @@ interface DelayedCreditAccountOperationPreview {
490
440
  */
491
441
  type OperationPreview = PoolOperationPreview | OpenCreditAccountPreview | AdjustCreditAccountPreview | CloseCreditAccountPreview | RepayCreditAccountPreview | DelayedCreditAccountOperationPreview;
492
442
  //#endregion
493
- export { AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview };
443
+ export { AccountProjection, AdjustCreditAccountPreview, CloseCreditAccountPreview, DelayedCreditAccountOperationPreview, ERROR_ADAPTER_CALL_OUTSIDE_BRACKET, ERROR_INVALID_TRANSACTION_VALUE, ERROR_MALFORMED_BRACKET, ERROR_NON_ADAPTER_CALL_IN_BRACKET, ERROR_UNPREVIEWABLE_ADAPTER_CALL, ERROR_UNPRICEABLE_TOKEN, ERROR_UNSUPPORTED_OUT_OF_BRACKET_CALL, InstantOperationPreview, OpenCreditAccountPreview, OperationPreview, OperationPreviewError, PoolOperationPreview, PoolOperationType, PreviewOperationInput, PreviewOperationOptions, RepayCreditAccountPreview };
@@ -22,6 +22,7 @@ import "./bots/index.js";
22
22
  import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
23
23
  import { borrowable } from "./intents/guards.js";
24
24
  import { LeverageBand } from "./intents/leverage-band.js";
25
+ import { CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, roundUpQuota } from "./quota-utils.js";
25
26
  import { AccountCalculatorOperation } from "./intents/operations.js";
26
27
  import { AddCollateralIntent, AdjustLeverageIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteRefusals, StartIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./intents/types.js";
27
28
  import { OpenStrategyPreview, OpenStrategyProps } from "./intents/open-strategy.js";
@@ -32,4 +33,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
32
33
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
33
34
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
34
35
  import "./liquidations/index.js";
35
- export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, borrowable, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
36
+ export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EncodableCreditAccountOperation, type FinishIntentProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, type OpenStrategyPreview, OpenStrategyPreviewResult, type OpenStrategyProps, type OperationState, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteRefusals, SetBotProps, SetBotResult, type StartIntent, type WithdrawAssetIntent, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, borrowable, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -1,5 +1,5 @@
1
1
  import { Bps, TokenAmount } from "../../../model/primitives.js";
2
- import { BorrowRateBreakdown } from "../../../model/positions.js";
2
+ import { AccountProjection } from "../../../model/previews.js";
3
3
  import "../../../model/index.js";
4
4
  import { Asset } from "../../base/types.js";
5
5
  import { MultiCall } from "../../types/transactions.js";
@@ -32,42 +32,28 @@ interface OpenStrategyProps {
32
32
  * hands back expected and floor balances from a single call, and `openCA` wants
33
33
  * both `minQuota` and `averageQuota`, so there is nothing to gain by dropping one.
34
34
  */
35
- interface OpenStrategyPreview {
35
+ interface OpenStrategyPreview extends Omit<AccountProjection, "assets" | "quotas"> {
36
36
  /**
37
- * Health factor in basis points: below `10000` the account is liquidatable.
38
- *
39
- * @example `12500` for a health factor of 1.25
40
- **/
41
- healthFactor: Bps;
42
- /**
43
- * Cost of the debt, broken down by source.
44
- **/
45
- borrowRate: BorrowRateBreakdown;
46
- /**
47
- * Estimated milliseconds until the health factor decays to `10000` under
48
- * the current borrow rate, or `null` when the debt carries no rate (or the
49
- * account is already liquidatable).
37
+ * The same factor with collateral valued at safe prices, which is what the
38
+ * credit manager weighs an opening at on-chain. Always reported here: an
39
+ * opening always hands the pool's funds over.
50
40
  **/
51
- timeToLiquidation: bigint | null;
52
- /**
53
- * Price of the single non-underlying collateral at which the account
54
- * becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
55
- * when the account holds zero or several non-underlying assets.
56
- **/
57
- liquidationPrice: bigint | null;
58
- /** Debt drawn, in underlying. */
59
- debt: bigint;
60
- /** Collateral supplied, valued in underlying. */
61
- collateral: bigint;
62
- /** Position size — collateral plus debt, in underlying. */
63
- totalValue: bigint;
41
+ safeHealthFactor: Bps;
42
+ /** Own funds put in, valued in underlying. */
43
+ netValue: TokenAmount;
64
44
  /** What the routed leg lost to market depth; `undefined` if not measured. */
65
45
  priceImpact: PathLossRate | undefined;
66
46
  /** Expected post-open balances. */
67
47
  averageAssets: TokenAmount[];
68
48
  /** Floor post-open balances after slippage. */
69
49
  minAssets: TokenAmount[];
70
- /** Quotas to buy against `averageAssets`; feeds `openCA.averageQuota`. */
50
+ /**
51
+ * Quotas to buy against `averageAssets`; feeds `openCA.averageQuota`.
52
+ *
53
+ * Bare pairs rather than priced amounts, like `calls` below: these three are
54
+ * transport for the transaction, handed to `openCA` untouched, and are the
55
+ * only fields here a caller is not meant to display.
56
+ **/
71
57
  averageQuota: Asset[];
72
58
  /** Quotas to buy against `minAssets`; feeds `openCA.minQuota`. */
73
59
  minQuota: Asset[];
@@ -3,7 +3,7 @@ import { Asset } from "../../base/types.js";
3
3
  import { MultiCall } from "../../types/transactions.js";
4
4
  import { OnchainSDK } from "../../OnchainSDK.js";
5
5
  import { EncodableCreditAccountOperation } from "../types.js";
6
- import { calcQuotaUpdate } from "../../../common-utils/utils/creditAccount/quota-utils.js";
6
+ import { calcQuotaUpdate } from "../quota-utils.js";
7
7
  import { CreditAccountSlice } from "./types.js";
8
8
  import "../../index.js";
9
9
  import { Address } from "viem";