@lidofinance/lsv-cli 1.1.0 → 1.2.0

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 (421) hide show
  1. package/dist/abi/Dashboard.d.ts +23 -3
  2. package/dist/abi/Dashboard.js +8 -3
  3. package/dist/abi/Dashboard.js.map +1 -1
  4. package/dist/abi/LazyOracle.d.ts +364 -0
  5. package/dist/abi/LazyOracle.js +2 -0
  6. package/dist/abi/LazyOracle.js.map +1 -1
  7. package/dist/abi/OperatorGrid.d.ts +24 -0
  8. package/dist/abi/OperatorGrid.js +16 -0
  9. package/dist/abi/OperatorGrid.js.map +1 -1
  10. package/dist/abi/ValidatorConsolidationRequests.d.ts +121 -0
  11. package/dist/abi/ValidatorConsolidationRequests.js +159 -0
  12. package/dist/abi/ValidatorConsolidationRequests.js.map +1 -0
  13. package/dist/abi/VaultFactory.d.ts +16 -0
  14. package/dist/abi/VaultViewer.d.ts +0 -14
  15. package/dist/abi/VaultViewer.js +0 -19
  16. package/dist/abi/VaultViewer.js.map +1 -1
  17. package/dist/abi/defi-wrapper/Distributor.d.ts +40 -2
  18. package/dist/abi/defi-wrapper/Distributor.js +52 -2
  19. package/dist/abi/defi-wrapper/Distributor.js.map +1 -1
  20. package/dist/abi/defi-wrapper/Factory.d.ts +973 -550
  21. package/dist/abi/defi-wrapper/Factory.js +720 -763
  22. package/dist/abi/defi-wrapper/Factory.js.map +1 -1
  23. package/dist/abi/defi-wrapper/StvPool.d.ts +121 -325
  24. package/dist/abi/defi-wrapper/StvPool.js +143 -413
  25. package/dist/abi/defi-wrapper/StvPool.js.map +1 -1
  26. package/dist/abi/defi-wrapper/StvStETHPool.d.ts +398 -381
  27. package/dist/abi/defi-wrapper/StvStETHPool.js +448 -433
  28. package/dist/abi/defi-wrapper/StvStETHPool.js.map +1 -1
  29. package/dist/abi/defi-wrapper/WithdrawalQueue.d.ts +309 -175
  30. package/dist/abi/defi-wrapper/WithdrawalQueue.js +381 -206
  31. package/dist/abi/defi-wrapper/WithdrawalQueue.js.map +1 -1
  32. package/dist/abi/defi-wrapper/index.d.ts +0 -1
  33. package/dist/abi/defi-wrapper/index.js +0 -1
  34. package/dist/abi/defi-wrapper/index.js.map +1 -1
  35. package/dist/abi/index.d.ts +1 -0
  36. package/dist/abi/index.js +1 -0
  37. package/dist/abi/index.js.map +1 -1
  38. package/dist/configs/constants.d.ts +44 -2
  39. package/dist/configs/constants.js +2 -2
  40. package/dist/configs/constants.js.map +1 -1
  41. package/dist/configs/deployed.d.ts +2 -2
  42. package/dist/configs/deployed.js +48 -6
  43. package/dist/configs/deployed.js.map +1 -1
  44. package/dist/configs/utils.d.ts +1 -0
  45. package/dist/configs/utils.js +8 -0
  46. package/dist/configs/utils.js.map +1 -1
  47. package/dist/contracts/dashboard-impl.d.ts +2 -2
  48. package/dist/contracts/dashboard-impl.js +3 -2
  49. package/dist/contracts/dashboard-impl.js.map +1 -1
  50. package/dist/contracts/dashboard.d.ts +2 -2
  51. package/dist/contracts/dashboard.js +3 -2
  52. package/dist/contracts/dashboard.js.map +1 -1
  53. package/dist/contracts/defi-wrapper/distributor.d.ts +1 -1
  54. package/dist/contracts/defi-wrapper/distributor.js +3 -2
  55. package/dist/contracts/defi-wrapper/distributor.js.map +1 -1
  56. package/dist/contracts/defi-wrapper/factory.d.ts +1 -1
  57. package/dist/contracts/defi-wrapper/factory.js +3 -2
  58. package/dist/contracts/defi-wrapper/factory.js.map +1 -1
  59. package/dist/contracts/defi-wrapper/index.d.ts +0 -1
  60. package/dist/contracts/defi-wrapper/index.js +0 -1
  61. package/dist/contracts/defi-wrapper/index.js.map +1 -1
  62. package/dist/contracts/defi-wrapper/stv-pool.d.ts +2 -2
  63. package/dist/contracts/defi-wrapper/stv-pool.js +3 -2
  64. package/dist/contracts/defi-wrapper/stv-pool.js.map +1 -1
  65. package/dist/contracts/defi-wrapper/stv-steth-pool.d.ts +1 -1
  66. package/dist/contracts/defi-wrapper/stv-steth-pool.js +3 -2
  67. package/dist/contracts/defi-wrapper/stv-steth-pool.js.map +1 -1
  68. package/dist/contracts/defi-wrapper/withdrawal-queue.d.ts +1 -1
  69. package/dist/contracts/defi-wrapper/withdrawal-queue.js +3 -2
  70. package/dist/contracts/defi-wrapper/withdrawal-queue.js.map +1 -1
  71. package/dist/contracts/index.d.ts +1 -0
  72. package/dist/contracts/index.js +1 -0
  73. package/dist/contracts/index.js.map +1 -1
  74. package/dist/contracts/lazy-oracle.js +3 -2
  75. package/dist/contracts/lazy-oracle.js.map +1 -1
  76. package/dist/contracts/locator.d.ts +3 -9655
  77. package/dist/contracts/locator.js +4 -3
  78. package/dist/contracts/locator.js.map +1 -1
  79. package/dist/contracts/operator-grid.d.ts +1 -1
  80. package/dist/contracts/operator-grid.js +3 -2
  81. package/dist/contracts/operator-grid.js.map +1 -1
  82. package/dist/contracts/pdg.js +3 -2
  83. package/dist/contracts/pdg.js.map +1 -1
  84. package/dist/contracts/steth.d.ts +54 -54
  85. package/dist/contracts/steth.js +3 -2
  86. package/dist/contracts/steth.js.map +1 -1
  87. package/dist/contracts/validator-consolidation-requests.d.ts +5 -0
  88. package/dist/contracts/validator-consolidation-requests.js +13 -0
  89. package/dist/contracts/validator-consolidation-requests.js.map +1 -0
  90. package/dist/contracts/vault-factory.d.ts +3 -28346
  91. package/dist/contracts/vault-factory.js +4 -3
  92. package/dist/contracts/vault-factory.js.map +1 -1
  93. package/dist/contracts/vault-hub.js +3 -2
  94. package/dist/contracts/vault-hub.js.map +1 -1
  95. package/dist/contracts/vault-viewer.d.ts +3 -9661
  96. package/dist/contracts/vault-viewer.js +9 -7
  97. package/dist/contracts/vault-viewer.js.map +1 -1
  98. package/dist/contracts/vault.d.ts +2 -2
  99. package/dist/contracts/vault.js +3 -2
  100. package/dist/contracts/vault.js.map +1 -1
  101. package/dist/contracts/wsteth.d.ts +3 -24690
  102. package/dist/contracts/wsteth.js +4 -3
  103. package/dist/contracts/wsteth.js.map +1 -1
  104. package/dist/features/consolidation.d.ts +18 -0
  105. package/dist/features/consolidation.js +199 -0
  106. package/dist/features/consolidation.js.map +1 -0
  107. package/dist/features/defi-wrapper/create-vault.d.ts +17 -0
  108. package/dist/features/defi-wrapper/create-vault.js +137 -0
  109. package/dist/features/defi-wrapper/create-vault.js.map +1 -0
  110. package/dist/features/defi-wrapper/defi-wrapper-factory.d.ts +112 -0
  111. package/dist/features/defi-wrapper/defi-wrapper-factory.js +228 -0
  112. package/dist/features/defi-wrapper/defi-wrapper-factory.js.map +1 -0
  113. package/dist/features/defi-wrapper/index.d.ts +3 -0
  114. package/dist/features/defi-wrapper/index.js +4 -0
  115. package/dist/features/defi-wrapper/index.js.map +1 -0
  116. package/dist/features/defi-wrapper/pool-info.d.ts +35 -0
  117. package/dist/features/defi-wrapper/pool-info.js +97 -0
  118. package/dist/features/defi-wrapper/pool-info.js.map +1 -0
  119. package/dist/features/deposits/check-bls-deposits.js +2 -2
  120. package/dist/features/deposits/check-bls-deposits.js.map +1 -1
  121. package/dist/features/deposits/index.d.ts +1 -0
  122. package/dist/features/deposits/index.js +1 -0
  123. package/dist/features/deposits/index.js.map +1 -1
  124. package/dist/features/deposits/make-pdg-proof.js +1 -1
  125. package/dist/features/deposits/make-pdg-proof.js.map +1 -1
  126. package/dist/features/deposits/no-pdg.d.ts +1 -1
  127. package/dist/features/deposits/no-pdg.js +6 -3
  128. package/dist/features/deposits/no-pdg.js.map +1 -1
  129. package/dist/features/deposits/pdg.d.ts +2 -0
  130. package/dist/features/deposits/pdg.js +18 -0
  131. package/dist/features/deposits/pdg.js.map +1 -0
  132. package/dist/features/dev-tools/impersonate.d.ts +14 -0
  133. package/dist/features/dev-tools/impersonate.js +64 -0
  134. package/dist/features/dev-tools/impersonate.js.map +1 -0
  135. package/dist/features/dev-tools/index.d.ts +1 -0
  136. package/dist/features/dev-tools/index.js +2 -0
  137. package/dist/features/dev-tools/index.js.map +1 -0
  138. package/dist/features/index.d.ts +4 -1
  139. package/dist/features/index.js +4 -1
  140. package/dist/features/index.js.map +1 -1
  141. package/dist/features/metrics.d.ts +4 -0
  142. package/dist/features/metrics.js +48 -0
  143. package/dist/features/metrics.js.map +1 -0
  144. package/dist/features/pdg.js +4 -0
  145. package/dist/features/pdg.js.map +1 -1
  146. package/dist/features/utils/get-boolean.d.ts +1 -0
  147. package/dist/features/utils/get-boolean.js +13 -0
  148. package/dist/features/utils/get-boolean.js.map +1 -0
  149. package/dist/features/utils/index.d.ts +1 -0
  150. package/dist/features/utils/index.js +1 -0
  151. package/dist/features/utils/index.js.map +1 -1
  152. package/dist/features/utils/quarantine.js +2 -0
  153. package/dist/features/utils/quarantine.js.map +1 -1
  154. package/dist/features/utils/report-fresh.js +2 -3
  155. package/dist/features/utils/report-fresh.js.map +1 -1
  156. package/dist/features/vault-factory.js +2 -2
  157. package/dist/features/vault-factory.js.map +1 -1
  158. package/dist/features/vault-operations/create-vault.d.ts +4 -2
  159. package/dist/features/vault-operations/create-vault.js +11 -3
  160. package/dist/features/vault-operations/create-vault.js.map +1 -1
  161. package/dist/features/vault-operations/dashboard-by-vault.js +4 -4
  162. package/dist/features/vault-operations/dashboard-by-vault.js.map +1 -1
  163. package/dist/features/vault-operations/vault-info.js +1 -1
  164. package/dist/features/vault-operations/vault-info.js.map +1 -1
  165. package/dist/features/vault-operations/vault-overview.js +1 -1
  166. package/dist/features/vault-operations/vault-overview.js.map +1 -1
  167. package/dist/features/vault-operations/vault-roles.js +3 -0
  168. package/dist/features/vault-operations/vault-roles.js.map +1 -1
  169. package/dist/features/vault-operations/vaults-by-role.js +29 -10
  170. package/dist/features/vault-operations/vaults-by-role.js.map +1 -1
  171. package/dist/features/vault.js +4 -2
  172. package/dist/features/vault.js.map +1 -1
  173. package/dist/index.js +7 -2
  174. package/dist/index.js.map +1 -1
  175. package/dist/programs/account/read.js +1 -1
  176. package/dist/programs/account/read.js.map +1 -1
  177. package/dist/programs/account/write.js +14 -0
  178. package/dist/programs/account/write.js.map +1 -1
  179. package/dist/programs/contracts/dashboard/read.js +7 -7
  180. package/dist/programs/contracts/dashboard/read.js.map +1 -1
  181. package/dist/programs/contracts/dashboard/write.js +42 -42
  182. package/dist/programs/contracts/dashboard/write.js.map +1 -1
  183. package/dist/programs/contracts/hub/config.js +0 -10
  184. package/dist/programs/contracts/hub/config.js.map +1 -1
  185. package/dist/programs/contracts/hub/read.js +63 -2
  186. package/dist/programs/contracts/hub/read.js.map +1 -1
  187. package/dist/programs/contracts/hub/write.js +1 -1
  188. package/dist/programs/contracts/hub/write.js.map +1 -1
  189. package/dist/programs/contracts/pdg/read.js +2 -1
  190. package/dist/programs/contracts/pdg/read.js.map +1 -1
  191. package/dist/programs/contracts/pdg/write.js +37 -3
  192. package/dist/programs/contracts/pdg/write.js.map +1 -1
  193. package/dist/programs/contracts/vault/write.js +16 -16
  194. package/dist/programs/contracts/vault/write.js.map +1 -1
  195. package/dist/programs/contracts/vault-factory/write.js +2 -2
  196. package/dist/programs/contracts/vault-factory/write.js.map +1 -1
  197. package/dist/programs/defi-wrapper/contracts/distributor/read.js +1 -1
  198. package/dist/programs/defi-wrapper/contracts/distributor/read.js.map +1 -1
  199. package/dist/programs/defi-wrapper/contracts/distributor/write.js +3 -3
  200. package/dist/programs/defi-wrapper/contracts/distributor/write.js.map +1 -1
  201. package/dist/programs/defi-wrapper/contracts/factory/read.js +2 -8
  202. package/dist/programs/defi-wrapper/contracts/factory/read.js.map +1 -1
  203. package/dist/programs/defi-wrapper/contracts/factory/write.js +90 -273
  204. package/dist/programs/defi-wrapper/contracts/factory/write.js.map +1 -1
  205. package/dist/programs/defi-wrapper/contracts/index.d.ts +0 -1
  206. package/dist/programs/defi-wrapper/contracts/index.js +0 -1
  207. package/dist/programs/defi-wrapper/contracts/index.js.map +1 -1
  208. package/dist/programs/defi-wrapper/contracts/stv-pool/config.js +22 -32
  209. package/dist/programs/defi-wrapper/contracts/stv-pool/config.js.map +1 -1
  210. package/dist/programs/defi-wrapper/contracts/stv-pool/read.js +17 -24
  211. package/dist/programs/defi-wrapper/contracts/stv-pool/read.js.map +1 -1
  212. package/dist/programs/defi-wrapper/contracts/stv-pool/write.js +25 -174
  213. package/dist/programs/defi-wrapper/contracts/stv-pool/write.js.map +1 -1
  214. package/dist/programs/defi-wrapper/contracts/stv-steth-pool/config.js +0 -90
  215. package/dist/programs/defi-wrapper/contracts/stv-steth-pool/config.js.map +1 -1
  216. package/dist/programs/defi-wrapper/contracts/stv-steth-pool/read.js +16 -23
  217. package/dist/programs/defi-wrapper/contracts/stv-steth-pool/read.js.map +1 -1
  218. package/dist/programs/defi-wrapper/contracts/stv-steth-pool/write.js +34 -231
  219. package/dist/programs/defi-wrapper/contracts/stv-steth-pool/write.js.map +1 -1
  220. package/dist/programs/defi-wrapper/contracts/withdrawal-queue/config.js +1 -91
  221. package/dist/programs/defi-wrapper/contracts/withdrawal-queue/config.js.map +1 -1
  222. package/dist/programs/defi-wrapper/contracts/withdrawal-queue/read.js +8 -27
  223. package/dist/programs/defi-wrapper/contracts/withdrawal-queue/read.js.map +1 -1
  224. package/dist/programs/defi-wrapper/contracts/withdrawal-queue/write.js +55 -24
  225. package/dist/programs/defi-wrapper/contracts/withdrawal-queue/write.js.map +1 -1
  226. package/dist/programs/defi-wrapper/index.d.ts +1 -0
  227. package/dist/programs/defi-wrapper/index.js +1 -0
  228. package/dist/programs/defi-wrapper/index.js.map +1 -1
  229. package/dist/programs/defi-wrapper/use-cases/health/index.js.map +1 -0
  230. package/dist/programs/defi-wrapper/use-cases/health/main.d.ts +1 -0
  231. package/dist/programs/defi-wrapper/use-cases/health/main.js +6 -0
  232. package/dist/programs/defi-wrapper/use-cases/health/main.js.map +1 -0
  233. package/dist/programs/defi-wrapper/use-cases/health/read.js +338 -0
  234. package/dist/programs/defi-wrapper/use-cases/health/read.js.map +1 -0
  235. package/dist/programs/defi-wrapper/use-cases/health/utils.d.ts +56 -0
  236. package/dist/programs/defi-wrapper/use-cases/health/utils.js +389 -0
  237. package/dist/programs/defi-wrapper/use-cases/health/utils.js.map +1 -0
  238. package/dist/programs/defi-wrapper/use-cases/health/write.js +254 -0
  239. package/dist/programs/defi-wrapper/use-cases/health/write.js.map +1 -0
  240. package/dist/programs/defi-wrapper/use-cases/index.d.ts +3 -0
  241. package/dist/programs/defi-wrapper/use-cases/index.js +4 -0
  242. package/dist/programs/defi-wrapper/use-cases/index.js.map +1 -0
  243. package/dist/programs/defi-wrapper/use-cases/main.d.ts +1 -0
  244. package/dist/programs/defi-wrapper/use-cases/main.js +6 -0
  245. package/dist/programs/defi-wrapper/use-cases/main.js.map +1 -0
  246. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.d.ts +1 -0
  247. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.js +143 -0
  248. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/create-pool.js.map +1 -0
  249. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/index.d.ts +3 -0
  250. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/index.js +5 -0
  251. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/index.js.map +1 -0
  252. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/main.d.ts +1 -0
  253. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/main.js +6 -0
  254. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/main.js.map +1 -0
  255. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.d.ts +1 -0
  256. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.js +130 -0
  257. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/read.js.map +1 -0
  258. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/write.d.ts +1 -0
  259. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/write.js +13 -0
  260. package/dist/programs/defi-wrapper/use-cases/wrapper-operations/write.js.map +1 -0
  261. package/dist/programs/dev-tools/anvil/index.d.ts +2 -0
  262. package/dist/programs/dev-tools/anvil/index.js +3 -0
  263. package/dist/programs/dev-tools/anvil/index.js.map +1 -0
  264. package/dist/programs/dev-tools/anvil/main.d.ts +1 -0
  265. package/dist/programs/dev-tools/anvil/main.js +5 -0
  266. package/dist/programs/dev-tools/anvil/main.js.map +1 -0
  267. package/dist/programs/dev-tools/anvil/write.d.ts +1 -0
  268. package/dist/programs/dev-tools/anvil/write.js +122 -0
  269. package/dist/programs/dev-tools/anvil/write.js.map +1 -0
  270. package/dist/programs/dev-tools/defi-wrapper/index.d.ts +2 -0
  271. package/dist/programs/dev-tools/defi-wrapper/index.js +3 -0
  272. package/dist/programs/dev-tools/defi-wrapper/index.js.map +1 -0
  273. package/dist/programs/dev-tools/defi-wrapper/main.d.ts +1 -0
  274. package/dist/programs/dev-tools/defi-wrapper/main.js +6 -0
  275. package/dist/programs/dev-tools/defi-wrapper/main.js.map +1 -0
  276. package/dist/programs/dev-tools/defi-wrapper/write.d.ts +1 -0
  277. package/dist/programs/dev-tools/defi-wrapper/write.js +77 -0
  278. package/dist/programs/dev-tools/defi-wrapper/write.js.map +1 -0
  279. package/dist/programs/dev-tools/index.d.ts +3 -0
  280. package/dist/programs/dev-tools/index.js +4 -0
  281. package/dist/programs/dev-tools/index.js.map +1 -0
  282. package/dist/programs/dev-tools/main.d.ts +1 -0
  283. package/dist/programs/dev-tools/main.js +6 -0
  284. package/dist/programs/dev-tools/main.js.map +1 -0
  285. package/dist/programs/index.d.ts +1 -0
  286. package/dist/programs/index.js +1 -0
  287. package/dist/programs/index.js.map +1 -1
  288. package/dist/programs/pdg-helpers.js +19 -15
  289. package/dist/programs/pdg-helpers.js.map +1 -1
  290. package/dist/programs/use-cases/consolidation/index.d.ts +2 -0
  291. package/dist/programs/use-cases/consolidation/index.js +3 -0
  292. package/dist/programs/use-cases/consolidation/index.js.map +1 -0
  293. package/dist/programs/use-cases/consolidation/main.d.ts +1 -0
  294. package/dist/programs/use-cases/consolidation/main.js +5 -0
  295. package/dist/programs/use-cases/consolidation/main.js.map +1 -0
  296. package/dist/programs/use-cases/consolidation/write.d.ts +1 -0
  297. package/dist/programs/use-cases/consolidation/write.js +78 -0
  298. package/dist/programs/use-cases/consolidation/write.js.map +1 -0
  299. package/dist/programs/use-cases/deposits/read.js +4 -0
  300. package/dist/programs/use-cases/deposits/read.js.map +1 -1
  301. package/dist/programs/use-cases/deposits/write.js +41 -11
  302. package/dist/programs/use-cases/deposits/write.js.map +1 -1
  303. package/dist/programs/use-cases/index.d.ts +1 -0
  304. package/dist/programs/use-cases/index.js +1 -0
  305. package/dist/programs/use-cases/index.js.map +1 -1
  306. package/dist/programs/use-cases/metrics/read.js +9 -20
  307. package/dist/programs/use-cases/metrics/read.js.map +1 -1
  308. package/dist/programs/use-cases/vault-operations/create-vault.js +2 -2
  309. package/dist/programs/use-cases/vault-operations/create-vault.js.map +1 -1
  310. package/dist/providers/wallet.d.ts +14539 -63
  311. package/dist/providers/wallet.js +14 -4
  312. package/dist/providers/wallet.js.map +1 -1
  313. package/dist/tests/utils/bigInt.test.d.ts +1 -0
  314. package/dist/tests/utils/bigInt.test.js +61 -0
  315. package/dist/tests/utils/bigInt.test.js.map +1 -0
  316. package/dist/types/config.d.ts +1 -0
  317. package/dist/utils/arguments.d.ts +4 -0
  318. package/dist/utils/arguments.js +40 -1
  319. package/dist/utils/arguments.js.map +1 -1
  320. package/dist/utils/bigInt.d.ts +2 -0
  321. package/dist/utils/bigInt.js +3 -0
  322. package/dist/utils/bigInt.js.map +1 -0
  323. package/dist/utils/bls.d.ts +2 -2
  324. package/dist/utils/bls.js +8 -7
  325. package/dist/utils/bls.js.map +1 -1
  326. package/dist/utils/cache.d.ts +30 -0
  327. package/dist/utils/cache.js +140 -3
  328. package/dist/utils/cache.js.map +1 -1
  329. package/dist/utils/calculate-overview-v2.js +1 -2
  330. package/dist/utils/calculate-overview-v2.js.map +1 -1
  331. package/dist/utils/calculate-overview.js +1 -2
  332. package/dist/utils/calculate-overview.js.map +1 -1
  333. package/dist/utils/charts/blessed/charts-apr.js +8 -18
  334. package/dist/utils/charts/blessed/charts-apr.js.map +1 -1
  335. package/dist/utils/charts/blessed/charts-rewards.js +7 -17
  336. package/dist/utils/charts/blessed/charts-rewards.js.map +1 -1
  337. package/dist/utils/charts/blessed/datasets/prepare-metrics.d.ts +5 -5
  338. package/dist/utils/charts/blessed/datasets/prepare-metrics.js +11 -11
  339. package/dist/utils/charts/blessed/datasets/prepare-metrics.js.map +1 -1
  340. package/dist/utils/charts/simple/simple-charts.js +8 -18
  341. package/dist/utils/charts/simple/simple-charts.js.map +1 -1
  342. package/dist/utils/commands/confirmations.js +1 -1
  343. package/dist/utils/commands/confirmations.js.map +1 -1
  344. package/dist/utils/commands/report.d.ts +1 -1
  345. package/dist/utils/commands/report.js +3 -2
  346. package/dist/utils/commands/report.js.map +1 -1
  347. package/dist/utils/consolidation/checks.d.ts +7 -0
  348. package/dist/utils/consolidation/checks.js +40 -0
  349. package/dist/utils/consolidation/checks.js.map +1 -0
  350. package/dist/utils/consolidation/confirms.d.ts +4 -0
  351. package/dist/utils/consolidation/confirms.js +41 -0
  352. package/dist/utils/consolidation/confirms.js.map +1 -0
  353. package/dist/utils/consolidation/index.d.ts +6 -0
  354. package/dist/utils/consolidation/index.js +7 -0
  355. package/dist/utils/consolidation/index.js.map +1 -0
  356. package/dist/utils/consolidation/logs.d.ts +3 -0
  357. package/dist/utils/consolidation/logs.js +41 -0
  358. package/dist/utils/consolidation/logs.js.map +1 -0
  359. package/dist/utils/consolidation/pubkeys.d.ts +8 -0
  360. package/dist/utils/consolidation/pubkeys.js +40 -0
  361. package/dist/utils/consolidation/pubkeys.js.map +1 -0
  362. package/dist/utils/consolidation/types.d.ts +11 -0
  363. package/dist/utils/consolidation/types.js +2 -0
  364. package/dist/utils/consolidation/types.js.map +1 -0
  365. package/dist/utils/consolidation/validator-info.d.ts +4 -0
  366. package/dist/utils/consolidation/validator-info.js +34 -0
  367. package/dist/utils/consolidation/validator-info.js.map +1 -0
  368. package/dist/utils/consolidation/validators-checks.d.ts +10 -0
  369. package/dist/utils/consolidation/validators-checks.js +58 -0
  370. package/dist/utils/consolidation/validators-checks.js.map +1 -0
  371. package/dist/utils/fetchCL.d.ts +35 -14
  372. package/dist/utils/fetchCL.js +78 -5
  373. package/dist/utils/fetchCL.js.map +1 -1
  374. package/dist/utils/health/health-utils.d.ts +54 -54
  375. package/dist/utils/index.d.ts +1 -0
  376. package/dist/utils/index.js +1 -0
  377. package/dist/utils/index.js.map +1 -1
  378. package/dist/utils/read-programs-by-abi.d.ts +1 -1
  379. package/dist/utils/read-programs-by-abi.js +4 -18
  380. package/dist/utils/read-programs-by-abi.js.map +1 -1
  381. package/dist/utils/report/report.js +1 -1
  382. package/dist/utils/report/report.js.map +1 -1
  383. package/dist/utils/report/statistic-data.js +3 -3
  384. package/dist/utils/report/statistic-data.js.map +1 -1
  385. package/dist/utils/statistic/report-statistic.d.ts +6 -5
  386. package/dist/utils/statistic/report-statistic.js +15 -16
  387. package/dist/utils/statistic/report-statistic.js.map +1 -1
  388. package/dist/utils/transactions/tx-private-key.js +14 -9
  389. package/dist/utils/transactions/tx-private-key.js.map +1 -1
  390. package/dist/utils/transactions/tx-wc.d.ts +5 -3
  391. package/dist/utils/transactions/tx-wc.js +21 -10
  392. package/dist/utils/transactions/tx-wc.js.map +1 -1
  393. package/dist/utils/transactions/types.d.ts +4 -2
  394. package/dist/utils/wallet-connect.js +3 -3
  395. package/dist/utils/wallet-connect.js.map +1 -1
  396. package/dist/version/index.js +1 -1
  397. package/package.json +2 -2
  398. package/dist/abi/defi-wrapper/StvStrategyPool.d.ts +0 -1769
  399. package/dist/abi/defi-wrapper/StvStrategyPool.js +0 -2319
  400. package/dist/abi/defi-wrapper/StvStrategyPool.js.map +0 -1
  401. package/dist/contracts/defi-wrapper/stv-strategy-pool.d.ts +0 -4
  402. package/dist/contracts/defi-wrapper/stv-strategy-pool.js +0 -11
  403. package/dist/contracts/defi-wrapper/stv-strategy-pool.js.map +0 -1
  404. package/dist/features/defi-wrapper-factory.d.ts +0 -18
  405. package/dist/features/defi-wrapper-factory.js +0 -28
  406. package/dist/features/defi-wrapper-factory.js.map +0 -1
  407. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/config.d.ts +0 -3
  408. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/config.js +0 -214
  409. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/config.js.map +0 -1
  410. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/index.js.map +0 -1
  411. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/main.d.ts +0 -1
  412. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/main.js +0 -6
  413. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/main.js.map +0 -1
  414. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/read.js +0 -77
  415. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/read.js.map +0 -1
  416. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/write.js +0 -370
  417. package/dist/programs/defi-wrapper/contracts/stv-strategy-pool/write.js.map +0 -1
  418. /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/index.d.ts +0 -0
  419. /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/index.js +0 -0
  420. /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/read.d.ts +0 -0
  421. /package/dist/programs/defi-wrapper/{contracts/stv-strategy-pool → use-cases/health}/write.d.ts +0 -0
