byreal-test 1.3.5 → 1.3.6
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/cli.js +31 -0
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -7,6 +7,8 @@ const path = require('path');
|
|
|
7
7
|
const { runSuites, listTests } = require('./src/runner');
|
|
8
8
|
const { printReport, saveReport } = require('./src/reporter');
|
|
9
9
|
const allSuites = require('./src/suites');
|
|
10
|
+
const { runSwap } = require('./src/swap-runner');
|
|
11
|
+
const { runSetup } = require('./src/setup');
|
|
10
12
|
|
|
11
13
|
const program = new Command();
|
|
12
14
|
|
|
@@ -71,4 +73,33 @@ program
|
|
|
71
73
|
listTests(allSuites, opts);
|
|
72
74
|
});
|
|
73
75
|
|
|
76
|
+
program
|
|
77
|
+
.command('setup')
|
|
78
|
+
.description('Interactive setup: configure wallet, RPC, and Lark webhook')
|
|
79
|
+
.action(async () => {
|
|
80
|
+
await runSetup();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
program
|
|
84
|
+
.command('run_swap')
|
|
85
|
+
.description('Run the swap smoke-test (buy → poll → sell)')
|
|
86
|
+
.option('--dry-run', 'Skip actual swap execution')
|
|
87
|
+
.option('--order-api <url>', 'Override order API base URL')
|
|
88
|
+
.option('--kline-api <url>', 'Override kline API base URL')
|
|
89
|
+
.option('--lark <url>', 'Lark webhook URL for alerts')
|
|
90
|
+
.option('--window1 <ms>', 'Phase-1 poll window in ms', '10000')
|
|
91
|
+
.option('--window2 <ms>', 'Phase-2 poll window in ms', '30000')
|
|
92
|
+
.option('--interval <ms>', 'Poll interval in ms', '2000')
|
|
93
|
+
.action(async (opts) => {
|
|
94
|
+
await runSwap({
|
|
95
|
+
dryRun: !!opts.dryRun,
|
|
96
|
+
orderApiUrl: opts.orderApi,
|
|
97
|
+
klineApiUrl: opts.klineApi,
|
|
98
|
+
larkWebhook: opts.lark,
|
|
99
|
+
window1Ms: parseInt(opts.window1, 10),
|
|
100
|
+
window2Ms: parseInt(opts.window2, 10),
|
|
101
|
+
intervalMs: parseInt(opts.interval, 10),
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
74
105
|
program.parse(process.argv);
|