dexbot 1.6.7 → 1.6.8
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/CHANGELOG.md +49 -1
- package/README.md +3 -3
- package/analysis/README.md +2 -3
- package/analysis/tradingview/README.md +78 -1
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +4 -0
- package/dist/analysis/tradingview/analyze_tradingview.js +55 -0
- package/dist/analysis/tradingview/grid_reset_config.d.ts +61 -0
- package/dist/analysis/tradingview/grid_reset_config.js +235 -0
- package/dist/analysis/tradingview/grid_reset_sim.d.ts +67 -0
- package/dist/analysis/tradingview/grid_reset_sim.js +307 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +419 -3
- package/dist/dexbot.js +22 -6
- package/dist/market_adapter/core/market_adapter_service.js +14 -2
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +8 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +5 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +97 -19
- package/dist/market_adapter/inputs/window_cache.js +302 -48
- package/dist/market_adapter/market_adapter.d.ts +8 -1
- package/dist/market_adapter/market_adapter.js +22 -4
- package/dist/modules/account_bots.js +10 -0
- package/dist/modules/account_orders.d.ts +24 -2
- package/dist/modules/account_orders.js +41 -4
- package/dist/modules/bot_settings.js +10 -1
- package/dist/modules/config.d.ts +1 -0
- package/dist/modules/config.js +1 -0
- package/dist/modules/constants.d.ts +11 -3
- package/dist/modules/constants.js +116 -37
- package/dist/modules/dexbot_class.d.ts +6 -76
- package/dist/modules/dexbot_class.js +0 -32
- package/dist/modules/dexbot_cow_runtime.d.ts +3 -58
- package/dist/modules/dexbot_cow_runtime.js +4 -87
- package/dist/modules/dexbot_maintenance_runtime.d.ts +15 -1
- package/dist/modules/dexbot_maintenance_runtime.js +59 -11
- package/dist/modules/dexbot_startup_runtime.js +73 -20
- package/dist/modules/dexbot_state_recovery.d.ts +6 -0
- package/dist/modules/dexbot_state_recovery.js +21 -0
- package/dist/modules/order/async_lock.d.ts +8 -0
- package/dist/modules/order/async_lock.js +15 -0
- package/dist/modules/order/genesis_policy.d.ts +162 -0
- package/dist/modules/order/genesis_policy.js +267 -0
- package/dist/modules/order/grid.js +76 -134
- package/dist/modules/order/grid_reconcile.d.ts +9 -0
- package/dist/modules/order/grid_reconcile.js +13 -4
- package/dist/modules/order/grid_reconcile_internal.js +2 -2
- package/dist/modules/order/manager.d.ts +4 -0
- package/dist/modules/order/manager.js +14 -1
- package/dist/modules/order/sync_engine.d.ts +19 -0
- package/dist/modules/order/sync_engine.js +284 -344
- package/dist/modules/order/utils/math.d.ts +22 -1
- package/dist/modules/order/utils/math.js +64 -1
- package/dist/modules/order/utils/order.d.ts +43 -58
- package/dist/modules/order/utils/order.js +220 -197
- package/dist/modules/order/utils/system.js +8 -1
- package/dist/modules/paths.d.ts +1 -0
- package/dist/modules/paths.js +1 -0
- package/dist/modules/version_notice.d.ts +165 -0
- package/dist/modules/version_notice.js +364 -0
- package/dist/pm2.js +9 -0
- package/dist/unlock.js +28 -0
- package/docs/BITSHARES_ONBOARDING.md +8 -1
- package/docs/COW_INVARIANTS.md +3 -2
- package/docs/DEXBOT_COMPARISON.md +4 -4
- package/docs/EVOLUTION.md +20 -19
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_PRICE_INVARIANT.md +149 -31
- package/docs/GRID_RECALCULATION.md +12 -0
- package/docs/README.md +3 -1
- package/docs/WORKFLOW.md +16 -5
- package/market_adapter/README.md +1 -1
- package/modules/README.md +18 -1
- package/package.json +13 -5
- package/scripts/README.md +28 -2
- package/scripts/clear-all.sh +13 -4
- package/scripts/clear-logs.sh +13 -4
- package/scripts/clear-market-adapter.sh +6 -0
- package/scripts/clear-orders.sh +5 -0
- package/scripts/lib/dexbot-paths.sh +108 -0
- package/tests/README.md +11 -3
- package/analysis/account_resolver.ts +0 -161
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +0 -155
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +0 -404
- package/analysis/ama_fitting/calibrate_convergence_er.ts +0 -201
- package/analysis/ama_fitting/fetch_lp_candles.ts +0 -184
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +0 -232
- package/analysis/ama_fitting/optimizer_high_resolution.ts +0 -802
- package/analysis/analyze_dynamic_weight.ts +0 -243
- package/analysis/analyze_kalman.ts +0 -157
- package/analysis/analyze_regime.ts +0 -158
- package/analysis/analyze_regime_windows.ts +0 -470
- package/analysis/analyze_risk_profile.ts +0 -199
- package/analysis/analyze_trade_heatmap.ts +0 -362
- package/analysis/analyze_volatility.ts +0 -182
- package/analysis/bot_fitting/backtest_ama_sweep.ts +0 -934
- package/analysis/bot_fitting/backtest_bot_fitting.ts +0 -861
- package/analysis/bot_fitting/shared_utils.ts +0 -52
- package/analysis/bot_key_utils.ts +0 -426
- package/analysis/bot_usage/discover_bot_accounts.ts +0 -635
- package/analysis/bot_usage/kibana_bot_queries.ts +0 -211
- package/analysis/chain_pool.ts +0 -47
- package/analysis/chart_css.ts +0 -62
- package/analysis/chart_ui.ts +0 -105
- package/analysis/chart_utils.ts +0 -210
- package/analysis/fills_source.ts +0 -228
- package/analysis/grid_correction_check.ts +0 -786
- package/analysis/math_utils.ts +0 -53
- package/analysis/price_sources.ts +0 -136
- package/analysis/resolve_bot_accounts.ts +0 -199
- package/analysis/resolve_source.ts +0 -99
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
- package/analysis/trade_profitability.ts +0 -1335
- package/analysis/tradingview/analyze_tradingview.ts +0 -280
- package/analysis/tradingview/h-bts_tradingview.html +0 -1570
- package/analysis/tradingview/t-bts_tradingview.html +0 -1570
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +0 -3268
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +0 -1481
- package/analysis/trend_detection/hurst_analyzer.ts +0 -7
- package/analysis/trend_detection/kalman_chart_generator.ts +0 -398
- package/analysis/trend_detection/kalman_trend_analyzer.ts +0 -9
- package/analysis/trend_detection/kalman_velocity_smoothing.ts +0 -7
- package/analysis/trend_detection/package.json +0 -23
- package/analysis/trend_detection/permutation_entropy_analyzer.ts +0 -7
- package/analysis/trend_detection/regime_chart_generator.ts +0 -338
- package/analysis/trend_detection/tests/test_kalman_trend.ts +0 -153
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +0 -64
- package/analysis/trend_detection/volatility_chart_generator.ts +0 -654
- package/analysis/tsconfig.json +0 -29
- package/claw/tests/package.json +0 -3
- package/claw/tests/test_claw_bridge.ts +0 -570
- package/claw/tests/test_claw_catalog_and_credentials.ts +0 -156
- package/claw/tests/test_claw_chain_layer.ts +0 -739
- package/claw/tests/test_claw_data_flow.ts +0 -525
- package/claw/tests/test_claw_domain_logic.ts +0 -471
- package/claw/tests/test_claw_manifest_and_matrix.ts +0 -222
- package/claw/tests/test_claw_mcp_transport.ts +0 -243
- package/claw/tests/test_claw_regressions.ts +0 -711
- package/claw/tests/test_claw_skill_generation.ts +0 -103
- package/claw/tests/test_claw_state_store.ts +0 -44
- package/claw/tests/test_dexbot_profiles.ts +0 -654
- package/claw/tests/test_memu_bridge.ts +0 -189
- package/claw/tests/test_nullclaw_tmp_integration.ts +0 -57
- package/claw/tests/test_position_health.ts +0 -343
- package/claw/tests/test_position_manager.ts +0 -429
- package/claw/tests/test_position_manager_watch_health.ts +0 -100
- package/claw/tests/test_short_mpa_strategy.ts +0 -232
- package/dist/analysis/account_resolver.d.ts.map +0 -1
- package/dist/analysis/account_resolver.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
- package/dist/analysis/analyze_kalman.d.ts.map +0 -1
- package/dist/analysis/analyze_kalman.js.map +0 -1
- package/dist/analysis/analyze_regime.d.ts.map +0 -1
- package/dist/analysis/analyze_regime.js.map +0 -1
- package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
- package/dist/analysis/analyze_regime_windows.js.map +0 -1
- package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
- package/dist/analysis/analyze_risk_profile.js.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
- package/dist/analysis/analyze_volatility.d.ts.map +0 -1
- package/dist/analysis/analyze_volatility.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
- package/dist/analysis/bot_key_utils.d.ts.map +0 -1
- package/dist/analysis/bot_key_utils.js.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
- package/dist/analysis/chain_pool.d.ts.map +0 -1
- package/dist/analysis/chain_pool.js.map +0 -1
- package/dist/analysis/chart_css.d.ts.map +0 -1
- package/dist/analysis/chart_css.js.map +0 -1
- package/dist/analysis/chart_ui.d.ts.map +0 -1
- package/dist/analysis/chart_ui.js.map +0 -1
- package/dist/analysis/chart_utils.d.ts.map +0 -1
- package/dist/analysis/chart_utils.js.map +0 -1
- package/dist/analysis/fills_source.d.ts.map +0 -1
- package/dist/analysis/fills_source.js.map +0 -1
- package/dist/analysis/grid_correction_check.d.ts.map +0 -1
- package/dist/analysis/grid_correction_check.js.map +0 -1
- package/dist/analysis/math_utils.d.ts.map +0 -1
- package/dist/analysis/math_utils.js.map +0 -1
- package/dist/analysis/price_sources.d.ts.map +0 -1
- package/dist/analysis/price_sources.js.map +0 -1
- package/dist/analysis/resolve_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/resolve_bot_accounts.js.map +0 -1
- package/dist/analysis/resolve_source.d.ts.map +0 -1
- package/dist/analysis/resolve_source.js.map +0 -1
- package/dist/analysis/trade_profitability.d.ts.map +0 -1
- package/dist/analysis/trade_profitability.js.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -128
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -37
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
- package/dist/bot.d.ts.map +0 -1
- package/dist/bot.js.map +0 -1
- package/dist/credential-daemon.d.ts.map +0 -1
- package/dist/credential-daemon.js.map +0 -1
- package/dist/dexbot.d.ts.map +0 -1
- package/dist/dexbot.js.map +0 -1
- package/dist/market_adapter/ama_signal_runner.d.ts.map +0 -1
- package/dist/market_adapter/ama_signal_runner.js.map +0 -1
- package/dist/market_adapter/candle_utils.d.ts.map +0 -1
- package/dist/market_adapter/candle_utils.js.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.js.map +0 -1
- package/dist/market_adapter/core/config_normalizers.d.ts.map +0 -1
- package/dist/market_adapter/core/config_normalizers.js.map +0 -1
- package/dist/market_adapter/core/kibana_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_candles.js.map +0 -1
- package/dist/market_adapter/core/kibana_client.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_client.js.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.js.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.js.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.js.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.js.map +0 -1
- package/dist/market_adapter/inputs/window_cache.d.ts.map +0 -1
- package/dist/market_adapter/inputs/window_cache.js.map +0 -1
- package/dist/market_adapter/interval_utils.d.ts.map +0 -1
- package/dist/market_adapter/interval_utils.js.map +0 -1
- package/dist/market_adapter/log_format.d.ts.map +0 -1
- package/dist/market_adapter/log_format.js.map +0 -1
- package/dist/market_adapter/lp_chart_core.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_core.js.map +0 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_runner.js.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +0 -1
- package/dist/market_adapter/market_adapter.d.ts.map +0 -1
- package/dist/market_adapter/market_adapter.js.map +0 -1
- package/dist/market_adapter/test_helpers.d.ts.map +0 -1
- package/dist/market_adapter/test_helpers.js.map +0 -1
- package/dist/market_adapter/utils/adapter_client.d.ts.map +0 -1
- package/dist/market_adapter/utils/adapter_client.js.map +0 -1
- package/dist/market_adapter/utils/atomic_write.d.ts.map +0 -1
- package/dist/market_adapter/utils/atomic_write.js.map +0 -1
- package/dist/market_adapter/utils/chain.d.ts.map +0 -1
- package/dist/market_adapter/utils/chain.js.map +0 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +0 -1
- package/dist/market_adapter/utils/data_discovery.js.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +0 -1
- package/dist/market_adapter/utils/file_lock.d.ts.map +0 -1
- package/dist/market_adapter/utils/file_lock.js.map +0 -1
- package/dist/market_adapter/utils/native_history.d.ts.map +0 -1
- package/dist/market_adapter/utils/native_history.js.map +0 -1
- package/dist/modules/account_bots.d.ts.map +0 -1
- package/dist/modules/account_bots.js.map +0 -1
- package/dist/modules/account_orders.d.ts.map +0 -1
- package/dist/modules/account_orders.js.map +0 -1
- package/dist/modules/authority_resolver.d.ts.map +0 -1
- package/dist/modules/authority_resolver.js.map +0 -1
- package/dist/modules/bitshares-native/chain_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/chain_client.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +0 -1
- package/dist/modules/bitshares-native/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/index.js.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.js.map +0 -1
- package/dist/modules/bitshares-native/resolvers.d.ts.map +0 -1
- package/dist/modules/bitshares-native/resolvers.js.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +0 -1
- package/dist/modules/bitshares-native/serial/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/index.js.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.js.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.js.map +0 -1
- package/dist/modules/bitshares-native/serial/types.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/types.js.map +0 -1
- package/dist/modules/bitshares-native/signing_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/signing_client.js.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.js.map +0 -1
- package/dist/modules/bitshares-native/transport.d.ts.map +0 -1
- package/dist/modules/bitshares-native/transport.js.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.js.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +0 -1
- package/dist/modules/bitshares_client.d.ts.map +0 -1
- package/dist/modules/bitshares_client.js.map +0 -1
- package/dist/modules/bot_defaults.d.ts.map +0 -1
- package/dist/modules/bot_defaults.js.map +0 -1
- package/dist/modules/bot_settings.d.ts.map +0 -1
- package/dist/modules/bot_settings.js.map +0 -1
- package/dist/modules/bots_file_lock.d.ts.map +0 -1
- package/dist/modules/bots_file_lock.js.map +0 -1
- package/dist/modules/broadcast_failure.d.ts.map +0 -1
- package/dist/modules/broadcast_failure.js.map +0 -1
- package/dist/modules/chain_keys.d.ts.map +0 -1
- package/dist/modules/chain_keys.js.map +0 -1
- package/dist/modules/chain_orders.d.ts.map +0 -1
- package/dist/modules/chain_orders.js.map +0 -1
- package/dist/modules/cli_colors.d.ts.map +0 -1
- package/dist/modules/cli_colors.js.map +0 -1
- package/dist/modules/cli_start_onboarding.d.ts.map +0 -1
- package/dist/modules/cli_start_onboarding.js.map +0 -1
- package/dist/modules/cli_start_output.d.ts.map +0 -1
- package/dist/modules/cli_start_output.js.map +0 -1
- package/dist/modules/config.d.ts.map +0 -1
- package/dist/modules/config.js.map +0 -1
- package/dist/modules/constants.d.ts.map +0 -1
- package/dist/modules/constants.js.map +0 -1
- package/dist/modules/cr_planner.d.ts.map +0 -1
- package/dist/modules/cr_planner.js.map +0 -1
- package/dist/modules/credential_policy.d.ts.map +0 -1
- package/dist/modules/credential_policy.js.map +0 -1
- package/dist/modules/credential_runtime.d.ts.map +0 -1
- package/dist/modules/credential_runtime.js.map +0 -1
- package/dist/modules/credential_session_cache.d.ts.map +0 -1
- package/dist/modules/credential_session_cache.js.map +0 -1
- package/dist/modules/credit_pricing.d.ts.map +0 -1
- package/dist/modules/credit_pricing.js.map +0 -1
- package/dist/modules/credit_runtime.d.ts.map +0 -1
- package/dist/modules/credit_runtime.js.map +0 -1
- package/dist/modules/crypto/browser_provider.d.ts.map +0 -1
- package/dist/modules/crypto/browser_provider.js.map +0 -1
- package/dist/modules/crypto/index.d.ts.map +0 -1
- package/dist/modules/crypto/index.js.map +0 -1
- package/dist/modules/crypto/node_provider.d.ts.map +0 -1
- package/dist/modules/crypto/node_provider.js.map +0 -1
- package/dist/modules/crypto/provider.d.ts.map +0 -1
- package/dist/modules/crypto/provider.js.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.d.ts.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.js.map +0 -1
- package/dist/modules/crypto/pure_scrypt.d.ts.map +0 -1
- package/dist/modules/crypto/pure_scrypt.js.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.js.map +0 -1
- package/dist/modules/crypto/sync.d.ts.map +0 -1
- package/dist/modules/crypto/sync.js.map +0 -1
- package/dist/modules/daemon_node_health.d.ts.map +0 -1
- package/dist/modules/daemon_node_health.js.map +0 -1
- package/dist/modules/dexbot_class.d.ts.map +0 -1
- package/dist/modules/dexbot_class.js.map +0 -1
- package/dist/modules/dexbot_cow_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_cow_runtime.js.map +0 -1
- package/dist/modules/dexbot_credential_client.d.ts.map +0 -1
- package/dist/modules/dexbot_credential_client.js.map +0 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_fill_runtime.js.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.js.map +0 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_startup_runtime.js.map +0 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +0 -1
- package/dist/modules/dexbot_state_recovery.js.map +0 -1
- package/dist/modules/env.d.ts.map +0 -1
- package/dist/modules/env.js.map +0 -1
- package/dist/modules/fund_registry.d.ts.map +0 -1
- package/dist/modules/fund_registry.js.map +0 -1
- package/dist/modules/general_settings.d.ts.map +0 -1
- package/dist/modules/general_settings.js.map +0 -1
- package/dist/modules/graceful_shutdown.d.ts.map +0 -1
- package/dist/modules/graceful_shutdown.js.map +0 -1
- package/dist/modules/grid_price_source.d.ts.map +0 -1
- package/dist/modules/grid_price_source.js.map +0 -1
- package/dist/modules/key_store.d.ts.map +0 -1
- package/dist/modules/key_store.js.map +0 -1
- package/dist/modules/launcher/adapter_requirement.d.ts.map +0 -1
- package/dist/modules/launcher/adapter_requirement.js.map +0 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +0 -1
- package/dist/modules/launcher/bot_supervisor.js.map +0 -1
- package/dist/modules/launcher/child_env.d.ts.map +0 -1
- package/dist/modules/launcher/child_env.js.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.js.map +0 -1
- package/dist/modules/launcher/credential_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/credential_daemon.js.map +0 -1
- package/dist/modules/launcher/credential_secret.d.ts.map +0 -1
- package/dist/modules/launcher/credential_secret.js.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.js.map +0 -1
- package/dist/modules/launcher/headless_password.d.ts.map +0 -1
- package/dist/modules/launcher/headless_password.js.map +0 -1
- package/dist/modules/launcher/launch_modes.d.ts.map +0 -1
- package/dist/modules/launcher/launch_modes.js.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.js.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.js.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.js.map +0 -1
- package/dist/modules/launcher/runtime_entry.d.ts.map +0 -1
- package/dist/modules/launcher/runtime_entry.js.map +0 -1
- package/dist/modules/launcher/status_reporting.d.ts.map +0 -1
- package/dist/modules/launcher/status_reporting.js.map +0 -1
- package/dist/modules/launcher/supervisor_control.d.ts.map +0 -1
- package/dist/modules/launcher/supervisor_control.js.map +0 -1
- package/dist/modules/market_adapter_whitelist.d.ts.map +0 -1
- package/dist/modules/market_adapter_whitelist.js.map +0 -1
- package/dist/modules/node_connect_policy.d.ts.map +0 -1
- package/dist/modules/node_connect_policy.js.map +0 -1
- package/dist/modules/node_failure_ledger.d.ts.map +0 -1
- package/dist/modules/node_failure_ledger.js.map +0 -1
- package/dist/modules/node_health_cache.d.ts.map +0 -1
- package/dist/modules/node_health_cache.js.map +0 -1
- package/dist/modules/node_manager.d.ts.map +0 -1
- package/dist/modules/node_manager.js.map +0 -1
- package/dist/modules/order/accounting.d.ts.map +0 -1
- package/dist/modules/order/accounting.js.map +0 -1
- package/dist/modules/order/async_lock.d.ts.map +0 -1
- package/dist/modules/order/async_lock.js.map +0 -1
- package/dist/modules/order/export.d.ts.map +0 -1
- package/dist/modules/order/export.js.map +0 -1
- package/dist/modules/order/format.d.ts.map +0 -1
- package/dist/modules/order/format.js.map +0 -1
- package/dist/modules/order/grid.d.ts.map +0 -1
- package/dist/modules/order/grid.js.map +0 -1
- package/dist/modules/order/grid_reconcile.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile.js.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.js.map +0 -1
- package/dist/modules/order/index.d.ts.map +0 -1
- package/dist/modules/order/index.js.map +0 -1
- package/dist/modules/order/logger.d.ts.map +0 -1
- package/dist/modules/order/logger.js.map +0 -1
- package/dist/modules/order/logger_state.d.ts.map +0 -1
- package/dist/modules/order/logger_state.js.map +0 -1
- package/dist/modules/order/manager.d.ts.map +0 -1
- package/dist/modules/order/manager.js.map +0 -1
- package/dist/modules/order/processed_fill_store.d.ts.map +0 -1
- package/dist/modules/order/processed_fill_store.js.map +0 -1
- package/dist/modules/order/strategy.d.ts.map +0 -1
- package/dist/modules/order/strategy.js.map +0 -1
- package/dist/modules/order/sync_engine.d.ts.map +0 -1
- package/dist/modules/order/sync_engine.js.map +0 -1
- package/dist/modules/order/utils/math.d.ts.map +0 -1
- package/dist/modules/order/utils/math.js.map +0 -1
- package/dist/modules/order/utils/order.d.ts.map +0 -1
- package/dist/modules/order/utils/order.js.map +0 -1
- package/dist/modules/order/utils/slot.d.ts.map +0 -1
- package/dist/modules/order/utils/slot.js.map +0 -1
- package/dist/modules/order/utils/system.d.ts.map +0 -1
- package/dist/modules/order/utils/system.js.map +0 -1
- package/dist/modules/order/utils/timeout.d.ts.map +0 -1
- package/dist/modules/order/utils/timeout.js.map +0 -1
- package/dist/modules/order/utils/validate.d.ts.map +0 -1
- package/dist/modules/order/utils/validate.js.map +0 -1
- package/dist/modules/order/utils/withPoolRef.d.ts.map +0 -1
- package/dist/modules/order/utils/withPoolRef.js.map +0 -1
- package/dist/modules/order/working_grid.d.ts.map +0 -1
- package/dist/modules/order/working_grid.js.map +0 -1
- package/dist/modules/path_api.d.ts.map +0 -1
- package/dist/modules/path_api.js.map +0 -1
- package/dist/modules/paths.d.ts.map +0 -1
- package/dist/modules/paths.js.map +0 -1
- package/dist/modules/process_discovery.d.ts.map +0 -1
- package/dist/modules/process_discovery.js.map +0 -1
- package/dist/modules/runtime.d.ts.map +0 -1
- package/dist/modules/runtime.js.map +0 -1
- package/dist/modules/runtime_settings.d.ts.map +0 -1
- package/dist/modules/runtime_settings.js.map +0 -1
- package/dist/modules/settings_merge.d.ts.map +0 -1
- package/dist/modules/settings_merge.js.map +0 -1
- package/dist/modules/socket_json_client.d.ts.map +0 -1
- package/dist/modules/socket_json_client.js.map +0 -1
- package/dist/modules/storage/browser_adapter.d.ts.map +0 -1
- package/dist/modules/storage/browser_adapter.js.map +0 -1
- package/dist/modules/storage/index.d.ts.map +0 -1
- package/dist/modules/storage/index.js.map +0 -1
- package/dist/modules/storage/node_adapter.d.ts.map +0 -1
- package/dist/modules/storage/node_adapter.js.map +0 -1
- package/dist/modules/storage/types.d.ts.map +0 -1
- package/dist/modules/storage/types.js.map +0 -1
- package/dist/modules/types.d.ts.map +0 -1
- package/dist/modules/types.js.map +0 -1
- package/dist/modules/utils/base58check.d.ts.map +0 -1
- package/dist/modules/utils/base58check.js.map +0 -1
- package/dist/modules/utils/build_dir.d.ts.map +0 -1
- package/dist/modules/utils/build_dir.js.map +0 -1
- package/dist/modules/utils/chain_logs.d.ts.map +0 -1
- package/dist/modules/utils/chain_logs.js.map +0 -1
- package/dist/modules/utils/errors.d.ts.map +0 -1
- package/dist/modules/utils/errors.js.map +0 -1
- package/dist/modules/utils/sanitize_key.d.ts.map +0 -1
- package/dist/modules/utils/sanitize_key.js.map +0 -1
- package/dist/modules/utils/text_width.d.ts.map +0 -1
- package/dist/modules/utils/text_width.js.map +0 -1
- package/dist/modules/validate_profiles.d.ts.map +0 -1
- package/dist/modules/validate_profiles.js.map +0 -1
- package/dist/pm2.d.ts.map +0 -1
- package/dist/pm2.js.map +0 -1
- package/dist/scripts/analyze-credit.d.ts.map +0 -1
- package/dist/scripts/analyze-credit.js.map +0 -1
- package/dist/scripts/analyze-git.d.ts.map +0 -1
- package/dist/scripts/analyze-git.js.map +0 -1
- package/dist/scripts/analyze-orders.d.ts.map +0 -1
- package/dist/scripts/analyze-orders.js.map +0 -1
- package/dist/scripts/chart_command.d.ts.map +0 -1
- package/dist/scripts/chart_command.js.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.js.map +0 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +0 -1
- package/dist/scripts/diagnose-pool-history.js.map +0 -1
- package/dist/scripts/divergence-calc.d.ts.map +0 -1
- package/dist/scripts/divergence-calc.js.map +0 -1
- package/dist/scripts/dw.d.ts.map +0 -1
- package/dist/scripts/dw.js.map +0 -1
- package/dist/scripts/generate_lp_chart.d.ts.map +0 -1
- package/dist/scripts/generate_lp_chart.js.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.js.map +0 -1
- package/dist/scripts/native_release_gates.d.ts.map +0 -1
- package/dist/scripts/native_release_gates.js.map +0 -1
- package/dist/scripts/print_grid.d.ts.map +0 -1
- package/dist/scripts/print_grid.js.map +0 -1
- package/dist/scripts/run-tests.d.ts.map +0 -1
- package/dist/scripts/run-tests.js.map +0 -1
- package/dist/scripts/runner.d.ts.map +0 -1
- package/dist/scripts/runner.js.map +0 -1
- package/dist/scripts/sync-version.d.ts.map +0 -1
- package/dist/scripts/sync-version.js.map +0 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +0 -1
- package/dist/scripts/test-credit-renewal.js.map +0 -1
- package/dist/scripts/tv.d.ts.map +0 -1
- package/dist/scripts/tv.js.map +0 -1
- package/dist/scripts/update.d.ts.map +0 -1
- package/dist/scripts/update.js.map +0 -1
- package/dist/scripts/update_dist_freshness.d.ts.map +0 -1
- package/dist/scripts/update_dist_freshness.js.map +0 -1
- package/dist/scripts/validate_bots.d.ts.map +0 -1
- package/dist/scripts/validate_bots.js.map +0 -1
- package/dist/scripts/verify-browser-bundle.d.ts.map +0 -1
- package/dist/scripts/verify-browser-bundle.js.map +0 -1
- package/dist/unlock.d.ts.map +0 -1
- package/dist/unlock.js.map +0 -1
|
@@ -1,711 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const assert = require('assert');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { runEsmMockStages, defineEsmMockAbs } = require('../../tests/helpers/esm_mocks');
|
|
6
|
-
|
|
7
|
-
// Compiled ESM graphs cannot be mocked via require.cache; the helper installs
|
|
8
|
-
// loader hooks (one child process per stage so fresh module instances load).
|
|
9
|
-
function clearModule(_modulePath: string) {
|
|
10
|
-
/* no-op under ESM hooks */
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function registerMock(modulePath: string, exports: any) {
|
|
14
|
-
defineEsmMockAbs(modulePath, Object.keys(exports), exports);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function testClawBitsharesClientNativePathAndConnection() {
|
|
18
|
-
console.log(' bitshares_client native path and connection...');
|
|
19
|
-
|
|
20
|
-
const clawBitsharesPath = require.resolve('../modules/bitshares_client');
|
|
21
|
-
clearModule(clawBitsharesPath);
|
|
22
|
-
|
|
23
|
-
const clawBitshares = require('../modules/bitshares_client');
|
|
24
|
-
|
|
25
|
-
assert.strictEqual(clawBitshares.isConnected(), false, 'initial state should not be connected');
|
|
26
|
-
assert.strictEqual(typeof clawBitshares.BitShares, 'object', 'BitShares proxy should exist');
|
|
27
|
-
assert.strictEqual(typeof clawBitshares.createAccountClient, 'function');
|
|
28
|
-
await assert.rejects(() => clawBitshares.createAccountClient('', 'wif'), /accountName is required/);
|
|
29
|
-
await assert.rejects(() => clawBitshares.createAccountClient('alice', ''), /privateKey is required/);
|
|
30
|
-
|
|
31
|
-
console.log(' PASS');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function testClawBitsharesClientWaitForConnectedTriggersNativeConnect() {
|
|
35
|
-
console.log(' bitshares_client waitForConnected lazy connect...');
|
|
36
|
-
|
|
37
|
-
const nativePath = require.resolve('../../modules/bitshares-native');
|
|
38
|
-
let connectCalls = 0;
|
|
39
|
-
let nodes: any[] = [];
|
|
40
|
-
let connected = false;
|
|
41
|
-
|
|
42
|
-
registerMock(nativePath, {
|
|
43
|
-
createChainClient: ({ onStatusChange }: any) => ({
|
|
44
|
-
connect: async () => {
|
|
45
|
-
connectCalls += 1;
|
|
46
|
-
connected = true;
|
|
47
|
-
if (typeof onStatusChange === 'function') onStatusChange('connected');
|
|
48
|
-
},
|
|
49
|
-
disconnect: () => {
|
|
50
|
-
connected = false;
|
|
51
|
-
if (typeof onStatusChange === 'function') onStatusChange('closed');
|
|
52
|
-
},
|
|
53
|
-
getStatus: () => connected ? 'connected' : 'closed',
|
|
54
|
-
setNodes: (nextNodes: any[]) => { nodes = Array.isArray(nextNodes) ? nextNodes.slice() : []; },
|
|
55
|
-
getNodes: () => nodes.slice(),
|
|
56
|
-
getCoreAsset: () => '1.3.0',
|
|
57
|
-
db: {},
|
|
58
|
-
history: {},
|
|
59
|
-
}),
|
|
60
|
-
createSigningClient: () => ({ client: { initPromise: Promise.resolve(), newTx() {} } }),
|
|
61
|
-
createSubscriptionManager: () => ({
|
|
62
|
-
onReconnect: async () => {},
|
|
63
|
-
subscribe: async () => () => {},
|
|
64
|
-
unsubscribe: async () => {},
|
|
65
|
-
}),
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const clawBitsharesPath = require.resolve('../modules/bitshares_client');
|
|
69
|
-
clearModule(clawBitsharesPath);
|
|
70
|
-
const clawBitshares = require('../modules/bitshares_client');
|
|
71
|
-
|
|
72
|
-
await clawBitshares.waitForConnected(200);
|
|
73
|
-
|
|
74
|
-
assert.strictEqual(connectCalls, 1, 'waitForConnected should initiate a native connect when idle');
|
|
75
|
-
assert.strictEqual(clawBitshares.isConnected(), true, 'client should report connected after lazy connect');
|
|
76
|
-
assert.ok(Array.isArray(clawBitshares.BitShares.node) && clawBitshares.BitShares.node.length > 0, 'default node list should be populated');
|
|
77
|
-
|
|
78
|
-
console.log(' PASS');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function testClawRootExportsAvoidSilentCollisions() {
|
|
82
|
-
console.log(' claw root exports...');
|
|
83
|
-
|
|
84
|
-
const clawIndexPath = require.resolve('..');
|
|
85
|
-
clearModule(clawIndexPath);
|
|
86
|
-
|
|
87
|
-
const claw = require('..').default;
|
|
88
|
-
const hermesManifest = claw.describeClawBridge({ runtimeName: 'hermes' });
|
|
89
|
-
const openclawManifest = claw.describeClawBridge({ runtimeName: 'openclaw' });
|
|
90
|
-
const openfangManifest = claw.describeClawBridge({ runtimeName: 'openfang' });
|
|
91
|
-
const nullManifest = claw.describeClawBridge({ runtimeName: 'nullclaw' });
|
|
92
|
-
const manifest = claw.describeClawBridge({ runtimeName: 'zeroclaw' });
|
|
93
|
-
|
|
94
|
-
assert.strictEqual(typeof claw.resolveSigningAccountName, 'function');
|
|
95
|
-
assert.strictEqual(claw.resolveSigningAccountName({ accountName: 'alice' }), 'alice');
|
|
96
|
-
assert.strictEqual(typeof claw.resolveAccountName, 'function');
|
|
97
|
-
assert.strictEqual(claw.resolveAccountName('alice') instanceof Promise, true);
|
|
98
|
-
assert.strictEqual(hermesManifest.options.runtimeName, 'hermes');
|
|
99
|
-
assert.strictEqual(hermesManifest.compatibility.name, 'Hermes');
|
|
100
|
-
assert.strictEqual(openclawManifest.options.runtimeName, 'openclaw');
|
|
101
|
-
assert.strictEqual(openclawManifest.compatibility.name, 'OpenClaw');
|
|
102
|
-
assert.strictEqual(openclawManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
103
|
-
assert.strictEqual(openfangManifest.options.runtimeName, 'openfang');
|
|
104
|
-
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
105
|
-
assert.strictEqual(nullManifest.options.runtimeName, 'nullclaw');
|
|
106
|
-
assert.strictEqual(nullManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
107
|
-
assert.strictEqual(manifest.options.runtimeName, 'zeroclaw');
|
|
108
|
-
assert.strictEqual(manifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
109
|
-
|
|
110
|
-
console.log(' PASS');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function testRuntimeSkillTomlQuotesPayloadPlaceholders() {
|
|
114
|
-
console.log(' runtime skill toml quoting...');
|
|
115
|
-
|
|
116
|
-
const { buildRuntimeSkillToml } = require('../modules/claw_skill_md');
|
|
117
|
-
|
|
118
|
-
const toml = buildRuntimeSkillToml(
|
|
119
|
-
{ runtime: 'zeroclaw', displayName: 'ZeroClaw' },
|
|
120
|
-
'/tmp/repo root',
|
|
121
|
-
'/tmp/profile root'
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
assert(
|
|
125
|
-
toml.includes("'--payload' '{{payload_json}}'"),
|
|
126
|
-
'generated skill commands must shell-quote payload placeholders'
|
|
127
|
-
);
|
|
128
|
-
assert(
|
|
129
|
-
toml.includes("'--profile-root' '/tmp/profile root'"),
|
|
130
|
-
'generated skill commands must shell-quote profile roots with spaces'
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
console.log(' PASS');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function testLiquidityPoolWrapperInjectsSharedBitSharesClient() {
|
|
137
|
-
console.log(' liquidity_pools shared client injection...');
|
|
138
|
-
|
|
139
|
-
const bitsharesPath = require.resolve('../modules/bitshares_client');
|
|
140
|
-
const dexbotBridgePath = require.resolve('../modules/dexbot_bridge');
|
|
141
|
-
const liquidityPoolsPath = require.resolve('../modules/liquidity_pools');
|
|
142
|
-
const sharedBitShares = { name: 'shared-bitshares-client' };
|
|
143
|
-
let capturedPoolArgs = null;
|
|
144
|
-
let capturedPriceArgs = null;
|
|
145
|
-
|
|
146
|
-
registerMock(bitsharesPath, { BitShares: sharedBitShares } as any);
|
|
147
|
-
registerMock(dexbotBridgePath, {
|
|
148
|
-
getDexbot2Root: () => '/tmp',
|
|
149
|
-
loadDexbotOrderSystemUtils: () => ({
|
|
150
|
-
cloneMap: (value: any) => value,
|
|
151
|
-
deepFreeze: (value: any) => value,
|
|
152
|
-
derivePoolPrice: (...args: any[]) => {
|
|
153
|
-
capturedPoolArgs = args;
|
|
154
|
-
return 'pool-price';
|
|
155
|
-
},
|
|
156
|
-
derivePrice: (...args: any[]) => {
|
|
157
|
-
capturedPriceArgs = args;
|
|
158
|
-
return 'derived-price';
|
|
159
|
-
},
|
|
160
|
-
loadAmaCenterPrice: () => null,
|
|
161
|
-
lookupAsset: () => null
|
|
162
|
-
}),
|
|
163
|
-
requireDexbot2Module: () => null
|
|
164
|
-
} as any);
|
|
165
|
-
clearModule(liquidityPoolsPath);
|
|
166
|
-
|
|
167
|
-
const liquidityPools = require('../modules/liquidity_pools');
|
|
168
|
-
|
|
169
|
-
assert.strictEqual(liquidityPools.derivePoolPrice('HONEST.USD', 'BTS'), 'pool-price');
|
|
170
|
-
assert.deepStrictEqual(
|
|
171
|
-
capturedPoolArgs,
|
|
172
|
-
[sharedBitShares, 'HONEST.USD', 'BTS'],
|
|
173
|
-
'derivePoolPrice wrapper must inject the shared BitShares client'
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
assert.strictEqual(liquidityPools.derivePrice('HONEST.USD', 'BTS', 'pool'), 'derived-price');
|
|
177
|
-
assert.deepStrictEqual(
|
|
178
|
-
capturedPriceArgs,
|
|
179
|
-
[sharedBitShares, 'HONEST.USD', 'BTS', 'pool'],
|
|
180
|
-
'derivePrice wrapper must inject the shared BitShares client'
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
console.log(' PASS');
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
async function testDecisionLoopReusesAnalyzerStateForDuplicateMarkets() {
|
|
187
|
-
console.log(' decision_loop analyzer state reuse...');
|
|
188
|
-
|
|
189
|
-
const decisionLoopPath = require.resolve('../modules/decision_loop');
|
|
190
|
-
const discoveryPath = require.resolve('../modules/position_discovery');
|
|
191
|
-
const healthPath = require.resolve('../modules/position_health');
|
|
192
|
-
const feedPriceSourcePath = require.resolve('../modules/feed_price_source');
|
|
193
|
-
const trendAnalyzerPath = require.resolve('../../market_adapter/core/signals/kalman_trend_analyzer');
|
|
194
|
-
let trendFetchCount = 0;
|
|
195
|
-
|
|
196
|
-
class FakeTrendAnalyzer {
|
|
197
|
-
[key: string]: any;
|
|
198
|
-
update(marketPrice: number, feedPrice: number) {
|
|
199
|
-
this.analysis = {
|
|
200
|
-
confidence: 77,
|
|
201
|
-
isReady: true,
|
|
202
|
-
marketPrice,
|
|
203
|
-
premium: {
|
|
204
|
-
percent: ((marketPrice - feedPrice) / feedPrice) * 100
|
|
205
|
-
},
|
|
206
|
-
trend: 'DOWN'
|
|
207
|
-
};
|
|
208
|
-
return this.analysis;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
getAnalysis() {
|
|
212
|
-
return this.analysis || {
|
|
213
|
-
confidence: 0,
|
|
214
|
-
isReady: false,
|
|
215
|
-
premium: {
|
|
216
|
-
percent: null
|
|
217
|
-
},
|
|
218
|
-
trend: 'NEUTRAL'
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
registerMock(discoveryPath, {
|
|
224
|
-
discoverPositions: async () => ([
|
|
225
|
-
{ id: 'pos-1', market: 'HONEST.USD/BTS', mpaSymbol: 'HONEST.USD', onChain: { debtAmount: 5 } },
|
|
226
|
-
{ id: 'pos-2', market: 'HONEST.USD/BTS', mpaSymbol: 'HONEST.USD', onChain: { debtAmount: 3 } }
|
|
227
|
-
])
|
|
228
|
-
} as any);
|
|
229
|
-
registerMock(healthPath, {
|
|
230
|
-
assessPosition: (position: any, trendSignal: any) => ({
|
|
231
|
-
actions: [],
|
|
232
|
-
positionId: position.id,
|
|
233
|
-
trend: trendSignal
|
|
234
|
-
})
|
|
235
|
-
} as any);
|
|
236
|
-
registerMock(feedPriceSourcePath, {
|
|
237
|
-
fetchTrendInput: async () => {
|
|
238
|
-
trendFetchCount += 1;
|
|
239
|
-
return {
|
|
240
|
-
feedPrice: 100,
|
|
241
|
-
marketPrice: 95,
|
|
242
|
-
premium: -5
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
} as any);
|
|
246
|
-
registerMock(trendAnalyzerPath, { KalmanTrendAnalyzer: FakeTrendAnalyzer } as any);
|
|
247
|
-
clearModule(decisionLoopPath);
|
|
248
|
-
|
|
249
|
-
const { evaluate, resetAnalyzers } = require('../modules/decision_loop');
|
|
250
|
-
const result = await evaluate('alice');
|
|
251
|
-
|
|
252
|
-
assert.strictEqual(trendFetchCount, 1, 'trend input should be fetched once per market');
|
|
253
|
-
assert.strictEqual(result.positionCount, 2, 'both positions should be evaluated');
|
|
254
|
-
assert.strictEqual(result.positions[0].trend.trend, 'DOWN');
|
|
255
|
-
assert.strictEqual(result.positions[1].trend.trend, 'DOWN');
|
|
256
|
-
assert.strictEqual(result.positions[1].trend.premium, -5, 'reused trend signal should come from cached analyzer state');
|
|
257
|
-
|
|
258
|
-
resetAnalyzers();
|
|
259
|
-
|
|
260
|
-
console.log(' PASS');
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
async function testDecisionLoopReplacesAnalyzerOnConfigChange() {
|
|
264
|
-
console.log(' decision_loop analyzer config replacement...');
|
|
265
|
-
|
|
266
|
-
const decisionLoopPath = require.resolve('../modules/decision_loop');
|
|
267
|
-
const discoveryPath = require.resolve('../modules/position_discovery');
|
|
268
|
-
const healthPath = require.resolve('../modules/position_health');
|
|
269
|
-
const feedPriceSourcePath = require.resolve('../modules/feed_price_source');
|
|
270
|
-
const trendAnalyzerPath = require.resolve('../../market_adapter/core/signals/kalman_trend_analyzer');
|
|
271
|
-
let constructionCount = 0;
|
|
272
|
-
|
|
273
|
-
class ConfigTrackingAnalyzer {
|
|
274
|
-
[key: string]: any;
|
|
275
|
-
constructor(config: any) {
|
|
276
|
-
constructionCount += 1;
|
|
277
|
-
this.config = config;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
update(marketPrice: number, feedPrice: number) {
|
|
281
|
-
return { confidence: 50, isReady: true, trend: 'NEUTRAL' };
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
getAnalysis() {
|
|
285
|
-
return { confidence: 50, isReady: true, premium: { percent: 0 }, trend: 'NEUTRAL' };
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
registerMock(discoveryPath, {
|
|
290
|
-
discoverPositions: async () => ([
|
|
291
|
-
{ id: 'pos-1', market: 'HONEST.USD/BTS', mpaSymbol: 'HONEST.USD', onChain: { debtAmount: 5 } }
|
|
292
|
-
])
|
|
293
|
-
} as any);
|
|
294
|
-
registerMock(healthPath, {
|
|
295
|
-
assessPosition: (position: any, trendSignal: any) => ({ actions: [], positionId: position.id, trend: trendSignal })
|
|
296
|
-
} as any);
|
|
297
|
-
registerMock(feedPriceSourcePath, {
|
|
298
|
-
fetchTrendInput: async () => ({ feedPrice: 100, marketPrice: 95, premium: -5 })
|
|
299
|
-
} as any);
|
|
300
|
-
registerMock(trendAnalyzerPath, { KalmanTrendAnalyzer: ConfigTrackingAnalyzer } as any);
|
|
301
|
-
clearModule(decisionLoopPath);
|
|
302
|
-
|
|
303
|
-
const { evaluate, resetAnalyzers } = require('../modules/decision_loop');
|
|
304
|
-
|
|
305
|
-
await evaluate('alice', { analyzerConfig: { kamaPeriod: 10 } });
|
|
306
|
-
assert.strictEqual(constructionCount, 1, 'first evaluate should create one analyzer');
|
|
307
|
-
|
|
308
|
-
await evaluate('alice', { analyzerConfig: { kamaPeriod: 10 } });
|
|
309
|
-
assert.strictEqual(constructionCount, 1, 'same config should reuse the cached analyzer');
|
|
310
|
-
|
|
311
|
-
await evaluate('alice', { analyzerConfig: { kamaPeriod: 20 } });
|
|
312
|
-
assert.strictEqual(constructionCount, 2, 'changed config should replace the analyzer');
|
|
313
|
-
|
|
314
|
-
resetAnalyzers();
|
|
315
|
-
|
|
316
|
-
console.log(' PASS');
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
async function testPositionManagerEntryExposesSellPriceInBts() {
|
|
320
|
-
console.log(' position_manager entry sellPriceInBts...');
|
|
321
|
-
|
|
322
|
-
const positionManagerPath = require.resolve('../modules/position_manager');
|
|
323
|
-
const mpaUtilsPath = require.resolve('../modules/mpa_utils');
|
|
324
|
-
|
|
325
|
-
// ESM hooks turn mock keys into synthetic named re-exports, so every name
|
|
326
|
-
// position_manager statically imports from mpa_utils must exist here. The
|
|
327
|
-
// two helpers beside requireBtsBackedMpa are minimal inline replicas of the
|
|
328
|
-
// real ones (requiring the real module would bypass the mock and poison
|
|
329
|
-
// the module cache with the real instance).
|
|
330
|
-
const blockchainToFloat = (amount: any, precision: any) => Number(amount) / (10 ** precision);
|
|
331
|
-
const computeBtsPerMpa = (settlementPrice: any, mpaAsset: any, backingAsset: any) => {
|
|
332
|
-
const base = settlementPrice?.base;
|
|
333
|
-
const quote = settlementPrice?.quote;
|
|
334
|
-
if (!base || !quote) return null;
|
|
335
|
-
const baseAmount = blockchainToFloat(base.amount, base.asset_id === mpaAsset.id ? mpaAsset.precision : backingAsset.precision);
|
|
336
|
-
const quoteAmount = blockchainToFloat(quote.amount, quote.asset_id === mpaAsset.id ? mpaAsset.precision : backingAsset.precision);
|
|
337
|
-
if (!baseAmount || !quoteAmount) return null;
|
|
338
|
-
if (base.asset_id === backingAsset.id && quote.asset_id === mpaAsset.id) return baseAmount / quoteAmount;
|
|
339
|
-
if (base.asset_id === mpaAsset.id && quote.asset_id === backingAsset.id) return quoteAmount / baseAmount;
|
|
340
|
-
return null;
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
registerMock(mpaUtilsPath, {
|
|
344
|
-
computeCallOrderAmounts: (callOrder: any, mpaAsset: any, backingAsset: any, bitassetData: any) => {
|
|
345
|
-
const debtAmount = blockchainToFloat(callOrder.debt, mpaAsset.precision);
|
|
346
|
-
const collateralAmount = blockchainToFloat(callOrder.collateral, backingAsset.precision);
|
|
347
|
-
const btsPerMpa = computeBtsPerMpa(bitassetData?.current_feed?.settlement_price, mpaAsset, backingAsset);
|
|
348
|
-
const debtValueInBts = debtAmount && btsPerMpa ? debtAmount * btsPerMpa : 0;
|
|
349
|
-
const collateralRatio = debtValueInBts > 0 ? collateralAmount / debtValueInBts : null;
|
|
350
|
-
return {
|
|
351
|
-
btsPerMpa,
|
|
352
|
-
collateralAmount: collateralAmount || 0,
|
|
353
|
-
collateralRatio,
|
|
354
|
-
debtAmount: debtAmount || 0,
|
|
355
|
-
debtValueInBts
|
|
356
|
-
};
|
|
357
|
-
},
|
|
358
|
-
getBlockchainToFloat: () => blockchainToFloat,
|
|
359
|
-
requireBtsBackedMpa: async (sym: string) => ({
|
|
360
|
-
backingAsset: { id: '1.3.0', symbol: 'BTS', precision: 5 },
|
|
361
|
-
mpaAsset: { id: `1.3.${sym.length}`, symbol: sym, precision: 5, bitasset_data_id: '2.4.1' }
|
|
362
|
-
})
|
|
363
|
-
} as any);
|
|
364
|
-
|
|
365
|
-
clearModule(positionManagerPath);
|
|
366
|
-
const { PositionManager } = require('../modules/position_manager');
|
|
367
|
-
|
|
368
|
-
const savedState: any = {};
|
|
369
|
-
const pm = new PositionManager({
|
|
370
|
-
loadState: async () => savedState.data || { positions: [] },
|
|
371
|
-
saveState: async (state: any) => { savedState.data = state; }
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
const position = await pm.createShortPosition({
|
|
375
|
-
accountName: 'alice',
|
|
376
|
-
mpaAsset: 'HONEST.USD',
|
|
377
|
-
debtAmount: 10,
|
|
378
|
-
collateralAmount: 25000,
|
|
379
|
-
sellPriceInBts: 1000
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
assert.strictEqual(position.entry.sellPriceInBts, 1000, 'entry must expose sellPriceInBts for openShort');
|
|
383
|
-
assert.strictEqual(position.entry.priceInBts, 1000, 'entry must also have generic priceInBts from createOrderTracking');
|
|
384
|
-
|
|
385
|
-
console.log(' PASS');
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function testClawBridgeRespectsRuntimeNameOption() {
|
|
389
|
-
console.log(' claw_bridge runtime name option...');
|
|
390
|
-
|
|
391
|
-
const clawBridgePath = require.resolve('../modules/claw_bridge');
|
|
392
|
-
const clawInfraPath = require.resolve('../modules/claw_infra');
|
|
393
|
-
|
|
394
|
-
let capturedOptions: any = null;
|
|
395
|
-
registerMock(clawInfraPath, {
|
|
396
|
-
createClawInfrastructure: (opts: any) => {
|
|
397
|
-
capturedOptions = opts;
|
|
398
|
-
return {
|
|
399
|
-
runtime: { name: opts.runtime?.name || 'claw-bridge' },
|
|
400
|
-
profiles: {},
|
|
401
|
-
market: {}
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
} as any);
|
|
405
|
-
|
|
406
|
-
clearModule(clawBridgePath);
|
|
407
|
-
const { createClawBridge } = require('../modules/claw_bridge');
|
|
408
|
-
|
|
409
|
-
createClawBridge({ runtimeName: 'openclaw' });
|
|
410
|
-
assert.strictEqual(capturedOptions.runtime.name, 'openclaw', 'runtimeName option should propagate to runtime.name');
|
|
411
|
-
|
|
412
|
-
createClawBridge({ runtime: { name: 'picoclaw' } });
|
|
413
|
-
assert.strictEqual(capturedOptions.runtime.name, 'picoclaw', 'runtime.name should still work directly');
|
|
414
|
-
|
|
415
|
-
createClawBridge({});
|
|
416
|
-
assert.strictEqual(capturedOptions.runtime.name, 'claw-bridge', 'should fall back to claw-bridge');
|
|
417
|
-
|
|
418
|
-
console.log(' PASS');
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function testClawBridgeScriptManifestUsesRuntimeSpecificDescriptors() {
|
|
422
|
-
console.log(' claw_bridge script manifest descriptors...');
|
|
423
|
-
|
|
424
|
-
const scriptPath = require.resolve('../scripts/claw_bridge');
|
|
425
|
-
clearModule(scriptPath);
|
|
426
|
-
|
|
427
|
-
const { describeRuntimeManifest } = require('../scripts/claw_bridge');
|
|
428
|
-
|
|
429
|
-
const hermesManifest = describeRuntimeManifest('hermes', {});
|
|
430
|
-
assert.strictEqual(hermesManifest.compatibility.name, 'Hermes');
|
|
431
|
-
assert.strictEqual(hermesManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
432
|
-
|
|
433
|
-
const openclawManifest = describeRuntimeManifest('openclaw', {});
|
|
434
|
-
assert.strictEqual(openclawManifest.compatibility.name, 'OpenClaw');
|
|
435
|
-
assert.strictEqual(openclawManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
436
|
-
|
|
437
|
-
const openfangManifest = describeRuntimeManifest('openfang', {});
|
|
438
|
-
assert.strictEqual(openfangManifest.compatibility.name, 'OpenFang');
|
|
439
|
-
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
440
|
-
|
|
441
|
-
const nanoclawManifest = describeRuntimeManifest('nanoclaw', {});
|
|
442
|
-
assert.strictEqual(nanoclawManifest.compatibility.name, 'NanoClaw');
|
|
443
|
-
assert.strictEqual(nanoclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
444
|
-
|
|
445
|
-
const nullclawManifest = describeRuntimeManifest('nullclaw', {});
|
|
446
|
-
assert.strictEqual(nullclawManifest.compatibility.name, 'NullClaw');
|
|
447
|
-
assert.strictEqual(nullclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
448
|
-
|
|
449
|
-
const zeroclawManifest = describeRuntimeManifest('zeroclaw', {});
|
|
450
|
-
assert.strictEqual(zeroclawManifest.compatibility.name, 'ZeroClaw');
|
|
451
|
-
assert.strictEqual(zeroclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
452
|
-
|
|
453
|
-
const genericManifest = describeRuntimeManifest(null, {});
|
|
454
|
-
assert.strictEqual(genericManifest.compatibility.name, 'Claw');
|
|
455
|
-
assert.strictEqual(genericManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
456
|
-
|
|
457
|
-
const payloadSelectedManifest = describeRuntimeManifest(null, { runtimeName: 'openfang' });
|
|
458
|
-
assert.strictEqual(payloadSelectedManifest.compatibility.name, 'OpenFang');
|
|
459
|
-
assert.strictEqual(payloadSelectedManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
460
|
-
|
|
461
|
-
const normalizedPayloadManifest = describeRuntimeManifest(null, { runtimeName: ' OpenFang ' });
|
|
462
|
-
assert.strictEqual(normalizedPayloadManifest.compatibility.name, 'OpenFang');
|
|
463
|
-
assert.strictEqual(normalizedPayloadManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
464
|
-
|
|
465
|
-
const hermesPayloadManifest = describeRuntimeManifest(null, { runtimeName: ' Hermes ' });
|
|
466
|
-
assert.strictEqual(hermesPayloadManifest.compatibility.name, 'Hermes');
|
|
467
|
-
assert.strictEqual(hermesPayloadManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
468
|
-
|
|
469
|
-
console.log(' PASS');
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
async function testRuntimeCommandManifestUsesRuntimeSpecificDescriptors() {
|
|
473
|
-
console.log(' runClawCommand manifest descriptors...');
|
|
474
|
-
|
|
475
|
-
const { runClawCommand } = require('../modules/claw_bridge');
|
|
476
|
-
|
|
477
|
-
const hermesManifest = await runClawCommand('manifest', { runtimeName: 'hermes' });
|
|
478
|
-
assert.strictEqual(hermesManifest.compatibility.name, 'Hermes');
|
|
479
|
-
assert.strictEqual(hermesManifest.options.runtimeName, 'hermes');
|
|
480
|
-
assert.ok(hermesManifest.compatibility.trustModel.includes('Hermes'));
|
|
481
|
-
|
|
482
|
-
const openfangManifest = await runClawCommand('manifest', { runtimeName: 'openfang' });
|
|
483
|
-
assert.strictEqual(openfangManifest.compatibility.name, 'OpenFang');
|
|
484
|
-
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
485
|
-
|
|
486
|
-
const nanoclawManifest = await runClawCommand('manifest', { runtimeName: 'nanoclaw' });
|
|
487
|
-
assert.strictEqual(nanoclawManifest.compatibility.name, 'NanoClaw');
|
|
488
|
-
assert.strictEqual(nanoclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
489
|
-
|
|
490
|
-
const nullclawManifest = await runClawCommand('manifest', { runtimeName: 'nullclaw' });
|
|
491
|
-
assert.strictEqual(nullclawManifest.compatibility.name, 'NullClaw');
|
|
492
|
-
assert.strictEqual(nullclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
493
|
-
|
|
494
|
-
const zeroclawManifest = await runClawCommand('manifest', { runtimeName: 'zeroclaw' });
|
|
495
|
-
assert.strictEqual(zeroclawManifest.compatibility.name, 'ZeroClaw');
|
|
496
|
-
assert.strictEqual(zeroclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
497
|
-
|
|
498
|
-
console.log(' PASS');
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
function testClawCommandInjectsRuntimeNameViaOption() {
|
|
502
|
-
console.log(' runClawCommand runtime name injection...');
|
|
503
|
-
|
|
504
|
-
const clawBridgePath = require.resolve('../modules/claw_bridge');
|
|
505
|
-
const clawInfraPath = require.resolve('../modules/claw_infra');
|
|
506
|
-
|
|
507
|
-
let capturedOptions: any = null;
|
|
508
|
-
registerMock(clawInfraPath, {
|
|
509
|
-
createClawInfrastructure: (opts: any) => {
|
|
510
|
-
capturedOptions = opts;
|
|
511
|
-
return {
|
|
512
|
-
runtime: { name: opts.runtime?.name || 'claw-bridge', accountName: null },
|
|
513
|
-
profiles: {},
|
|
514
|
-
market: {}
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
} as any);
|
|
518
|
-
|
|
519
|
-
clearModule(clawBridgePath);
|
|
520
|
-
const { runClawCommand } = require('../modules/claw_bridge');
|
|
521
|
-
|
|
522
|
-
runClawCommand('runtime', { runtimeName: 'openfang' });
|
|
523
|
-
assert.strictEqual(capturedOptions.runtime.name, 'openfang', 'runtimeName option should propagate to runtime.name');
|
|
524
|
-
|
|
525
|
-
console.log(' PASS');
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
function testAccountOrdersBotKeyFallsBackToAssetIds() {
|
|
529
|
-
console.log(' account_orders botKey fallback...');
|
|
530
|
-
|
|
531
|
-
const { createBotKey } = require('../../modules/account_orders');
|
|
532
|
-
|
|
533
|
-
const idOnlyBot = { assetAId: '1.3.1', assetBId: '1.3.0' };
|
|
534
|
-
const key = createBotKey(idOnlyBot, 0);
|
|
535
|
-
assert.ok(key.includes('1-3-1'), `account_orders botKey should derive from assetAId, got: ${key}`);
|
|
536
|
-
assert.ok(key.includes('1-3-0'), `account_orders botKey should include assetBId, got: ${key}`);
|
|
537
|
-
|
|
538
|
-
// Symbol fields still take precedence
|
|
539
|
-
const symBot = { assetA: 'IOB.XRP', assetB: 'BTS', assetAId: '1.3.1', assetBId: '1.3.0' };
|
|
540
|
-
const symKey = createBotKey(symBot, 0);
|
|
541
|
-
assert.ok(symKey.includes('iob'), `symbol-based key should take precedence, got: ${symKey}`);
|
|
542
|
-
assert.ok(!symKey.includes('1-3-1'), `symbol key should not include asset ID, got: ${symKey}`);
|
|
543
|
-
|
|
544
|
-
// Aligns with claw's createBotKey
|
|
545
|
-
const clawProfiles = require('../modules/dexbot_profiles');
|
|
546
|
-
const clawKey = clawProfiles.createBotKey(idOnlyBot, 0);
|
|
547
|
-
assert.strictEqual(key, clawKey, `account_orders and claw botKey must match for same input, got: ${key} vs ${clawKey}`);
|
|
548
|
-
|
|
549
|
-
console.log(' PASS');
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
function testBuildQueryScopesAnyPoolByReceivedAsset() {
|
|
553
|
-
console.log(' kibana query pool scoping...');
|
|
554
|
-
|
|
555
|
-
const { buildDirectionalDocumentQuery } = require('../../market_adapter/core/kibana_candles');
|
|
556
|
-
const fieldMap = {
|
|
557
|
-
soldAssetField: 'operation_history.op_object.amount_to_sell.asset_id.keyword',
|
|
558
|
-
receivedAssetField: 'operation_history.op_object.min_to_receive.asset_id.keyword',
|
|
559
|
-
poolField: 'operation_history.op_object.pool.keyword'
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
// With poolId: no received asset filter needed
|
|
563
|
-
const poolScoped = buildDirectionalDocumentQuery({
|
|
564
|
-
opType: 63,
|
|
565
|
-
...fieldMap,
|
|
566
|
-
soldAssetId: '1.3.0',
|
|
567
|
-
receivedAssetId: null,
|
|
568
|
-
lookbackHours: 100,
|
|
569
|
-
poolId: '1.19.133',
|
|
570
|
-
size: 10000
|
|
571
|
-
});
|
|
572
|
-
const poolFilters = poolScoped.query.bool.filter;
|
|
573
|
-
assert.ok(
|
|
574
|
-
poolFilters.some((f: any) => f.term?.['operation_history.op_object.pool.keyword'] === '1.19.133'),
|
|
575
|
-
'pool-scoped query should filter by pool'
|
|
576
|
-
);
|
|
577
|
-
assert.ok(
|
|
578
|
-
!poolFilters.some((f: any) => f.term?.['operation_history.op_object.min_to_receive.asset_id.keyword']),
|
|
579
|
-
'pool-scoped query should not add receivedAssetId filter'
|
|
580
|
-
);
|
|
581
|
-
|
|
582
|
-
// Without poolId but with receivedAssetId: must scope by counterpart
|
|
583
|
-
const pairScoped = buildDirectionalDocumentQuery({
|
|
584
|
-
opType: 63,
|
|
585
|
-
...fieldMap,
|
|
586
|
-
soldAssetId: '1.3.0',
|
|
587
|
-
receivedAssetId: '1.3.1',
|
|
588
|
-
lookbackHours: 100,
|
|
589
|
-
poolId: null,
|
|
590
|
-
size: 10000
|
|
591
|
-
});
|
|
592
|
-
const pairFilters = pairScoped.query.bool.filter;
|
|
593
|
-
assert.ok(
|
|
594
|
-
!pairFilters.some((f: any) => f.term?.['operation_history.op_object.pool.keyword']),
|
|
595
|
-
'any-pool query should not have pool filter'
|
|
596
|
-
);
|
|
597
|
-
assert.ok(
|
|
598
|
-
pairFilters.some((f: any) => f.term?.['operation_history.op_object.min_to_receive.asset_id.keyword'] === '1.3.1'),
|
|
599
|
-
'any-pool query should filter by received asset ID'
|
|
600
|
-
);
|
|
601
|
-
|
|
602
|
-
console.log(' PASS');
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
function testClawDefaultDataPathsStayInsideClawFolder() {
|
|
606
|
-
console.log(' claw default data paths...');
|
|
607
|
-
|
|
608
|
-
// modules/paths.ts resolveClawDirs keeps claw state inside the repo's
|
|
609
|
-
// claw/ folder regardless of where the code runs from (dist or source),
|
|
610
|
-
// so anchor expectations to that folder rather than to this test file.
|
|
611
|
-
const clawDataDir = path.join(__dirname, '..', '..', '..', 'claw', 'data');
|
|
612
|
-
const clawStateDir = path.join(clawDataDir, 'state');
|
|
613
|
-
const clawInfra = require('../modules/claw_infra');
|
|
614
|
-
const { DEFAULT_STATE_PATH } = require('../modules/position_manager');
|
|
615
|
-
const { DEFAULT_HEALTH_PATH } = require('../modules/position_manager_watch');
|
|
616
|
-
|
|
617
|
-
assert.strictEqual(DEFAULT_STATE_PATH, path.join(clawDataDir, 'positions.json'));
|
|
618
|
-
assert.strictEqual(DEFAULT_HEALTH_PATH, path.join(clawDataDir, 'watcher-health.json'));
|
|
619
|
-
|
|
620
|
-
const runtime = clawInfra.createRuntimeContext();
|
|
621
|
-
assert.strictEqual(runtime.dataDir, clawDataDir);
|
|
622
|
-
assert.strictEqual(runtime.stateDir, clawStateDir);
|
|
623
|
-
|
|
624
|
-
const stateStore = clawInfra.createStateStore();
|
|
625
|
-
assert.strictEqual(stateStore.filePath, path.join(clawStateDir, 'claw-state.json'));
|
|
626
|
-
|
|
627
|
-
console.log(' PASS');
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
runEsmMockStages(
|
|
631
|
-
[
|
|
632
|
-
'native-path',
|
|
633
|
-
'wait-connected',
|
|
634
|
-
'root-exports',
|
|
635
|
-
'skill-toml',
|
|
636
|
-
'liquidity-pools',
|
|
637
|
-
'analyzer-reuse',
|
|
638
|
-
'analyzer-replace',
|
|
639
|
-
'position-manager',
|
|
640
|
-
'bridge-runtime-name',
|
|
641
|
-
'script-manifest',
|
|
642
|
-
'runtime-manifest',
|
|
643
|
-
'command-runtime-name',
|
|
644
|
-
'account-orders-bot-key',
|
|
645
|
-
'kibana-query-scopes',
|
|
646
|
-
'default-data-paths'
|
|
647
|
-
],
|
|
648
|
-
async (stage: string) => {
|
|
649
|
-
if (stage === 'native-path') {
|
|
650
|
-
await testClawBitsharesClientNativePathAndConnection();
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
if (stage === 'wait-connected') {
|
|
654
|
-
await testClawBitsharesClientWaitForConnectedTriggersNativeConnect();
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
if (stage === 'root-exports') {
|
|
658
|
-
testClawRootExportsAvoidSilentCollisions();
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
if (stage === 'skill-toml') {
|
|
662
|
-
testRuntimeSkillTomlQuotesPayloadPlaceholders();
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
if (stage === 'liquidity-pools') {
|
|
666
|
-
testLiquidityPoolWrapperInjectsSharedBitSharesClient();
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
if (stage === 'analyzer-reuse') {
|
|
670
|
-
await testDecisionLoopReusesAnalyzerStateForDuplicateMarkets();
|
|
671
|
-
return;
|
|
672
|
-
}
|
|
673
|
-
if (stage === 'analyzer-replace') {
|
|
674
|
-
await testDecisionLoopReplacesAnalyzerOnConfigChange();
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
if (stage === 'position-manager') {
|
|
678
|
-
await testPositionManagerEntryExposesSellPriceInBts();
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
if (stage === 'bridge-runtime-name') {
|
|
682
|
-
testClawBridgeRespectsRuntimeNameOption();
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
if (stage === 'script-manifest') {
|
|
686
|
-
testClawBridgeScriptManifestUsesRuntimeSpecificDescriptors();
|
|
687
|
-
return;
|
|
688
|
-
}
|
|
689
|
-
if (stage === 'runtime-manifest') {
|
|
690
|
-
await testRuntimeCommandManifestUsesRuntimeSpecificDescriptors();
|
|
691
|
-
return;
|
|
692
|
-
}
|
|
693
|
-
if (stage === 'command-runtime-name') {
|
|
694
|
-
testClawCommandInjectsRuntimeNameViaOption();
|
|
695
|
-
return;
|
|
696
|
-
}
|
|
697
|
-
if (stage === 'account-orders-bot-key') {
|
|
698
|
-
testAccountOrdersBotKeyFallsBackToAssetIds();
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
if (stage === 'kibana-query-scopes') {
|
|
702
|
-
testBuildQueryScopesAnyPoolByReceivedAsset();
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
if (stage === 'default-data-paths') {
|
|
706
|
-
testClawDefaultDataPathsStayInsideClawFolder();
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
throw new Error(`Unknown stage: ${stage}`);
|
|
710
|
-
}
|
|
711
|
-
);
|