dexbot 1.1.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 (807) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +287 -0
  3. package/claw/README.md +513 -0
  4. package/claw/scripts/memu_runner.py +385 -0
  5. package/claw/skills/bitshares-guide/SKILL.md +14 -0
  6. package/claw/skills/bitshares-guide/references/example-skill-shells.md +18 -0
  7. package/claw/skills/bitshares-guide/references/presentation-patterns.md +19 -0
  8. package/claw/skills/bitshares-guide/references/scope-guardrails.md +9 -0
  9. package/claw/skills/launcher-ops/SKILL.md +18 -0
  10. package/claw/skills/launcher-ops/references/launcher-workflow.md +23 -0
  11. package/claw/skills/margin-trading/SKILL.md +23 -0
  12. package/claw/skills/margin-trading/references/honest-asset-list.md +74 -0
  13. package/claw/skills/margin-trading/references/honest-assets.md +44 -0
  14. package/claw/skills/margin-trading/references/position-management.md +203 -0
  15. package/claw/skills/margin-trading/references/trading-concepts.md +80 -0
  16. package/claw/skills/memu-memory/SKILL.md +218 -0
  17. package/claw/skills/shared/references/js-automation-overview.md +24 -0
  18. package/claw/skills/shared/references/safety-and-staleness.md +11 -0
  19. package/claw/skills/shared/references/skill-boundaries.md +17 -0
  20. package/claw/skills/trend-detection/SKILL.md +33 -0
  21. package/claw/skills/trend-detection/agents/openai.yaml +3 -0
  22. package/claw/skills/trend-detection/references/service.md +45 -0
  23. package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts +3 -0
  24. package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +1 -0
  25. package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +149 -0
  26. package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +1 -0
  27. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts +3 -0
  28. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +1 -0
  29. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +387 -0
  30. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -0
  31. package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts +3 -0
  32. package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +1 -0
  33. package/dist/analysis/ama_fitting/calibrate_convergence_er.js +200 -0
  34. package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +1 -0
  35. package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts +3 -0
  36. package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +1 -0
  37. package/dist/analysis/ama_fitting/fetch_lp_candles.js +212 -0
  38. package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +1 -0
  39. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +31 -0
  40. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +1 -0
  41. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +249 -0
  42. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +1 -0
  43. package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts +2 -0
  44. package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +1 -0
  45. package/dist/analysis/ama_fitting/optimizer_high_resolution.js +782 -0
  46. package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +1 -0
  47. package/dist/analysis/analyze_derivatives.d.ts +95 -0
  48. package/dist/analysis/analyze_derivatives.d.ts.map +1 -0
  49. package/dist/analysis/analyze_derivatives.js +295 -0
  50. package/dist/analysis/analyze_derivatives.js.map +1 -0
  51. package/dist/analysis/analyze_dynamic_weight.d.ts +14 -0
  52. package/dist/analysis/analyze_dynamic_weight.d.ts.map +1 -0
  53. package/dist/analysis/analyze_dynamic_weight.js +208 -0
  54. package/dist/analysis/analyze_dynamic_weight.js.map +1 -0
  55. package/dist/analysis/analyze_kalman.d.ts +13 -0
  56. package/dist/analysis/analyze_kalman.d.ts.map +1 -0
  57. package/dist/analysis/analyze_kalman.js +123 -0
  58. package/dist/analysis/analyze_kalman.js.map +1 -0
  59. package/dist/analysis/analyze_regime.d.ts +20 -0
  60. package/dist/analysis/analyze_regime.d.ts.map +1 -0
  61. package/dist/analysis/analyze_regime.js +139 -0
  62. package/dist/analysis/analyze_regime.js.map +1 -0
  63. package/dist/analysis/analyze_regime_windows.d.ts +19 -0
  64. package/dist/analysis/analyze_regime_windows.d.ts.map +1 -0
  65. package/dist/analysis/analyze_regime_windows.js +413 -0
  66. package/dist/analysis/analyze_regime_windows.js.map +1 -0
  67. package/dist/analysis/analyze_risk_profile.d.ts +3 -0
  68. package/dist/analysis/analyze_risk_profile.d.ts.map +1 -0
  69. package/dist/analysis/analyze_risk_profile.js +159 -0
  70. package/dist/analysis/analyze_risk_profile.js.map +1 -0
  71. package/dist/analysis/analyze_trade_heatmap.d.ts +3 -0
  72. package/dist/analysis/analyze_trade_heatmap.d.ts.map +1 -0
  73. package/dist/analysis/analyze_trade_heatmap.js +367 -0
  74. package/dist/analysis/analyze_trade_heatmap.js.map +1 -0
  75. package/dist/analysis/analyze_volatility.d.ts +22 -0
  76. package/dist/analysis/analyze_volatility.d.ts.map +1 -0
  77. package/dist/analysis/analyze_volatility.js +172 -0
  78. package/dist/analysis/analyze_volatility.js.map +1 -0
  79. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +99 -0
  80. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +1 -0
  81. package/dist/analysis/bot_fitting/backtest_ama_sweep.js +804 -0
  82. package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +1 -0
  83. package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +2 -0
  84. package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +1 -0
  85. package/dist/analysis/bot_fitting/backtest_bot_fitting.js +347 -0
  86. package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +1 -0
  87. package/dist/analysis/bot_fitting/shared_utils.d.ts +15 -0
  88. package/dist/analysis/bot_fitting/shared_utils.d.ts.map +1 -0
  89. package/dist/analysis/bot_fitting/shared_utils.js +48 -0
  90. package/dist/analysis/bot_fitting/shared_utils.js.map +1 -0
  91. package/dist/analysis/bot_key_utils.d.ts +16 -0
  92. package/dist/analysis/bot_key_utils.d.ts.map +1 -0
  93. package/dist/analysis/bot_key_utils.js +61 -0
  94. package/dist/analysis/bot_key_utils.js.map +1 -0
  95. package/dist/analysis/bot_usage/discover_bot_accounts.d.ts +3 -0
  96. package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +1 -0
  97. package/dist/analysis/bot_usage/discover_bot_accounts.js +498 -0
  98. package/dist/analysis/bot_usage/discover_bot_accounts.js.map +1 -0
  99. package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +546 -0
  100. package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +1 -0
  101. package/dist/analysis/bot_usage/kibana_bot_queries.js +427 -0
  102. package/dist/analysis/bot_usage/kibana_bot_queries.js.map +1 -0
  103. package/dist/analysis/chart_utils.d.ts +13 -0
  104. package/dist/analysis/chart_utils.d.ts.map +1 -0
  105. package/dist/analysis/chart_utils.js +142 -0
  106. package/dist/analysis/chart_utils.js.map +1 -0
  107. package/dist/analysis/derivative_chart_generator.d.ts +18 -0
  108. package/dist/analysis/derivative_chart_generator.d.ts.map +1 -0
  109. package/dist/analysis/derivative_chart_generator.js +896 -0
  110. package/dist/analysis/derivative_chart_generator.js.map +1 -0
  111. package/dist/analysis/math_utils.d.ts +35 -0
  112. package/dist/analysis/math_utils.d.ts.map +1 -0
  113. package/dist/analysis/math_utils.js +121 -0
  114. package/dist/analysis/math_utils.js.map +1 -0
  115. package/dist/analysis/price_sources.d.ts +34 -0
  116. package/dist/analysis/price_sources.d.ts.map +1 -0
  117. package/dist/analysis/price_sources.js +103 -0
  118. package/dist/analysis/price_sources.js.map +1 -0
  119. package/dist/analysis/trade_profitability.d.ts +115 -0
  120. package/dist/analysis/trade_profitability.d.ts.map +1 -0
  121. package/dist/analysis/trade_profitability.js +1247 -0
  122. package/dist/analysis/trade_profitability.js.map +1 -0
  123. package/dist/analysis/tradingview/analyze_tradingview.d.ts +38 -0
  124. package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +1 -0
  125. package/dist/analysis/tradingview/analyze_tradingview.js +212 -0
  126. package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -0
  127. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +9 -0
  128. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -0
  129. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +1717 -0
  130. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -0
  131. package/dist/analysis/trend_detection/derivative_analyzer.d.ts +250 -0
  132. package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +1 -0
  133. package/dist/analysis/trend_detection/derivative_analyzer.js +903 -0
  134. package/dist/analysis/trend_detection/derivative_analyzer.js.map +1 -0
  135. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +6 -0
  136. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -0
  137. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +1449 -0
  138. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -0
  139. package/dist/analysis/trend_detection/hurst_analyzer.d.ts +42 -0
  140. package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -0
  141. package/dist/analysis/trend_detection/hurst_analyzer.js +159 -0
  142. package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -0
  143. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +6 -0
  144. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +1 -0
  145. package/dist/analysis/trend_detection/kalman_chart_generator.js +408 -0
  146. package/dist/analysis/trend_detection/kalman_chart_generator.js.map +1 -0
  147. package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts +103 -0
  148. package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +1 -0
  149. package/dist/analysis/trend_detection/kalman_trend_analyzer.js +229 -0
  150. package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -0
  151. package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts +34 -0
  152. package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +1 -0
  153. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +89 -0
  154. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -0
  155. package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts +39 -0
  156. package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +1 -0
  157. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +132 -0
  158. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -0
  159. package/dist/analysis/trend_detection/regime_chart_generator.d.ts +6 -0
  160. package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +1 -0
  161. package/dist/analysis/trend_detection/regime_chart_generator.js +345 -0
  162. package/dist/analysis/trend_detection/regime_chart_generator.js.map +1 -0
  163. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +2 -0
  164. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +1 -0
  165. package/dist/analysis/trend_detection/tests/test_kalman_trend.js +130 -0
  166. package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +1 -0
  167. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +2 -0
  168. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +1 -0
  169. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +38 -0
  170. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +1 -0
  171. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +6 -0
  172. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +1 -0
  173. package/dist/analysis/trend_detection/volatility_chart_generator.js +732 -0
  174. package/dist/analysis/trend_detection/volatility_chart_generator.js.map +1 -0
  175. package/dist/bot.d.ts +49 -0
  176. package/dist/bot.d.ts.map +1 -0
  177. package/dist/bot.js +221 -0
  178. package/dist/bot.js.map +1 -0
  179. package/dist/credential-daemon.d.ts +64 -0
  180. package/dist/credential-daemon.d.ts.map +1 -0
  181. package/dist/credential-daemon.js +987 -0
  182. package/dist/credential-daemon.js.map +1 -0
  183. package/dist/dexbot.d.ts +87 -0
  184. package/dist/dexbot.d.ts.map +1 -0
  185. package/dist/dexbot.js +1222 -0
  186. package/dist/dexbot.js.map +1 -0
  187. package/dist/market_adapter/ama_signal_runner.d.ts +3 -0
  188. package/dist/market_adapter/ama_signal_runner.d.ts.map +1 -0
  189. package/dist/market_adapter/ama_signal_runner.js +175 -0
  190. package/dist/market_adapter/ama_signal_runner.js.map +1 -0
  191. package/dist/market_adapter/candle_utils.d.ts +57 -0
  192. package/dist/market_adapter/candle_utils.d.ts.map +1 -0
  193. package/dist/market_adapter/candle_utils.js +252 -0
  194. package/dist/market_adapter/candle_utils.js.map +1 -0
  195. package/dist/market_adapter/core/asymmetric_bounds.d.ts +20 -0
  196. package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -0
  197. package/dist/market_adapter/core/asymmetric_bounds.js +88 -0
  198. package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -0
  199. package/dist/market_adapter/core/config_normalizers.d.ts +10 -0
  200. package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -0
  201. package/dist/market_adapter/core/config_normalizers.js +24 -0
  202. package/dist/market_adapter/core/config_normalizers.js.map +1 -0
  203. package/dist/market_adapter/core/kibana_candles.d.ts +74 -0
  204. package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -0
  205. package/dist/market_adapter/core/kibana_candles.js +249 -0
  206. package/dist/market_adapter/core/kibana_candles.js.map +1 -0
  207. package/dist/market_adapter/core/kibana_client.d.ts +27 -0
  208. package/dist/market_adapter/core/kibana_client.d.ts.map +1 -0
  209. package/dist/market_adapter/core/kibana_client.js +120 -0
  210. package/dist/market_adapter/core/kibana_client.js.map +1 -0
  211. package/dist/market_adapter/core/kibana_market_candles.d.ts +143 -0
  212. package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -0
  213. package/dist/market_adapter/core/kibana_market_candles.js +170 -0
  214. package/dist/market_adapter/core/kibana_market_candles.js.map +1 -0
  215. package/dist/market_adapter/core/market_adapter_service.d.ts +210 -0
  216. package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -0
  217. package/dist/market_adapter/core/market_adapter_service.js +2328 -0
  218. package/dist/market_adapter/core/market_adapter_service.js.map +1 -0
  219. package/dist/market_adapter/core/strategies/ama.d.ts +2 -0
  220. package/dist/market_adapter/core/strategies/ama.d.ts.map +1 -0
  221. package/dist/market_adapter/core/strategies/ama.js +138 -0
  222. package/dist/market_adapter/core/strategies/ama.js.map +1 -0
  223. package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +50 -0
  224. package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -0
  225. package/dist/market_adapter/core/strategies/ama_slope_model.js +143 -0
  226. package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -0
  227. package/dist/market_adapter/core/strategies/atr/calculator.d.ts +12 -0
  228. package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -0
  229. package/dist/market_adapter/core/strategies/atr/calculator.js +47 -0
  230. package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -0
  231. package/dist/market_adapter/core/strategies/collateral_manager.d.ts +32 -0
  232. package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -0
  233. package/dist/market_adapter/core/strategies/collateral_manager.js +68 -0
  234. package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -0
  235. package/dist/market_adapter/core/strategies/regime_gate.d.ts +66 -0
  236. package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -0
  237. package/dist/market_adapter/core/strategies/regime_gate.js +189 -0
  238. package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -0
  239. package/dist/market_adapter/index.d.ts +10 -0
  240. package/dist/market_adapter/index.d.ts.map +1 -0
  241. package/dist/market_adapter/index.js +71 -0
  242. package/dist/market_adapter/index.js.map +1 -0
  243. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts +3 -0
  244. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +1 -0
  245. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +1165 -0
  246. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -0
  247. package/dist/market_adapter/inputs/fetch_lp_data.d.ts +54 -0
  248. package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -0
  249. package/dist/market_adapter/inputs/fetch_lp_data.js +743 -0
  250. package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -0
  251. package/dist/market_adapter/inputs/kibana_source.d.ts +68 -0
  252. package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -0
  253. package/dist/market_adapter/inputs/kibana_source.js +143 -0
  254. package/dist/market_adapter/inputs/kibana_source.js.map +1 -0
  255. package/dist/market_adapter/interval_utils.d.ts +6 -0
  256. package/dist/market_adapter/interval_utils.d.ts.map +1 -0
  257. package/dist/market_adapter/interval_utils.js +14 -0
  258. package/dist/market_adapter/interval_utils.js.map +1 -0
  259. package/dist/market_adapter/log_format.d.ts +16 -0
  260. package/dist/market_adapter/log_format.d.ts.map +1 -0
  261. package/dist/market_adapter/log_format.js +72 -0
  262. package/dist/market_adapter/log_format.js.map +1 -0
  263. package/dist/market_adapter/lp_chart_core.d.ts +6 -0
  264. package/dist/market_adapter/lp_chart_core.d.ts.map +1 -0
  265. package/dist/market_adapter/lp_chart_core.js +874 -0
  266. package/dist/market_adapter/lp_chart_core.js.map +1 -0
  267. package/dist/market_adapter/lp_chart_runner.d.ts +135 -0
  268. package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -0
  269. package/dist/market_adapter/lp_chart_runner.js +337 -0
  270. package/dist/market_adapter/lp_chart_runner.js.map +1 -0
  271. package/dist/market_adapter/lp_chart_strategy_loader.d.ts +23 -0
  272. package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -0
  273. package/dist/market_adapter/lp_chart_strategy_loader.js +169 -0
  274. package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -0
  275. package/dist/market_adapter/market_adapter.d.ts +133 -0
  276. package/dist/market_adapter/market_adapter.d.ts.map +1 -0
  277. package/dist/market_adapter/market_adapter.js +1331 -0
  278. package/dist/market_adapter/market_adapter.js.map +1 -0
  279. package/dist/market_adapter/merge_lp_data.d.ts +3 -0
  280. package/dist/market_adapter/merge_lp_data.d.ts.map +1 -0
  281. package/dist/market_adapter/merge_lp_data.js +125 -0
  282. package/dist/market_adapter/merge_lp_data.js.map +1 -0
  283. package/dist/market_adapter/test_helpers.d.ts +14 -0
  284. package/dist/market_adapter/test_helpers.d.ts.map +1 -0
  285. package/dist/market_adapter/test_helpers.js +22 -0
  286. package/dist/market_adapter/test_helpers.js.map +1 -0
  287. package/dist/market_adapter/utils/adapter_client.d.ts +20 -0
  288. package/dist/market_adapter/utils/adapter_client.d.ts.map +1 -0
  289. package/dist/market_adapter/utils/adapter_client.js +88 -0
  290. package/dist/market_adapter/utils/adapter_client.js.map +1 -0
  291. package/dist/market_adapter/utils/atomic_write.d.ts +9 -0
  292. package/dist/market_adapter/utils/atomic_write.d.ts.map +1 -0
  293. package/dist/market_adapter/utils/atomic_write.js +13 -0
  294. package/dist/market_adapter/utils/atomic_write.js.map +1 -0
  295. package/dist/market_adapter/utils/chain.d.ts +50 -0
  296. package/dist/market_adapter/utils/chain.d.ts.map +1 -0
  297. package/dist/market_adapter/utils/chain.js +196 -0
  298. package/dist/market_adapter/utils/chain.js.map +1 -0
  299. package/dist/market_adapter/utils/data_discovery.d.ts +6 -0
  300. package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -0
  301. package/dist/market_adapter/utils/data_discovery.js +35 -0
  302. package/dist/market_adapter/utils/data_discovery.js.map +1 -0
  303. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +15 -0
  304. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -0
  305. package/dist/market_adapter/utils/dynamic_grid_snapshot.js +60 -0
  306. package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -0
  307. package/dist/market_adapter/utils/file_lock.d.ts +19 -0
  308. package/dist/market_adapter/utils/file_lock.d.ts.map +1 -0
  309. package/dist/market_adapter/utils/file_lock.js +191 -0
  310. package/dist/market_adapter/utils/file_lock.js.map +1 -0
  311. package/dist/market_adapter/utils/native_history.d.ts +19 -0
  312. package/dist/market_adapter/utils/native_history.d.ts.map +1 -0
  313. package/dist/market_adapter/utils/native_history.js +172 -0
  314. package/dist/market_adapter/utils/native_history.js.map +1 -0
  315. package/dist/market_adapter/utils/paths.d.ts +5 -0
  316. package/dist/market_adapter/utils/paths.d.ts.map +1 -0
  317. package/dist/market_adapter/utils/paths.js +7 -0
  318. package/dist/market_adapter/utils/paths.js.map +1 -0
  319. package/dist/modules/account_bots.d.ts +112 -0
  320. package/dist/modules/account_bots.d.ts.map +1 -0
  321. package/dist/modules/account_bots.js +1259 -0
  322. package/dist/modules/account_bots.js.map +1 -0
  323. package/dist/modules/account_orders.d.ts +273 -0
  324. package/dist/modules/account_orders.d.ts.map +1 -0
  325. package/dist/modules/account_orders.js +662 -0
  326. package/dist/modules/account_orders.js.map +1 -0
  327. package/dist/modules/authority_resolver.d.ts +2 -0
  328. package/dist/modules/authority_resolver.d.ts.map +1 -0
  329. package/dist/modules/authority_resolver.js +231 -0
  330. package/dist/modules/authority_resolver.js.map +1 -0
  331. package/dist/modules/bitshares-native/chain_client.d.ts +38 -0
  332. package/dist/modules/bitshares-native/chain_client.d.ts.map +1 -0
  333. package/dist/modules/bitshares-native/chain_client.js +322 -0
  334. package/dist/modules/bitshares-native/chain_client.js.map +1 -0
  335. package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +59 -0
  336. package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -0
  337. package/dist/modules/bitshares-native/crypto/ecc.browser.js +456 -0
  338. package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -0
  339. package/dist/modules/bitshares-native/crypto/ecc.d.ts +66 -0
  340. package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +1 -0
  341. package/dist/modules/bitshares-native/crypto/ecc.js +557 -0
  342. package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -0
  343. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +2 -0
  344. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -0
  345. package/dist/modules/bitshares-native/crypto/ecc_selector.js +20 -0
  346. package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -0
  347. package/dist/modules/bitshares-native/index.d.ts +3 -0
  348. package/dist/modules/bitshares-native/index.d.ts.map +1 -0
  349. package/dist/modules/bitshares-native/index.js +32 -0
  350. package/dist/modules/bitshares-native/index.js.map +1 -0
  351. package/dist/modules/bitshares-native/resolvers.d.ts +40 -0
  352. package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -0
  353. package/dist/modules/bitshares-native/resolvers.js +161 -0
  354. package/dist/modules/bitshares-native/resolvers.js.map +1 -0
  355. package/dist/modules/bitshares-native/serial/chain_constants.d.ts +56 -0
  356. package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +1 -0
  357. package/dist/modules/bitshares-native/serial/chain_constants.js +92 -0
  358. package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -0
  359. package/dist/modules/bitshares-native/serial/index.d.ts +10 -0
  360. package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -0
  361. package/dist/modules/bitshares-native/serial/index.js +14 -0
  362. package/dist/modules/bitshares-native/serial/index.js.map +1 -0
  363. package/dist/modules/bitshares-native/serial/operations.d.ts +102 -0
  364. package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -0
  365. package/dist/modules/bitshares-native/serial/operations.js +615 -0
  366. package/dist/modules/bitshares-native/serial/operations.js.map +1 -0
  367. package/dist/modules/bitshares-native/serial/serializer.d.ts +64 -0
  368. package/dist/modules/bitshares-native/serial/serializer.d.ts.map +1 -0
  369. package/dist/modules/bitshares-native/serial/serializer.js +252 -0
  370. package/dist/modules/bitshares-native/serial/serializer.js.map +1 -0
  371. package/dist/modules/bitshares-native/serial/types.d.ts +120 -0
  372. package/dist/modules/bitshares-native/serial/types.d.ts.map +1 -0
  373. package/dist/modules/bitshares-native/serial/types.js +837 -0
  374. package/dist/modules/bitshares-native/serial/types.js.map +1 -0
  375. package/dist/modules/bitshares-native/signing_client.d.ts +6 -0
  376. package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -0
  377. package/dist/modules/bitshares-native/signing_client.js +141 -0
  378. package/dist/modules/bitshares-native/signing_client.js.map +1 -0
  379. package/dist/modules/bitshares-native/subscriptions.d.ts +6 -0
  380. package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -0
  381. package/dist/modules/bitshares-native/subscriptions.js +865 -0
  382. package/dist/modules/bitshares-native/subscriptions.js.map +1 -0
  383. package/dist/modules/bitshares-native/transport.d.ts +51 -0
  384. package/dist/modules/bitshares-native/transport.d.ts.map +1 -0
  385. package/dist/modules/bitshares-native/transport.js +447 -0
  386. package/dist/modules/bitshares-native/transport.js.map +1 -0
  387. package/dist/modules/bitshares-native/tx/builder.d.ts +30 -0
  388. package/dist/modules/bitshares-native/tx/builder.d.ts.map +1 -0
  389. package/dist/modules/bitshares-native/tx/builder.js +262 -0
  390. package/dist/modules/bitshares-native/tx/builder.js.map +1 -0
  391. package/dist/modules/bitshares_client.d.ts +129 -0
  392. package/dist/modules/bitshares_client.d.ts.map +1 -0
  393. package/dist/modules/bitshares_client.js +627 -0
  394. package/dist/modules/bitshares_client.js.map +1 -0
  395. package/dist/modules/bot_settings.d.ts +33 -0
  396. package/dist/modules/bot_settings.d.ts.map +1 -0
  397. package/dist/modules/bot_settings.js +328 -0
  398. package/dist/modules/bot_settings.js.map +1 -0
  399. package/dist/modules/bots_file_lock.d.ts +88 -0
  400. package/dist/modules/bots_file_lock.d.ts.map +1 -0
  401. package/dist/modules/bots_file_lock.js +161 -0
  402. package/dist/modules/bots_file_lock.js.map +1 -0
  403. package/dist/modules/chain_keys.d.ts +302 -0
  404. package/dist/modules/chain_keys.d.ts.map +1 -0
  405. package/dist/modules/chain_keys.js +1095 -0
  406. package/dist/modules/chain_keys.js.map +1 -0
  407. package/dist/modules/chain_orders.d.ts +423 -0
  408. package/dist/modules/chain_orders.d.ts.map +1 -0
  409. package/dist/modules/chain_orders.js +1201 -0
  410. package/dist/modules/chain_orders.js.map +1 -0
  411. package/dist/modules/cli_whitelist_args.d.ts +6 -0
  412. package/dist/modules/cli_whitelist_args.d.ts.map +1 -0
  413. package/dist/modules/cli_whitelist_args.js +13 -0
  414. package/dist/modules/cli_whitelist_args.js.map +1 -0
  415. package/dist/modules/config.d.ts +57 -0
  416. package/dist/modules/config.d.ts.map +1 -0
  417. package/dist/modules/config.js +107 -0
  418. package/dist/modules/config.js.map +1 -0
  419. package/dist/modules/constants.d.ts +635 -0
  420. package/dist/modules/constants.d.ts.map +1 -0
  421. package/dist/modules/constants.js +1464 -0
  422. package/dist/modules/constants.js.map +1 -0
  423. package/dist/modules/cr_planner.d.ts +51 -0
  424. package/dist/modules/cr_planner.d.ts.map +1 -0
  425. package/dist/modules/cr_planner.js +299 -0
  426. package/dist/modules/cr_planner.js.map +1 -0
  427. package/dist/modules/credential_policy.d.ts +188 -0
  428. package/dist/modules/credential_policy.d.ts.map +1 -0
  429. package/dist/modules/credential_policy.js +1452 -0
  430. package/dist/modules/credential_policy.js.map +1 -0
  431. package/dist/modules/credential_runtime.d.ts +42 -0
  432. package/dist/modules/credential_runtime.d.ts.map +1 -0
  433. package/dist/modules/credential_runtime.js +148 -0
  434. package/dist/modules/credential_runtime.js.map +1 -0
  435. package/dist/modules/credential_session_cache.d.ts +36 -0
  436. package/dist/modules/credential_session_cache.d.ts.map +1 -0
  437. package/dist/modules/credential_session_cache.js +106 -0
  438. package/dist/modules/credential_session_cache.js.map +1 -0
  439. package/dist/modules/credit_runtime.d.ts +412 -0
  440. package/dist/modules/credit_runtime.d.ts.map +1 -0
  441. package/dist/modules/credit_runtime.js +2866 -0
  442. package/dist/modules/credit_runtime.js.map +1 -0
  443. package/dist/modules/crypto/browser_provider.d.ts +15 -0
  444. package/dist/modules/crypto/browser_provider.d.ts.map +1 -0
  445. package/dist/modules/crypto/browser_provider.js +113 -0
  446. package/dist/modules/crypto/browser_provider.js.map +1 -0
  447. package/dist/modules/crypto/index.d.ts +9 -0
  448. package/dist/modules/crypto/index.d.ts.map +1 -0
  449. package/dist/modules/crypto/index.js +44 -0
  450. package/dist/modules/crypto/index.js.map +1 -0
  451. package/dist/modules/crypto/node_provider.d.ts +15 -0
  452. package/dist/modules/crypto/node_provider.d.ts.map +1 -0
  453. package/dist/modules/crypto/node_provider.js +74 -0
  454. package/dist/modules/crypto/node_provider.js.map +1 -0
  455. package/dist/modules/crypto/provider.d.ts +34 -0
  456. package/dist/modules/crypto/provider.d.ts.map +1 -0
  457. package/dist/modules/crypto/provider.js +3 -0
  458. package/dist/modules/crypto/provider.js.map +1 -0
  459. package/dist/modules/crypto/pure_ripemd160.d.ts +8 -0
  460. package/dist/modules/crypto/pure_ripemd160.d.ts.map +1 -0
  461. package/dist/modules/crypto/pure_ripemd160.js +142 -0
  462. package/dist/modules/crypto/pure_ripemd160.js.map +1 -0
  463. package/dist/modules/crypto/pure_scrypt.d.ts +23 -0
  464. package/dist/modules/crypto/pure_scrypt.d.ts.map +1 -0
  465. package/dist/modules/crypto/pure_scrypt.js +161 -0
  466. package/dist/modules/crypto/pure_scrypt.js.map +1 -0
  467. package/dist/modules/crypto/pure_secp256k1.d.ts +29 -0
  468. package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -0
  469. package/dist/modules/crypto/pure_secp256k1.js +195 -0
  470. package/dist/modules/crypto/pure_secp256k1.js.map +1 -0
  471. package/dist/modules/crypto/sync.d.ts +13 -0
  472. package/dist/modules/crypto/sync.d.ts.map +1 -0
  473. package/dist/modules/crypto/sync.js +37 -0
  474. package/dist/modules/crypto/sync.js.map +1 -0
  475. package/dist/modules/dexbot_class.d.ts +1074 -0
  476. package/dist/modules/dexbot_class.d.ts.map +1 -0
  477. package/dist/modules/dexbot_class.js +4613 -0
  478. package/dist/modules/dexbot_class.js.map +1 -0
  479. package/dist/modules/dexbot_credential_client.d.ts +71 -0
  480. package/dist/modules/dexbot_credential_client.d.ts.map +1 -0
  481. package/dist/modules/dexbot_credential_client.js +224 -0
  482. package/dist/modules/dexbot_credential_client.js.map +1 -0
  483. package/dist/modules/dexbot_fill_runtime.d.ts +173 -0
  484. package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -0
  485. package/dist/modules/dexbot_fill_runtime.js +217 -0
  486. package/dist/modules/dexbot_fill_runtime.js.map +1 -0
  487. package/dist/modules/dexbot_maintenance_runtime.d.ts +279 -0
  488. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -0
  489. package/dist/modules/dexbot_maintenance_runtime.js +1613 -0
  490. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -0
  491. package/dist/modules/env.d.ts +12 -0
  492. package/dist/modules/env.d.ts.map +1 -0
  493. package/dist/modules/env.js +57 -0
  494. package/dist/modules/env.js.map +1 -0
  495. package/dist/modules/fund_registry.d.ts +96 -0
  496. package/dist/modules/fund_registry.d.ts.map +1 -0
  497. package/dist/modules/fund_registry.js +261 -0
  498. package/dist/modules/fund_registry.js.map +1 -0
  499. package/dist/modules/general_settings.d.ts +36 -0
  500. package/dist/modules/general_settings.d.ts.map +1 -0
  501. package/dist/modules/general_settings.js +63 -0
  502. package/dist/modules/general_settings.js.map +1 -0
  503. package/dist/modules/graceful_shutdown.d.ts +86 -0
  504. package/dist/modules/graceful_shutdown.d.ts.map +1 -0
  505. package/dist/modules/graceful_shutdown.js +164 -0
  506. package/dist/modules/graceful_shutdown.js.map +1 -0
  507. package/dist/modules/key_store.d.ts +60 -0
  508. package/dist/modules/key_store.d.ts.map +1 -0
  509. package/dist/modules/key_store.js +215 -0
  510. package/dist/modules/key_store.js.map +1 -0
  511. package/dist/modules/launcher/bot_supervisor.d.ts +84 -0
  512. package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -0
  513. package/dist/modules/launcher/bot_supervisor.js +1067 -0
  514. package/dist/modules/launcher/bot_supervisor.js.map +1 -0
  515. package/dist/modules/launcher/child_env.d.ts +9 -0
  516. package/dist/modules/launcher/child_env.d.ts.map +1 -0
  517. package/dist/modules/launcher/child_env.js +78 -0
  518. package/dist/modules/launcher/child_env.js.map +1 -0
  519. package/dist/modules/launcher/credential_bootstrap.d.ts +22 -0
  520. package/dist/modules/launcher/credential_bootstrap.d.ts.map +1 -0
  521. package/dist/modules/launcher/credential_bootstrap.js +303 -0
  522. package/dist/modules/launcher/credential_bootstrap.js.map +1 -0
  523. package/dist/modules/launcher/credential_daemon.d.ts +32 -0
  524. package/dist/modules/launcher/credential_daemon.d.ts.map +1 -0
  525. package/dist/modules/launcher/credential_daemon.js +173 -0
  526. package/dist/modules/launcher/credential_daemon.js.map +1 -0
  527. package/dist/modules/launcher/credential_secret.d.ts +6 -0
  528. package/dist/modules/launcher/credential_secret.d.ts.map +1 -0
  529. package/dist/modules/launcher/credential_secret.js +15 -0
  530. package/dist/modules/launcher/credential_secret.js.map +1 -0
  531. package/dist/modules/launcher/foreign_cred_daemon.d.ts +2 -0
  532. package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -0
  533. package/dist/modules/launcher/foreign_cred_daemon.js +166 -0
  534. package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -0
  535. package/dist/modules/launcher/headless_password.d.ts +8 -0
  536. package/dist/modules/launcher/headless_password.d.ts.map +1 -0
  537. package/dist/modules/launcher/headless_password.js +33 -0
  538. package/dist/modules/launcher/headless_password.js.map +1 -0
  539. package/dist/modules/launcher/launch_modes.d.ts +36 -0
  540. package/dist/modules/launcher/launch_modes.d.ts.map +1 -0
  541. package/dist/modules/launcher/launch_modes.js +129 -0
  542. package/dist/modules/launcher/launch_modes.js.map +1 -0
  543. package/dist/modules/launcher/market_adapter_runtime.d.ts +43 -0
  544. package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -0
  545. package/dist/modules/launcher/market_adapter_runtime.js +217 -0
  546. package/dist/modules/launcher/market_adapter_runtime.js.map +1 -0
  547. package/dist/modules/launcher/market_adapter_watchdog.d.ts +26 -0
  548. package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -0
  549. package/dist/modules/launcher/market_adapter_watchdog.js +214 -0
  550. package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -0
  551. package/dist/modules/launcher/monolithic_runtime.d.ts +89 -0
  552. package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -0
  553. package/dist/modules/launcher/monolithic_runtime.js +425 -0
  554. package/dist/modules/launcher/monolithic_runtime.js.map +1 -0
  555. package/dist/modules/launcher/runtime_entry.d.ts +26 -0
  556. package/dist/modules/launcher/runtime_entry.d.ts.map +1 -0
  557. package/dist/modules/launcher/runtime_entry.js +49 -0
  558. package/dist/modules/launcher/runtime_entry.js.map +1 -0
  559. package/dist/modules/launcher/status_reporting.d.ts +48 -0
  560. package/dist/modules/launcher/status_reporting.d.ts.map +1 -0
  561. package/dist/modules/launcher/status_reporting.js +113 -0
  562. package/dist/modules/launcher/status_reporting.js.map +1 -0
  563. package/dist/modules/launcher/supervisor_control.d.ts +6 -0
  564. package/dist/modules/launcher/supervisor_control.d.ts.map +1 -0
  565. package/dist/modules/launcher/supervisor_control.js +59 -0
  566. package/dist/modules/launcher/supervisor_control.js.map +1 -0
  567. package/dist/modules/logger.d.ts +2 -0
  568. package/dist/modules/logger.d.ts.map +1 -0
  569. package/dist/modules/logger.js +71 -0
  570. package/dist/modules/logger.js.map +1 -0
  571. package/dist/modules/market_adapter_whitelist.d.ts +22 -0
  572. package/dist/modules/market_adapter_whitelist.d.ts.map +1 -0
  573. package/dist/modules/market_adapter_whitelist.js +82 -0
  574. package/dist/modules/market_adapter_whitelist.js.map +1 -0
  575. package/dist/modules/node_health_cache.d.ts +55 -0
  576. package/dist/modules/node_health_cache.d.ts.map +1 -0
  577. package/dist/modules/node_health_cache.js +134 -0
  578. package/dist/modules/node_health_cache.js.map +1 -0
  579. package/dist/modules/node_manager.d.ts +215 -0
  580. package/dist/modules/node_manager.d.ts.map +1 -0
  581. package/dist/modules/node_manager.js +628 -0
  582. package/dist/modules/node_manager.js.map +1 -0
  583. package/dist/modules/order/accounting.d.ts +349 -0
  584. package/dist/modules/order/accounting.d.ts.map +1 -0
  585. package/dist/modules/order/accounting.js +1191 -0
  586. package/dist/modules/order/accounting.js.map +1 -0
  587. package/dist/modules/order/async_lock.d.ts +126 -0
  588. package/dist/modules/order/async_lock.d.ts.map +1 -0
  589. package/dist/modules/order/async_lock.js +195 -0
  590. package/dist/modules/order/async_lock.js.map +1 -0
  591. package/dist/modules/order/export.d.ts +129 -0
  592. package/dist/modules/order/export.d.ts.map +1 -0
  593. package/dist/modules/order/export.js +316 -0
  594. package/dist/modules/order/export.js.map +1 -0
  595. package/dist/modules/order/format.d.ts +158 -0
  596. package/dist/modules/order/format.d.ts.map +1 -0
  597. package/dist/modules/order/format.js +232 -0
  598. package/dist/modules/order/format.js.map +1 -0
  599. package/dist/modules/order/grid.d.ts +549 -0
  600. package/dist/modules/order/grid.d.ts.map +1 -0
  601. package/dist/modules/order/grid.js +1746 -0
  602. package/dist/modules/order/grid.js.map +1 -0
  603. package/dist/modules/order/grid_reconcile.d.ts +154 -0
  604. package/dist/modules/order/grid_reconcile.d.ts.map +1 -0
  605. package/dist/modules/order/grid_reconcile.js +1192 -0
  606. package/dist/modules/order/grid_reconcile.js.map +1 -0
  607. package/dist/modules/order/index.d.ts +55 -0
  608. package/dist/modules/order/index.d.ts.map +1 -0
  609. package/dist/modules/order/index.js +79 -0
  610. package/dist/modules/order/index.js.map +1 -0
  611. package/dist/modules/order/logger.d.ts +136 -0
  612. package/dist/modules/order/logger.d.ts.map +1 -0
  613. package/dist/modules/order/logger.js +614 -0
  614. package/dist/modules/order/logger.js.map +1 -0
  615. package/dist/modules/order/logger_state.d.ts +133 -0
  616. package/dist/modules/order/logger_state.d.ts.map +1 -0
  617. package/dist/modules/order/logger_state.js +170 -0
  618. package/dist/modules/order/logger_state.js.map +1 -0
  619. package/dist/modules/order/manager.d.ts +413 -0
  620. package/dist/modules/order/manager.d.ts.map +1 -0
  621. package/dist/modules/order/manager.js +1605 -0
  622. package/dist/modules/order/manager.js.map +1 -0
  623. package/dist/modules/order/processed_fill_store.d.ts +135 -0
  624. package/dist/modules/order/processed_fill_store.d.ts.map +1 -0
  625. package/dist/modules/order/processed_fill_store.js +288 -0
  626. package/dist/modules/order/processed_fill_store.js.map +1 -0
  627. package/dist/modules/order/runner.d.ts +70 -0
  628. package/dist/modules/order/runner.d.ts.map +1 -0
  629. package/dist/modules/order/runner.js +140 -0
  630. package/dist/modules/order/runner.js.map +1 -0
  631. package/dist/modules/order/strategy.d.ts +196 -0
  632. package/dist/modules/order/strategy.d.ts.map +1 -0
  633. package/dist/modules/order/strategy.js +398 -0
  634. package/dist/modules/order/strategy.js.map +1 -0
  635. package/dist/modules/order/sync_engine.d.ts +386 -0
  636. package/dist/modules/order/sync_engine.d.ts.map +1 -0
  637. package/dist/modules/order/sync_engine.js +1459 -0
  638. package/dist/modules/order/sync_engine.js.map +1 -0
  639. package/dist/modules/order/utils/math.d.ts +677 -0
  640. package/dist/modules/order/utils/math.d.ts.map +1 -0
  641. package/dist/modules/order/utils/math.js +1172 -0
  642. package/dist/modules/order/utils/math.js.map +1 -0
  643. package/dist/modules/order/utils/order.d.ts +572 -0
  644. package/dist/modules/order/utils/order.d.ts.map +1 -0
  645. package/dist/modules/order/utils/order.js +1145 -0
  646. package/dist/modules/order/utils/order.js.map +1 -0
  647. package/dist/modules/order/utils/system.d.ts +268 -0
  648. package/dist/modules/order/utils/system.d.ts.map +1 -0
  649. package/dist/modules/order/utils/system.js +1261 -0
  650. package/dist/modules/order/utils/system.js.map +1 -0
  651. package/dist/modules/order/utils/validate.d.ts +280 -0
  652. package/dist/modules/order/utils/validate.d.ts.map +1 -0
  653. package/dist/modules/order/utils/validate.js +918 -0
  654. package/dist/modules/order/utils/validate.js.map +1 -0
  655. package/dist/modules/order/working_grid.d.ts +212 -0
  656. package/dist/modules/order/working_grid.d.ts.map +1 -0
  657. package/dist/modules/order/working_grid.js +279 -0
  658. package/dist/modules/order/working_grid.js.map +1 -0
  659. package/dist/modules/path_api.d.ts +32 -0
  660. package/dist/modules/path_api.d.ts.map +1 -0
  661. package/dist/modules/path_api.js +148 -0
  662. package/dist/modules/path_api.js.map +1 -0
  663. package/dist/modules/paths.d.ts +58 -0
  664. package/dist/modules/paths.d.ts.map +1 -0
  665. package/dist/modules/paths.js +82 -0
  666. package/dist/modules/paths.js.map +1 -0
  667. package/dist/modules/process_discovery.d.ts +58 -0
  668. package/dist/modules/process_discovery.d.ts.map +1 -0
  669. package/dist/modules/process_discovery.js +265 -0
  670. package/dist/modules/process_discovery.js.map +1 -0
  671. package/dist/modules/runtime.d.ts +34 -0
  672. package/dist/modules/runtime.d.ts.map +1 -0
  673. package/dist/modules/runtime.js +98 -0
  674. package/dist/modules/runtime.js.map +1 -0
  675. package/dist/modules/runtime_settings.d.ts +12 -0
  676. package/dist/modules/runtime_settings.d.ts.map +1 -0
  677. package/dist/modules/runtime_settings.js +122 -0
  678. package/dist/modules/runtime_settings.js.map +1 -0
  679. package/dist/modules/settings_merge.d.ts +38 -0
  680. package/dist/modules/settings_merge.d.ts.map +1 -0
  681. package/dist/modules/settings_merge.js +246 -0
  682. package/dist/modules/settings_merge.js.map +1 -0
  683. package/dist/modules/storage/browser_adapter.d.ts +56 -0
  684. package/dist/modules/storage/browser_adapter.d.ts.map +1 -0
  685. package/dist/modules/storage/browser_adapter.js +231 -0
  686. package/dist/modules/storage/browser_adapter.js.map +1 -0
  687. package/dist/modules/storage/index.d.ts +28 -0
  688. package/dist/modules/storage/index.d.ts.map +1 -0
  689. package/dist/modules/storage/index.js +52 -0
  690. package/dist/modules/storage/index.js.map +1 -0
  691. package/dist/modules/storage/node_adapter.d.ts +49 -0
  692. package/dist/modules/storage/node_adapter.d.ts.map +1 -0
  693. package/dist/modules/storage/node_adapter.js +167 -0
  694. package/dist/modules/storage/node_adapter.js.map +1 -0
  695. package/dist/modules/storage/types.d.ts +92 -0
  696. package/dist/modules/storage/types.d.ts.map +1 -0
  697. package/dist/modules/storage/types.js +3 -0
  698. package/dist/modules/storage/types.js.map +1 -0
  699. package/dist/modules/types.d.ts +1382 -0
  700. package/dist/modules/types.d.ts.map +1 -0
  701. package/dist/modules/types.js +11 -0
  702. package/dist/modules/types.js.map +1 -0
  703. package/dist/modules/utils/base58check.d.ts +12 -0
  704. package/dist/modules/utils/base58check.d.ts.map +1 -0
  705. package/dist/modules/utils/base58check.js +112 -0
  706. package/dist/modules/utils/base58check.js.map +1 -0
  707. package/dist/modules/utils/build_dir.d.ts +7 -0
  708. package/dist/modules/utils/build_dir.d.ts.map +1 -0
  709. package/dist/modules/utils/build_dir.js +8 -0
  710. package/dist/modules/utils/build_dir.js.map +1 -0
  711. package/dist/modules/utils/fs_utils.d.ts +25 -0
  712. package/dist/modules/utils/fs_utils.d.ts.map +1 -0
  713. package/dist/modules/utils/fs_utils.js +27 -0
  714. package/dist/modules/utils/fs_utils.js.map +1 -0
  715. package/dist/modules/utils/math_utils.d.ts +10 -0
  716. package/dist/modules/utils/math_utils.d.ts.map +1 -0
  717. package/dist/modules/utils/math_utils.js +17 -0
  718. package/dist/modules/utils/math_utils.js.map +1 -0
  719. package/dist/modules/validate_profiles.d.ts +37 -0
  720. package/dist/modules/validate_profiles.d.ts.map +1 -0
  721. package/dist/modules/validate_profiles.js +369 -0
  722. package/dist/modules/validate_profiles.js.map +1 -0
  723. package/dist/pm2.d.ts +167 -0
  724. package/dist/pm2.d.ts.map +1 -0
  725. package/dist/pm2.js +998 -0
  726. package/dist/pm2.js.map +1 -0
  727. package/dist/scripts/analyze-git.d.ts +11 -0
  728. package/dist/scripts/analyze-git.d.ts.map +1 -0
  729. package/dist/scripts/analyze-git.js +851 -0
  730. package/dist/scripts/analyze-git.js.map +1 -0
  731. package/dist/scripts/analyze-orders.d.ts +17 -0
  732. package/dist/scripts/analyze-orders.d.ts.map +1 -0
  733. package/dist/scripts/analyze-orders.js +1568 -0
  734. package/dist/scripts/analyze-orders.js.map +1 -0
  735. package/dist/scripts/diagnose-kibana-candles.d.ts +3 -0
  736. package/dist/scripts/diagnose-kibana-candles.d.ts.map +1 -0
  737. package/dist/scripts/diagnose-kibana-candles.js +82 -0
  738. package/dist/scripts/diagnose-kibana-candles.js.map +1 -0
  739. package/dist/scripts/diagnose-pool-history.d.ts +3 -0
  740. package/dist/scripts/diagnose-pool-history.d.ts.map +1 -0
  741. package/dist/scripts/diagnose-pool-history.js +296 -0
  742. package/dist/scripts/diagnose-pool-history.js.map +1 -0
  743. package/dist/scripts/divergence-calc.d.ts +26 -0
  744. package/dist/scripts/divergence-calc.d.ts.map +1 -0
  745. package/dist/scripts/divergence-calc.js +119 -0
  746. package/dist/scripts/divergence-calc.js.map +1 -0
  747. package/dist/scripts/generate_lp_chart.d.ts +31 -0
  748. package/dist/scripts/generate_lp_chart.d.ts.map +1 -0
  749. package/dist/scripts/generate_lp_chart.js +92 -0
  750. package/dist/scripts/generate_lp_chart.js.map +1 -0
  751. package/dist/scripts/generate_mainnet_corpus_report.d.ts +24 -0
  752. package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +1 -0
  753. package/dist/scripts/generate_mainnet_corpus_report.js +237 -0
  754. package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -0
  755. package/dist/scripts/generate_market_adapter_whitelist.d.ts +2 -0
  756. package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -0
  757. package/dist/scripts/generate_market_adapter_whitelist.js +111 -0
  758. package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -0
  759. package/dist/scripts/migrate_bot_keys.d.ts +6 -0
  760. package/dist/scripts/migrate_bot_keys.d.ts.map +1 -0
  761. package/dist/scripts/migrate_bot_keys.js +301 -0
  762. package/dist/scripts/migrate_bot_keys.js.map +1 -0
  763. package/dist/scripts/native_release_gates.d.ts +3 -0
  764. package/dist/scripts/native_release_gates.d.ts.map +1 -0
  765. package/dist/scripts/native_release_gates.js +52 -0
  766. package/dist/scripts/native_release_gates.js.map +1 -0
  767. package/dist/scripts/print_grid.d.ts +16 -0
  768. package/dist/scripts/print_grid.d.ts.map +1 -0
  769. package/dist/scripts/print_grid.js +80 -0
  770. package/dist/scripts/print_grid.js.map +1 -0
  771. package/dist/scripts/run-tests.d.ts +2 -0
  772. package/dist/scripts/run-tests.d.ts.map +1 -0
  773. package/dist/scripts/run-tests.js +49 -0
  774. package/dist/scripts/run-tests.js.map +1 -0
  775. package/dist/scripts/sync-version.d.ts +14 -0
  776. package/dist/scripts/sync-version.d.ts.map +1 -0
  777. package/dist/scripts/sync-version.js +158 -0
  778. package/dist/scripts/sync-version.js.map +1 -0
  779. package/dist/scripts/test-credit-renewal.d.ts +2 -0
  780. package/dist/scripts/test-credit-renewal.d.ts.map +1 -0
  781. package/dist/scripts/test-credit-renewal.js +329 -0
  782. package/dist/scripts/test-credit-renewal.js.map +1 -0
  783. package/dist/scripts/update.d.ts +24 -0
  784. package/dist/scripts/update.d.ts.map +1 -0
  785. package/dist/scripts/update.js +650 -0
  786. package/dist/scripts/update.js.map +1 -0
  787. package/dist/scripts/validate_bots.d.ts +16 -0
  788. package/dist/scripts/validate_bots.d.ts.map +1 -0
  789. package/dist/scripts/validate_bots.js +106 -0
  790. package/dist/scripts/validate_bots.js.map +1 -0
  791. package/dist/scripts/verify-browser-bundle.d.ts +22 -0
  792. package/dist/scripts/verify-browser-bundle.d.ts.map +1 -0
  793. package/dist/scripts/verify-browser-bundle.js +339 -0
  794. package/dist/scripts/verify-browser-bundle.js.map +1 -0
  795. package/dist/unlock.d.ts +48 -0
  796. package/dist/unlock.d.ts.map +1 -0
  797. package/dist/unlock.js +925 -0
  798. package/dist/unlock.js.map +1 -0
  799. package/package.json +112 -0
  800. package/scripts/README.md +356 -0
  801. package/scripts/clear-all.sh +195 -0
  802. package/scripts/clear-logs.sh +95 -0
  803. package/scripts/clear-market-adapter.sh +196 -0
  804. package/scripts/clear-orders.sh +113 -0
  805. package/scripts/create-bot-symlinks.sh +51 -0
  806. package/scripts/postinstall.js +9 -0
  807. package/scripts/reset-settings.sh +118 -0