@@ -16,14 +16,14 @@ withdrawalQueueWrite
16
16
  .description('pause withdrawal requests placement and finalization')
17
17
  .argument('<address>', 'withdrawal queue address', stringToAddress)
18
18
  .action(async (address) => {
19
- const contract = getWithdrawalQueueContract(address);
19
+ const contract = await getWithdrawalQueueContract(address);
20
20
  const confirmationMessage = `Are you sure you want to pause withdrawal requests placement and finalization for the withdrawal queue ${address}?`;
21
21
  const confirm = await confirmOperation(confirmationMessage);
22
22
  if (!confirm)
23
23
  return;
24
24
  await callWriteMethodWithReceipt({
25
25
  contract,
26
- methodName: 'pause',
26
+ methodName: 'pauseWithdrawals',
27
27
  payload: [],
28
28
  });
29
29
  });
@@ -32,14 +32,46 @@ withdrawalQueueWrite
32
32
  .description('resume withdrawal requests placement and finalization')
33
33
  .argument('<address>', 'withdrawal queue address', stringToAddress)
34
34
  .action(async (address) => {
35
- const contract = getWithdrawalQueueContract(address);
35
+ const contract = await getWithdrawalQueueContract(address);
36
36
  const confirmationMessage = `Are you sure you want to resume withdrawal requests placement and finalization for the withdrawal queue ${address}?`;
37
37
  const confirm = await confirmOperation(confirmationMessage);
38
38
  if (!confirm)
39
39
  return;
40
40
  await callWriteMethodWithReceipt({
41
41
  contract,
42
- methodName: 'resume',
42
+ methodName: 'resumeWithdrawals',
43
+ payload: [],
44
+ });
45
+ });
46
+ withdrawalQueueWrite
47
+ .command('pause-finalization')
48
+ .description('pause withdrawal requests finalization')
49
+ .argument('<address>', 'withdrawal queue address', stringToAddress)
50
+ .action(async (address) => {
51
+ const contract = await getWithdrawalQueueContract(address);
52
+ const confirmationMessage = `Are you sure you want to pause withdrawal requests finalization for the withdrawal queue ${address}?`;
53
+ const confirm = await confirmOperation(confirmationMessage);
54
+ if (!confirm)
55
+ return;
56
+ await callWriteMethodWithReceipt({
57
+ contract,
58
+ methodName: 'pauseFinalization',
59
+ payload: [],
60
+ });
61
+ });
62
+ withdrawalQueueWrite
63
+ .command('resume-finalization')
64
+ .description('resume withdrawal requests finalization')
65
+ .argument('<address>', 'withdrawal queue address', stringToAddress)
66
+ .action(async (address) => {
67
+ const contract = await getWithdrawalQueueContract(address);
68
+ const confirmationMessage = `Are you sure you want to resume withdrawal requests finalization for the withdrawal queue ${address}?`;
69
+ const confirm = await confirmOperation(confirmationMessage);
70
+ if (!confirm)
71
+ return;
72
+ await callWriteMethodWithReceipt({
73
+ contract,
74
+ methodName: 'resumeFinalization',
43
75
  payload: [],
44
76
  });
45
77
  });
