x402-bazaar 1.2.1 → 1.2.2

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
@@ -21,7 +21,7 @@ const program = new Command();
21
21
  program
22
22
  .name('x402-bazaar')
23
23
  .description(chalk.hex('#FF9900')('x402 Bazaar') + ' — Connect your AI agent to the marketplace in one command')
24
- .version('1.2.1');
24
+ .version('1.2.2');
25
25
 
26
26
  program
27
27
  .command('init')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402-bazaar",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "CLI to set up x402 Bazaar MCP server for AI agents. One command to connect your agent to the marketplace.",
5
5
  "type": "module",
6
6
  "main": "bin/cli.js",
@@ -191,8 +191,8 @@ export async function initCommand(options) {
191
191
 
192
192
  console.log('');
193
193
 
194
- // ─── Step 3: Wallet Configuration ───────────────────────────────────
195
- log.step(3, 'Configuring wallet...');
194
+ // ─── Step 3: Network & Wallet Configuration ────────────────────────
195
+ log.step(3, 'Configuring network and wallet...');
196
196
  console.log('');
197
197
 
198
198
  let walletMode = 'readonly';
@@ -207,6 +207,42 @@ export async function initCommand(options) {
207
207
  log.info('Skipping wallet setup (--no-wallet)');
208
208
  walletMode = 'readonly';
209
209
  } else {
210
+ // Network & Budget first — needed for wallet funding instructions
211
+ const configOverrides = {};
212
+ if (options.network) configOverrides.network = options.network;
213
+ if (options.budget) configOverrides.maxBudget = options.budget;
214
+
215
+ const configAnswers = await promptOrDefault([
216
+ {
217
+ type: 'list',
218
+ name: 'network',
219
+ message: 'Which network?',
220
+ choices: [
221
+ { name: 'Base Mainnet (real USDC)', value: 'mainnet' },
222
+ { name: 'Base Sepolia (testnet, free tokens for testing)', value: 'testnet' },
223
+ { name: 'SKALE Europa (zero gas fees — advanced users)', value: 'skale' },
224
+ ],
225
+ default: 'mainnet',
226
+ },
227
+ {
228
+ type: 'input',
229
+ name: 'maxBudget',
230
+ message: 'Max USDC budget per session (safety limit):',
231
+ default: '1.00',
232
+ validate: (v) => {
233
+ const n = parseFloat(v);
234
+ if (isNaN(n) || n <= 0) return 'Must be a positive number';
235
+ if (n > 100) return 'Maximum is 100 USDC per session';
236
+ return true;
237
+ },
238
+ },
239
+ ], configOverrides);
240
+
241
+ network = configAnswers.network;
242
+ maxBudget = configAnswers.maxBudget;
243
+
244
+ console.log('');
245
+
210
246
  const { mode } = await promptOrDefault([{
211
247
  type: 'list',
212
248
  name: 'mode',
@@ -247,19 +283,36 @@ export async function initCommand(options) {
247
283
  ).toString().trim();
248
284
  console.log('');
249
285
  log.info(`Wallet address: ${chalk.bold(walletAddress)}`);
250
- log.dim(` BaseScan: https://basescan.org/address/${walletAddress}`);
286
+ if (network === 'skale') {
287
+ log.dim(` Explorer: https://elated-tan-skat.explorer.mainnet.skalenodes.com/address/${walletAddress}`);
288
+ } else {
289
+ log.dim(` BaseScan: https://basescan.org/address/${walletAddress}`);
290
+ }
251
291
  console.log('');
252
292
  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!`);
293
+ if (network === 'skale') {
294
+ log.info(chalk.bold('To activate payments, fund this wallet:'));
295
+ console.log('');
296
+ log.dim(` ${chalk.white('1.')} Bridge USDC to SKALE Europa`);
297
+ log.dim(` (Use https://portal.skale.space/bridge or any SKALE bridge)`);
298
+ log.dim(` ${chalk.white('2.')} Send ${chalk.bold('USDC')} to: ${chalk.hex('#34D399')(walletAddress)}`);
299
+ log.dim(` (Even $1 USDC is enough each API call costs $0.005-$0.05)`);
300
+ log.dim(` ${chalk.white('3.')} Get free sFUEL for gas at https://www.sfuelstation.com/`);
301
+ log.dim(` (sFUEL is free — no ETH needed on SKALE!)`);
302
+ console.log('');
303
+ log.warn(`IMPORTANT: Send USDC on ${chalk.bold('SKALE Europa')} only — not Base or Ethereum!`);
304
+ } else {
305
+ log.info(chalk.bold('To activate payments, fund this wallet from MetaMask:'));
306
+ console.log('');
307
+ log.dim(` ${chalk.white('1.')} Open MetaMask and switch to the ${chalk.bold('Base')} network`);
308
+ log.dim(` (Chain ID: 8453 — add it via https://chainlist.org/chain/8453)`);
309
+ log.dim(` ${chalk.white('2.')} Send ${chalk.bold('USDC')} to: ${chalk.hex('#34D399')(walletAddress)}`);
310
+ log.dim(` (Even $1 USDC is enough to start — each API call costs $0.005-$0.05)`);
311
+ log.dim(` ${chalk.white('3.')} Send a tiny bit of ${chalk.bold('ETH')} to the same address for gas`);
312
+ log.dim(` (${chalk.white('~$0.01 of ETH on Base')} is enough for hundreds of transactions)`);
313
+ console.log('');
314
+ log.warn(`IMPORTANT: Send on the ${chalk.bold('Base')} network only — not Ethereum mainnet!`);
315
+ }
263
316
  log.separator();
264
317
  } catch {
265
318
  log.info('Wallet address will be shown when you first use the MCP server.');
@@ -325,39 +378,6 @@ export async function initCommand(options) {
325
378
  }
326
379
  }
327
380
  }
328
-
329
- // Network & Budget — use CLI flags as overrides
330
- const configOverrides = {};
331
- if (options.network) configOverrides.network = options.network;
332
- if (options.budget) configOverrides.maxBudget = options.budget;
333
-
334
- const configAnswers = await promptOrDefault([
335
- {
336
- type: 'list',
337
- name: 'network',
338
- message: 'Which network?',
339
- choices: [
340
- { name: 'Base Mainnet (real USDC)', value: 'mainnet' },
341
- { name: 'Base Sepolia (testnet, free tokens for testing)', value: 'testnet' },
342
- ],
343
- default: 'mainnet',
344
- },
345
- {
346
- type: 'input',
347
- name: 'maxBudget',
348
- message: 'Max USDC budget per session (safety limit):',
349
- default: '1.00',
350
- validate: (v) => {
351
- const n = parseFloat(v);
352
- if (isNaN(n) || n <= 0) return 'Must be a positive number';
353
- if (n > 100) return 'Maximum is 100 USDC per session';
354
- return true;
355
- },
356
- },
357
- ], configOverrides);
358
-
359
- network = configAnswers.network;
360
- maxBudget = configAnswers.maxBudget;
361
381
  }
362
382
 
363
383
  console.log('');
@@ -461,7 +481,7 @@ export async function initCommand(options) {
461
481
  `Environment: ${targetEnv.label}`,
462
482
  `Install dir: ${installDir}`,
463
483
  `Server: ${serverUrl}`,
464
- `Network: ${network === 'mainnet' ? 'Base Mainnet' : 'Base Sepolia'}`,
484
+ `Network: ${network === 'mainnet' ? 'Base Mainnet' : network === 'skale' ? 'SKALE Europa' : 'Base Sepolia'}`,
465
485
  `Budget limit: ${maxBudget} USDC / session`,
466
486
  `Wallet: ${walletLabel}`,
467
487
  `Services: ${serviceCount > 0 ? serviceCount + ' available' : 'check with npx x402-bazaar status'}`,
@@ -470,7 +490,9 @@ export async function initCommand(options) {
470
490
  '',
471
491
  ...(walletMode === 'generate' ? [
472
492
  'Before your agent can pay for APIs:',
473
- ' 1. Send USDC + a little ETH to your wallet on Base',
493
+ network === 'skale'
494
+ ? ' 1. Bridge USDC to your wallet on SKALE Europa + get free sFUEL'
495
+ : ' 1. Send USDC + a little ETH to your wallet on Base',
474
496
  ' 2. Restart your IDE',
475
497
  '',
476
498
  ] : []),