@darksol/terminal 0.5.7 → 0.5.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darksol/terminal",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "description": "DARKSOL Terminal — unified CLI for all DARKSOL services. Market intel, trading, oracle, casino, and more.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@ const config = new Conf({
31
31
  default: {
32
32
  oracle: 'https://acp.darksol.net/oracle',
33
33
  casino: 'https://casino.darksol.net',
34
- cards: 'https://acp.darksol.net/cards',
34
+ cards: 'https://acp.darksol.net',
35
35
  facilitator: 'https://facilitator.darksol.net',
36
36
  builders: 'https://builders.darksol.net',
37
37
  market: 'https://acp.darksol.net/market',
@@ -1,29 +1,50 @@
1
1
  import { fetchJSON } from '../utils/fetch.js';
2
2
  import { getServiceURL } from '../config/store.js';
3
3
  import { theme } from '../ui/theme.js';
4
- import { spinner, kvDisplay, error } from '../ui/components.js';
4
+ import { spinner, kvDisplay, error, info } from '../ui/components.js';
5
5
  import { showSection } from '../ui/banner.js';
6
6
 
7
+ // Facilitator root returns service info (no /api/health path)
7
8
  const getURL = () => getServiceURL('facilitator') || 'https://facilitator.darksol.net';
8
9
 
9
10
  export async function facilitatorHealth() {
10
11
  const spin = spinner('Checking facilitator...').start();
11
12
  try {
12
- const data = await fetchJSON(`${getURL()}/api/health`);
13
+ const data = await fetchJSON(`${getURL()}/`);
13
14
  spin.succeed('Facilitator online');
14
15
 
15
- showSection('FACILITATOR STATUS');
16
- kvDisplay(Object.entries(data).map(([k, v]) => [k, typeof v === 'object' ? JSON.stringify(v) : String(v)]));
16
+ showSection('x402 FACILITATOR');
17
+ kvDisplay([
18
+ ['Service', data.service || 'DARKSOL Facilitator'],
19
+ ['Version', data.version || '-'],
20
+ ['Protocol', data.protocol || 'x402'],
21
+ ['Fee', data.fee || '0%'],
22
+ ['Chains', Array.isArray(data.chains) ? data.chains.join(', ') : (data.chains || 'Base, Polygon')],
23
+ ['Status', theme.success('● Online')],
24
+ ]);
25
+ if (data.description) {
26
+ console.log('');
27
+ console.log(theme.dim(` ${data.description}`));
28
+ }
29
+ if (data.contracts) {
30
+ console.log('');
31
+ for (const [chain, addr] of Object.entries(data.contracts)) {
32
+ console.log(` ${theme.gold(chain.padEnd(10))} ${theme.dim(addr)}`);
33
+ }
34
+ }
35
+ console.log('');
36
+ info('Docs: https://acp.darksol.net/facilitator');
17
37
  } catch (err) {
18
38
  spin.fail('Facilitator unreachable');
19
39
  error(err.message);
40
+ info('Check: https://facilitator.darksol.net');
20
41
  }
21
42
  }
22
43
 
23
44
  export async function facilitatorVerify(payment) {
24
45
  const spin = spinner('Verifying payment...').start();
25
46
  try {
26
- const data = await fetchJSON(`${getURL()}/api/verify`, {
47
+ const data = await fetchJSON(`${getURL()}/verify`, {
27
48
  method: 'POST',
28
49
  headers: { 'Content-Type': 'application/json' },
29
50
  body: JSON.stringify(typeof payment === 'string' ? JSON.parse(payment) : payment),
@@ -41,7 +62,7 @@ export async function facilitatorVerify(payment) {
41
62
  export async function facilitatorSettle(payment) {
42
63
  const spin = spinner('Settling on-chain...').start();
43
64
  try {
44
- const data = await fetchJSON(`${getURL()}/api/settle`, {
65
+ const data = await fetchJSON(`${getURL()}/settle`, {
45
66
  method: 'POST',
46
67
  headers: { 'Content-Type': 'application/json' },
47
68
  body: JSON.stringify(typeof payment === 'string' ? JSON.parse(payment) : payment),
@@ -1138,34 +1138,48 @@ async function cmdOracle(args, ws) {
1138
1138
  }
1139
1139
 
1140
1140
  async function cmdCasino(args, ws) {
1141
+ ws.sendLine(`${ANSI.gold} ◆ CASINO${ANSI.reset}`);
1142
+ ws.sendLine(`${ANSI.dim} ${'─'.repeat(50)}${ANSI.reset}`);
1141
1143
  try {
1142
- const resp = await fetch('https://casino.darksol.net/health');
1144
+ const resp = await fetch('https://casino.darksol.net/api/stats');
1145
+ const ct = resp.headers.get('content-type') || '';
1146
+ if (!ct.includes('json')) throw new Error('not json');
1143
1147
  const data = await resp.json();
1144
1148
 
1145
- ws.sendLine(`${ANSI.gold} CASINO${ANSI.reset}`);
1146
- ws.sendLine(`${ANSI.dim} ${''.repeat(50)}${ANSI.reset}`);
1147
- ws.sendLine(` ${ANSI.darkGold}Status${ANSI.reset} ${data.status || 'unknown'}`);
1149
+ ws.sendLine(` ${ANSI.darkGold}Status${ANSI.reset} ${ANSI.green}● Online${ANSI.reset}`);
1150
+ ws.sendLine(` ${ANSI.darkGold}Bankroll${ANSI.reset} ${ANSI.white}$${data.bankrollUsdc || '0'} USDC${ANSI.reset}`);
1151
+ ws.sendLine(` ${ANSI.darkGold}Total Bets${ANSI.reset} ${ANSI.white}${data.totalBets || 0}${ANSI.reset}`);
1152
+ ws.sendLine(` ${ANSI.darkGold}Win Rate${ANSI.reset} ${ANSI.white}${data.winRate || '0'}%${ANSI.reset}`);
1148
1153
  ws.sendLine(` ${ANSI.darkGold}Endpoint${ANSI.reset} ${ANSI.blue}casino.darksol.net${ANSI.reset}`);
1154
+ ws.sendLine(` ${ANSI.darkGold}Docs${ANSI.reset} ${ANSI.blue}casino.darksol.net/docs${ANSI.reset}`);
1149
1155
  ws.sendLine('');
1150
1156
  } catch {
1151
- ws.sendLine(` ${ANSI.dim}Casino unreachable${ANSI.reset}`);
1157
+ ws.sendLine(` ${ANSI.red}Casino unreachable${ANSI.reset}`);
1158
+ ws.sendLine(` ${ANSI.dim}Check: https://casino.darksol.net/docs${ANSI.reset}`);
1152
1159
  ws.sendLine('');
1153
1160
  }
1154
1161
  return {};
1155
1162
  }
1156
1163
 
1157
1164
  async function cmdFacilitator(args, ws) {
1165
+ ws.sendLine(`${ANSI.gold} ◆ x402 FACILITATOR${ANSI.reset}`);
1166
+ ws.sendLine(`${ANSI.dim} ${'─'.repeat(50)}${ANSI.reset}`);
1158
1167
  try {
1159
- const resp = await fetch('https://facilitator.darksol.net/health');
1168
+ const resp = await fetch('https://facilitator.darksol.net/');
1169
+ const ct = resp.headers.get('content-type') || '';
1170
+ if (!ct.includes('json')) throw new Error('not json');
1160
1171
  const data = await resp.json();
1161
1172
 
1162
- ws.sendLine(`${ANSI.gold} FACILITATOR${ANSI.reset}`);
1163
- ws.sendLine(`${ANSI.dim} ${''.repeat(50)}${ANSI.reset}`);
1164
- ws.sendLine(` ${ANSI.darkGold}Status${ANSI.reset} ${data.status || 'unknown'}`);
1165
- ws.sendLine(` ${ANSI.darkGold}Endpoint${ANSI.reset} ${ANSI.blue}facilitator.darksol.net${ANSI.reset}`);
1173
+ ws.sendLine(` ${ANSI.darkGold}Status${ANSI.reset} ${ANSI.green}● Online${ANSI.reset}`);
1174
+ ws.sendLine(` ${ANSI.darkGold}Service${ANSI.reset} ${ANSI.white}${data.service || 'DARKSOL Facilitator'}${ANSI.reset}`);
1175
+ ws.sendLine(` ${ANSI.darkGold}Protocol${ANSI.reset} ${ANSI.white}${data.protocol || 'x402'}${ANSI.reset}`);
1176
+ ws.sendLine(` ${ANSI.darkGold}Fee${ANSI.reset} ${ANSI.green}${data.fee || '0%'}${ANSI.reset}`);
1177
+ ws.sendLine(` ${ANSI.darkGold}Chains${ANSI.reset} ${ANSI.white}${Array.isArray(data.chains) ? data.chains.join(', ') : 'Base, Polygon'}${ANSI.reset}`);
1178
+ ws.sendLine(` ${ANSI.darkGold}Docs${ANSI.reset} ${ANSI.blue}acp.darksol.net/facilitator${ANSI.reset}`);
1166
1179
  ws.sendLine('');
1167
1180
  } catch {
1168
- ws.sendLine(` ${ANSI.dim}Facilitator unreachable${ANSI.reset}`);
1181
+ ws.sendLine(` ${ANSI.red}Facilitator unreachable${ANSI.reset}`);
1182
+ ws.sendLine(` ${ANSI.dim}Check: https://acp.darksol.net/facilitator${ANSI.reset}`);
1169
1183
  ws.sendLine('');
1170
1184
  }
1171
1185
  return {};
@@ -3,8 +3,8 @@
3
3
  ══════════════════════════════════════════════════ */
4
4
 
5
5
  :root {
6
- --bg: #0a0a1a;
7
- --bg-surface: #111128;
6
+ --bg: #000000;
7
+ --bg-surface: #0a0a0a;
8
8
  --gold: #FFD700;
9
9
  --dark-gold: #B8860B;
10
10
  --text: #e0e0e0;
@@ -12,7 +12,7 @@
12
12
  --accent: #e94560;
13
13
  --green: #00ff88;
14
14
  --blue: #4488ff;
15
- --border: #1a1a3e;
15
+ --border: #1a1a1a;
16
16
  }
17
17
 
18
18
  * {
@@ -44,13 +44,13 @@ let promptMask = false;
44
44
  async function init() {
45
45
  term = new Terminal({
46
46
  theme: {
47
- background: '#0a0a1a',
47
+ background: '#000000',
48
48
  foreground: '#e0e0e0',
49
49
  cursor: '#FFD700',
50
- cursorAccent: '#0a0a1a',
50
+ cursorAccent: '#000000',
51
51
  selectionBackground: 'rgba(255, 215, 0, 0.2)',
52
52
  selectionForeground: '#ffffff',
53
- black: '#0a0a1a',
53
+ black: '#000000',
54
54
  red: '#e94560',
55
55
  green: '#00ff88',
56
56
  yellow: '#FFD700',