@@ -51,15 +83,15 @@ withdrawalQueueWrite
51
83
  .argument('<steth>', 'array of amounts of stETH shares to rebalance', stringToBigIntArray)
52
84
  .argument('<address>', 'address that will be able to claim the created request', stringToAddress)
53
85
  .action(async (address, stvToWithdraw, stethSharesToRebalance, owner) => {
54
- const contract = getWithdrawalQueueContract(address);
86
+ const contract = await getWithdrawalQueueContract(address);
55
87
  const confirmationMessage = `Are you sure you want to request multiple withdrawals for ${owner} with ${stvToWithdraw.join(', ')} stv and ${stethSharesToRebalance.join(', ')} steth shares for the withdrawal queue ${address}?`;
56
88
  const confirm = await confirmOperation(confirmationMessage);
57
89
  if (!confirm)
58
90
  return;
59
91
  await callWriteMethodWithReceipt({
60
92
  contract,
61
- methodName: 'requestWithdrawals',
62
- payload: [stvToWithdraw, stethSharesToRebalance, owner],
93
+ methodName: 'requestWithdrawalBatch',
94
+ payload: [owner, stvToWithdraw, stethSharesToRebalance],
63
95
  });
64
96
  });
65
97
  withdrawalQueueWrite
@@ -70,7 +102,7 @@ withdrawalQueueWrite
70
102
  .argument('<steth>', 'amount of steth shares to rebalance', stringToBigInt)
