aiprotocol-sbi 1.2.0 → 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/dist/modules/backend-api/backend-api.service.d.ts +0 -1
- package/dist/modules/config/config.service.d.ts +2 -0
- package/dist/modules/economy/commands/economy-launch.command.js +8 -2
- package/dist/modules/wallet/commands/wallet-who.command.js +2 -0
- package/dist/setup.command.d.ts +1 -3
- package/dist/setup.command.js +23 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -3,11 +3,13 @@ export interface SbiConfig {
|
|
|
3
3
|
apiBaseUrl: string;
|
|
4
4
|
network: "base" | "base-sepolia";
|
|
5
5
|
keystorePassword?: string;
|
|
6
|
+
image?: string;
|
|
6
7
|
botId?: string;
|
|
7
8
|
botName?: string;
|
|
8
9
|
botCreatedAt?: string;
|
|
9
10
|
botLastSeenAt?: string;
|
|
10
11
|
wallet_address?: string;
|
|
12
|
+
private_key?: string;
|
|
11
13
|
economyContractAddress?: string;
|
|
12
14
|
economyTokenAddress?: string;
|
|
13
15
|
economyTicker?: string;
|
|
@@ -33,6 +33,7 @@ let EconomyLaunchCommand = EconomyLaunchCommand_1 = class EconomyLaunchCommand {
|
|
|
33
33
|
.requiredOption("--name <name>", "Agent / economy name")
|
|
34
34
|
.requiredOption("--ticker <ticker>", "Token ticker")
|
|
35
35
|
.requiredOption("--description <description>", "Short agent description")
|
|
36
|
+
.requiredOption("--image <image>", "Agent image")
|
|
36
37
|
.option("--json", "Output result as JSON")
|
|
37
38
|
.action(async (opts) => {
|
|
38
39
|
const cfg = this.config.requireWallet();
|
|
@@ -55,7 +56,8 @@ let EconomyLaunchCommand = EconomyLaunchCommand_1 = class EconomyLaunchCommand {
|
|
|
55
56
|
}
|
|
56
57
|
const name = this.security.sanitizeString(opts.name, 64);
|
|
57
58
|
const ticker = tickerCheck.value;
|
|
58
|
-
const description = opts.description
|
|
59
|
+
const description = opts.description;
|
|
60
|
+
const image = opts.image
|
|
59
61
|
? this.security.sanitizeString(opts.description, 512)
|
|
60
62
|
: undefined;
|
|
61
63
|
if (!opts.yes && !opts.json) {
|
|
@@ -63,6 +65,7 @@ let EconomyLaunchCommand = EconomyLaunchCommand_1 = class EconomyLaunchCommand {
|
|
|
63
65
|
this.output.row("Name", name);
|
|
64
66
|
this.output.row("Ticker", ticker);
|
|
65
67
|
this.output.row("Network", cfg.network);
|
|
68
|
+
this.output.row("Image", image);
|
|
66
69
|
this.output.row("Wallet", cfg.wallet_address);
|
|
67
70
|
this.output.blank();
|
|
68
71
|
}
|
|
@@ -81,12 +84,14 @@ let EconomyLaunchCommand = EconomyLaunchCommand_1 = class EconomyLaunchCommand {
|
|
|
81
84
|
wallet_address: cfg.wallet_address,
|
|
82
85
|
network: cfg.network,
|
|
83
86
|
description,
|
|
87
|
+
image: image,
|
|
84
88
|
});
|
|
85
89
|
if (!result?.is_application) {
|
|
86
90
|
this.output.blank();
|
|
87
91
|
this.output.row("Status", this.output.statusBadge("BLOCKED"));
|
|
88
92
|
this.output.row("Name", name);
|
|
89
93
|
this.output.row("Ticker", ticker);
|
|
94
|
+
this.output.row("Image", image);
|
|
90
95
|
this.output.divider();
|
|
91
96
|
this.output.blank();
|
|
92
97
|
this.output.warn("No funding application found for this bot.\n" +
|
|
@@ -104,6 +109,7 @@ let EconomyLaunchCommand = EconomyLaunchCommand_1 = class EconomyLaunchCommand {
|
|
|
104
109
|
this.output.row("Status", this.output.statusBadge("BLOCKED"));
|
|
105
110
|
this.output.row("Name", name);
|
|
106
111
|
this.output.row("Ticker", ticker);
|
|
112
|
+
this.output.row("Image", image);
|
|
107
113
|
this.output.divider();
|
|
108
114
|
this.output.blank();
|
|
109
115
|
this.output.warn("Launch blocked. Your funding application has not been verified yet.\n" +
|
|
@@ -112,7 +118,6 @@ let EconomyLaunchCommand = EconomyLaunchCommand_1 = class EconomyLaunchCommand {
|
|
|
112
118
|
this.output.info(`Check application status with:\n ${nextCommand}`);
|
|
113
119
|
process.exit(1);
|
|
114
120
|
}
|
|
115
|
-
console.log(result, "result");
|
|
116
121
|
this.config.save({
|
|
117
122
|
economyTicker: result?.sbi?.ticker ?? name,
|
|
118
123
|
economyName: result?.sbi?.name ?? ticker,
|
|
@@ -124,6 +129,7 @@ let EconomyLaunchCommand = EconomyLaunchCommand_1 = class EconomyLaunchCommand {
|
|
|
124
129
|
this.output.row("Status", this.output.statusBadge("PENDING"));
|
|
125
130
|
this.output.row("Name", name);
|
|
126
131
|
this.output.row("Ticker", ticker);
|
|
132
|
+
this.output.row("Image", image);
|
|
127
133
|
this.output.divider();
|
|
128
134
|
this.output.blank();
|
|
129
135
|
this.output.info("Deployment in progress. Poll with:\n aiprotocol-sbi economy status --poll");
|
|
@@ -58,6 +58,7 @@ let WalletWhoCommand = WalletWhoCommand_1 = class WalletWhoCommand {
|
|
|
58
58
|
botId: bot_id,
|
|
59
59
|
botName: bot_name,
|
|
60
60
|
address: wallet_address,
|
|
61
|
+
private_key: cfg?.private_key ?? "",
|
|
61
62
|
commandCount: command_count ?? 0,
|
|
62
63
|
keystorePath: this.output.envelope(wallet_address).data,
|
|
63
64
|
firstSeen: createdAt,
|
|
@@ -70,6 +71,7 @@ let WalletWhoCommand = WalletWhoCommand_1 = class WalletWhoCommand {
|
|
|
70
71
|
this.output.row("Bot ID", bot_id);
|
|
71
72
|
this.output.row("Bot Name", bot_name);
|
|
72
73
|
this.output.row("Address", wallet_address);
|
|
74
|
+
this.output.row("Private Key", cfg?.private_key);
|
|
73
75
|
this.output.row("Commands run", String(command_count ?? 0));
|
|
74
76
|
this.output.row("First seen", createdAt);
|
|
75
77
|
this.output.row("Last seen", last_seen_at);
|
package/dist/setup.command.d.ts
CHANGED
|
@@ -2,17 +2,15 @@ import { Command } from "commander";
|
|
|
2
2
|
import { WalletCryptoService } from "./modules/wallet/wallet-crypto.service";
|
|
3
3
|
import { BotIdentityService } from "./modules/wallet/bot-identity.service";
|
|
4
4
|
import { BackendApiService } from "./modules/backend-api/backend-api.service";
|
|
5
|
-
import { AuditService } from "./modules/security/audit.service";
|
|
6
5
|
import { OutputService } from "./common/output.service";
|
|
7
6
|
import { ConfigService } from "./modules/config/config.service";
|
|
8
7
|
export declare class SetupCommand {
|
|
9
8
|
private readonly walletCrypto;
|
|
10
9
|
private readonly botIdentity;
|
|
11
|
-
private readonly audit;
|
|
12
10
|
private readonly output;
|
|
13
11
|
private readonly config;
|
|
14
12
|
private readonly backend;
|
|
15
|
-
constructor(walletCrypto: WalletCryptoService, botIdentity: BotIdentityService,
|
|
13
|
+
constructor(walletCrypto: WalletCryptoService, botIdentity: BotIdentityService, output: OutputService, config: ConfigService, backend: BackendApiService);
|
|
16
14
|
register(program: Command): void;
|
|
17
15
|
private resetConfig;
|
|
18
16
|
private handleExistingBot;
|
package/dist/setup.command.js
CHANGED
|
@@ -14,14 +14,12 @@ const common_1 = require("@nestjs/common");
|
|
|
14
14
|
const wallet_crypto_service_1 = require("./modules/wallet/wallet-crypto.service");
|
|
15
15
|
const bot_identity_service_1 = require("./modules/wallet/bot-identity.service");
|
|
16
16
|
const backend_api_service_1 = require("./modules/backend-api/backend-api.service");
|
|
17
|
-
const audit_service_1 = require("./modules/security/audit.service");
|
|
18
17
|
const output_service_1 = require("./common/output.service");
|
|
19
18
|
const config_service_1 = require("./modules/config/config.service");
|
|
20
19
|
let SetupCommand = class SetupCommand {
|
|
21
|
-
constructor(walletCrypto, botIdentity,
|
|
20
|
+
constructor(walletCrypto, botIdentity, output, config, backend) {
|
|
22
21
|
this.walletCrypto = walletCrypto;
|
|
23
22
|
this.botIdentity = botIdentity;
|
|
24
|
-
this.audit = audit;
|
|
25
23
|
this.output = output;
|
|
26
24
|
this.config = config;
|
|
27
25
|
this.backend = backend;
|
|
@@ -30,13 +28,13 @@ let SetupCommand = class SetupCommand {
|
|
|
30
28
|
program
|
|
31
29
|
.command("setup")
|
|
32
30
|
.description("Create a new agent wallet and configure funding")
|
|
33
|
-
.
|
|
31
|
+
.option("--bot-name <name>", "Bot name")
|
|
34
32
|
.option("--network <network>", "base | base-sepolia", "base")
|
|
35
|
-
.
|
|
36
|
-
.option("--payment-token <token>", "ALI | USDC (required for SELF)")
|
|
33
|
+
.option("--funding <type>", "GRANT | SELF")
|
|
37
34
|
.option("--applicant-name <name>", "Required for GRANT")
|
|
38
35
|
.option("--applicant-email <email>", "Required for GRANT")
|
|
39
36
|
.option("--purpose <text>", "Required for GRANT")
|
|
37
|
+
.option("--links <text>", "Required for GRANT")
|
|
40
38
|
.option("--json", "Output JSON")
|
|
41
39
|
.option("--reset", "Clear config")
|
|
42
40
|
.action(async (opts) => {
|
|
@@ -117,21 +115,23 @@ let SetupCommand = class SetupCommand {
|
|
|
117
115
|
}
|
|
118
116
|
}
|
|
119
117
|
async handleSelfStatus(existingBot, appStatus, opts) {
|
|
120
|
-
const token =
|
|
121
|
-
const requiredAmount =
|
|
118
|
+
const token = "ALI";
|
|
119
|
+
const requiredAmount = "500 ALI";
|
|
122
120
|
if (!opts.json) {
|
|
123
121
|
this.output.section("Funding Method: Self-Funded");
|
|
122
|
+
this.output.info("You need to send 500 ALI to launch an economy.");
|
|
123
|
+
this.output.info("Send payment to your bot's address:");
|
|
124
|
+
this.output.divider();
|
|
124
125
|
this.output.row("Wallet Address", existingBot.wallet_address);
|
|
125
126
|
this.output.row("Payment Token", token);
|
|
126
127
|
this.output.row("Required Amount", requiredAmount);
|
|
127
128
|
this.output.blank();
|
|
129
|
+
this.output.info("Transfer these funds using 'Transfer Script' to AIP");
|
|
128
130
|
if (appStatus?.status === "SUCCESS") {
|
|
129
131
|
this.output.success("✅ Payment confirmed! Your agent is funded.");
|
|
130
132
|
this.output.info("aiprotocol-sbi economy launch");
|
|
131
133
|
}
|
|
132
134
|
else {
|
|
133
|
-
this.output.warn("Payment not yet confirmed.");
|
|
134
|
-
this.output.info(`Send ${requiredAmount} to the wallet above.`);
|
|
135
135
|
this.output.info("Verify payment: aiprotocol-sbi payment verify");
|
|
136
136
|
}
|
|
137
137
|
this.output.blank();
|
|
@@ -146,6 +146,7 @@ let SetupCommand = class SetupCommand {
|
|
|
146
146
|
botName,
|
|
147
147
|
network,
|
|
148
148
|
wallet_address: wallet.address,
|
|
149
|
+
private_key: wallet.privateKey,
|
|
149
150
|
fundingType: funding,
|
|
150
151
|
setupComplete: true,
|
|
151
152
|
});
|
|
@@ -153,7 +154,6 @@ let SetupCommand = class SetupCommand {
|
|
|
153
154
|
bot_id: botId,
|
|
154
155
|
bot_name: botName,
|
|
155
156
|
wallet_address: wallet.address,
|
|
156
|
-
private_key: wallet.privateKey,
|
|
157
157
|
network,
|
|
158
158
|
});
|
|
159
159
|
if (funding === "GRANT") {
|
|
@@ -162,8 +162,11 @@ let SetupCommand = class SetupCommand {
|
|
|
162
162
|
return this.handleSelfFlow(botId, botName, wallet, network, opts);
|
|
163
163
|
}
|
|
164
164
|
async handleGrantFlow(botId, botName, wallet, network, opts) {
|
|
165
|
-
if (!opts.applicantName ||
|
|
166
|
-
|
|
165
|
+
if (!opts.applicantName ||
|
|
166
|
+
!opts.applicantEmail ||
|
|
167
|
+
!opts.purpose ||
|
|
168
|
+
!!opts.links) {
|
|
169
|
+
throw new Error("GRANT requires --applicant-name, --applicant-email, --purpose --links");
|
|
167
170
|
}
|
|
168
171
|
this.output.section("AIP Grant Application");
|
|
169
172
|
const result = await this.backend.submitGrantApplication({
|
|
@@ -180,16 +183,17 @@ let SetupCommand = class SetupCommand {
|
|
|
180
183
|
this.output.row("Bot ID", botId);
|
|
181
184
|
this.output.row("Bot Name", botName);
|
|
182
185
|
this.output.row("Wallet Address", wallet.address);
|
|
186
|
+
this.output.row("Private Key", wallet.privateKey);
|
|
183
187
|
this.output.info("Wait 48 hours for approval.");
|
|
184
188
|
this.output.info("Check status anytime: aiprotocol-sbi grant status");
|
|
185
189
|
process.exit(0);
|
|
186
190
|
}
|
|
187
191
|
async handleSelfFlow(botId, botName, wallet, network, opts) {
|
|
188
|
-
const token =
|
|
192
|
+
const token = "ALI";
|
|
189
193
|
if (!["ALI", "USDC"].includes(token)) {
|
|
190
194
|
throw new Error("SELF requires --payment-token ALI or USDC");
|
|
191
195
|
}
|
|
192
|
-
const requiredAmount = token === "ALI" ? "
|
|
196
|
+
const requiredAmount = token === "ALI" ? "500" : "10";
|
|
193
197
|
await this.backend.submitApplication({
|
|
194
198
|
bot_id: botId,
|
|
195
199
|
wallet_address: wallet.address,
|
|
@@ -198,12 +202,13 @@ let SetupCommand = class SetupCommand {
|
|
|
198
202
|
network,
|
|
199
203
|
type: "SELF",
|
|
200
204
|
});
|
|
201
|
-
this.output.warn("
|
|
205
|
+
this.output.warn("⚠️ You need to send 500 ALI to launch an economy.");
|
|
206
|
+
this.output.warn("Send payment to your bot's address:");
|
|
202
207
|
this.output.row("Wallet", wallet.address);
|
|
203
208
|
this.output.row("Network", network);
|
|
204
209
|
this.output.row("Required Amount", requiredAmount);
|
|
205
|
-
this.output.info("After sending,
|
|
206
|
-
this.output.info("Verify using: aiprotocol-sbi payment verify");
|
|
210
|
+
this.output.info("After sending, transfer these funds using 'Transfer Script' to AIP");
|
|
211
|
+
this.output.info("Verify payment using: aiprotocol-sbi payment verify");
|
|
207
212
|
process.exit(0);
|
|
208
213
|
}
|
|
209
214
|
validateBotName(name) {
|
|
@@ -241,7 +246,6 @@ exports.SetupCommand = SetupCommand = __decorate([
|
|
|
241
246
|
(0, common_1.Injectable)(),
|
|
242
247
|
__metadata("design:paramtypes", [wallet_crypto_service_1.WalletCryptoService,
|
|
243
248
|
bot_identity_service_1.BotIdentityService,
|
|
244
|
-
audit_service_1.AuditService,
|
|
245
249
|
output_service_1.OutputService,
|
|
246
250
|
config_service_1.ConfigService,
|
|
247
251
|
backend_api_service_1.BackendApiService])
|