@t2000/cli 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 t2000
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,213 @@
1
+ # @t2000/cli
2
+
3
+ Terminal bank account for AI agents on Sui. One command to create a bank account, send USDC, earn yield, swap, borrow, and pay for APIs.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@t2000/cli)](https://www.npmjs.com/package/@t2000/cli)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ **[Website](https://t2000.ai)** · **[GitHub](https://github.com/mission69b/t2000)** · **[SDK](https://www.npmjs.com/package/@t2000/sdk)** · **[x402](https://www.npmjs.com/package/@t2000/x402)**
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install -g @t2000/cli
14
+ # or
15
+ npx @t2000/cli init
16
+ ```
17
+
18
+ **Requirements:** Node.js 18+
19
+
20
+ ## Quick Start
21
+
22
+ ```
23
+ ❯ t2000 init
24
+
25
+ Creating agent wallet...
26
+ ✓ Keypair generated
27
+ ✓ Network Sui mainnet
28
+ ✓ Gas sponsorship enabled
29
+
30
+ Setting up accounts...
31
+ ✓ Checking ✓ Savings ✓ Credit ✓ Exchange ✓ 402 Pay
32
+
33
+ 🎉 Bank account created
34
+ Address: 0x8b3e4f2a...
35
+
36
+ Deposit USDC on Sui network only.
37
+ ─────────────────────────────────────────────────────
38
+ t2000 balance check for funds
39
+ t2000 save all start earning yield
40
+ t2000 address show address again
41
+
42
+ ❯ t2000 send 10 USDC to 0x8b3e...d412
43
+ ✓ Sent $10.00 USDC → 0x8b3e...d412
44
+ Tx: https://suiscan.xyz/mainnet/tx/0xa1b2...
45
+
46
+ ❯ t2000 save 80 USDC
47
+ ✓ Saved $80.00 USDC to NAVI
48
+ ✓ Protocol fee: $0.08 USDC (0.1%)
49
+ ✓ Current APY: 4.21%
50
+ ✓ Savings balance: $79.92 USDC
51
+ Tx: https://suiscan.xyz/mainnet/tx/0x9f2c...
52
+
53
+ ❯ t2000 borrow 20 USDC
54
+ ✓ Borrowed $20.00 USDC
55
+ Health Factor: 3.39
56
+ Tx: https://suiscan.xyz/mainnet/tx/0xb3c4...
57
+
58
+ ❯ t2000 swap 5 USDC to SUI
59
+ ✓ Swapped 5 USDC → 5.83 SUI
60
+ Tx: https://suiscan.xyz/mainnet/tx/0xd5e6...
61
+
62
+ ❯ t2000 pay https://data.api.com/prices
63
+ → GET https://data.api.com/prices
64
+ ← 402 Payment Required: $0.01 USDC (Sui)
65
+ ✓ Paid $0.01 USDC (tx: 0x9f2c...a801)
66
+ ← 200 OK [342ms]
67
+
68
+ ❯ t2000 repay 20 USDC
69
+ ✓ Repaid $20.00 USDC
70
+ Remaining Debt: $0.00
71
+ Tx: https://suiscan.xyz/mainnet/tx/0xe7f8...
72
+
73
+ ❯ t2000 withdraw all
74
+ ✓ Withdrew $79.92 USDC
75
+ Tx: https://suiscan.xyz/mainnet/tx/0xf9a0...
76
+
77
+ ❯ t2000 balance
78
+ Available: $85.00 USDC (checking — spendable)
79
+ Savings: $0.00 USDC
80
+ Gas: 0.31 SUI (~$0.28)
81
+ ──────────────────────────────────────
82
+ Total: $85.28 USDC
83
+ ```
84
+
85
+ 30 seconds. Send → save → borrow → swap → pay → repay → withdraw.
86
+
87
+ ## Commands
88
+
89
+ ### Wallet
90
+
91
+ | Command | Description |
92
+ |---------|-------------|
93
+ | `t2000 init` | Create a new agent bank account (Ed25519 keypair, AES-256-GCM encrypted) |
94
+ | `t2000 balance` | Show available USDC + savings + gas reserve |
95
+ | `t2000 address` | Show wallet address |
96
+ | `t2000 deposit` | Show funding instructions |
97
+ | `t2000 import` | Import an existing bank account from private key |
98
+ | `t2000 export` | Export private key (raw Ed25519 hex) |
99
+ | `t2000 history` | Transaction history |
100
+
101
+ ### Transfers
102
+
103
+ | Command | Description |
104
+ |---------|-------------|
105
+ | `t2000 send <amount> USDC to <address>` | Send USDC to any Sui address |
106
+
107
+ ### Savings & DeFi
108
+
109
+ | Command | Description |
110
+ |---------|-------------|
111
+ | `t2000 save <amount>` | Deposit USDC to NAVI Protocol (earn ~4–8% APY) |
112
+ | `t2000 withdraw <amount>` | Withdraw USDC from savings |
113
+ | `t2000 borrow <amount>` | Borrow USDC against savings collateral |
114
+ | `t2000 repay <amount>` | Repay outstanding borrows |
115
+ | `t2000 swap <amount> <from> <to>` | Swap via Cetus DEX (e.g. `swap 5 USDC SUI`) |
116
+ | `t2000 health` | Check savings health factor |
117
+ | `t2000 rates` | Current NAVI save/borrow APYs |
118
+ | `t2000 positions` | Open savings & borrow positions |
119
+ | `t2000 earnings` | Yield earned to date |
120
+ | `t2000 fund-status` | Full savings summary |
121
+
122
+ ### x402 Payments
123
+
124
+ | Command | Description |
125
+ |---------|-------------|
126
+ | `t2000 pay <url>` | Pay for an x402-protected API resource |
127
+ | `t2000 pay <url> --max-price 0.10` | Set max USDC per request (default: $1.00) |
128
+ | `t2000 pay <url> --method POST --data '{...}'` | POST with JSON body |
129
+
130
+ ### Configuration
131
+
132
+ | Command | Description |
133
+ |---------|-------------|
134
+ | `t2000 config get <key>` | Show a config value |
135
+ | `t2000 config set <key> <value>` | Set a config value |
136
+
137
+ ### HTTP API Server
138
+
139
+ ```bash
140
+ # Start a local HTTP API for non-TypeScript agents
141
+ t2000 serve --port 3001
142
+
143
+ # All endpoints available at /v1/*
144
+ curl -H "Authorization: Bearer t2k_..." http://localhost:3001/v1/balance
145
+ curl -X POST -H "Authorization: Bearer t2k_..." \
146
+ -d '{"to":"0x...","amount":10}' \
147
+ http://localhost:3001/v1/send
148
+ ```
149
+
150
+ ## Flags
151
+
152
+ | Flag | Description |
153
+ |------|-------------|
154
+ | `--json` | Structured JSON output (for automation) |
155
+ | `--yes` | Skip confirmation prompts |
156
+ | `--key <path>` | Custom key file path |
157
+ | `--network <net>` | `mainnet` or `testnet` |
158
+
159
+ ## Configuration
160
+
161
+ Config is stored at `~/.t2000/config.json`.
162
+
163
+ | Key | Description | Default |
164
+ |-----|-------------|---------|
165
+ | `network` | Sui network | `mainnet` |
166
+ | `rpcUrl` | Custom RPC URL | Sui public fullnode |
167
+
168
+ ## Environment Variables
169
+
170
+ | Variable | Description |
171
+ |----------|-------------|
172
+ | `T2000_PASSPHRASE` | Bank account passphrase (skip interactive prompt) |
173
+ | `T2000_NETWORK` | Override network (`mainnet` / `testnet`) |
174
+ | `T2000_KEY_PATH` | Custom key file path |
175
+
176
+ ## Gas Handling
177
+
178
+ Gas is fully automated:
179
+
180
+ 1. **Sponsored** — early transactions are free via the t2000 Gas Station
181
+ 2. **Self-funded** — uses SUI balance after bootstrap
182
+ 3. **Auto-topup** — swaps $1 USDC → SUI when gas reserve is low
183
+
184
+ You never need to manually acquire SUI for gas.
185
+
186
+ ## File Locations
187
+
188
+ | File | Path | Description |
189
+ |------|------|-------------|
190
+ | Encrypted key | `~/.t2000/wallet.key` | AES-256-GCM encrypted Ed25519 keypair |
191
+ | Config | `~/.t2000/config.json` | Network, RPC, preferences |
192
+
193
+ ## Examples
194
+
195
+ ```bash
196
+ # Full DeFi cycle
197
+ t2000 save all # Deposit all available USDC
198
+ t2000 borrow 40 USDC # Borrow against it
199
+ t2000 repay 40 USDC # Pay it back
200
+ t2000 withdraw all # Get everything out
201
+
202
+ # Automation-friendly (no prompts, JSON output)
203
+ t2000 balance --json
204
+ t2000 send 10 USDC to 0x... --yes --json
205
+
206
+ # Use with AI coding agents
207
+ export T2000_PASSPHRASE="agent-secret"
208
+ t2000 balance --json | jq '.available'
209
+ ```
210
+
211
+ ## License
212
+
213
+ MIT — see [LICENSE](https://github.com/mission69b/t2000/blob/main/LICENSE)