clawmoney 0.15.0 → 0.15.2
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/dist/index.js +50 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,56 @@ program
|
|
|
31
31
|
process.exit(1);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
+
// account
|
|
35
|
+
program
|
|
36
|
+
.command('account')
|
|
37
|
+
.description('Show current agent info (wallet, email, slug, credits)')
|
|
38
|
+
.action(async () => {
|
|
39
|
+
try {
|
|
40
|
+
const { requireConfig } = await import('./utils/config.js');
|
|
41
|
+
const { apiGet } = await import('./utils/api.js');
|
|
42
|
+
const chalk = (await import('chalk')).default;
|
|
43
|
+
const ora = (await import('ora')).default;
|
|
44
|
+
const config = requireConfig();
|
|
45
|
+
const spinner = ora('Fetching account info...').start();
|
|
46
|
+
const resp = await apiGet('/api/v1/claw-agents/me', config.api_key);
|
|
47
|
+
if (!resp.ok) {
|
|
48
|
+
spinner.fail(`Failed: ${resp.status}`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const a = resp.data;
|
|
52
|
+
spinner.succeed('Account');
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(` ${chalk.bold('Agent:')} ${a.name ?? '-'} (${a.slug ?? '-'})`);
|
|
55
|
+
console.log(` ${chalk.bold('ID:')} ${a.id ?? '-'}`);
|
|
56
|
+
console.log(` ${chalk.bold('Email:')} ${a.email ?? '-'}`);
|
|
57
|
+
console.log(` ${chalk.bold('Wallet:')} ${a.wallet_address ?? 'not set'}`);
|
|
58
|
+
console.log(` ${chalk.bold('Status:')} ${a.status ?? '-'}`);
|
|
59
|
+
const credResp = await apiGet('/api/v1/relay/credits', config.api_key);
|
|
60
|
+
if (credResp.ok && credResp.data) {
|
|
61
|
+
console.log(` ${chalk.bold('Credits:')} $${Number(credResp.data.balance_usd ?? 0).toFixed(2)}`);
|
|
62
|
+
}
|
|
63
|
+
// Query on-chain wallet balance via awal
|
|
64
|
+
if (a.wallet_address) {
|
|
65
|
+
try {
|
|
66
|
+
const { awalExec } = await import('./utils/awal.js');
|
|
67
|
+
const balResult = await awalExec(['balance']);
|
|
68
|
+
const balData = balResult.data;
|
|
69
|
+
if (balData && typeof balData === 'object') {
|
|
70
|
+
console.log(` ${chalk.bold('On-chain:')} ${Object.entries(balData).map(([k, v]) => `${v} ${k}`).join(', ') || '0'}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// awal not installed or not configured — skip silently
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
console.log('');
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
console.error(err.message);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
34
84
|
// browse
|
|
35
85
|
program
|
|
36
86
|
.command('browse')
|