aiprotocol-sbi 1.3.5 → 1.3.6

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.
@@ -60,9 +60,9 @@ let SetupCommand = SetupCommand_1 = class SetupCommand {
60
60
  this.resetConfig(opts);
61
61
  return;
62
62
  }
63
- const botName = this.validateBotName(opts.botName);
64
- const validatedNetwork = this.validateNetwork(network);
65
- const funding = this.validateFunding(opts.funding);
63
+ const botName = this.validateBotName(opts.botName, opts);
64
+ const validatedNetwork = this.validateNetwork(network, opts);
65
+ const funding = this.validateFunding(opts.funding, opts);
66
66
  const finalBotId = this.botIdentity.generateBotId(`${botName}-${validatedNetwork}`);
67
67
  const existingBot = await this.backend.getBot(finalBotId);
68
68
  if (existingBot) {
@@ -232,22 +232,25 @@ let SetupCommand = SetupCommand_1 = class SetupCommand {
232
232
  this.output.info("After sending, approve these funds using 'Approve Script'");
233
233
  this.output.info("Verify payment using: aiprotocol-sbi payment verify");
234
234
  }
235
- validateBotName(name) {
235
+ validateBotName(name, opts) {
236
236
  if (!name || name.trim().length < 2) {
237
- throw new Error("Bot name must be at least 2 characters");
237
+ this.handleError("Bot name must be at least 2 characters", opts);
238
+ return;
238
239
  }
239
240
  return name.trim();
240
241
  }
241
- validateNetwork(network) {
242
+ validateNetwork(network, opts) {
242
243
  if (!["base", "base-sepolia"].includes(network)) {
243
- throw new Error("Network must be base or base-sepolia");
244
+ this.handleError("Network must be base or base-sepolia", opts);
245
+ return;
244
246
  }
245
247
  return network;
246
248
  }
247
- validateFunding(funding) {
249
+ validateFunding(funding, opts) {
248
250
  const f = funding?.toUpperCase();
249
251
  if (!["GRANT", "SELF"].includes(f)) {
250
- throw new Error("Funding must be GRANT or SELF");
252
+ this.handleError("Funding must be GRANT or SELF", opts);
253
+ return;
251
254
  }
252
255
  return f;
253
256
  }