@gearbox-protocol/sdk 15.1.0-next.1 → 15.1.0-next.10

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 (444) hide show
  1. package/dist/cjs/abi/iExpirable.js +15 -0
  2. package/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
  3. package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
  4. package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
  5. package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +8 -5
  6. package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +21 -11
  7. package/dist/cjs/dev/AccountOpener.js +0 -1
  8. package/dist/cjs/dev/compareOpportunities.js +218 -0
  9. package/dist/cjs/model/charts.js +147 -0
  10. package/dist/cjs/model/charts.schema.js +240 -0
  11. package/dist/cjs/model/index.js +35 -22
  12. package/dist/cjs/model/liquidations.schema.js +1 -1
  13. package/dist/cjs/model/notices.schema.js +25 -0
  14. package/dist/cjs/model/opportunities.schema.js +1 -1
  15. package/dist/cjs/model/positions.schema.js +48 -2
  16. package/dist/cjs/new-sdk/AbstractNamespace.js +34 -4
  17. package/dist/cjs/new-sdk/GearboxSDK.js +72 -3
  18. package/dist/cjs/new-sdk/execute/ExecuteApi.js +95 -0
  19. package/dist/cjs/new-sdk/execute/index.js +3 -0
  20. package/dist/cjs/new-sdk/index.js +7 -0
  21. package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +29 -6
  22. package/dist/cjs/new-sdk/positions/PositionsNamespace.js +3 -6
  23. package/dist/cjs/new-sdk/simulate/SimulateApi.js +361 -0
  24. package/dist/cjs/new-sdk/simulate/index.js +4 -0
  25. package/dist/cjs/new-sdk/utils/index.js +0 -1
  26. package/dist/cjs/offchain/AbstractOffchainNamespace.js +10 -7
  27. package/dist/cjs/offchain/GearboxAPI.js +7 -0
  28. package/dist/cjs/offchain/index.js +3 -0
  29. package/dist/cjs/offchain/notices/OffchainNotices.js +27 -0
  30. package/dist/cjs/offchain/notices/index.js +3 -0
  31. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +4 -8
  32. package/dist/cjs/offchain/positions/OffchainPositions.js +12 -12
  33. package/dist/cjs/preview/preview/CreditAccountState.js +14 -1
  34. package/dist/cjs/preview/preview/buildDelayedPreview.js +16 -6
  35. package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +9 -2
  36. package/dist/cjs/preview/preview/previewOpenCreditAccount.js +11 -3
  37. package/dist/cjs/preview/preview/previewOperation.js +1 -1
  38. package/dist/cjs/sdk/MultichainSDK.js +3 -4
  39. package/dist/cjs/sdk/OnchainSDK.js +42 -13
  40. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +2 -8
  41. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
  42. package/dist/cjs/sdk/accounts/index.js +5 -2
  43. package/dist/cjs/sdk/accounts/intents/guards.js +114 -0
  44. package/dist/cjs/sdk/accounts/intents/index.js +216 -358
  45. package/dist/cjs/sdk/accounts/intents/math.js +56 -0
  46. package/dist/cjs/sdk/accounts/intents/open-strategy.js +133 -0
  47. package/dist/cjs/sdk/accounts/intents/operations.js +165 -0
  48. package/dist/cjs/sdk/accounts/intents/plan.js +373 -0
  49. package/dist/cjs/sdk/accounts/intents/realize.js +301 -0
  50. package/dist/cjs/sdk/accounts/intents/testing/delayed.js +50 -0
  51. package/dist/cjs/sdk/accounts/intents/testing/market.js +166 -0
  52. package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +194 -35
  53. package/dist/cjs/sdk/accounts/intents/tests/add-collateral.fixtures.js +123 -0
  54. package/dist/cjs/sdk/accounts/intents/tests/adjust-leverage.fixtures.js +254 -0
  55. package/dist/cjs/sdk/accounts/intents/tests/deposit.fixtures.js +324 -0
  56. package/dist/cjs/sdk/accounts/intents/tests/finish-decrease-leverage.fixtures.js +242 -0
  57. package/dist/cjs/sdk/accounts/intents/tests/finish-withdraw.fixtures.js +383 -0
  58. package/dist/cjs/sdk/accounts/intents/tests/open-strategy.fixtures.js +133 -0
  59. package/dist/cjs/sdk/accounts/intents/tests/withdraw-asset.fixtures.js +131 -0
  60. package/dist/cjs/sdk/accounts/intents/tests/withdraw.fixtures.js +426 -0
  61. package/dist/cjs/sdk/accounts/intents/types.js +16 -0
  62. package/dist/cjs/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +18 -0
  63. package/dist/cjs/sdk/accounts/intents/utils/credit-account-slice.js +45 -0
  64. package/dist/cjs/sdk/accounts/intents/utils/index.js +17 -8
  65. package/dist/cjs/sdk/accounts/intents/utils/ledger.js +94 -0
  66. package/dist/cjs/sdk/accounts/intents/utils/pick-token.js +72 -0
  67. package/dist/cjs/sdk/accounts/intents/utils/quotas-for-update.js +27 -0
  68. package/dist/cjs/sdk/accounts/intents/utils/router-path.js +86 -0
  69. package/dist/cjs/sdk/accounts/intents/view.js +38 -0
  70. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +0 -3
  71. package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +29 -18
  72. package/dist/cjs/sdk/base/BaseContract.js +1 -1
  73. package/dist/cjs/sdk/base/TokensMeta.js +78 -27
  74. package/dist/cjs/sdk/index.js +30 -7
  75. package/dist/cjs/sdk/market/MarketRegister.js +16 -7
  76. package/dist/cjs/sdk/market/ZapperRegister.js +56 -25
  77. package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +1 -12
  78. package/dist/cjs/sdk/market/credit/CreditSuite.js +28 -9
  79. package/dist/cjs/sdk/market/credit/index.js +3 -0
  80. package/dist/cjs/sdk/market/credit/isStrategyCollateral.js +50 -0
  81. package/dist/cjs/sdk/market/index.js +17 -0
  82. package/dist/cjs/sdk/market/math.js +57 -44
  83. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
  84. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +15 -1
  85. package/dist/cjs/sdk/market/rwa/RWARegistry.js +22 -0
  86. package/dist/cjs/sdk/opportunities/index.js +0 -13
  87. package/dist/cjs/sdk/options.js +1 -5
  88. package/dist/cjs/sdk/pools/PoolService.js +132 -3
  89. package/dist/cjs/sdk/pools/index.js +2 -0
  90. package/dist/cjs/sdk/positions/PositionsService.js +213 -1
  91. package/dist/cjs/sdk/positions/calcBorrowRate.js +43 -0
  92. package/dist/cjs/sdk/positions/calcHealthFactor.js +52 -0
  93. package/dist/cjs/sdk/positions/calcLiquidationPrice.js +23 -0
  94. package/dist/cjs/sdk/positions/calcLiquidationPriceForTarget.js +30 -0
  95. package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +19 -0
  96. package/dist/cjs/sdk/positions/index.js +12 -1
  97. package/dist/cjs/sdk/positions/types.js +31 -0
  98. package/dist/cjs/sdk/utils/abi-decode.js +2 -2
  99. package/dist/cjs/sdk/utils/viem/executeMulticallBatches.js +32 -0
  100. package/dist/cjs/sdk/utils/viem/index.js +2 -0
  101. package/dist/esm/abi/iExpirable.js +14 -0
  102. package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
  103. package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
  104. package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
  105. package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +8 -5
  106. package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +21 -11
  107. package/dist/esm/dev/AccountOpener.js +1 -2
  108. package/dist/esm/dev/compareOpportunities.js +216 -0
  109. package/dist/esm/dev/withdrawalUtils.js +1 -1
  110. package/dist/esm/model/charts.js +140 -0
  111. package/dist/esm/model/charts.schema.js +226 -0
  112. package/dist/esm/model/index.js +9 -7
  113. package/dist/esm/model/liquidations.schema.js +1 -1
  114. package/dist/esm/model/notices.schema.js +23 -0
  115. package/dist/esm/model/opportunities.schema.js +1 -1
  116. package/dist/esm/model/positions.schema.js +46 -4
  117. package/dist/esm/new-sdk/AbstractNamespace.js +34 -4
  118. package/dist/esm/new-sdk/GearboxSDK.js +72 -4
  119. package/dist/esm/new-sdk/execute/ExecuteApi.js +94 -0
  120. package/dist/esm/new-sdk/execute/index.js +2 -0
  121. package/dist/esm/new-sdk/index.js +6 -2
  122. package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +29 -6
  123. package/dist/esm/new-sdk/positions/PositionsNamespace.js +3 -6
  124. package/dist/esm/new-sdk/simulate/SimulateApi.js +360 -0
  125. package/dist/esm/new-sdk/simulate/index.js +3 -0
  126. package/dist/esm/new-sdk/utils/index.js +0 -1
  127. package/dist/esm/offchain/AbstractOffchainNamespace.js +10 -7
  128. package/dist/esm/offchain/GearboxAPI.js +7 -0
  129. package/dist/esm/offchain/index.js +3 -1
  130. package/dist/esm/offchain/notices/OffchainNotices.js +26 -0
  131. package/dist/esm/offchain/notices/index.js +2 -0
  132. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +4 -8
  133. package/dist/esm/offchain/positions/OffchainPositions.js +12 -12
  134. package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
  135. package/dist/esm/preview/preview/CreditAccountState.js +14 -1
  136. package/dist/esm/preview/preview/buildDelayedPreview.js +16 -6
  137. package/dist/esm/preview/preview/previewAdjustCreditAccount.js +9 -2
  138. package/dist/esm/preview/preview/previewOpenCreditAccount.js +11 -3
  139. package/dist/esm/preview/preview/previewOperation.js +1 -1
  140. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  141. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  142. package/dist/esm/sdk/MultichainSDK.js +3 -4
  143. package/dist/esm/sdk/OnchainSDK.js +42 -13
  144. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +4 -10
  145. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
  146. package/dist/esm/sdk/accounts/index.js +3 -2
  147. package/dist/esm/sdk/accounts/intents/guards.js +108 -0
  148. package/dist/esm/sdk/accounts/intents/index.js +214 -358
  149. package/dist/esm/sdk/accounts/intents/math.js +51 -0
  150. package/dist/esm/sdk/accounts/intents/open-strategy.js +132 -0
  151. package/dist/esm/sdk/accounts/intents/operations.js +153 -0
  152. package/dist/esm/sdk/accounts/intents/plan.js +361 -0
  153. package/dist/esm/sdk/accounts/intents/realize.js +300 -0
  154. package/dist/esm/sdk/accounts/intents/testing/delayed.js +38 -0
  155. package/dist/esm/sdk/accounts/intents/testing/market.js +148 -0
  156. package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +194 -35
  157. package/dist/esm/sdk/accounts/intents/tests/add-collateral.fixtures.js +110 -0
  158. package/dist/esm/sdk/accounts/intents/tests/adjust-leverage.fixtures.js +234 -0
  159. package/dist/esm/sdk/accounts/intents/tests/deposit.fixtures.js +302 -0
  160. package/dist/esm/sdk/accounts/intents/tests/finish-decrease-leverage.fixtures.js +220 -0
  161. package/dist/esm/sdk/accounts/intents/tests/finish-withdraw.fixtures.js +355 -0
  162. package/dist/esm/sdk/accounts/intents/tests/open-strategy.fixtures.js +119 -0
  163. package/dist/esm/sdk/accounts/intents/tests/withdraw-asset.fixtures.js +117 -0
  164. package/dist/esm/sdk/accounts/intents/tests/withdraw.fixtures.js +402 -0
  165. package/dist/esm/sdk/accounts/intents/types.js +16 -1
  166. package/dist/esm/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +17 -0
  167. package/dist/esm/sdk/accounts/intents/utils/credit-account-slice.js +43 -0
  168. package/dist/esm/sdk/accounts/intents/utils/index.js +9 -7
  169. package/dist/esm/sdk/accounts/intents/utils/ledger.js +93 -0
  170. package/dist/esm/sdk/accounts/intents/utils/pick-token.js +68 -0
  171. package/dist/esm/sdk/accounts/intents/utils/quotas-for-update.js +27 -1
  172. package/dist/esm/sdk/accounts/intents/utils/router-path.js +85 -0
  173. package/dist/esm/sdk/accounts/intents/view.js +37 -0
  174. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -4
  175. package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +29 -18
  176. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  177. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  178. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  179. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  180. package/dist/esm/sdk/base/BaseContract.js +1 -1
  181. package/dist/esm/sdk/base/TokensMeta.js +80 -29
  182. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  183. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  184. package/dist/esm/sdk/index.js +13 -4
  185. package/dist/esm/sdk/market/MarketRegister.js +16 -7
  186. package/dist/esm/sdk/market/ZapperRegister.js +56 -25
  187. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  188. package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +2 -13
  189. package/dist/esm/sdk/market/credit/CreditSuite.js +29 -10
  190. package/dist/esm/sdk/market/credit/index.js +2 -1
  191. package/dist/esm/sdk/market/credit/isStrategyCollateral.js +48 -0
  192. package/dist/esm/sdk/market/index.js +3 -1
  193. package/dist/esm/sdk/market/math.js +52 -40
  194. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
  195. package/dist/esm/sdk/market/pool/PoolV310Contract.js +17 -3
  196. package/dist/esm/sdk/market/rwa/RWARegistry.js +22 -0
  197. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  198. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  199. package/dist/esm/sdk/opportunities/index.js +1 -2
  200. package/dist/esm/sdk/options.js +1 -5
  201. package/dist/esm/sdk/pools/PoolService.js +133 -6
  202. package/dist/esm/sdk/pools/index.js +2 -2
  203. package/dist/esm/sdk/positions/PositionsService.js +213 -1
  204. package/dist/esm/sdk/positions/calcBorrowRate.js +42 -0
  205. package/dist/esm/sdk/positions/calcHealthFactor.js +51 -0
  206. package/dist/esm/sdk/positions/calcLiquidationPrice.js +22 -0
  207. package/dist/esm/sdk/positions/calcLiquidationPriceForTarget.js +29 -0
  208. package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +18 -0
  209. package/dist/esm/sdk/positions/index.js +7 -2
  210. package/dist/esm/sdk/positions/types.js +31 -1
  211. package/dist/esm/sdk/utils/abi-decode.js +2 -2
  212. package/dist/esm/sdk/utils/viem/executeMulticallBatches.js +31 -0
  213. package/dist/esm/sdk/utils/viem/index.js +2 -1
  214. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  215. package/dist/types/abi/iExpirable.d.ts +14 -0
  216. package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +2 -0
  217. package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +3 -0
  218. package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +2 -0
  219. package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +6 -1
  220. package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +3 -0
  221. package/dist/types/dev/compareOpportunities.d.ts +153 -0
  222. package/dist/types/model/charts.d.ts +349 -0
  223. package/dist/types/model/charts.schema.d.ts +364 -0
  224. package/dist/types/model/index.d.ts +8 -6
  225. package/dist/types/model/notices.d.ts +29 -0
  226. package/dist/types/model/notices.schema.d.ts +23 -0
  227. package/dist/types/model/opportunities.d.ts +9 -9
  228. package/dist/types/model/positions.d.ts +133 -7
  229. package/dist/types/model/positions.schema.d.ts +128 -1
  230. package/dist/types/new-sdk/AbstractNamespace.d.ts +15 -2
  231. package/dist/types/new-sdk/GearboxSDK.d.ts +14 -2
  232. package/dist/types/new-sdk/execute/ExecuteApi.d.ts +108 -0
  233. package/dist/types/new-sdk/execute/index.d.ts +2 -0
  234. package/dist/types/new-sdk/index.d.ts +8 -4
  235. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +19 -7
  236. package/dist/types/new-sdk/opportunities/types.d.ts +30 -9
  237. package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +4 -5
  238. package/dist/types/new-sdk/positions/types.d.ts +9 -9
  239. package/dist/types/new-sdk/simulate/SimulateApi.d.ts +90 -0
  240. package/dist/types/new-sdk/simulate/index.d.ts +3 -0
  241. package/dist/types/new-sdk/simulate/types.d.ts +508 -0
  242. package/dist/types/new-sdk/types.d.ts +35 -1
  243. package/dist/types/new-sdk/utils/index.d.ts +1 -2
  244. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +5 -21
  245. package/dist/types/offchain/GearboxAPI.d.ts +6 -0
  246. package/dist/types/offchain/index.d.ts +4 -2
  247. package/dist/types/offchain/notices/OffchainNotices.d.ts +19 -0
  248. package/dist/types/offchain/notices/index.d.ts +2 -0
  249. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +8 -4
  250. package/dist/types/offchain/positions/OffchainPositions.d.ts +8 -6
  251. package/dist/types/preview/preview/CreditAccountState.d.ts +6 -0
  252. package/dist/types/preview/preview/buildDelayedPreview.d.ts +5 -1
  253. package/dist/types/preview/preview/types.d.ts +4 -2
  254. package/dist/types/sdk/MultichainSDK.d.ts +0 -5
  255. package/dist/types/sdk/OnchainSDK.d.ts +1 -5
  256. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -7
  257. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +3 -12
  258. package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +2 -2
  259. package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +1 -19
  260. package/dist/types/sdk/accounts/index.d.ts +7 -5
  261. package/dist/types/sdk/accounts/intents/guards.d.ts +72 -0
  262. package/dist/types/sdk/accounts/intents/index.d.ts +130 -15
  263. package/dist/types/sdk/accounts/intents/math.d.ts +46 -0
  264. package/dist/types/sdk/accounts/intents/open-strategy.d.ts +64 -0
  265. package/dist/types/sdk/accounts/intents/operations.d.ts +215 -0
  266. package/dist/types/sdk/accounts/intents/plan.d.ts +189 -0
  267. package/dist/types/sdk/accounts/intents/realize.d.ts +35 -0
  268. package/dist/types/sdk/accounts/intents/testing/delayed.d.ts +50 -0
  269. package/dist/types/sdk/accounts/intents/testing/expect.d.ts +17 -21
  270. package/dist/types/sdk/accounts/intents/testing/market.d.ts +91 -0
  271. package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +64 -16
  272. package/dist/types/sdk/accounts/intents/tests/add-collateral.fixtures.d.ts +45 -0
  273. package/dist/types/sdk/accounts/intents/tests/adjust-leverage.fixtures.d.ts +56 -0
  274. package/dist/types/sdk/accounts/intents/tests/deposit.fixtures.d.ts +64 -0
  275. package/dist/types/sdk/accounts/intents/tests/finish-decrease-leverage.fixtures.d.ts +107 -0
  276. package/dist/types/sdk/accounts/intents/tests/finish-withdraw.fixtures.d.ts +136 -0
  277. package/dist/types/sdk/accounts/intents/tests/open-strategy.fixtures.d.ts +56 -0
  278. package/dist/types/sdk/accounts/intents/tests/withdraw-asset.fixtures.d.ts +60 -0
  279. package/dist/types/sdk/accounts/intents/tests/withdraw.fixtures.d.ts +79 -0
  280. package/dist/types/sdk/accounts/intents/types.d.ts +369 -43
  281. package/dist/types/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts +13 -0
  282. package/dist/types/sdk/accounts/intents/utils/assemble-operation-calls.d.ts +1 -1
  283. package/dist/types/sdk/accounts/intents/utils/credit-account-slice.d.ts +29 -0
  284. package/dist/types/sdk/accounts/intents/utils/index.d.ts +7 -5
  285. package/dist/types/sdk/accounts/intents/utils/ledger.d.ts +41 -0
  286. package/dist/types/sdk/accounts/intents/utils/pick-token.d.ts +55 -0
  287. package/dist/types/sdk/accounts/intents/utils/quotas-for-update.d.ts +15 -4
  288. package/dist/types/sdk/accounts/intents/utils/router-path.d.ts +70 -0
  289. package/dist/types/sdk/accounts/intents/view.d.ts +15 -0
  290. package/dist/types/sdk/accounts/types.d.ts +17 -14
  291. package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +6 -0
  292. package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +18 -0
  293. package/dist/types/sdk/base/TokensMeta.d.ts +44 -1
  294. package/dist/types/sdk/base/index.d.ts +2 -2
  295. package/dist/types/sdk/base/token-types.d.ts +12 -1
  296. package/dist/types/sdk/index.d.ts +28 -19
  297. package/dist/types/sdk/market/MarketRegister.d.ts +7 -3
  298. package/dist/types/sdk/market/ZapperRegister.d.ts +20 -2
  299. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +0 -4
  300. package/dist/types/sdk/market/credit/CreditSuite.d.ts +6 -3
  301. package/dist/types/sdk/market/credit/index.d.ts +2 -1
  302. package/dist/types/sdk/market/credit/isStrategyCollateral.d.ts +74 -0
  303. package/dist/types/sdk/market/credit/types.d.ts +2 -9
  304. package/dist/types/sdk/market/index.d.ts +4 -2
  305. package/dist/types/sdk/market/math.d.ts +44 -34
  306. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +6 -2
  307. package/dist/types/sdk/market/oracle/types.d.ts +10 -2
  308. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +5 -0
  309. package/dist/types/sdk/market/pool/types.d.ts +5 -0
  310. package/dist/types/sdk/market/rwa/RWARegistry.d.ts +13 -0
  311. package/dist/types/sdk/market/types.d.ts +5 -1
  312. package/dist/types/sdk/opportunities/index.d.ts +1 -2
  313. package/dist/types/sdk/options.d.ts +0 -1
  314. package/dist/types/sdk/pools/PoolService.d.ts +32 -2
  315. package/dist/types/sdk/pools/index.d.ts +3 -3
  316. package/dist/types/sdk/pools/types.d.ts +109 -4
  317. package/dist/types/sdk/positions/PositionsService.d.ts +33 -2
  318. package/dist/types/sdk/positions/calcBorrowRate.d.ts +40 -0
  319. package/dist/types/sdk/positions/calcHealthFactor.d.ts +55 -0
  320. package/dist/types/sdk/positions/calcLiquidationPrice.d.ts +12 -0
  321. package/dist/types/sdk/positions/calcLiquidationPriceForTarget.d.ts +43 -0
  322. package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +16 -0
  323. package/dist/types/sdk/positions/index.d.ts +7 -2
  324. package/dist/types/sdk/positions/types.d.ts +58 -1
  325. package/dist/types/sdk/types/state.d.ts +6 -0
  326. package/dist/types/sdk/utils/viem/executeMulticallBatches.d.ts +39 -0
  327. package/dist/types/sdk/utils/viem/index.d.ts +3 -2
  328. package/package.json +2 -1
  329. package/dist/cjs/model/history.js +0 -53
  330. package/dist/cjs/model/history.schema.js +0 -128
  331. package/dist/cjs/sdk/accounts/intents/intents/index.js +0 -14
  332. package/dist/cjs/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.js +0 -121
  333. package/dist/cjs/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.js +0 -15
  334. package/dist/cjs/sdk/accounts/intents/intents/resume/close/close.fixtures.js +0 -108
  335. package/dist/cjs/sdk/accounts/intents/intents/resume/close/close.js +0 -51
  336. package/dist/cjs/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.js +0 -130
  337. package/dist/cjs/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.js +0 -83
  338. package/dist/cjs/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.js +0 -117
  339. package/dist/cjs/sdk/accounts/intents/intents/resume/deposit/deposit.js +0 -15
  340. package/dist/cjs/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.js +0 -95
  341. package/dist/cjs/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.js +0 -15
  342. package/dist/cjs/sdk/accounts/intents/intents/resume/index.js +0 -13
  343. package/dist/cjs/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.js +0 -138
  344. package/dist/cjs/sdk/accounts/intents/intents/resume/withdraw/withdraw.js +0 -161
  345. package/dist/cjs/sdk/accounts/intents/operations/add-collateral/index.js +0 -17
  346. package/dist/cjs/sdk/accounts/intents/operations/claim-delayed/index.js +0 -54
  347. package/dist/cjs/sdk/accounts/intents/operations/close-credit-account/index.js +0 -26
  348. package/dist/cjs/sdk/accounts/intents/operations/decrease-debt/index.js +0 -12
  349. package/dist/cjs/sdk/accounts/intents/operations/increase-debt/index.js +0 -12
  350. package/dist/cjs/sdk/accounts/intents/operations/index.js +0 -27
  351. package/dist/cjs/sdk/accounts/intents/operations/quota-update/index.js +0 -22
  352. package/dist/cjs/sdk/accounts/intents/operations/repay-credit-account/index.js +0 -22
  353. package/dist/cjs/sdk/accounts/intents/operations/start-delayed-withdrawal/index.js +0 -18
  354. package/dist/cjs/sdk/accounts/intents/operations/swap/index.js +0 -18
  355. package/dist/cjs/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +0 -27
  356. package/dist/cjs/sdk/accounts/intents/operations/withdraw-collateral/index.js +0 -43
  357. package/dist/cjs/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +0 -27
  358. package/dist/cjs/sdk/accounts/intents/quoters/close.js +0 -58
  359. package/dist/cjs/sdk/accounts/intents/quoters/index.js +0 -7
  360. package/dist/cjs/sdk/accounts/intents/quoters/swap.js +0 -79
  361. package/dist/cjs/sdk/accounts/intents/testing/expect.js +0 -167
  362. package/dist/cjs/sdk/accounts/intents/testing/resume.js +0 -172
  363. package/dist/cjs/sdk/accounts/intents/utils/simulate-adjust-state.js +0 -39
  364. package/dist/cjs/sdk/accounts/intents/utils/simulate-assets.js +0 -69
  365. package/dist/cjs/sdk/accounts/intents/utils/with-quota-update.js +0 -13
  366. package/dist/esm/model/history.js +0 -49
  367. package/dist/esm/model/history.schema.js +0 -116
  368. package/dist/esm/sdk/accounts/intents/intents/index.js +0 -8
  369. package/dist/esm/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.js +0 -107
  370. package/dist/esm/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.js +0 -14
  371. package/dist/esm/sdk/accounts/intents/intents/resume/close/close.fixtures.js +0 -94
  372. package/dist/esm/sdk/accounts/intents/intents/resume/close/close.js +0 -50
  373. package/dist/esm/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.js +0 -114
  374. package/dist/esm/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.js +0 -82
  375. package/dist/esm/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.js +0 -110
  376. package/dist/esm/sdk/accounts/intents/intents/resume/deposit/deposit.js +0 -14
  377. package/dist/esm/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.js +0 -88
  378. package/dist/esm/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.js +0 -14
  379. package/dist/esm/sdk/accounts/intents/intents/resume/index.js +0 -7
  380. package/dist/esm/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.js +0 -121
  381. package/dist/esm/sdk/accounts/intents/intents/resume/withdraw/withdraw.js +0 -160
  382. package/dist/esm/sdk/accounts/intents/operations/add-collateral/index.js +0 -16
  383. package/dist/esm/sdk/accounts/intents/operations/claim-delayed/index.js +0 -52
  384. package/dist/esm/sdk/accounts/intents/operations/close-credit-account/index.js +0 -25
  385. package/dist/esm/sdk/accounts/intents/operations/decrease-debt/index.js +0 -11
  386. package/dist/esm/sdk/accounts/intents/operations/increase-debt/index.js +0 -11
  387. package/dist/esm/sdk/accounts/intents/operations/index.js +0 -14
  388. package/dist/esm/sdk/accounts/intents/operations/quota-update/index.js +0 -21
  389. package/dist/esm/sdk/accounts/intents/operations/repay-credit-account/index.js +0 -21
  390. package/dist/esm/sdk/accounts/intents/operations/start-delayed-withdrawal/index.js +0 -17
  391. package/dist/esm/sdk/accounts/intents/operations/swap/index.js +0 -17
  392. package/dist/esm/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +0 -26
  393. package/dist/esm/sdk/accounts/intents/operations/withdraw-collateral/index.js +0 -42
  394. package/dist/esm/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +0 -26
  395. package/dist/esm/sdk/accounts/intents/quoters/close.js +0 -56
  396. package/dist/esm/sdk/accounts/intents/quoters/index.js +0 -3
  397. package/dist/esm/sdk/accounts/intents/quoters/swap.js +0 -77
  398. package/dist/esm/sdk/accounts/intents/testing/expect.js +0 -162
  399. package/dist/esm/sdk/accounts/intents/testing/resume.js +0 -157
  400. package/dist/esm/sdk/accounts/intents/utils/simulate-adjust-state.js +0 -38
  401. package/dist/esm/sdk/accounts/intents/utils/simulate-assets.js +0 -68
  402. package/dist/esm/sdk/accounts/intents/utils/with-quota-update.js +0 -12
  403. package/dist/types/model/history.d.ts +0 -153
  404. package/dist/types/model/history.schema.d.ts +0 -95
  405. package/dist/types/new-sdk/utils/history.d.ts +0 -18
  406. package/dist/types/sdk/accounts/intents/intents/index.d.ts +0 -8
  407. package/dist/types/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.d.ts +0 -13
  408. package/dist/types/sdk/accounts/intents/intents/resume/add-collateral/add-collateral.fixtures.d.ts +0 -38
  409. package/dist/types/sdk/accounts/intents/intents/resume/close/close.d.ts +0 -26
  410. package/dist/types/sdk/accounts/intents/intents/resume/close/close.fixtures.d.ts +0 -63
  411. package/dist/types/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.d.ts +0 -26
  412. package/dist/types/sdk/accounts/intents/intents/resume/decrease-leverage/decrease-leverage.fixtures.d.ts +0 -86
  413. package/dist/types/sdk/accounts/intents/intents/resume/deposit/deposit.d.ts +0 -13
  414. package/dist/types/sdk/accounts/intents/intents/resume/deposit/deposit.fixtures.d.ts +0 -48
  415. package/dist/types/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.d.ts +0 -13
  416. package/dist/types/sdk/accounts/intents/intents/resume/increase-leverage/increase-leverage.fixtures.d.ts +0 -46
  417. package/dist/types/sdk/accounts/intents/intents/resume/index.d.ts +0 -7
  418. package/dist/types/sdk/accounts/intents/intents/resume/withdraw/withdraw.d.ts +0 -33
  419. package/dist/types/sdk/accounts/intents/intents/resume/withdraw/withdraw.fixtures.d.ts +0 -68
  420. package/dist/types/sdk/accounts/intents/operations/add-collateral/index.d.ts +0 -23
  421. package/dist/types/sdk/accounts/intents/operations/claim-delayed/index.d.ts +0 -55
  422. package/dist/types/sdk/accounts/intents/operations/close-credit-account/index.d.ts +0 -22
  423. package/dist/types/sdk/accounts/intents/operations/decrease-debt/index.d.ts +0 -18
  424. package/dist/types/sdk/accounts/intents/operations/increase-debt/index.d.ts +0 -18
  425. package/dist/types/sdk/accounts/intents/operations/index.d.ts +0 -14
  426. package/dist/types/sdk/accounts/intents/operations/quota-update/index.d.ts +0 -24
  427. package/dist/types/sdk/accounts/intents/operations/repay-credit-account/index.d.ts +0 -31
  428. package/dist/types/sdk/accounts/intents/operations/start-delayed-withdrawal/index.d.ts +0 -23
  429. package/dist/types/sdk/accounts/intents/operations/swap/index.d.ts +0 -28
  430. package/dist/types/sdk/accounts/intents/operations/types.d.ts +0 -21
  431. package/dist/types/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.d.ts +0 -30
  432. package/dist/types/sdk/accounts/intents/operations/withdraw-collateral/index.d.ts +0 -36
  433. package/dist/types/sdk/accounts/intents/operations/wrap-rwa-collateral/index.d.ts +0 -30
  434. package/dist/types/sdk/accounts/intents/quoters/close.d.ts +0 -43
  435. package/dist/types/sdk/accounts/intents/quoters/index.d.ts +0 -3
  436. package/dist/types/sdk/accounts/intents/quoters/swap.d.ts +0 -43
  437. package/dist/types/sdk/accounts/intents/testing/resume.d.ts +0 -84
  438. package/dist/types/sdk/accounts/intents/utils/simulate-adjust-state.d.ts +0 -19
  439. package/dist/types/sdk/accounts/intents/utils/simulate-assets.d.ts +0 -21
  440. package/dist/types/sdk/accounts/intents/utils/with-quota-update.d.ts +0 -16
  441. /package/dist/cjs/{new-sdk/utils/history.js → model/notices.js} +0 -0
  442. /package/dist/cjs/{sdk/accounts/intents/operations → new-sdk/simulate}/types.js +0 -0
  443. /package/dist/esm/{new-sdk/utils/history.js → model/notices.js} +0 -0
  444. /package/dist/esm/{sdk/accounts/intents/operations → new-sdk/simulate}/types.js +0 -0
