@darksol/terminal 0.12.0 → 0.13.0
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 +10 -0
- package/package.json +1 -1
- package/src/cli.js +68 -0
- package/src/config/store.js +28 -0
- package/src/llm/intent.js +2 -0
- package/src/trading/arb-dexes.js +291 -0
- package/src/trading/arb.js +923 -0
- package/src/trading/index.js +2 -0
- package/src/web/commands.js +55 -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,59 @@ 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
|
+
// Default: show arb menu
|
|
1394
|
+
ws.sendLine(`${ANSI.gold} ◆ ARBITRAGE${ANSI.reset}`);
|
|
1395
|
+
ws.sendLine(`${ANSI.dim} ${'─'.repeat(50)}${ANSI.reset}`);
|
|
1396
|
+
ws.sendLine(` ${ANSI.white}Cross-DEX arbitrage scanner${ANSI.reset}`);
|
|
1397
|
+
ws.sendLine('');
|
|
1398
|
+
|
|
1399
|
+
ws.sendMenu('arb_action', '◆ Arb Actions', [
|
|
1400
|
+
{ value: 'arb scan', label: '🔍 Scan', desc: 'One-shot DEX price comparison' },
|
|
1401
|
+
{ value: 'arb stats', label: '📊 Stats', desc: 'View arb history & PnL' },
|
|
1402
|
+
{ value: 'arb info', label: '📖 Guide', desc: 'How arb works, setup tips, risks' },
|
|
1403
|
+
{ value: 'back', label: '← Back', desc: '' },
|
|
1404
|
+
]);
|
|
1405
|
+
|
|
1406
|
+
return {};
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1354
1409
|
// ══════════════════════════════════════════════════
|
|
1355
1410
|
// BRIDGE (LI.FI cross-chain)
|
|
1356
1411
|
// ══════════════════════════════════════════════════
|