terafab-cli 1.1.6 ā 1.1.7
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/package.json +1 -1
- package/terafab.js +20 -27
package/package.json
CHANGED
package/terafab.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
2
|
const { Command } = require('commander');
|
|
4
3
|
const { ethers } = require('ethers');
|
|
5
4
|
const fs = require('fs');
|
|
@@ -19,19 +18,26 @@ function getVaultKey() {
|
|
|
19
18
|
return null;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
program
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.
|
|
21
|
+
program.name('terafab').version('1.1.6');
|
|
22
|
+
|
|
23
|
+
program.command('status')
|
|
24
|
+
.description('Check network health')
|
|
25
|
+
.action(async () => {
|
|
26
|
+
try {
|
|
27
|
+
const res = await fetch(`${API_BASE}/v1/watcher`);
|
|
28
|
+
const d = await res.json();
|
|
29
|
+
const advice = d.advice || 'Market signals are being analyzed...';
|
|
30
|
+
console.log(`\nStatus: ${d.healthy ? 'š¢ Operational' : 'š“ Issues'}`);
|
|
31
|
+
console.log(`Advice: ${advice}`);
|
|
32
|
+
} catch (e) { console.error('ā Server offline.'); }
|
|
33
|
+
});
|
|
26
34
|
|
|
27
|
-
// --- BRIDGE OHNE TX ---
|
|
28
35
|
program.command('bridge')
|
|
29
|
-
.description('Start a no-KYC swap to Monero
|
|
36
|
+
.description('Start a no-KYC swap to Monero')
|
|
30
37
|
.option('-f, --from <chain>', 'sol, eth, btc', 'sol')
|
|
31
|
-
.option('-a, --amount <n>', 'Amount
|
|
32
|
-
.requiredOption('-to, --address <addr>', '
|
|
38
|
+
.option('-a, --amount <n>', 'Amount', '0.1')
|
|
39
|
+
.requiredOption('-to, --address <addr>', 'XMR address')
|
|
33
40
|
.action(async (o) => {
|
|
34
|
-
console.log(`ā³ Initializing bridge: ${o.amount} ${o.from.toUpperCase()} -> XMR...`);
|
|
35
41
|
try {
|
|
36
42
|
const res = await fetch(`${API_BASE}/v1/xmr/create`, {
|
|
37
43
|
method: 'POST',
|
|
@@ -41,25 +47,13 @@ program.command('bridge')
|
|
|
41
47
|
const d = await res.json();
|
|
42
48
|
if (d.error) console.log(`\nā Error: ${d.error}`);
|
|
43
49
|
else {
|
|
44
|
-
console.log(`\nā
BRIDGE ORDER CREATED
|
|
45
|
-
console.log(
|
|
46
|
-
console.log(`
|
|
47
|
-
console.log(`TO ADDRESS: ${d.payinAddress}`);
|
|
48
|
-
console.log(`--------------------------------------`);
|
|
49
|
-
console.log(`ESTIMATED: ~${d.estimatedXmr} XMR`);
|
|
50
|
-
console.log(`ORDER ID: ${d.orderId}`);
|
|
51
|
-
console.log(`TRACKING: ${d.trackUrl}`);
|
|
50
|
+
console.log(`\nā
BRIDGE ORDER CREATED\n----------------------`);
|
|
51
|
+
console.log(`SEND: ${o.amount} ${o.from.toUpperCase()} TO: ${d.payinAddress}`);
|
|
52
|
+
console.log(`ESTIMATED: ~${d.estimatedXmr} XMR`);
|
|
52
53
|
}
|
|
53
|
-
} catch (e) { console.error('ā
|
|
54
|
+
} catch (e) { console.error('ā Connection failed.'); }
|
|
54
55
|
});
|
|
55
56
|
|
|
56
|
-
// --- PUBLIC TOOLS ---
|
|
57
|
-
program.command('status').action(async () => {
|
|
58
|
-
const res = await fetch(`${API_BASE}/v1/watcher`);
|
|
59
|
-
const d = await res.json();
|
|
60
|
-
console.log(`Status: ${d.healthy ? 'š¢' : 'š“'} | Advice: ${d.advice}`);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
57
|
program.command('xmr:quote').option('-f, --from <c>', 'sol').option('-a, --amount <n>', '0.1').action(async (o) => {
|
|
64
58
|
const res = await fetch(`${API_BASE}/v1/xmr/quote?from=${o.from}&amount=${o.amount}`);
|
|
65
59
|
const d = await res.json();
|
|
@@ -71,7 +65,6 @@ program.command('wallet:create').action(() => {
|
|
|
71
65
|
console.log(`ā
Address: ${w.address}\nš Key: ${w.privateKey}`);
|
|
72
66
|
});
|
|
73
67
|
|
|
74
|
-
// --- AI & TRAINING (Auth required) ---
|
|
75
68
|
program.command('auth').argument('<key>').action((key) => {
|
|
76
69
|
fs.writeFileSync(VAULT_PATH, JSON.stringify({ k: key }), { mode: 0o600 });
|
|
77
70
|
console.log('ā
Key vaulted.');
|