@oneie/cli 0.8.0 → 0.9.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/README.md CHANGED
@@ -73,10 +73,11 @@ Every actor — human or agent — gets real, self-custodied multi-chain wallets
73
73
  one wallet create --workspace <slug> --kind agent # provision a wallet row (idempotent)
74
74
  one wallet get --workspace <slug> # credits, ceiling, live balances, delegated wallets
75
75
  one wallet transactions --workspace <slug> --limit 50 # unified feed across every settlement rail
76
+ one wallet faucet <address> --chain sui # fund from testnet — sui/sol auto-fund, others return a manual URL
76
77
  one wallet send <to> --chain SUI --amount 5 --payment-tx <hash> --workspace <slug>
77
78
  ```
78
79
 
79
- `send` never signs — sign and broadcast the transfer yourself first (`agent-wallet-client.ts` for an agent, `/w` for a human), then pass the resulting transaction hash. The private key never crosses this command.
80
+ `send` never signs — sign and broadcast the transfer yourself first (`agent-wallet-client.ts` for an agent, `/w` for a human), then pass the resulting transaction hash. The private key never crosses this command. `faucet` talks to `pay.one.ie` directly (its own protocol, not the `/ask` gateway) and needs no credential — funding any address is public by design, funding ≠ ownership.
80
81
 
81
82
  ## Chat — fan in · fan out
82
83
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,7 @@
1
1
  import { Command } from 'commander';
2
2
  export declare function askPath(base: string, receiver: string): string;
3
+ export declare function faucetOk(results: Array<{
4
+ success: boolean;
5
+ }>): boolean;
3
6
  export declare function okWrap(result: Record<string, unknown>): Record<string, unknown>;
4
7
  export declare function walletCmd(): Command;
@@ -29,6 +29,23 @@ async function ask(base, key, receiver, data) {
29
29
  }
30
30
  return envelope.result ?? envelope;
31
31
  }
32
+ const DEFAULT_PAY = process.env.ONEIE_PAY_URL ?? 'https://pay.one.ie';
33
+ // pay.one.ie is a separate service from the gateway/one.ie ask surface above —
34
+ // its own protocol envelope, POST <payUrl>/ { protocol, data } → { success, data,
35
+ // error? }. faucet_request is public (no credential), matching the threat model:
36
+ // funding ≠ ownership, anyone can fund any address (wallet-plan.md).
37
+ async function payProtocol(payUrl, protocol, data) {
38
+ const res = await fetch(`${payUrl.replace(/\/$/, '')}/`, {
39
+ method: 'POST',
40
+ headers: { 'Content-Type': 'application/json' },
41
+ body: JSON.stringify({ protocol, data }),
42
+ });
43
+ const body = (await res.json().catch(() => ({})));
44
+ if (!res.ok || !body.success) {
45
+ throw new Error(`${protocol} → ${body.error?.message ?? body.error?.code ?? res.status}`);
46
+ }
47
+ return body.data ?? {};
48
+ }
32
49
  function resolveAuth(opts) {
33
50
  const env = mergeEnv(process.cwd());
34
51
  const key = opts.key ?? env.ONEIE_API_KEY ?? env.ONE_API_KEY ?? '';
@@ -43,6 +60,14 @@ function resolveWorkspace(explicit) {
43
60
  }
44
61
  return workspace;
45
62
  }
63
+ // A chain with no auto-fund path (ETH/USDC/BTC) legitimately returns success:false
64
+ // with a manualUrls fallback — that's documented, expected behavior (wallet-plan.md:
65
+ // "SUI/SOL auto-fund; ETH/USDC/BTC return a manual URL"), never a call failure.
66
+ // `ok` here means "the request was answered" (payProtocol already throws on a real
67
+ // failure) — per-chain funded/manual status lives in `results`, read that, not `ok`.
68
+ export function faucetOk(results) {
69
+ return results.length > 0;
70
+ }
46
71
  // wallet:get/create/transactions return bare data or { error } — no `ok` field
47
72
  // of their own. wallet:send already returns { ok, ... }. Normalize both to the
48
73
  // { ok, ... } shape out() expects without ever overwriting a real error/false
@@ -55,7 +80,7 @@ export function okWrap(result) {
55
80
  return { ok: true, ...result };
56
81
  }
57
82
  export function walletCmd() {
58
- const cmd = new Command('wallet').description('Read balances, provision a wallet row, send crypto — wallet:* receivers');
83
+ const cmd = new Command('wallet').description('Read balances, provision a wallet row, fund from testnet, send crypto — wallet:* receivers + pay.one.ie');
59
84
  cmd.command('get')
60
85
  .description('Credits, spend ceiling, wallet rows, live chain balances, delegated wallets')
61
86
  .option('--workspace <slug>', 'Workspace (defaults to AGENCY_SLUG)')
@@ -93,6 +118,16 @@ export function walletCmd() {
93
118
  const result = await ask(base, key, 'wallet:transactions', { workspace, limit: Number(opts.limit) });
94
119
  out(cmd, okWrap(result));
95
120
  });
121
+ cmd.command('faucet <address>')
122
+ .description('Fund an address from a testnet tap — Sui and Solana auto-fund; ETH/USDC/BTC return a manual faucet URL')
123
+ .requiredOption('--chain <chain>', 'sui | sol | eth | usdc | btc | all')
124
+ .option('--network <network>', 'testnet | devnet (Sui only)')
125
+ .option('--pay-url <url>', 'pay.one.ie base URL', DEFAULT_PAY)
126
+ .action(async (address, opts) => {
127
+ const data = await payProtocol(opts.payUrl, 'faucet_request', { chain: opts.chain, address, network: opts.network });
128
+ const results = (data.results ?? []);
129
+ out(cmd, { ok: faucetOk(results), results, manualFaucets: data.manualFaucets });
130
+ });
96
131
  cmd.command('send <to>')
97
132
  .description('Send crypto via pay.one.ie payment links, incl. Bitcoin — sign the transfer yourself first, pass the tx hash')
98
133
  .requiredOption('--chain <chain>', 'SUI | EVM | SOL | BTC | BASE | ARB | OPT')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneie/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "ONE agent CLI",
5
5
  "type": "module",
6
6
  "bin": {