dexbot 1.4.11 → 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.
- package/README.md +4 -4
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +9 -18
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +6 -16
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +31 -38
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js +7 -10
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js +10 -14
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +10 -15
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +7 -10
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +4 -12
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.d.ts +0 -1
- package/dist/credential-daemon.d.ts.map +1 -1
- package/dist/credential-daemon.js +3 -123
- package/dist/credential-daemon.js.map +1 -1
- package/dist/dexbot.d.ts +0 -87
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +11 -14
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +8 -9
- package/dist/market_adapter/ama_signal_runner.js.map +1 -1
- package/dist/market_adapter/candle_utils.js +1 -7
- package/dist/market_adapter/candle_utils.js.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.js +1 -4
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
- package/dist/market_adapter/core/config_normalizers.js +5 -9
- package/dist/market_adapter/core/config_normalizers.js.map +1 -1
- package/dist/market_adapter/core/kibana_candles.js +8 -15
- package/dist/market_adapter/core/kibana_candles.js.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +7 -13
- package/dist/market_adapter/core/kibana_client.js.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js +6 -12
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +92 -102
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama.js +5 -10
- package/dist/market_adapter/core/strategies/ama.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +21 -24
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js +3 -5
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +4 -6
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +15 -22
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/index.d.ts +23 -23
- package/dist/market_adapter/index.d.ts.map +1 -1
- package/dist/market_adapter/index.js +24 -82
- package/dist/market_adapter/index.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +2 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +59 -98
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +11 -17
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
- package/dist/market_adapter/interval_utils.js +1 -2
- package/dist/market_adapter/interval_utils.js.map +1 -1
- package/dist/market_adapter/log_format.js +1 -7
- package/dist/market_adapter/log_format.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +20 -22
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_runner.js +41 -57
- package/dist/market_adapter/lp_chart_runner.js.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +30 -34
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts +2 -2
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +157 -221
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/merge_lp_data.js +17 -18
- package/dist/market_adapter/merge_lp_data.js.map +1 -1
- package/dist/market_adapter/test_helpers.js +3 -14
- package/dist/market_adapter/test_helpers.js.map +1 -1
- package/dist/market_adapter/utils/adapter_client.js +7 -16
- package/dist/market_adapter/utils/adapter_client.js.map +1 -1
- package/dist/market_adapter/utils/atomic_write.js +3 -5
- package/dist/market_adapter/utils/atomic_write.js.map +1 -1
- package/dist/market_adapter/utils/chain.d.ts.map +1 -1
- package/dist/market_adapter/utils/chain.js +9 -17
- package/dist/market_adapter/utils/chain.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +8 -10
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +11 -14
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
- package/dist/market_adapter/utils/file_lock.js +14 -19
- package/dist/market_adapter/utils/file_lock.js.map +1 -1
- package/dist/market_adapter/utils/native_history.js +8 -14
- package/dist/market_adapter/utils/native_history.js.map +1 -1
- package/dist/market_adapter/utils/paths.js +3 -6
- package/dist/market_adapter/utils/paths.js.map +1 -1
- package/dist/modules/account_bots.d.ts +1 -1
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +90 -97
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +0 -9
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +26 -121
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/authority_resolver.js +12 -18
- package/dist/modules/authority_resolver.js.map +1 -1
- package/dist/modules/bitshares-native/chain_client.js +16 -21
- package/dist/modules/bitshares-native/chain_client.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +12 -72
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.js +13 -40
- package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +5 -6
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
- package/dist/modules/bitshares-native/index.d.ts +8 -8
- package/dist/modules/bitshares-native/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/index.js +11 -68
- package/dist/modules/bitshares-native/index.js.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.js +3 -6
- package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
- package/dist/modules/bitshares-native/resolvers.js +9 -11
- package/dist/modules/bitshares-native/resolvers.js.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js +3 -28
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
- package/dist/modules/bitshares-native/serial/index.d.ts +4 -4
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/index.js +5 -46
- package/dist/modules/bitshares-native/serial/index.js.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts +98 -98
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.js +372 -473
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js +3 -8
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
- package/dist/modules/bitshares-native/serial/types.js +9 -74
- package/dist/modules/bitshares-native/serial/types.js.map +1 -1
- package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -1
- package/dist/modules/bitshares-native/signing_client.js +11 -48
- package/dist/modules/bitshares-native/signing_client.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +24 -27
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/bitshares-native/transport.d.ts.map +1 -1
- package/dist/modules/bitshares-native/transport.js +14 -26
- package/dist/modules/bitshares-native/transport.js.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.js +29 -72
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js +12 -21
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +21 -0
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +32 -86
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bot_settings.d.ts.map +1 -1
- package/dist/modules/bot_settings.js +30 -49
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/bots_file_lock.d.ts.map +1 -1
- package/dist/modules/bots_file_lock.js +5 -13
- package/dist/modules/bots_file_lock.js.map +1 -1
- package/dist/modules/broadcast_failure.js +1 -3
- package/dist/modules/broadcast_failure.js.map +1 -1
- package/dist/modules/chain_keys.d.ts +4 -9
- package/dist/modules/chain_keys.d.ts.map +1 -1
- package/dist/modules/chain_keys.js +77 -182
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +2 -2
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +81 -144
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +23 -28
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +2 -9
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +38 -73
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.js +15 -26
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +3 -6
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +62 -153
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credential_runtime.d.ts +1 -1
- package/dist/modules/credential_runtime.d.ts.map +1 -1
- package/dist/modules/credential_runtime.js +34 -41
- package/dist/modules/credential_runtime.js.map +1 -1
- package/dist/modules/credential_session_cache.d.ts +1 -1
- package/dist/modules/credential_session_cache.d.ts.map +1 -1
- package/dist/modules/credential_session_cache.js +5 -42
- package/dist/modules/credential_session_cache.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +126 -162
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/crypto/browser_provider.d.ts +1 -1
- package/dist/modules/crypto/browser_provider.d.ts.map +1 -1
- package/dist/modules/crypto/browser_provider.js +7 -11
- package/dist/modules/crypto/browser_provider.js.map +1 -1
- package/dist/modules/crypto/index.d.ts +6 -6
- package/dist/modules/crypto/index.d.ts.map +1 -1
- package/dist/modules/crypto/index.js +12 -30
- package/dist/modules/crypto/index.js.map +1 -1
- package/dist/modules/crypto/node_provider.d.ts +1 -1
- package/dist/modules/crypto/node_provider.d.ts.map +1 -1
- package/dist/modules/crypto/node_provider.js +3 -5
- package/dist/modules/crypto/node_provider.js.map +1 -1
- package/dist/modules/crypto/provider.js +1 -2
- package/dist/modules/crypto/pure_ripemd160.js +1 -3
- package/dist/modules/crypto/pure_ripemd160.js.map +1 -1
- package/dist/modules/crypto/pure_scrypt.js +1 -4
- package/dist/modules/crypto/pure_scrypt.js.map +1 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts +1 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -1
- package/dist/modules/crypto/pure_secp256k1.js +1 -16
- package/dist/modules/crypto/pure_secp256k1.js.map +1 -1
- package/dist/modules/crypto/sync.d.ts.map +1 -1
- package/dist/modules/crypto/sync.js +16 -17
- package/dist/modules/crypto/sync.js.map +1 -1
- package/dist/modules/daemon_node_health.js +14 -16
- package/dist/modules/daemon_node_health.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +19 -14
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +127 -164
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +28 -27
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +55 -45
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_credential_client.d.ts +6 -2
- package/dist/modules/dexbot_credential_client.d.ts.map +1 -1
- package/dist/modules/dexbot_credential_client.js +21 -31
- package/dist/modules/dexbot_credential_client.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +23 -23
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +119 -77
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +46 -38
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +81 -81
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts +3 -3
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_startup_runtime.js +43 -81
- package/dist/modules/dexbot_startup_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts +11 -11
- package/dist/modules/dexbot_state_recovery.js +32 -78
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/env.js +3 -7
- package/dist/modules/env.js.map +1 -1
- package/dist/modules/fund_registry.d.ts.map +1 -1
- package/dist/modules/fund_registry.js +12 -24
- package/dist/modules/fund_registry.js.map +1 -1
- package/dist/modules/general_settings.js +10 -16
- package/dist/modules/general_settings.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +12 -19
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/key_store.d.ts.map +1 -1
- package/dist/modules/key_store.js +27 -65
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +89 -118
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/child_env.js +1 -5
- package/dist/modules/launcher/child_env.js.map +1 -1
- package/dist/modules/launcher/credential_bootstrap.js +22 -31
- package/dist/modules/launcher/credential_bootstrap.js.map +1 -1
- package/dist/modules/launcher/credential_daemon.js +37 -75
- package/dist/modules/launcher/credential_daemon.js.map +1 -1
- package/dist/modules/launcher/credential_secret.js +2 -37
- package/dist/modules/launcher/credential_secret.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +25 -31
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/headless_password.js +10 -12
- package/dist/modules/launcher/headless_password.js.map +1 -1
- package/dist/modules/launcher/launch_modes.js +3 -9
- package/dist/modules/launcher/launch_modes.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +25 -35
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.js +42 -45
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +67 -138
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/runtime_entry.d.ts +1 -11
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
- package/dist/modules/launcher/runtime_entry.js +12 -15
- package/dist/modules/launcher/runtime_entry.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +1 -1
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +15 -36
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/launcher/supervisor_control.js +4 -9
- package/dist/modules/launcher/supervisor_control.js.map +1 -1
- package/dist/modules/logger.d.ts +1 -1
- package/dist/modules/logger.d.ts.map +1 -1
- package/dist/modules/logger.js +3 -38
- package/dist/modules/logger.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +9 -18
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/node_failure_ledger.js +1 -3
- package/dist/modules/node_failure_ledger.js.map +1 -1
- package/dist/modules/node_health_cache.d.ts.map +1 -1
- package/dist/modules/node_health_cache.js +15 -25
- package/dist/modules/node_health_cache.js.map +1 -1
- package/dist/modules/node_manager.d.ts +1 -1
- package/dist/modules/node_manager.d.ts.map +1 -1
- package/dist/modules/node_manager.js +44 -43
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/accounting.d.ts.map +1 -1
- package/dist/modules/order/accounting.js +102 -118
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/async_lock.d.ts +3 -15
- package/dist/modules/order/async_lock.d.ts.map +1 -1
- package/dist/modules/order/async_lock.js +6 -26
- package/dist/modules/order/async_lock.js.map +1 -1
- package/dist/modules/order/export.js +34 -75
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +1 -3
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +4 -24
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +3 -3
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +206 -262
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile.js +77 -94
- package/dist/modules/order/grid_reconcile.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +117 -149
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/index.d.ts.map +1 -1
- package/dist/modules/order/index.js +11 -45
- package/dist/modules/order/index.js.map +1 -1
- package/dist/modules/order/logger.js +28 -69
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +3 -4
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +10 -0
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +131 -151
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/processed_fill_store.js +2 -7
- package/dist/modules/order/processed_fill_store.js.map +1 -1
- package/dist/modules/order/strategy.js +23 -25
- package/dist/modules/order/strategy.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts +27 -0
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +232 -181
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +1 -25
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +49 -172
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts +46 -2
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +165 -143
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +3 -1
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +152 -211
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/timeout.js +1 -4
- package/dist/modules/order/utils/timeout.js.map +1 -1
- package/dist/modules/order/utils/validate.js +91 -142
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/order/utils/withPoolRef.js +21 -61
- package/dist/modules/order/utils/withPoolRef.js.map +1 -1
- package/dist/modules/order/working_grid.js +6 -9
- package/dist/modules/order/working_grid.js.map +1 -1
- package/dist/modules/path_api.d.ts.map +1 -1
- package/dist/modules/path_api.js +8 -11
- package/dist/modules/path_api.js.map +1 -1
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +61 -67
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/process_discovery.js +13 -21
- package/dist/modules/process_discovery.js.map +1 -1
- package/dist/modules/runtime.js +7 -11
- package/dist/modules/runtime.js.map +1 -1
- package/dist/modules/runtime_settings.d.ts.map +1 -1
- package/dist/modules/runtime_settings.js +14 -16
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.js +1 -3
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/socket_json_client.js +3 -5
- package/dist/modules/socket_json_client.js.map +1 -1
- package/dist/modules/storage/browser_adapter.js +1 -4
- package/dist/modules/storage/browser_adapter.js.map +1 -1
- package/dist/modules/storage/index.d.ts +3 -2
- package/dist/modules/storage/index.d.ts.map +1 -1
- package/dist/modules/storage/index.js +5 -8
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/modules/storage/node_adapter.d.ts +3 -4
- package/dist/modules/storage/node_adapter.d.ts.map +1 -1
- package/dist/modules/storage/node_adapter.js +12 -16
- package/dist/modules/storage/node_adapter.js.map +1 -1
- package/dist/modules/storage/types.js +1 -2
- package/dist/modules/types.d.ts +0 -6
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/types.js +1 -2
- package/dist/modules/types.js.map +1 -1
- package/dist/modules/utils/base58check.js +8 -15
- package/dist/modules/utils/base58check.js.map +1 -1
- package/dist/modules/utils/build_dir.js +3 -7
- package/dist/modules/utils/build_dir.js.map +1 -1
- package/dist/modules/utils/errors.js +1 -5
- package/dist/modules/utils/errors.js.map +1 -1
- package/dist/modules/utils/math_utils.d.ts +1 -1
- package/dist/modules/utils/math_utils.d.ts.map +1 -1
- package/dist/modules/utils/math_utils.js +2 -7
- package/dist/modules/utils/math_utils.js.map +1 -1
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +18 -25
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/pm2.d.ts +4 -70
- package/dist/pm2.d.ts.map +1 -1
- package/dist/pm2.js +106 -132
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-git.js +13 -17
- package/dist/scripts/analyze-git.js.map +1 -1
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +48 -63
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +1 -1
- package/dist/scripts/diagnose-kibana-candles.js +2 -1
- package/dist/scripts/diagnose-kibana-candles.js.map +1 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +1 -1
- package/dist/scripts/diagnose-pool-history.js +2 -1
- package/dist/scripts/diagnose-pool-history.js.map +1 -1
- package/dist/scripts/divergence-calc.d.ts.map +1 -1
- package/dist/scripts/divergence-calc.js +2 -2
- package/dist/scripts/divergence-calc.js.map +1 -1
- package/dist/scripts/fix-err-message.js +17 -22
- package/dist/scripts/fix-err-message.js.map +1 -1
- package/dist/scripts/generate_lp_chart.d.ts.map +1 -1
- package/dist/scripts/generate_lp_chart.js +7 -15
- package/dist/scripts/generate_lp_chart.js.map +1 -1
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +1 -1
- package/dist/scripts/generate_mainnet_corpus_report.js +3 -2
- package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
- package/dist/scripts/generate_market_adapter_whitelist.js +18 -24
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
- package/dist/scripts/native_release_gates.js +15 -19
- package/dist/scripts/native_release_gates.js.map +1 -1
- package/dist/scripts/print_grid.d.ts.map +1 -1
- package/dist/scripts/print_grid.js +2 -2
- package/dist/scripts/print_grid.js.map +1 -1
- package/dist/scripts/run-tests.js +12 -17
- package/dist/scripts/run-tests.js.map +1 -1
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +18 -20
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/sync-version.js +2 -2
- package/dist/scripts/sync-version.js.map +1 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +1 -1
- package/dist/scripts/test-credit-renewal.js +4 -3
- package/dist/scripts/test-credit-renewal.js.map +1 -1
- package/dist/scripts/update.js +77 -89
- package/dist/scripts/update.js.map +1 -1
- package/dist/scripts/validate_bots.d.ts.map +1 -1
- package/dist/scripts/validate_bots.js +2 -2
- package/dist/scripts/validate_bots.js.map +1 -1
- package/dist/scripts/verify-browser-bundle.js +12 -17
- package/dist/scripts/verify-browser-bundle.js.map +1 -1
- package/dist/unlock.d.ts +0 -30
- package/dist/unlock.d.ts.map +1 -1
- package/dist/unlock.js +95 -143
- package/dist/unlock.js.map +1 -1
- package/package.json +5 -8
- package/scripts/README.md +1 -1
- package/scripts/create-bot-symlinks.sh +2 -2
- package/dist/modules/utils/fs_utils.d.ts +0 -18
- package/dist/modules/utils/fs_utils.d.ts.map +0 -1
- package/dist/modules/utils/fs_utils.js +0 -32
- package/dist/modules/utils/fs_utils.js.map +0 -1
- package/dist/scripts/migrate_bot_keys.d.ts +0 -3
- package/dist/scripts/migrate_bot_keys.d.ts.map +0 -1
- package/dist/scripts/migrate_bot_keys.js +0 -225
- package/dist/scripts/migrate_bot_keys.js.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* modules/dexbot_cow_runtime.ts - COW (Copy-on-Write) Batch Execution Runtime
|
|
4
3
|
*
|
|
@@ -8,18 +7,28 @@
|
|
|
8
7
|
* Each function takes the DEXBot instance as its first parameter, following
|
|
9
8
|
* the same pattern as dexbot_fill_runtime.ts.
|
|
10
9
|
*/
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
10
|
+
import * as chainOrdersModule from './chain_orders.js';
|
|
11
|
+
const chainOrders = chainOrdersModule;
|
|
12
|
+
const { readOpenOrdersWithMetaSafe, readOpenOrdersGuarded } = chainOrdersModule;
|
|
13
|
+
import { BroadcastUncertainError as BroadcastUncertainErrorBinding } from './dexbot_credential_client.js';
|
|
14
|
+
const BroadcastUncertainError = BroadcastUncertainErrorBinding;
|
|
15
|
+
import * as orderUtils from './order/utils/order.js';
|
|
16
|
+
const { buildCreateOrderArgs, buildCreateOpFingerprint, extractBatchOperationResults, formatUnmatchedChainOrder, convertToSpreadPlaceholder, buildOutsideInPairGroups, isOrderPlaced, } = orderUtils;
|
|
17
|
+
import * as validate from './order/utils/validate.js';
|
|
18
|
+
const { validateCreateTargetSlots, evaluateCommit, hasExecutableActions } = validate;
|
|
19
|
+
import * as math from './order/utils/math.js';
|
|
20
|
+
const { validateOrderSize, findPriceCollision } = math;
|
|
17
21
|
// Lazy accessor so test mocks on the math module export take effect at call time.
|
|
18
22
|
function getAssetFeesSafe(...args) { return require('./order/utils/math').getAssetFeesSafe(...args); }
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
+
import * as constantsModule from './constants.js';
|
|
24
|
+
const { COW_ACTIONS, ORDER_STATES, ORDER_TYPES, REBALANCE_STATES, } = constantsModule;
|
|
25
|
+
import * as FormatModule from './order/format.js';
|
|
26
|
+
const Format = FormatModule;
|
|
27
|
+
import * as workingGridModule from './order/working_grid.js';
|
|
28
|
+
const { WorkingGrid } = workingGridModule;
|
|
29
|
+
import { getErrorMessage } from './utils/errors.js';
|
|
30
|
+
import { createRequire } from 'node:module';
|
|
31
|
+
const require = createRequire(import.meta.url);
|
|
23
32
|
// Maximum number of times the pre-broadcast staleness guard may re-plan the
|
|
24
33
|
// batch from a fresh master before proceeding anyway. Bounded so a master
|
|
25
34
|
// grid that keeps mutating (fill bursts, sync loops) can never livelock the
|
|
@@ -95,7 +104,7 @@ function findMissingCreateResultContexts(operationResults, opContexts) {
|
|
|
95
104
|
}
|
|
96
105
|
/**
|
|
97
106
|
* Run an immediate chain sync after a successful CREATE broadcast returned incomplete ids.
|
|
98
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
107
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
99
108
|
* @param {string} [reason]
|
|
100
109
|
* @returns {Promise<void>}
|
|
101
110
|
*/
|
|
@@ -148,7 +157,7 @@ async function recoverAfterMissingCreateResults(bot, reason = 'missing create op
|
|
|
148
157
|
}
|
|
149
158
|
/**
|
|
150
159
|
* Restore unresolved missing-create blockers after recovery if sync did not adopt them.
|
|
151
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
160
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
152
161
|
* @param {Array} blockers
|
|
153
162
|
* @param {Object} recoveryResult
|
|
154
163
|
*/
|
|
@@ -180,7 +189,7 @@ function preserveMissingCreateBlockersAfterRecovery(bot, blockers, recoveryResul
|
|
|
180
189
|
}
|
|
181
190
|
/**
|
|
182
191
|
* Merge missing CREATE result contexts into manager._lastUnmatchedChainOrders.
|
|
183
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
192
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
184
193
|
* @param {Array<{index:number, ctx:Object}>} missingCreateResults
|
|
185
194
|
*/
|
|
186
195
|
function markMissingCreateResultsAsStructuralBlocker(bot, missingCreateResults) {
|
|
@@ -231,7 +240,7 @@ function formatUnmatchedChainOrderForLog(order) {
|
|
|
231
240
|
}
|
|
232
241
|
/**
|
|
233
242
|
* Record a pending CREATE broadcast on the manager.
|
|
234
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
243
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
235
244
|
* @param {Object} entry
|
|
236
245
|
*/
|
|
237
246
|
function recordPendingBroadcast(bot, entry) {
|
|
@@ -285,7 +294,7 @@ function clearPendingBroadcasts(pendingBroadcasts) {
|
|
|
285
294
|
* (duplicate orders). The batch-entry guard only fires for batches WITH
|
|
286
295
|
* CREATE actions, so a create-less batch can reach the re-plan path while
|
|
287
296
|
* earlier entries are still live.
|
|
288
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
297
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
289
298
|
* @param {Array} actions - The abandoned batch's actions (COW_ACTIONS)
|
|
290
299
|
*/
|
|
291
300
|
function clearPendingBroadcastsForSlots(bot, actions) {
|
|
@@ -310,7 +319,7 @@ function clearPendingBroadcastsForSlots(bot, actions) {
|
|
|
310
319
|
* no-trigger processFilledOrders outputs, updateOrdersOnChainPlan cowResults,
|
|
311
320
|
* reconcileGridOrders null results) leave the stack untouched — an unmatched
|
|
312
321
|
* pop could steal a nested grid's entry.
|
|
313
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
322
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
314
323
|
* @param {Object} cowResult - Rebalance/COW result carrying _workingGridPushed
|
|
315
324
|
*/
|
|
316
325
|
function popPushedWorkingGrid(bot, cowResult) {
|
|
@@ -323,7 +332,7 @@ function popPushedWorkingGrid(bot, cowResult) {
|
|
|
323
332
|
* omits the freshest orders (exactly the batch's creates), so absence is
|
|
324
333
|
* never authoritative: the pending-broadcast protection is kept and a
|
|
325
334
|
* structural resync is requested so the next cycle adopts any landed orders.
|
|
326
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
335
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
327
336
|
* @param {string} detail - The failure detail (before the common suffix)
|
|
328
337
|
* @param {string} suffix - Parenthetical explanation appended to the message
|
|
329
338
|
* @param {string} resyncReason - Reason string passed to the structural resync
|
|
@@ -340,7 +349,7 @@ async function deferUncertainBroadcastRead(bot, detail, suffix, resyncReason, re
|
|
|
340
349
|
/**
|
|
341
350
|
* Build a fingerprint for an on-chain order so it can be matched against
|
|
342
351
|
* the pending-broadcast cache.
|
|
343
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
352
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
344
353
|
* @param {Object} chainOrder
|
|
345
354
|
* @param {string} slotId
|
|
346
355
|
* @returns {string|null}
|
|
@@ -363,7 +372,7 @@ function buildChainOrderFingerprint(bot, chainOrder, slotId) {
|
|
|
363
372
|
/**
|
|
364
373
|
* Normalize raw BitShares limit_order_object data into the integer tuple
|
|
365
374
|
* used by pending-broadcast recovery.
|
|
366
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
375
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
367
376
|
* @param {Object} chainOrder
|
|
368
377
|
* @returns {{side: string, assetA: string, assetB: string, sellInt: number, receiveInt: number}|null}
|
|
369
378
|
*/
|
|
@@ -406,7 +415,7 @@ function normalizeChainOrderForPendingMatch(bot, chainOrder) {
|
|
|
406
415
|
}
|
|
407
416
|
/**
|
|
408
417
|
* Find a chain order that matches a planned slot using price+size proximity.
|
|
409
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
418
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
410
419
|
* @param {Array} chainOrders - Open chain orders for the account
|
|
411
420
|
* @param {string} slotId - Planned grid slot id
|
|
412
421
|
* @param {Object} planned - { sell, receive, orderType } integers from the planned op
|
|
@@ -467,7 +476,7 @@ function findChainOrderForSlot(bot, chainOrders, slotId, planned) {
|
|
|
467
476
|
/**
|
|
468
477
|
* Reconcile a broadcast whose chain state is unknown.
|
|
469
478
|
* Thin wrapper that optionally acquires _fillProcessingLock before delegating.
|
|
470
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
479
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
471
480
|
* @param {BroadcastUncertainError} err
|
|
472
481
|
* @param {Array<Object>} opContexts
|
|
473
482
|
* @param {Object} [options]
|
|
@@ -483,7 +492,7 @@ async function reconcileAfterUncertainBroadcast(bot, err, opContexts, options =
|
|
|
483
492
|
}
|
|
484
493
|
/**
|
|
485
494
|
* Reconcile a broadcast whose chain state is unknown (implementation).
|
|
486
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
495
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
487
496
|
* @param {BroadcastUncertainError} err
|
|
488
497
|
* @param {Array<Object>} opContexts
|
|
489
498
|
* @param {Object} options
|
|
@@ -787,7 +796,7 @@ async function reconcileAfterUncertainBroadcastImpl(bot, err, opContexts, _optio
|
|
|
787
796
|
}
|
|
788
797
|
/**
|
|
789
798
|
* Auto-cancel one unmatched orphan (price-drift orphan) per cycle.
|
|
790
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
799
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
791
800
|
* @returns {Promise<{cancelled: boolean, reason?: string, orderId?: string}>}
|
|
792
801
|
*/
|
|
793
802
|
async function autoCancelOneUnmatchedOrphan(bot) {
|
|
@@ -847,7 +856,7 @@ async function autoCancelOneUnmatchedOrphan(bot) {
|
|
|
847
856
|
}
|
|
848
857
|
/**
|
|
849
858
|
* Check whether to execute creates in outside-in pair mode.
|
|
850
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
859
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
851
860
|
* @param {Array} opContexts
|
|
852
861
|
* @returns {boolean}
|
|
853
862
|
*/
|
|
@@ -874,7 +883,7 @@ function shouldExecuteCreatePairMode(_bot, opContexts) {
|
|
|
874
883
|
* - 'absent' → provably never transmitted → retry safe
|
|
875
884
|
* - 'landed' → provably applied on chain → must defer
|
|
876
885
|
* - 'unknown' → chain state unverifiable → must defer
|
|
877
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
886
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
878
887
|
* @param {Array} freshChain - Non-empty, non-truncated chain snapshot
|
|
879
888
|
* @param {Object} ctx - Operation context (kind: create/cancel/size-update/rotation)
|
|
880
889
|
* @returns {'absent' | 'landed' | 'unknown'}
|
|
@@ -964,7 +973,7 @@ function verifyUpdateUnapplied(freshChain, ctx) {
|
|
|
964
973
|
* reconciliation machinery (pollChainForConfirmation +
|
|
965
974
|
* reconcileAfterUncertainBroadcast), which verifies inclusion and adopts
|
|
966
975
|
* landed orders before the next cycle.
|
|
967
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
976
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
968
977
|
* @param {Array} operations
|
|
969
978
|
* @param {Array} opContexts
|
|
970
979
|
* @returns {Promise<{result: Object, opContexts: Array}>}
|
|
@@ -1069,7 +1078,7 @@ function chainOrderUnchangedFromCache(chainOrder, cachedRaw) {
|
|
|
1069
1078
|
}
|
|
1070
1079
|
/**
|
|
1071
1080
|
* Execute blockchain operations with appropriate strategy (single batch or pair mode).
|
|
1072
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1081
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1073
1082
|
* @param {Array} operations
|
|
1074
1083
|
* @param {Array} opContexts
|
|
1075
1084
|
* @returns {Promise<{result: Object, opContexts: Array}>}
|
|
@@ -1132,7 +1141,7 @@ async function executeOperationsWithStrategy(bot, operations, opContexts) {
|
|
|
1132
1141
|
}
|
|
1133
1142
|
/**
|
|
1134
1143
|
* Validate that operations can be executed with available funds before broadcasting.
|
|
1135
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1144
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1136
1145
|
* @param {Array} operations
|
|
1137
1146
|
* @param {Object} assetA
|
|
1138
1147
|
* @param {Object} assetB
|
|
@@ -1223,7 +1232,7 @@ function validateOperationFunds(bot, operations, assetA, assetB) {
|
|
|
1223
1232
|
}
|
|
1224
1233
|
/**
|
|
1225
1234
|
* Resolve the ideal size from an order-like object with fallback.
|
|
1226
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1235
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1227
1236
|
* @param {Object|null} orderLike
|
|
1228
1237
|
* @param {number|null} [fallbackSize=null]
|
|
1229
1238
|
* @returns {number|null}
|
|
@@ -1246,19 +1255,19 @@ function resolveIdealSizeForValidation(_bot, orderLike, fallbackSize = null) {
|
|
|
1246
1255
|
}
|
|
1247
1256
|
/**
|
|
1248
1257
|
* Validate that an order size is safe to execute.
|
|
1249
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1258
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1250
1259
|
* @param {number} size
|
|
1251
1260
|
* @param {string} type
|
|
1252
1261
|
* @param {Object|null} [orderLike=null]
|
|
1253
1262
|
* @param {number|null} [fallbackSize=null]
|
|
1254
|
-
* @returns {import('./types').OrderValidationResult}
|
|
1263
|
+
* @returns {import('./types.js').OrderValidationResult}
|
|
1255
1264
|
*/
|
|
1256
1265
|
function validateOrderSizeForExecution(bot, size, type, orderLike = null, fallbackSize = null) {
|
|
1257
1266
|
return validateOrderSize(size, type, bot.manager.assets, bot.config.gridLimits?.MIN_ORDER_SIZE_FACTOR, resolveIdealSizeForValidation(bot, orderLike, fallbackSize), bot.config.gridLimits?.PARTIAL_DUST_THRESHOLD_PERCENTAGE);
|
|
1258
1267
|
}
|
|
1259
1268
|
/**
|
|
1260
1269
|
* Build COW actions array from a simple plan object.
|
|
1261
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1270
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1262
1271
|
* @param {Object|Array} plan
|
|
1263
1272
|
* @returns {Array}
|
|
1264
1273
|
*/
|
|
@@ -1335,9 +1344,9 @@ function buildActionsFromPlan(_bot, plan) {
|
|
|
1335
1344
|
}
|
|
1336
1345
|
/**
|
|
1337
1346
|
* Build a COW result object (workingGrid + actions) from a simple plan.
|
|
1338
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1347
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1339
1348
|
* @param {Object|Array} plan
|
|
1340
|
-
* @returns {{workingGrid: import('./types').WorkingGrid, workingIndexes: Object, workingBoundary: number, actions: Array}}
|
|
1349
|
+
* @returns {{workingGrid: import('./types.js').WorkingGrid, workingIndexes: Object, workingBoundary: number, actions: Array}}
|
|
1341
1350
|
*/
|
|
1342
1351
|
function buildCowResultFromPlan(bot, plan) {
|
|
1343
1352
|
const workingGrid = new WorkingGrid(bot.manager.orders, {
|
|
@@ -1418,8 +1427,8 @@ function buildCowResultFromPlan(bot, plan) {
|
|
|
1418
1427
|
}
|
|
1419
1428
|
/**
|
|
1420
1429
|
* Restore skipped update slots in the working grid to master state.
|
|
1421
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1422
|
-
* @param {import('./types').WorkingGrid} workingGrid
|
|
1430
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1431
|
+
* @param {import('./types.js').WorkingGrid} workingGrid
|
|
1423
1432
|
* @param {Set<string>} skippedSlotIds
|
|
1424
1433
|
* @param {number} [skippedCount=0]
|
|
1425
1434
|
*/
|
|
@@ -1603,7 +1612,7 @@ function restoreSkippedUpdateSlotsInWorkingGrid(bot, workingGrid, skippedSlotIds
|
|
|
1603
1612
|
* release exactly the entry they were pushed with, instead of underflowing
|
|
1604
1613
|
* or stealing a nested grid's entry.
|
|
1605
1614
|
*
|
|
1606
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1615
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1607
1616
|
* @param {Object} cowResult - The stale plan result
|
|
1608
1617
|
* @param {number} replanDepth - Recursion depth (0 = first attempt)
|
|
1609
1618
|
* @param {Object} preBroadcastGuard - The failed evaluateCommit result
|
|
@@ -1698,7 +1707,7 @@ async function replanStaleBatch(bot, cowResult, replanDepth, preBroadcastGuard)
|
|
|
1698
1707
|
}
|
|
1699
1708
|
/**
|
|
1700
1709
|
* COW broadcast: Execute blockchain operations and commit working grid on success.
|
|
1701
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
1710
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
1702
1711
|
* @param {Object} cowResult
|
|
1703
1712
|
* @param {Object} [options={}] - Internal execution options (replanDepth)
|
|
1704
1713
|
* @returns {Promise<Object>}
|
|
@@ -2403,7 +2412,7 @@ async function updateOrdersOnChainBatchCOW(bot, cowResult, options = {}) {
|
|
|
2403
2412
|
* Request a structural grid resync with the recovery-state flag raised, so a
|
|
2404
2413
|
* later plan cannot duplicate orders placed by a batch whose chain adoption is
|
|
2405
2414
|
* pending. No-op when the manager has no structural-resync handler.
|
|
2406
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
2415
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
2407
2416
|
* @param {string} reason - Human-readable resync reason
|
|
2408
2417
|
* @param {Object} [details={}] - Details passed to the resync handler
|
|
2409
2418
|
*/
|
|
@@ -2424,7 +2433,7 @@ async function requestStructuralResync(bot, reason, details = {}) {
|
|
|
2424
2433
|
* not be read (empty/lagging read, truncated read, or sync failure) — the
|
|
2425
2434
|
* caller then keeps the pending-broadcast protection and defers adoption to
|
|
2426
2435
|
* a structural resync.
|
|
2427
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
2436
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
2428
2437
|
* @param {Object} chainOrders - Chain orders module
|
|
2429
2438
|
* @param {string} logPrefix - Log prefix for sync failure messages
|
|
2430
2439
|
* @returns {Promise<boolean>}
|
|
@@ -2458,7 +2467,7 @@ async function adoptPlacedBatchFromChain(bot, chainOrders, logPrefix) {
|
|
|
2458
2467
|
* Persist the master grid after a chain adoption and clear the pending
|
|
2459
2468
|
* broadcast protection. Persist failures are logged, not thrown — the
|
|
2460
2469
|
* in-memory master is authoritative and the next sync/persist converges disk.
|
|
2461
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
2470
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
2462
2471
|
* @param {string} logPrefix - Log prefix for persist failure messages
|
|
2463
2472
|
*/
|
|
2464
2473
|
async function persistGridAndClearPendingBroadcasts(bot, logPrefix) {
|
|
@@ -2484,7 +2493,7 @@ async function persistGridAndClearPendingBroadcasts(bot, logPrefix) {
|
|
|
2484
2493
|
* capital release for cancelled orders (diff-based, applying it again would
|
|
2485
2494
|
* double-release), and rotations without a committed destination cannot be
|
|
2486
2495
|
* accounted locally.
|
|
2487
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
2496
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
2488
2497
|
* @param {Array<Object>} contexts - Executed op contexts (create/rotation/cancel)
|
|
2489
2498
|
*/
|
|
2490
2499
|
async function applyAdoptionFeeAccounting(bot, contexts) {
|
|
@@ -2548,7 +2557,7 @@ async function applyAdoptionFeeAccounting(bot, contexts) {
|
|
|
2548
2557
|
/**
|
|
2549
2558
|
* Process results from batch transaction execution.
|
|
2550
2559
|
* Updates order state, synchronizes with chain, and deducts BTS fees.
|
|
2551
|
-
* @param {import('./dexbot_class').DEXBot} bot
|
|
2560
|
+
* @param {import('./dexbot_class.js').DEXBot} bot
|
|
2552
2561
|
* @param {Object} result
|
|
2553
2562
|
* @param {Array} opContexts
|
|
2554
2563
|
* @returns {Object} Result with { executed: boolean, hadRotation: boolean }
|
|
@@ -2725,7 +2734,8 @@ async function processBatchResults(bot, result, opContexts) {
|
|
|
2725
2734
|
updateOperationCount
|
|
2726
2735
|
};
|
|
2727
2736
|
}
|
|
2728
|
-
|
|
2737
|
+
export { buildOutsideInPairGroupsForOrders, buildOutsideInPairGroupsForCreateEntries, extractOperationResults, findMissingCreateResultContexts, recoverAfterMissingCreateResults, preserveMissingCreateBlockersAfterRecovery, markMissingCreateResultsAsStructuralBlocker, formatUnmatchedChainOrderForLog, recordPendingBroadcast, clearPendingBroadcasts, clearPendingBroadcastsForSlots, popPushedWorkingGrid, buildChainOrderFingerprint, normalizeChainOrderForPendingMatch, findChainOrderForSlot, reconcileAfterUncertainBroadcast, reconcileAfterUncertainBroadcastImpl, autoCancelOneUnmatchedOrphan, shouldExecuteCreatePairMode, executeWithRetryOnUncertain, executeOperationsWithStrategy, validateOperationFunds, resolveIdealSizeForValidation, validateOrderSizeForExecution, buildActionsFromPlan, buildCowResultFromPlan, restoreSkippedUpdateSlotsInWorkingGrid, applyRotationTransitionsToWorkingGrid, pollChainForConfirmation, updateOrdersOnChainBatchCOW, processBatchResults };
|
|
2738
|
+
export default {
|
|
2729
2739
|
buildOutsideInPairGroupsForOrders,
|
|
2730
2740
|
buildOutsideInPairGroupsForCreateEntries,
|
|
2731
2741
|
extractOperationResults,
|