@agenttech/tpay-cli 0.0.1

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.
Files changed (3) hide show
  1. package/README.md +87 -0
  2. package/dist/index.js +64424 -0
  3. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # @agentpay/tpay-cli
2
+
3
+ A CLI for AI agents to send USDC/USDT via the T402 x402 v2 payment protocol.
4
+ Output defaults to structured JSON. Use `--format text` for human-readable output. Logs go to stderr.
5
+
6
+ ## Commands
7
+
8
+ | Command | Description |
9
+ |---|---|
10
+ | `tpay setup` | Configure wallet keys interactively |
11
+ | `tpay setup --from-env <file>` | Import keys from an env file |
12
+ | `tpay send --to <addr> --amount <n> --chain <chain>` | Send payment |
13
+ | `tpay intent status <intent_id>` | Check payment status |
14
+ | `tpay version` | Print version |
15
+ | `tpay help` / `tpay --help` | Show all commands |
16
+ | `tpay send --help` | Show send args |
17
+
18
+ Global flags:
19
+ - `--verbose` — debug output to stderr
20
+ - `--format text|json` — output format (default: `json`)
21
+
22
+ ```bash
23
+ # JSON output (default, for programmatic use)
24
+ tpay send --to 0x... --amount 10 --chain base
25
+ {"status":"success","intent_id":"...","tx_hash":"...","explorer_url":"..."}
26
+
27
+ # Text output (human-readable)
28
+ tpay send --to 0x... --amount 10 --chain base --format text
29
+ status: success
30
+ intent_id: abc123
31
+ tx_hash: 0x...
32
+ explorer_url: https://...
33
+ ```
34
+
35
+ Stdin JSON mode: pipe `{"to":"...","amount":"...","chain":"..."}` to `tpay send`.
36
+
37
+ ## Supported Chains
38
+
39
+ | `--chain` value | Network |
40
+ |---|---|
41
+ | `base` | Base Mainnet (EVM) |
42
+ | `bsc` | BSC Mainnet (EVM) |
43
+ | `base-sepolia` | Base Sepolia (EVM testnet) |
44
+ | `solana` | Solana Mainnet |
45
+ | `solana-devnet` | Solana Devnet |
46
+
47
+ ## Runtime Environment Variables
48
+
49
+ | Variable | Required | Description |
50
+ |---|---|---|
51
+ | `WALLET_PROVIDER` | No (default: `env`) | Wallet plugin name |
52
+ | `WALLET_SEED_PHRASE` | Yes (for Solana) | BIP-39 mnemonic seed phrase |
53
+ | `WALLET_EVM_PRIVATE_KEY` | For EVM chains | Hex private key (`0x...`) |
54
+
55
+ ## Build
56
+
57
+ ```bash
58
+ T402_API_URL=https://api.example.com \
59
+ SOLANA_RPC_URL=https://your-rpc.example.com \
60
+ SOLANA_FEE_PAYER=<base58> \
61
+ bun build --compile src/index.ts --outfile tpay
62
+ ```
63
+
64
+ ## Development
65
+
66
+ ```bash
67
+ bun install
68
+ bun test
69
+ T402_API_URL=https://... WALLET_EVM_PRIVATE_KEY=0x... bun run src/index.ts send --to 0x... --amount 1 --chain base
70
+ ```
71
+
72
+ ## Adding a New Chain Plugin
73
+
74
+ - [ ] Create `src/plugins/chains/<name>.ts`
75
+ - [ ] Implement `ChainPlugin` interface (`name`, `chains[]`, `sign()`)
76
+ - [ ] Add to `CHAIN_PLUGIN_LOADERS` in `src/loader.ts`
77
+ - [ ] Add to Supported Chains table above
78
+ - [ ] Test: verify x402 payload structure matches T402 backend
79
+
80
+ ## Adding a New Wallet Plugin
81
+
82
+ - [ ] Create `src/plugins/wallets/<name>.ts`
83
+ - [ ] Implement `WalletPlugin` interface (`name`, `getEvmPrivateKey()`, `getSolanaSeed()`)
84
+ - [ ] Add to `WALLET_PLUGINS` map in `src/loader.ts`
85
+ - [ ] Document required env vars above
86
+ - [ ] Ensure key/seed return values are never logged
87
+ - [ ] Test: verify loads when `WALLET_PROVIDER=<name>` is set