71
103
  .argument('<address>', 'address that will be able to claim the created request', stringToAddress)
72
104
  .action(async (address, stvToWithdraw, stethSharesToRebalance, owner) => {
73
- const contract = getWithdrawalQueueContract(address);
105
+ const contract = await getWithdrawalQueueContract(address);
74
106
  const confirmationMessage = `Are you sure you want to request a withdrawal for ${owner} with ${stvToWithdraw} stv and ${stethSharesToRebalance} steth shares for the withdrawal queue ${address}?`;
75
107
  const confirm = await confirmOperation(confirmationMessage);
76
108
  if (!confirm)
@@ -78,7 +110,7 @@ withdrawalQueueWrite
78
110
  await callWriteMethodWithReceipt({
79
111
  contract,
80
112
  methodName: 'requestWithdrawal',
81
- payload: [stvToWithdraw, stethSharesToRebalance, owner],
113
+ payload: [owner, stvToWithdraw, stethSharesToRebalance],
82
114
  });
83
115
  });
84
116
  withdrawalQueueWrite
@@ -86,16 +118,17 @@ withdrawalQueueWrite
86
118
  .description('finalize withdrawal requests')
87
119
  .argument('<address>', 'withdrawal queue address', stringToAddress)
88
120
  .argument('<maxRequests>', 'the maximum number of requests to finalize', stringToBigInt)