@@ -0,0 +1,364 @@
1
+ import { ChartBundle, ChartMetric, ChartRange } from "./charts.js";
2
+ import { z } from "zod/v4";
3
+ //#region src/model/charts.schema.d.ts
4
+ /**
5
+ * Runtime schemas for {@link ./charts.js}, see the note in
6
+ * `primitives.schema.ts` on why they are written by hand.
7
+ *
8
+ * Metric schemas are shared with the backend, while
9
+ * {@link chartBundleSchemaFor} builds the response schema for one concrete
10
+ * request. Component schemas remain available for consumers that validate
11
+ * model fragments.
12
+ **/
13
+ /**
14
+ * {@link ChartRange}
15
+ **/
16
+ declare const chartRangeSchema: z.ZodEnum<{
17
+ "1d": "1d";
18
+ "1m": "1m";
19
+ "1w": "1w";
20
+ "1y": "1y";
21
+ max: "max";
22
+ }>;
23
+ /**
24
+ * {@link PoolOpportunityChartMetric}
25
+ **/
26
+ declare const poolOpportunityChartMetricSchema: z.ZodEnum<{
27
+ availableLiquidity: "availableLiquidity";
28
+ borrowApy: "borrowApy";
29
+ borrowed: "borrowed";
30
+ depositApy: "depositApy";
31
+ dieselRate: "dieselRate";
32
+ supplied: "supplied";
33
+ }>;
34
+ /**
35
+ * {@link StrategyOpportunityChartMetric}
36
+ **/
37
+ declare const strategyOpportunityChartMetricSchema: z.ZodEnum<{
38
+ borrowApy: "borrowApy";
39
+ collateralApy: "collateralApy";
40
+ collateralPrice: "collateralPrice";
41
+ collateralUsdPrice: "collateralUsdPrice";
42
+ netApy: "netApy";
43
+ tvl: "tvl";
44
+ underlyingUsdPrice: "underlyingUsdPrice";
45
+ }>;
46
+ /**
47
+ * {@link PoolPositionChartMetric}
48
+ **/
49
+ declare const poolPositionChartMetricSchema: z.ZodEnum<{
50
+ apy: "apy";
51
+ mwr: "mwr";
52
+ pnl: "pnl";
53
+ twr: "twr";
54
+ underlyingPrice: "underlyingPrice";
55
+ value: "value";
56
+ }>;
57
+ /**
58
+ * {@link StrategyPositionChartMetric}
59
+ **/
60
+ declare const strategyPositionChartMetricSchema: z.ZodEnum<{
61
+ borrowApy: "borrowApy";
62
+ debt: "debt";
63
+ healthFactor: "healthFactor";
64
+ leverage: "leverage";
65
+ mwr: "mwr";
66
+ pnl: "pnl";
67
+ totalValueUnderlying: "totalValueUnderlying";
68
+ totalValueUsd: "totalValueUsd";
69
+ trailingApy30d: "trailingApy30d";
70
+ trailingApy7d: "trailingApy7d";
71
+ twr: "twr";
72
+ twrApy: "twrApy";
73
+ underlyingPrice: "underlyingPrice";
74
+ }>;
75
+ /**
76
+ * {@link ChartMetric}, every metric either kind of subject can chart.
77
+ **/
78
+ declare const chartMetricSchema: z.ZodUnion<readonly [z.ZodEnum<{
79
+ availableLiquidity: "availableLiquidity";
80
+ borrowApy: "borrowApy";
81
+ borrowed: "borrowed";
82
+ depositApy: "depositApy";
83
+ dieselRate: "dieselRate";
84
+ supplied: "supplied";
85
+ }>, z.ZodEnum<{
86
+ borrowApy: "borrowApy";
87
+ collateralApy: "collateralApy";
88
+ collateralPrice: "collateralPrice";
89
+ collateralUsdPrice: "collateralUsdPrice";
90
+ netApy: "netApy";
91
+ tvl: "tvl";
92
+ underlyingUsdPrice: "underlyingUsdPrice";
93
+ }>, z.ZodEnum<{
94
+ apy: "apy";
95
+ mwr: "mwr";
96
+ pnl: "pnl";
97
+ twr: "twr";
98
+ underlyingPrice: "underlyingPrice";
99
+ value: "value";
100
+ }>, z.ZodEnum<{
101
+ borrowApy: "borrowApy";
102
+ debt: "debt";
103
+ healthFactor: "healthFactor";
104
+ leverage: "leverage";
105
+ mwr: "mwr";
106
+ pnl: "pnl";
107
+ totalValueUnderlying: "totalValueUnderlying";
108
+ totalValueUsd: "totalValueUsd";
109
+ trailingApy30d: "trailingApy30d";
110
+ trailingApy7d: "trailingApy7d";
111
+ twr: "twr";
112
+ twrApy: "twrApy";
113
+ underlyingPrice: "underlyingPrice";
114
+ }>]>;
115
+ /**
116
+ * {@link ChartQuery}
117
+ **/
118
+ declare const chartQuerySchema: z.ZodObject<{
119
+ metrics: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
120
+ availableLiquidity: "availableLiquidity";
121
+ borrowApy: "borrowApy";
122
+ borrowed: "borrowed";
123
+ depositApy: "depositApy";
124
+ dieselRate: "dieselRate";
125
+ supplied: "supplied";
126
+ }>, z.ZodEnum<{
127
+ borrowApy: "borrowApy";
128
+ collateralApy: "collateralApy";
129
+ collateralPrice: "collateralPrice";
130
+ collateralUsdPrice: "collateralUsdPrice";
131
+ netApy: "netApy";
132
+ tvl: "tvl";
133
+ underlyingUsdPrice: "underlyingUsdPrice";
134
+ }>, z.ZodEnum<{
135
+ apy: "apy";
136
+ mwr: "mwr";
137
+ pnl: "pnl";
138
+ twr: "twr";
139
+ underlyingPrice: "underlyingPrice";
140
+ value: "value";
141
+ }>, z.ZodEnum<{
142
+ borrowApy: "borrowApy";
143
+ debt: "debt";
144
+ healthFactor: "healthFactor";
145
+ leverage: "leverage";
146
+ mwr: "mwr";
147
+ pnl: "pnl";
148
+ totalValueUnderlying: "totalValueUnderlying";
149
+ totalValueUsd: "totalValueUsd";
150
+ trailingApy30d: "trailingApy30d";
151
+ trailingApy7d: "trailingApy7d";
152
+ twr: "twr";
153
+ twrApy: "twrApy";
154
+ underlyingPrice: "underlyingPrice";
155
+ }>]>>>;
156
+ range: z.ZodEnum<{
157
+ "1d": "1d";
158
+ "1m": "1m";
159
+ "1w": "1w";
160
+ "1y": "1y";
161
+ max: "max";
162
+ }>;
163
+ }, z.core.$strip>;
164
+ /**
165
+ * {@link ChartQuery} as a URL can carry it: the metrics comma-joined, since
166
+ * repeated `?metrics=` entries would order differently between clients and give
167
+ * one request two cache keys.
168
+ **/
169
+ declare const chartQueryParamsSchema: z.ZodObject<{
170
+ metrics: z.ZodString;
171
+ range: z.ZodEnum<{
172
+ "1d": "1d";
173
+ "1m": "1m";
174
+ "1w": "1w";
175
+ "1y": "1y";
176
+ max: "max";
177
+ }>;
178
+ }, z.core.$strip>;
179
+ /**
180
+ * Codec for {@link ChartQuery} to encode/decode to/from url query parameters.
181
+ *
182
+ * The one place the wire form of a chart request is decided. The SDK encodes
183
+ * with it, the backend decodes with it, and the checks that a read names at
184
+ * least one metric and names none of them twice ride along in both directions —
185
+ * so a bad request fails before it is issued, not after a round trip.
186
+ **/
187
+ declare const chartQueryCodec: z.ZodCodec<z.ZodObject<{
188
+ metrics: z.ZodString;
189
+ range: z.ZodEnum<{
190
+ "1d": "1d";
191
+ "1m": "1m";
192
+ "1w": "1w";
193
+ "1y": "1y";
194
+ max: "max";
195
+ }>;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ metrics: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
198
+ availableLiquidity: "availableLiquidity";
199
+ borrowApy: "borrowApy";
200
+ borrowed: "borrowed";
201
+ depositApy: "depositApy";
202
+ dieselRate: "dieselRate";
203
+ supplied: "supplied";
204
+ }>, z.ZodEnum<{
205
+ borrowApy: "borrowApy";
206
+ collateralApy: "collateralApy";
207
+ collateralPrice: "collateralPrice";
208
+ collateralUsdPrice: "collateralUsdPrice";
209
+ netApy: "netApy";
210
+ tvl: "tvl";
211
+ underlyingUsdPrice: "underlyingUsdPrice";
212
+ }>, z.ZodEnum<{
213
+ apy: "apy";
214
+ mwr: "mwr";
215
+ pnl: "pnl";
216
+ twr: "twr";
217
+ underlyingPrice: "underlyingPrice";
218
+ value: "value";
219
+ }>, z.ZodEnum<{
220
+ borrowApy: "borrowApy";
221
+ debt: "debt";
222
+ healthFactor: "healthFactor";
223
+ leverage: "leverage";
224
+ mwr: "mwr";
225
+ pnl: "pnl";
226
+ totalValueUnderlying: "totalValueUnderlying";
227
+ totalValueUsd: "totalValueUsd";
228
+ trailingApy30d: "trailingApy30d";
229
+ trailingApy7d: "trailingApy7d";
230
+ twr: "twr";
231
+ twrApy: "twrApy";
232
+ underlyingPrice: "underlyingPrice";
233
+ }>]>>>;
234
+ range: z.ZodEnum<{
235
+ "1d": "1d";
236
+ "1m": "1m";
237
+ "1w": "1w";
238
+ "1y": "1y";
239
+ max: "max";
240
+ }>;
241
+ }, z.core.$strip>>;
242
+ /**
243
+ * {@link ChartDenomination}
244
+ **/
245
+ declare const chartDenominationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
246
+ unit: z.ZodLiteral<"bps">;
247
+ }, z.core.$strip>, z.ZodObject<{
248
+ unit: z.ZodLiteral<"usd">;
249
+ }, z.core.$strip>, z.ZodObject<{
250
+ unit: z.ZodLiteral<"scalar">;
251
+ }, z.core.$strip>, z.ZodObject<{
252
+ unit: z.ZodLiteral<"token">;
253
+ base: z.ZodObject<{
254
+ chainId: z.ZodNumber;
255
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
256
+ symbol: z.ZodString;
257
+ name: z.ZodString;
258
+ decimals: z.ZodNumber;
259
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
260
+ }, z.core.$strip>;
261
+ }, z.core.$strip>, z.ZodObject<{
262
+ unit: z.ZodLiteral<"ratio">;
263
+ base: z.ZodObject<{
264
+ chainId: z.ZodNumber;
265
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
266
+ symbol: z.ZodString;
267
+ name: z.ZodString;
268
+ decimals: z.ZodNumber;
269
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
270
+ }, z.core.$strip>;
271
+ quote: z.ZodObject<{
272
+ chainId: z.ZodNumber;
273
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
274
+ symbol: z.ZodString;
275
+ name: z.ZodString;
276
+ decimals: z.ZodNumber;
277
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
278
+ }, z.core.$strip>;
279
+ }, z.core.$strip>], "unit">;
280
+ /**
281
+ * {@link ChartValue}. `null` is a gap, never a zero.
282
+ **/
283
+ declare const chartValueSchema: z.ZodNullable<z.ZodNumber>;
284
+ /**
285
+ * {@link ChartSeries}
286
+ **/
287
+ declare const chartSeriesSchema: z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
288
+ status: z.ZodLiteral<"ok">;
289
+ values: z.ZodArray<z.ZodNullable<z.ZodNumber>>;
290
+ }, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
291
+ unit: z.ZodLiteral<"bps">;
292
+ }, z.core.$strip>, z.ZodObject<{
293
+ unit: z.ZodLiteral<"usd">;
294
+ }, z.core.$strip>, z.ZodObject<{
295
+ unit: z.ZodLiteral<"scalar">;
296
+ }, z.core.$strip>, z.ZodObject<{
297
+ unit: z.ZodLiteral<"token">;
298
+ base: z.ZodObject<{
299
+ chainId: z.ZodNumber;
300
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
301
+ symbol: z.ZodString;
302
+ name: z.ZodString;
303
+ decimals: z.ZodNumber;
304
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
305
+ }, z.core.$strip>;
306
+ }, z.core.$strip>, z.ZodObject<{
307
+ unit: z.ZodLiteral<"ratio">;
308
+ base: z.ZodObject<{
309
+ chainId: z.ZodNumber;
310
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
311
+ symbol: z.ZodString;
312
+ name: z.ZodString;
313
+ decimals: z.ZodNumber;
314
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
315
+ }, z.core.$strip>;
316
+ quote: z.ZodObject<{
317
+ chainId: z.ZodNumber;
318
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
319
+ symbol: z.ZodString;
320
+ name: z.ZodString;
321
+ decimals: z.ZodNumber;
322
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
323
+ }, z.core.$strip>;
324
+ }, z.core.$strip>], "unit">>, z.ZodObject<{
325
+ status: z.ZodLiteral<"unavailable">;
326
+ reason: z.ZodObject<{
327
+ code: z.ZodEnum<{
328
+ internal: "internal";
329
+ no_price_feed: "no_price_feed";
330
+ not_indexed: "not_indexed";
331
+ unknown_subject: "unknown_subject";
332
+ unsupported_metric: "unsupported_metric";
333
+ }>;
334
+ message: z.ZodOptional<z.ZodString>;
335
+ }, z.core.$strip>;
336
+ }, z.core.$strip>]>;
337
+ /**
338
+ * {@link ChartWindow}
339
+ **/
340
+ declare const chartWindowSchema: z.ZodObject<{
341
+ range: z.ZodEnum<{
342
+ "1d": "1d";
343
+ "1m": "1m";
344
+ "1w": "1w";
345
+ "1y": "1y";
346
+ max: "max";
347
+ }>;
348
+ from: z.ZodNumber;
349
+ to: z.ZodNumber;
350
+ }, z.core.$strip>;
351
+ /**
352
+ * The schema one chart read is decoded with: a {@link ChartBundle} keyed by the
353
+ * requested distinct metrics, all of them and nothing else, for the requested
354
+ * range.
355
+ *
356
+ * Pinning the metrics is what upholds the `ChartBundle<Metrics>` a caller gets
357
+ * back — a response that answers a different question fails validation rather
358
+ * than being cast into the requested shape. The declared return type is the one
359
+ * the key schema actually enforces, which the compiler cannot see through a
360
+ * schema built from a runtime list.
361
+ **/
362
+ declare function chartBundleSchemaFor<const Metrics extends readonly ChartMetric[]>(metrics: Metrics, range: ChartRange): z.ZodType<ChartBundle<Metrics>>;
363
+ //#endregion
364
+ export { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema };
@@ -1,17 +1,19 @@
1
1
  import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall } from "./primitives.js";
