x402-bazaar 3.2.5 → 3.3.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/bin/cli.js CHANGED
@@ -25,7 +25,7 @@ const program = new Command();
25
25
  program
26
26
  .name('x402-bazaar')
27
27
  .description(chalk.hex('#FF9900')('x402 Bazaar') + ' — Connect your AI agent to the marketplace in one command')
28
- .version('3.2.5');
28
+ .version('3.3.0');
29
29
 
30
30
  program
31
31
  .command('init')
@@ -33,7 +33,7 @@ program
33
33
  .option('--env <environment>', 'Force environment (claude-desktop, cursor, claude-code, vscode-continue, generic)')
34
34
  .option('--no-wallet', 'Skip wallet configuration (read-only mode)')
35
35
  .option('--server-url <url>', 'Custom server URL', 'https://x402-api.onrender.com')
36
- .option('--network <network>', 'Network: skale, mainnet, or testnet')
36
+ .option('--network <network>', 'Network: skale, polygon, mainnet, or testnet')
37
37
  .option('--budget <amount>', 'Max USDC budget per session', '1.00')
38
38
  .action(initCommand);
39
39
 
@@ -43,7 +43,7 @@ program
43
43
  .option('--env <environment>', 'Target environment (claude-desktop, cursor, claude-code, vscode-continue, generic)')
44
44
  .option('--output <path>', 'Output file path')
45
45
  .option('--server-url <url>', 'Custom server URL', 'https://x402-api.onrender.com')
46
- .option('--network <network>', 'Network: skale, mainnet, or testnet')
46
+ .option('--network <network>', 'Network: skale, polygon, mainnet, or testnet')
47
47
  .option('--budget <amount>', 'Max USDC budget per session', '1.00')
48
48
  .action(configCommand);
49
49
 
@@ -56,7 +56,7 @@ program
56
56
  program
57
57
  .command('list')
58
58
  .description('List all services on x402 Bazaar')
59
- .option('--chain <chain>', 'Filter by chain (base or skale)')
59
+ .option('--chain <chain>', 'Filter by chain (base, skale, or polygon)')
60
60
  .option('--category <category>', 'Filter by category (ai, data, weather, etc.)')
61
61
  .option('--free', 'Show only free services')
62
62
  .option('--server-url <url>', 'Server URL', 'https://x402-api.onrender.com')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402-bazaar",
3
- "version": "3.2.5",
3
+ "version": "3.3.0",
4
4
  "description": "CLI for x402 Bazaar — AI Agent Marketplace. Browse, call, and auto-pay APIs with USDC on Base. One command to connect your agent.",
5
5
  "type": "module",
6
6
  "main": "bin/cli.js",