89
- .action(async (address, maxRequests) => {
90
- const contract = getWithdrawalQueueContract(address);
91
- const confirmationMessage = `Are you sure you want to finalize up to ${maxRequests} withdrawal requests for the withdrawal queue ${address}?`;
121
+ .argument('<gasCostCoverageRecipient>', 'address to receive gas cost coverage', stringToAddress)
122
+ .action(async (address, maxRequests, gasCostCoverageRecipient) => {
123
+ const contract = await getWithdrawalQueueContract(address);
124
+ const confirmationMessage = `Are you sure you want to finalize up to ${maxRequests} withdrawal requests for the withdrawal queue ${address} to ${gasCostCoverageRecipient}?`;
92
125
  const confirm = await confirmOperation(confirmationMessage);
93
126
  if (!confirm)
94
127
  return;
95
128
  await callWriteMethodWithReceipt({
96
129
  contract,
97
130
  methodName: 'finalize',
98
- payload: [maxRequests],
131
+ payload: [maxRequests, gasCostCoverageRecipient],
99
132
  });
100
133
  });
101
134
  withdrawalQueueWrite
@@ -103,18 +136,17 @@ withdrawalQueueWrite
103
136
  .description('claim one `_requestId` request once finalized sending locked ether to the owner')
104
137
  .argument('<address>', 'withdrawal queue address', stringToAddress)
105
138
  .argument('<requestId>', 'request id to claim', stringToBigInt)
106
- .argument('<requestor>', 'address of the request owner, should be equal to msg.sender on Wrapper side', stringToAddress)
107
139
  .argument('<recipient>', 'address where claimed ether will be sent to', stringToAddress)
108
- .action(async (address, requestId, requestor, recipient) => {
109
- const contract = getWithdrawalQueueContract(address);
110
- const confirmationMessage = `Are you sure you want to claim request ${requestId} for ${requestor} and send the claimed ether to ${recipient} for the withdrawal queue ${address}?`;
140
+ .action(async (address, requestId, recipient) => {
141
+ const contract = await getWithdrawalQueueContract(address);
142
+ const confirmationMessage = `Are you sure you want to claim request ${requestId} and send the claimed ether to ${recipient} for the withdrawal queue ${address}?`;
111
143
  const confirm = await confirmOperation(confirmationMessage);
112
144
  if (!confirm)
113
145
  return;
114
146
  await callWriteMethodWithReceipt({
115
147
  contract,
116
148
  methodName: 'claimWithdrawal',
117
- payload: [requestId, requestor, recipient],
149
+ payload: [recipient, requestId],
118
150
  });
119
151
  });
120
152
  withdrawalQueueWrite
@@ -123,18 +155,17 @@ withdrawalQueueWrite
123
155
  .argument('<address>', 'withdrawal queue address', stringToAddress)
124
156
  .argument('<requestIds>', 'array of request ids to claim', stringToBigIntArray)
125
157
  .argument('<hints>', 'checkpoint hints. can be found with `findCheckpointHints(_requestIds, 1, getLastCheckpointIndex())`', stringToBigIntArray)
126
- .argument('<requestor>', 'address of the request owner, should be equal to msg.sender on Wrapper side', stringToAddress)
127
158
  .argument('<recipient>', 'address where claimed ether will be sent to', stringToAddress)
128
- .action(async (address, requestIds, hints, requestor, recipient) => {
129
- const contract = getWithdrawalQueueContract(address);
130
- const confirmationMessage = `Are you sure you want to claim requests ${requestIds.join(', ')} for ${requestor} and send the claimed ether to ${recipient} for the withdrawal queue ${address}?`;
159
+ .action(async (address, requestIds, hints, recipient) => {
160
+ const contract = await getWithdrawalQueueContract(address);
161
+ const confirmationMessage = `Are you sure you want to claim requests ${requestIds.join(', ')} and send the claimed ether to ${recipient} for the withdrawal queue ${address}?`;
131
162
  const confirm = await confirmOperation(confirmationMessage);
132
163
  if (!confirm)
133
164
  return;
134
165
  await callWriteMethodWithReceipt({
135
166
  contract,
136
- methodName: 'claimWithdrawals',
137
- payload: [requestIds, hints, requestor, recipient],
167
+ methodName: 'claimWithdrawalBatch',
168
+ payload: [recipient, requestIds, hints],
138
169
  });
139
170
  });
140
171
  //# sourceMappingURL=write.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/contracts/withdrawal-queue/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,cAAc,EACd,mBAAmB,GACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,eAAe,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A6E,EAC7E,eAAe,CAChB;KACA,QAAQ,CACP,aAAa,EACb,6CAA6C,EAC7C,eAAe,CAChB;KACA,MAAM,CACL,KAAK,EACH,OAAgB,EAChB,UAAoB,EACpB,KAAe,EACf,SAAkB,EAClB,SAAkB,EAClB,EAAE;IACF,MAAM,QAAQ,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAErD,MAAM,mBAAmB,GAAG,2CAA2C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,SAAS,kCAAkC,SAAS,6BAA6B,OAAO,GAAG,CAAC;IAChM,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IAC5D,IAAI,CAAC,OAAO;QAAE,OAAO;IAErB,MAAM,0BAA0B,CAAC;QAC/B,QAAQ;QACR,UAAU,EAAE,kBAAkB;QAC9B,OAAO,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC;KACnD,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"write.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/contracts/withdrawal-queue/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,OAAO,EACP,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,cAAc,EACd,mBAAmB,GACpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,oBAAoB,GAAG,eAAe;KACzC,OAAO,CAAC,OAAO,CAAC;KAChB,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,iCAAiC,CAAC,CAAC;AAElD,oBAAoB,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;AACxD,oBAAoB,CAA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0BAA0B,CAAC;QAC/B,QAAQ;QACR,UAAU,EAAE,sBAAsB;QAClC,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './main.js';
2
2
  export * from './contracts/index.js';
3
+ export * from './use-cases/index.js';
@@ -1,3 +1,4 @@
1
1
  export * from './main.js';
2
2
  export * from './contracts/index.js';
3
+ export * from './use-cases/index.js';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../programs/defi-wrapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../programs/defi-wrapper/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/use-cases/health/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const health: import("commander").Command;
@@ -0,0 +1,6 @@
1
+ import { useCases } from '../main.js';
2
+ export const health = useCases
3
+ .command('health')
4
+ .alias('h')
5
+ .description('health monitoring commands for stv-steth-pool positions');
6
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/use-cases/health/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ;KAC3B,OAAO,CAAC,QAAQ,CAAC;KACjB,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,yDAAyD,CAAC,CAAC"}
@@ -0,0 +1,338 @@
1
+ import { formatEther, formatUnits } from 'viem';
2
+ import { health } from './main.js';
3
+ import { getStvStethPoolContract } from '../../../../contracts/defi-wrapper/index.js';
4
+ import { getStethContract } from '../../../../contracts/index.js';
5
+ import { stringToAddress, logTable, logInfo, callReadMethodSilent, stringToNumber, formatBP, } from '../../../../utils/index.js';
6
+ import { getPublicClient } from '../../../../providers/index.js';
7
+ import { isThresholdBreached, calculateEffectiveLTV, calculateThresholdExcess, calculateBalancesFromEvents, } from './utils.js';
8
+ const healthRead = health
9
+ .command('read')
10
+ .aliases(['r'])
11
+ .description('health read commands');
12
+ healthRead
13
+ .command('list-unhealthy')
14
+ .description('list all unhealthy positions in the pool')
15
+ .argument('<address>', 'stv-steth-pool address', stringToAddress)
16
+ .option('--from-block <number>', 'from block number', stringToNumber)
17
+ .option('--to-block <number>', 'to block number (default: latest)', stringToNumber)
18
+ .option('--batch-size <number>', 'max blocks per RPC call (default: 30000)', stringToNumber)
19
+ .option('--verbose', 'show verbose output', false)
20
+ .action(async (address, options) => {
21
+ const poolContract = await getStvStethPoolContract(address);
22
+ const stethContract = await getStethContract();
23
+ logInfo('Fetching pool configuration...');
24
+ // Get pool configuration
25
+ const [forcedRebalanceThresholdBP, name, symbol] = await Promise.all([
26
+ callReadMethodSilent(poolContract, 'forcedRebalanceThresholdBP'),
27
+ callReadMethodSilent(poolContract, 'name'),
28
+ callReadMethodSilent(poolContract, 'symbol'),
29
+ ]);
30
+ logInfo(`Pool: ${name} (${symbol}) at ${address}\nForced Rebalance Threshold: ${formatBP(forcedRebalanceThresholdBP)}\n`);
31
+ // Check health for each account
32
+ const unhealthyPositions = [];
33
+ // Calculate balances from indexed events
34
+ logInfo('📊 Calculating balances from indexed events');
35
+ const balances = await calculateBalancesFromEvents({
36
+ poolAddress: address,
37
+ fromBlock: options.fromBlock,
38
+ toBlock: options.toBlock,
39
+ batchSize: options.batchSize,
40
+ });
41
+ logInfo(`Found ${balances.size} accounts with positions. Checking health...\n`);
42
+ for (const [account, balance] of balances) {
43
+ try {
44
+ const stvBalance = balance.stvBalance;
45
+ const debtShares = balance.debtShares;
46
+ // Still check contract's isHealthy for comparison
47
+ const isHealthy = await callReadMethodSilent(poolContract, 'isHealthyOf', [account]);
48
+ if (options.verbose) {
49
+ logInfo(`Account: ${account}
50
+ stvBalance: ${formatUnits(stvBalance, 27)} STV
51
+ debtShares: ${formatEther(debtShares)} shares
52
+ isHealthy (from contract): ${isHealthy}
53
+ `);
54
+ }
55
+ // Skip accounts with no position
56
+ if (stvBalance === 0n && debtShares === 0n) {
57
+ if (options.verbose) {
58
+ logInfo(` Skipping account ${account} - no position\n`);
59
+ }
60
+ continue;
61
+ }
62
+ // Calculate values in ETH
63
+ const stvInEth = stvBalance > 0n
64
+ ? await callReadMethodSilent(poolContract, 'previewRedeem', [
65
+ stvBalance,
66
+ ])
67
+ : 0n;
68
+ const debtInEth = debtShares > 0n
69
+ ? await callReadMethodSilent(stethContract, 'getPooledEthBySharesRoundUp', [debtShares])
70
+ : 0n;
71
+ if (options.verbose) {
72
+ logInfo(` stvInEth: ${formatEther(stvInEth)} ETH`);
73
+ logInfo(` debtInEth: ${formatEther(debtInEth)} ETH`);
74
+ logInfo(` forcedRebalanceThresholdBP: ${formatBP(forcedRebalanceThresholdBP)}`);
75
+ }
76
+ // Use contract-accurate threshold check
77
+ const thresholdBreached = isThresholdBreached({
78
+ assets: stvInEth,
79
+ stethShares: debtShares,
80
+ debtInEth,
81
+ forcedRebalanceThresholdBP,
82
+ verbose: options.verbose,
83
+ });
84
+ // Calculate display metrics
85
+ const ltvRatio = calculateEffectiveLTV({
86
+ assets: stvInEth,
87
+ debtInEth,
88
+ });
89
+ const thresholdExcess = calculateThresholdExcess({
90
+ assets: stvInEth,
91
+ stethShares: debtShares,
92
+ debtInEth,
93
+ forcedRebalanceThresholdBP,
94
+ verbose: options.verbose,
95
+ });
96
+ if (options.verbose) {
97
+ logInfo(` thresholdBreached (our calc): ${thresholdBreached}
98
+ ltvRatio: ${ltvRatio / 100}%
99
+ thresholdExcess: ${thresholdExcess / 100}%
100
+ `);
101
+ }
102
+ // Sanity check: contract's isHealthy should be inverse of our thresholdBreached
103
+ // isHealthy = true means healthy, thresholdBreached = false means healthy
104
+ if (isHealthy === thresholdBreached) {
105
+ logInfo(` ⚠️ MISMATCH: Contract isHealthy=${isHealthy}, our thresholdBreached=${thresholdBreached}`);
106
+ logInfo(`⚠️ WARNING: Health check mismatch for ${account}! Contract isHealthy=${isHealthy}, but our thresholdBreached=${thresholdBreached}`);
107
+ }
108
+ else {
109
+ if (options.verbose) {
110
+ logInfo(' ✅ Health check matches contract');
111
+ }
112
+ }
113
+ if (!isHealthy && stvBalance > 0n) {
114
+ unhealthyPositions.push({
115
+ account,
116
+ stvBalance,
117
+ stvInEth,
118
+ debtShares,
119
+ debtInEth,
120
+ ltvRatio,
121
+ isHealthy,
122
+ thresholdExcess,
123
+ });
124
+ }
125
+ }
126
+ catch (error) {
127
+ logInfo(`Error checking account ${account}: ${error}`);
128
+ }
129
+ }
130
+ // Sort by threshold excess descending (most critical first)
131
+ unhealthyPositions.sort((a, b) => b.thresholdExcess - a.thresholdExcess);
132
+ if (unhealthyPositions.length === 0) {
133
+ logInfo('✅ No unhealthy positions found!');
134
+ return;
135
+ }
136
+ logInfo('⚠️ Unhealthy Positions Report\n');
137
+ const tableData = unhealthyPositions.map((p) => [
138
+ p.account,
139
+ `${formatUnits(p.stvBalance, 27)} STV`,
140
+ `${formatEther(p.debtShares)} shares`,
141
+ `${formatEther(p.debtInEth)} ETH`,
142
+ `${(p.ltvRatio / 100).toFixed(2)}%`, // Display LTV
143
+ `+${(p.thresholdExcess / 100).toFixed(2)}%`, // How much over threshold
144
+ p.thresholdExcess > 1000 // > 10% over threshold
145
+ ? '🚨 CRITICAL'
146
+ : '⚠️ UNHEALTHY',
147
+ ]);
148
+ logTable({
149
+ params: {
150
+ head: [
151
+ 'Account',
152
+ 'STV Balance',
153
+ 'Debt (shares)',
154
+ 'Debt (ETH)',
155
+ 'LTV Ratio',
156
+ 'Over Threshold',
157
+ 'Status',
158
+ ],
159
+ },
160
+ data: tableData,
161
+ });
162
+ logInfo(`\nTotal Unhealthy Accounts: ${unhealthyPositions.length}`);
163
+ logInfo(`Threshold: ${(Number(forcedRebalanceThresholdBP) / 100).toFixed(2)}%`);
164
+ });
165
+ healthRead
166
+ .command('calculate-rebalance-need')
167
+ .description('calculate total ETH needed to rebalance all unhealthy positions')
168
+ .argument('<address>', 'stv-steth-pool address', stringToAddress)
169
+ .option('--from-block <number>', 'from block number', stringToNumber)
170
+ .option('--batch-size <number>', 'max blocks per RPC call (default: 30000)', stringToNumber)
171
+ .option('--verbose', 'show verbose output', false)
172
+ .action(async (address, options) => {
173
+ const poolContract = await getStvStethPoolContract(address);
174
+ const stethContract = await getStethContract();
175
+ logInfo('Calculating rebalance requirements...\n');
176
+ // Get pool info
177
+ const [name, symbol, totalExceedingMintedSteth, vaultAddress] = await Promise.all([
178
+ callReadMethodSilent(poolContract, 'name'),
179
+ callReadMethodSilent(poolContract, 'symbol'),
180
+ callReadMethodSilent(poolContract, 'totalExceedingMintedSteth'),
181
+ callReadMethodSilent(poolContract, 'VAULT'),
182
+ ]);
183
+ logInfo(`Pool: ${name} (${symbol}) at ${address}\n`);
184
+ // Calculate balances from indexed events
185
+ const balances = await calculateBalancesFromEvents({
186
+ poolAddress: address,
187
+ fromBlock: options.fromBlock,
188
+ batchSize: options.batchSize,
189
+ });
190
+ const rebalanceRequirements = [];
191
+ let totalStethRequired = 0n;
192
+ for (const [account, balance] of balances) {
193
+ try {
194
+ // Skip accounts with no position
195
+ if (balance.stvBalance === 0n && balance.debtShares === 0n) {
196
+ continue;
197
+ }
198
+ const isHealthy = await callReadMethodSilent(poolContract, 'isHealthyOf', [account]);
199
+ if (!isHealthy) {
200
+ // Call previewForceRebalance
201
+ const [stethShares, stvToBurn, isUndercollateralized] = await callReadMethodSilent(poolContract, 'previewForceRebalance', [account]);
202
+ if (stvToBurn > 0n) {
203
+ // Convert stETH shares to ETH
204
+ const stethInEth = await callReadMethodSilent(stethContract, 'getPooledEthBySharesRoundUp', [stethShares]);
205
+ rebalanceRequirements.push({
206
+ account,
207
+ stvToBurn,
208
+ stethShares,
209
+ stethInEth,
210
+ isUndercollateralized,
211
+ });
212
+ totalStethRequired += stethInEth;
213
+ }
214
+ }
215
+ }
216
+ catch (error) {
217
+ logInfo(`Error processing account ${account}: ${error}`);
218
+ }
219
+ }
220
+ // Get vault balance
221
+ const publicClient = await getPublicClient();
222
+ const vaultEthBalance = await publicClient.getBalance({
223
+ address: vaultAddress,
224
+ });
225
+ // Calculate adjusted requirement after exceeding stETH
226
+ // "Exceeding minted stETH" is already available in the pool and can be used
227
+ // for rebalancing WITHOUT providing additional ETH.
228
+ // So we subtract it from total required to get the REAL ETH need.
229
+ const adjustedRequirement = totalStethRequired > totalExceedingMintedSteth
230
+ ? totalStethRequired - totalExceedingMintedSteth
231
+ : 0n;
232
+ // Calculate ETH shortfall: how much MORE ETH is needed beyond vault balance
233
+ const ethShortfall = adjustedRequirement > vaultEthBalance
234
+ ? adjustedRequirement - vaultEthBalance
235
+ : 0n;
236
+ // Output summary
237
+ logInfo('═'.repeat(70));
238
+ logInfo('REBALANCE REQUIREMENTS REPORT');
239
+ logInfo('═'.repeat(70) + '\n');
240
+ logTable({
241
+ data: [
242
+ ['Pool', address],
243
+ ['Pool Name', `${name} (${symbol})`],
244
+ ['', ''],
245
+ ['📊 Unhealthy Accounts', rebalanceRequirements.length.toString()],
246
+ ['', ''],
247
+ ['═══ REBALANCE NEEDS ═══', ''],
248
+ [
249
+ '1️⃣ Total stETH Required (raw)',
250
+ `${formatEther(totalStethRequired)} ETH`,
251
+ ],
252
+ [
253
+ '2️⃣ Exceeding Minted stETH (available)',
254
+ totalExceedingMintedSteth > 0n
255
+ ? `${formatEther(totalExceedingMintedSteth)} ETH ✅`
256
+ : `${formatEther(totalExceedingMintedSteth)} ETH`,
257
+ ],
258
+ [
259
+ '3️⃣ After Exceeding Adjustment',
260
+ adjustedRequirement > 0n
261
+ ? `${formatEther(adjustedRequirement)} ETH (real need)`
262
+ : `${formatEther(adjustedRequirement)} ETH ✅ (covered by exceeding)`,
263
+ ],
264
+ ['', ''],
265
+ ['═══ VAULT RESOURCES ═══', ''],
266
+ ['💰 Vault ETH Balance', `${formatEther(vaultEthBalance)} ETH`],
267
+ [
268
+ '🎯 ETH Shortfall',
269
+ ethShortfall > 0n
270
+ ? `⚠️ ${formatEther(ethShortfall)} ETH (NEED MORE)`
271
+ : `✅ ${formatEther(ethShortfall)} ETH (SUFFICIENT)`,
272
+ ],
273
+ ],
274
+ });
275
+ if (options.verbose && rebalanceRequirements.length > 0) {
276
+ logInfo('\n' + '─'.repeat(70));
277
+ logInfo('DETAILED BREAKDOWN BY ACCOUNT');
278
+ logInfo('─'.repeat(70) + '\n');
279
+ const detailedData = rebalanceRequirements.map((r) => [
280
+ r.account,
281
+ formatUnits(r.stvToBurn, 27),
282
+ formatEther(r.stethShares),
283
+ formatEther(r.stethInEth),
284
+ r.isUndercollateralized ? '⚠️ Yes' : 'No',
285
+ ]);
286
+ logTable({
287
+ params: {
288
+ head: [
289
+ 'Account',
290
+ 'STV to Burn',
291
+ 'stETH Shares',
292
+ 'stETH (ETH)',
293
+ 'Undercollateralized',
294
+ ],
295
+ },
296
+ data: detailedData,
297
+ });
298
+ }
299
+ // Action items
300
+ logInfo('\n' + '═'.repeat(70));
301
+ logInfo('ACTION ITEMS');
302
+ logInfo('═'.repeat(70) + '\n');
303
+ if (rebalanceRequirements.length === 0) {
304
+ logInfo('✅ No rebalance needed - all positions are healthy!\n');
305
+ }
306
+ else {
307
+ // Explain the rebalance strategy
308
+ if (totalExceedingMintedSteth > 0n) {
309
+ logInfo(`1. 🔄 Can rebalance using exceeding stETH: ${formatEther(totalExceedingMintedSteth)} ETH`);
310
+ logInfo(` This stETH is already in the pool and doesn't require external ETH`);
311
+ }
312
+ else {
313
+ logInfo(`1. 🔄 No exceeding stETH available - will need to provide ETH externally`);
314
+ }
315
+ if (ethShortfall > 0n) {
316
+ logInfo(`\n2. ⚠️ Need to provide ${formatEther(ethShortfall)} ETH from external source`);
317
+ logInfo(` Command: yarn start dw stv-steth w rebalance-unassigned-liability-with-ether \\`);
318
+ logInfo(` ${address} ${formatEther(ethShortfall)}`);
319
+ }
320
+ else if (adjustedRequirement > 0n) {
321
+ logInfo(`\n2. ✅ Vault has sufficient ETH balance (${formatEther(vaultEthBalance)} ETH available)`);
322
+ }
323
+ else {
324
+ logInfo('\n2. ✅ Exceeding stETH fully covers all rebalance needs - no ETH required!');
325
+ }
326
+ logInfo(`\n3. 🎯 Execute rebalances for each account:`);
327
+ logInfo(` Command: yarn start dw uc h force-rebalance ${address} <account-address>`);
328
+ const undercollateralizedCount = rebalanceRequirements.filter((r) => r.isUndercollateralized).length;
329
+ if (undercollateralizedCount > 0) {
330
+ logInfo(`\n⚠️ CRITICAL: ${undercollateralizedCount} of ${rebalanceRequirements.length} accounts are UNDERCOLLATERALIZED!`);
331
+ logInfo(' These positions have debt > collateral and will cause LOSSES.');
332
+ logInfo(' Requires: LOSS_SOCIALIZER_ROLE to execute');
333
+ logInfo(` Command: yarn start dw uc h force-rebalance-and-socialize-loss ${address} <account-address>`);
334
+ }
335
+ logInfo('');
336
+ }
337
+ });
338
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../../programs/defi-wrapper/use-cases/health/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACt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E,CAAC,CAAC;QACjE,CAAC;aAAM,IAAI,mBAAmB,GAAG,EAAE,EAAE,CAAC;YACpC,OAAO,CACL,4CAA4C,WAAW,CAAC,eAAe,CAAC,iBAAiB,CAC1F,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CACL,4EAA4E,CAC7E,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,8CAA8C,CAAC,CAAC;QACxD,OAAO,CACL,kDAAkD,OAAO,oBAAoB,CAC9E,CAAC;QAEF,MAAM,wBAAwB,GAAG,qBAAqB,CAAC,MAAM,CAC3D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAC/B,CAAC,MAAM,CAAC;QACT,IAAI,wBAAwB,GAAG,CAAC,EAAE,CAAC;YACjC,OAAO,CACL,mBAAmB,wBAAwB,OAAO,qBAAqB,CAAC,MAAM,oCAAoC,CACnH,CAAC;YACF,OAAO,CACL,kEAAkE,CACnE,CAAC;YACF,OAAO,CAAC,8CAA8C,CAAC,CAAC;YACxD,OAAO,CACL,qEAAqE,OAAO,oBAAoB,CACjG,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { Address } from 'viem';
2
+ /**
3
+ * Replicates the contract's _isThresholdBreached logic
4
+ * @param assets - STV assets value in ETH (from previewRedeem)
5
+ * @param stethShares - debt in stETH shares
6
+ * @param debtInEth - debt in ETH (from getPooledEthBySharesRoundUp)
7
+ * @param forcedRebalanceThresholdBP - threshold in basis points
8
+ * @returns true if threshold is breached (position is unhealthy)
9
+ */
10
+ export declare const isThresholdBreached: ({ assets, stethShares, debtInEth, forcedRebalanceThresholdBP, verbose, }: {
11
+ assets: bigint;
12
+ stethShares: bigint;
13
+ debtInEth: bigint;
14
+ forcedRebalanceThresholdBP: bigint;
15
+ verbose?: boolean;
16
+ }) => boolean;
17
+ /**
18
+ * Calculate the "effective LTV ratio" for display purposes
19
+ * This shows how close the position is to the threshold
20
+ * Returns basis points (10000 = 100%)
21
+ */
22
+ export declare const calculateEffectiveLTV: ({ assets, debtInEth, }: {
23
+ assets: bigint;
24
+ debtInEth: bigint;
25
+ }) => number;
26
+ /**
27
+ * Calculate how much the position exceeds the threshold
28
+ * Returns basis points of how much over threshold (negative if healthy)
29
+ */
30
+ export declare const calculateThresholdExcess: ({ assets, stethShares, debtInEth, forcedRebalanceThresholdBP, verbose, }: {
31
+ assets: bigint;
32
+ stethShares: bigint;
33
+ debtInEth: bigint;
34
+ forcedRebalanceThresholdBP: bigint;
35
+ verbose?: boolean;
36
+ }) => number;
37
+ export declare const indexAccountsFromEvents: ({ poolAddress, fromBlock, toBlock, batchSize, }: {
38
+ poolAddress: Address;
39
+ fromBlock?: number;
40
+ toBlock?: number;
41
+ batchSize?: number;
42
+ }) => Promise<Set<Address>>;
43
+ /**
44
+ * Calculate account balances from indexed events
45
+ */
46
+ export declare const calculateBalancesFromEvents: ({ poolAddress, fromBlock, toBlock, batchSize, }: {
47
+ poolAddress: Address;
48
+ fromBlock?: number;
49
+ toBlock?: number;
50
+ batchSize?: number;
51
+ }) => Promise<Map<Address, {
52
+ stvBalance: bigint;
53
+ debtShares: bigint;
54
+ }>>;
55
+ export declare const grantLossSocializerRole: (address: Address, currentAccount: Address) => Promise<void>;
56
+ export declare const setMaxLossSocializationBP: (address: Address) => Promise<void>;