memeputer 1.0.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.
Files changed (42) hide show
  1. package/README.md +311 -0
  2. package/dist/commands/agents.d.ts +3 -0
  3. package/dist/commands/agents.d.ts.map +1 -0
  4. package/dist/commands/agents.js +47 -0
  5. package/dist/commands/agents.js.map +1 -0
  6. package/dist/commands/ask.d.ts +3 -0
  7. package/dist/commands/ask.d.ts.map +1 -0
  8. package/dist/commands/ask.js +83 -0
  9. package/dist/commands/ask.js.map +1 -0
  10. package/dist/commands/balance.d.ts +3 -0
  11. package/dist/commands/balance.d.ts.map +1 -0
  12. package/dist/commands/balance.js +63 -0
  13. package/dist/commands/balance.js.map +1 -0
  14. package/dist/commands/pfp.d.ts +3 -0
  15. package/dist/commands/pfp.d.ts.map +1 -0
  16. package/dist/commands/pfp.js +99 -0
  17. package/dist/commands/pfp.js.map +1 -0
  18. package/dist/index.d.ts +3 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +39 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/lib/api.d.ts +33 -0
  23. package/dist/lib/api.d.ts.map +1 -0
  24. package/dist/lib/api.js +104 -0
  25. package/dist/lib/api.js.map +1 -0
  26. package/dist/lib/config.d.ts +9 -0
  27. package/dist/lib/config.d.ts.map +1 -0
  28. package/dist/lib/config.js +46 -0
  29. package/dist/lib/config.js.map +1 -0
  30. package/dist/lib/wallet.d.ts +4 -0
  31. package/dist/lib/wallet.d.ts.map +1 -0
  32. package/dist/lib/wallet.js +30 -0
  33. package/dist/lib/wallet.js.map +1 -0
  34. package/dist/lib/x402Client.d.ts +14 -0
  35. package/dist/lib/x402Client.d.ts.map +1 -0
  36. package/dist/lib/x402Client.js +81 -0
  37. package/dist/lib/x402Client.js.map +1 -0
  38. package/dist/utils/formatting.d.ts +11 -0
  39. package/dist/utils/formatting.d.ts.map +1 -0
  40. package/dist/utils/formatting.js +67 -0
  41. package/dist/utils/formatting.js.map +1 -0
  42. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,311 @@