2
2
  import { Curator, CuratorName } from "./curators.js";
3
+ import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
4
+ import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
3
5
  import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
4
6
  import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
5
7
  import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
6
- import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
7
8
  import { DelayedReceivedAsset, InstantReceivedAsset, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, ReceivedAsset, matchesLiquidatableAccountFilter } from "./liquidations.js";
8
- import { PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
9
- import { HistoryChartMetadata, HistoryMetric, HistoryPoint, HistoryRange, HistorySeries, OpportunityHistoryQuery, POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, PoolHistoryMetric, PoolPositionHistoryMetric, PositionHistoryMetric, PositionHistoryQuery, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS, StrategyHistoryMetric, StrategyPositionHistoryMetric } from "./history.js";
10
- import { historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, opportunityHistoryQuerySchema, poolHistoryMetricSchema, poolPositionHistoryMetricSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, strategyHistoryMetricSchema, strategyPositionHistoryMetricSchema } from "./history.schema.js";
11
9
  import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
10
+ import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
11
+ import { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, PositionTransaction, PositionTransactionKind, PositionsTotals, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
12
+ import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
13
+ import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
12
14
  import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
13
- import { pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
15
+ import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
14
16
  import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema } from "./primitives.schema.js";
15
17
  import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
16
18
  import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
17
- export { Amount, ApyBreakdown, AssetType, Bps, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, Curator, CuratorName, DataResponse, DataSource, DelayedReceivedAsset, FILTER_ALL, FilterAll, Filterable, HistoryChartMetadata, HistoryMetric, HistoryPoint, HistoryRange, HistorySeries, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityHistoryQuery, OpportunityId, OpportunityKey, OpportunityKind, POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolHistoryMetric, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionHistoryMetric, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionHistoryMetric, PositionHistoryQuery, PositionId, PositionKey, PositionKind, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS, StrategyHistoryMetric, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionHistoryMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenRewards, TokenRewardsPnL, TxCall, amountSchema, apyBreakdownSchema, assetTypeSchema, booleanParamSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityHistoryQuerySchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolHistoryMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionHistoryMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, positionId, positionKeySchema, positionKindSchema, positionSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyHistoryMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionHistoryMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, txCallSchema };
19
+ export { Amount, ApyBreakdown, 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, Curator, CuratorName, DataResponse, DataSource, DelayedReceivedAsset, FILTER_ALL, FilterAll, Filterable, GridSampling, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Notice, NoticeKind, NoticeSubject, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionRef, Position, PositionChartMetric, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, PositionTransaction, PositionTransactionKind, PositionsTotals, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenRewards, TokenRewardsPnL, TxCall, amountSchema, apyBreakdownSchema, assetTypeSchema, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, noticeKindSchema, noticeSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, 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, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, txCallSchema };
@@ -0,0 +1,29 @@
1
+ import { Token } from "./primitives.js";
2
+ import { PoolOpportunity } from "./opportunities.js";
3
+ import { StrategyPosition } from "./positions.js";
4
+ //#region src/model/notices.d.ts
5
+ /**
6
+ * What a notice is about, and therefore how a consumer shows it.
7
+ **/
8
+ type NoticeKind = "expired" | "externalRewards" | "extraApy" | "warning" | "disclaimer";
9
+ /**
10
+ * A banner the backend asks a consumer to show for a pool opportunity or a
11
+ * strategy position: an expired account, rewards paid outside the protocol,
12
+ * a caveat on the yield. The message is final text; the consumer adds
13
+ * nothing.
14
+ **/
15
+ interface Notice {
16
+ kind: NoticeKind;
17
+ message: string;
18
+ /**
19
+ * Token the notice is about, when it is about one (rewards, extra APY).
20
+ **/
21
+ token?: Token;
22
+ }
23
+ /**
24
+ * What a notice is attached to: a pool opportunity or a strategy position —
25
+ * the two entities a consumer shows banners for.
26
+ **/
27
+ type NoticeSubject = PoolOpportunity | StrategyPosition;
28
+ //#endregion
29
+ export { Notice, NoticeKind, NoticeSubject };
@@ -0,0 +1,23 @@
1
+ import { z } from "zod/v4";
2
+ //#region src/model/notices.schema.d.ts
3
+ /**
4
+ * {@link NoticeKind}
5
+ **/
6
+ declare const noticeKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"expired">, z.ZodLiteral<"externalRewards">, z.ZodLiteral<"extraApy">, z.ZodLiteral<"warning">, z.ZodLiteral<"disclaimer">]>;
7
+ /**
8
+ * {@link Notice}
9
+ **/
10
+ declare const noticeSchema: z.ZodObject<{
11
+ kind: z.ZodUnion<readonly [z.ZodLiteral<"expired">, z.ZodLiteral<"externalRewards">, z.ZodLiteral<"extraApy">, z.ZodLiteral<"warning">, z.ZodLiteral<"disclaimer">]>;
12
+ message: z.ZodString;
13
+ token: z.ZodOptional<z.ZodObject<{
14
+ chainId: z.ZodNumber;
15
+ address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
16
+ symbol: z.ZodString;
17
+ name: z.ZodString;
18
+ decimals: z.ZodNumber;
19
+ assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
20
+ }, z.core.$strip>>;
21
+ }, z.core.$strip>;
22
+ //#endregion
23
+ export { noticeKindSchema, noticeSchema };
@@ -254,9 +254,8 @@ interface StrategyOpportunity extends OpportunityBase {
254
254
  collateralApy?: ApyBreakdown;
255
255
  /**
256
256
  * Net yield at {@link maxLeverage}:
257
- * `collateralApy * maxLeverage - borrowApy * (maxLeverage - 1)`, applied to
258
- * {@link ApyBreakdown.totalApy}, {@link ApyBreakdown.organicApy} and
259
- * {@link ApyBreakdown.rewards} alike.
257
+ * `collateralApy × maxLeverage − borrowApy × (maxLeverage − 1) − additionalBorrowApy`.
258
+ * Yield is on the whole position; borrow interest is on the borrowed part only.
260
259
  *
261
260
  * Absent in `onchain` mode: its {@link collateralApy} term is.
262
261
  *
@@ -271,9 +270,9 @@ interface StrategyOpportunity extends OpportunityBase {
271
270
  **/
272
271
  borrowApy?: Bps;
273
272
  /**
274
- * Annual cost of the quota on {@link targetCollateral}, scaled to the debt a
275
- * maximally leveraged position carries, in basis points. Comes on top of
276
- * {@link borrowApy}.
273
+ * Annual cost of the quota on {@link targetCollateral}, in basis points:
274
+ * `quotaRate × (1 + feeInterest) × maxLeverage`. Quota accrues on the whole
275
+ * quoted position and carries the same DAO fee as {@link borrowApy}.
277
276
  *
278
277
  * @example `90` for +0.9% APY
279
278
  **/
@@ -307,10 +306,11 @@ interface StrategyOpportunity extends OpportunityBase {
307
306
  **/
308
307
  maxBorrowAmount: Amount;
309
308
  /**
310
- * Highest leverage the liquidation threshold allows,
311
- * `1 / (1 - liquidationThreshold)`.
309
+ * Highest total-value leverage the liquidation threshold allows:
310
+ * `(1 − 0.05) / (1 − liquidationThreshold)`. The 5% safety margin keeps a
311
+ * maxed position slightly above HF = 1.
312
312
  *
313
- * @example `10` at a 90% threshold
313
+ * @example `9.5` at a 90% threshold
314
314
  **/
315
315
  maxLeverage: Leverage;
316
316
  }
@@ -1,8 +1,8 @@
1
- import { AssetType, Bps, ChainId, Leverage, Token, TokenAmount } from "./primitives.js";
1
+ import { AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount } from "./primitives.js";
2
2
  import { ChainScopedFilter, Filterable } from "./filters.js";
3
- import { ApyBreakdown, PointsProgram } from "./opportunities.js";
4
3
  import { DelayedReceivedAsset, LiquidationPosition } from "./liquidations.js";
5
- import { Address } from "viem";
4
+ import { ApyBreakdown, PointsProgram } from "./opportunities.js";
5
+ import { Address, Hex } from "viem";
6
6
  //#region src/model/positions.d.ts
7
7
  /**
8
8
  * Discriminator of the three kinds of position a wallet can hold.
@@ -131,6 +131,67 @@ interface PoolPosition {
131
131
  **/
132
132
  pnl?: PnlBreakdown;
133
133
  }
134
+ /**
135
+ * Cost of a position's debt broken down by source.
136
+ *
137
+ * The base rate is what the pool charges on the debt; each quoted collateral
138
+ * adds its own quota rate on top. Rates are reported in two normalizations:
139
+ * relative to the position's total value and relative to its debt.
140
+ **/
141
+ interface BorrowRateBreakdown {
142
+ /**
143
+ * Base rate plus quota rates, relative to the position's total value.
144
+ **/
145
+ total: Bps;
146
+ /**
147
+ * Base rate plus quota rates, relative to the debt. This is the rate the
148
+ * debt itself grows at, so it feeds {@link PositionMetrics.timeToLiquidation}.
149
+ **/
150
+ totalOnDebt: Bps;
151
+ /**
152
+ * Annual cost of the borrowed underlying itself: the pool's base rate plus
153
+ * the credit manager's interest fee. Same value `borrowApy` reports.
154
+ **/
155
+ base: Bps;
156
+ /**
157
+ * Per-token quota rate contribution, relative to the position's total value.
158
+ **/
159
+ quotas: Record<Address, Bps>;
160
+ }
161
+ /**
162
+ * Health and cost metrics of a credit account's state, actual or projected.
163
+ *
164
+ * Previews and operation states carry the whole group; on-chain positions
165
+ * report only the fields they lack natively, see {@link StrategyPosition}.
166
+ **/
167
+ interface PositionMetrics {
168
+ /**
169
+ * Health factor in basis points: below `10000` the account is liquidatable.
170
+ *
171
+ * @example `12500` for a health factor of 1.25
172
+ **/
173
+ healthFactor: Bps;
174
+ /**
175
+ * Net rate the whole position earns, collateral yield minus borrow cost.
176
+ **/
177
+ overallApy: Bps;
178
+ /**
179
+ * Cost of the debt, broken down by source.
180
+ **/
181
+ borrowRate: BorrowRateBreakdown;
182
+ /**
183
+ * Estimated milliseconds until the health factor decays to `10000` under
184
+ * the current borrow rate, or `null` when the debt carries no rate (or the
185
+ * account is already liquidatable).
186
+ **/
187
+ timeToLiquidation: bigint | null;
188
+ /**
189
+ * Price of the single non-underlying collateral at which the account
190
+ * becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
191
+ * when the account holds zero or several non-underlying assets.
192
+ **/
193
+ liquidationPrice: bigint | null;
194
+ }
134
195
  /**
135
196
  * An open credit account of a wallet.
136
197
  **/
@@ -163,9 +224,9 @@ interface StrategyPosition {
163
224
  **/
164
225
  targetCollateral: Token | null;
165
226
  /**
166
- * Debt/equity ratio: `totalDebt / equity` (`equity = totalValue −
167
- * totalDebt`). `0` = unleveraged; `0` if underwater. Same notation as the
168
- * opportunity `maxLeverage`, and bounded by it.
227
+ * Total-value leverage: `totalValue / (totalValue − totalDebt)`. `1` =
228
+ * unleveraged; `0` if underwater. Same notation as opportunity `maxLeverage`,
229
+ * and bounded by it.
169
230
  **/
170
231
  leverage: Leverage;
171
232
  /**
@@ -200,6 +261,28 @@ interface StrategyPosition {
200
261
  * @example `12500` for a health factor of 1.25
201
262
  **/
202
263
  healthFactor: Bps;
264
+ /**
265
+ * Cost of the debt broken down into the pool's base rate and per-token
266
+ * quota rates.
267
+ *
268
+ * @mode onchain
269
+ **/
270
+ borrowRate?: BorrowRateBreakdown;
271
+ /**
272
+ * Estimated milliseconds until the health factor decays to `10000` under
273
+ * the current borrow rate, or `null` when it cannot be estimated.
274
+ *
275
+ * @mode onchain
276
+ **/
277
+ timeToLiquidation?: bigint | null;
278
+ /**
279
+ * Price of the single non-underlying collateral at which the account
280
+ * becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
281
+ * when the account holds zero or several non-underlying assets.
282
+ *
283
+ * @mode onchain
284
+ **/
285
+ liquidationPrice?: bigint | null;
203
286
  /**
204
287
  * What the position has earned so far.
205
288
  *
@@ -342,5 +425,48 @@ interface StrategyPositionRef extends StrategyPositionKey {
342
425
  * event rather than a series.
343
426
  **/
344
427
  type PositionKey = PoolPositionRef | StrategyPositionRef;
428
+ /**
429
+ * Aggregate over everything a wallet holds, served by the backend rather than
430
+ * summed by a consumer: the list screen's badges. `null` where the wallet
431
+ * holds nothing that contributes.
432
+ **/
433
+ interface PositionsTotals {
434
+ /**
435
+ * Blended rate the wallet's positions currently earn.
436
+ **/
437
+ currentYield: ApyBreakdown | null;
438
+ /**
439
+ * Profit and loss over every position, in USD terms of {@link PnlBreakdown}.
440
+ **/
441
+ pnl: PnlBreakdown | null;
442
+ /**
443
+ * Net value of every position in US dollars.
444
+ **/
445
+ netValueUsd: number | null;
446
+ /**
447
+ * What the wallet can claim right now (matured withdrawals, rewards) in US
448
+ * dollars.
449
+ **/
450
+ claimableUsd: number | null;
451
+ }
452
+ /**
453
+ * What a transaction did to a position.
454
+ **/
455
+ type PositionTransactionKind = "open" | "deposit" | "withdraw" | "adjustLeverage" | "addCollateral" | "withdrawCollateral" | "liquidation";
456
+ /**
457
+ * One transaction in a position's history, from the backend's indexer.
458
+ **/
459
+ interface PositionTransaction {
460
+ txHash: Hex;
461
+ /**
462
+ * Unix seconds of the block the transaction was mined in.
463
+ **/
464
+ timestamp: Timestamp;
465
+ kind: PositionTransactionKind;
466
+ /**
467
+ * Assets the transaction moved, in the direction the kind implies.
468
+ **/
469
+ assets: TokenAmount[];
470
+ }
345
471
  //#endregion
346
- export { PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId };
472
+ export { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, PositionTransaction, PositionTransactionKind, PositionsTotals, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId };