dexbot 1.4.10 → 1.4.12

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 (502) hide show
  1. package/README.md +6 -5
  2. package/dist/analysis/chart_utils.d.ts.map +1 -1
  3. package/dist/analysis/chart_utils.js +9 -18
  4. package/dist/analysis/chart_utils.js.map +1 -1
  5. package/dist/analysis/math_utils.d.ts.map +1 -1
  6. package/dist/analysis/math_utils.js +6 -16
  7. package/dist/analysis/math_utils.js.map +1 -1
  8. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +1 -1
  9. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
  10. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +31 -38
  11. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
  12. package/dist/analysis/trend_detection/hurst_analyzer.js +7 -10
  13. package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
  14. package/dist/analysis/trend_detection/kalman_trend_analyzer.js +10 -14
  15. package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -1
  16. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +10 -15
  17. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -1
  18. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +7 -10
  19. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -1
  20. package/dist/bot.d.ts.map +1 -1
  21. package/dist/bot.js +4 -12
  22. package/dist/bot.js.map +1 -1
  23. package/dist/credential-daemon.d.ts +0 -1
  24. package/dist/credential-daemon.d.ts.map +1 -1
  25. package/dist/credential-daemon.js +3 -123
  26. package/dist/credential-daemon.js.map +1 -1
  27. package/dist/dexbot.d.ts +0 -87
  28. package/dist/dexbot.d.ts.map +1 -1
  29. package/dist/dexbot.js +54 -23
  30. package/dist/dexbot.js.map +1 -1
  31. package/dist/market_adapter/ama_signal_runner.js +8 -9
  32. package/dist/market_adapter/ama_signal_runner.js.map +1 -1
  33. package/dist/market_adapter/candle_utils.js +1 -7
  34. package/dist/market_adapter/candle_utils.js.map +1 -1
  35. package/dist/market_adapter/core/asymmetric_bounds.js +1 -4
  36. package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
  37. package/dist/market_adapter/core/config_normalizers.js +5 -9
  38. package/dist/market_adapter/core/config_normalizers.js.map +1 -1
  39. package/dist/market_adapter/core/kibana_candles.js +8 -15
  40. package/dist/market_adapter/core/kibana_candles.js.map +1 -1
  41. package/dist/market_adapter/core/kibana_client.js +7 -13
  42. package/dist/market_adapter/core/kibana_client.js.map +1 -1
  43. package/dist/market_adapter/core/kibana_market_candles.js +6 -12
  44. package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
  45. package/dist/market_adapter/core/market_adapter_service.d.ts +2 -0
  46. package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
  47. package/dist/market_adapter/core/market_adapter_service.js +100 -101
  48. package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
  49. package/dist/market_adapter/core/strategies/ama.js +5 -10
  50. package/dist/market_adapter/core/strategies/ama.js.map +1 -1
  51. package/dist/market_adapter/core/strategies/ama_slope_model.js +21 -24
  52. package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
  53. package/dist/market_adapter/core/strategies/atr/calculator.js +3 -5
  54. package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
  55. package/dist/market_adapter/core/strategies/collateral_manager.js +4 -6
  56. package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
  57. package/dist/market_adapter/core/strategies/regime_gate.js +15 -22
  58. package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
  59. package/dist/market_adapter/index.d.ts +23 -23
  60. package/dist/market_adapter/index.d.ts.map +1 -1
  61. package/dist/market_adapter/index.js +24 -82
  62. package/dist/market_adapter/index.js.map +1 -1
  63. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +2 -1
  64. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
  65. package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
  66. package/dist/market_adapter/inputs/fetch_lp_data.js +59 -98
  67. package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
  68. package/dist/market_adapter/inputs/kibana_source.js +11 -17
  69. package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
  70. package/dist/market_adapter/interval_utils.js +1 -2
  71. package/dist/market_adapter/interval_utils.js.map +1 -1
  72. package/dist/market_adapter/log_format.js +1 -7
  73. package/dist/market_adapter/log_format.js.map +1 -1
  74. package/dist/market_adapter/lp_chart_core.js +20 -22
  75. package/dist/market_adapter/lp_chart_core.js.map +1 -1
  76. package/dist/market_adapter/lp_chart_runner.d.ts +1 -1
  77. package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
  78. package/dist/market_adapter/lp_chart_runner.js +41 -57
  79. package/dist/market_adapter/lp_chart_runner.js.map +1 -1
  80. package/dist/market_adapter/lp_chart_strategy_loader.js +30 -34
  81. package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
  82. package/dist/market_adapter/market_adapter.d.ts +2 -2
  83. package/dist/market_adapter/market_adapter.d.ts.map +1 -1
  84. package/dist/market_adapter/market_adapter.js +163 -222
  85. package/dist/market_adapter/market_adapter.js.map +1 -1
  86. package/dist/market_adapter/merge_lp_data.js +17 -18
  87. package/dist/market_adapter/merge_lp_data.js.map +1 -1
  88. package/dist/market_adapter/test_helpers.js +3 -14
  89. package/dist/market_adapter/test_helpers.js.map +1 -1
  90. package/dist/market_adapter/utils/adapter_client.js +7 -16
  91. package/dist/market_adapter/utils/adapter_client.js.map +1 -1
  92. package/dist/market_adapter/utils/atomic_write.js +3 -5
  93. package/dist/market_adapter/utils/atomic_write.js.map +1 -1
  94. package/dist/market_adapter/utils/chain.d.ts.map +1 -1
  95. package/dist/market_adapter/utils/chain.js +9 -17
  96. package/dist/market_adapter/utils/chain.js.map +1 -1
  97. package/dist/market_adapter/utils/data_discovery.js +8 -10
  98. package/dist/market_adapter/utils/data_discovery.js.map +1 -1
  99. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
  100. package/dist/market_adapter/utils/dynamic_grid_snapshot.js +11 -14
  101. package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
  102. package/dist/market_adapter/utils/file_lock.js +14 -19
  103. package/dist/market_adapter/utils/file_lock.js.map +1 -1
  104. package/dist/market_adapter/utils/native_history.js +8 -14
  105. package/dist/market_adapter/utils/native_history.js.map +1 -1
  106. package/dist/market_adapter/utils/paths.js +3 -6
  107. package/dist/market_adapter/utils/paths.js.map +1 -1
  108. package/dist/modules/account_bots.d.ts +1 -1
  109. package/dist/modules/account_bots.d.ts.map +1 -1
  110. package/dist/modules/account_bots.js +90 -97
  111. package/dist/modules/account_bots.js.map +1 -1
  112. package/dist/modules/account_orders.d.ts +0 -9
  113. package/dist/modules/account_orders.d.ts.map +1 -1
  114. package/dist/modules/account_orders.js +26 -121
  115. package/dist/modules/account_orders.js.map +1 -1
  116. package/dist/modules/authority_resolver.js +12 -18
  117. package/dist/modules/authority_resolver.js.map +1 -1
  118. package/dist/modules/bitshares-native/chain_client.js +16 -21
  119. package/dist/modules/bitshares-native/chain_client.js.map +1 -1
  120. package/dist/modules/bitshares-native/crypto/ecc.browser.js +12 -72
  121. package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
  122. package/dist/modules/bitshares-native/crypto/ecc.js +13 -40
  123. package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
  124. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -1
  125. package/dist/modules/bitshares-native/crypto/ecc_selector.js +5 -6
  126. package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
  127. package/dist/modules/bitshares-native/index.d.ts +8 -8
  128. package/dist/modules/bitshares-native/index.d.ts.map +1 -1
  129. package/dist/modules/bitshares-native/index.js +11 -68
  130. package/dist/modules/bitshares-native/index.js.map +1 -1
  131. package/dist/modules/bitshares-native/lru_cache.js +3 -6
  132. package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
  133. package/dist/modules/bitshares-native/resolvers.js +9 -11
  134. package/dist/modules/bitshares-native/resolvers.js.map +1 -1
  135. package/dist/modules/bitshares-native/serial/chain_constants.js +3 -28
  136. package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
  137. package/dist/modules/bitshares-native/serial/index.d.ts +4 -4
  138. package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
  139. package/dist/modules/bitshares-native/serial/index.js +5 -46
  140. package/dist/modules/bitshares-native/serial/index.js.map +1 -1
  141. package/dist/modules/bitshares-native/serial/operations.d.ts +98 -98
  142. package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
  143. package/dist/modules/bitshares-native/serial/operations.js +372 -473
  144. package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
  145. package/dist/modules/bitshares-native/serial/serializer.js +3 -8
  146. package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
  147. package/dist/modules/bitshares-native/serial/types.js +9 -74
  148. package/dist/modules/bitshares-native/serial/types.js.map +1 -1
  149. package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -1
  150. package/dist/modules/bitshares-native/signing_client.js +11 -48
  151. package/dist/modules/bitshares-native/signing_client.js.map +1 -1
  152. package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
  153. package/dist/modules/bitshares-native/subscriptions.js +24 -27
  154. package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
  155. package/dist/modules/bitshares-native/transport.d.ts.map +1 -1
  156. package/dist/modules/bitshares-native/transport.js +14 -26
  157. package/dist/modules/bitshares-native/transport.js.map +1 -1
  158. package/dist/modules/bitshares-native/tx/builder.js +29 -72
  159. package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
  160. package/dist/modules/bitshares-native/tx/tx_cache.js +12 -21
  161. package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
  162. package/dist/modules/bitshares_client.d.ts +21 -0
  163. package/dist/modules/bitshares_client.d.ts.map +1 -1
  164. package/dist/modules/bitshares_client.js +32 -86
  165. package/dist/modules/bitshares_client.js.map +1 -1
  166. package/dist/modules/bot_settings.d.ts.map +1 -1
  167. package/dist/modules/bot_settings.js +30 -49
  168. package/dist/modules/bot_settings.js.map +1 -1
  169. package/dist/modules/bots_file_lock.d.ts.map +1 -1
  170. package/dist/modules/bots_file_lock.js +5 -13
  171. package/dist/modules/bots_file_lock.js.map +1 -1
  172. package/dist/modules/broadcast_failure.js +1 -3
  173. package/dist/modules/broadcast_failure.js.map +1 -1
  174. package/dist/modules/chain_keys.d.ts +4 -9
  175. package/dist/modules/chain_keys.d.ts.map +1 -1
  176. package/dist/modules/chain_keys.js +77 -182
  177. package/dist/modules/chain_keys.js.map +1 -1
  178. package/dist/modules/chain_orders.d.ts +2 -2
  179. package/dist/modules/chain_orders.d.ts.map +1 -1
  180. package/dist/modules/chain_orders.js +81 -144
  181. package/dist/modules/chain_orders.js.map +1 -1
  182. package/dist/modules/config.d.ts.map +1 -1
  183. package/dist/modules/config.js +23 -28
  184. package/dist/modules/config.js.map +1 -1
  185. package/dist/modules/constants.d.ts +4 -14
  186. package/dist/modules/constants.d.ts.map +1 -1
  187. package/dist/modules/constants.js +46 -78
  188. package/dist/modules/constants.js.map +1 -1
  189. package/dist/modules/cr_planner.js +15 -26
  190. package/dist/modules/cr_planner.js.map +1 -1
  191. package/dist/modules/credential_policy.d.ts +3 -6
  192. package/dist/modules/credential_policy.d.ts.map +1 -1
  193. package/dist/modules/credential_policy.js +62 -153
  194. package/dist/modules/credential_policy.js.map +1 -1
  195. package/dist/modules/credential_runtime.d.ts +1 -1
  196. package/dist/modules/credential_runtime.d.ts.map +1 -1
  197. package/dist/modules/credential_runtime.js +34 -41
  198. package/dist/modules/credential_runtime.js.map +1 -1
  199. package/dist/modules/credential_session_cache.d.ts +1 -1
  200. package/dist/modules/credential_session_cache.d.ts.map +1 -1
  201. package/dist/modules/credential_session_cache.js +5 -42
  202. package/dist/modules/credential_session_cache.js.map +1 -1
  203. package/dist/modules/credit_runtime.d.ts.map +1 -1
  204. package/dist/modules/credit_runtime.js +126 -162
  205. package/dist/modules/credit_runtime.js.map +1 -1
  206. package/dist/modules/crypto/browser_provider.d.ts +1 -1
  207. package/dist/modules/crypto/browser_provider.d.ts.map +1 -1
  208. package/dist/modules/crypto/browser_provider.js +7 -11
  209. package/dist/modules/crypto/browser_provider.js.map +1 -1
  210. package/dist/modules/crypto/index.d.ts +6 -6
  211. package/dist/modules/crypto/index.d.ts.map +1 -1
  212. package/dist/modules/crypto/index.js +12 -30
  213. package/dist/modules/crypto/index.js.map +1 -1
  214. package/dist/modules/crypto/node_provider.d.ts +1 -1
  215. package/dist/modules/crypto/node_provider.d.ts.map +1 -1
  216. package/dist/modules/crypto/node_provider.js +3 -5
  217. package/dist/modules/crypto/node_provider.js.map +1 -1
  218. package/dist/modules/crypto/provider.js +1 -2
  219. package/dist/modules/crypto/pure_ripemd160.js +1 -3
  220. package/dist/modules/crypto/pure_ripemd160.js.map +1 -1
  221. package/dist/modules/crypto/pure_scrypt.js +1 -4
  222. package/dist/modules/crypto/pure_scrypt.js.map +1 -1
  223. package/dist/modules/crypto/pure_secp256k1.d.ts +1 -1
  224. package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -1
  225. package/dist/modules/crypto/pure_secp256k1.js +1 -16
  226. package/dist/modules/crypto/pure_secp256k1.js.map +1 -1
  227. package/dist/modules/crypto/sync.d.ts.map +1 -1
  228. package/dist/modules/crypto/sync.js +16 -17
  229. package/dist/modules/crypto/sync.js.map +1 -1
  230. package/dist/modules/daemon_node_health.js +14 -16
  231. package/dist/modules/daemon_node_health.js.map +1 -1
  232. package/dist/modules/dexbot_class.d.ts +19 -14
  233. package/dist/modules/dexbot_class.d.ts.map +1 -1
  234. package/dist/modules/dexbot_class.js +127 -164
  235. package/dist/modules/dexbot_class.js.map +1 -1
  236. package/dist/modules/dexbot_cow_runtime.d.ts +28 -27
  237. package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
  238. package/dist/modules/dexbot_cow_runtime.js +55 -45
  239. package/dist/modules/dexbot_cow_runtime.js.map +1 -1
  240. package/dist/modules/dexbot_credential_client.d.ts +6 -2
  241. package/dist/modules/dexbot_credential_client.d.ts.map +1 -1
  242. package/dist/modules/dexbot_credential_client.js +21 -31
  243. package/dist/modules/dexbot_credential_client.js.map +1 -1
  244. package/dist/modules/dexbot_fill_runtime.d.ts +23 -23
  245. package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
  246. package/dist/modules/dexbot_fill_runtime.js +119 -77
  247. package/dist/modules/dexbot_fill_runtime.js.map +1 -1
  248. package/dist/modules/dexbot_maintenance_runtime.d.ts +46 -38
  249. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
  250. package/dist/modules/dexbot_maintenance_runtime.js +81 -81
  251. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
  252. package/dist/modules/dexbot_startup_runtime.d.ts +3 -3
  253. package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
  254. package/dist/modules/dexbot_startup_runtime.js +43 -81
  255. package/dist/modules/dexbot_startup_runtime.js.map +1 -1
  256. package/dist/modules/dexbot_state_recovery.d.ts +11 -11
  257. package/dist/modules/dexbot_state_recovery.js +32 -78
  258. package/dist/modules/dexbot_state_recovery.js.map +1 -1
  259. package/dist/modules/env.js +3 -7
  260. package/dist/modules/env.js.map +1 -1
  261. package/dist/modules/fund_registry.d.ts.map +1 -1
  262. package/dist/modules/fund_registry.js +12 -24
  263. package/dist/modules/fund_registry.js.map +1 -1
  264. package/dist/modules/general_settings.js +10 -16
  265. package/dist/modules/general_settings.js.map +1 -1
  266. package/dist/modules/graceful_shutdown.d.ts.map +1 -1
  267. package/dist/modules/graceful_shutdown.js +12 -19
  268. package/dist/modules/graceful_shutdown.js.map +1 -1
  269. package/dist/modules/key_store.d.ts.map +1 -1
  270. package/dist/modules/key_store.js +27 -65
  271. package/dist/modules/key_store.js.map +1 -1
  272. package/dist/modules/launcher/bot_supervisor.d.ts +1 -1
  273. package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
  274. package/dist/modules/launcher/bot_supervisor.js +89 -118
  275. package/dist/modules/launcher/bot_supervisor.js.map +1 -1
  276. package/dist/modules/launcher/child_env.js +1 -5
  277. package/dist/modules/launcher/child_env.js.map +1 -1
  278. package/dist/modules/launcher/credential_bootstrap.js +22 -31
  279. package/dist/modules/launcher/credential_bootstrap.js.map +1 -1
  280. package/dist/modules/launcher/credential_daemon.js +37 -75
  281. package/dist/modules/launcher/credential_daemon.js.map +1 -1
  282. package/dist/modules/launcher/credential_secret.js +2 -37
  283. package/dist/modules/launcher/credential_secret.js.map +1 -1
  284. package/dist/modules/launcher/foreign_cred_daemon.js +25 -31
  285. package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
  286. package/dist/modules/launcher/headless_password.js +10 -12
  287. package/dist/modules/launcher/headless_password.js.map +1 -1
  288. package/dist/modules/launcher/launch_modes.js +3 -9
  289. package/dist/modules/launcher/launch_modes.js.map +1 -1
  290. package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -1
  291. package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
  292. package/dist/modules/launcher/market_adapter_runtime.js +25 -35
  293. package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
  294. package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
  295. package/dist/modules/launcher/market_adapter_watchdog.js +42 -45
  296. package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
  297. package/dist/modules/launcher/monolithic_runtime.d.ts +3 -2
  298. package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
  299. package/dist/modules/launcher/monolithic_runtime.js +97 -138
  300. package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
  301. package/dist/modules/launcher/runtime_entry.d.ts +1 -11
  302. package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
  303. package/dist/modules/launcher/runtime_entry.js +12 -15
  304. package/dist/modules/launcher/runtime_entry.js.map +1 -1
  305. package/dist/modules/launcher/status_reporting.d.ts +1 -1
  306. package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
  307. package/dist/modules/launcher/status_reporting.js +15 -36
  308. package/dist/modules/launcher/status_reporting.js.map +1 -1
  309. package/dist/modules/launcher/supervisor_control.js +4 -9
  310. package/dist/modules/launcher/supervisor_control.js.map +1 -1
  311. package/dist/modules/logger.d.ts +1 -1
  312. package/dist/modules/logger.d.ts.map +1 -1
  313. package/dist/modules/logger.js +3 -38
  314. package/dist/modules/logger.js.map +1 -1
  315. package/dist/modules/market_adapter_whitelist.js +9 -18
  316. package/dist/modules/market_adapter_whitelist.js.map +1 -1
  317. package/dist/modules/node_failure_ledger.js +1 -3
  318. package/dist/modules/node_failure_ledger.js.map +1 -1
  319. package/dist/modules/node_health_cache.d.ts.map +1 -1
  320. package/dist/modules/node_health_cache.js +15 -25
  321. package/dist/modules/node_health_cache.js.map +1 -1
  322. package/dist/modules/node_manager.d.ts +1 -1
  323. package/dist/modules/node_manager.d.ts.map +1 -1
  324. package/dist/modules/node_manager.js +44 -43
  325. package/dist/modules/node_manager.js.map +1 -1
  326. package/dist/modules/order/accounting.d.ts.map +1 -1
  327. package/dist/modules/order/accounting.js +102 -118
  328. package/dist/modules/order/accounting.js.map +1 -1
  329. package/dist/modules/order/async_lock.d.ts +3 -15
  330. package/dist/modules/order/async_lock.d.ts.map +1 -1
  331. package/dist/modules/order/async_lock.js +6 -26
  332. package/dist/modules/order/async_lock.js.map +1 -1
  333. package/dist/modules/order/export.js +34 -75
  334. package/dist/modules/order/export.js.map +1 -1
  335. package/dist/modules/order/format.d.ts +1 -3
  336. package/dist/modules/order/format.d.ts.map +1 -1
  337. package/dist/modules/order/format.js +4 -24
  338. package/dist/modules/order/format.js.map +1 -1
  339. package/dist/modules/order/grid.d.ts +8 -8
  340. package/dist/modules/order/grid.d.ts.map +1 -1
  341. package/dist/modules/order/grid.js +254 -266
  342. package/dist/modules/order/grid.js.map +1 -1
  343. package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
  344. package/dist/modules/order/grid_reconcile.js +77 -94
  345. package/dist/modules/order/grid_reconcile.js.map +1 -1
  346. package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
  347. package/dist/modules/order/grid_reconcile_internal.js +117 -149
  348. package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
  349. package/dist/modules/order/index.d.ts.map +1 -1
  350. package/dist/modules/order/index.js +11 -45
  351. package/dist/modules/order/index.js.map +1 -1
  352. package/dist/modules/order/logger.d.ts +0 -8
  353. package/dist/modules/order/logger.d.ts.map +1 -1
  354. package/dist/modules/order/logger.js +28 -141
  355. package/dist/modules/order/logger.js.map +1 -1
  356. package/dist/modules/order/logger_state.d.ts.map +1 -1
  357. package/dist/modules/order/logger_state.js +3 -4
  358. package/dist/modules/order/logger_state.js.map +1 -1
  359. package/dist/modules/order/manager.d.ts +10 -79
  360. package/dist/modules/order/manager.d.ts.map +1 -1
  361. package/dist/modules/order/manager.js +131 -247
  362. package/dist/modules/order/manager.js.map +1 -1
  363. package/dist/modules/order/processed_fill_store.js +2 -7
  364. package/dist/modules/order/processed_fill_store.js.map +1 -1
  365. package/dist/modules/order/strategy.js +23 -25
  366. package/dist/modules/order/strategy.js.map +1 -1
  367. package/dist/modules/order/sync_engine.d.ts +27 -0
  368. package/dist/modules/order/sync_engine.d.ts.map +1 -1
  369. package/dist/modules/order/sync_engine.js +232 -181
  370. package/dist/modules/order/sync_engine.js.map +1 -1
  371. package/dist/modules/order/utils/math.d.ts +1 -25
  372. package/dist/modules/order/utils/math.d.ts.map +1 -1
  373. package/dist/modules/order/utils/math.js +49 -172
  374. package/dist/modules/order/utils/math.js.map +1 -1
  375. package/dist/modules/order/utils/order.d.ts +46 -2
  376. package/dist/modules/order/utils/order.d.ts.map +1 -1
  377. package/dist/modules/order/utils/order.js +165 -143
  378. package/dist/modules/order/utils/order.js.map +1 -1
  379. package/dist/modules/order/utils/system.d.ts +3 -1
  380. package/dist/modules/order/utils/system.d.ts.map +1 -1
  381. package/dist/modules/order/utils/system.js +152 -211
  382. package/dist/modules/order/utils/system.js.map +1 -1
  383. package/dist/modules/order/utils/timeout.js +1 -4
  384. package/dist/modules/order/utils/timeout.js.map +1 -1
  385. package/dist/modules/order/utils/validate.js +91 -142
  386. package/dist/modules/order/utils/validate.js.map +1 -1
  387. package/dist/modules/order/utils/withPoolRef.js +21 -61
  388. package/dist/modules/order/utils/withPoolRef.js.map +1 -1
  389. package/dist/modules/order/working_grid.js +6 -9
  390. package/dist/modules/order/working_grid.js.map +1 -1
  391. package/dist/modules/path_api.d.ts.map +1 -1
  392. package/dist/modules/path_api.js +8 -11
  393. package/dist/modules/path_api.js.map +1 -1
  394. package/dist/modules/paths.d.ts.map +1 -1
  395. package/dist/modules/paths.js +61 -67
  396. package/dist/modules/paths.js.map +1 -1
  397. package/dist/modules/process_discovery.d.ts.map +1 -1
  398. package/dist/modules/process_discovery.js +14 -23
  399. package/dist/modules/process_discovery.js.map +1 -1
  400. package/dist/modules/runtime.js +7 -11
  401. package/dist/modules/runtime.js.map +1 -1
  402. package/dist/modules/runtime_settings.d.ts.map +1 -1
  403. package/dist/modules/runtime_settings.js +14 -16
  404. package/dist/modules/runtime_settings.js.map +1 -1
  405. package/dist/modules/settings_merge.js +1 -3
  406. package/dist/modules/settings_merge.js.map +1 -1
  407. package/dist/modules/socket_json_client.js +3 -5
  408. package/dist/modules/socket_json_client.js.map +1 -1
  409. package/dist/modules/storage/browser_adapter.js +1 -4
  410. package/dist/modules/storage/browser_adapter.js.map +1 -1
  411. package/dist/modules/storage/index.d.ts +3 -2
  412. package/dist/modules/storage/index.d.ts.map +1 -1
  413. package/dist/modules/storage/index.js +5 -8
  414. package/dist/modules/storage/index.js.map +1 -1
  415. package/dist/modules/storage/node_adapter.d.ts +3 -4
  416. package/dist/modules/storage/node_adapter.d.ts.map +1 -1
  417. package/dist/modules/storage/node_adapter.js +12 -16
  418. package/dist/modules/storage/node_adapter.js.map +1 -1
  419. package/dist/modules/storage/types.js +1 -2
  420. package/dist/modules/types.d.ts +0 -6
  421. package/dist/modules/types.d.ts.map +1 -1
  422. package/dist/modules/types.js +1 -2
  423. package/dist/modules/types.js.map +1 -1
  424. package/dist/modules/utils/base58check.js +8 -15
  425. package/dist/modules/utils/base58check.js.map +1 -1
  426. package/dist/modules/utils/build_dir.js +3 -7
  427. package/dist/modules/utils/build_dir.js.map +1 -1
  428. package/dist/modules/utils/errors.js +1 -5
  429. package/dist/modules/utils/errors.js.map +1 -1
  430. package/dist/modules/utils/math_utils.d.ts +1 -1
  431. package/dist/modules/utils/math_utils.d.ts.map +1 -1
  432. package/dist/modules/utils/math_utils.js +2 -7
  433. package/dist/modules/utils/math_utils.js.map +1 -1
  434. package/dist/modules/validate_profiles.d.ts.map +1 -1
  435. package/dist/modules/validate_profiles.js +18 -25
  436. package/dist/modules/validate_profiles.js.map +1 -1
  437. package/dist/pm2.d.ts +4 -70
  438. package/dist/pm2.d.ts.map +1 -1
  439. package/dist/pm2.js +106 -132
  440. package/dist/pm2.js.map +1 -1
  441. package/dist/scripts/analyze-git.js +13 -17
  442. package/dist/scripts/analyze-git.js.map +1 -1
  443. package/dist/scripts/analyze-orders.d.ts.map +1 -1
  444. package/dist/scripts/analyze-orders.js +48 -63
  445. package/dist/scripts/analyze-orders.js.map +1 -1
  446. package/dist/scripts/diagnose-kibana-candles.d.ts.map +1 -1
  447. package/dist/scripts/diagnose-kibana-candles.js +2 -1
  448. package/dist/scripts/diagnose-kibana-candles.js.map +1 -1
  449. package/dist/scripts/diagnose-pool-history.d.ts.map +1 -1
  450. package/dist/scripts/diagnose-pool-history.js +2 -1
  451. package/dist/scripts/diagnose-pool-history.js.map +1 -1
  452. package/dist/scripts/divergence-calc.d.ts.map +1 -1
  453. package/dist/scripts/divergence-calc.js +2 -2
  454. package/dist/scripts/divergence-calc.js.map +1 -1
  455. package/dist/scripts/fix-err-message.js +17 -22
  456. package/dist/scripts/fix-err-message.js.map +1 -1
  457. package/dist/scripts/generate_lp_chart.d.ts.map +1 -1
  458. package/dist/scripts/generate_lp_chart.js +7 -15
  459. package/dist/scripts/generate_lp_chart.js.map +1 -1
  460. package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +1 -1
  461. package/dist/scripts/generate_mainnet_corpus_report.js +3 -2
  462. package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -1
  463. package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
  464. package/dist/scripts/generate_market_adapter_whitelist.js +18 -24
  465. package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
  466. package/dist/scripts/native_release_gates.js +15 -19
  467. package/dist/scripts/native_release_gates.js.map +1 -1
  468. package/dist/scripts/print_grid.d.ts.map +1 -1
  469. package/dist/scripts/print_grid.js +2 -2
  470. package/dist/scripts/print_grid.js.map +1 -1
  471. package/dist/scripts/run-tests.js +12 -17
  472. package/dist/scripts/run-tests.js.map +1 -1
  473. package/dist/scripts/runner.d.ts.map +1 -1
  474. package/dist/scripts/runner.js +18 -20
  475. package/dist/scripts/runner.js.map +1 -1
  476. package/dist/scripts/sync-version.js +2 -2
  477. package/dist/scripts/sync-version.js.map +1 -1
  478. package/dist/scripts/test-credit-renewal.d.ts.map +1 -1
  479. package/dist/scripts/test-credit-renewal.js +4 -3
  480. package/dist/scripts/test-credit-renewal.js.map +1 -1
  481. package/dist/scripts/update.js +93 -95
  482. package/dist/scripts/update.js.map +1 -1
  483. package/dist/scripts/validate_bots.d.ts.map +1 -1
  484. package/dist/scripts/validate_bots.js +2 -2
  485. package/dist/scripts/validate_bots.js.map +1 -1
  486. package/dist/scripts/verify-browser-bundle.js +12 -17
  487. package/dist/scripts/verify-browser-bundle.js.map +1 -1
  488. package/dist/unlock.d.ts +0 -30
  489. package/dist/unlock.d.ts.map +1 -1
  490. package/dist/unlock.js +258 -222
  491. package/dist/unlock.js.map +1 -1
  492. package/package.json +5 -8
  493. package/scripts/README.md +1 -1
  494. package/scripts/create-bot-symlinks.sh +2 -2
  495. package/dist/modules/utils/fs_utils.d.ts +0 -18
  496. package/dist/modules/utils/fs_utils.d.ts.map +0 -1
  497. package/dist/modules/utils/fs_utils.js +0 -32
  498. package/dist/modules/utils/fs_utils.js.map +0 -1
  499. package/dist/scripts/migrate_bot_keys.d.ts +0 -3
  500. package/dist/scripts/migrate_bot_keys.d.ts.map +0 -1
  501. package/dist/scripts/migrate_bot_keys.js +0 -225
  502. package/dist/scripts/migrate_bot_keys.js.map +0 -1
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * modules/dexbot_class.ts - DEXBot Core Engine
4
3
  *
@@ -53,60 +52,25 @@
53
52
  *
54
53
  * ===============================================================================
55
54
  */
56
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
57
- if (k2 === undefined) k2 = k;
58
- var desc = Object.getOwnPropertyDescriptor(m, k);
59
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
60
- desc = { enumerable: true, get: function() { return m[k]; } };
61
- }
62
- Object.defineProperty(o, k2, desc);
63
- }) : (function(o, m, k, k2) {
64
- if (k2 === undefined) k2 = k;
65
- o[k2] = m[k];
66
- }));
67
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
68
- Object.defineProperty(o, "default", { enumerable: true, value: v });
69
- }) : function(o, v) {
70
- o["default"] = v;
71
- });
72
- var __importStar = (this && this.__importStar) || (function () {
73
- var ownKeys = function(o) {
74
- ownKeys = Object.getOwnPropertyNames || function (o) {
75
- var ar = [];
76
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
77
- return ar;
78
- };
79
- return ownKeys(o);
80
- };
81
- return function (mod) {
82
- if (mod && mod.__esModule) return mod;
83
- var result = {};
84
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
85
- __setModuleDefault(result, mod);
86
- return result;
87
- };
88
- })();
89
- var __importDefault = (this && this.__importDefault) || function (mod) {
90
- return (mod && mod.__esModule) ? mod : { "default": mod };
91
- };
92
- Object.defineProperty(exports, "__esModule", { value: true });
93
- const client = __importStar(require("./bitshares_client"));
55
+ import { createRequire } from 'node:module';
56
+ const require = createRequire(import.meta.url);
57
+ import * as client from './bitshares_client.js';
94
58
  const { BitShares } = client;
95
- const chainKeys = __importStar(require("./chain_keys"));
96
- const chainOrders = __importStar(require("./chain_orders"));
97
- const fundRegistry = __importStar(require("./fund_registry"));
98
- const DexbotFillRuntime = __importStar(require("./dexbot_fill_runtime"));
99
- const dexbot_maintenance_runtime_1 = __importDefault(require("./dexbot_maintenance_runtime"));
100
- const DexbotStateRecovery = __importStar(require("./dexbot_state_recovery"));
101
- const DexbotStartupRuntime = __importStar(require("./dexbot_startup_runtime"));
102
- const credit_runtime_1 = __importDefault(require("./credit_runtime"));
103
- const paths_1 = require("./paths");
104
- const Format = __importStar(require("./order/format"));
105
- const dexbot_cow_runtime_1 = __importDefault(require("./dexbot_cow_runtime"));
106
- const processed_fill_store_1 = require("./order/processed_fill_store");
107
- const constants_1 = require("./constants");
108
- const bot_settings_1 = require("./bot_settings");
109
- const errors_1 = require("./utils/errors");
59
+ import * as chainKeys from './chain_keys.js';
60
+ import * as chainOrders from './chain_orders.js';
61
+ import * as fundRegistry from './fund_registry.js';
62
+ import * as DexbotFillRuntime from './dexbot_fill_runtime.js';
63
+ import DexbotMaintenanceRuntime from './dexbot_maintenance_runtime.js';
64
+ import * as DexbotStateRecovery from './dexbot_state_recovery.js';
65
+ import * as DexbotStartupRuntime from './dexbot_startup_runtime.js';
66
+ import CreditRuntime from './credit_runtime.js';
67
+ import { PATHS } from './paths.js';
68
+ import * as Format from './order/format.js';
69
+ import cowRuntime from './dexbot_cow_runtime.js';
70
+ import { ProcessedFillStore, PROCESSED_FILL_PERSISTENCE_MODES } from './order/processed_fill_store.js';
71
+ import { TIMING, FILL_PROCESSING, DAEMON_CODES, } from './constants.js';
72
+ import { normalizeBotEntry } from './bot_settings.js';
73
+ import { getErrorMessage } from './utils/errors.js';
110
74
  function waitForConnected(...args) { return require('./bitshares_client').waitForConnected(...args); }
