aiprotocol-sbi 1.3.4 → 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.
|
@@ -124,9 +124,6 @@ let SecurityService = class SecurityService {
|
|
|
124
124
|
const rateCheck = await this.checkRateLimit(botId, command);
|
|
125
125
|
if (!rateCheck.allowed)
|
|
126
126
|
return rateCheck;
|
|
127
|
-
const economyCheck = await this.checkNoDuplicateEconomy(botId);
|
|
128
|
-
if (!economyCheck.allowed)
|
|
129
|
-
return economyCheck;
|
|
130
127
|
return { allowed: true };
|
|
131
128
|
}
|
|
132
129
|
formatWindow(secs) {
|
package/dist/setup.command.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
252
|
+
this.handleError("Funding must be GRANT or SELF", opts);
|
|
253
|
+
return;
|
|
251
254
|
}
|
|
252
255
|
return f;
|
|
253
256
|
}
|