1
+ # Memeputer CLI 🤖
2
+
3
+ Pay and interact with AI agents from your terminal using x402 micropayments.
4
+
5
+ **✨ Pay $0 in gas fees** - All transactions use PayAI Facilitator!
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g memeputer-cli
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # List available agents
17
+ memeputer agents
18
+
19
+ # Ask an agent (auto-pays via x402)
20
+ memeputer ask memeputer "What can you do?"
21
+
22
+ # Generate a PFP image
23
+ memeputer pfp "cyberpunk samurai with neon katana" --wallet ~/.config/solana/id.json -o ./pfp.png
24
+
25
+ # Check your wallet balance
26
+ memeputer balance --wallet ~/.config/solana/id.json
27
+ ```
28
+
29
+ ## Commands
30
+
31
+ ### `memeputer agents`
32
+
33
+ List all available agents with pricing and categories.
34
+
35
+ **Example:**
36
+
37
+ ```bash
38
+ memeputer agents
39
+ # Shows table of agents with prices
40
+
41
+ memeputer agents --json
42
+ # Output in JSON format for scripting
43
+ ```
44
+
45
+ ### `memeputer ask <agent> <message>`
46
+
47
+ Interact with any agent. Payment happens automatically via x402 protocol.
48
+
49
+ **Examples:**
50
+
51
+ ```bash
52
+ # Chat with memeputer
53
+ memeputer ask memeputer "Tell me a joke" -w ~/.config/solana/id.json
54
+
55
+ # Get trading analysis
56
+ memeputer ask tradeputer "What's the sentiment on SOL?"
57
+
58
+ # Voice generation
59
+ memeputer ask veoputer "Create an upbeat podcast intro"
60
+ ```
61
+
62
+ **Options:**
63
+
64
+ - `-w, --wallet <path>` - Path to Solana wallet keypair file
65
+ - `--json` - Output in JSON format
66
+ - `-q, --quiet` - Suppress progress output
67
+
68
+ ### `memeputer pfp <prompt>`
69
+
70
+ Generate a profile picture using PFPputer.
71
+
72
+ **Examples:**
73
+
74
+ ```bash
75
+ # Generate and view URL
76
+ memeputer pfp "pixel art wizard" -w ./my-wallet.json
77
+
78
+ # Generate and save locally
79
+ memeputer pfp "anime character with blue hair" -w ./wallet.json -o ./avatar.png
80
+ ```
81
+
82
+ **Options:**
83
+
84
+ - `-w, --wallet <path>` - Path to Solana wallet keypair file
85
+ - `-o, --output <path>` - Save image to file path
86
+ - `--json` - Output in JSON format
87
+ - `-q, --quiet` - Suppress progress output
88
+
89
+ ### `memeputer balance`
90
+
91
+ Check your wallet's USDC balance.
92
+
93
+ **Example:**
94
+
95
+ ```bash
96
+ memeputer balance -w ~/.config/solana/id.json
97
+
98
+ # Output:
99
+ # 💰 Wallet Balance
100
+ # Address: 7zH2...pump
101
+ # Balance: 10.50 USDC
102
+ ```
103
+
104
+ ## Configuration
105
+
106
+ Create `~/.memeputerrc` for default settings:
107
+
108
+ ```json
109
+ {
110
+ "wallet": "/path/to/wallet.json",
111
+ "network": "mainnet-beta",
112
+ "apiUrl": "https://agents.api.memeputer.com"
113
+ }
114
+ ```
115
+
116
+ ## Environment Variables
117
+
118
+ - `MEMEPUTER_WALLET` - Default wallet path
119
+ - `MEMEPUTER_API_URL` - API endpoint (default: https://agents.api.memeputer.com)
120
+ - `SOLANA_RPC_URL` - Custom Solana RPC endpoint (default: Helius)
121
+
122
+ ## How It Works
123
+
124
+ The CLI uses the **x402 micropayment protocol**:
125
+
126
+ 1. 🔐 Loads your Solana wallet from file
127
+ 2. 📡 Calls agent API (first call returns 402 Payment Required)
128
+ 3. 💸 Creates USDC payment transaction automatically
129
+ 4. ✅ Signs transaction with your wallet
130
+ 5. 📤 Sends payment via **PayAI Facilitator** (you pay $0 gas!)
131
+ 6. 🤖 Returns AI-generated result
132
+
133
+ All payments are instant and on-chain. No accounts, no subscriptions.
134
+
135
+ ## Requirements
136
+
137
+ - **Node.js 18+**
138
+ - **Solana wallet with USDC**
139
+ - Get a wallet at https://phantom.app
140
+ - Export keypair to JSON file
141
+ - Add USDC to your wallet
142
+
143
+ ## Getting a Wallet
144
+
145
+ ### Option 1: Phantom Wallet (Browser)
146
+
147
+ 1. Install Phantom browser extension
148
+ 2. Create wallet
149
+ 3. Go to Settings → Export Private Key
150
+ 4. Save as JSON file
151
+
152
+ ### Option 2: Solana CLI
153
+
154
+ ```bash
155
+ # Install Solana CLI
156
+ sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
157
+
158
+ # Generate new wallet
159
+ solana-keygen new --outfile ~/.config/solana/id.json
160
+
161
+ # Check address
162
+ solana address
163
+
164
+ # Add USDC to this address
165
+ ```
166
+
167
+ ## Example Workflows
168
+
169
+ ### Generate PFP and save locally
170
+
171
+ ```bash
172
+ memeputer pfp "pixel art wizard casting spell" \
173
+ -w ~/.config/solana/id.json \
174
+ -o ~/Desktop/wizard.png
175
+
176
+ # Output includes:
177
+ # - AI response
178
+ # - Image URL
179
+ # - Transaction signature
180
+ # - Local file path
181
+ ```
182
+
183
+ ### Get trading analysis
184
+
185
+ ```bash
186
+ memeputer ask tradeputer "analyze BTC/USD" -w ./wallet.json
187
+
188
+ # Agent responds with:
189
+ # - Market analysis
190
+ # - Price predictions
191
+ # - Trading signals
192
+ ```
193
+
194
+ ### Check balance before paying
195
+
196
+ ```bash
197
+ memeputer balance -w ~/.config/solana/id.json
198
+ # Balance: 10.50 USDC ✅ (enough for ~100 interactions)
199
+
200
+ memeputer ask memeputer "What's the weather?" -w ~/.config/solana/id.json
201
+ # Payment auto-sent, response received!
202
+ ```
203
+
204
+ ### JSON output for scripting
205
+
206
+ ```bash
207
+ # Get response as JSON
208
+ result=$(memeputer pfp "anime character" -w ./wallet.json --json)
209
+
210
+ # Extract media URL
211
+ echo $result | jq -r '.mediaUrl'
212
+
213
+ # Download image
214
+ curl $(echo $result | jq -r '.mediaUrl') -o image.png
215
+ ```
216
+
217
+ ## Pricing
218
+
219
+ Agent prices are set by their creators. Typical prices:
220
+
221
+ - **General chat**: $0.01-$0.05 per message
222
+ - **Image generation**: $0.05-$0.15 per image
223
+ - **Voice/audio**: $0.05-$0.10 per generation
224
+ - **Trading signals**: $0.10-$0.50 per analysis
225
+
226
+ **You pay exactly the agent price + $0.00 gas fees!** (PayAI covers gas)
227
+
228
+ ## Troubleshooting
229
+
230
+ ### "Insufficient USDC balance"
231
+
232
+ Your wallet needs USDC (not SOL) to pay agents.
233
+
234
+ 1. Get USDC on an exchange (Coinbase, Binance)
235
+ 2. Withdraw to your Solana wallet address
236
+ 3. Run `memeputer balance` to verify
237
+
238
+ ### "Wallet file not found"
239
+
240
+ Provide full path to your wallet JSON file:
241
+
242
+ ```bash
243
+ memeputer ask memeputer "hi" --wallet /full/path/to/wallet.json
244
+ ```
245
+
246
+ ### "Network timeout"
247
+
248
+ Solana RPC can be slow. Try again or set custom RPC:
249
+
250
+ ```bash
251
+ export SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"
252
+ ```
253
+
254
+ ### "Agent not found"
255
+
256
+ Check available agents:
257
+
258
+ ```bash
259
+ memeputer agents
260
+ # Lists all marketplace-enabled agents
261
+ ```
262
+
263
+ ## Development
264
+
265
+ ```bash
266
+ # Clone repo
267
+ git clone https://github.com/memeputer/memeputer
268
+
269
+ # Install dependencies
270
+ cd apps/cli
271
+ npm install
272
+
273
+ # Run in dev mode
274
+ npm run dev
275
+
276
+ # Build
277
+ npm run build
278
+
279
+ # Test locally
280
+ npm link
281
+ memeputer agents
282
+ ```
283
+
284
+ ## Publishing
285
+
286
+ ```bash
287
+ # Build for production
288
+ npm run build
289
+
290
+ # Publish to npm
291
+ npm publish
292
+
293
+ # Users can then install:
294
+ npm install -g memeputer-cli
295
+ ```
296
+
297
+ ## Support
298
+
299
+ - **Website:** https://memeputer.com
300
+ - **Marketplace:** https://agents.memeputer.com
301
+ - **API Docs:** https://agents.memeputer.com/docs
302
+ - **Discord:** https://discord.gg/memeputer
303
+ - **Twitter:** @MemeputerAI
304
+
305
+ ## License
306
+
307
+ MIT
308
+
309
+ ---
310
+
311
+ **Made with 💜 by the Memeputer team**
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function createAgentsCommand(): Command;
3
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,mBAAmB,IAAI,OAAO,CAgD7C"}
@@ -0,0 +1,47 @@
1
+ import { Command } from "commander";
2
+ import ora from "ora";
3
+ import { loadConfig } from "../lib/config.js";
4
+ import { AgentsApiClient } from "../lib/api.js";
5
+ import { formatError, formatTable, formatPrice, formatAgent, } from "../utils/formatting.js";
6
+ export function createAgentsCommand() {
7
+ return new Command("agents")
8
+ .description("List all available AI agents")
9
+ .option("--json", "Output in JSON format")
10
+ .action(async (options) => {
11
+ try {
12
+ const config = loadConfig();
13
+ const apiUrl = config.apiUrl;
14
+ const spinner = options.json ? null : ora("Fetching agents...").start();
15
+ const client = new AgentsApiClient(apiUrl);
16
+ const agents = await client.listAgents();
17
+ if (spinner) {
18
+ spinner.stop();
19
+ }
20
+ if (options.json) {
21
+ console.log(JSON.stringify(agents, null, 2));
22
+ }
23
+ else {
24
+ console.log();
25
+ console.log("🤖 Available Memeputer Agents");
26
+ console.log();
27
+ formatTable(["Agent", "Description", "Price", "Category"], agents.map((agent) => [
28
+ formatAgent(agent.name),
29
+ agent.description.slice(0, 50) +
30
+ (agent.description.length > 50 ? "..." : ""),
31
+ formatPrice(agent.price),
32
+ agent.category,
33
+ ]));
34
+ console.log();
35
+ console.log("💡 Usage:");
36
+ console.log(' memeputer pfp "your prompt" --wallet ~/.config/solana/id.json');
37
+ console.log(' memeputer ask veOputer "your message"');
38
+ console.log();
39
+ }
40
+ }
41
+ catch (error) {
42
+ console.error(formatError(error.message || "Failed to fetch agents"));
43
+ process.exit(1);
44
+ }
45
+ });
46
+ }
47
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"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AAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,CAAC,EAC7C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;oBACpB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;oBACvB,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;wBAC5B,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC9C,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC;oBACxB,KAAK,CAAC,QAAQ;iBACf,CAAC,CACH,CAAC;gBAEF,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACzB,OAAO,CAAC,GAAG,CACT,iEAAiE,CAClE,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;gBACvD,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function createAskCommand(): Command;
3
+ //# sourceMappingURL=ask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../src/commands/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,gBAAgB,IAAI,OAAO,CA+G1C"}
@@ -0,0 +1,83 @@
1
+ import { Command } from "commander";
2
+ import { Connection } from "@solana/web3.js";
3
+ import ora from "ora";
4
+ import chalk from "chalk";
5
+ import { loadConfig, getDefaultWalletPath } from "../lib/config.js";
6
+ import { loadWallet, formatPublicKey } from "../lib/wallet.js";
7
+ import { AgentsApiClient } from "../lib/api.js";
8
+ import { formatSuccess, formatError, formatInfo, formatAgent, } from "../utils/formatting.js";
9
+ export function createAskCommand() {
10
+ return new Command("ask")
11
+ .description("Ask any agent a question (pays via x402 with $0 gas fees!)")
12
+ .argument("<agent>", "Agent ID (e.g., memeputer, tradeputer, pfpputer)")
13
+ .argument("<message>", "Your message or question")
14
+ .option("-w, --wallet <path>", "Path to Solana wallet keypair")
15
+ .option("--json", "Output in JSON format")
16
+ .option("-q, --quiet", "Suppress progress output")
17
+ .action(async (agentName, message, options) => {
18
+ try {
19
+ const config = loadConfig();
20
+ const apiUrl = config.apiUrl;
21
+ const rpcUrl = config.rpcUrl;
22
+ const walletPath = options.wallet || config.wallet || getDefaultWalletPath();
23
+ if (!walletPath) {
24
+ console.error(formatError("No wallet specified. Use --wallet or set MEMEPUTER_WALLET"));
25
+ process.exit(1);
26
+ }
27
+ const quiet = options.quiet || options.json;
28
+ const agentId = agentName.toLowerCase();
29
+ // Load wallet
30
+ let spinner = quiet ? null : ora("Loading wallet...").start();
31
+ const wallet = loadWallet(walletPath);
32
+ if (spinner) {
33
+ spinner.succeed(`Wallet loaded: ${formatPublicKey(wallet.publicKey.toBase58())}`);
34
+ }
35
+ // Connect to Solana
36
+ spinner = quiet ? null : ora("Connecting to Solana...").start();
37
+ const connection = new Connection(rpcUrl, "confirmed");
38
+ if (spinner) {
39
+ spinner.succeed("Connected to Solana");
40
+ }
41
+ // Call API with manual x402 payment flow
42
+ spinner = quiet
43
+ ? null
44
+ : ora(`Asking ${formatAgent(agentName)}... (processing payment via x402)`).start();
45
+ const apiClient = new AgentsApiClient(apiUrl);
46
+ const result = await apiClient.interact(agentId, message, wallet, connection);
47
+ if (spinner) {
48
+ spinner.succeed(`Response received from ${formatAgent(agentName)}`);
49
+ }
50
+ // Output results
51
+ if (options.json) {
52
+ console.log(JSON.stringify({
53
+ success: result.success,
54
+ response: result.response,
55
+ format: result.format,
56
+ mediaUrl: result.mediaUrl,
57
+ signature: result.transactionSignature,
58
+ agent: agentName,
59
+ }, null, 2));
60
+ }
61
+ else {
62
+ console.log();
63
+ console.log(formatSuccess(`${agentName} says:`));
64
+ console.log();
65
+ console.log(chalk.white(result.response));
66
+ console.log();
67
+ if (result.mediaUrl) {
68
+ console.log(formatInfo(`Media: ${chalk.underline(result.mediaUrl)}`));
69
+ }
70
+ if (result.transactionSignature) {
71
+ console.log(formatInfo(`Transaction: ${chalk.underline(`https://solscan.io/tx/${result.transactionSignature}`)}`));
72
+ console.log(chalk.green("💚 You paid $0 in gas fees (PayAI Facilitator covered it)!"));
73
+ }
74
+ console.log();
75
+ }
76
+ }
77
+ catch (error) {
78
+ console.error(formatError(error.message || "Failed to get response"));
79
+ process.exit(1);
80
+ }
81
+ });
82
+ }
83
+ //# sourceMappingURL=ask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask.js","sourceRoot":"","sources":["../../src/commands/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;SACtB,WAAW,CAAC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BACjD,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC1C,OAAO,CAAC,GAAG,EAAE,CAAC;gBAEd,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACpB,OAAO,CAAC,GAAG,CACT,UAAU,CAAC,UAAU,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CACzD,CAAC;gBACJ,CAAC;gBAED,IAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC;oBAChC,OAAO,CAAC,GAAG,CACT,UAAU,CACR,gBAAgB,KAAK,CAAC,SAAS,CAAC,yBAAyB,MAAM,CAAC,oBAAoB,EAAE,CAAC,EAAE,CAC1F,CACF,CAAC;oBACF,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,4DAA4D,CAC7D,CACF,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function createBalanceCommand(): Command;
3
+ //# sourceMappingURL=balance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,oBAAoB,IAAI,OAAO,CA+E9C"}
@@ -0,0 +1,63 @@
1
+ import { Command } from "commander";
2
+ import { Connection } from "@solana/web3.js";
3
+ import ora from "ora";
4
+ import chalk from "chalk";
5
+ import { loadConfig, getDefaultWalletPath } from "../lib/config.js";
6
+ import { loadWallet, formatPublicKey } from "../lib/wallet.js";
7
+ import { getUsdcBalance } from "../lib/x402Client.js";
8
+ import { formatError, formatSuccess, formatPrice, } from "../utils/formatting.js";
9
+ export function createBalanceCommand() {
10
+ return new Command("balance")
11
+ .description("Check your wallet's USDC balance")
12
+ .option("-w, --wallet <path>", "Path to Solana wallet keypair")
13
+ .option("--json", "Output in JSON format")
14
+ .action(async (options) => {
15
+ try {
16
+ const config = loadConfig();
17
+ const rpcUrl = config.rpcUrl;
18
+ const walletPath = options.wallet || config.wallet || getDefaultWalletPath();
19
+ if (!walletPath) {
20
+ console.error(formatError("No wallet specified. Use --wallet or set MEMEPUTER_WALLET"));
21
+ process.exit(1);
22
+ }
23
+ // Load wallet
24
+ const spinner = options.json ? null : ora("Loading wallet...").start();
25
+ const wallet = loadWallet(walletPath);
26
+ if (spinner) {
27
+ spinner.text = "Checking USDC balance...";
28
+ }
29
+ // Connect and get balance
30
+ const connection = new Connection(rpcUrl, "confirmed");
31
+ const balance = await getUsdcBalance(connection, wallet);
32
+ if (spinner) {
33
+ spinner.stop();
34
+ }
35
+ // Output results
36
+ if (options.json) {
37
+ console.log(JSON.stringify({
38
+ wallet: wallet.publicKey.toBase58(),
39
+ balance,
40
+ currency: "USDC",
41
+ }, null, 2));
42
+ }
43
+ else {
44
+ console.log();
45
+ console.log(formatSuccess("💰 Wallet Balance"));
46
+ console.log();
47
+ console.log(` Address: ${formatPublicKey(wallet.publicKey.toBase58())}`);
48
+ console.log(` Balance: ${chalk.bold.green(formatPrice(balance))}`);
49
+ console.log();
50
+ if (balance < 0.1) {
51
+ console.log(chalk.yellow("âš ī¸ Low balance! You may not have enough USDC to interact with agents."));
52
+ console.log(chalk.gray(" Most agents cost between $0.01-$0.10 per interaction."));
53
+ console.log();
54
+ }
55
+ }
56
+ }
57
+ catch (error) {
58
+ console.error(formatError(error.message || "Failed to check balance"));
59
+ process.exit(1);
60
+ }
61
+ });
62
+ }
63
+ //# sourceMappingURL=balance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EACL,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;SAC1B,WAAW,CAAC,kCAAkC,CAAC;SAC/C,MAAM,CAAC,qBAAqB,EAAE,+BAA+B,CAAC;SAC9D,MAAM,CAAC,QAAQ,EAAE,uBAAuB,CAAC;SACzC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;YAC5B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAO,CAAC;YAC9B,MAAM,UAAU,GACd,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,oBAAoB,EAAE,CAAC;YAE5D,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO,CAAC,KAAK,CACX,WAAW,CACT,2DAA2D,CAC5D,CACF,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,cAAc;YACd,MAAM,OAAO,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B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM,CACV,wEAAwE,CACzE,CACF,CAAC;oBACF,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,IAAI,CACR,0DAA0D,CAC3D,CACF,CAAC;oBACF,OAAO,CAAC,GAAG,EAAE,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,IAAI,yBAAyB,CAAC,CAAC,CAAC;YACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function createPfpCommand(): Command;
3
+ //# sourceMappingURL=pfp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pfp.d.ts","sourceRoot":"","sources":["../../src/commands/pfp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,wBAAgB,gBAAgB,IAAI,OAAO,CAmI1C"}
@@ -0,0 +1,99 @@
1
+ import { Command } from "commander";
2
+ import { Connection } from "@solana/web3.js";
3
+ import ora from "ora";
4
+ import chalk from "chalk";
5
+ import axios from "axios";
6
+ import { writeFileSync } from "fs";
7
+ import { resolve } from "path";
8
+ import { loadConfig, getDefaultWalletPath } from "../lib/config.js";
9
+ import { loadWallet, formatPublicKey } from "../lib/wallet.js";
10
+ import { AgentsApiClient } from "../lib/api.js";
11
+ import { formatSuccess, formatError, formatInfo, formatAgent, } from "../utils/formatting.js";
12
+ export function createPfpCommand() {
13
+ return new Command("pfp")
14
+ .description("Generate a profile picture with PFPputer")
15
+ .argument("<prompt>", "Description of the PFP you want to generate")
16
+ .option("-w, --wallet <path>", "Path to Solana wallet keypair")
17
+ .option("-o, --output <path>", "Save image to file path")
18
+ .option("--json", "Output in JSON format")
19
+ .option("-q, --quiet", "Suppress progress output")
20
+ .action(async (prompt, options) => {
21
+ try {
22
+ const config = loadConfig();
23
+ const apiUrl = config.apiUrl;
24
+ const rpcUrl = config.rpcUrl;
25
+ const walletPath = options.wallet || config.wallet || getDefaultWalletPath();
26
+ if (!walletPath) {
27
+ console.error(formatError("No wallet specified. Use --wallet or set MEMEPUTER_WALLET"));
28
+ process.exit(1);
29
+ }
30
+ const quiet = options.quiet || options.json;
31
+ // Load wallet
32
+ let spinner = quiet ? null : ora("Loading wallet...").start();
33
+ const wallet = loadWallet(walletPath);
34
+ if (spinner) {
35
+ spinner.succeed(`Wallet loaded: ${formatPublicKey(wallet.publicKey.toBase58())}`);
36
+ }
37
+ // Connect to Solana
38
+ spinner = quiet ? null : ora("Connecting to Solana...").start();
39
+ const connection = new Connection(rpcUrl, "confirmed");
40
+ if (spinner) {
41
+ spinner.succeed("Connected to Solana");
42
+ }
43
+ // Call PFPputer API with x402 payment
44
+ spinner = quiet
45
+ ? null
46
+ : ora(`Generating PFP with ${formatAgent("PFPputer")}... (processing payment)`).start();
47
+ const apiClient = new AgentsApiClient(apiUrl);
48
+ const result = await apiClient.interact("pfpputer", prompt, wallet, connection);
49
+ if (spinner) {
50
+ spinner.succeed(`PFP generated by ${formatAgent("PFPputer")}`);
51
+ }
52
+ // Download image if requested
53
+ if (options.output && result.mediaUrl) {
54
+ spinner = quiet ? null : ora("Downloading image...").start();
55
+ const imageResponse = await axios.get(result.mediaUrl, {
56
+ responseType: "arraybuffer",
57
+ });
58
+ const outputPath = resolve(options.output);
59
+ writeFileSync(outputPath, imageResponse.data);
60
+ if (spinner) {
61
+ spinner.succeed(`Image saved to ${chalk.cyan(outputPath)}`);
62
+ }
63
+ }
64
+ // Output results
65
+ if (options.json) {
66
+ console.log(JSON.stringify({
67
+ success: result.success,
68
+ response: result.response,
69
+ mediaUrl: result.mediaUrl,
70
+ signature: result.transactionSignature,
71
+ savedTo: options.output ? resolve(options.output) : null,
72
+ }, null, 2));
73
+ }
74
+ else {
75
+ console.log();
76
+ console.log(formatSuccess("PFP Generated!"));
77
+ console.log();
78
+ console.log(chalk.white(result.response));
79
+ console.log();
80
+ if (result.mediaUrl) {
81
+ console.log(formatInfo(`Image URL: ${chalk.underline(result.mediaUrl)}`));
82
+ }
83
+ if (result.transactionSignature) {
84
+ console.log(formatInfo(`Transaction: ${chalk.underline(`https://solscan.io/tx/${result.transactionSignature}`)}`));
85
+ console.log(chalk.green("💚 You paid $0 in gas fees (PayAI Facilitator covered it)!"));
86
+ }
87
+ if (options.output) {
88
+ console.log(formatInfo(`Saved to: ${chalk.cyan(resolve(options.output))}`));
89
+ }
90
+ console.log();
91
+ }
92
+ }
93
+ catch (error) {
94
+ console.error(formatError(error.message || "Failed to generate PFP"));
95
+ process.exit(1);
96
+ }
97
+ });
98
+ }
99
+ //# sourceMappingURL=pfp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pfp.js","sourceRoot":"","sources":["../../src/commands/pfp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAEhC,MAAM,UAAU,gBAAgB;IAC9B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AC7D,CACF,CAAC;gBACJ,CAAC;gBAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;oBACnB,OAAO,CAAC,GAAG,CACT,UAAU,CAAC,aAAa,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAC/D,CAAC;gBACJ,CAAC;gBACD,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC,CAAC;YACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import chalk from "chalk";
4
+ import { createPfpCommand } from "./commands/pfp.js";
5
+ import { createAskCommand } from "./commands/ask.js";
6
+ import { createAgentsCommand } from "./commands/agents.js";
7
+ import { createBalanceCommand } from "./commands/balance.js";
8
+ const program = new Command();
9
+ program
10
+ .name("memeputer")
11
+ .description(chalk.bold("🤖 Memeputer CLI") +
12
+ "\n Pay and interact with AI agents via x402 micropayments")
13
+ .version("1.0.0");
14
+ // Add commands
15
+ program.addCommand(createPfpCommand());
16
+ program.addCommand(createAskCommand());
17
+ program.addCommand(createAgentsCommand());
18
+ program.addCommand(createBalanceCommand());
19
+ // Examples in help
20
+ program.on("--help", () => {
21
+ console.log();
22
+ console.log("Examples:");
23
+ console.log(' $ memeputer pfp "cyberpunk samurai" --wallet ~/.config/solana/id.json');
24
+ console.log(' $ memeputer ask veOputer "create a podcast intro"');
25
+ console.log(" $ memeputer agents");
26
+ console.log(" $ memeputer balance");
27
+ console.log();
28
+ console.log("Configuration:");
29
+ console.log(" Create ~/.memeputerrc with your default settings");
30
+ console.log();
31
+ console.log("Learn more:");
32
+ console.log(" Website: https://memeputer.com");
33
+ console.log(" Marketplace: https://marketplace.memeputer.com");
34
+ console.log(" API Docs: https://agents.memeputer.com/docs");
35
+ console.log();
36
+ });
37
+ // Parse and execute
38
+ program.parse();
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CACV,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC;IAC5B,6DAA6D,CAChE;KACA,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,eAAe;AACf,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;AACvC,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;AACvC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAC1C,OAAO,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC;AAE3C,mBAAmB;AACnB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,OAAO,CAAC,GAAG,CACT,yEAAyE,CAC1E,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH,oBAAoB;AACpB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Connection, Keypair } from "@solana/web3.js";
2
+ export interface AgentInfo {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ price: number;
7
+ category: string;
8
+ examplePrompts: string[];
9
+ payTo: string;
10
+ }
11
+ export interface InteractionResult {
12
+ success: boolean;
13
+ response: string;
14
+ format: "text" | "image" | "video" | "audio";
15
+ mediaUrl?: string;
16
+ transactionSignature?: string;
17
+ agentId?: string;
18
+ error?: string;
19
+ }
20
+ export declare class AgentsApiClient {
21
+ private baseUrl;
22
+ constructor(baseUrl: string);
23
+ /**
24
+ * List all available agents from the x402 resources endpoint
25
+ */
26
+ listAgents(): Promise<AgentInfo[]>;
27
+ /**
28
+ * Interact with an agent using x402 payment
29
+ * Manual x402 flow: 402 → create payment → retry with X-PAYMENT header
30
+ */
31
+ interact(agentId: string, message: string, wallet: Keypair, connection: Connection): Promise<InteractionResult>;
32
+ }
33
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM;IAEnC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAsBxC;;;OAGG;IACG,QAAQ,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,iBAAiB,CAAC;CAsG9B"}
@@ -0,0 +1,104 @@
1
+ import axios from "axios";
2
+ import { createPaymentTransaction } from "./x402Client.js";
3
+ export class AgentsApiClient {
4
+ baseUrl;
5
+ constructor(baseUrl) {
6
+ this.baseUrl = baseUrl;
7
+ }
8
+ /**
9
+ * List all available agents from the x402 resources endpoint
10
+ */
11
+ async listAgents() {
12
+ const response = await axios.get(`${this.baseUrl}/x402/resources`);
13
+ const data = response.data;
14
+ // Parse new x402 format: { x402Version: 1, accepts: [...] }
15
+ const acceptsList = data.accepts || [];
16
+ const agents = acceptsList.map((accept) => ({
17
+ id: accept.extra?.agentId || accept.agentId || "unknown",
18
+ name: accept.extra?.agentName || accept.name || "Unknown Agent",
19
+ description: accept.description || "AI agent",
20
+ price: accept.extra?.pricing?.amount ||
21
+ parseFloat(accept.maxAmountRequired || "10000") / 1_000_000,
22
+ category: accept.extra?.category || "General AI",
23
+ examplePrompts: accept.extra?.examplePrompts || [],
24
+ payTo: accept.payTo || "",
25
+ }));
26
+ return agents;
27
+ }
28
+ /**
29
+ * Interact with an agent using x402 payment
30
+ * Manual x402 flow: 402 → create payment → retry with X-PAYMENT header
31
+ */
32
+ async interact(agentId, message, wallet, connection) {
33
+ try {
34
+ // Step 1: Make request without payment (will get 402)
35
+ let response;
36
+ try {
37
+ response = await axios.post(`${this.baseUrl}/x402/interact`, { agentId, message }, { headers: { "Content-Type": "application/json" } });
38
+ }
39
+ catch (error) {
40
+ if (error.response?.status !== 402) {
41
+ throw error;
42
+ }
43
+ // Got 402 - payment required
44
+ response = error.response;
45
+ }
46
+ if (response.status === 402) {
47
+ // Step 2: Get payment requirements from 402 response
48
+ const paymentReq = response.data;
49
+ // x402 format has payment details in accepts array
50
+ const acceptDetails = paymentReq.accepts?.[0];
51
+ if (!acceptDetails) {
52
+ throw new Error(`No payment details in 402 response. Response: ${JSON.stringify(paymentReq)}`);
53
+ }
54
+ const recipient = acceptDetails.payTo;
55
+ const amountMicroUsdc = parseInt(acceptDetails.maxAmountRequired || "10000");
56
+ const amountUsdc = amountMicroUsdc / 1_000_000;
57
+ const feePayer = acceptDetails.extra?.feePayer;
58
+ if (!recipient) {
59
+ throw new Error(`No recipient wallet (payTo) found in 402 response.`);
60
+ }
61
+ console.log(`\nđŸ’ŗ Payment required:
62
+ Recipient: ${recipient}
63
+ Amount: ${amountUsdc} USDC
64
+ Fee Payer: ${feePayer || "PayAI Facilitator"}
65
+ `);
66
+ // Step 3: Create and sign payment transaction
67
+ const { signature: paymentHeader } = await createPaymentTransaction(connection, wallet, recipient, amountUsdc);
68
+ // Step 4: Retry request with X-PAYMENT header
69
+ response = await axios.post(`${this.baseUrl}/x402/interact`, { agentId, message }, {
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ "X-PAYMENT": paymentHeader,
73
+ },
74
+ });
75
+ }
76
+ // Parse successful response
77
+ const data = response.data;
78
+ return {
79
+ success: data.success || true,
80
+ response: data.response || "",
81
+ format: data.format || "text",
82
+ mediaUrl: data.mediaUrl,
83
+ transactionSignature: data.transactionSignature,
84
+ agentId: data.agentId || agentId,
85
+ };
86
+ }
87
+ catch (error) {
88
+ // Better error messages
89
+ if (error.response) {
90
+ const status = error.response.status;
91
+ const data = error.response.data;
92
+ if (status === 402) {
93
+ throw new Error(`Payment required but payment was rejected. Check your USDC balance.`);
94
+ }
95
+ if (data?.error) {
96
+ throw new Error(data.error);
97
+ }
98
+ throw new Error(`API error (${status}): ${JSON.stringify(data)}`);
99
+ }
100
+ throw error;
101
+ }
102
+ }
103
+ }
104
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAsB3D,MAAM,OAAO,eAAe;IACN;IAApB,YAAoB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAEvC;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OA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): Config;
8
+ export declare function getDefaultWalletPath(): string;
9
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,UAAU,IAAI,MAAM,CA0CnC;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -0,0 +1,46 @@
1
+ import { homedir } from "os";
2
+ import { join } from "path";
3
+ import { readFileSync, existsSync } from "fs";
4
+ const CONFIG_PATH = join(homedir(), ".memeputerrc");
5
+ export function loadConfig() {
6
+ const config = {
7
+ network: "mainnet-beta",
8
+ apiUrl: process.env.NODE_ENV === "production"
9
+ ? "https://agents.api.memeputer.com"
10
+ : "http://localhost:3006",
11
+ };
12
+ // Load from config file
13
+ if (existsSync(CONFIG_PATH)) {
14
+ try {
15
+ const fileConfig = JSON.parse(readFileSync(CONFIG_PATH, "utf-8"));
16
+ Object.assign(config, fileConfig);
17
+ }
18
+ catch (error) {
19
+ // Ignore config file errors
20
+ }
21
+ }
22
+ // Override with environment variables
23
+ if (process.env.MEMEPUTER_WALLET) {
24
+ config.wallet = process.env.MEMEPUTER_WALLET;
25
+ }
26
+ if (process.env.MEMEPUTER_API_URL) {
27
+ config.apiUrl = process.env.MEMEPUTER_API_URL;
28
+ }
29
+ if (process.env.SOLANA_RPC_URL) {
30
+ config.rpcUrl = process.env.SOLANA_RPC_URL;
31
+ }
32
+ // Set default RPC URL if not specified
33
+ if (!config.rpcUrl) {
34
+ // Use Helius for better reliability
35
+ const heliusKey = process.env.HELIUS_API_KEY || "e20ea2f4-232f-484e-be1e-e41b698a7850";
36
+ config.rpcUrl =
37
+ config.network === "mainnet-beta"
38
+ ? `https://rpc.helius.xyz/?api-key=${heliusKey}`
39
+ : "https://api.devnet.solana.com";
40
+ }
41
+ return config;
42
+ }
43
+ export function getDefaultWalletPath() {
44
+ return join(homedir(), ".config", "solana", "id.json");
45
+ }
46
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAS9C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAEpD,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAW;QACrB,OAAO,EAAE,cAAc;QACvB,MAAM,EACJ,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YACnC,CAAC,CAAC,kCAAkC;YACpC,CAAC,CAAC,uBAAuB;KAC9B,CAAC;IAEF,wBAAwB;IACxB,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YAClE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,4BAA4B;QAC9B,CAAC;IACH,CAAC;IAED,sCAAsC;IACtC,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACjC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC/C,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;QAClC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAChD,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;QAC/B,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC7C,CAAC;IAED,uCAAuC;IACvC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,oCAAoC;QACpC,MAAM,SAAS,GACb,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,sCAAsC,CAAC;QACvE,MAAM,CAAC,MAAM;YACX,MAAM,CAAC,OAAO,KAAK,cAAc;gBAC/B,CAAC,CAAC,mCAAmC,SAAS,EAAE;gBAChD,CAAC,CAAC,+BAA+B,CAAC;IACxC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Keypair } from "@solana/web3.js";
2
+ export declare function loadWallet(walletPath: string): Keypair;
3
+ export declare function formatPublicKey(publicKey: string): string;
4
+ //# sourceMappingURL=wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/lib/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAI1C,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAuBtD;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD"}
@@ -0,0 +1,30 @@
1
+ import { Keypair } from "@solana/web3.js";
2
+ import { readFileSync, existsSync } from "fs";
3
+ import bs58 from "bs58";
4
+ export function loadWallet(walletPath) {
5
+ if (!existsSync(walletPath)) {
6
+ throw new Error(`Wallet file not found: ${walletPath}\n\n` +
7
+ `Create a wallet with: solana-keygen new --outfile ${walletPath}`);
8
+ }
9
+ try {
10
+ const walletData = readFileSync(walletPath, "utf-8");
11
+ const secretKey = JSON.parse(walletData);
12
+ // Handle both array format and base58 string format
13
+ if (Array.isArray(secretKey)) {
14
+ return Keypair.fromSecretKey(Uint8Array.from(secretKey));
15
+ }
16
+ else if (typeof secretKey === "string") {
17
+ return Keypair.fromSecretKey(bs58.decode(secretKey));
18
+ }
19
+ else {
20
+ throw new Error("Invalid wallet format");
21
+ }
22
+ }
23
+ catch (error) {
24
+ throw new Error(`Failed to load wallet: ${error.message}`);
25
+ }
26
+ }
27
+ export function formatPublicKey(publicKey) {
28
+ return `${publicKey.slice(0, 4)}...${publicKey.slice(-4)}`;
29
+ }
30
+ //# sourceMappingURL=wallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/lib/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,UAAU,UAAU,CAAC,UAAkB;IAC3C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,0BAA0B,UAAU,MAAM;YACxC,qDAAqD,UAAU,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAEzC,oDAAoD;QACpD,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3D,CAAC;aAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YACzC,OAAO,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACvD,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Connection, Keypair, Transaction } from "@solana/web3.js";
2
+ /**
3
+ * Create a simple USDC payment transaction (for CLI use)
4
+ * This creates a signed transaction that can be sent in the X-PAYMENT header
5
+ */
6
+ export declare function createPaymentTransaction(connection: Connection, payer: Keypair, recipient: string, amountUsdc: number): Promise<{
7
+ transaction: Transaction;
8
+ signature: string;
9
+ }>;
10
+ /**
11
+ * Get USDC balance for a wallet
12
+ */
13
+ export declare function getUsdcBalance(connection: Connection, keypair: Keypair): Promise<number>;
14
+ //# sourceMappingURL=x402Client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x402Client.d.ts","sourceRoot":"","sources":["../../src/lib/x402Client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,WAAW,EAGZ,MAAM,iBAAiB,CAAC;AAYzB;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CA8F1D;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,CAejB"}
@@ -0,0 +1,81 @@
1
+ import { Transaction, } from "@solana/web3.js";
2
+ import { getAssociatedTokenAddress, createTransferInstruction, createAssociatedTokenAccountInstruction, TOKEN_PROGRAM_ID, } from "@solana/spl-token";
3
+ import { PublicKey } from "@solana/web3.js";
4
+ // USDC mint on Solana mainnet
5
+ const USDC_MINT = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
6
+ /**
7
+ * Create a simple USDC payment transaction (for CLI use)
8
+ * This creates a signed transaction that can be sent in the X-PAYMENT header
9
+ */
10
+ export async function createPaymentTransaction(connection, payer, recipient, amountUsdc) {
11
+ try {
12
+ const recipientPubkey = new PublicKey(recipient);
13
+ // Convert USDC amount to micro-USDC (6 decimals)
14
+ const amount = Math.floor(amountUsdc * 1_000_000);
15
+ // Get token accounts (allowOwnerOffCurve fixes wallet adapter key issues)
16
+ const payerTokenAccount = await getAssociatedTokenAddress(USDC_MINT, payer.publicKey, true, // allowOwnerOffCurve - critical for wallet adapter keys!
17
+ TOKEN_PROGRAM_ID);
18
+ const recipientTokenAccount = await getAssociatedTokenAddress(USDC_MINT, recipientPubkey, true, // allowOwnerOffCurve - critical for wallet adapter keys!
19
+ TOKEN_PROGRAM_ID);
20
+ // Build transaction
21
+ const transaction = new Transaction();
22
+ // Check if recipient token account exists, if not create it
23
+ const recipientAccountInfo = await connection.getAccountInfo(recipientTokenAccount);
24
+ if (!recipientAccountInfo) {
25
+ console.log(` 📝 Recipient token account doesn't exist, will create it`);
26
+ transaction.add(createAssociatedTokenAccountInstruction(payer.publicKey, // payer
27
+ recipientTokenAccount, // ata
28
+ recipientPubkey, // owner
29
+ USDC_MINT, // mint
30
+ TOKEN_PROGRAM_ID));
31
+ }
32
+ // Get recent blockhash and set transaction properties
33
+ const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash("confirmed");
34
+ transaction.recentBlockhash = blockhash;
35
+ transaction.lastValidBlockHeight = lastValidBlockHeight;
36
+ transaction.feePayer = payer.publicKey;
37
+ // Add the transfer instruction
38
+ transaction.add(createTransferInstruction(payerTokenAccount, recipientTokenAccount, payer.publicKey, amount, [], TOKEN_PROGRAM_ID));
39
+ // Sign transaction
40
+ transaction.sign(payer);
41
+ // Serialize transaction
42
+ const serialized = transaction.serialize({
43
+ requireAllSignatures: true,
44
+ verifySignatures: false,
45
+ });
46
+ const serializedTx = serialized.toString("base64");
47
+ // Create X-PAYMENT header in x402 format
48
+ // This matches the exact format from PayAI/x402 protocol
49
+ const paymentPayload = {
50
+ x402Version: 1,
51
+ scheme: "exact",
52
+ network: "solana",
53
+ payload: {
54
+ transaction: serializedTx,
55
+ },
56
+ };
57
+ // Encode as base64
58
+ const paymentHeader = Buffer.from(JSON.stringify(paymentPayload)).toString("base64");
59
+ return { transaction, signature: paymentHeader };
60
+ }
61
+ catch (error) {
62
+ console.error("Error creating payment transaction:", error);
63
+ throw new Error(`Failed to create payment: ${error instanceof Error ? error.message : String(error)}`);
64
+ }
65
+ }
66
+ /**
67
+ * Get USDC balance for a wallet
68
+ */
69
+ export async function getUsdcBalance(connection, keypair) {
70
+ try {
71
+ const tokenAccount = await getAssociatedTokenAddress(USDC_MINT, keypair.publicKey, true, // allowOwnerOffCurve - critical for wallet adapter keys!
72
+ TOKEN_PROGRAM_ID);
73
+ const balance = await connection.getTokenAccountBalance(tokenAccount);
74
+ return parseFloat(balance.value.uiAmount?.toString() || "0");
75
+ }
76
+ catch (error) {
77
+ // Token account doesn't exist or other error
78
+ return 0;
79
+ }
80
+ }
81
+ //# sourceMappingURL=x402Client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x402Client.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KAAK,CAAC,CAAC;QAC5D,MAAM,IAAI,KAAK,CACb,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACtF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,UAAsB,EACtB,OAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,MAAM,yBAAyB,CAClD,SAAS,EACT,OAAO,CAAC,SAAS,EACjB,IAAI,EAAE,yDAAyD;QAC/D,gBAAgB,CACjB,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,6CAA6C;QAC7C,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare function formatSuccess(message: string): string;
2
+ export declare function formatError(message: string): string;
3
+ export declare function formatInfo(message: string): string;
4
+ export declare function formatWarning(message: string): string;
5
+ export declare function formatPrice(usdc: number): string;
6
+ export declare function formatAgent(name: string): string;
7
+ export declare function formatUrl(url: string): string;
8
+ export declare function formatSignature(signature: string): string;
9
+ export declare function printBox(title: string, content: string[]): void;
10
+ export declare function formatTable(headers: string[], rows: string[][]): void;
11
+ //# sourceMappingURL=formatting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAoB/D;AAOD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI,CAyBrE"}
@@ -0,0 +1,67 @@
1
+ import chalk from "chalk";
2
+ export function formatSuccess(message) {
3
+ return chalk.green("✅ " + message);
4
+ }
5
+ export function formatError(message) {
6
+ return chalk.red("❌ " + message);
7
+ }
8
+ export function formatInfo(message) {
9
+ return chalk.blue("â„šī¸ " + message);
10
+ }
11
+ export function formatWarning(message) {
12
+ return chalk.yellow("âš ī¸ " + message);
13
+ }
14
+ export function formatPrice(usdc) {
15
+ return chalk.cyan(`$${usdc.toFixed(2)} USDC`);
16
+ }
17
+ export function formatAgent(name) {
18
+ return chalk.magenta(name);
19
+ }
20
+ export function formatUrl(url) {
21
+ return chalk.underline.blue(url);
22
+ }
23
+ export function formatSignature(signature) {
24
+ return chalk.gray(`${signature.slice(0, 8)}...${signature.slice(-8)}`);
25
+ }
26
+ export function printBox(title, content) {
27
+ const width = Math.max(title.length, ...content.map((line) => stripAnsi(line).length));
28
+ const border = "─".repeat(width + 4);
29
+ console.log(`┌${border}┐`);
30
+ console.log(`│ ${chalk.bold(title)}${" ".repeat(width - title.length + 2)}│`);
31
+ console.log(`├${border}┤`);
32
+ for (const line of content) {
33
+ const stripped = stripAnsi(line);
34
+ const padding = " ".repeat(width - stripped.length);
35
+ console.log(`│ ${line}${padding} │`);
36
+ }
37
+ console.log(`└${border}┘`);
38
+ }
39
+ // Simple ANSI strip for box formatting
40
+ function stripAnsi(str) {
41
+ return str.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
42
+ }
43
+ export function formatTable(headers, rows) {
44
+ // Calculate column widths
45
+ const widths = headers.map((header, i) => {
46
+ const rowWidths = rows.map((row) => stripAnsi(row[i] || "").length);
47
+ return Math.max(header.length, ...rowWidths);
48
+ });
49
+ // Print header
50
+ const headerRow = headers
51
+ .map((header, i) => header.padEnd(widths[i]))
52
+ .join(" ");
53
+ console.log(chalk.bold(headerRow));
54
+ console.log("─".repeat(widths.reduce((a, b) => a + b + 2, 0)));
55
+ // Print rows
56
+ for (const row of rows) {
57
+ const formattedRow = row
58
+ .map((cell, i) => {
59
+ const stripped = stripAnsi(cell);
60
+ const padding = widths[i] - stripped.length;
61
+ return cell + " ".repeat(padding);
62
+ })
63
+ .join(" ");
64
+ console.log(formattedRow);
65
+ }
66
+ }
67
+ //# sourceMappingURL=formatting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa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CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/D,aAAa;IACb,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,YAAY,GAAG,GAAG;aACrB,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACf,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;YAC5C,OAAO,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "memeputer",
3
+ "version": "1.0.0",
4
+ "description": "CLI tool for interacting with Memeputer AI agents via x402 payments",
5
+ "bin": {
6
+ "memeputer": "./dist/index.js"
7
+ },
8
+ "main": "dist/index.js",
9
+ "type": "module",
10
+ "scripts": {
11
+ "dev": "echo '✅ CLI is ready! Run: cd apps/cli && tsx src/index.ts -- agents'",
12
+ "test": "tsx src/index.ts agents",
13
+ "build": "tsc",
14
+ "start": "node dist/index.js",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "keywords": [
18
+ "memeputer",
19
+ "ai",
20
+ "agents",
21
+ "cli",
22
+ "x402",
23
+ "solana",
24
+ "micropayments"
25
+ ],
26
+ "author": "Memeputer",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/memeputer/memeputer"
31
+ },
32
+ "homepage": "https://memeputer.com",
33
+ "bugs": {
34
+ "url": "https://github.com/memeputer/memeputer/issues"
35
+ },
36
+ "dependencies": {
37
+ "commander": "^11.1.0",
38
+ "ora": "^8.0.1",
39
+ "chalk": "^5.3.0",
40
+ "axios": "^1.6.5",
41
+ "@solana/web3.js": "^1.98.4",
42
+ "@solana/spl-token": "^0.4.14",
43
+ "bs58": "^5.0.0",
44
+ "dotenv": "^16.3.1"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^20.10.6",
48
+ "tsx": "^4.7.0",
49
+ "typescript": "^5.3.3"
50
+ },
51
+ "engines": {
52
+ "node": ">=18.0.0"
53
+ }
54
+ }