111
75
  function getKeyStore(...args) { return require('./key_store').getKeyStore(...args); }
112
76
  function hasExecutableActions(...args) { return require('./order/utils/validate').hasExecutableActions(...args); }
@@ -201,9 +165,9 @@ class DEXBot {
201
165
  this.config.logging = rs.logging;
202
166
  this._fillDedupeWindowMs = this.config.timing.FILL_DEDUPE_WINDOW_MS;
203
167
  this._fillRecordRetentionMs = this.config.timing.FILL_RECORD_RETENTION_MS;
204
- this._processedFillPersistBatchMs = constants_1.TIMING.PROCESSED_FILL_PERSIST_BATCH_MS;
205
- this._processedFillPersistBatchSize = constants_1.TIMING.PROCESSED_FILL_PERSIST_BATCH_SIZE;
206
- this._processedFillStore = new processed_fill_store_1.ProcessedFillStore({
168
+ this._processedFillPersistBatchMs = TIMING.PROCESSED_FILL_PERSIST_BATCH_MS;
169
+ this._processedFillPersistBatchSize = TIMING.PROCESSED_FILL_PERSIST_BATCH_SIZE;
170
+ this._processedFillStore = new ProcessedFillStore({
207
171
  batchMs: this._processedFillPersistBatchMs,
208
172
  batchSize: this._processedFillPersistBatchSize,
209
173
  warn: (message) => this._warn(message)
@@ -367,7 +331,7 @@ class DEXBot {
367
331
  * @returns {{incomingFillQueueLength: number, shadowLocks: number, batchInFlight: boolean, recoveryInFlight: boolean, broadcasting: boolean}}
368
332
  */
369
333
  _getPipelineSignals() {
370
- return dexbot_maintenance_runtime_1.default.getPipelineSignals(this);
334
+ return DexbotMaintenanceRuntime.getPipelineSignals(this);
371
335
  }
372
336
  /**
373
337
  * Mark that grid activity occurred (updates idle timer).
@@ -375,7 +339,7 @@ class DEXBot {
375
339
  * @returns {void}
376
340
  */
377
341
  _markGridActivity(reason = 'activity') {
378
- return dexbot_maintenance_runtime_1.default.markGridActivity(this, reason);
342
+ return DexbotMaintenanceRuntime.markGridActivity(this, reason);
379
343
  }
380
344
  /**
381
345
  * Trigger a full state recovery sync (fetch chain + sync from open orders + persist).
@@ -544,7 +508,7 @@ class DEXBot {
544
508
  /**
545
509
  * Apply replay-safe fill accounting using a provided fill key.
546
510
  * @param {Object} fill - Fill event object
547
- * @param {import('./types').FillOperationData} fillOp - Fill operation data
511
+ * @param {import('./types.js').FillOperationData} fillOp - Fill operation data
548
512
  * @param {Object} [options={}] - Options
549
513
  * @param {string} [options.missingKeyMessage]
550
514
  * @param {string} [options.fallbackKeyMessage]
@@ -556,9 +520,9 @@ class DEXBot {
556
520
  * @param {string} [options.replayLevel='debug']
557
521
  * @param {string} [options.persistenceMode='immediate']
558
522
  * @param {boolean} [options.allowOrphanFallbackKey=false]
559
- * @returns {Promise<import('./types').ReplaySafeFillResult>}
523
+ * @returns {Promise<import('./types.js').ReplaySafeFillResult>}
560
524
  */
561
- async _applyReplaySafeFillAccounting(fill, fillOp, { missingKeyMessage, fallbackKeyMessage, replayMessage, errorMessage, logger = this.manager?.logger, missingKeyLevel = 'warn', fallbackKeyLevel = 'warn', replayLevel = 'debug', persistenceMode = processed_fill_store_1.PROCESSED_FILL_PERSISTENCE_MODES.IMMEDIATE, allowOrphanFallbackKey = false } = {}) {
525
+ async _applyReplaySafeFillAccounting(fill, fillOp, { missingKeyMessage, fallbackKeyMessage, replayMessage, errorMessage, logger = this.manager?.logger, missingKeyLevel = 'warn', fallbackKeyLevel = 'warn', replayLevel = 'debug', persistenceMode = PROCESSED_FILL_PERSISTENCE_MODES.IMMEDIATE, allowOrphanFallbackKey = false } = {}) {
562
526
  return DexbotFillRuntime.applyReplaySafeFillAccounting(this, fill, fillOp, {
563
527
  missingKeyMessage,
564
528
  fallbackKeyMessage,
@@ -575,15 +539,15 @@ class DEXBot {
575
539
  /**
576
540
  * Apply replay-safe fill accounting for tracked fills (those with a valid grid order).
577
541
  * @param {Object} fill - Fill event object
578
- * @param {import('./types').FillOperationData} fillOp - Fill operation data
542
+ * @param {import('./types.js').FillOperationData} fillOp - Fill operation data
579
543
  * @param {Object} [options={}]
580
544
  * @param {string} [options.context]
581
545
  * @param {Object} [options.logger]
582
546
  * @param {string} [options.replayMessage]
583
547
  * @param {string} [options.persistenceMode='batched']
584
- * @returns {Promise<import('./types').ReplaySafeFillResult>}
548
+ * @returns {Promise<import('./types.js').ReplaySafeFillResult>}
585
549
  */
586
- async _applyReplaySafeTrackedFillAccounting(fill, fillOp, { context, logger = this.manager?.logger, replayMessage, persistenceMode = processed_fill_store_1.PROCESSED_FILL_PERSISTENCE_MODES.BATCHED } = {}) {
550
+ async _applyReplaySafeTrackedFillAccounting(fill, fillOp, { context, logger = this.manager?.logger, replayMessage, persistenceMode = PROCESSED_FILL_PERSISTENCE_MODES.BATCHED } = {}) {
587
551
  return DexbotFillRuntime.applyReplaySafeTrackedFillAccounting(this, fill, fillOp, {
588
552
  context,
589
553
  logger,
@@ -594,15 +558,15 @@ class DEXBot {
594
558
  /**
595
559
  * Apply replay-safe fill accounting for orphan fills (grid order not found).
596
560
  * @param {Object} fill - Fill event object
597
- * @param {import('./types').FillOperationData} fillOp - Fill operation data
561
+ * @param {import('./types.js').FillOperationData} fillOp - Fill operation data
598
562
  * @param {Object} [options={}]
599
563
  * @param {string} [options.context]
600
564
  * @param {Object} [options.logger]
601
565
  * @param {string} [options.replayMessage]
602
566
  * @param {string} [options.persistenceMode='batched']
603
- * @returns {Promise<import('./types').ReplaySafeFillResult>}
567
+ * @returns {Promise<import('./types.js').ReplaySafeFillResult>}
604
568
  */
605
- async _applyReplaySafeOrphanFillAccounting(fill, fillOp, { context, logger = this.manager?.logger, replayMessage, persistenceMode = processed_fill_store_1.PROCESSED_FILL_PERSISTENCE_MODES.BATCHED } = {}) {
569
+ async _applyReplaySafeOrphanFillAccounting(fill, fillOp, { context, logger = this.manager?.logger, replayMessage, persistenceMode = PROCESSED_FILL_PERSISTENCE_MODES.BATCHED } = {}) {
606
570
  return DexbotFillRuntime.applyReplaySafeOrphanFillAccounting(this, fill, fillOp, {
607
571
  context,
608
572
  logger,
@@ -613,10 +577,10 @@ class DEXBot {
613
577
  /**
614
578
  * Refresh dynamic weight distribution from market adapter.
615
579
  * @param {string} [context='runtime'] - Context label for logging
616
- * @returns {import('./types').DynamicWeightRefreshResult|null}
580
+ * @returns {import('./types.js').DynamicWeightRefreshResult|null}
617
581
  */
618
582
  _refreshDynamicWeightDistribution(context = 'runtime') {
619
- return dexbot_maintenance_runtime_1.default.refreshDynamicWeightDistribution(this, context);
583
+ return DexbotMaintenanceRuntime.refreshDynamicWeightDistribution(this, context);
620
584
  }
621
585
  /**
622
586
  * Finalize the bot startup after account and initial grid sync are complete.
@@ -644,7 +608,7 @@ class DEXBot {
644
608
  * @returns {Promise<{syncResult: Object|null, aborted: boolean, hasUnmatched: number, openOrders: Array|null}>}
645
609
  */
646
610
  async _syncOpenOrdersAndProcessFills(tag) {
647
- return dexbot_maintenance_runtime_1.default.syncOpenOrdersAndProcessFills(this, tag);
611
+ return DexbotMaintenanceRuntime.syncOpenOrdersAndProcessFills(this, tag);
648
612
  }
649
613
  _maxConsecutiveFillConsumerFailures() {
650
614
  return DexbotFillRuntime.maxConsecutiveFillConsumerFailures(this);
@@ -724,7 +688,7 @@ class DEXBot {
724
688
  * @throws {Error} If initialization fails or preferredAccount is missing.
725
689
  */
726
690
  async initialize(vaultSecret = null) {
727
- await waitForConnected(constants_1.TIMING.CONNECTION_TIMEOUT_MS);
691
+ await waitForConnected(TIMING.CONNECTION_TIMEOUT_MS);
728
692
  if (this.config && this.config.preferredAccount) {
729
693
  try {
730
694
  let privateKey = null;
@@ -734,7 +698,7 @@ class DEXBot {
734
698
  catch (err) {
735
699
  if (vaultSecret)
736
700
  throw err;
737
- this._warn(`Credential daemon probe failed: ${(0, errors_1.getErrorMessage)(err)}. Falling back to interactive authentication.`);
701
+ this._warn(`Credential daemon probe failed: ${getErrorMessage(err)}. Falling back to interactive authentication.`);
738
702
  }
739
703
  if (!privateKey) {
740
704
  const unlockSecret = await chainKeys.authenticate();
@@ -747,7 +711,7 @@ class DEXBot {
747
711
  if (chainKeys.isMasterPasswordFailure(err)) {
748
712
  throw err;
749
713
  }
750
- this._warn(`Auto-selection of preferredAccount failed: ${(0, errors_1.getErrorMessage)(err)}`);
714
+ this._warn(`Auto-selection of preferredAccount failed: ${getErrorMessage(err)}`);
751
715
  // dexbot.ts has fallback to selectAccount, bot.ts throws
752
716
  if (typeof chainOrders.selectAccount === 'function') {
753
717
  const accountData = await chainOrders.selectAccount();
@@ -776,7 +740,7 @@ class DEXBot {
776
740
  * @returns {Array<Array<Object>>} Grouped order arrays
777
741
  */
778
742
  _buildOutsideInPairGroupsForOrders(orders) {
779
- return dexbot_cow_runtime_1.default.buildOutsideInPairGroupsForOrders(orders);
743
+ return cowRuntime.buildOutsideInPairGroupsForOrders(orders);
780
744
  }
781
745
  /**
782
746
  * Build outside-in pair groups for create entry contexts.
@@ -784,14 +748,14 @@ class DEXBot {
784
748
  * @returns {Array<Array<Object>>} Grouped entry arrays
785
749
  */
786
750
  _buildOutsideInPairGroupsForCreateEntries(createEntries) {
787
- return dexbot_cow_runtime_1.default.buildOutsideInPairGroupsForCreateEntries(createEntries);
751
+ return cowRuntime.buildOutsideInPairGroupsForCreateEntries(createEntries);
788
752
  }
789
753
  /**
790
754
  * Resolve the centralized fill batch cap.
791
755
  * @returns {number} Positive maximum number of fill-driven rotations per broadcast cycle
792
756
  */
793
757
  _getMaxFillBatchSize() {
794
- return Math.max(1, this.config.fillProcessing?.MAX_FILL_BATCH_SIZE ?? constants_1.FILL_PROCESSING.MAX_FILL_BATCH_SIZE);
758
+ return Math.max(1, this.config.fillProcessing?.MAX_FILL_BATCH_SIZE ?? FILL_PROCESSING.MAX_FILL_BATCH_SIZE);
795
759
  }
796
760
  /**
797
761
  * Extract operation results from a batch transaction result.
@@ -800,7 +764,7 @@ class DEXBot {
800
764
  * @returns {Array} Array of operation result entries
801
765
  */
802
766
  _extractOperationResults(result, warnContext = '') {
803
- return dexbot_cow_runtime_1.default.extractOperationResults(result, warnContext, this.manager?.logger?.log?.bind(this.manager?.logger));
767
+ return cowRuntime.extractOperationResults(result, warnContext, this.manager?.logger?.log?.bind(this.manager?.logger));
804
768
  }
805
769
  /**
806
770
  * Find CREATE operation contexts whose broadcast result did not include a chain order id.
@@ -810,7 +774,7 @@ class DEXBot {
810
774
  * @returns {Array<{index:number, ctx:Object}>} Missing create result contexts.
811
775
  */
812
776
  _findMissingCreateResultContexts(operationResults, opContexts) {
813
- return dexbot_cow_runtime_1.default.findMissingCreateResultContexts(operationResults, opContexts);
777
+ return cowRuntime.findMissingCreateResultContexts(operationResults, opContexts);
814
778
  }
815
779
  /**
816
780
  * Run an immediate chain sync after a successful CREATE broadcast returned incomplete ids.
@@ -824,7 +788,7 @@ class DEXBot {
824
788
  * @returns {Promise<void>}
825
789
  */
826
790
  async _recoverAfterMissingCreateResults(reason = 'missing create operation results') {
827
- return dexbot_cow_runtime_1.default.recoverAfterMissingCreateResults(this, reason);
791
+ return cowRuntime.recoverAfterMissingCreateResults(this, reason);
828
792
  }
829
793
  /**
830
794
  * Restore unresolved missing-create blockers after recovery if sync did not adopt them.
@@ -834,7 +798,7 @@ class DEXBot {
834
798
  * @returns {void}
835
799
  */
836
800
  _preserveMissingCreateBlockersAfterRecovery(blockers, recoveryResult) {
837
- return dexbot_cow_runtime_1.default.preserveMissingCreateBlockersAfterRecovery(this, blockers, recoveryResult);
801
+ return cowRuntime.preserveMissingCreateBlockersAfterRecovery(this, blockers, recoveryResult);
838
802
  }
839
803
  /**
840
804
  * Merge missing CREATE result contexts into manager._lastUnmatchedChainOrders.
@@ -848,7 +812,7 @@ class DEXBot {
848
812
  * @returns {void}
849
813
  */
850
814
  _markMissingCreateResultsAsStructuralBlocker(missingCreateResults) {
851
- return dexbot_cow_runtime_1.default.markMissingCreateResultsAsStructuralBlocker(this, missingCreateResults);
815
+ return cowRuntime.markMissingCreateResultsAsStructuralBlocker(this, missingCreateResults);
852
816
  }
853
817
  /**
854
818
  * Format an unmatched chain order/blocker for COW logs.
@@ -857,7 +821,7 @@ class DEXBot {
857
821
  * @returns {string} Compact human-readable diagnostic.
858
822
  */
859
823
  _formatUnmatchedChainOrderForLog(order) {
860
- return dexbot_cow_runtime_1.default.formatUnmatchedChainOrderForLog(order);
824
+ return cowRuntime.formatUnmatchedChainOrderForLog(order);
861
825
  }
862
826
  /**
863
827
  * Record a pending CREATE broadcast on the manager.
@@ -880,7 +844,7 @@ class DEXBot {
880
844
  * @returns {void}
881
845
  */
882
846
  _recordPendingBroadcast(entry) {
883
- return dexbot_cow_runtime_1.default.recordPendingBroadcast(this, entry);
847
+ return cowRuntime.recordPendingBroadcast(this, entry);
884
848
  }
885
849
  /**
886
850
  * Clear the pending-broadcast cache.
@@ -891,7 +855,7 @@ class DEXBot {
891
855
  * _reconcileAfterUncertainBroadcast before calling this).
892
856
  */
893
857
  _clearPendingBroadcasts() {
894
- return dexbot_cow_runtime_1.default.clearPendingBroadcasts(this.manager?._pendingBroadcasts);
858
+ return cowRuntime.clearPendingBroadcasts(this.manager?._pendingBroadcasts);
895
859
  }
896
860
  /**
897
861
  * Build a fingerprint for an on-chain order so it can be matched against
@@ -902,7 +866,7 @@ class DEXBot {
902
866
  * @returns {string|null} Fingerprint or null on bad input
903
867
  */
904
868
  _buildChainOrderFingerprint(chainOrder, slotId) {
905
- return dexbot_cow_runtime_1.default.buildChainOrderFingerprint(this, chainOrder, slotId);
869
+ return cowRuntime.buildChainOrderFingerprint(this, chainOrder, slotId);
906
870
  }
907
871
  /**
908
872
  * Normalize raw BitShares limit_order_object data into the integer tuple
@@ -916,7 +880,7 @@ class DEXBot {
916
880
  * @returns {{side: string, assetA: string, assetB: string, sellInt: number, receiveInt: number}|null}
917
881
  */
918
882
  _normalizeChainOrderForPendingMatch(chainOrder) {
919
- return dexbot_cow_runtime_1.default.normalizeChainOrderForPendingMatch(this, chainOrder);
883
+ return cowRuntime.normalizeChainOrderForPendingMatch(this, chainOrder);
920
884
  }
921
885
  /**
922
886
  * Find a chain order that matches a planned slot using price+size proximity.
@@ -934,7 +898,7 @@ class DEXBot {
934
898
  * @returns {Object|null} Matching chain order, or null
935
899
  */
936
900
  _findChainOrderForSlot(chainOrders, slotId, planned) {
937
- return dexbot_cow_runtime_1.default.findChainOrderForSlot(this, chainOrders, slotId, planned);
901
+ return cowRuntime.findChainOrderForSlot(this, chainOrders, slotId, planned);
938
902
  }
939
903
  /**
940
904
  * Reconcile a broadcast whose chain state is unknown.
@@ -963,10 +927,10 @@ class DEXBot {
963
927
  * @returns {Promise<Object>} Result object compatible with batch return shape
964
928
  */
965
929
  async _reconcileAfterUncertainBroadcast(err, opContexts, options = {}) {
966
- return dexbot_cow_runtime_1.default.reconcileAfterUncertainBroadcast(this, err, opContexts, options);
930
+ return cowRuntime.reconcileAfterUncertainBroadcast(this, err, opContexts, options);
967
931
  }
968
932
  async _reconcileAfterUncertainBroadcastImpl(err, opContexts, options) {
969
- return dexbot_cow_runtime_1.default.reconcileAfterUncertainBroadcastImpl(this, err, opContexts, options);
933
+ return cowRuntime.reconcileAfterUncertainBroadcastImpl(this, err, opContexts, options);
970
934
  }
971
935
  /**
972
936
  * Auto-cancel a price-drift orphan from the unmatched-order snapshot.
@@ -994,7 +958,7 @@ class DEXBot {
994
958
  * @returns {Promise<{cancelled: boolean, orderId?: string, reason?: string}>}
995
959
  */
996
960
  async _autoCancelOneUnmatchedOrphan() {
997
- return dexbot_cow_runtime_1.default.autoCancelOneUnmatchedOrphan(this);
961
+ return cowRuntime.autoCancelOneUnmatchedOrphan(this);
998
962
  }
999
963
  // Pair mode applies only when create contexts include both BUY and SELL.
1000
964
  // Single-side create batches intentionally remain a single executeBatch.
@@ -1004,7 +968,7 @@ class DEXBot {
1004
968
  * @returns {boolean} True if pair mode should be used
1005
969
  */
1006
970
  _shouldExecuteCreatePairMode(opContexts) {
1007
- return dexbot_cow_runtime_1.default.shouldExecuteCreatePairMode(this, opContexts);
971
+ return cowRuntime.shouldExecuteCreatePairMode(this, opContexts);
1008
972
  }
1009
973
  /**
1010
974
  * Execute operations with retry on BroadcastUncertainError.
@@ -1020,16 +984,16 @@ class DEXBot {
1020
984
  * the full operations array would duplicate those creates on chain.
1021
985
  */
1022
986
  async _executeWithRetryOnUncertain(operations, opContexts) {
1023
- return dexbot_cow_runtime_1.default.executeWithRetryOnUncertain(this, operations, opContexts);
987
+ return cowRuntime.executeWithRetryOnUncertain(this, operations, opContexts);
1024
988
  }
1025
989
  /**
1026
990
  * Execute blockchain operations with appropriate strategy (single batch or pair mode).
1027
- * @param {Array<import('./types').CreatedOperation>} operations - Array of operation objects
991
+ * @param {Array<import('./types.js').CreatedOperation>} operations - Array of operation objects
1028
992
  * @param {Array<Object>} opContexts - Array of operation context metadata (1:1 with operations)
1029
993
  * @returns {Promise<{result: Object, opContexts: Array}>} Execution result with contexts
1030
994
  */
1031
995
  async _executeOperationsWithStrategy(operations, opContexts) {
1032
- return dexbot_cow_runtime_1.default.executeOperationsWithStrategy(this, operations, opContexts);
996
+ return cowRuntime.executeOperationsWithStrategy(this, operations, opContexts);
1033
997
  }
1034
998
  /**
1035
999
  * Validate that operations can be executed with available funds before broadcasting.
@@ -1041,7 +1005,7 @@ class DEXBot {
1041
1005
  * @private
1042
1006
  */
1043
1007
  _validateOperationFunds(operations, assetA, assetB) {
1044
- return dexbot_cow_runtime_1.default.validateOperationFunds(this, operations, assetA, assetB);
1008
+ return cowRuntime.validateOperationFunds(this, operations, assetA, assetB);
1045
1009
  }
1046
1010
  /**
1047
1011
  * Resolve the ideal size from an order-like object with fallback.
@@ -1050,7 +1014,7 @@ class DEXBot {
1050
1014
  * @returns {number|null} Resolved size or null
1051
1015
  */
1052
1016
  _resolveIdealSizeForValidation(orderLike, fallbackSize = null) {
1053
- return dexbot_cow_runtime_1.default.resolveIdealSizeForValidation(this, orderLike, fallbackSize);
1017
+ return cowRuntime.resolveIdealSizeForValidation(this, orderLike, fallbackSize);
1054
1018
  }
1055
1019
  /**
1056
1020
  * Validate that an order size is safe to execute (above minimum dust thresholds).
@@ -1058,10 +1022,10 @@ class DEXBot {
1058
1022
  * @param {string} type - ORDER_TYPES.BUY or ORDER_TYPES.SELL
1059
1023
  * @param {Object|null} [orderLike=null] - Optional order-like object for ideal size comparison
1060
1024
  * @param {number|null} [fallbackSize=null] - Fallback ideal size
1061
- * @returns {import('./types').OrderValidationResult}
1025
+ * @returns {import('./types.js').OrderValidationResult}
1062
1026
  */
1063
1027
  _validateOrderSizeForExecution(size, type, orderLike = null, fallbackSize = null) {
1064
- return dexbot_cow_runtime_1.default.validateOrderSizeForExecution(this, size, type, orderLike, fallbackSize);
1028
+ return cowRuntime.validateOrderSizeForExecution(this, size, type, orderLike, fallbackSize);
1065
1029
  }
1066
1030
  /**
1067
1031
  * Execute a batch of order operations if the rebalance result has executable actions.
@@ -1082,7 +1046,7 @@ class DEXBot {
1082
1046
  // outputs, updateOrdersOnChainPlan cowResults, reconcileGridOrders
1083
1047
  // null results) must NOT pop the stack — an unmatched pop could steal
1084
1048
  // a nested grid's entry.
1085
- dexbot_cow_runtime_1.default.popPushedWorkingGrid(this, rebalanceResult);
1049
+ cowRuntime.popPushedWorkingGrid(this, rebalanceResult);
1086
1050
  // Persist master grid mutations that may have occurred outside COW
1087
1051
  // broadcast (e.g., partial-fill size updates applied directly by the
1088
1052
  // sync engine). Without this, a partial fill that does not trigger a
@@ -1232,17 +1196,17 @@ class DEXBot {
1232
1196
  }
1233
1197
  try {
1234
1198
  if (this.privateKey && getKeyStore().isDaemonSigningKey(this.privateKey)) {
1235
- await chainKeys.pingDaemon(this.privateKey.accountName, Math.min(constants_1.TIMING.DAEMON_PING_TIMEOUT_MS, constants_1.TIMING.DAEMON_STARTUP_TIMEOUT_MS), { socketPath: this.privateKey.socketPath });
1199
+ await chainKeys.pingDaemon(this.privateKey.accountName, Math.min(TIMING.DAEMON_PING_TIMEOUT_MS, TIMING.DAEMON_STARTUP_TIMEOUT_MS), { socketPath: this.privateKey.socketPath });
1236
1200
  }
1237
1201
  }
1238
1202
  catch (err) {
1239
- const message = `Credential daemon unavailable before ${contextLabel}: ${(0, errors_1.getErrorMessage)(err)}`;
1203
+ const message = `Credential daemon unavailable before ${contextLabel}: ${getErrorMessage(err)}`;
1240
1204
  this._credentialDaemonDown = true;
1241
1205
  this._credentialRecoveryNeeded = true;
1242
1206
  this._suspendGridPersistenceForCredentialOutage(message);
1243
1207
  this.manager?.logger?.log?.(`[CREDENTIAL] ${message}. Write operations paused; re-unlock with dexbot pm2.`, 'error');
1244
1208
  const wrapped = new Error(message);
1245
- wrapped.code = constants_1.DAEMON_CODES.CREDENTIAL_DAEMON_UNAVAILABLE;
1209
+ wrapped.code = DAEMON_CODES.CREDENTIAL_DAEMON_UNAVAILABLE;
1246
1210
  wrapped.cause = err;
1247
1211
  throw wrapped;
1248
1212
  }
@@ -1255,9 +1219,9 @@ class DEXBot {
1255
1219
  _isCredentialDaemonError(err) {
1256
1220
  if (!err)
1257
1221
  return false;
1258
- if (err.code === constants_1.DAEMON_CODES.CREDENTIAL_DAEMON_UNAVAILABLE)
1222
+ if (err.code === DAEMON_CODES.CREDENTIAL_DAEMON_UNAVAILABLE)
1259
1223
  return true;
1260
- const message = String((0, errors_1.getErrorMessage)(err) || '');
1224
+ const message = String(getErrorMessage(err) || '');
1261
1225
  return /Credential daemon|Daemon connection failed|daemon .*unavailable|dexbot-cred-daemon\.sock|ECONNREFUSED|ENOENT/.test(message);
1262
1226
  }
1263
1227
  /**
@@ -1274,7 +1238,7 @@ class DEXBot {
1274
1238
  this._credentialRecoveryDeferredTimer = setTimeout(() => {
1275
1239
  this._credentialRecoveryDeferredTimer = null;
1276
1240
  this._runCredentialRecoveryAfterDaemonRestored().catch((err) => {
1277
- this.manager?.logger?.log?.(`[CREDENTIAL] Deferred recovery failed: ${(0, errors_1.getErrorMessage)(err)}`, 'error');
1241
+ this.manager?.logger?.log?.(`[CREDENTIAL] Deferred recovery failed: ${getErrorMessage(err)}`, 'error');
1278
1242
  if (this.manager) {
1279
1243
  this.manager._recoveryState = { ...this.manager._recoveryState, lastFailureAt: Date.now() };
1280
1244
  }
@@ -1302,8 +1266,8 @@ class DEXBot {
1302
1266
  }
1303
1267
  catch (err) {
1304
1268
  this._credentialRecoveryNeeded = true;
1305
- this._suspendGridPersistenceForCredentialOutage(`credential recovery failed: ${(0, errors_1.getErrorMessage)(err)}`);
1306
- this.manager?.logger?.log?.(`[CREDENTIAL] Credential recovery sync failed: ${(0, errors_1.getErrorMessage)(err)}. Writes remain guarded by preflight.`, 'error');
1269
+ this._suspendGridPersistenceForCredentialOutage(`credential recovery failed: ${getErrorMessage(err)}`);
1270
+ this.manager?.logger?.log?.(`[CREDENTIAL] Credential recovery sync failed: ${getErrorMessage(err)}. Writes remain guarded by preflight.`, 'error');
1307
1271
  }
1308
1272
  finally {
1309
1273
  this._credentialRecoveryInFlight = false;
@@ -1322,7 +1286,7 @@ class DEXBot {
1322
1286
  this._credentialDaemonDown = false;
1323
1287
  return;
1324
1288
  }
1325
- const intervalMs = Math.max(constants_1.TIMING.DAEMON_PING_TIMEOUT_MS, constants_1.TIMING.CREDENTIAL_DAEMON_WATCHDOG_MS);
1289
+ const intervalMs = Math.max(TIMING.DAEMON_PING_TIMEOUT_MS, TIMING.CREDENTIAL_DAEMON_WATCHDOG_MS);
1326
1290
  const probe = async () => {
1327
1291
  if (this._shuttingDown || !this._isCredentialDaemonWriteRequired())
1328
1292
  return;
@@ -1346,7 +1310,7 @@ class DEXBot {
1346
1310
  }
1347
1311
  catch (err) {
1348
1312
  if (!this._credentialDaemonDown) {
1349
- const errMsg = String((0, errors_1.getErrorMessage)(err) || '');
1313
+ const errMsg = String(getErrorMessage(err) || '');
1350
1314
  let hint = '';
1351
1315
  if (errMsg.includes('ENOENT')) {
1352
1316
  hint = `Socket file missing at ${token.socketPath}. The credential daemon process may have been killed (e.g. by stray Ctrl-C). Restart it with: dexbot pm2 restart dexbot-cred. If the problem persists, check the daemon log: profiles/logs/dexbot-cred.log`;
@@ -1360,10 +1324,10 @@ class DEXBot {
1360
1324
  else {
1361
1325
  hint = `Write operations will remain paused until re-unlocked with dexbot pm2.`;
1362
1326
  }
1363
- this.manager?.logger?.log?.(`[CREDENTIAL] Credential daemon watchdog failed: ${(0, errors_1.getErrorMessage)(err)}. ${hint}`, 'error');
1327
+ this.manager?.logger?.log?.(`[CREDENTIAL] Credential daemon watchdog failed: ${getErrorMessage(err)}. ${hint}`, 'error');
1364
1328
  }
1365
1329
  this._credentialDaemonDown = true;
1366
- this._suspendGridPersistenceForCredentialOutage(`credential daemon watchdog failed: ${(0, errors_1.getErrorMessage)(err)}`);
1330
+ this._suspendGridPersistenceForCredentialOutage(`credential daemon watchdog failed: ${getErrorMessage(err)}`);
1367
1331
  }
1368
1332
  }
1369
1333
  finally {
@@ -1372,14 +1336,14 @@ class DEXBot {
1372
1336
  };
1373
1337
  this._credentialDaemonWatchdogInterval = setInterval(() => {
1374
1338
  probe().catch((err) => {
1375
- this.manager?.logger?.log?.(`[CREDENTIAL] Credential daemon watchdog error: ${(0, errors_1.getErrorMessage)(err)}`, 'warn');
1339
+ this.manager?.logger?.log?.(`[CREDENTIAL] Credential daemon watchdog error: ${getErrorMessage(err)}`, 'warn');
1376
1340
  });
1377
1341
  }, intervalMs);
1378
1342
  if (typeof this._credentialDaemonWatchdogInterval.unref === 'function') {
1379
1343
  this._credentialDaemonWatchdogInterval.unref();
1380
1344
  }
1381
1345
  void probe();
1382
- this._log(`Credential daemon watchdog started (${Math.round(intervalMs / constants_1.TIMING.MILLISECONDS_PER_SECOND)}s interval)`);
1346
+ this._log(`Credential daemon watchdog started (${Math.round(intervalMs / TIMING.MILLISECONDS_PER_SECOND)}s interval)`);
1383
1347
  }
1384
1348
  /**
1385
1349
  * Stop the credential daemon watchdog interval.
@@ -1421,25 +1385,25 @@ class DEXBot {
1421
1385
  * @returns {Array<{type: string, id: string, order?: Object, orderId?: string, newSize?: number, newPrice?: number, newGridId?: string}>}
1422
1386
  */
1423
1387
  _buildActionsFromPlan(plan) {
1424
- return dexbot_cow_runtime_1.default.buildActionsFromPlan(this, plan);
1388
+ return cowRuntime.buildActionsFromPlan(this, plan);
1425
1389
  }
1426
1390
  /**
1427
1391
  * Build a COW result object (workingGrid + actions) from a simple plan.
1428
1392
  * @param {Object|Array} plan - Plan object or array of ordersToPlace
1429
- * @returns {{workingGrid: import('./types').WorkingGrid, workingIndexes: Object, workingBoundary: number, actions: Array}}
1393
+ * @returns {{workingGrid: import('./types.js').WorkingGrid, workingIndexes: Object, workingBoundary: number, actions: Array}}
1430
1394
  */
1431
1395
  _buildCowResultFromPlan(plan) {
1432
- return dexbot_cow_runtime_1.default.buildCowResultFromPlan(this, plan);
1396
+ return cowRuntime.buildCowResultFromPlan(this, plan);
1433
1397
  }
1434
1398
  /**
1435
1399
  * Restore skipped update slots in the working grid to master state.
1436
- * @param {import('./types').WorkingGrid} workingGrid - Working grid to restore slots into
1400
+ * @param {import('./types.js').WorkingGrid} workingGrid - Working grid to restore slots into
1437
1401
  * @param {Set<string>} skippedSlotIds - Set of slot IDs that were skipped
1438
1402
  * @param {number} [skippedCount=0] - Count of skipped actions for logging
1439
1403
  * @returns {void}
1440
1404
  */
1441
1405
  _restoreSkippedUpdateSlotsInWorkingGrid(workingGrid, skippedSlotIds, skippedCount = 0) {
1442
- return dexbot_cow_runtime_1.default.restoreSkippedUpdateSlotsInWorkingGrid(this, workingGrid, skippedSlotIds, skippedCount);
1406
+ return cowRuntime.restoreSkippedUpdateSlotsInWorkingGrid(this, workingGrid, skippedSlotIds, skippedCount);
1443
1407
  }
1444
1408
  /**
1445
1409
  * COW broadcast: Execute blockchain operations and commit working grid on success.
@@ -1449,10 +1413,10 @@ class DEXBot {
1449
1413
  * @private
1450
1414
  */
1451
1415
  async _updateOrdersOnChainBatchCOW(cowResult, options = {}) {
1452
- return dexbot_cow_runtime_1.default.updateOrdersOnChainBatchCOW(this, cowResult, options);
1416
+ return cowRuntime.updateOrdersOnChainBatchCOW(this, cowResult, options);
1453
1417
  }
1454
1418
  async _processBatchResults(result, opContexts) {
1455
- return dexbot_cow_runtime_1.default.processBatchResults(this, result, opContexts);
1419
+ return cowRuntime.processBatchResults(this, result, opContexts);
1456
1420
  }
1457
1421
  /**
1458
1422
  * Perform grid recalculation triggered by trigger file.
@@ -1463,7 +1427,7 @@ class DEXBot {
1463
1427
  * @private
1464
1428
  */
1465
1429
  async _performGridResync(options = {}) {
1466
- return dexbot_maintenance_runtime_1.default.performGridResync(this, options);
1430
+ return DexbotMaintenanceRuntime.performGridResync(this, options);
1467
1431
  }
1468
1432
  /**
1469
1433
  * Handle any pending trigger file reset at startup.
@@ -1472,7 +1436,7 @@ class DEXBot {
1472
1436
  * @private
1473
1437
  */
1474
1438
  async _handlePendingTriggerReset() {
1475
- return dexbot_maintenance_runtime_1.default.handlePendingTriggerReset(this);
1439
+ return DexbotMaintenanceRuntime.handlePendingTriggerReset(this);
1476
1440
  }
1477
1441
  /**
1478
1442
  * Setup trigger file detection for grid reset.
@@ -1480,7 +1444,7 @@ class DEXBot {
1480
1444
  * @private
1481
1445
  */
1482
1446
  async _setupTriggerFileDetection() {
1483
- return dexbot_maintenance_runtime_1.default.setupTriggerFileDetection(this);
1447
+ return DexbotMaintenanceRuntime.setupTriggerFileDetection(this);
1484
1448
  }
1485
1449
  /**
1486
1450
  * Starts the bot's operation.
@@ -1499,14 +1463,14 @@ class DEXBot {
1499
1463
  */
1500
1464
  async startWithPrivateKey(privateKey) {
1501
1465
  // Initialize account data with provided private key
1502
- await waitForConnected(constants_1.TIMING.CONNECTION_TIMEOUT_MS);
1466
+ await waitForConnected(TIMING.CONNECTION_TIMEOUT_MS);
1503
1467
  if (this.config && this.config.preferredAccount) {
1504
1468
  try {
1505
1469
  this.privateKey = privateKey;
1506
1470
  await this._setupAccountContext(this.config.preferredAccount);
1507
1471
  }
1508
1472
  catch (err) {
1509
- this._warn(`Auto-selection of preferredAccount failed: ${(0, errors_1.getErrorMessage)(err)}`);
1473
+ this._warn(`Auto-selection of preferredAccount failed: ${getErrorMessage(err)}`);
1510
1474
  throw err;
1511
1475
  }
1512
1476
  }
@@ -1529,7 +1493,7 @@ class DEXBot {
1529
1493
  await this._finishStartupSequence(startupState);
1530
1494
  }
1531
1495
  catch (err) {
1532
- this._warn(`Error during grid initialization: ${(0, errors_1.getErrorMessage)(err)}`);
1496
+ this._warn(`Error during grid initialization: ${getErrorMessage(err)}`);
1533
1497
  await this.shutdown();
1534
1498
  throw err;
1535
1499
  }
@@ -1552,10 +1516,10 @@ class DEXBot {
1552
1516
  * @private
1553
1517
  */
1554
1518
  async _performPeriodicGridChecks() {
1555
- return dexbot_maintenance_runtime_1.default.performPeriodicGridChecks(this);
1519
+ return DexbotMaintenanceRuntime.performPeriodicGridChecks(this);
1556
1520
  }
1557
1521
  _isOpenOrdersSyncLoopEnabled() {
1558
- return dexbot_maintenance_runtime_1.default.isOpenOrdersSyncLoopEnabled(this);
1522
+ return DexbotMaintenanceRuntime.isOpenOrdersSyncLoopEnabled(this);
1559
1523
  }
1560
1524
  /**
1561
1525
  * Start the open-orders watchdog sync loop.
@@ -1563,14 +1527,14 @@ class DEXBot {
1563
1527
  * @private
1564
1528
  */
1565
1529
  _startOpenOrdersSyncLoop() {
1566
- return dexbot_maintenance_runtime_1.default.startOpenOrdersSyncLoop(this);
1530
+ return DexbotMaintenanceRuntime.startOpenOrdersSyncLoop(this);
1567
1531
  }
1568
1532
  /**
1569
1533
  * Stop the open-orders watchdog sync loop.
1570
1534
  * @private
1571
1535
  */
1572
1536
  async _stopOpenOrdersSyncLoop() {
1573
- return dexbot_maintenance_runtime_1.default.stopOpenOrdersSyncLoop(this);
1537
+ return DexbotMaintenanceRuntime.stopOpenOrdersSyncLoop(this);
1574
1538
  }
1575
1539
  /**
1576
1540
  * Set up periodic blockchain account balance fetch interval.
@@ -1578,21 +1542,21 @@ class DEXBot {
1578
1542
  * @private
1579
1543
  */
1580
1544
  _setupBlockchainFetchInterval() {
1581
- return dexbot_maintenance_runtime_1.default.setupBlockchainFetchInterval(this);
1545
+ return DexbotMaintenanceRuntime.setupBlockchainFetchInterval(this);
1582
1546
  }
1583
1547
  /**
1584
1548
  * Stop the periodic blockchain fetch interval.
1585
1549
  * @private
1586
1550
  */
1587
1551
  _stopBlockchainFetchInterval() {
1588
- return dexbot_maintenance_runtime_1.default.stopBlockchainFetchInterval(this);
1552
+ return DexbotMaintenanceRuntime.stopBlockchainFetchInterval(this);
1589
1553
  }
1590
1554
  async _releaseMarketAdapterRuntime(context = 'shutdown') {
1591
- return dexbot_maintenance_runtime_1.default.releaseMarketAdapterRuntime(this, this.config?.botKey || this.config?.name, context);
1555
+ return DexbotMaintenanceRuntime.releaseMarketAdapterRuntime(this, this.config?.botKey || this.config?.name, context);
1592
1556
  }
1593
1557
  /**
1594
1558
  * Get or create the credit runtime for debt policy management.
1595
- * @returns {import('./credit_runtime').CreditRuntime|null}
1559
+ * @returns {import('./credit_runtime.js').CreditRuntime|null}
1596
1560
  */
1597
1561
  _getCreditRuntime() {
1598
1562
  const lending = this.config?.debtPolicy?.lending;
@@ -1604,15 +1568,15 @@ class DEXBot {
1604
1568
  return null;
1605
1569
  }
1606
1570
  if (!this._creditRuntime) {
1607
- this._creditRuntime = new credit_runtime_1.default(this, {
1608
- stateDir: paths_1.PATHS.CREDIT_RUNTIME_DIR,
1571
+ this._creditRuntime = new CreditRuntime(this, {
1572
+ stateDir: PATHS.CREDIT_RUNTIME_DIR,
1609
1573
  });
1610
1574
  }
1611
1575
  return this._creditRuntime;
1612
1576
  }
1613
1577
  /**
1614
1578
  * Set up the credit runtime by loading its persisted state.
1615
- * @returns {Promise<import('./credit_runtime').CreditRuntime|null>}
1579
+ * @returns {Promise<import('./credit_runtime.js').CreditRuntime|null>}
1616
1580
  */
1617
1581
  async _setupCreditRuntime() {
1618
1582
  const runtime = this._getCreditRuntime();
@@ -1634,7 +1598,7 @@ class DEXBot {
1634
1598
  await runtime.refreshState();
1635
1599
  }
1636
1600
  catch (err) {
1637
- this._warn(`Credit runtime refresh/sync failed: ${(0, errors_1.getErrorMessage)(err)}`);
1601
+ this._warn(`Credit runtime refresh/sync failed: ${getErrorMessage(err)}`);
1638
1602
  }
1639
1603
  }
1640
1604
  /**
@@ -1659,7 +1623,7 @@ class DEXBot {
1659
1623
  if (!runtime) {
1660
1624
  return;
1661
1625
  }
1662
- const intervalMin = Number(this.config?.TIMING?.CREDIT_DEAL_CHECK_INTERVAL_MIN ?? constants_1.TIMING.CREDIT_DEAL_CHECK_INTERVAL_MIN);
1626
+ const intervalMin = Number(this.config?.TIMING?.CREDIT_DEAL_CHECK_INTERVAL_MIN ?? TIMING.CREDIT_DEAL_CHECK_INTERVAL_MIN);
1663
1627
  if (!Number.isFinite(intervalMin) || intervalMin <= 0) {
1664
1628
  this._log('Credit deal watchdog disabled by configuration (TIMING.CREDIT_DEAL_CHECK_INTERVAL_MIN <= 0)');
1665
1629
  return;
@@ -1668,13 +1632,13 @@ class DEXBot {
1668
1632
  clearInterval(this._creditWatchdogInterval);
1669
1633
  this._creditWatchdogInterval = null;
1670
1634
  }
1671
- const intervalMs = intervalMin * 60 * constants_1.TIMING.MILLISECONDS_PER_SECOND;
1635
+ const intervalMs = intervalMin * 60 * TIMING.MILLISECONDS_PER_SECOND;
1672
1636
  this._creditWatchdogInterval = setInterval(async () => {
1673
1637
  try {
1674
1638
  await runtime.runCreditWatchdog();
1675
1639
  }
1676
1640
  catch (err) {
1677
- this._warn(`Credit watchdog error: ${(0, errors_1.getErrorMessage)(err)}`);
1641
+ this._warn(`Credit watchdog error: ${getErrorMessage(err)}`);
1678
1642
  }
1679
1643
  }, intervalMs);
1680
1644
  if (typeof this._creditWatchdogInterval?.unref === 'function') {
@@ -1693,17 +1657,17 @@ class DEXBot {
1693
1657
  }
1694
1658
  }
1695
1659
  async requestGridReset(reason = 'structural change', options = {}) {
1696
- return dexbot_maintenance_runtime_1.default.requestGridReset(this, reason, options);
1660
+ return DexbotMaintenanceRuntime.requestGridReset(this, reason, options);
1697
1661
  }
1698
1662
  _wireStructuralGridResyncRequest() {
1699
- return dexbot_maintenance_runtime_1.default.wireStructuralGridResyncRequest(this);
1663
+ return DexbotMaintenanceRuntime.wireStructuralGridResyncRequest(this);
1700
1664
  }
1701
1665
  /**
1702
1666
  * Get current metrics for monitoring and debugging.
1703
1667
  * @returns {Object} Metrics snapshot
1704
1668
  */
1705
1669
  getMetrics() {
1706
- return dexbot_maintenance_runtime_1.default.getMetrics(this);
1670
+ return DexbotMaintenanceRuntime.getMetrics(this);
1707
1671
  }
1708
1672
  /**
1709
1673
  * Execute grid maintenance checks in strict order with pipeline consensus.
@@ -1737,7 +1701,7 @@ class DEXBot {
1737
1701
  * @private
1738
1702
  */
1739
1703
  async _executeMaintenanceLogic(context) {
1740
- return dexbot_maintenance_runtime_1.default.executeMaintenanceLogic(this, context);
1704
+ return DexbotMaintenanceRuntime.executeMaintenanceLogic(this, context);
1741
1705
  }
1742
1706
  /**
1743
1707
  * Cancel dust partial orders immediately — no maps, no timers, no delay.
@@ -1748,7 +1712,7 @@ class DEXBot {
1748
1712
  * @private
1749
1713
  */
1750
1714
  async _cancelDustOrders({ buy: buyDust = [], sell: sellDust = [] } = {}) {
1751
- return dexbot_maintenance_runtime_1.default.cancelDustOrders(this, { buy: buyDust, sell: sellDust });
1715
+ return DexbotMaintenanceRuntime.cancelDustOrders(this, { buy: buyDust, sell: sellDust });
1752
1716
  }
1753
1717
  /**
1754
1718
  * Run a single dust health check cycle: inspect grid for partials below the
@@ -1758,7 +1722,7 @@ class DEXBot {
1758
1722
  * @private
1759
1723
  */
1760
1724
  async _runDustHealthCheck() {
1761
- return dexbot_maintenance_runtime_1.default.runDustHealthCheck(this);
1725
+ return DexbotMaintenanceRuntime.runDustHealthCheck(this);
1762
1726
  }
1763
1727
  /**
1764
1728
  * Set up the periodic dust health check interval.
@@ -1768,7 +1732,7 @@ class DEXBot {
1768
1732
  * @private
1769
1733
  */
1770
1734
  _setupDustHealthCheckInterval() {
1771
- return dexbot_maintenance_runtime_1.default.setupDustHealthCheckInterval(this);
1735
+ return DexbotMaintenanceRuntime.setupDustHealthCheckInterval(this);
1772
1736
  }
1773
1737
  /**
1774
1738
  * Perform grid maintenance: fund thresholds, spread condition, grid health, divergence.
@@ -1795,7 +1759,7 @@ class DEXBot {
1795
1759
  * @private
1796
1760
  */
1797
1761
  async _runGridMaintenance(context = 'periodic', options = {}) {
1798
- return dexbot_maintenance_runtime_1.default.runGridMaintenance(this, context, options);
1762
+ return DexbotMaintenanceRuntime.runGridMaintenance(this, context, options);
1799
1763
  }
1800
1764
  /**
1801
1765
  * Gracefully shutdown the bot.
@@ -1852,7 +1816,7 @@ class DEXBot {
1852
1816
  await this._creditRuntime.shutdown();
1853
1817
  }
1854
1818
  catch (err) {
1855
- this._warn(`Failed to persist credit runtime state: ${(0, errors_1.getErrorMessage)(err)}`);
1819
+ this._warn(`Failed to persist credit runtime state: ${getErrorMessage(err)}`);
1856
1820
  }
1857
1821
  }
1858
1822
  if (this._triggerWatcher && typeof this._triggerWatcher.close === 'function') {
@@ -1860,7 +1824,7 @@ class DEXBot {
1860
1824
  this._triggerWatcher.close();
1861
1825
  }
1862
1826
  catch (err) {
1863
- this._warn(`Failed to close trigger watcher: ${(0, errors_1.getErrorMessage)(err)}`);
1827
+ this._warn(`Failed to close trigger watcher: ${getErrorMessage(err)}`);
1864
1828
  }
1865
1829
  finally {
1866
1830
  this._triggerWatcher = null;
@@ -1871,7 +1835,7 @@ class DEXBot {
1871
1835
  await this._fillsUnsubscribe();
1872
1836
  }
1873
1837
  catch (err) {
1874
- this._warn(`Failed to unsubscribe fill listener: ${(0, errors_1.getErrorMessage)(err)}`);
1838
+ this._warn(`Failed to unsubscribe fill listener: ${getErrorMessage(err)}`);
1875
1839
  }
1876
1840
  finally {
1877
1841
  this._fillsUnsubscribe = null;
@@ -1882,7 +1846,7 @@ class DEXBot {
1882
1846
  this._reconnectUnregister();
1883
1847
  }
1884
1848
  catch (err) {
1885
- this._warn(`Error unregistering reconnect callback: ${(0, errors_1.getErrorMessage)(err)}`);
1849
+ this._warn(`Error unregistering reconnect callback: ${getErrorMessage(err)}`);
1886
1850
  }
1887
1851
  this._reconnectUnregister = null;
1888
1852
  }
@@ -1890,13 +1854,13 @@ class DEXBot {
1890
1854
  await this._stopOpenOrdersSyncLoop();
1891
1855
  }
1892
1856
  catch (err) {
1893
- this._warn(`Error while stopping open-orders sync loop: ${(0, errors_1.getErrorMessage)(err)}`);
1857
+ this._warn(`Error while stopping open-orders sync loop: ${getErrorMessage(err)}`);
1894
1858
  }
1895
1859
  try {
1896
1860
  await this._releaseMarketAdapterRuntime('shutdown');
1897
1861
  }
1898
1862
  catch (err) {
1899
- this._warn(`Error while releasing market adapter runtime: ${(0, errors_1.getErrorMessage)(err)}`);
1863
+ this._warn(`Error while releasing market adapter runtime: ${getErrorMessage(err)}`);
1900
1864
  }
1901
1865
  // Wait for current fill processing to complete
1902
1866
  try {
@@ -1934,7 +1898,7 @@ class DEXBot {
1934
1898
  this._log('Final grid snapshot persisted');
1935
1899
  }
1936
1900
  catch (err) {
1937
- this._warn(`Failed to persist final state: ${(0, errors_1.getErrorMessage)(err)}`);
1901
+ this._warn(`Failed to persist final state: ${getErrorMessage(err)}`);
1938
1902
  }
1939
1903
  }
1940
1904
  }).then(() => 'acquired'),
@@ -1973,12 +1937,12 @@ class DEXBot {
1973
1937
  this._log('Final grid snapshot persisted (best-effort, lock not held)');
1974
1938
  }
1975
1939
  catch (err) {
1976
- this._warn(`Failed to persist final state (best-effort): ${(0, errors_1.getErrorMessage)(err)}`);
1940
+ this._warn(`Failed to persist final state (best-effort): ${getErrorMessage(err)}`);
1977
1941
  }
1978
1942
  }
1979
1943
  }
1980
1944
  catch (err) {
1981
- this._warn(`Best-effort flush during shutdown failed: ${(0, errors_1.getErrorMessage)(err)}`);
1945
+ this._warn(`Best-effort flush during shutdown failed: ${getErrorMessage(err)}`);
1982
1946
  }
1983
1947
  }
1984
1948
  // Always reset the fill-consumer watchdog on shutdown completion,
@@ -1988,14 +1952,14 @@ class DEXBot {
1988
1952
  }
1989
1953
  }
1990
1954
  catch (err) {
1991
- this._warn(`Error during shutdown lock acquisition: ${(0, errors_1.getErrorMessage)(err)}`);
1955
+ this._warn(`Error during shutdown lock acquisition: ${getErrorMessage(err)}`);
1992
1956
  }
1993
1957
  // Release fund registry allocation
1994
1958
  if (this.config?.preferredAccount) {
1995
1959
  const botName = this.config.botKey;
1996
1960
  if (botName) {
1997
1961
  fundRegistry.releaseAllocation(this.config.preferredAccount, botName).catch((err) => {
1998
- this._warn(`Failed to release fund allocation for ${botName}: ${(0, errors_1.getErrorMessage)(err)}`);
1962
+ this._warn(`Failed to release fund allocation for ${botName}: ${getErrorMessage(err)}`);
1999
1963
  });
2000
1964
  }
2001
1965
  }
@@ -2012,7 +1976,6 @@ class DEXBot {
2012
1976
  await this.manager?.logger?.flush();
2013
1977
  }
2014
1978
  }
2015
- DEXBot.normalizeBotEntry = bot_settings_1.normalizeBotEntry;
2016
- exports.default = DEXBot;
2017
- module.exports = DEXBot;
1979
+ DEXBot.normalizeBotEntry = normalizeBotEntry;
1980
+ export default DEXBot;
2018
1981
  //# sourceMappingURL=dexbot_class.js.map