@darksol/terminal 0.12.0 → 0.13.1
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/AUDIT-2026-03-14.md +241 -0
- package/README.md +16 -0
- package/package.json +1 -1
- package/src/cli.js +93 -0
- package/src/config/store.js +28 -0
- package/src/llm/intent.js +2 -0
- package/src/trading/arb-ai.js +827 -0
- package/src/trading/arb-dexes.js +291 -0
- package/src/trading/arb.js +971 -0
- package/src/trading/index.js +2 -0
- package/src/web/commands.js +99 -0
package/src/trading/index.js
CHANGED
|
@@ -2,3 +2,5 @@ export { executeSwap, resolveToken, getTokenInfo } from './swap.js';
|
|
|
2
2
|
export { snipeToken, watchSnipe } from './snipe.js';
|
|
3
3
|
export { createDCA, listDCA, cancelDCA, runDCA } from './dca.js';
|
|
4
4
|
export { executeLifiSwap, executeLifiBridge, checkBridgeStatus, showSupportedChains } from '../services/lifi.js';
|
|
5
|
+
export { arbScan, arbMonitor, arbExecute, arbStats, arbConfig, arbAddEndpoint, arbAddPair, arbRemovePair, arbInfo } from './arb.js';
|
|
6
|
+
export { DEX_ADAPTERS, getDexesForChain } from './arb-dexes.js';
|
package/src/web/commands.js
CHANGED
|
@@ -902,6 +902,8 @@ export async function handleCommand(cmd, ws) {
|
|
|
902
902
|
return await cmdMarket(args, ws);
|
|
903
903
|
case 'trade':
|
|
904
904
|
return await cmdTrade(args, ws);
|
|
905
|
+
case 'arb':
|
|
906
|
+
return await cmdArb(args, ws);
|
|
905
907
|
case 'bridge':
|
|
906
908
|
return await cmdBridge(args, ws);
|
|
907
909
|
case 'wallet':
|
|
@@ -1351,6 +1353,103 @@ async function cmdTrade(args, ws) {
|
|
|
1351
1353
|
return {};
|
|
1352
1354
|
}
|
|
1353
1355
|
|
|
1356
|
+
// ══════════════════════════════════════════════════
|
|
1357
|
+
// ARBITRAGE
|
|
1358
|
+
// ══════════════════════════════════════════════════
|
|
1359
|
+
async function cmdArb(args, ws) {
|
|
1360
|
+
const sub = (args[0] || '').toLowerCase();
|
|
1361
|
+
|
|
1362
|
+
if (sub === 'scan') {
|
|
1363
|
+
ws.sendLine(` ${ANSI.dim}Running arb scan...${ANSI.reset}`);
|
|
1364
|
+
try {
|
|
1365
|
+
const { arbScan } = await import('../trading/arb.js');
|
|
1366
|
+
await arbScan({ chain: args[1] || getConfig('chain') || 'base' });
|
|
1367
|
+
} catch (e) {
|
|
1368
|
+
ws.sendLine(` ${ANSI.red}Scan failed: ${e.message}${ANSI.reset}`);
|
|
1369
|
+
}
|
|
1370
|
+
return {};
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
if (sub === 'stats') {
|
|
1374
|
+
try {
|
|
1375
|
+
const { arbStats } = await import('../trading/arb.js');
|
|
1376
|
+
await arbStats({ days: args[1] || '7' });
|
|
1377
|
+
} catch (e) {
|
|
1378
|
+
ws.sendLine(` ${ANSI.red}Stats failed: ${e.message}${ANSI.reset}`);
|
|
1379
|
+
}
|
|
1380
|
+
return {};
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
if (sub === 'info') {
|
|
1384
|
+
try {
|
|
1385
|
+
const { arbInfo } = await import('../trading/arb.js');
|
|
1386
|
+
await arbInfo();
|
|
1387
|
+
} catch (e) {
|
|
1388
|
+
ws.sendLine(` ${ANSI.red}${e.message}${ANSI.reset}`);
|
|
1389
|
+
}
|
|
1390
|
+
return {};
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
if (sub === 'ai') {
|
|
1394
|
+
try {
|
|
1395
|
+
const { aiStrategyBriefing } = await import('../trading/arb-ai.js');
|
|
1396
|
+
await aiStrategyBriefing({ chain: args[1] || getConfig('chain') || 'base' });
|
|
1397
|
+
} catch (e) {
|
|
1398
|
+
ws.sendLine(` ${ANSI.red}AI briefing failed: ${e.message}${ANSI.reset}`);
|
|
1399
|
+
}
|
|
1400
|
+
return {};
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
if (sub === 'discover') {
|
|
1404
|
+
try {
|
|
1405
|
+
const { aiDiscoverPairs } = await import('../trading/arb-ai.js');
|
|
1406
|
+
await aiDiscoverPairs({ chain: args[1] || getConfig('chain') || 'base' });
|
|
1407
|
+
} catch (e) {
|
|
1408
|
+
ws.sendLine(` ${ANSI.red}Discovery failed: ${e.message}${ANSI.reset}`);
|
|
1409
|
+
}
|
|
1410
|
+
return {};
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
if (sub === 'tune') {
|
|
1414
|
+
try {
|
|
1415
|
+
const { aiTuneThresholds } = await import('../trading/arb-ai.js');
|
|
1416
|
+
await aiTuneThresholds({ chain: args[1] || getConfig('chain') || 'base' });
|
|
1417
|
+
} catch (e) {
|
|
1418
|
+
ws.sendLine(` ${ANSI.red}Tuning failed: ${e.message}${ANSI.reset}`);
|
|
1419
|
+
}
|
|
1420
|
+
return {};
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
if (sub === 'learn') {
|
|
1424
|
+
try {
|
|
1425
|
+
const { aiLearn } = await import('../trading/arb-ai.js');
|
|
1426
|
+
await aiLearn({ chain: args[1] || getConfig('chain') || 'base' });
|
|
1427
|
+
} catch (e) {
|
|
1428
|
+
ws.sendLine(` ${ANSI.red}Learning failed: ${e.message}${ANSI.reset}`);
|
|
1429
|
+
}
|
|
1430
|
+
return {};
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
// Default: show arb menu
|
|
1434
|
+
ws.sendLine(`${ANSI.gold} ◆ ARBITRAGE${ANSI.reset}`);
|
|
1435
|
+
ws.sendLine(`${ANSI.dim} ${'─'.repeat(50)}${ANSI.reset}`);
|
|
1436
|
+
ws.sendLine(` ${ANSI.white}AI-powered cross-DEX arbitrage${ANSI.reset}`);
|
|
1437
|
+
ws.sendLine('');
|
|
1438
|
+
|
|
1439
|
+
ws.sendMenu('arb_action', '◆ Arb Actions', [
|
|
1440
|
+
{ value: 'arb scan', label: '🔍 Scan', desc: 'AI-scored DEX price comparison' },
|
|
1441
|
+
{ value: 'arb ai', label: '🧠 AI Briefing', desc: 'Strategy assessment + recommendations' },
|
|
1442
|
+
{ value: 'arb discover', label: '📈 Discover', desc: 'AI pair discovery — find new opportunities' },
|
|
1443
|
+
{ value: 'arb tune', label: '🔧 Tune', desc: 'AI threshold optimization' },
|
|
1444
|
+
{ value: 'arb learn', label: '📚 Learn', desc: 'Run learning cycle on history' },
|
|
1445
|
+
{ value: 'arb stats', label: '📊 Stats', desc: 'View arb history & PnL' },
|
|
1446
|
+
{ value: 'arb info', label: '📖 Guide', desc: 'How arb works, setup tips, risks' },
|
|
1447
|
+
{ value: 'back', label: '← Back', desc: '' },
|
|
1448
|
+
]);
|
|
1449
|
+
|
|
1450
|
+
return {};
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1354
1453
|
// ══════════════════════════════════════════════════
|
|
1355
1454
|
// BRIDGE (LI.FI cross-chain)
|
|
1356
1455
|
// ══════════════════════════════════════════════════
|