@@ -0,0 +1,1074 @@
1
+ /**
2
+ * modules/dexbot_class.ts - DEXBot Core Engine
3
+ *
4
+ * Core trading bot implementation shared by bot.ts (single) and dexbot.ts (multi-bot).
5
+ * Implements complete grid trading bot lifecycle.
6
+ *
7
+ * Responsibilities:
8
+ * - Bot initialization and account setup
9
+ * - Order placement and batch operations
10
+ * - Fill processing and synchronization
11
+ * - Grid rebalancing and order rotation
12
+ * - Divergence detection and correction
13
+ * - State persistence and recovery
14
+ * - Market monitoring and health checks
15
+ *
16
+ * ===============================================================================
17
+ * CORE CLASS: DEXBot
18
+ * ===============================================================================
19
+ *
20
+ * LIFECYCLE METHODS:
21
+ * - constructor(config) - Initialize bot with configuration
22
+ * - run() - Start bot operation loop
23
+ * - shutdown() - Graceful shutdown
24
+ *
25
+ * FILL PROCESSING:
26
+ * - processFills() - Handle fill events
27
+ *
28
+ * SYNCHRONIZATION:
29
+ * - reconcileGrid() - Reconcile grid state with blockchain
30
+ *
31
+ * MONITORING:
32
+ * - monitorHealth() - Check bot health status
33
+ *
34
+ * ===============================================================================
35
+ *
36
+ * HELPER FUNCTIONS (module-level):
37
+ * - normalizeBotEntry() - Normalize bot configuration object
38
+ *
39
+ * ===============================================================================
40
+ *
41
+ * STATE MANAGEMENT:
42
+ * - Internal OrderManager maintains all state
43
+ * - Persists grid snapshots to profiles/orders/{botKey}.json
44
+ * - Recovers from persisted state on startup
45
+ * - Real-time synchronization with blockchain
46
+ *
47
+ * ERROR HANDLING:
48
+ * - Graceful error recovery
49
+ * - Automatic reconnection on connection loss
50
+ * - Anomaly detection and correction
51
+ * - Detailed logging for debugging
52
+ *
53
+ * ===============================================================================
54
+ */
55
+ declare class DEXBot {
56
+ config: any;
57
+ _baseWeightDistribution: {
58
+ sell: number;
59
+ buy: number;
60
+ };
61
+ account: any;
62
+ accountId: string | null;
63
+ privateKey: any;
64
+ manager: any;
65
+ accountOrders: any;
66
+ triggerFile: string;
67
+ _recentlyQueuedFills: Map<any, any>;
68
+ _fillCleanupCounter: number;
69
+ _fillDedupeWindowMs: number;
70
+ _fillRecordRetentionMs: number;
71
+ _processedFillPersistBatchMs: number;
72
+ _processedFillPersistBatchSize: number;
73
+ _processedFillStore: any;
74
+ _recentlyProcessedFills: any;
75
+ _pendingProcessedFillWrites: any;
76
+ _incomingFillQueue: any[];
77
+ logPrefix: string;
78
+ _credentialDaemonWatchdogInterval: any;
79
+ _credentialDaemonDown: boolean;
80
+ _credentialRecoveryNeeded: boolean;
81
+ _credentialRecoveryInFlight: boolean;
82
+ _credentialDaemonWatchdogInFlight: boolean;
83
+ _staleCleanedOrderIds: Map<string, number>;
84
+ _staleCleanupRetentionMs: number;
85
+ _metrics: any;
86
+ _shuttingDown: boolean;
87
+ _shutdownStarted: boolean;
88
+ _shutdownPromise: Promise<void> | null;
89
+ _blockchainFetchInterval: any;
90
+ _blockchainFetchInFlight: boolean;
91
+ _fillsUnsubscribe: any;
92
+ _triggerWatcher: any;
93
+ _triggerDebounceTimer: any;
94
+ _deferredGridResyncTimer: any;
95
+ _maintenanceIdleTimer: any;
96
+ _mainLoopActive: boolean;
97
+ _mainLoopPromise: any;
98
+ _creditRuntime: any;
99
+ _creditWatchdogInterval: any;
100
+ _batchInFlight: boolean;
101
+ _recoverySyncInFlight: boolean;
102
+ _lastTargetedDriftSyncAt: number;
103
+ _targetedDriftSyncCooldownMs: number;
104
+ _maintenanceCooldownCycles: number;
105
+ _lastGridActivityAt: number;
106
+ _currentCycleId: number;
107
+ _autoCancelOrphanCycleMarker: number | null;
108
+ _consecutiveConsumeFailures: number;
109
+ _consumeFailureFirstAt: number;
110
+ _reconnectUnregister: any;
111
+ _credentialRecoveryDeferredTimer: any;
112
+ _structuralGridResyncTimer: any;
113
+ _structuralGridResyncRunning: boolean;
114
+ _dustHealthCheckTimer: any;
115
+ _lastBroadcastHeartbeatAt: number;
116
+ _currentBatchId: any;
117
+ /**
118
+ * Create a new DEXBot instance
119
+ * @param {Object} config - Bot configuration from profiles/bots.json
120
+ * @param {Object} options - Optional settings
121
+ * @param {string} options.logPrefix - Prefix for console logs (e.g., "[bot.js]")
122
+ */
123
+ constructor(config: any, options?: {
124
+ logPrefix?: string;
125
+ });
126
+ /**
127
+ * Validate startup configuration to catch errors early.
128
+ * Ensures critical values are valid before bot starts.
129
+ * @param {Object} config - Configuration object to validate
130
+ * @throws {Error} If critical validation fails
131
+ * @private
132
+ */
133
+ _validateStartupConfig(config: any): void;
134
+ /**
135
+ * Log a message to the console with the bot's prefix.
136
+ * @param {string} msg - The message to log.
137
+ * @param {string} [level='info'] - The log level ('debug', 'info', 'warn', 'error').
138
+ * @private
139
+ */
140
+ _log(msg: any, level?: string): void;
141
+ /**
142
+ * Log a warning message to the console with the bot's prefix.
143
+ * @param {string} msg - The message to log.
144
+ * @private
145
+ */
146
+ _warn(msg: any): void;
147
+ /**
148
+ * Persist the grid and trigger immediate recovery if validation fails.
149
+ * Used during startup to ensure bot begins in a stable state.
150
+ * @private
151
+ */
152
+ _persistAndRecoverIfNeeded(): Promise<void>;
153
+ /**
154
+ * Get current pipeline signal state for congestion checks.
155
+ * @returns {{incomingFillQueueLength: number, shadowLocks: number, batchInFlight: boolean, recoveryInFlight: boolean, broadcasting: boolean}}
156
+ */
157
+ _getPipelineSignals(): {
158
+ incomingFillQueueLength: number;
159
+ shadowLocks: any;
160
+ batchInFlight: boolean;
161
+ recoveryInFlight: boolean;
162
+ broadcasting: any;
163
+ };
164
+ /**
165
+ * Mark that grid activity occurred (updates idle timer).
166
+ * @param {string} [reason='activity'] - Reason for activity
167
+ * @returns {void}
168
+ */
169
+ _markGridActivity(reason?: string): void;
170
+ /**
171
+ * Trigger a full state recovery sync (fetch chain + sync from open orders + persist).
172
+ * @param {string} [reason='state recovery sync'] - Reason for recovery
173
+ * @returns {Promise<void>}
174
+ */
175
+ _triggerStateRecoverySync(reason?: string): Promise<void>;
176
+ /**
177
+ * Abort the current flow if an illegal state signal was raised.
178
+ * @param {string} flowContext - Description of the flow being aborted
179
+ * @returns {Promise<boolean>} True if flow was aborted
180
+ */
181
+ _abortFlowIfIllegalState(flowContext: any): Promise<boolean>;
182
+ /**
183
+ * Handle a hard abort from batch processing due to illegal state or accounting failure.
184
+ * @param {Error} err - The error that triggered the abort
185
+ * @param {string} [phase='batch processing'] - Phase description
186
+ * @param {number} [opsCount=0] - Number of operations in the batch
187
+ * @returns {Promise<Object>} Abort result object
188
+ */
189
+ _handleBatchHardAbort(err: any, phase?: string, opsCount?: number): Promise<{
190
+ abortedForIllegalState: boolean;
191
+ executed: boolean;
192
+ hadRotation: boolean;
193
+ } | {
194
+ abortedForAccountingFailure: boolean;
195
+ executed: boolean;
196
+ hadRotation: boolean;
197
+ }>;
198
+ /**
199
+ * Apply recoverable grid updates (order virtualisation) after a batch failure.
200
+ * @param {Array<Object>} updates - Array of order update objects
201
+ * @param {string} [context='recoverable-grid-update'] - Context label for logging
202
+ * @returns {Promise<number>} Number of updates applied
203
+ */
204
+ _applyRecoverableGridUpdates(updates: any, context?: string): Promise<any>;
205
+ /**
206
+ * Recover from explicit stale order errors by virtualizing affected grid slots.
207
+ * @param {Set<string>|string[]} staleOrderIds - Set or array of stale chain order IDs
208
+ * @param {string} [reason='stale order cleanup'] - Reason for cleanup
209
+ * @returns {Promise<{executed: boolean, hadRotation: boolean, stale: boolean, recoveredByVirtualization?: boolean}>}
210
+ */
211
+ _recoverExplicitStaleOrders(staleOrderIds: any, reason?: string): Promise<{
212
+ executed: boolean;
213
+ hadRotation: boolean;
214
+ stale: boolean;
215
+ recoveredByVirtualization?: undefined;
216
+ } | {
217
+ executed: boolean;
218
+ hadRotation: boolean;
219
+ stale: boolean;
220
+ recoveredByVirtualization: boolean;
221
+ }>;
222
+ /**
223
+ * Recover from on-chain size drift detected during batch broadcast.
224
+ * @param {Error} err - The size drift error
225
+ * @returns {Promise<{executed: boolean, hadRotation: boolean, recoveredBySync: boolean, reason: string}>}
226
+ */
227
+ _recoverBatchSizeDrift(err: any, opContexts?: any[]): Promise<{
228
+ executed: boolean;
229
+ hadRotation: boolean;
230
+ recoveredBySync: boolean;
231
+ reason: string;
232
+ }>;
233
+ /**
234
+ * Extract chain order IDs from opContexts for operations that could
235
+ * trigger a size-drift error (size-update and rotation update).
236
+ * @param {Array<Object>} opContexts
237
+ * @returns {string[]} Unique chain order IDs
238
+ */
239
+ _extractSizeDriftOrderIds(opContexts: any): unknown[];
240
+ /**
241
+ * Attempt to repair size-drift for specific order IDs by reading their
242
+ * current on-chain state and correcting the local grid directly.
243
+ * Falls back gracefully (returns false) on any error.
244
+ * @param {string[]} orderIds
245
+ * @returns {Promise<boolean>} True if all affected orders were repaired
246
+ */
247
+ _targetedOrderRepair(orderIds: any): Promise<boolean>;
248
+ /**
249
+ * Initialize bot state from storage and blockchain.
250
+ * Consolidates common initialization logic for start() and startWithPrivateKey().
251
+ * @returns {{persistedGrid: Object, persistedBtsFeesOwed: number, persistedBoundaryIdx: number, persistedBtsBalance: number}}
252
+ * @private
253
+ */
254
+ _initializeStartupState(): Promise<{
255
+ persistedGrid: any;
256
+ persistedBtsFeesOwed: any;
257
+ persistedBoundaryIdx: any;
258
+ persistedBtsBalance: any;
259
+ }>;
260
+ /**
261
+ * Wire processed fill tracking into the manager.
262
+ * @returns {void}
263
+ */
264
+ _wireProcessedFillTracking(): any;
265
+ /**
266
+ * Flush pending processed fill persistence to disk.
267
+ * @param {string} [reason='manual'] - Reason for flushing
268
+ * @param {Object} [options={}] - Flush options
269
+ * @returns {Promise<void>}
270
+ */
271
+ _flushProcessedFillPersistence(reason?: string, options?: {}): Promise<any>;
272
+ /**
273
+ * Flush persistence for specific fill keys.
274
+ * @param {Set<string>|string[]} fillKeys - Fill keys to persist
275
+ * @param {string} [reason='manual-selected'] - Reason for flushing
276
+ * @param {Object} [options={}] - Flush options
277
+ * @returns {Promise<void>}
278
+ */
279
+ _flushProcessedFillPersistenceForKeys(fillKeys: any, reason?: string, options?: {}): Promise<any>;
280
+ /**
281
+ * Discard pending persistence for specific fill keys.
282
+ * @param {string[]|Set<string>} fillKeys - Fill keys to discard
283
+ * @returns {void}
284
+ */
285
+ _discardPendingProcessedFillPersistence(fillKeys: any): any;
286
+ /**
287
+ * Build a fallback deduplication key for an orphan fill (when standard keys are unavailable).
288
+ * @param {Object} fill - Fill event object
289
+ * @returns {string|null} Fallback key or null
290
+ */
291
+ _buildOrphanFillFallbackKey(fill: any): any;
292
+ _isNewFillKey(fillKey: any, processedFillKeys: any, label?: string): boolean;
293
+ /**
294
+ * Apply replay-safe fill accounting using a provided fill key.
295
+ * @param {Object} fill - Fill event object
296
+ * @param {import('./types').FillOperationData} fillOp - Fill operation data
297
+ * @param {Object} [options={}] - Options
298
+ * @param {string} [options.missingKeyMessage]
299
+ * @param {string} [options.fallbackKeyMessage]
300
+ * @param {string} [options.replayMessage]
301
+ * @param {string} [options.errorMessage]
302
+ * @param {Object} [options.logger]
303
+ * @param {string} [options.missingKeyLevel='warn']
304
+ * @param {string} [options.fallbackKeyLevel='warn']
305
+ * @param {string} [options.replayLevel='debug']
306
+ * @param {string} [options.persistenceMode='immediate']
307
+ * @param {boolean} [options.allowOrphanFallbackKey=false]
308
+ * @returns {Promise<import('./types').ReplaySafeFillResult>}
309
+ */
310
+ _applyReplaySafeFillAccounting(fill: any, fillOp: any, { missingKeyMessage, fallbackKeyMessage, replayMessage, errorMessage, logger, missingKeyLevel, fallbackKeyLevel, replayLevel, persistenceMode, allowOrphanFallbackKey }?: {
311
+ missingKeyMessage?: any;
312
+ fallbackKeyMessage?: any;
313
+ replayMessage?: any;
314
+ errorMessage?: any;
315
+ logger?: any;
316
+ missingKeyLevel?: string;
317
+ fallbackKeyLevel?: string;
318
+ replayLevel?: string;
319
+ persistenceMode?: any;
320
+ allowOrphanFallbackKey?: boolean;
321
+ }): Promise<any>;
322
+ /**
323
+ * Apply replay-safe fill accounting for tracked fills (those with a valid grid order).
324
+ * @param {Object} fill - Fill event object
325
+ * @param {import('./types').FillOperationData} fillOp - Fill operation data
326
+ * @param {Object} [options={}]
327
+ * @param {string} [options.context]
328
+ * @param {Object} [options.logger]
329
+ * @param {string} [options.replayMessage]
330
+ * @param {string} [options.persistenceMode='batched']
331
+ * @returns {Promise<import('./types').ReplaySafeFillResult>}
332
+ */
333
+ _applyReplaySafeTrackedFillAccounting(fill: any, fillOp: any, { context, logger, replayMessage, persistenceMode }?: {
334
+ context?: string;
335
+ logger?: any;
336
+ replayMessage?: any;
337
+ persistenceMode?: any;
338
+ }): Promise<any>;
339
+ /**
340
+ * Apply replay-safe fill accounting for orphan fills (grid order not found).
341
+ * @param {Object} fill - Fill event object
342
+ * @param {import('./types').FillOperationData} fillOp - Fill operation data
343
+ * @param {Object} [options={}]
344
+ * @param {string} [options.context]
345
+ * @param {Object} [options.logger]
346
+ * @param {string} [options.replayMessage]
347
+ * @param {string} [options.persistenceMode='immediate']
348
+ * @returns {Promise<import('./types').ReplaySafeFillResult>}
349
+ */
350
+ _applyReplaySafeOrphanFillAccounting(fill: any, fillOp: any, { context, logger, replayMessage, persistenceMode }?: {
351
+ context?: string;
352
+ logger?: any;
353
+ replayMessage?: any;
354
+ persistenceMode?: any;
355
+ }): Promise<any>;
356
+ /**
357
+ * Refresh dynamic weight distribution from market adapter.
358
+ * @param {string} [context='runtime'] - Context label for logging
359
+ * @returns {import('./types').DynamicWeightRefreshResult|null}
360
+ */
361
+ _refreshDynamicWeightDistribution(context?: string): any;
362
+ /**
363
+ * Finalize the bot startup after account and initial grid sync are complete.
364
+ * Consolidates common logic for start() and startWithPrivateKey().
365
+ * @param {Object} startupState - The startup state from _initializeStartupState.
366
+ * @private
367
+ */
368
+ _finishStartupSequence(startupState: any): Promise<void>;
369
+ /**
370
+ * Create the fill callback for listenForFills.
371
+ * Separated from start() to allow deferred activation after startup completes.
372
+ * @param {Object} chainOrders - Chain orders module for blockchain operations
373
+ * @returns {Function} Async callback for processing fills
374
+ * @private
375
+ */
376
+ _createFillCallback(chainOrders: any): any;
377
+ /**
378
+ * Read open orders from chain, sync with local state, and process any fills found.
379
+ * Shared helper used by post-reset spread check and targeted drift reconciliation.
380
+ * @param {string} tag - Context label for logging
381
+ * @returns {Promise<{syncResult: Object|null, aborted: boolean, hasUnmatched: number, openOrders: Array|null}>}
382
+ */
383
+ _syncOpenOrdersAndProcessFills(tag: any): Promise<{
384
+ syncResult: any;
385
+ aborted: boolean;
386
+ hasUnmatched: any;
387
+ openOrders: any;
388
+ }>;
389
+ _maxConsecutiveFillConsumerFailures(): any;
390
+ /**
391
+ * Compute the backoff delay for fill-consumer retries after the failure
392
+ * budget (MAX_CONSECUTIVE_CONSUMER_FAILURES) is exhausted. Each retry
393
+ * doubles the previous delay, capped at CONSUMER_BACKOFF_MAX_MS. The
394
+ * consumer NEVER permanently stops re-scheduling — it just slows down.
395
+ * @param {number} failures The current consecutive-failure count.
396
+ * @returns {number} Delay in milliseconds before the next retry.
397
+ * @private
398
+ */
399
+ _computeFillConsumerBackoffMs(failures: any): number;
400
+ _scheduleFillConsumerRestart(chainOrders: any): void;
401
+ /**
402
+ * Consume queued fills from incomingFillQueue and rebalance.
403
+ *
404
+ * 1. Deduplicates fills against already-processed set (replay-safe)
405
+ * 2. Syncs filled orders from history or open orders mode
406
+ * 3. Handles price mismatches via correctAllPriceMismatches
407
+ * 4. Processes fills sequentially with interruptible rebalancing (merges new work between fills)
408
+ * 5. Periodically cleans old fill records to prevent memory leaks
409
+ *
410
+ * Atomic lock behavior: If already processing or has waiters, returns immediately (no double-queuing)
411
+ * @param {Object} chainOrders - Chain orders module for blockchain operations
412
+ * @private
413
+ */
414
+ _consumeFillQueue(chainOrders: any): Promise<void>;
415
+ /**
416
+ * Process fills during bootstrap phase using the standard fill pipeline.
417
+ *
418
+ * BOOTSTRAP MODE STRATEGY:
419
+ * - Delegate to the same fill pipeline as the post-reset path
420
+ * - Same-side replacement at the filled slot (handled by processFillsOnly)
421
+ * - Symmetric grid regen via COW rebalance (calculateTargetGrid + reconcileGrid)
422
+ * - Dust orders are cancelled by the rebalance's isCreateHealthy / cancelSurpluses
423
+ *
424
+ * This ensures:
425
+ * - Identical behavior between bootstrap and post-reset
426
+ * - Grid symmetry maintained by the rebalance, not by manual rotation
427
+ * - Budget safety enforced by validateWorkingGridFunds in the COW engine
428
+ *
429
+ * @param {Object} chainOrders - Chain orders instance for broadcasting
430
+ * @returns {Promise<void>}
431
+ */
432
+ _processFillsWithBootstrapMode(chainOrders: any): Promise<void>;
433
+ /**
434
+ * Set up account identifier and configure global context.
435
+ * @param {string} accountName - The name of the account to set up
436
+ * @private
437
+ */
438
+ _setupAccountContext(accountName: any): Promise<void>;
439
+ /**
440
+ * Initialize the bot by connecting to BitShares and setting up the account.
441
+ * @param {string|Object|Buffer} [vaultSecret=null] - The unlock secret for authentication.
442
+ * @returns {Promise<void>}
443
+ * @throws {Error} If initialization fails or preferredAccount is missing.
444
+ */
445
+ initialize(vaultSecret?: any): Promise<void>;
446
+ /**
447
+ * Places initial orders on the blockchain.
448
+ * @returns {Promise<void>}
449
+ */
450
+ placeInitialOrders(): Promise<void>;
451
+ /**
452
+ * Build outside-in pair groups for initial order placement.
453
+ * @param {Array<Object>} orders - Array of order objects
454
+ * @returns {Array<Array<Object>>} Grouped order arrays
455
+ */
456
+ _buildOutsideInPairGroupsForOrders(orders: any): any;
457
+ /**
458
+ * Build outside-in pair groups for create entry contexts.
459
+ * @param {Array<Object>} createEntries - Array of create entry objects with context.order
460
+ * @returns {Array<Array<Object>>} Grouped entry arrays
461
+ */
462
+ _buildOutsideInPairGroupsForCreateEntries(createEntries: any): any;
463
+ /**
464
+ * Resolve the centralized fill batch cap.
465
+ * @returns {number} Positive maximum number of fill-driven rotations per broadcast cycle
466
+ */
467
+ _getMaxFillBatchSize(): number;
468
+ /**
469
+ * Extract operation results from a batch transaction result.
470
+ * @param {Object|Array|null} result - Transaction result from executeBatch
471
+ * @param {string} [warnContext=''] - Context for warning messages
472
+ * @returns {Array} Array of operation result entries
473
+ */
474
+ _extractOperationResults(result: any, warnContext?: string): any[];
475
+ /**
476
+ * Find CREATE operation contexts whose broadcast result did not include a chain order id.
477
+ *
478
+ * @param {Array} operationResults - operation_results aligned with opContexts.
479
+ * @param {Array<Object>} opContexts - Operation context metadata aligned with operations.
480
+ * @returns {Array<{index:number, ctx:Object}>} Missing create result contexts.
481
+ */
482
+ _findMissingCreateResultContexts(operationResults: any, opContexts: any): any[];
483
+ /**
484
+ * Run an immediate chain sync after a successful CREATE broadcast returned incomplete ids.
485
+ *
486
+ * Missing-create blockers are intentionally preserved if the recovery snapshot does not
487
+ * account for the affected local slot. The sync engine owns normal clearing of
488
+ * _lastUnmatchedChainOrders after a successful clean snapshot; this method prevents a
489
+ * lagging empty snapshot from clearing blockers that were just created by this flow.
490
+ *
491
+ * @param {string} [reason] - Human-readable recovery context for logs.
492
+ * @returns {Promise<void>}
493
+ */
494
+ _recoverAfterMissingCreateResults(reason?: string): Promise<void>;
495
+ /**
496
+ * Restore unresolved missing-create blockers after recovery if sync did not adopt them.
497
+ *
498
+ * @param {Array<Object>} blockers - Pre-recovery missing-create blockers.
499
+ * @param {Object} recoveryResult - Result returned by manager.syncFromOpenOrders.
500
+ * @returns {void}
501
+ */
502
+ _preserveMissingCreateBlockersAfterRecovery(blockers: any, recoveryResult: any): void;
503
+ /**
504
+ * Merge missing CREATE result contexts into manager._lastUnmatchedChainOrders.
505
+ *
506
+ * The sync engine sets and clears _lastUnmatchedChainOrders on full sync snapshots.
507
+ * COW uses the same manager field as a structural create blocker before broadcasting.
508
+ * Missing-create entries are keyed by reason:slotId:operationIndex to avoid replacing
509
+ * unrelated unmatched chain orders that may already be blocking new creates.
510
+ *
511
+ * @param {Array<{index:number, ctx:Object}>} missingCreateResults - Missing CREATE results.
512
+ * @returns {void}
513
+ */
514
+ _markMissingCreateResultsAsStructuralBlocker(missingCreateResults: any): void;
515
+ /**
516
+ * Format an unmatched chain order/blocker for COW logs.
517
+ *
518
+ * @param {Object} order - Unmatched chain order or structural blocker.
519
+ * @returns {string} Compact human-readable diagnostic.
520
+ */
521
+ _formatUnmatchedChainOrderForLog(order: any): any;
522
+ /**
523
+ * Record a pending CREATE broadcast on the manager.
524
+ *
525
+ * Called immediately after each CREATE op is built into the opContext list.
526
+ * The fingerprint and op indices are stashed so the recovery path in
527
+ * _reconcileAfterUncertainBroadcast can correlate the planned op with an
528
+ * on-chain order (or discard it as a chain-side orphan).
529
+ *
530
+ * Storage: manager._pendingBroadcasts is a Map<fingerprint, PendingEntry>.
531
+ * We store on the manager (not on the bot) so the sync engine, grid
532
+ * reconcile, and any other consumer can read it without crossing the
533
+ * bot/manager boundary.
534
+ *
535
+ * @param {Object} entry
536
+ * @param {number} entry.opIndex - Index into the operations array
537
+ * @param {number} entry.ctxIndex - Index into opContexts
538
+ * @param {Object} entry.order - The grid order being broadcast
539
+ * @param {Object} entry.finalInts - { amountToSell, minToReceive, ... } blockchain integers
540
+ * @returns {void}
541
+ */
542
+ _recordPendingBroadcast(entry: any): void;
543
+ /**
544
+ * Clear the pending-broadcast cache.
545
+ *
546
+ * Called after a successful commit, after a confirmed failure (so the
547
+ * stale entries don't block the next cycle), and after a successful
548
+ * recovery adoption (matched entries are explicitly removed by
549
+ * _reconcileAfterUncertainBroadcast before calling this).
550
+ */
551
+ _clearPendingBroadcasts(): void;
552
+ /**
553
+ * Build a fingerprint for an on-chain order so it can be matched against
554
+ * the pending-broadcast cache.
555
+ *
556
+ * @param {Object} chainOrder - Parsed chain order (id, sell, receive, sellAssetId, receiveAssetId, ...)
557
+ * @param {string} slotId - The grid slot id (order.id) we expect this chain order to belong to
558
+ * @returns {string|null} Fingerprint or null on bad input
559
+ */
560
+ _buildChainOrderFingerprint(chainOrder: any, slotId: any): any;
561
+ /**
562
+ * Normalize raw BitShares limit_order_object data into the integer tuple
563
+ * used by pending-broadcast recovery.
564
+ *
565
+ * readOpenOrders() returns raw orders with sell_price/for_sale, not the
566
+ * parsed DEXBot fields type/sellInt/receiveInt. Test fixtures may still
567
+ * pass the parsed shape, so this helper accepts both.
568
+ *
569
+ * @param {Object} chainOrder
570
+ * @returns {{side: string, assetA: string, assetB: string, sellInt: number, receiveInt: number}|null}
571
+ */
572
+ _normalizeChainOrderForPendingMatch(chainOrder: any): {
573
+ side: any;
574
+ assetA: any;
575
+ assetB: any;
576
+ sellInt: number;
577
+ receiveInt: number;
578
+ };
579
+ /**
580
+ * Find a chain order that matches a planned slot using price+size proximity.
581
+ *
582
+ * Fallback for the case where the chain order's integer pair doesn't
583
+ * bit-match the planned op (e.g. the daemon normalized the minToReceive
584
+ * by ±1 unit to force an op, or precision rounding changed a value by 1).
585
+ * For each open chain order we build a fingerprint candidate per known
586
+ * slot id and accept the first exact match; if none, we look for a near
587
+ * match by sell+receive integer proximity.
588
+ *
589
+ * @param {Array<Object>} chainOrders - Open chain orders for the account
590
+ * @param {string} slotId - Planned grid slot id
591
+ * @param {Object} planned - { sell, receive, orderType } integers from the planned op
592
+ * @returns {Object|null} Matching chain order, or null
593
+ */
594
+ _findChainOrderForSlot(chainOrders: any, slotId: any, planned: any): any;
595
+ /**
596
+ * Reconcile a broadcast whose chain state is unknown.
597
+ *
598
+ * Triggered when the credential daemon times out (or hits its inner
599
+ * deadline) before confirming the broadcast. The chain may or may not
600
+ * have accepted the operations; we MUST treat the state as uncertain
601
+ * and recover deterministically.
602
+ *
603
+ * Algorithm:
604
+ * 1. Read the account's current open orders from the chain.
605
+ * 2. For each pending-broadcast entry (fingerprinted CREATE op), look
606
+ * for a matching chain order. If found: adopt it (set the opContext's
607
+ * chainOrderId and continue with the existing planned slot).
608
+ * 3. For pending entries with no chain match: virtualize (mark the
609
+ * opContext as discarded; the planned slot stays empty until the
610
+ * next planning cycle).
611
+ * 4. Persist + log a structured [COW][UNCERTAIN] summary.
612
+ *
613
+ * After this method returns, the bot has either adopted the on-chain
614
+ * result (good case — chain accepted but we didn't see the reply) or
615
+ * accepted the discard (chain rejected or never received the op).
616
+ *
617
+ * @param {BroadcastUncertainError} err - The thrown error
618
+ * @param {Array<Object>} opContexts - Original opContexts from the failed batch
619
+ * @returns {Promise<Object>} Result object compatible with batch return shape
620
+ */
621
+ _reconcileAfterUncertainBroadcast(err: any, opContexts: any, options?: {
622
+ fillLockAlreadyHeld?: boolean;
623
+ [key: string]: any;
624
+ }): Promise<any>;
625
+ _reconcileAfterUncertainBroadcastImpl(err: any, opContexts: any, options: any): Promise<{
626
+ executed: boolean;
627
+ hadRotation: boolean;
628
+ uncertain: boolean;
629
+ adopted?: undefined;
630
+ discarded?: undefined;
631
+ } | {
632
+ executed: boolean;
633
+ hadRotation: boolean;
634
+ uncertain: boolean;
635
+ adopted: any[];
636
+ discarded: any[];
637
+ }>;
638
+ /**
639
+ * Auto-cancel a single unmatched chain order from the recovery snapshot.
640
+ *
641
+ * This is the post-recovery safety net: if, after
642
+ * _reconcileAfterUncertainBroadcast runs, there are still chain orders
643
+ * the bot doesn't recognize (e.g. from a network partition, or from a
644
+ * daemon timeout that we couldn't even fingerprint), we cancel ONE of
645
+ * them per call. Per-cycle cap = 1 — the next cycle will pick up the
646
+ * next unmatched order if more remain.
647
+ *
648
+ * Safety conditions (ALL must hold):
649
+ * 1. _pendingBroadcasts is empty (no in-flight recovery)
650
+ * 2. _lastUnmatchedChainOrders is non-empty
651
+ * 3. The current cycle has not already auto-cancelled an orphan
652
+ * (tracked via this._autoCancelOrphanCycleMarker)
653
+ *
654
+ * Records the cancel via _recordOwnCancelOps so the fill consumer
655
+ * doesn't trip the self-cancel guard.
656
+ *
657
+ * @returns {Promise<{cancelled: boolean, orderId?: string, reason?: string}>}
658
+ */
659
+ _autoCancelOneUnmatchedOrphan(): Promise<{
660
+ cancelled: boolean;
661
+ reason: string;
662
+ orderId?: undefined;
663
+ error?: undefined;
664
+ } | {
665
+ cancelled: boolean;
666
+ orderId: any;
667
+ reason?: undefined;
668
+ error?: undefined;
669
+ } | {
670
+ cancelled: boolean;
671
+ reason: string;
672
+ error: any;
673
+ orderId?: undefined;
674
+ }>;
675
+ /**
676
+ * Check whether to execute creates in outside-in pair mode (mixed BUY/SELL operations).
677
+ * @param {Array<Object>} opContexts - Operation contexts array
678
+ * @returns {boolean} True if pair mode should be used
679
+ */
680
+ _shouldExecuteCreatePairMode(opContexts: any): boolean;
681
+ /**
682
+ * Execute operations with retry on BroadcastUncertainError.
683
+ * The daemon already retries internally against a 25s deadline.
684
+ * If all expire, a fresh bot-level attempt buys a new 25s window.
685
+ *
686
+ * Skips retry when partialOnChainState is true (pair-mode grouped
687
+ * execution where earlier groups already committed). Re-broadcasting
688
+ * the full operations array would duplicate those creates on chain.
689
+ */
690
+ _executeWithRetryOnUncertain(operations: any, opContexts: any): Promise<{
691
+ result: any;
692
+ opContexts: any;
693
+ }>;
694
+ /**
695
+ * Execute blockchain operations with appropriate strategy (single batch or pair mode).
696
+ * @param {Array<import('./types').CreatedOperation>} operations - Array of operation objects
697
+ * @param {Array<Object>} opContexts - Array of operation context metadata (1:1 with operations)
698
+ * @returns {Promise<{result: Object, opContexts: Array}>} Execution result with contexts
699
+ */
700
+ _executeOperationsWithStrategy(operations: any, opContexts: any): Promise<{
701
+ result: any;
702
+ opContexts: any;
703
+ }>;
704
+ /**
705
+ * Validate that operations can be executed with available funds before broadcasting.
706
+ * Checks sufficient available funds for all operations.
707
+ * @param {Array} operations - Operations to validate
708
+ * @param {Object} assetA - Asset A metadata (id, precision, symbol)
709
+ * @param {Object} assetB - Asset B metadata (id, precision, symbol)
710
+ * @returns {Object} { isValid: boolean, summary: string }
711
+ * @private
712
+ */
713
+ _validateOperationFunds(operations: any, assetA: any, assetB: any): {
714
+ isValid: boolean;
715
+ summary: string;
716
+ violations?: undefined;
717
+ } | {
718
+ isValid: boolean;
719
+ summary: string;
720
+ violations: any[];
721
+ };
722
+ /**
723
+ * Resolve the ideal size from an order-like object with fallback.
724
+ * @param {Object|null} orderLike - Order-like object with optional idealSize/size nested properties
725
+ * @param {number|null} [fallbackSize=null] - Fallback size if none found
726
+ * @returns {number|null} Resolved size or null
727
+ */
728
+ _resolveIdealSizeForValidation(orderLike: any, fallbackSize?: any): number;
729
+ /**
730
+ * Validate that an order size is safe to execute (above minimum dust thresholds).
731
+ * @param {number} size - Order size to validate
732
+ * @param {string} type - ORDER_TYPES.BUY or ORDER_TYPES.SELL
733
+ * @param {Object|null} [orderLike=null] - Optional order-like object for ideal size comparison
734
+ * @param {number|null} [fallbackSize=null] - Fallback ideal size
735
+ * @returns {import('./types').OrderValidationResult}
736
+ */
737
+ _validateOrderSizeForExecution(size: any, type: any, orderLike?: any, fallbackSize?: any): any;
738
+ /**
739
+ * Execute a batch of order operations if the rebalance result has executable actions.
740
+ * @param {Object} rebalanceResult - COW rebalance result with actions
741
+ * @param {string} [contextLabel='rebalance'] - Context label for logging
742
+ * @returns {Promise<Object>} Batch execution result
743
+ */
744
+ _executeBatchIfNeeded(rebalanceResult: any, contextLabel?: string): Promise<any>;
745
+ /**
746
+ * Process filled orders in capped batches per FILL_PROCESSING.MAX_FILL_BATCH_SIZE.
747
+ * Each chunk triggers its own processFilledOrders → COW plan → broadcast cycle.
748
+ *
749
+ * @param {Array} fills - Filled order objects to process
750
+ * @param {Set|null} excl - Exclusion set (order IDs to skip)
751
+ * @param {string} contextLabel - Label for logging and batch context
752
+ * @param {Object} [options={}] - Passed through to processFilledOrders
753
+ * @returns {{aborted: boolean}}
754
+ */
755
+ _processFillsWithBatching(fills: any, excl: any, contextLabel: any, options?: {}): Promise<{
756
+ aborted: boolean;
757
+ }>;
758
+ /**
759
+ * Check if the bot requires credential daemon for write operations.
760
+ * @returns {boolean}
761
+ */
762
+ _isCredentialDaemonWriteRequired(): any;
763
+ /**
764
+ * Suspend grid persistence due to credential daemon outage.
765
+ * @param {string} reason - Reason for suspension
766
+ * @returns {void}
767
+ */
768
+ _suspendGridPersistenceForCredentialOutage(reason: any): void;
769
+ /**
770
+ * Resume grid persistence after credential daemon recovery.
771
+ * @param {string} reason - Reason for resuming
772
+ * @returns {void}
773
+ */
774
+ _resumeGridPersistenceAfterCredentialRecovery(reason: any): void;
775
+ /**
776
+ * Ensure the credential daemon is writable before broadcasting operations.
777
+ * @param {string} [contextLabel='write batch'] - Context label for logging
778
+ * @returns {Promise<void>}
779
+ * @throws {Error} With code CREDENTIAL_DAEMON_UNAVAILABLE if daemon is down
780
+ */
781
+ _ensureCredentialDaemonWritable(contextLabel?: string): Promise<void>;
782
+ /**
783
+ * Check if an error is related to credential daemon unavailability.
784
+ * @param {Error|*} err - Error to check
785
+ * @returns {boolean}
786
+ */
787
+ _isCredentialDaemonError(err: any): boolean;
788
+ /**
789
+ * Run state recovery after credential daemon is restored.
790
+ * @returns {Promise<void>}
791
+ */
792
+ _runCredentialRecoveryAfterDaemonRestored(): Promise<void>;
793
+ /**
794
+ * Start the credential daemon watchdog interval that periodically probes daemon health.
795
+ * @returns {void}
796
+ */
797
+ _setupCredentialDaemonWatchdogInterval(): void;
798
+ /**
799
+ * Stop the credential daemon watchdog interval.
800
+ * @returns {void}
801
+ */
802
+ _stopCredentialDaemonWatchdogInterval(): void;
803
+ /**
804
+ * Executes a batch of order operations on the blockchain using COW pattern.
805
+ * Master grid is only updated after successful blockchain confirmation.
806
+ * @param {Object} rebalanceResult - COW result containing workingGrid + actions.
807
+ * @returns {Promise<Object>} The batch result.
808
+ */
809
+ updateOrdersOnChainBatch(rebalanceResult: any): Promise<any>;
810
+ /**
811
+ * Converts simple plan payloads (place/update/rotate/cancel) into a COW batch.
812
+ * Used by spread/divergence maintenance and bootstrap helpers.
813
+ * @param {Object|Array} plan - Plan object or array of ordersToPlace
814
+ * @returns {Promise<Object>} Batch execution result
815
+ */
816
+ updateOrdersOnChainPlan(plan: any): Promise<any>;
817
+ /**
818
+ * Build COW actions array from a simple plan object or array of ordersToPlace.
819
+ * @param {Object|Array} plan - Plan object with ordersToPlace/ordersToRotate/ordersToUpdate/ordersToCancel, or array of ordersToPlace
820
+ * @returns {Array<{type: string, id: string, order?: Object, orderId?: string, newSize?: number, newPrice?: number, newGridId?: string}>}
821
+ */
822
+ _buildActionsFromPlan(plan: any): any[];
823
+ /**
824
+ * Build a COW result object (workingGrid + actions) from a simple plan.
825
+ * @param {Object|Array} plan - Plan object or array of ordersToPlace
826
+ * @returns {{workingGrid: import('./types').WorkingGrid, workingIndexes: Object, workingBoundary: number, actions: Array}}
827
+ */
828
+ _buildCowResultFromPlan(plan: any): {
829
+ workingGrid: any;
830
+ workingIndexes: any;
831
+ workingBoundary: any;
832
+ actions: any[];
833
+ };
834
+ /**
835
+ * Restore skipped update slots in the working grid to master state.
836
+ * @param {import('./types').WorkingGrid} workingGrid - Working grid to restore slots into
837
+ * @param {Set<string>} skippedSlotIds - Set of slot IDs that were skipped
838
+ * @param {number} [skippedCount=0] - Count of skipped actions for logging
839
+ * @returns {void}
840
+ */
841
+ _restoreSkippedUpdateSlotsInWorkingGrid(workingGrid: any, skippedSlotIds: any, skippedCount?: number): void;
842
+ /**
843
+ * COW broadcast: Execute blockchain operations and commit working grid on success.
844
+ * Master grid is ONLY updated after successful blockchain confirmation.
845
+ * @param {Object} cowResult - COW result with workingGrid, actions, etc.
846
+ * @returns {Promise<Object>} The batch result.
847
+ * @private
848
+ */
849
+ _updateOrdersOnChainBatchCOW(cowResult: any): Promise<any>;
850
+ /**
851
+ * Process results from batch transaction execution.
852
+ * Updates order state, synchronizes with chain, and deducts BTS fees.
853
+ * @param {Object} result - Transaction result from executeBatch
854
+ * @param {Array} opContexts - Operation context array with operation metadata (must be 1:1 with result.operation_results)
855
+ * @returns {Object} Result with { executed: boolean, hadRotation: boolean }
856
+ * @private
857
+ */
858
+ _processBatchResults(result: any, opContexts: any): Promise<{
859
+ executed: boolean;
860
+ hadRotation: boolean;
861
+ updateOperationCount: number;
862
+ }>;
863
+ /**
864
+ * Perform grid recalculation triggered by trigger file.
865
+ * Reloads config from disk, recalculates grid, resets funds, and removes trigger file.
866
+ * Must be called with _fillProcessingLock already held.
867
+ * @param {Object} [options] - Optional configuration for grid resync.
868
+ * @returns {Promise<boolean>} True if resync succeeded
869
+ * @private
870
+ */
871
+ _performGridResync(options?: {}): Promise<any>;
872
+ /**
873
+ * Handle any pending trigger file reset at startup.
874
+ * This is called FIRST during startup before any grid operations.
875
+ * @returns {Promise<boolean>} True if trigger reset completed successfully, false otherwise
876
+ * @private
877
+ */
878
+ _handlePendingTriggerReset(): Promise<any>;
879
+ /**
880
+ * Setup trigger file detection for grid reset.
881
+ * Monitors the trigger file and performs grid resync when it's created.
882
+ * @private
883
+ */
884
+ _setupTriggerFileDetection(): Promise<any>;
885
+ /**
886
+ * Starts the bot's operation.
887
+ * @param {string|Object|Buffer} [vaultSecret=null] - The unlock secret.
888
+ * @returns {Promise<void>}
889
+ */
890
+ start(vaultSecret?: any): Promise<void>;
891
+ /**
892
+ * Start bot with a pre-decrypted private key.
893
+ * Alternative to start(vaultSecret) when the signing secret is already available.
894
+ * @param {string|Object} privateKey - Pre-decrypted private key or daemon signing token
895
+ * @returns {Promise<void>}
896
+ */
897
+ startWithPrivateKey(privateKey: any): Promise<void>;
898
+ /**
899
+ * Common startup sequence logic shared between start() and startWithPrivateKey().
900
+ * @private
901
+ */
902
+ _runStartupSequence(): Promise<void>;
903
+ /**
904
+ * Perform periodic grid checks: fund thresholds, spread condition, grid health.
905
+ * Called by the periodic blockchain fetch interval to check if grid needs updates.
906
+ *
907
+ * IMPORTANT: This method MUST only be called from within _fillProcessingLock.acquire()
908
+ * (specifically from _setupBlockchainFetchInterval). It passes fillLockAlreadyHeld
909
+ * to avoid deadlock with _consumeFillQueue which uses the same lock ordering.
910
+ *
911
+ * @private
912
+ */
913
+ _performPeriodicGridChecks(): Promise<any>;
914
+ _isOpenOrdersSyncLoopEnabled(): any;
915
+ /**
916
+ * Start the open-orders watchdog sync loop.
917
+ * Uses fill lock contention checks to avoid competing with fill processing.
918
+ * @private
919
+ */
920
+ _startOpenOrdersSyncLoop(): any;
921
+ /**
922
+ * Stop the open-orders watchdog sync loop.
923
+ * @private
924
+ */
925
+ _stopOpenOrdersSyncLoop(): Promise<any>;
926
+ /**
927
+ * Set up periodic blockchain account balance fetch interval.
928
+ * Fetches available funds at regular intervals to keep blockchain variables up-to-date.
929
+ * @private
930
+ */
931
+ _setupBlockchainFetchInterval(): any;
932
+ /**
933
+ * Stop the periodic blockchain fetch interval.
934
+ * @private
935
+ */
936
+ _stopBlockchainFetchInterval(): any;
937
+ _releaseMarketAdapterRuntime(context?: string): Promise<any>;
938
+ /**
939
+ * Get or create the credit runtime for debt policy management.
940
+ * @returns {import('./credit_runtime').CreditRuntime|null}
941
+ */
942
+ _getCreditRuntime(): any;
943
+ /**
944
+ * Set up the credit runtime by loading its persisted state.
945
+ * @returns {Promise<import('./credit_runtime').CreditRuntime|null>}
946
+ */
947
+ _setupCreditRuntime(): Promise<any>;
948
+ /**
949
+ * Refresh credit runtime state from chain and sync internal tracking.
950
+ * @returns {Promise<void>}
951
+ */
952
+ _refreshAndSyncCreditRuntime(): Promise<void>;
953
+ /**
954
+ * Run credit runtime maintenance (deal checks, collateral monitoring).
955
+ * @param {string} [context='periodic'] - Maintenance context
956
+ * @param {Object} [options={}] - Maintenance options
957
+ * @returns {Promise<*>} Maintenance result from runtime
958
+ */
959
+ _runCreditRuntimeMaintenance(context?: string, options?: {}): Promise<any>;
960
+ /**
961
+ * Start the credit deal watchdog interval.
962
+ * @returns {void}
963
+ */
964
+ _setupCreditWatchdogInterval(): void;
965
+ /**
966
+ * Stop the credit deal watchdog interval.
967
+ * @returns {void}
968
+ */
969
+ _stopCreditWatchdogInterval(): void;
970
+ requestGridReset(reason?: string, options?: {
971
+ refreshCenterPrice?: boolean;
972
+ fillLockAlreadyHeld?: boolean;
973
+ [key: string]: any;
974
+ }): Promise<any>;
975
+ _wireStructuralGridResyncRequest(): void;
976
+ /**
977
+ * Get current metrics for monitoring and debugging.
978
+ * @returns {Object} Metrics snapshot
979
+ */
980
+ getMetrics(): any;
981
+ /**
982
+ * Execute grid maintenance checks in strict order with pipeline consensus.
983
+ *
984
+ * CRITICAL DESIGN: All structural grid modifications are deferred until the pipeline
985
+ * is empty to prevent "race-to-resize" conditions where the bot attempts to reallocate
986
+ * temporary fund surpluses from filled orders before their counter-orders/rotations
987
+ * are placed.
988
+ *
989
+ * MAINTENANCE SEQUENCE:
990
+ * 1. Fund Recalculation (ALWAYS) - Updates internal fund metrics
991
+ * 2. Pipeline Check (GATE) - Verifies no pending operations
992
+ * 3. Health Check (IF IDLE) - Detects and cleans dust orders
993
+ * 4. Divergence Detection (IF IDLE) - Identifies structural mismatches
994
+ * 5. Grid Resizing (IF IDLE) - Applies size corrections on-chain
995
+ * 6. Spread Correction (IF IDLE) - Corrects spread after structural work completes
996
+ *
997
+ * WHY PIPELINE CONSENSUS MATTERS:
998
+ * - After a fill, funds temporarily show a "surplus" from the filled order
999
+ * - If grid maintenance runs immediately, it sees the surplus and triggers a resize
1000
+ * - The resize attempts to allocate funds that will be consumed by pending counter-orders
1001
+ * - This causes cascading trades, fund accounting errors, and grid instability
1002
+ * - Solution: Wait for pipeline to empty (all rotations placed) before resizing
1003
+ *
1004
+ * TIMEOUT SAFETY:
1005
+ * - clearStalePipelineOperations() clears stuck operations after 5-minute timeout
1006
+ * - Called before pipeline check to prevent indefinite blocking
1007
+ * - See manager.clearStalePipelineOperations() for details
1008
+ *
1009
+ * @param {Object} context - Maintenance context for logging.
1010
+ * @private
1011
+ */
1012
+ _executeMaintenanceLogic(context: any): Promise<any>;
1013
+ /**
1014
+ * Cancel dust partial orders immediately — no maps, no timers, no delay.
1015
+ * Each dust order is cancelled on chain and its slot rotated through the
1016
+ * synthetic-fill pipeline.
1017
+ * @param {{ buy: Array, sell: Array, fillLockAlreadyHeld?: boolean }} options
1018
+ * @returns {Promise<{cancelledCount: number, batchResult: {aborted: boolean}|null}>}
1019
+ * @private
1020
+ */
1021
+ _cancelDustOrders({ buy: buyDust, sell: sellDust, fillLockAlreadyHeld }?: {
1022
+ buy?: any[];
1023
+ sell?: any[];
1024
+ fillLockAlreadyHeld?: boolean;
1025
+ }): Promise<any>;
1026
+ /**
1027
+ * Set up the periodic dust health check interval.
1028
+ * Catches partials below the dust threshold that were missed by the post-fill
1029
+ * pipeline (e.g. from a prior bot lifetime after crash/restart).
1030
+ * Cancels dust immediately inside the fill-processing lock.
1031
+ * @private
1032
+ */
1033
+ _setupDustHealthCheckInterval(): void;
1034
+ /**
1035
+ * Perform grid maintenance: fund thresholds, spread condition, grid health, divergence.
1036
+ * Consolidates maintenance checks used during startup, periodic updates, and post-fill.
1037
+ *
1038
+ * ENTRY POINTS:
1039
+ * 1. Startup (line ~681): After grid initialization, ensures grid is healthy
1040
+ * 2. Periodic (line ~2682): Every BLOCKCHAIN_FETCH_INTERVAL_MIN (default 240 min)
1041
+ * 3. Post-Fill (line ~1059): After order fills are rotated
1042
+ *
1043
+ * PIPELINE PROTECTION:
1044
+ * All maintenance operations inside _executeMaintenanceLogic respect isPipelineEmpty().
1045
+ * This prevents grid modifications while fills/rotations/corrections are pending.
1046
+ * See _executeMaintenanceLogic documentation for detailed rationale.
1047
+ *
1048
+ * LOCK ORDERING:
1049
+ * - Canonical order: _fillProcessingLock → _divergenceLock
1050
+ * - This function handles lock acquisition based on fillLockAlreadyHeld parameter
1051
+ * - When called from post-fill context, fill lock is already held
1052
+ * - When called from periodic context, both locks must be acquired
1053
+ * - Matches the order used in _consumeFillQueue to prevent deadlocks
1054
+ *
1055
+ * @param {string} context - Maintenance context for logging (e.g. 'startup', 'periodic', 'post-fill')
1056
+ * @param {Object} options - Maintenance options
1057
+ * @private
1058
+ */
1059
+ _runGridMaintenance(context?: string, options?: {}): Promise<any>;
1060
+ /**
1061
+ * Gracefully shutdown the bot.
1062
+ * Waits for current fill processing to complete, persists state, and stops intervals.
1063
+ * Idempotent: subsequent calls await the first shutdown so duplicate cleanup
1064
+ * invocations do not run the body twice or exit before persistence finishes.
1065
+ * @returns {Promise<void>}
1066
+ */
1067
+ shutdown(): Promise<void>;
1068
+ _shutdownImpl(): Promise<void>;
1069
+ }
1070
+ declare const _default: typeof DEXBot & {
1071
+ normalizeBotEntry: any;
1072
+ };
1073
+ export = _default;
1074
+ //# sourceMappingURL=dexbot_class.d.ts.map