dexbot 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +287 -0
- package/claw/README.md +513 -0
- package/claw/scripts/memu_runner.py +385 -0
- package/claw/skills/bitshares-guide/SKILL.md +14 -0
- package/claw/skills/bitshares-guide/references/example-skill-shells.md +18 -0
- package/claw/skills/bitshares-guide/references/presentation-patterns.md +19 -0
- package/claw/skills/bitshares-guide/references/scope-guardrails.md +9 -0
- package/claw/skills/launcher-ops/SKILL.md +18 -0
- package/claw/skills/launcher-ops/references/launcher-workflow.md +23 -0
- package/claw/skills/margin-trading/SKILL.md +23 -0
- package/claw/skills/margin-trading/references/honest-asset-list.md +74 -0
- package/claw/skills/margin-trading/references/honest-assets.md +44 -0
- package/claw/skills/margin-trading/references/position-management.md +203 -0
- package/claw/skills/margin-trading/references/trading-concepts.md +80 -0
- package/claw/skills/memu-memory/SKILL.md +218 -0
- package/claw/skills/shared/references/js-automation-overview.md +24 -0
- package/claw/skills/shared/references/safety-and-staleness.md +11 -0
- package/claw/skills/shared/references/skill-boundaries.md +17 -0
- package/claw/skills/trend-detection/SKILL.md +33 -0
- package/claw/skills/trend-detection/agents/openai.yaml +3 -0
- package/claw/skills/trend-detection/references/service.md +45 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts +3 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +149 -0
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +1 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts +3 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +387 -0
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts +3 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +200 -0
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +1 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts +3 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +212 -0
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +1 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +31 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +249 -0
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +1 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts +2 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +1 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +782 -0
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +1 -0
- package/dist/analysis/analyze_derivatives.d.ts +95 -0
- package/dist/analysis/analyze_derivatives.d.ts.map +1 -0
- package/dist/analysis/analyze_derivatives.js +295 -0
- package/dist/analysis/analyze_derivatives.js.map +1 -0
- package/dist/analysis/analyze_dynamic_weight.d.ts +14 -0
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +1 -0
- package/dist/analysis/analyze_dynamic_weight.js +208 -0
- package/dist/analysis/analyze_dynamic_weight.js.map +1 -0
- package/dist/analysis/analyze_kalman.d.ts +13 -0
- package/dist/analysis/analyze_kalman.d.ts.map +1 -0
- package/dist/analysis/analyze_kalman.js +123 -0
- package/dist/analysis/analyze_kalman.js.map +1 -0
- package/dist/analysis/analyze_regime.d.ts +20 -0
- package/dist/analysis/analyze_regime.d.ts.map +1 -0
- package/dist/analysis/analyze_regime.js +139 -0
- package/dist/analysis/analyze_regime.js.map +1 -0
- package/dist/analysis/analyze_regime_windows.d.ts +19 -0
- package/dist/analysis/analyze_regime_windows.d.ts.map +1 -0
- package/dist/analysis/analyze_regime_windows.js +413 -0
- package/dist/analysis/analyze_regime_windows.js.map +1 -0
- package/dist/analysis/analyze_risk_profile.d.ts +3 -0
- package/dist/analysis/analyze_risk_profile.d.ts.map +1 -0
- package/dist/analysis/analyze_risk_profile.js +159 -0
- package/dist/analysis/analyze_risk_profile.js.map +1 -0
- package/dist/analysis/analyze_trade_heatmap.d.ts +3 -0
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +1 -0
- package/dist/analysis/analyze_trade_heatmap.js +367 -0
- package/dist/analysis/analyze_trade_heatmap.js.map +1 -0
- package/dist/analysis/analyze_volatility.d.ts +22 -0
- package/dist/analysis/analyze_volatility.d.ts.map +1 -0
- package/dist/analysis/analyze_volatility.js +172 -0
- package/dist/analysis/analyze_volatility.js.map +1 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +99 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +1 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +804 -0
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +1 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +2 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +1 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +347 -0
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +1 -0
- package/dist/analysis/bot_fitting/shared_utils.d.ts +15 -0
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +1 -0
- package/dist/analysis/bot_fitting/shared_utils.js +48 -0
- package/dist/analysis/bot_fitting/shared_utils.js.map +1 -0
- package/dist/analysis/bot_key_utils.d.ts +16 -0
- package/dist/analysis/bot_key_utils.d.ts.map +1 -0
- package/dist/analysis/bot_key_utils.js +61 -0
- package/dist/analysis/bot_key_utils.js.map +1 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts +3 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +1 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.js +498 -0
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +1 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +546 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +1 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.js +427 -0
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +1 -0
- package/dist/analysis/chart_utils.d.ts +13 -0
- package/dist/analysis/chart_utils.d.ts.map +1 -0
- package/dist/analysis/chart_utils.js +142 -0
- package/dist/analysis/chart_utils.js.map +1 -0
- package/dist/analysis/derivative_chart_generator.d.ts +18 -0
- package/dist/analysis/derivative_chart_generator.d.ts.map +1 -0
- package/dist/analysis/derivative_chart_generator.js +896 -0
- package/dist/analysis/derivative_chart_generator.js.map +1 -0
- package/dist/analysis/math_utils.d.ts +35 -0
- package/dist/analysis/math_utils.d.ts.map +1 -0
- package/dist/analysis/math_utils.js +121 -0
- package/dist/analysis/math_utils.js.map +1 -0
- package/dist/analysis/price_sources.d.ts +34 -0
- package/dist/analysis/price_sources.d.ts.map +1 -0
- package/dist/analysis/price_sources.js +103 -0
- package/dist/analysis/price_sources.js.map +1 -0
- package/dist/analysis/trade_profitability.d.ts +115 -0
- package/dist/analysis/trade_profitability.d.ts.map +1 -0
- package/dist/analysis/trade_profitability.js +1247 -0
- package/dist/analysis/trade_profitability.js.map +1 -0
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +38 -0
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +1 -0
- package/dist/analysis/tradingview/analyze_tradingview.js +212 -0
- package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +9 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +1717 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts +250 -0
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/derivative_analyzer.js +903 -0
- package/dist/analysis/trend_detection/derivative_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +1449 -0
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts +42 -0
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/hurst_analyzer.js +159 -0
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.js +408 -0
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts +103 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js +229 -0
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts +34 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +1 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +89 -0
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts +39 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +1 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +132 -0
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -0
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/regime_chart_generator.js +345 -0
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +2 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +130 -0
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +2 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +1 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +38 -0
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +1 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +6 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +1 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.js +732 -0
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +1 -0
- package/dist/bot.d.ts +49 -0
- package/dist/bot.d.ts.map +1 -0
- package/dist/bot.js +221 -0
- package/dist/bot.js.map +1 -0
- package/dist/credential-daemon.d.ts +64 -0
- package/dist/credential-daemon.d.ts.map +1 -0
- package/dist/credential-daemon.js +987 -0
- package/dist/credential-daemon.js.map +1 -0
- package/dist/dexbot.d.ts +87 -0
- package/dist/dexbot.d.ts.map +1 -0
- package/dist/dexbot.js +1222 -0
- package/dist/dexbot.js.map +1 -0
- package/dist/market_adapter/ama_signal_runner.d.ts +3 -0
- package/dist/market_adapter/ama_signal_runner.d.ts.map +1 -0
- package/dist/market_adapter/ama_signal_runner.js +175 -0
- package/dist/market_adapter/ama_signal_runner.js.map +1 -0
- package/dist/market_adapter/candle_utils.d.ts +57 -0
- package/dist/market_adapter/candle_utils.d.ts.map +1 -0
- package/dist/market_adapter/candle_utils.js +252 -0
- package/dist/market_adapter/candle_utils.js.map +1 -0
- package/dist/market_adapter/core/asymmetric_bounds.d.ts +20 -0
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -0
- package/dist/market_adapter/core/asymmetric_bounds.js +88 -0
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -0
- package/dist/market_adapter/core/config_normalizers.d.ts +10 -0
- package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -0
- package/dist/market_adapter/core/config_normalizers.js +24 -0
- package/dist/market_adapter/core/config_normalizers.js.map +1 -0
- package/dist/market_adapter/core/kibana_candles.d.ts +74 -0
- package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -0
- package/dist/market_adapter/core/kibana_candles.js +249 -0
- package/dist/market_adapter/core/kibana_candles.js.map +1 -0
- package/dist/market_adapter/core/kibana_client.d.ts +27 -0
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -0
- package/dist/market_adapter/core/kibana_client.js +120 -0
- package/dist/market_adapter/core/kibana_client.js.map +1 -0
- package/dist/market_adapter/core/kibana_market_candles.d.ts +143 -0
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -0
- package/dist/market_adapter/core/kibana_market_candles.js +170 -0
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -0
- package/dist/market_adapter/core/market_adapter_service.d.ts +210 -0
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -0
- package/dist/market_adapter/core/market_adapter_service.js +2328 -0
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -0
- package/dist/market_adapter/core/strategies/ama.d.ts +2 -0
- package/dist/market_adapter/core/strategies/ama.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/ama.js +138 -0
- package/dist/market_adapter/core/strategies/ama.js.map +1 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +50 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.js +143 -0
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -0
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +12 -0
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/atr/calculator.js +47 -0
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -0
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts +32 -0
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/collateral_manager.js +68 -0
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -0
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +66 -0
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/regime_gate.js +189 -0
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -0
- package/dist/market_adapter/index.d.ts +10 -0
- package/dist/market_adapter/index.d.ts.map +1 -0
- package/dist/market_adapter/index.js +71 -0
- package/dist/market_adapter/index.js.map +1 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts +3 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +1 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +1165 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -0
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +54 -0
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -0
- package/dist/market_adapter/inputs/fetch_lp_data.js +743 -0
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -0
- package/dist/market_adapter/inputs/kibana_source.d.ts +68 -0
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -0
- package/dist/market_adapter/inputs/kibana_source.js +143 -0
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -0
- package/dist/market_adapter/interval_utils.d.ts +6 -0
- package/dist/market_adapter/interval_utils.d.ts.map +1 -0
- package/dist/market_adapter/interval_utils.js +14 -0
- package/dist/market_adapter/interval_utils.js.map +1 -0
- package/dist/market_adapter/log_format.d.ts +16 -0
- package/dist/market_adapter/log_format.d.ts.map +1 -0
- package/dist/market_adapter/log_format.js +72 -0
- package/dist/market_adapter/log_format.js.map +1 -0
- package/dist/market_adapter/lp_chart_core.d.ts +6 -0
- package/dist/market_adapter/lp_chart_core.d.ts.map +1 -0
- package/dist/market_adapter/lp_chart_core.js +874 -0
- package/dist/market_adapter/lp_chart_core.js.map +1 -0
- package/dist/market_adapter/lp_chart_runner.d.ts +135 -0
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -0
- package/dist/market_adapter/lp_chart_runner.js +337 -0
- package/dist/market_adapter/lp_chart_runner.js.map +1 -0
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +23 -0
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -0
- package/dist/market_adapter/lp_chart_strategy_loader.js +169 -0
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -0
- package/dist/market_adapter/market_adapter.d.ts +133 -0
- package/dist/market_adapter/market_adapter.d.ts.map +1 -0
- package/dist/market_adapter/market_adapter.js +1331 -0
- package/dist/market_adapter/market_adapter.js.map +1 -0
- package/dist/market_adapter/merge_lp_data.d.ts +3 -0
- package/dist/market_adapter/merge_lp_data.d.ts.map +1 -0
- package/dist/market_adapter/merge_lp_data.js +125 -0
- package/dist/market_adapter/merge_lp_data.js.map +1 -0
- package/dist/market_adapter/test_helpers.d.ts +14 -0
- package/dist/market_adapter/test_helpers.d.ts.map +1 -0
- package/dist/market_adapter/test_helpers.js +22 -0
- package/dist/market_adapter/test_helpers.js.map +1 -0
- package/dist/market_adapter/utils/adapter_client.d.ts +20 -0
- package/dist/market_adapter/utils/adapter_client.d.ts.map +1 -0
- package/dist/market_adapter/utils/adapter_client.js +88 -0
- package/dist/market_adapter/utils/adapter_client.js.map +1 -0
- package/dist/market_adapter/utils/atomic_write.d.ts +9 -0
- package/dist/market_adapter/utils/atomic_write.d.ts.map +1 -0
- package/dist/market_adapter/utils/atomic_write.js +13 -0
- package/dist/market_adapter/utils/atomic_write.js.map +1 -0
- package/dist/market_adapter/utils/chain.d.ts +50 -0
- package/dist/market_adapter/utils/chain.d.ts.map +1 -0
- package/dist/market_adapter/utils/chain.js +196 -0
- package/dist/market_adapter/utils/chain.js.map +1 -0
- package/dist/market_adapter/utils/data_discovery.d.ts +6 -0
- package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -0
- package/dist/market_adapter/utils/data_discovery.js +35 -0
- package/dist/market_adapter/utils/data_discovery.js.map +1 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +15 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +60 -0
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -0
- package/dist/market_adapter/utils/file_lock.d.ts +19 -0
- package/dist/market_adapter/utils/file_lock.d.ts.map +1 -0
- package/dist/market_adapter/utils/file_lock.js +191 -0
- package/dist/market_adapter/utils/file_lock.js.map +1 -0
- package/dist/market_adapter/utils/native_history.d.ts +19 -0
- package/dist/market_adapter/utils/native_history.d.ts.map +1 -0
- package/dist/market_adapter/utils/native_history.js +172 -0
- package/dist/market_adapter/utils/native_history.js.map +1 -0
- package/dist/market_adapter/utils/paths.d.ts +5 -0
- package/dist/market_adapter/utils/paths.d.ts.map +1 -0
- package/dist/market_adapter/utils/paths.js +7 -0
- package/dist/market_adapter/utils/paths.js.map +1 -0
- package/dist/modules/account_bots.d.ts +112 -0
- package/dist/modules/account_bots.d.ts.map +1 -0
- package/dist/modules/account_bots.js +1259 -0
- package/dist/modules/account_bots.js.map +1 -0
- package/dist/modules/account_orders.d.ts +273 -0
- package/dist/modules/account_orders.d.ts.map +1 -0
- package/dist/modules/account_orders.js +662 -0
- package/dist/modules/account_orders.js.map +1 -0
- package/dist/modules/authority_resolver.d.ts +2 -0
- package/dist/modules/authority_resolver.d.ts.map +1 -0
- package/dist/modules/authority_resolver.js +231 -0
- package/dist/modules/authority_resolver.js.map +1 -0
- package/dist/modules/bitshares-native/chain_client.d.ts +38 -0
- package/dist/modules/bitshares-native/chain_client.d.ts.map +1 -0
- package/dist/modules/bitshares-native/chain_client.js +322 -0
- package/dist/modules/bitshares-native/chain_client.js.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +59 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +456 -0
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.d.ts +66 -0
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc.js +557 -0
- package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +2 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +20 -0
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -0
- package/dist/modules/bitshares-native/index.d.ts +3 -0
- package/dist/modules/bitshares-native/index.d.ts.map +1 -0
- package/dist/modules/bitshares-native/index.js +32 -0
- package/dist/modules/bitshares-native/index.js.map +1 -0
- package/dist/modules/bitshares-native/resolvers.d.ts +40 -0
- package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -0
- package/dist/modules/bitshares-native/resolvers.js +161 -0
- package/dist/modules/bitshares-native/resolvers.js.map +1 -0
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts +56 -0
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/chain_constants.js +92 -0
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -0
- package/dist/modules/bitshares-native/serial/index.d.ts +10 -0
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/index.js +14 -0
- package/dist/modules/bitshares-native/serial/index.js.map +1 -0
- package/dist/modules/bitshares-native/serial/operations.d.ts +102 -0
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/operations.js +615 -0
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -0
- package/dist/modules/bitshares-native/serial/serializer.d.ts +64 -0
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/serializer.js +252 -0
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -0
- package/dist/modules/bitshares-native/serial/types.d.ts +120 -0
- package/dist/modules/bitshares-native/serial/types.d.ts.map +1 -0
- package/dist/modules/bitshares-native/serial/types.js +837 -0
- package/dist/modules/bitshares-native/serial/types.js.map +1 -0
- package/dist/modules/bitshares-native/signing_client.d.ts +6 -0
- package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -0
- package/dist/modules/bitshares-native/signing_client.js +141 -0
- package/dist/modules/bitshares-native/signing_client.js.map +1 -0
- package/dist/modules/bitshares-native/subscriptions.d.ts +6 -0
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -0
- package/dist/modules/bitshares-native/subscriptions.js +865 -0
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -0
- package/dist/modules/bitshares-native/transport.d.ts +51 -0
- package/dist/modules/bitshares-native/transport.d.ts.map +1 -0
- package/dist/modules/bitshares-native/transport.js +447 -0
- package/dist/modules/bitshares-native/transport.js.map +1 -0
- package/dist/modules/bitshares-native/tx/builder.d.ts +30 -0
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +1 -0
- package/dist/modules/bitshares-native/tx/builder.js +262 -0
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -0
- package/dist/modules/bitshares_client.d.ts +129 -0
- package/dist/modules/bitshares_client.d.ts.map +1 -0
- package/dist/modules/bitshares_client.js +627 -0
- package/dist/modules/bitshares_client.js.map +1 -0
- package/dist/modules/bot_settings.d.ts +33 -0
- package/dist/modules/bot_settings.d.ts.map +1 -0
- package/dist/modules/bot_settings.js +328 -0
- package/dist/modules/bot_settings.js.map +1 -0
- package/dist/modules/bots_file_lock.d.ts +88 -0
- package/dist/modules/bots_file_lock.d.ts.map +1 -0
- package/dist/modules/bots_file_lock.js +161 -0
- package/dist/modules/bots_file_lock.js.map +1 -0
- package/dist/modules/chain_keys.d.ts +302 -0
- package/dist/modules/chain_keys.d.ts.map +1 -0
- package/dist/modules/chain_keys.js +1095 -0
- package/dist/modules/chain_keys.js.map +1 -0
- package/dist/modules/chain_orders.d.ts +423 -0
- package/dist/modules/chain_orders.d.ts.map +1 -0
- package/dist/modules/chain_orders.js +1201 -0
- package/dist/modules/chain_orders.js.map +1 -0
- package/dist/modules/cli_whitelist_args.d.ts +6 -0
- package/dist/modules/cli_whitelist_args.d.ts.map +1 -0
- package/dist/modules/cli_whitelist_args.js +13 -0
- package/dist/modules/cli_whitelist_args.js.map +1 -0
- package/dist/modules/config.d.ts +57 -0
- package/dist/modules/config.d.ts.map +1 -0
- package/dist/modules/config.js +107 -0
- package/dist/modules/config.js.map +1 -0
- package/dist/modules/constants.d.ts +635 -0
- package/dist/modules/constants.d.ts.map +1 -0
- package/dist/modules/constants.js +1464 -0
- package/dist/modules/constants.js.map +1 -0
- package/dist/modules/cr_planner.d.ts +51 -0
- package/dist/modules/cr_planner.d.ts.map +1 -0
- package/dist/modules/cr_planner.js +299 -0
- package/dist/modules/cr_planner.js.map +1 -0
- package/dist/modules/credential_policy.d.ts +188 -0
- package/dist/modules/credential_policy.d.ts.map +1 -0
- package/dist/modules/credential_policy.js +1452 -0
- package/dist/modules/credential_policy.js.map +1 -0
- package/dist/modules/credential_runtime.d.ts +42 -0
- package/dist/modules/credential_runtime.d.ts.map +1 -0
- package/dist/modules/credential_runtime.js +148 -0
- package/dist/modules/credential_runtime.js.map +1 -0
- package/dist/modules/credential_session_cache.d.ts +36 -0
- package/dist/modules/credential_session_cache.d.ts.map +1 -0
- package/dist/modules/credential_session_cache.js +106 -0
- package/dist/modules/credential_session_cache.js.map +1 -0
- package/dist/modules/credit_runtime.d.ts +412 -0
- package/dist/modules/credit_runtime.d.ts.map +1 -0
- package/dist/modules/credit_runtime.js +2866 -0
- package/dist/modules/credit_runtime.js.map +1 -0
- package/dist/modules/crypto/browser_provider.d.ts +15 -0
- package/dist/modules/crypto/browser_provider.d.ts.map +1 -0
- package/dist/modules/crypto/browser_provider.js +113 -0
- package/dist/modules/crypto/browser_provider.js.map +1 -0
- package/dist/modules/crypto/index.d.ts +9 -0
- package/dist/modules/crypto/index.d.ts.map +1 -0
- package/dist/modules/crypto/index.js +44 -0
- package/dist/modules/crypto/index.js.map +1 -0
- package/dist/modules/crypto/node_provider.d.ts +15 -0
- package/dist/modules/crypto/node_provider.d.ts.map +1 -0
- package/dist/modules/crypto/node_provider.js +74 -0
- package/dist/modules/crypto/node_provider.js.map +1 -0
- package/dist/modules/crypto/provider.d.ts +34 -0
- package/dist/modules/crypto/provider.d.ts.map +1 -0
- package/dist/modules/crypto/provider.js +3 -0
- package/dist/modules/crypto/provider.js.map +1 -0
- package/dist/modules/crypto/pure_ripemd160.d.ts +8 -0
- package/dist/modules/crypto/pure_ripemd160.d.ts.map +1 -0
- package/dist/modules/crypto/pure_ripemd160.js +142 -0
- package/dist/modules/crypto/pure_ripemd160.js.map +1 -0
- package/dist/modules/crypto/pure_scrypt.d.ts +23 -0
- package/dist/modules/crypto/pure_scrypt.d.ts.map +1 -0
- package/dist/modules/crypto/pure_scrypt.js +161 -0
- package/dist/modules/crypto/pure_scrypt.js.map +1 -0
- package/dist/modules/crypto/pure_secp256k1.d.ts +29 -0
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -0
- package/dist/modules/crypto/pure_secp256k1.js +195 -0
- package/dist/modules/crypto/pure_secp256k1.js.map +1 -0
- package/dist/modules/crypto/sync.d.ts +13 -0
- package/dist/modules/crypto/sync.d.ts.map +1 -0
- package/dist/modules/crypto/sync.js +37 -0
- package/dist/modules/crypto/sync.js.map +1 -0
- package/dist/modules/dexbot_class.d.ts +1074 -0
- package/dist/modules/dexbot_class.d.ts.map +1 -0
- package/dist/modules/dexbot_class.js +4613 -0
- package/dist/modules/dexbot_class.js.map +1 -0
- package/dist/modules/dexbot_credential_client.d.ts +71 -0
- package/dist/modules/dexbot_credential_client.d.ts.map +1 -0
- package/dist/modules/dexbot_credential_client.js +224 -0
- package/dist/modules/dexbot_credential_client.js.map +1 -0
- package/dist/modules/dexbot_fill_runtime.d.ts +173 -0
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_fill_runtime.js +217 -0
- package/dist/modules/dexbot_fill_runtime.js.map +1 -0
- package/dist/modules/dexbot_maintenance_runtime.d.ts +279 -0
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -0
- package/dist/modules/dexbot_maintenance_runtime.js +1613 -0
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -0
- package/dist/modules/env.d.ts +12 -0
- package/dist/modules/env.d.ts.map +1 -0
- package/dist/modules/env.js +57 -0
- package/dist/modules/env.js.map +1 -0
- package/dist/modules/fund_registry.d.ts +96 -0
- package/dist/modules/fund_registry.d.ts.map +1 -0
- package/dist/modules/fund_registry.js +261 -0
- package/dist/modules/fund_registry.js.map +1 -0
- package/dist/modules/general_settings.d.ts +36 -0
- package/dist/modules/general_settings.d.ts.map +1 -0
- package/dist/modules/general_settings.js +63 -0
- package/dist/modules/general_settings.js.map +1 -0
- package/dist/modules/graceful_shutdown.d.ts +86 -0
- package/dist/modules/graceful_shutdown.d.ts.map +1 -0
- package/dist/modules/graceful_shutdown.js +164 -0
- package/dist/modules/graceful_shutdown.js.map +1 -0
- package/dist/modules/key_store.d.ts +60 -0
- package/dist/modules/key_store.d.ts.map +1 -0
- package/dist/modules/key_store.js +215 -0
- package/dist/modules/key_store.js.map +1 -0
- package/dist/modules/launcher/bot_supervisor.d.ts +84 -0
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -0
- package/dist/modules/launcher/bot_supervisor.js +1067 -0
- package/dist/modules/launcher/bot_supervisor.js.map +1 -0
- package/dist/modules/launcher/child_env.d.ts +9 -0
- package/dist/modules/launcher/child_env.d.ts.map +1 -0
- package/dist/modules/launcher/child_env.js +78 -0
- package/dist/modules/launcher/child_env.js.map +1 -0
- package/dist/modules/launcher/credential_bootstrap.d.ts +22 -0
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +1 -0
- package/dist/modules/launcher/credential_bootstrap.js +303 -0
- package/dist/modules/launcher/credential_bootstrap.js.map +1 -0
- package/dist/modules/launcher/credential_daemon.d.ts +32 -0
- package/dist/modules/launcher/credential_daemon.d.ts.map +1 -0
- package/dist/modules/launcher/credential_daemon.js +173 -0
- package/dist/modules/launcher/credential_daemon.js.map +1 -0
- package/dist/modules/launcher/credential_secret.d.ts +6 -0
- package/dist/modules/launcher/credential_secret.d.ts.map +1 -0
- package/dist/modules/launcher/credential_secret.js +15 -0
- package/dist/modules/launcher/credential_secret.js.map +1 -0
- package/dist/modules/launcher/foreign_cred_daemon.d.ts +2 -0
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -0
- package/dist/modules/launcher/foreign_cred_daemon.js +166 -0
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -0
- package/dist/modules/launcher/headless_password.d.ts +8 -0
- package/dist/modules/launcher/headless_password.d.ts.map +1 -0
- package/dist/modules/launcher/headless_password.js +33 -0
- package/dist/modules/launcher/headless_password.js.map +1 -0
- package/dist/modules/launcher/launch_modes.d.ts +36 -0
- package/dist/modules/launcher/launch_modes.d.ts.map +1 -0
- package/dist/modules/launcher/launch_modes.js +129 -0
- package/dist/modules/launcher/launch_modes.js.map +1 -0
- package/dist/modules/launcher/market_adapter_runtime.d.ts +43 -0
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -0
- package/dist/modules/launcher/market_adapter_runtime.js +217 -0
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -0
- package/dist/modules/launcher/market_adapter_watchdog.d.ts +26 -0
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -0
- package/dist/modules/launcher/market_adapter_watchdog.js +214 -0
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -0
- package/dist/modules/launcher/monolithic_runtime.d.ts +89 -0
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -0
- package/dist/modules/launcher/monolithic_runtime.js +425 -0
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -0
- package/dist/modules/launcher/runtime_entry.d.ts +26 -0
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -0
- package/dist/modules/launcher/runtime_entry.js +49 -0
- package/dist/modules/launcher/runtime_entry.js.map +1 -0
- package/dist/modules/launcher/status_reporting.d.ts +48 -0
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -0
- package/dist/modules/launcher/status_reporting.js +113 -0
- package/dist/modules/launcher/status_reporting.js.map +1 -0
- package/dist/modules/launcher/supervisor_control.d.ts +6 -0
- package/dist/modules/launcher/supervisor_control.d.ts.map +1 -0
- package/dist/modules/launcher/supervisor_control.js +59 -0
- package/dist/modules/launcher/supervisor_control.js.map +1 -0
- package/dist/modules/logger.d.ts +2 -0
- package/dist/modules/logger.d.ts.map +1 -0
- package/dist/modules/logger.js +71 -0
- package/dist/modules/logger.js.map +1 -0
- package/dist/modules/market_adapter_whitelist.d.ts +22 -0
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -0
- package/dist/modules/market_adapter_whitelist.js +82 -0
- package/dist/modules/market_adapter_whitelist.js.map +1 -0
- package/dist/modules/node_health_cache.d.ts +55 -0
- package/dist/modules/node_health_cache.d.ts.map +1 -0
- package/dist/modules/node_health_cache.js +134 -0
- package/dist/modules/node_health_cache.js.map +1 -0
- package/dist/modules/node_manager.d.ts +215 -0
- package/dist/modules/node_manager.d.ts.map +1 -0
- package/dist/modules/node_manager.js +628 -0
- package/dist/modules/node_manager.js.map +1 -0
- package/dist/modules/order/accounting.d.ts +349 -0
- package/dist/modules/order/accounting.d.ts.map +1 -0
- package/dist/modules/order/accounting.js +1191 -0
- package/dist/modules/order/accounting.js.map +1 -0
- package/dist/modules/order/async_lock.d.ts +126 -0
- package/dist/modules/order/async_lock.d.ts.map +1 -0
- package/dist/modules/order/async_lock.js +195 -0
- package/dist/modules/order/async_lock.js.map +1 -0
- package/dist/modules/order/export.d.ts +129 -0
- package/dist/modules/order/export.d.ts.map +1 -0
- package/dist/modules/order/export.js +316 -0
- package/dist/modules/order/export.js.map +1 -0
- package/dist/modules/order/format.d.ts +158 -0
- package/dist/modules/order/format.d.ts.map +1 -0
- package/dist/modules/order/format.js +232 -0
- package/dist/modules/order/format.js.map +1 -0
- package/dist/modules/order/grid.d.ts +549 -0
- package/dist/modules/order/grid.d.ts.map +1 -0
- package/dist/modules/order/grid.js +1746 -0
- package/dist/modules/order/grid.js.map +1 -0
- package/dist/modules/order/grid_reconcile.d.ts +154 -0
- package/dist/modules/order/grid_reconcile.d.ts.map +1 -0
- package/dist/modules/order/grid_reconcile.js +1192 -0
- package/dist/modules/order/grid_reconcile.js.map +1 -0
- package/dist/modules/order/index.d.ts +55 -0
- package/dist/modules/order/index.d.ts.map +1 -0
- package/dist/modules/order/index.js +79 -0
- package/dist/modules/order/index.js.map +1 -0
- package/dist/modules/order/logger.d.ts +136 -0
- package/dist/modules/order/logger.d.ts.map +1 -0
- package/dist/modules/order/logger.js +614 -0
- package/dist/modules/order/logger.js.map +1 -0
- package/dist/modules/order/logger_state.d.ts +133 -0
- package/dist/modules/order/logger_state.d.ts.map +1 -0
- package/dist/modules/order/logger_state.js +170 -0
- package/dist/modules/order/logger_state.js.map +1 -0
- package/dist/modules/order/manager.d.ts +413 -0
- package/dist/modules/order/manager.d.ts.map +1 -0
- package/dist/modules/order/manager.js +1605 -0
- package/dist/modules/order/manager.js.map +1 -0
- package/dist/modules/order/processed_fill_store.d.ts +135 -0
- package/dist/modules/order/processed_fill_store.d.ts.map +1 -0
- package/dist/modules/order/processed_fill_store.js +288 -0
- package/dist/modules/order/processed_fill_store.js.map +1 -0
- package/dist/modules/order/runner.d.ts +70 -0
- package/dist/modules/order/runner.d.ts.map +1 -0
- package/dist/modules/order/runner.js +140 -0
- package/dist/modules/order/runner.js.map +1 -0
- package/dist/modules/order/strategy.d.ts +196 -0
- package/dist/modules/order/strategy.d.ts.map +1 -0
- package/dist/modules/order/strategy.js +398 -0
- package/dist/modules/order/strategy.js.map +1 -0
- package/dist/modules/order/sync_engine.d.ts +386 -0
- package/dist/modules/order/sync_engine.d.ts.map +1 -0
- package/dist/modules/order/sync_engine.js +1459 -0
- package/dist/modules/order/sync_engine.js.map +1 -0
- package/dist/modules/order/utils/math.d.ts +677 -0
- package/dist/modules/order/utils/math.d.ts.map +1 -0
- package/dist/modules/order/utils/math.js +1172 -0
- package/dist/modules/order/utils/math.js.map +1 -0
- package/dist/modules/order/utils/order.d.ts +572 -0
- package/dist/modules/order/utils/order.d.ts.map +1 -0
- package/dist/modules/order/utils/order.js +1145 -0
- package/dist/modules/order/utils/order.js.map +1 -0
- package/dist/modules/order/utils/system.d.ts +268 -0
- package/dist/modules/order/utils/system.d.ts.map +1 -0
- package/dist/modules/order/utils/system.js +1261 -0
- package/dist/modules/order/utils/system.js.map +1 -0
- package/dist/modules/order/utils/validate.d.ts +280 -0
- package/dist/modules/order/utils/validate.d.ts.map +1 -0
- package/dist/modules/order/utils/validate.js +918 -0
- package/dist/modules/order/utils/validate.js.map +1 -0
- package/dist/modules/order/working_grid.d.ts +212 -0
- package/dist/modules/order/working_grid.d.ts.map +1 -0
- package/dist/modules/order/working_grid.js +279 -0
- package/dist/modules/order/working_grid.js.map +1 -0
- package/dist/modules/path_api.d.ts +32 -0
- package/dist/modules/path_api.d.ts.map +1 -0
- package/dist/modules/path_api.js +148 -0
- package/dist/modules/path_api.js.map +1 -0
- package/dist/modules/paths.d.ts +58 -0
- package/dist/modules/paths.d.ts.map +1 -0
- package/dist/modules/paths.js +82 -0
- package/dist/modules/paths.js.map +1 -0
- package/dist/modules/process_discovery.d.ts +58 -0
- package/dist/modules/process_discovery.d.ts.map +1 -0
- package/dist/modules/process_discovery.js +265 -0
- package/dist/modules/process_discovery.js.map +1 -0
- package/dist/modules/runtime.d.ts +34 -0
- package/dist/modules/runtime.d.ts.map +1 -0
- package/dist/modules/runtime.js +98 -0
- package/dist/modules/runtime.js.map +1 -0
- package/dist/modules/runtime_settings.d.ts +12 -0
- package/dist/modules/runtime_settings.d.ts.map +1 -0
- package/dist/modules/runtime_settings.js +122 -0
- package/dist/modules/runtime_settings.js.map +1 -0
- package/dist/modules/settings_merge.d.ts +38 -0
- package/dist/modules/settings_merge.d.ts.map +1 -0
- package/dist/modules/settings_merge.js +246 -0
- package/dist/modules/settings_merge.js.map +1 -0
- package/dist/modules/storage/browser_adapter.d.ts +56 -0
- package/dist/modules/storage/browser_adapter.d.ts.map +1 -0
- package/dist/modules/storage/browser_adapter.js +231 -0
- package/dist/modules/storage/browser_adapter.js.map +1 -0
- package/dist/modules/storage/index.d.ts +28 -0
- package/dist/modules/storage/index.d.ts.map +1 -0
- package/dist/modules/storage/index.js +52 -0
- package/dist/modules/storage/index.js.map +1 -0
- package/dist/modules/storage/node_adapter.d.ts +49 -0
- package/dist/modules/storage/node_adapter.d.ts.map +1 -0
- package/dist/modules/storage/node_adapter.js +167 -0
- package/dist/modules/storage/node_adapter.js.map +1 -0
- package/dist/modules/storage/types.d.ts +92 -0
- package/dist/modules/storage/types.d.ts.map +1 -0
- package/dist/modules/storage/types.js +3 -0
- package/dist/modules/storage/types.js.map +1 -0
- package/dist/modules/types.d.ts +1382 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/modules/types.js +11 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/modules/utils/base58check.d.ts +12 -0
- package/dist/modules/utils/base58check.d.ts.map +1 -0
- package/dist/modules/utils/base58check.js +112 -0
- package/dist/modules/utils/base58check.js.map +1 -0
- package/dist/modules/utils/build_dir.d.ts +7 -0
- package/dist/modules/utils/build_dir.d.ts.map +1 -0
- package/dist/modules/utils/build_dir.js +8 -0
- package/dist/modules/utils/build_dir.js.map +1 -0
- package/dist/modules/utils/fs_utils.d.ts +25 -0
- package/dist/modules/utils/fs_utils.d.ts.map +1 -0
- package/dist/modules/utils/fs_utils.js +27 -0
- package/dist/modules/utils/fs_utils.js.map +1 -0
- package/dist/modules/utils/math_utils.d.ts +10 -0
- package/dist/modules/utils/math_utils.d.ts.map +1 -0
- package/dist/modules/utils/math_utils.js +17 -0
- package/dist/modules/utils/math_utils.js.map +1 -0
- package/dist/modules/validate_profiles.d.ts +37 -0
- package/dist/modules/validate_profiles.d.ts.map +1 -0
- package/dist/modules/validate_profiles.js +369 -0
- package/dist/modules/validate_profiles.js.map +1 -0
- package/dist/pm2.d.ts +167 -0
- package/dist/pm2.d.ts.map +1 -0
- package/dist/pm2.js +998 -0
- package/dist/pm2.js.map +1 -0
- package/dist/scripts/analyze-git.d.ts +11 -0
- package/dist/scripts/analyze-git.d.ts.map +1 -0
- package/dist/scripts/analyze-git.js +851 -0
- package/dist/scripts/analyze-git.js.map +1 -0
- package/dist/scripts/analyze-orders.d.ts +17 -0
- package/dist/scripts/analyze-orders.d.ts.map +1 -0
- package/dist/scripts/analyze-orders.js +1568 -0
- package/dist/scripts/analyze-orders.js.map +1 -0
- package/dist/scripts/diagnose-kibana-candles.d.ts +3 -0
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +1 -0
- package/dist/scripts/diagnose-kibana-candles.js +82 -0
- package/dist/scripts/diagnose-kibana-candles.js.map +1 -0
- package/dist/scripts/diagnose-pool-history.d.ts +3 -0
- package/dist/scripts/diagnose-pool-history.d.ts.map +1 -0
- package/dist/scripts/diagnose-pool-history.js +296 -0
- package/dist/scripts/diagnose-pool-history.js.map +1 -0
- package/dist/scripts/divergence-calc.d.ts +26 -0
- package/dist/scripts/divergence-calc.d.ts.map +1 -0
- package/dist/scripts/divergence-calc.js +119 -0
- package/dist/scripts/divergence-calc.js.map +1 -0
- package/dist/scripts/generate_lp_chart.d.ts +31 -0
- package/dist/scripts/generate_lp_chart.d.ts.map +1 -0
- package/dist/scripts/generate_lp_chart.js +92 -0
- package/dist/scripts/generate_lp_chart.js.map +1 -0
- package/dist/scripts/generate_mainnet_corpus_report.d.ts +24 -0
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +1 -0
- package/dist/scripts/generate_mainnet_corpus_report.js +237 -0
- package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -0
- package/dist/scripts/generate_market_adapter_whitelist.d.ts +2 -0
- package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -0
- package/dist/scripts/generate_market_adapter_whitelist.js +111 -0
- package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -0
- package/dist/scripts/migrate_bot_keys.d.ts +6 -0
- package/dist/scripts/migrate_bot_keys.d.ts.map +1 -0
- package/dist/scripts/migrate_bot_keys.js +301 -0
- package/dist/scripts/migrate_bot_keys.js.map +1 -0
- package/dist/scripts/native_release_gates.d.ts +3 -0
- package/dist/scripts/native_release_gates.d.ts.map +1 -0
- package/dist/scripts/native_release_gates.js +52 -0
- package/dist/scripts/native_release_gates.js.map +1 -0
- package/dist/scripts/print_grid.d.ts +16 -0
- package/dist/scripts/print_grid.d.ts.map +1 -0
- package/dist/scripts/print_grid.js +80 -0
- package/dist/scripts/print_grid.js.map +1 -0
- package/dist/scripts/run-tests.d.ts +2 -0
- package/dist/scripts/run-tests.d.ts.map +1 -0
- package/dist/scripts/run-tests.js +49 -0
- package/dist/scripts/run-tests.js.map +1 -0
- package/dist/scripts/sync-version.d.ts +14 -0
- package/dist/scripts/sync-version.d.ts.map +1 -0
- package/dist/scripts/sync-version.js +158 -0
- package/dist/scripts/sync-version.js.map +1 -0
- package/dist/scripts/test-credit-renewal.d.ts +2 -0
- package/dist/scripts/test-credit-renewal.d.ts.map +1 -0
- package/dist/scripts/test-credit-renewal.js +329 -0
- package/dist/scripts/test-credit-renewal.js.map +1 -0
- package/dist/scripts/update.d.ts +24 -0
- package/dist/scripts/update.d.ts.map +1 -0
- package/dist/scripts/update.js +650 -0
- package/dist/scripts/update.js.map +1 -0
- package/dist/scripts/validate_bots.d.ts +16 -0
- package/dist/scripts/validate_bots.d.ts.map +1 -0
- package/dist/scripts/validate_bots.js +106 -0
- package/dist/scripts/validate_bots.js.map +1 -0
- package/dist/scripts/verify-browser-bundle.d.ts +22 -0
- package/dist/scripts/verify-browser-bundle.d.ts.map +1 -0
- package/dist/scripts/verify-browser-bundle.js +339 -0
- package/dist/scripts/verify-browser-bundle.js.map +1 -0
- package/dist/unlock.d.ts +48 -0
- package/dist/unlock.d.ts.map +1 -0
- package/dist/unlock.js +925 -0
- package/dist/unlock.js.map +1 -0
- package/package.json +112 -0
- package/scripts/README.md +356 -0
- package/scripts/clear-all.sh +195 -0
- package/scripts/clear-logs.sh +95 -0
- package/scripts/clear-market-adapter.sh +196 -0
- package/scripts/clear-orders.sh +113 -0
- package/scripts/create-bot-symlinks.sh +51 -0
- package/scripts/postinstall.js +9 -0
- package/scripts/reset-settings.sh +118 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* DEXBot2 Auto-Update Script
|
|
5
|
+
*
|
|
6
|
+
* Manages pulling latest code from git repository with smart logic:
|
|
7
|
+
* - Fetches from configured remote repository
|
|
8
|
+
* - Detects if updates are available
|
|
9
|
+
* - Handles branch switching if needed
|
|
10
|
+
* - Reinstalls npm dependencies
|
|
11
|
+
* - Selectively restarts active runtime processes
|
|
12
|
+
* - Gracefully handles missing files or PM2
|
|
13
|
+
*
|
|
14
|
+
* Configuration:
|
|
15
|
+
* - Repository URL: Hardcoded in modules/constants.ts (UPDATER.REPOSITORY_URL)
|
|
16
|
+
* - Target branch: Configurable in constants.ts (UPDATER.BRANCH), supports 'auto' for auto-detection
|
|
17
|
+
*
|
|
18
|
+
* Exit codes:
|
|
19
|
+
* - 0: Update completed successfully (or already up-to-date)
|
|
20
|
+
* - 1: Update failed (with error details printed)
|
|
21
|
+
*
|
|
22
|
+
* Usage: tsx scripts/update.ts
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const { execSync } = require('child_process');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
const fs = require('fs');
|
|
28
|
+
const { sendControlCommand } = require('../modules/launcher/supervisor_control');
|
|
29
|
+
// Import update configuration from constants
|
|
30
|
+
// Contains: REPOSITORY_URL, BRANCH, BUILD_DIR settings
|
|
31
|
+
const { UPDATER, BUILD_DIR } = require('../modules/constants');
|
|
32
|
+
const { PATHS } = require('../modules/paths');
|
|
33
|
+
const { Config } = require('../modules/config');
|
|
34
|
+
const { readJSON } = require('../modules/utils/fs_utils');
|
|
35
|
+
const UPDATE_COLORS = {
|
|
36
|
+
reset: '\x1b[0m',
|
|
37
|
+
ok: '\x1b[1;92m',
|
|
38
|
+
warn: '\x1b[1;33m',
|
|
39
|
+
error: '\x1b[1;31m',
|
|
40
|
+
};
|
|
41
|
+
function colorUpdateOutput(text, color, stream = process.stdout) {
|
|
42
|
+
return stream.isTTY && !Config.NO_COLOR
|
|
43
|
+
? `${color}${text}${UPDATE_COLORS.reset}`
|
|
44
|
+
: text;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* log: Output timestamped update log message
|
|
48
|
+
*
|
|
49
|
+
* Formats: [ISO_TIMESTAMP] [UPDATE] message
|
|
50
|
+
*
|
|
51
|
+
* @param {string} msg - Message to log
|
|
52
|
+
*/
|
|
53
|
+
function log(msg) {
|
|
54
|
+
console.log(`[${new Date().toISOString()}] [UPDATE] ${msg}`);
|
|
55
|
+
}
|
|
56
|
+
function logSuccess(msg) {
|
|
57
|
+
console.log(colorUpdateOutput(`[${new Date().toISOString()}] [UPDATE] ${msg}`, UPDATE_COLORS.ok));
|
|
58
|
+
}
|
|
59
|
+
function updateError(msg) {
|
|
60
|
+
return colorUpdateOutput(msg, UPDATE_COLORS.error, process.stderr);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* run: Execute shell command with error handling
|
|
64
|
+
*
|
|
65
|
+
* Runs command with inherited stdio so user sees full output.
|
|
66
|
+
* Throws error if command fails, breaking update process.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} cmd - Shell command to execute
|
|
69
|
+
* @throws {Error} If command exits with non-zero status
|
|
70
|
+
*/
|
|
71
|
+
function run(cmd) {
|
|
72
|
+
log(`Executing: ${cmd}`);
|
|
73
|
+
try {
|
|
74
|
+
execSync(cmd, { stdio: 'inherit', cwd: PATHS.PROJECT_ROOT });
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
console.error(updateError(`[ERROR] Command failed: ${cmd}`));
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function readLivePidFile(filePath) {
|
|
82
|
+
if (!fs.existsSync(filePath))
|
|
83
|
+
return 0;
|
|
84
|
+
try {
|
|
85
|
+
const pid = Number(fs.readFileSync(filePath, 'utf8').trim());
|
|
86
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
87
|
+
return 0;
|
|
88
|
+
process.kill(pid, 0);
|
|
89
|
+
return pid;
|
|
90
|
+
}
|
|
91
|
+
catch (_) {
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function detectMonolithicRuntime() {
|
|
96
|
+
const wrapperPid = readLivePidFile(PATHS.PROFILES.MONOLITHIC_PID);
|
|
97
|
+
if (!wrapperPid)
|
|
98
|
+
return null;
|
|
99
|
+
const detected = { wrapperPid, botPid: readLivePidFile(PATHS.PROFILES.MONOLITHIC_BOT_PID), botNames: [] };
|
|
100
|
+
try {
|
|
101
|
+
const info = readJSON(PATHS.PROFILES.MONOLITHIC_BOT_INFO);
|
|
102
|
+
if (Array.isArray(info.botNames)) {
|
|
103
|
+
detected.botNames = info.botNames.map((name) => String(name));
|
|
104
|
+
}
|
|
105
|
+
else if (info.botName) {
|
|
106
|
+
detected.botNames = [String(info.botName)];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (_) { }
|
|
110
|
+
return detected;
|
|
111
|
+
}
|
|
112
|
+
function detectAnyMonolithicFiles() {
|
|
113
|
+
return fs.existsSync(PATHS.PROFILES.MONOLITHIC_PID)
|
|
114
|
+
|| fs.existsSync(PATHS.PROFILES.MONOLITHIC_BOT_INFO)
|
|
115
|
+
|| fs.existsSync(PATHS.PROFILES.MONOLITHIC_CRED_PID);
|
|
116
|
+
}
|
|
117
|
+
function restartMonolithicRuntime(monolithic) {
|
|
118
|
+
const details = [
|
|
119
|
+
`wrapper PID ${monolithic.wrapperPid}`,
|
|
120
|
+
monolithic.botPid ? `bot PID ${monolithic.botPid}` : null,
|
|
121
|
+
monolithic.botNames.length ? `bots: ${monolithic.botNames.join(', ')}` : null,
|
|
122
|
+
].filter(Boolean).join('; ');
|
|
123
|
+
log(`Monolithic runtime detected (${details}). Restarting via unlock control...`);
|
|
124
|
+
const unlockPath = fs.existsSync(path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'unlock.js'))
|
|
125
|
+
? path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'unlock.js')
|
|
126
|
+
: path.join(PATHS.PROJECT_ROOT, 'unlock.js');
|
|
127
|
+
run(`node "${unlockPath}" restart all`);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Start the monolithic daemon by invoking `node unlock`.
|
|
131
|
+
*
|
|
132
|
+
* Returns true only when the unlock command exited successfully. In
|
|
133
|
+
* non-interactive (non-TTY) mode the function prints a manual-start hint
|
|
134
|
+
* and returns false; the caller can then surface its own fallback message.
|
|
135
|
+
* On a thrown error (e.g. wrong password, user cancellation) the function
|
|
136
|
+
* logs a warning and returns false.
|
|
137
|
+
*/
|
|
138
|
+
function startMonolithicRuntime() {
|
|
139
|
+
const unlockPath = fs.existsSync(path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'unlock.js'))
|
|
140
|
+
? path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'unlock.js')
|
|
141
|
+
: path.join(PATHS.PROJECT_ROOT, 'unlock.js');
|
|
142
|
+
const isTTY = process.stdin && process.stdin.isTTY;
|
|
143
|
+
if (!isTTY) {
|
|
144
|
+
console.log(colorUpdateOutput('\n⚠️ Monolithic daemon was running before update but cannot be auto-started\n' +
|
|
145
|
+
' in non-interactive mode (no TTY).\n' +
|
|
146
|
+
' To start it manually:\n' +
|
|
147
|
+
' node unlock\n' +
|
|
148
|
+
' (or with --headless --password-file <path> for automation)\n', UPDATE_COLORS.warn));
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
log('Starting monolithic daemon (node unlock)...');
|
|
152
|
+
try {
|
|
153
|
+
execSync(`node "${unlockPath}"`, {
|
|
154
|
+
cwd: PATHS.PROJECT_ROOT,
|
|
155
|
+
stdio: 'inherit',
|
|
156
|
+
});
|
|
157
|
+
logSuccess('Monolithic daemon started.');
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
log(`Warning: Could not auto-start monolithic daemon (${err.message}). Start manually with: node unlock`);
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function hasLocalChanges() {
|
|
166
|
+
try {
|
|
167
|
+
const tracked = execSync('git diff --name-only', { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT }).toString().trim();
|
|
168
|
+
if (tracked)
|
|
169
|
+
return true;
|
|
170
|
+
const untracked = execSync('git ls-files --others --exclude-standard', { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT }).toString().trim();
|
|
171
|
+
return !!untracked;
|
|
172
|
+
}
|
|
173
|
+
catch (_) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Resolve a stash ref (e.g. `stash@{0}`) for a given stash message.
|
|
179
|
+
*
|
|
180
|
+
* Capturing the ref by message — rather than always using `stash@{0}` —
|
|
181
|
+
* makes the apply+drop pair robust against any other stash operation that
|
|
182
|
+
* may occur between push and pop (e.g. an external tool, hook, or operator
|
|
183
|
+
* action). Falls back to `stash@{0}` if the lookup fails so the script
|
|
184
|
+
* still attempts a restore.
|
|
185
|
+
*/
|
|
186
|
+
function resolveStashRef(message) {
|
|
187
|
+
try {
|
|
188
|
+
const list = execSync('git stash list --format="%gd %gs" 2>/dev/null', { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT }).toString().trim();
|
|
189
|
+
if (list) {
|
|
190
|
+
for (const line of list.split('\n')) {
|
|
191
|
+
if (line.includes(message)) {
|
|
192
|
+
return line.split(' ')[0];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (_) {
|
|
198
|
+
log('Debug: Could not enumerate stash list to resolve stash ref. Falling back to stash@{0}.');
|
|
199
|
+
}
|
|
200
|
+
return 'stash@{0}';
|
|
201
|
+
}
|
|
202
|
+
async function detectIsolatedSupervisor() {
|
|
203
|
+
try {
|
|
204
|
+
const resp = await sendControlCommand({ cmd: 'status' });
|
|
205
|
+
return resp?.ok ? resp.status || {} : null;
|
|
206
|
+
}
|
|
207
|
+
catch (_) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function restartActiveIsolatedProcesses() {
|
|
212
|
+
const status = await detectIsolatedSupervisor();
|
|
213
|
+
if (!status) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
const runningNames = Object.entries(status)
|
|
217
|
+
.filter(([name, info]) => name !== 'dexbot-update' && info && info.status === 'running')
|
|
218
|
+
.map(([name]) => name);
|
|
219
|
+
if (runningNames.length === 0) {
|
|
220
|
+
log('No active isolated processes are currently running. Skipping supervisor restart.');
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
log(`Active isolated processes detected: ${runningNames.join(', ')}`);
|
|
224
|
+
await sendControlCommand({ cmd: 'restart-running' });
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
(async () => {
|
|
228
|
+
try {
|
|
229
|
+
// Change to project root for all git operations
|
|
230
|
+
process.chdir(PATHS.PROJECT_ROOT);
|
|
231
|
+
log('Starting DEXBot2 update process...');
|
|
232
|
+
// Get configured repository URL and target branch
|
|
233
|
+
const repoUrl = UPDATER.REPOSITORY_URL;
|
|
234
|
+
let branch = UPDATER.BRANCH;
|
|
235
|
+
/**
|
|
236
|
+
* STEP 1: Validate Git Repository
|
|
237
|
+
* Ensures .git directory exists so we can perform git operations
|
|
238
|
+
*/
|
|
239
|
+
if (!fs.existsSync(path.join(PATHS.PROJECT_ROOT, '.git'))) {
|
|
240
|
+
throw new Error('Not a git repository. If installed from npm, run: npm update -g dexbot');
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* STEP 2: Detect Current Branch
|
|
244
|
+
* Gets the current checked-out branch name
|
|
245
|
+
*/
|
|
246
|
+
log('Checking for updates...');
|
|
247
|
+
let currentBranch;
|
|
248
|
+
try {
|
|
249
|
+
// Get detached/attached branch name
|
|
250
|
+
currentBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
|
251
|
+
}
|
|
252
|
+
catch (e) {
|
|
253
|
+
// Fallback if command fails
|
|
254
|
+
currentBranch = 'unknown';
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* STEP 3: Handle Branch Auto-Detection
|
|
258
|
+
* If UPDATER.BRANCH is 'auto', detect or default to 'main'
|
|
259
|
+
* Otherwise use the configured branch name
|
|
260
|
+
*/
|
|
261
|
+
if (branch === 'auto') {
|
|
262
|
+
if (currentBranch === 'HEAD' || currentBranch === 'unknown') {
|
|
263
|
+
// Detached HEAD or unknown state - default to main
|
|
264
|
+
branch = 'main';
|
|
265
|
+
log(`Could not detect current branch, defaulting to: ${branch}`);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
// Auto-detect: use current branch
|
|
269
|
+
branch = currentBranch;
|
|
270
|
+
log(`Detected current branch: ${branch}`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* STEP 4: Verify/Fix Remote Configuration
|
|
275
|
+
* Ensures origin points to the correct repository URL
|
|
276
|
+
* Updates URL if it differs, or adds origin remote if missing
|
|
277
|
+
*/
|
|
278
|
+
try {
|
|
279
|
+
const currentRemote = execSync('git remote get-url origin', { stdio: 'pipe' }).toString().trim();
|
|
280
|
+
log(`Remote origin already configured (${currentRemote}). Keeping existing remote.`);
|
|
281
|
+
}
|
|
282
|
+
catch (e) {
|
|
283
|
+
// Remote doesn't exist, add it from config
|
|
284
|
+
log(`Adding origin remote: ${repoUrl}`);
|
|
285
|
+
run(`git remote add origin ${repoUrl}`);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* STEP 5: Check for Available Updates
|
|
289
|
+
* Fetches remote branch metadata and compares with local
|
|
290
|
+
*/
|
|
291
|
+
run(`git fetch origin ${branch}`);
|
|
292
|
+
// Get current commit hashes for comparison
|
|
293
|
+
const localHash = execSync('git rev-parse HEAD').toString().trim();
|
|
294
|
+
const remoteHash = execSync(`git rev-parse origin/${branch}`).toString().trim();
|
|
295
|
+
/**
|
|
296
|
+
* Check for incoming commits
|
|
297
|
+
* git rev-list --count HEAD..origin/branch = commits that exist remotely but not locally
|
|
298
|
+
* This is the core check: if > 0, updates are available
|
|
299
|
+
*/
|
|
300
|
+
const incomingCommits = parseInt(execSync(`git rev-list --count HEAD..origin/${branch}`).toString().trim(), 10);
|
|
301
|
+
const updatesAvailable = incomingCommits > 0;
|
|
302
|
+
const branchSwitchNeeded = currentBranch !== branch;
|
|
303
|
+
/**
|
|
304
|
+
* Decision Logic for Update Flow
|
|
305
|
+
*
|
|
306
|
+
* Three scenarios are possible:
|
|
307
|
+
* 1. NO incoming updates (updatesAvailable = false)
|
|
308
|
+
* - Local is either equal to or ahead of remote
|
|
309
|
+
* - Action: Switch branch if needed, then exit cleanly
|
|
310
|
+
* 2. Incoming updates available (updatesAvailable = true)
|
|
311
|
+
* - Remote has new commits we need to pull
|
|
312
|
+
* - Action: Proceed with full update (pull, npm install, restart runtimes)
|
|
313
|
+
*/
|
|
314
|
+
if (!updatesAvailable) {
|
|
315
|
+
// No updates available - check if branch switch is needed
|
|
316
|
+
if (branchSwitchNeeded) {
|
|
317
|
+
log(`Aligning branch reference: ${currentBranch} -> ${branch} (no incoming updates).`);
|
|
318
|
+
run(`git checkout ${branch}`);
|
|
319
|
+
log('DEXBot2 is now tracking the correct branch.');
|
|
320
|
+
}
|
|
321
|
+
log('DEXBot2 is already up to date (local is equal or ahead of remote).');
|
|
322
|
+
process.exit(0);
|
|
323
|
+
}
|
|
324
|
+
log(`${incomingCommits} update(s) available. Proceeding with update process...`);
|
|
325
|
+
// List changes
|
|
326
|
+
console.log('\n----------------------------------------------------------------');
|
|
327
|
+
console.log('Incoming Changes:');
|
|
328
|
+
try {
|
|
329
|
+
execSync(`git log --oneline --graph --decorate HEAD..origin/${branch}`, { stdio: 'inherit', cwd: PATHS.PROJECT_ROOT });
|
|
330
|
+
}
|
|
331
|
+
catch (e) {
|
|
332
|
+
log('Warning: Could not list changes.');
|
|
333
|
+
}
|
|
334
|
+
console.log('----------------------------------------------------------------\n');
|
|
335
|
+
/**
|
|
336
|
+
* STEP 6a: Snapshot pre-update runtime state
|
|
337
|
+
*
|
|
338
|
+
* Detect whether the monolithic daemon is alive BEFORE we touch git.
|
|
339
|
+
* The daemon may shut down during git/npm operations (e.g. prepare
|
|
340
|
+
* hook or build), erasing its PID file. By capturing state up front,
|
|
341
|
+
* we can still restart it after the build completes.
|
|
342
|
+
*/
|
|
343
|
+
const monolithicWasRunning = !!detectMonolithicRuntime();
|
|
344
|
+
const hadMonolithicFiles = detectAnyMonolithicFiles();
|
|
345
|
+
if (monolithicWasRunning) {
|
|
346
|
+
log('Monolithic daemon detected running before update. Will restart after build.');
|
|
347
|
+
}
|
|
348
|
+
else if (hadMonolithicFiles) {
|
|
349
|
+
log('Monolithic PID/file artifacts found but daemon is not alive. Will attempt restart after build.');
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* STEP 6b: Prepare Working Directory
|
|
353
|
+
* Stashes local changes to ensure a clean pull.
|
|
354
|
+
* Skips stash entirely if there are no local changes (avoids creating
|
|
355
|
+
* orphaned empty stash entries).
|
|
356
|
+
* Ignores gitignored directories (profiles/, dist/) — they are
|
|
357
|
+
* never touched by stash, so bot configs and keys are safe.
|
|
358
|
+
*/
|
|
359
|
+
let stashed = false;
|
|
360
|
+
const STASH_MESSAGE = 'dexbot-update-auto';
|
|
361
|
+
if (hasLocalChanges()) {
|
|
362
|
+
log('Stashing local changes before pull...');
|
|
363
|
+
run(`git stash push --include-untracked --message "${STASH_MESSAGE}" 2>/dev/null; true`);
|
|
364
|
+
stashed = true;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
log('No local changes — skipping stash.');
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* STEP 7: Pull Latest Code Changes
|
|
371
|
+
* Switches branch if needed, then pulls remote changes
|
|
372
|
+
*/
|
|
373
|
+
if (currentBranch !== branch) {
|
|
374
|
+
log(`Switching to branch: ${branch}...`);
|
|
375
|
+
run(`git checkout ${branch}`);
|
|
376
|
+
}
|
|
377
|
+
log(`Pulling latest changes from ${repoUrl} (branch: ${branch})...`);
|
|
378
|
+
// Use --rebase to avoid merge commits and keep clean linear history
|
|
379
|
+
run(`git pull --rebase origin ${branch}`);
|
|
380
|
+
/**
|
|
381
|
+
* Restore stashed changes using apply + explicit drop.
|
|
382
|
+
*
|
|
383
|
+
* Using `git stash apply` instead of `git stash pop` avoids the stash
|
|
384
|
+
* leak bug: `pop` keeps the stash entry when conflicts occur, causing
|
|
385
|
+
* orphaned entries to accumulate across runs. `apply` always preserves
|
|
386
|
+
* the stash, so we clean it up unconditionally with `git stash drop`.
|
|
387
|
+
*
|
|
388
|
+
* If the apply produces merge conflicts we auto-resolve by keeping
|
|
389
|
+
* the stashed (user-local) version with `--theirs`. In a `git stash
|
|
390
|
+
* apply` 3-way merge, `--ours` is the current worktree (the pulled-in
|
|
391
|
+
* remote content) and `--theirs` is the stashed content (the user's
|
|
392
|
+
* local edits). Local changes take precedence over incoming remote.
|
|
393
|
+
*/
|
|
394
|
+
if (stashed) {
|
|
395
|
+
const stashRef = resolveStashRef(STASH_MESSAGE);
|
|
396
|
+
log('Restoring stashed changes...');
|
|
397
|
+
try {
|
|
398
|
+
execSync(`git stash apply ${stashRef} 2>/dev/null`, { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT });
|
|
399
|
+
}
|
|
400
|
+
catch (_) {
|
|
401
|
+
// Apply had conflicts — auto-resolve in favor of the stashed (local) content
|
|
402
|
+
log('Stash apply had conflicts, auto-resolving in favor of local changes...');
|
|
403
|
+
try {
|
|
404
|
+
execSync('git checkout --theirs -- . 2>/dev/null', { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT });
|
|
405
|
+
}
|
|
406
|
+
catch (_2) { }
|
|
407
|
+
}
|
|
408
|
+
// Unconditionally drop the stash entry — no orphan accumulation
|
|
409
|
+
try {
|
|
410
|
+
execSync(`git stash drop ${stashRef} 2>/dev/null`, { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT });
|
|
411
|
+
}
|
|
412
|
+
catch (_) {
|
|
413
|
+
log('Warning: Could not drop stash entry — it may have been already dropped.');
|
|
414
|
+
}
|
|
415
|
+
// Check for leftover unmerged paths and resolve them
|
|
416
|
+
try {
|
|
417
|
+
const unmergedRaw = execSync('git diff --name-only --diff-filter=U', { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT }).toString().trim();
|
|
418
|
+
if (unmergedRaw) {
|
|
419
|
+
const unmerged = unmergedRaw.split('\n').filter(Boolean);
|
|
420
|
+
log(`Cleaning up ${unmerged.length} unresolved merge marker(s) after stash restore...`);
|
|
421
|
+
execSync(`git checkout --theirs -- ${unmerged.join(' ')} 2>/dev/null`, { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT });
|
|
422
|
+
// If package-lock.json was conflicted, regenerate it so it's
|
|
423
|
+
// consistent with the (potentially updated) package.json
|
|
424
|
+
if (unmerged.includes('package-lock.json')) {
|
|
425
|
+
log('package-lock.json was conflicted — regenerating...');
|
|
426
|
+
execSync('npm install --prefer-offline --ignore-scripts 2>&1', { stdio: 'pipe', cwd: PATHS.PROJECT_ROOT });
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
catch (_) { }
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* STEP 8: Reinstall Dependencies
|
|
434
|
+
* Updates npm packages to versions specified in package-lock.json.
|
|
435
|
+
* --ignore-scripts prevents npm from running the package `prepare` hook,
|
|
436
|
+
* which would build once here before the explicit build step below.
|
|
437
|
+
* --prefer-offline: Uses cached packages when possible
|
|
438
|
+
*/
|
|
439
|
+
log('Updating dependencies...');
|
|
440
|
+
run('npm install --prefer-offline --ignore-scripts');
|
|
441
|
+
/**
|
|
442
|
+
* STEP 8b: Build TypeScript sources
|
|
443
|
+
*
|
|
444
|
+
* Do NOT rely on the npm `prepare` hook. The `prepare` script only re-fires
|
|
445
|
+
* when package.json itself changes, not when only .ts source files are
|
|
446
|
+
* updated. After a `git pull` that touches only .ts files, `npm install`
|
|
447
|
+
* is a no-op, `tsc` never runs, and the running bot process keeps loading
|
|
448
|
+
* the stale dist/ bundle — with no error surfaced to the operator.
|
|
449
|
+
*
|
|
450
|
+
* Always run the explicit build here so the next PM2 restart picks up
|
|
451
|
+
* the new code. The staleness check at the end of this step is defense
|
|
452
|
+
* in depth: if the build silently no-ops (e.g. tsc crashed, output path
|
|
453
|
+
* missing), the update aborts before PM2 is restarted.
|
|
454
|
+
*/
|
|
455
|
+
log('Building TypeScript sources (npm run build)...');
|
|
456
|
+
run('npm run build');
|
|
457
|
+
const SOURCE_MARKER = path.join(PATHS.PROJECT_ROOT, 'modules', 'dexbot_class.ts');
|
|
458
|
+
const DIST_MARKER = path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'modules', 'dexbot_class.js');
|
|
459
|
+
if (fs.existsSync(SOURCE_MARKER)) {
|
|
460
|
+
if (!fs.existsSync(DIST_MARKER)) {
|
|
461
|
+
throw new Error(`Build did not produce ${BUILD_DIR}/modules/dexbot_class.js. ` +
|
|
462
|
+
`Refusing to restart PM2 with a missing bundle. ` +
|
|
463
|
+
`Run \`npm run build\` manually and inspect tsc output.`);
|
|
464
|
+
}
|
|
465
|
+
const srcStat = fs.statSync(SOURCE_MARKER);
|
|
466
|
+
const distStat = fs.statSync(DIST_MARKER);
|
|
467
|
+
if (distStat.mtimeMs < srcStat.mtimeMs) {
|
|
468
|
+
throw new Error(`Build did not refresh ${BUILD_DIR}/modules/dexbot_class.js ` +
|
|
469
|
+
`(src mtime=${srcStat.mtime.toISOString()}, ` +
|
|
470
|
+
`${BUILD_DIR} mtime=${distStat.mtime.toISOString()}). ` +
|
|
471
|
+
`Refusing to restart PM2 with a stale bundle. ` +
|
|
472
|
+
`Run \`npm run build\` manually and inspect tsc output.`);
|
|
473
|
+
}
|
|
474
|
+
log(`${BUILD_DIR}/ is fresh (mtime=${distStat.mtime.toISOString()}).`);
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* STEP 8c: Regenerate Ecosystem Config
|
|
478
|
+
* Ensures profiles/ecosystem.config.js reflects the current bots.json
|
|
479
|
+
* state, including service apps like dexbot-adapter and dexbot-update.
|
|
480
|
+
* Uses the compiled dist/pm2.js (after TS build) for correct dist/ paths.
|
|
481
|
+
*/
|
|
482
|
+
log('Regenerating PM2 ecosystem config...');
|
|
483
|
+
try {
|
|
484
|
+
// Try loading from compiled dist/ first, then fall back to source dir
|
|
485
|
+
let generateEcosystemConfig;
|
|
486
|
+
try {
|
|
487
|
+
({ generateEcosystemConfig } = require(path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'pm2')));
|
|
488
|
+
}
|
|
489
|
+
catch (_) {
|
|
490
|
+
({ generateEcosystemConfig } = require(path.join(PATHS.PROJECT_ROOT, 'pm2')));
|
|
491
|
+
}
|
|
492
|
+
generateEcosystemConfig({ clawOnly: false, exitOnError: false });
|
|
493
|
+
log('Ecosystem config regenerated successfully.');
|
|
494
|
+
}
|
|
495
|
+
catch (err) {
|
|
496
|
+
log(`Warning: Ecosystem config regeneration failed (${err.message}). Continuing with existing config.`);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* STEP 9: Restart Active Runtime Processes
|
|
500
|
+
* Intelligently restarts only the bots that were active before update
|
|
501
|
+
* This approach:
|
|
502
|
+
* - Preserves PM2 state if not running
|
|
503
|
+
* - Restarts active bots to pick up code changes
|
|
504
|
+
* - Handles missing bots.json gracefully
|
|
505
|
+
* - Never restarts dexbot-cred through bulk PM2 actions
|
|
506
|
+
*
|
|
507
|
+
* Uses the pre-update snapshot (monolithicWasRunning) as a fallback:
|
|
508
|
+
* if the daemon shut down during git/npm ops and its PID file is gone,
|
|
509
|
+
* we still attempt to restart it.
|
|
510
|
+
*/
|
|
511
|
+
let restarted = false;
|
|
512
|
+
log('Restarting active runtime processes...');
|
|
513
|
+
try {
|
|
514
|
+
if (Config.DEXBOT_UPDATE_SKIP_RELOAD) {
|
|
515
|
+
log('Restart skipped (managed by launcher).');
|
|
516
|
+
restarted = true;
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
const monolithic = detectMonolithicRuntime();
|
|
520
|
+
if (monolithic) {
|
|
521
|
+
restartMonolithicRuntime(monolithic);
|
|
522
|
+
restarted = true;
|
|
523
|
+
}
|
|
524
|
+
else if (await restartActiveIsolatedProcesses()) {
|
|
525
|
+
log('Isolated supervisor runtime restarted.');
|
|
526
|
+
restarted = true;
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
const BOTS_FILE = PATHS.PROFILES.BOTS_JSON;
|
|
530
|
+
if (fs.existsSync(BOTS_FILE)) {
|
|
531
|
+
const raw = fs.readFileSync(BOTS_FILE, 'utf8');
|
|
532
|
+
const stripped = raw.replace(/\/\*(?:.|[\r\n])*?\*\//g, '').replace(/(^|\s*)\/\/.*$/gm, '');
|
|
533
|
+
const config = JSON.parse(stripped);
|
|
534
|
+
const activeInConfig = (config.bots || [])
|
|
535
|
+
.filter(b => b.active !== false)
|
|
536
|
+
.map(b => b.name)
|
|
537
|
+
.filter(name => !!name);
|
|
538
|
+
if (activeInConfig.length > 0) {
|
|
539
|
+
let runningProcesses = [];
|
|
540
|
+
try {
|
|
541
|
+
const output = execSync('pm2 jlist').toString().trim();
|
|
542
|
+
const jsonStart = output.indexOf('[');
|
|
543
|
+
if (jsonStart !== -1) {
|
|
544
|
+
const jsonPart = output.substring(jsonStart);
|
|
545
|
+
const parsed = JSON.parse(jsonPart);
|
|
546
|
+
runningProcesses = parsed.map(p => p.name);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
log('Warning: PM2 jlist output did not contain JSON array.');
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
catch (e) {
|
|
553
|
+
log('Warning: Could not fetch PM2 process list. Falling back to config-only detection.');
|
|
554
|
+
runningProcesses = activeInConfig;
|
|
555
|
+
}
|
|
556
|
+
const botsToRestart = activeInConfig.filter(name => runningProcesses.includes(name));
|
|
557
|
+
const activeBots = (config.bots || []).filter(b => b.active !== false);
|
|
558
|
+
const runningActiveBots = activeBots.filter(b => runningProcesses.includes(b.name));
|
|
559
|
+
let needsMarketAdapter;
|
|
560
|
+
try {
|
|
561
|
+
({ needsMarketAdapter } = require(path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'pm2')));
|
|
562
|
+
}
|
|
563
|
+
catch (_) {
|
|
564
|
+
({ needsMarketAdapter } = require(path.join(PATHS.PROJECT_ROOT, 'pm2')));
|
|
565
|
+
}
|
|
566
|
+
const marketAdapterRequired = needsMarketAdapter(runningActiveBots);
|
|
567
|
+
const serviceAppsToRestart = marketAdapterRequired ? ['dexbot-adapter'] : [];
|
|
568
|
+
const servicesToRestart = serviceAppsToRestart.filter(name => runningProcesses.includes(name));
|
|
569
|
+
const allToRestart = [...botsToRestart, ...servicesToRestart];
|
|
570
|
+
if (allToRestart.length > 0) {
|
|
571
|
+
log(`Active processes detected: ${allToRestart.join(', ')}`);
|
|
572
|
+
for (const name of allToRestart) {
|
|
573
|
+
try {
|
|
574
|
+
run(`pm2 restart "${name}"`);
|
|
575
|
+
}
|
|
576
|
+
catch (e) {
|
|
577
|
+
log(`Warning: Failed to restart process "${name}" (it might not be running).`);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
restarted = true;
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
log('No active processes currently running in PM2. Skipping restart.');
|
|
584
|
+
}
|
|
585
|
+
if (marketAdapterRequired && !runningProcesses.includes('dexbot-adapter')) {
|
|
586
|
+
log('dexbot-adapter is required by an AMA-grid bot but not running. Starting from ecosystem...');
|
|
587
|
+
try {
|
|
588
|
+
run('pm2 start profiles/ecosystem.config.js --only dexbot-adapter');
|
|
589
|
+
}
|
|
590
|
+
catch (e) {
|
|
591
|
+
log('Warning: Failed to start dexbot-adapter from ecosystem config.');
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
log('No active bots found in config.');
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
log('Warning: profiles/bots.json not found, skipping selective restart.');
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
catch (err) {
|
|
606
|
+
log(`Warning: runtime restart logic failed (${err.message}). Skipping bulk restart to avoid touching dexbot-cred.`);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* STEP 9b: Fallback restart for monolithic daemon
|
|
610
|
+
*
|
|
611
|
+
* If the monolithic daemon was running (or had state files) before the
|
|
612
|
+
* update but is no longer alive (common when the daemon is killed during
|
|
613
|
+
* git/npm operations like the prepare hook), try to auto-start it.
|
|
614
|
+
* This prevents the "bot updated but is not running" failure mode.
|
|
615
|
+
*
|
|
616
|
+
* Only mark `restarted` true when startMonolithicRuntime reports
|
|
617
|
+
* success — otherwise fall through to the manual-start instructions
|
|
618
|
+
* below so the operator knows the daemon did not actually come back.
|
|
619
|
+
*/
|
|
620
|
+
if (!restarted && !Config.DEXBOT_UPDATE_SKIP_RELOAD) {
|
|
621
|
+
if (monolithicWasRunning || hadMonolithicFiles) {
|
|
622
|
+
log('Monolithic daemon was detected before update but is no longer running. Auto-starting...');
|
|
623
|
+
if (startMonolithicRuntime()) {
|
|
624
|
+
restarted = true;
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
log('Auto-start did not succeed; the manual-start instructions below apply.');
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
if (!restarted) {
|
|
632
|
+
console.log(colorUpdateOutput('\n⚠️ No active runtime was restarted.\n' +
|
|
633
|
+
' If the daemon was running before, start it manually from a terminal:\n' +
|
|
634
|
+
' node unlock\n' +
|
|
635
|
+
' (will prompt for master password; add --foreground for interactive mode)\n' +
|
|
636
|
+
' For non-interactive automation:\n' +
|
|
637
|
+
' node unlock --headless --password-file <path>\n', UPDATE_COLORS.warn));
|
|
638
|
+
}
|
|
639
|
+
logSuccess('DEXBot2 update completed successfully.');
|
|
640
|
+
process.exit(0);
|
|
641
|
+
}
|
|
642
|
+
catch (err) {
|
|
643
|
+
console.error(updateError('=========================================='));
|
|
644
|
+
console.error(updateError('UPDATE FAILED'));
|
|
645
|
+
console.error(updateError(`Error: ${err.message}`));
|
|
646
|
+
console.error(updateError('=========================================='));
|
|
647
|
+
process.exit(1);
|
|
648
|
+
}
|
|
649
|
+
})();
|
|
650
|
+
//# sourceMappingURL=update.js.map
|