@@ -219,6 +219,7 @@ export async function initCommand(options) {
219
219
  message: 'Which network?',
220
220
  choices: [
221
221
  { name: 'SKALE on Base (ultra-low gas ~$0.0007/tx — recommended for AI agents)', value: 'skale' },
222
+ { name: 'Polygon (gas-free via x402 facilitator — no POL needed)', value: 'polygon' },
222
223
  { name: 'Base Mainnet (real USDC, requires ETH for gas)', value: 'mainnet' },
223
224
  { name: 'Base Sepolia (testnet, free tokens for testing)', value: 'testnet' },
224
225
  ],
@@ -286,6 +287,8 @@ export async function initCommand(options) {
286
287
  log.info(`Wallet address: ${chalk.bold(walletAddress)}`);
287
288
  if (network === 'skale') {
288
289
  log.dim(` Explorer: https://skale-base-explorer.skalenodes.com/address/${walletAddress}`);
290
+ } else if (network === 'polygon') {
291
+ log.dim(` PolygonScan: https://polygonscan.com/address/${walletAddress}`);
289
292
  } else {
290
293
  log.dim(` BaseScan: https://basescan.org/address/${walletAddress}`);
291
294
  }
@@ -301,6 +304,16 @@ export async function initCommand(options) {
301
304
  log.dim(` ${chalk.white('3.')} Gas (CREDITS) is auto-funded — no ETH needed on SKALE!`);
302
305
  console.log('');
303
306
  log.warn(`IMPORTANT: Send USDC on ${chalk.bold('SKALE on Base')} (chain ID 1187947933) — not Base or Ethereum!`);
307
+ } else if (network === 'polygon') {
308
+ log.info(chalk.bold('To activate payments, fund this wallet:'));
309
+ console.log('');
310
+ log.dim(` ${chalk.white('1.')} Bridge USDC from any chain → Polygon via:`);
311
+ log.dim(` ${chalk.cyan('https://jumper.exchange')} or ${chalk.cyan('https://x402bazaar.org/fund')}`);
312
+ log.dim(` ${chalk.white('2.')} Or send ${chalk.bold('USDC')} directly to: ${chalk.hex('#34D399')(walletAddress)}`);
313
+ log.dim(` (Even $1 USDC is enough — each API call costs $0.005-$0.05)`);
314
+ log.dim(` ${chalk.white('3.')} ${chalk.bold('No gas needed!')} The x402 facilitator sponsors gas via PIP-82`);
315
+ console.log('');
316
+ log.warn(`IMPORTANT: Send ${chalk.bold('native USDC')} on ${chalk.bold('Polygon')} (chain ID 137) — not USDC.e!`);
304
317
  } else {
305
318
  log.info(chalk.bold('To activate payments, fund this wallet:'));
306
319
  console.log('');
@@ -482,7 +495,7 @@ export async function initCommand(options) {
482
495
  `Environment: ${targetEnv.label}`,
483
496
  `Install dir: ${installDir}`,
484
497
  `Server: ${serverUrl}`,
485
- `Network: ${network === 'mainnet' ? 'Base Mainnet' : network === 'skale' ? 'SKALE on Base' : 'Base Sepolia'}`,
498
+ `Network: ${network === 'mainnet' ? 'Base Mainnet' : network === 'skale' ? 'SKALE on Base' : network === 'polygon' ? 'Polygon' : 'Base Sepolia'}`,
486
499
  `Budget limit: ${maxBudget} USDC / session`,
487
500
  `Wallet: ${walletLabel}`,
488
501
  `Services: ${serviceCount > 0 ? serviceCount + ' available' : 'check with npx x402-bazaar status'}`,
@@ -493,7 +506,9 @@ export async function initCommand(options) {
493
506
  'Before your agent can pay for APIs:',
494
507
  network === 'skale'
495
508
  ? ' 1. Bridge USDC → SKALE on Base: https://x402bazaar.org/fund (CREDITS auto-funded!)'
496
- : ' 1. Send USDC + a little ETH to your wallet on Base',
509
+ : network === 'polygon'
510
+ ? ' 1. Send USDC to your wallet on Polygon (gas-free via x402 facilitator!)'
511
+ : ' 1. Send USDC + a little ETH to your wallet on Base',
497
512
  ' 2. Restart your IDE',
498
513
  '',
499
514
  ] : []),
@@ -528,6 +543,22 @@ export async function initCommand(options) {
528
543
  console.log('');
529
544
  console.log('='.repeat(70));
530
545
  console.log('');
546
+ } else if (walletMode === 'generate' && network === 'polygon') {
547
+ console.log('');
548
+ console.log('='.repeat(70));
549
+ console.log('');
550
+ console.log(' IMPORTANT — After restarting, ask your agent to run: setup_wallet');
551
+ console.log('');
552
+ console.log(' This will:');
553
+ console.log(' - Show your wallet balance on Base, SKALE, and Polygon');
554
+ console.log(' - Provide bridge links to fund your wallet with USDC');
555
+ console.log('');
556
+ console.log(' Polygon uses the x402 facilitator — NO gas needed (PIP-82)!');
557
+ console.log(' Just send USDC to your wallet on Polygon.');
558
+ console.log(' Bridge: https://jumper.exchange or https://x402bazaar.org/fund');
559
+ console.log('');
560
+ console.log('='.repeat(70));
561
+ console.log('');
531
562
  } else if (walletMode === 'generate') {
532
563
  console.log('');
533
564
  console.log('='.repeat(70));
@@ -28,7 +28,18 @@ NETWORK=${network}
28
28
  # WARNING: Keep this secret! Never commit to git.
29
29
  AGENT_PRIVATE_KEY=${agentPrivateKey}
30
30
  `;
31
- } else if (coinbaseApiKey) {
31
+ }
32
+
33
+ // Polygon facilitator env vars (gas-free payments via PIP-82)
34
+ if (network === 'polygon') {
35
+ content += `
36
+ # Polygon x402 Facilitator (gas-free payments via PIP-82)
37
+ POLYGON_FACILITATOR_URL=https://x402.polygon.technology
38
+ POLYGON_FEE_SPLITTER_CONTRACT=0x820d4b07D09e5E07598464E6E36cB12561e0Ba56
39
+ `;
40
+ }
41
+
42
+ if (!agentPrivateKey && coinbaseApiKey) {
32
43
  content += `
33
44
  # Coinbase Developer Platform API credentials (legacy mode)
34
45
  # Get yours at: https://portal.cdp.coinbase.com/
@@ -32,6 +32,12 @@ export function generateMcpConfig({
32
32
  }
33
33
  }
34
34
 
35
+ // Polygon facilitator — gas-free payments via PIP-82
36
+ if (network === 'polygon') {
37
+ env.POLYGON_FACILITATOR_URL = 'https://x402.polygon.technology';
38
+ env.POLYGON_FEE_SPLITTER_CONTRACT = '0x820d4b07D09e5E07598464E6E36cB12561e0Ba56';
39
+ }
40
+
35
41
  const serverEntry = {
36
42
  command: 'node',
37
43
  args: [mcpServerPath],