x402-bazaar 1.2.0 → 1.2.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.
- package/bin/cli.js +1 -1
- package/package.json +1 -1
- package/src/commands/init.js +30 -5
package/bin/cli.js
CHANGED
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -239,15 +239,28 @@ export async function initCommand(options) {
|
|
|
239
239
|
log.success('New wallet generated!');
|
|
240
240
|
|
|
241
241
|
// Derive address using viem (installed in step 2)
|
|
242
|
+
let walletAddress = '';
|
|
242
243
|
try {
|
|
243
|
-
|
|
244
|
+
walletAddress = execSync(
|
|
244
245
|
`node --input-type=module -e "import{privateKeyToAccount}from'viem/accounts';console.log(privateKeyToAccount('${agentPrivateKey}').address)"`,
|
|
245
246
|
{ cwd: installDir, stdio: 'pipe', timeout: 15000 }
|
|
246
247
|
).toString().trim();
|
|
247
|
-
log.info(`Wallet address: ${chalk.bold(addr)}`);
|
|
248
248
|
console.log('');
|
|
249
|
-
log.
|
|
250
|
-
log.dim(`
|
|
249
|
+
log.info(`Wallet address: ${chalk.bold(walletAddress)}`);
|
|
250
|
+
log.dim(` BaseScan: https://basescan.org/address/${walletAddress}`);
|
|
251
|
+
console.log('');
|
|
252
|
+
log.separator();
|
|
253
|
+
log.info(chalk.bold('To activate payments, fund this wallet from MetaMask:'));
|
|
254
|
+
console.log('');
|
|
255
|
+
log.dim(` ${chalk.white('1.')} Open MetaMask and switch to the ${chalk.bold('Base')} network`);
|
|
256
|
+
log.dim(` (Chain ID: 8453 — add it via https://chainlist.org/chain/8453)`);
|
|
257
|
+
log.dim(` ${chalk.white('2.')} Send ${chalk.bold('USDC')} to: ${chalk.hex('#34D399')(walletAddress)}`);
|
|
258
|
+
log.dim(` (Even $1 USDC is enough to start — each API call costs $0.005-$0.05)`);
|
|
259
|
+
log.dim(` ${chalk.white('3.')} Send a tiny bit of ${chalk.bold('ETH')} to the same address for gas`);
|
|
260
|
+
log.dim(` (${chalk.white('~$0.01 of ETH on Base')} is enough for hundreds of transactions)`);
|
|
261
|
+
console.log('');
|
|
262
|
+
log.warn(`IMPORTANT: Send on the ${chalk.bold('Base')} network only — not Ethereum mainnet!`);
|
|
263
|
+
log.separator();
|
|
251
264
|
} catch {
|
|
252
265
|
log.info('Wallet address will be shown when you first use the MCP server.');
|
|
253
266
|
log.dim(' Use the get_wallet_balance tool to see your address.');
|
|
@@ -438,17 +451,29 @@ export async function initCommand(options) {
|
|
|
438
451
|
'claude-code': 'Restart Claude Code to activate the MCP server.',
|
|
439
452
|
};
|
|
440
453
|
|
|
454
|
+
const walletLabel = walletMode === 'readonly'
|
|
455
|
+
? 'Read-only (no payments)'
|
|
456
|
+
: walletMode === 'generate'
|
|
457
|
+
? 'New wallet (needs funding)'
|
|
458
|
+
: 'Configured';
|
|
459
|
+
|
|
441
460
|
const summaryLines = [
|
|
442
461
|
`Environment: ${targetEnv.label}`,
|
|
443
462
|
`Install dir: ${installDir}`,
|
|
444
463
|
`Server: ${serverUrl}`,
|
|
445
464
|
`Network: ${network === 'mainnet' ? 'Base Mainnet' : 'Base Sepolia'}`,
|
|
446
465
|
`Budget limit: ${maxBudget} USDC / session`,
|
|
447
|
-
`Wallet: ${
|
|
466
|
+
`Wallet: ${walletLabel}`,
|
|
448
467
|
`Services: ${serviceCount > 0 ? serviceCount + ' available' : 'check with npx x402-bazaar status'}`,
|
|
449
468
|
'',
|
|
450
469
|
restartMsg[targetEnv.name] || 'Configure your AI client with the generated JSON above.',
|
|
451
470
|
'',
|
|
471
|
+
...(walletMode === 'generate' ? [
|
|
472
|
+
'Before your agent can pay for APIs:',
|
|
473
|
+
' 1. Send USDC + a little ETH to your wallet on Base',
|
|
474
|
+
' 2. Restart your IDE',
|
|
475
|
+
'',
|
|
476
|
+
] : []),
|
|
452
477
|
'Then try asking your agent:',
|
|
453
478
|
' "Search for weather APIs on x402 Bazaar"',
|
|
454
479
|
' "List all available services on the marketplace"',
|