@bankr/cli 0.1.3 → 0.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/cli.js +439 -133
- package/dist/commands/balances.d.ts +1 -0
- package/dist/commands/balances.js +7 -32
- package/dist/commands/llm.js +74 -18
- package/dist/commands/login.d.ts +5 -0
- package/dist/commands/login.js +139 -33
- package/dist/commands/portfolio.d.ts +9 -0
- package/dist/commands/portfolio.js +134 -0
- package/dist/commands/tokens.d.ts +7 -0
- package/dist/commands/tokens.js +60 -0
- package/dist/commands/transfer.d.ts +8 -0
- package/dist/commands/transfer.js +80 -0
- package/dist/commands/update.d.ts +4 -0
- package/dist/commands/update.js +116 -0
- package/dist/commands/x402.d.ts +69 -0
- package/dist/commands/x402.js +636 -0
- package/dist/lib/api.d.ts +59 -2
- package/dist/lib/api.js +34 -8
- package/dist/lib/chains.d.ts +5 -0
- package/dist/lib/chains.js +39 -0
- package/dist/lib/output.d.ts +4 -0
- package/dist/lib/output.js +19 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,8 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { input } from "@inquirer/prompts";
|
|
5
5
|
import { balancesCommand } from "./commands/balances.js";
|
|
6
|
+
import { portfolioCommand } from "./commands/portfolio.js";
|
|
7
|
+
import { transferCommand } from "./commands/transfer.js";
|
|
6
8
|
import { skillsCommand } from "./commands/capabilities.js";
|
|
7
9
|
import { cancelCommand } from "./commands/cancel.js";
|
|
8
10
|
import { configGetCommand, configSetCommand } from "./commands/config.js";
|
|
@@ -17,7 +19,10 @@ import { signCommand } from "./commands/sign.js";
|
|
|
17
19
|
import { soundsDisableCommand, soundsEnableCommand, soundsInstallCommand, soundsListCommand, soundsMuteCommand, soundsSearchCommand, soundsStatusCommand, soundsTestCommand, soundsUnmuteCommand, soundsUseCommand, soundsVolumeCommand, } from "./commands/sounds.js";
|
|
18
20
|
import { statusCommand } from "./commands/status.js";
|
|
19
21
|
import { submitCommand, submitJsonCommand } from "./commands/submit.js";
|
|
22
|
+
import { updateCommand } from "./commands/update.js";
|
|
20
23
|
import { whoamiCommand } from "./commands/whoami.js";
|
|
24
|
+
import { tokensSearchCommand, tokensInfoCommand } from "./commands/tokens.js";
|
|
25
|
+
import { x402InitCommand, x402AddCommand, x402ConfigureCommand, x402DeployCommand, x402ListCommand, x402PauseResumeCommand, x402DeleteCommand, x402RevenueCommand, x402EnvSetCommand, x402EnvListCommand, x402EnvUnsetCommand, x402SearchCommand, } from "./commands/x402.js";
|
|
21
26
|
import { profileViewCommand, profileCreateCommand, profileUpdateCommand, profileDeleteCommand, profileAddUpdateCommand, } from "./commands/profile.js";
|
|
22
27
|
import * as output from "./lib/output.js";
|
|
23
28
|
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
@@ -74,7 +79,7 @@ function colorizeHelp(text) {
|
|
|
74
79
|
}
|
|
75
80
|
program
|
|
76
81
|
.name("bankr")
|
|
77
|
-
.description("Bankr AI agent CLI")
|
|
82
|
+
.description("Bankr AI agent CLI\n\n Docs: https://docs.bankr.bot\n Skills: https://docs.bankr.bot/openclaw/installation")
|
|
78
83
|
.version(pkg.version, "-v, --version", "Show CLI version")
|
|
79
84
|
.helpOption("-h, --help", "Display help")
|
|
80
85
|
.addHelpCommand("help [command]", "Display help for command")
|
|
@@ -89,6 +94,7 @@ program
|
|
|
89
94
|
setConfigPath(configPath);
|
|
90
95
|
}
|
|
91
96
|
});
|
|
97
|
+
// ── Core commands ───────────────────────────────────────────────────────
|
|
92
98
|
const loginCmd = program
|
|
93
99
|
.command("login")
|
|
94
100
|
.description("Authenticate with the Bankr API")
|
|
@@ -110,8 +116,13 @@ loginCmd
|
|
|
110
116
|
.option("--code <otp>", "OTP code (step 2 of headless login)")
|
|
111
117
|
.option("--accept-terms", "Accept Terms of Service (skips prompt)")
|
|
112
118
|
.option("--key-name <name>", "API key name (default: CLI)")
|
|
113
|
-
.option("--read-write", "
|
|
119
|
+
.option("--read-write", "Disable read-only mode (allow transactions)")
|
|
120
|
+
.option("--no-wallet-api", "Disable Wallet API (enabled by default)")
|
|
121
|
+
.option("--agent-api", "Enable Agent API (AI prompts)")
|
|
122
|
+
.option("--no-token-launch", "Disable Token Launch API (enabled by default)")
|
|
114
123
|
.option("--llm", "Enable LLM gateway on the API key")
|
|
124
|
+
.option("--allowed-ips <ips>", "Comma-separated IP allowlist (requests from other IPs will be blocked)")
|
|
125
|
+
.option("--allowed-recipients <addresses>", "Comma-separated EVM/Solana addresses (agent will only send funds to these)")
|
|
115
126
|
.action(async (address, opts, cmd) => {
|
|
116
127
|
const parentOpts = cmd.parent.opts();
|
|
117
128
|
await loginCommand({
|
|
@@ -122,7 +133,12 @@ loginCmd
|
|
|
122
133
|
acceptTerms: opts.acceptTerms,
|
|
123
134
|
keyName: opts.keyName,
|
|
124
135
|
readWrite: opts.readWrite,
|
|
136
|
+
walletApi: opts.walletApi,
|
|
137
|
+
agentApi: opts.agentApi,
|
|
138
|
+
tokenLaunch: opts.tokenLaunch,
|
|
125
139
|
llm: opts.llm,
|
|
140
|
+
allowedIps: opts.allowedIps,
|
|
141
|
+
allowedRecipients: opts.allowedRecipients,
|
|
126
142
|
});
|
|
127
143
|
});
|
|
128
144
|
loginCmd
|
|
@@ -131,7 +147,12 @@ loginCmd
|
|
|
131
147
|
.requiredOption("--private-key <key>", "Ethereum private key (0x...)")
|
|
132
148
|
.option("--partner-key <key>", "Partner API key for fee attribution")
|
|
133
149
|
.option("--key-name <name>", "API key name (default: SIWE-<date>)")
|
|
134
|
-
.option("--read-write", "
|
|
150
|
+
.option("--read-write", "Disable read-only mode (allow transactions)")
|
|
151
|
+
.option("--no-wallet-api", "Disable Wallet API (enabled by default)")
|
|
152
|
+
.option("--agent-api", "Enable Agent API (AI prompts)")
|
|
153
|
+
.option("--no-token-launch", "Disable Token Launch API (enabled by default)")
|
|
154
|
+
.option("--allowed-ips <ips>", "Comma-separated IP allowlist (requests from other IPs will be blocked)")
|
|
155
|
+
.option("--allowed-recipients <addresses>", "Comma-separated EVM/Solana addresses (agent will only send funds to these)")
|
|
135
156
|
.action(async (opts, cmd) => {
|
|
136
157
|
const parentOpts = cmd.parent.opts();
|
|
137
158
|
await loginCommand({
|
|
@@ -141,25 +162,126 @@ loginCmd
|
|
|
141
162
|
partnerKey: opts.partnerKey,
|
|
142
163
|
keyName: opts.keyName,
|
|
143
164
|
readWrite: opts.readWrite,
|
|
165
|
+
walletApi: opts.walletApi,
|
|
166
|
+
agentApi: opts.agentApi,
|
|
167
|
+
tokenLaunch: opts.tokenLaunch,
|
|
168
|
+
allowedIps: opts.allowedIps,
|
|
169
|
+
allowedRecipients: opts.allowedRecipients,
|
|
144
170
|
});
|
|
145
171
|
});
|
|
146
|
-
program
|
|
147
|
-
.command("logout")
|
|
148
|
-
.description("Clear stored credentials")
|
|
149
|
-
.action(logoutCommand);
|
|
150
172
|
program
|
|
151
173
|
.command("whoami")
|
|
152
|
-
.description("Show
|
|
174
|
+
.description("Show wallet info and account details")
|
|
153
175
|
.action(whoamiCommand);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
.
|
|
157
|
-
.
|
|
176
|
+
// Wallet commands (non-agentic operations)
|
|
177
|
+
const walletCmd = program
|
|
178
|
+
.command("wallet")
|
|
179
|
+
.description("Wallet info, portfolio, transfer, sign, and submit")
|
|
180
|
+
.action(async () => {
|
|
181
|
+
await whoamiCommand();
|
|
182
|
+
});
|
|
183
|
+
walletCmd
|
|
184
|
+
.command("portfolio")
|
|
185
|
+
.description("Show wallet portfolio: balances, PnL, and NFTs")
|
|
186
|
+
.option("--chain <chains>", "Chain(s): base, polygon, mainnet, unichain, solana (comma-separated)")
|
|
187
|
+
.option("--pnl", "Include profit/loss per token")
|
|
188
|
+
.option("--nfts", "Include NFT holdings")
|
|
189
|
+
.option("--all", "Include everything (pnl + nfts)")
|
|
158
190
|
.option("--json", "Output raw JSON")
|
|
191
|
+
.option("--low-value", "Include low-value tokens (under $1)")
|
|
159
192
|
.action(async (opts) => {
|
|
160
|
-
await
|
|
193
|
+
await portfolioCommand(opts);
|
|
161
194
|
});
|
|
162
|
-
|
|
195
|
+
walletCmd
|
|
196
|
+
.command("transfer")
|
|
197
|
+
.description("Transfer tokens to an EVM address")
|
|
198
|
+
.requiredOption("--to <address>", "Recipient address")
|
|
199
|
+
.requiredOption("--amount <amount>", "Amount to send (human-readable)")
|
|
200
|
+
.option("--token <symbol or address>", "Token symbol (USDC) or contract address")
|
|
201
|
+
.option("--native", "Send native token (ETH, POL) instead of ERC20")
|
|
202
|
+
.option("--chain <chain>", "EVM chain: base, polygon, mainnet, unichain (default: base)")
|
|
203
|
+
.action(async (opts) => {
|
|
204
|
+
await transferCommand({
|
|
205
|
+
to: opts.to,
|
|
206
|
+
amount: opts.amount,
|
|
207
|
+
token: opts.token,
|
|
208
|
+
native: opts.native,
|
|
209
|
+
chain: opts.chain,
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
walletCmd
|
|
213
|
+
.command("sign")
|
|
214
|
+
.description("Sign messages, typed data, or transactions")
|
|
215
|
+
.requiredOption("-t, --type <type>", "Signature type: personal_sign, eth_signTypedData_v4, eth_signTransaction")
|
|
216
|
+
.option("-m, --message <message>", "Message to sign (for personal_sign)")
|
|
217
|
+
.option("--typed-data <json>", "EIP-712 typed data as JSON (for eth_signTypedData_v4)")
|
|
218
|
+
.option("--transaction <json>", "Transaction as JSON (for eth_signTransaction)")
|
|
219
|
+
.action(async (opts) => {
|
|
220
|
+
await signCommand({
|
|
221
|
+
type: opts.type,
|
|
222
|
+
message: opts.message,
|
|
223
|
+
typedData: opts.typedData,
|
|
224
|
+
transaction: opts.transaction,
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
const walletSubmitCmd = walletCmd
|
|
228
|
+
.command("submit")
|
|
229
|
+
.description("Submit a transaction to the blockchain");
|
|
230
|
+
walletSubmitCmd
|
|
231
|
+
.command("tx")
|
|
232
|
+
.description("Submit transaction with explicit parameters")
|
|
233
|
+
.requiredOption("--to <address>", "Destination address")
|
|
234
|
+
.requiredOption("--chain-id <id>", "Chain ID (8453=Base, 1=Ethereum, 137=Polygon)")
|
|
235
|
+
.option("--value <wei>", "Value in wei")
|
|
236
|
+
.option("--data <hex>", "Calldata (hex string)")
|
|
237
|
+
.option("--gas <limit>", "Gas limit")
|
|
238
|
+
.option("--gas-price <wei>", "Gas price (legacy)")
|
|
239
|
+
.option("--max-fee-per-gas <wei>", "Max fee per gas (EIP-1559)")
|
|
240
|
+
.option("--max-priority-fee-per-gas <wei>", "Max priority fee (EIP-1559)")
|
|
241
|
+
.option("--nonce <n>", "Transaction nonce")
|
|
242
|
+
.option("-d, --description <text>", "Description for logging")
|
|
243
|
+
.option("--no-wait", "Don't wait for confirmation")
|
|
244
|
+
.action(async (opts) => {
|
|
245
|
+
await submitCommand({
|
|
246
|
+
to: opts.to,
|
|
247
|
+
chainId: opts.chainId,
|
|
248
|
+
value: opts.value,
|
|
249
|
+
data: opts.data,
|
|
250
|
+
gas: opts.gas,
|
|
251
|
+
gasPrice: opts.gasPrice,
|
|
252
|
+
maxFeePerGas: opts.maxFeePerGas,
|
|
253
|
+
maxPriorityFeePerGas: opts.maxPriorityFeePerGas,
|
|
254
|
+
nonce: opts.nonce,
|
|
255
|
+
description: opts.description,
|
|
256
|
+
noWait: !opts.wait,
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
walletSubmitCmd
|
|
260
|
+
.command("json <transaction>")
|
|
261
|
+
.description("Submit transaction from JSON: {to, chainId, value?, data?}")
|
|
262
|
+
.option("-d, --description <text>", "Description for logging")
|
|
263
|
+
.option("--no-wait", "Don't wait for confirmation")
|
|
264
|
+
.action(async (transaction, opts) => {
|
|
265
|
+
await submitJsonCommand(transaction, {
|
|
266
|
+
noWait: !opts.wait,
|
|
267
|
+
description: opts.description,
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
// Agent commands (agentic operations that use LLM)
|
|
271
|
+
const agentCmd = program
|
|
272
|
+
.command("agent [text...]")
|
|
273
|
+
.description("AI agent commands (prompt, status, cancel, profile, skills)")
|
|
274
|
+
.option("--thread <id>", "Continue a specific conversation thread")
|
|
275
|
+
.option("-c, --continue", "Continue the most recent thread")
|
|
276
|
+
.action(async (text, opts) => {
|
|
277
|
+
const joined = text.join(" ").trim();
|
|
278
|
+
if (!joined) {
|
|
279
|
+
agentCmd.help();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
await promptCommand(joined || (await readPromptInput()), opts);
|
|
283
|
+
});
|
|
284
|
+
agentCmd
|
|
163
285
|
.command("prompt [text...]")
|
|
164
286
|
.description("Send a prompt to the Bankr AI agent")
|
|
165
287
|
.option("--thread <id>", "Continue a specific conversation thread")
|
|
@@ -168,73 +290,18 @@ program
|
|
|
168
290
|
const joined = text.join(" ").trim();
|
|
169
291
|
await promptCommand(joined || (await readPromptInput()), opts);
|
|
170
292
|
});
|
|
171
|
-
|
|
293
|
+
agentCmd
|
|
172
294
|
.command("status <jobId>")
|
|
173
295
|
.description("Check the status of a job")
|
|
174
296
|
.action(statusCommand);
|
|
175
|
-
|
|
297
|
+
agentCmd
|
|
176
298
|
.command("cancel <jobId>")
|
|
177
299
|
.description("Cancel a running job")
|
|
178
300
|
.action(cancelCommand);
|
|
179
|
-
|
|
180
|
-
.command("config")
|
|
181
|
-
.description("Manage CLI configuration");
|
|
182
|
-
configCmd
|
|
183
|
-
.command("get [key]")
|
|
184
|
-
.description("Get config value(s). Keys: apiKey, apiUrl, llmKey, llmUrl")
|
|
185
|
-
.action(configGetCommand);
|
|
186
|
-
configCmd
|
|
187
|
-
.command("set <key> <value>")
|
|
188
|
-
.description("Set a config value. Keys: apiKey, apiUrl, llmKey, llmUrl")
|
|
189
|
-
.action(configSetCommand);
|
|
190
|
-
program
|
|
301
|
+
agentCmd
|
|
191
302
|
.command("skills")
|
|
192
303
|
.description("Show all Bankr AI agent skills with examples")
|
|
193
304
|
.action(skillsCommand);
|
|
194
|
-
const soundsCmd = program
|
|
195
|
-
.command("sounds")
|
|
196
|
-
.description("Manage CESP sound packs")
|
|
197
|
-
.action(soundsStatusCommand);
|
|
198
|
-
soundsCmd
|
|
199
|
-
.command("enable")
|
|
200
|
-
.description("Enable sounds")
|
|
201
|
-
.action(soundsEnableCommand);
|
|
202
|
-
soundsCmd
|
|
203
|
-
.command("disable")
|
|
204
|
-
.description("Disable sounds")
|
|
205
|
-
.action(soundsDisableCommand);
|
|
206
|
-
soundsCmd
|
|
207
|
-
.command("install <pack>")
|
|
208
|
-
.description("Install a sound pack from the CESP registry")
|
|
209
|
-
.action(soundsInstallCommand);
|
|
210
|
-
soundsCmd
|
|
211
|
-
.command("search [query]")
|
|
212
|
-
.description("Search available packs in the CESP registry")
|
|
213
|
-
.action(soundsSearchCommand);
|
|
214
|
-
soundsCmd
|
|
215
|
-
.command("list")
|
|
216
|
-
.description("List installed sound packs")
|
|
217
|
-
.action(soundsListCommand);
|
|
218
|
-
soundsCmd
|
|
219
|
-
.command("use <pack>")
|
|
220
|
-
.description("Set active sound pack")
|
|
221
|
-
.action(soundsUseCommand);
|
|
222
|
-
soundsCmd
|
|
223
|
-
.command("volume [level]")
|
|
224
|
-
.description("Get or set volume (0.0-1.0)")
|
|
225
|
-
.action(soundsVolumeCommand);
|
|
226
|
-
soundsCmd
|
|
227
|
-
.command("mute")
|
|
228
|
-
.description("Mute all sounds")
|
|
229
|
-
.action(soundsMuteCommand);
|
|
230
|
-
soundsCmd
|
|
231
|
-
.command("unmute")
|
|
232
|
-
.description("Unmute sounds")
|
|
233
|
-
.action(soundsUnmuteCommand);
|
|
234
|
-
soundsCmd
|
|
235
|
-
.command("test [category]")
|
|
236
|
-
.description("Play a test sound")
|
|
237
|
-
.action(soundsTestCommand);
|
|
238
305
|
program
|
|
239
306
|
.command("launch")
|
|
240
307
|
.description("Launch a token on Base (interactive wizard)")
|
|
@@ -280,7 +347,8 @@ feesCmd
|
|
|
280
347
|
.option("--all", "Claim all tokens without selection prompt")
|
|
281
348
|
.option("-y, --yes", "Skip confirmation prompt")
|
|
282
349
|
.action(feesClaimWalletCommand);
|
|
283
|
-
|
|
350
|
+
// Profile under agent namespace
|
|
351
|
+
const profileCmd = agentCmd
|
|
284
352
|
.command("profile")
|
|
285
353
|
.description("Manage your agent profile page")
|
|
286
354
|
.option("--json", "Output raw JSON")
|
|
@@ -342,64 +410,6 @@ profileCmd
|
|
|
342
410
|
json: opts.json,
|
|
343
411
|
});
|
|
344
412
|
});
|
|
345
|
-
program
|
|
346
|
-
.command("sign")
|
|
347
|
-
.description("Sign messages, typed data, or transactions")
|
|
348
|
-
.requiredOption("-t, --type <type>", "Signature type: personal_sign, eth_signTypedData_v4, eth_signTransaction")
|
|
349
|
-
.option("-m, --message <message>", "Message to sign (for personal_sign)")
|
|
350
|
-
.option("--typed-data <json>", "EIP-712 typed data as JSON (for eth_signTypedData_v4)")
|
|
351
|
-
.option("--transaction <json>", "Transaction as JSON (for eth_signTransaction)")
|
|
352
|
-
.action(async (opts) => {
|
|
353
|
-
await signCommand({
|
|
354
|
-
type: opts.type,
|
|
355
|
-
message: opts.message,
|
|
356
|
-
typedData: opts.typedData,
|
|
357
|
-
transaction: opts.transaction,
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
const submitCmd = program
|
|
361
|
-
.command("submit")
|
|
362
|
-
.description("Submit a transaction to the blockchain");
|
|
363
|
-
submitCmd
|
|
364
|
-
.command("tx")
|
|
365
|
-
.description("Submit transaction with explicit parameters")
|
|
366
|
-
.requiredOption("--to <address>", "Destination address")
|
|
367
|
-
.requiredOption("--chain-id <id>", "Chain ID (8453=Base, 1=Ethereum, 137=Polygon)")
|
|
368
|
-
.option("--value <wei>", "Value in wei")
|
|
369
|
-
.option("--data <hex>", "Calldata (hex string)")
|
|
370
|
-
.option("--gas <limit>", "Gas limit")
|
|
371
|
-
.option("--gas-price <wei>", "Gas price (legacy)")
|
|
372
|
-
.option("--max-fee-per-gas <wei>", "Max fee per gas (EIP-1559)")
|
|
373
|
-
.option("--max-priority-fee-per-gas <wei>", "Max priority fee (EIP-1559)")
|
|
374
|
-
.option("--nonce <n>", "Transaction nonce")
|
|
375
|
-
.option("-d, --description <text>", "Description for logging")
|
|
376
|
-
.option("--no-wait", "Don't wait for confirmation")
|
|
377
|
-
.action(async (opts) => {
|
|
378
|
-
await submitCommand({
|
|
379
|
-
to: opts.to,
|
|
380
|
-
chainId: opts.chainId,
|
|
381
|
-
value: opts.value,
|
|
382
|
-
data: opts.data,
|
|
383
|
-
gas: opts.gas,
|
|
384
|
-
gasPrice: opts.gasPrice,
|
|
385
|
-
maxFeePerGas: opts.maxFeePerGas,
|
|
386
|
-
maxPriorityFeePerGas: opts.maxPriorityFeePerGas,
|
|
387
|
-
nonce: opts.nonce,
|
|
388
|
-
description: opts.description,
|
|
389
|
-
noWait: !opts.wait,
|
|
390
|
-
});
|
|
391
|
-
});
|
|
392
|
-
submitCmd
|
|
393
|
-
.command("json <transaction>")
|
|
394
|
-
.description("Submit transaction from JSON: {to, chainId, value?, data?}")
|
|
395
|
-
.option("-d, --description <text>", "Description for logging")
|
|
396
|
-
.option("--no-wait", "Don't wait for confirmation")
|
|
397
|
-
.action(async (transaction, opts) => {
|
|
398
|
-
await submitJsonCommand(transaction, {
|
|
399
|
-
noWait: !opts.wait,
|
|
400
|
-
description: opts.description,
|
|
401
|
-
});
|
|
402
|
-
});
|
|
403
413
|
const llmCmd = program
|
|
404
414
|
.command("llm")
|
|
405
415
|
.description("LLM Gateway tools")
|
|
@@ -470,13 +480,309 @@ llmCmd
|
|
|
470
480
|
const args = idx >= 0 ? process.argv.slice(idx + 1) : [];
|
|
471
481
|
await opencodeCommand(args);
|
|
472
482
|
});
|
|
483
|
+
// Token search and info
|
|
484
|
+
const tokensCmd = program
|
|
485
|
+
.command("tokens")
|
|
486
|
+
.description("Token search and info")
|
|
487
|
+
.action(() => {
|
|
488
|
+
tokensCmd.help();
|
|
489
|
+
});
|
|
490
|
+
tokensCmd
|
|
491
|
+
.command("search <query>")
|
|
492
|
+
.description("Search tokens by name, symbol, or address")
|
|
493
|
+
.option("--chain <chainId>", "Chain ID (default: 8453 for Base)")
|
|
494
|
+
.action(async (query, opts) => {
|
|
495
|
+
await tokensSearchCommand(query, opts);
|
|
496
|
+
});
|
|
497
|
+
tokensCmd
|
|
498
|
+
.command("info <address>")
|
|
499
|
+
.description("Get detailed token info by contract address")
|
|
500
|
+
.option("--chain <chainId>", "Chain ID (default: 8453 for Base)")
|
|
501
|
+
.action(async (address, opts) => {
|
|
502
|
+
await tokensInfoCommand(address, opts);
|
|
503
|
+
});
|
|
504
|
+
// ── Utility commands ────────────────────────────────────────────────────
|
|
505
|
+
const configCmd = program
|
|
506
|
+
.command("config")
|
|
507
|
+
.description("Manage CLI configuration");
|
|
508
|
+
configCmd
|
|
509
|
+
.command("get [key]")
|
|
510
|
+
.description("Get config value(s). Keys: apiKey, apiUrl, llmKey, llmUrl")
|
|
511
|
+
.action(configGetCommand);
|
|
512
|
+
configCmd
|
|
513
|
+
.command("set <key> <value>")
|
|
514
|
+
.description("Set a config value. Keys: apiKey, apiUrl, llmKey, llmUrl")
|
|
515
|
+
.action(configSetCommand);
|
|
516
|
+
const soundsCmd = program
|
|
517
|
+
.command("sounds")
|
|
518
|
+
.description("Manage CESP sound packs")
|
|
519
|
+
.action(soundsStatusCommand);
|
|
520
|
+
soundsCmd
|
|
521
|
+
.command("enable")
|
|
522
|
+
.description("Enable sounds")
|
|
523
|
+
.action(soundsEnableCommand);
|
|
524
|
+
soundsCmd
|
|
525
|
+
.command("disable")
|
|
526
|
+
.description("Disable sounds")
|
|
527
|
+
.action(soundsDisableCommand);
|
|
528
|
+
soundsCmd
|
|
529
|
+
.command("install <pack>")
|
|
530
|
+
.description("Install a sound pack from the CESP registry")
|
|
531
|
+
.action(soundsInstallCommand);
|
|
532
|
+
soundsCmd
|
|
533
|
+
.command("search [query]")
|
|
534
|
+
.description("Search available packs in the CESP registry")
|
|
535
|
+
.action(soundsSearchCommand);
|
|
536
|
+
soundsCmd
|
|
537
|
+
.command("list")
|
|
538
|
+
.description("List installed sound packs")
|
|
539
|
+
.action(soundsListCommand);
|
|
540
|
+
soundsCmd
|
|
541
|
+
.command("use <pack>")
|
|
542
|
+
.description("Set active sound pack")
|
|
543
|
+
.action(soundsUseCommand);
|
|
544
|
+
soundsCmd
|
|
545
|
+
.command("volume [level]")
|
|
546
|
+
.description("Get or set volume (0.0-1.0)")
|
|
547
|
+
.action(soundsVolumeCommand);
|
|
548
|
+
soundsCmd
|
|
549
|
+
.command("mute")
|
|
550
|
+
.description("Mute all sounds")
|
|
551
|
+
.action(soundsMuteCommand);
|
|
552
|
+
soundsCmd
|
|
553
|
+
.command("unmute")
|
|
554
|
+
.description("Unmute sounds")
|
|
555
|
+
.action(soundsUnmuteCommand);
|
|
556
|
+
soundsCmd
|
|
557
|
+
.command("test [category]")
|
|
558
|
+
.description("Play a test sound")
|
|
559
|
+
.action(soundsTestCommand);
|
|
560
|
+
program
|
|
561
|
+
.command("logout")
|
|
562
|
+
.description("Clear stored credentials")
|
|
563
|
+
.action(logoutCommand);
|
|
564
|
+
// ── Deprecated aliases (kept for backward compat) ──────────────────────
|
|
565
|
+
program
|
|
566
|
+
.command("balances")
|
|
567
|
+
.description("Deprecated: use `bankr wallet portfolio` instead")
|
|
568
|
+
.option("--chain <chains>", "Chain(s) to fetch (comma-separated)")
|
|
569
|
+
.option("--json", "Output raw JSON")
|
|
570
|
+
.option("--low-value", "Include low-value tokens (under $1)")
|
|
571
|
+
.action(async (opts) => {
|
|
572
|
+
await balancesCommand({
|
|
573
|
+
chain: opts.chain,
|
|
574
|
+
json: opts.json,
|
|
575
|
+
showLowValueTokens: opts.lowValue,
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
program
|
|
579
|
+
.command("prompt [text...]")
|
|
580
|
+
.description("Deprecated: use `bankr agent <prompt>` instead")
|
|
581
|
+
.option("--thread <id>")
|
|
582
|
+
.option("-c, --continue")
|
|
583
|
+
.action(async (text, opts) => {
|
|
584
|
+
const joined = text.join(" ").trim();
|
|
585
|
+
await promptCommand(joined || (await readPromptInput()), opts);
|
|
586
|
+
});
|
|
587
|
+
program
|
|
588
|
+
.command("status <jobId>")
|
|
589
|
+
.description("Deprecated: use `bankr agent status` instead")
|
|
590
|
+
.action(statusCommand);
|
|
591
|
+
program
|
|
592
|
+
.command("cancel <jobId>")
|
|
593
|
+
.description("Deprecated: use `bankr agent cancel` instead")
|
|
594
|
+
.action(cancelCommand);
|
|
595
|
+
const profileAliasCmd = program
|
|
596
|
+
.command("profile")
|
|
597
|
+
.description("Deprecated: use `bankr agent profile` instead")
|
|
598
|
+
.option("--json", "Output raw JSON")
|
|
599
|
+
.action(async (opts) => {
|
|
600
|
+
await profileViewCommand({ json: opts.json });
|
|
601
|
+
});
|
|
602
|
+
profileAliasCmd
|
|
603
|
+
.command("create")
|
|
604
|
+
.option("--name <name>", "Project name")
|
|
605
|
+
.option("--description <text>", "Project description")
|
|
606
|
+
.option("--token <address>", "Token contract address")
|
|
607
|
+
.option("--image <url>", "Profile image URL")
|
|
608
|
+
.option("--website <url>", "Project website URL")
|
|
609
|
+
.option("--json", "Output raw JSON")
|
|
610
|
+
.action(async (opts) => {
|
|
611
|
+
await profileCreateCommand({
|
|
612
|
+
name: opts.name,
|
|
613
|
+
description: opts.description,
|
|
614
|
+
token: opts.token,
|
|
615
|
+
image: opts.image,
|
|
616
|
+
website: opts.website,
|
|
617
|
+
json: opts.json,
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
profileAliasCmd
|
|
621
|
+
.command("update")
|
|
622
|
+
.option("--name <name>", "Project name")
|
|
623
|
+
.option("--description <text>", "Project description")
|
|
624
|
+
.option("--token <address>", "Token contract address")
|
|
625
|
+
.option("--image <url>", "Profile image URL")
|
|
626
|
+
.option("--website <url>", "Project website URL")
|
|
627
|
+
.option("--json", "Output raw JSON")
|
|
628
|
+
.action(async (opts) => {
|
|
629
|
+
await profileUpdateCommand({
|
|
630
|
+
name: opts.name,
|
|
631
|
+
description: opts.description,
|
|
632
|
+
token: opts.token,
|
|
633
|
+
image: opts.image,
|
|
634
|
+
website: opts.website,
|
|
635
|
+
json: opts.json,
|
|
636
|
+
});
|
|
637
|
+
});
|
|
638
|
+
profileAliasCmd.command("delete").action(profileDeleteCommand);
|
|
639
|
+
profileAliasCmd
|
|
640
|
+
.command("add-update")
|
|
641
|
+
.option("--title <title>", "Update title")
|
|
642
|
+
.option("--content <text>", "Update content")
|
|
643
|
+
.option("--json", "Output raw JSON")
|
|
644
|
+
.action(async (opts) => {
|
|
645
|
+
await profileAddUpdateCommand({
|
|
646
|
+
title: opts.title,
|
|
647
|
+
content: opts.content,
|
|
648
|
+
json: opts.json,
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
program
|
|
652
|
+
.command("sign")
|
|
653
|
+
.description("Deprecated: use `bankr wallet sign` instead")
|
|
654
|
+
.requiredOption("-t, --type <type>", "Signature type")
|
|
655
|
+
.option("-m, --message <message>", "Message to sign")
|
|
656
|
+
.option("--typed-data <json>", "EIP-712 typed data as JSON")
|
|
657
|
+
.option("--transaction <json>", "Transaction as JSON")
|
|
658
|
+
.action(async (opts) => {
|
|
659
|
+
await signCommand({
|
|
660
|
+
type: opts.type,
|
|
661
|
+
message: opts.message,
|
|
662
|
+
typedData: opts.typedData,
|
|
663
|
+
transaction: opts.transaction,
|
|
664
|
+
});
|
|
665
|
+
});
|
|
666
|
+
const submitAliasCmd = program
|
|
667
|
+
.command("submit")
|
|
668
|
+
.description("Deprecated: use `bankr wallet submit` instead");
|
|
669
|
+
submitAliasCmd
|
|
670
|
+
.command("tx")
|
|
671
|
+
.description("Submit transaction with explicit parameters")
|
|
672
|
+
.requiredOption("--to <address>", "Destination address")
|
|
673
|
+
.requiredOption("--chain-id <id>", "Chain ID")
|
|
674
|
+
.option("--value <wei>", "Value in wei")
|
|
675
|
+
.option("--data <hex>", "Calldata")
|
|
676
|
+
.option("--gas <limit>", "Gas limit")
|
|
677
|
+
.option("--gas-price <wei>", "Gas price")
|
|
678
|
+
.option("--max-fee-per-gas <wei>", "Max fee per gas")
|
|
679
|
+
.option("--max-priority-fee-per-gas <wei>", "Max priority fee")
|
|
680
|
+
.option("--nonce <n>", "Transaction nonce")
|
|
681
|
+
.option("-d, --description <text>", "Description")
|
|
682
|
+
.option("--no-wait", "Don't wait for confirmation")
|
|
683
|
+
.action(async (opts) => {
|
|
684
|
+
await submitCommand({
|
|
685
|
+
to: opts.to,
|
|
686
|
+
chainId: opts.chainId,
|
|
687
|
+
value: opts.value,
|
|
688
|
+
data: opts.data,
|
|
689
|
+
gas: opts.gas,
|
|
690
|
+
gasPrice: opts.gasPrice,
|
|
691
|
+
maxFeePerGas: opts.maxFeePerGas,
|
|
692
|
+
maxPriorityFeePerGas: opts.maxPriorityFeePerGas,
|
|
693
|
+
nonce: opts.nonce,
|
|
694
|
+
description: opts.description,
|
|
695
|
+
noWait: !opts.wait,
|
|
696
|
+
});
|
|
697
|
+
});
|
|
698
|
+
submitAliasCmd
|
|
699
|
+
.command("json <transaction>")
|
|
700
|
+
.description("Submit from JSON")
|
|
701
|
+
.option("-d, --description <text>", "Description")
|
|
702
|
+
.option("--no-wait", "Don't wait for confirmation")
|
|
703
|
+
.action(async (transaction, opts) => {
|
|
704
|
+
await submitJsonCommand(transaction, {
|
|
705
|
+
noWait: !opts.wait,
|
|
706
|
+
description: opts.description,
|
|
707
|
+
});
|
|
708
|
+
});
|
|
709
|
+
program
|
|
710
|
+
.command("update")
|
|
711
|
+
.description("Update the Bankr CLI to the latest version")
|
|
712
|
+
.option("--check", "Check for updates without installing")
|
|
713
|
+
.action(async (opts) => {
|
|
714
|
+
await updateCommand({ check: opts.check });
|
|
715
|
+
});
|
|
716
|
+
// ── x402 Endpoint Hosting ─────────────────────────────────────────────
|
|
717
|
+
const x402Cmd = program
|
|
718
|
+
.command("x402")
|
|
719
|
+
.description("Deploy and manage x402 paid API endpoints");
|
|
720
|
+
x402Cmd
|
|
721
|
+
.command("init")
|
|
722
|
+
.description("Scaffold x402/ folder and bankr.x402.json config")
|
|
723
|
+
.action(x402InitCommand);
|
|
724
|
+
x402Cmd
|
|
725
|
+
.command("add <name>")
|
|
726
|
+
.description("Add a new x402 service handler")
|
|
727
|
+
.action(x402AddCommand);
|
|
728
|
+
x402Cmd
|
|
729
|
+
.command("configure <name>")
|
|
730
|
+
.description("Interactively configure pricing and description")
|
|
731
|
+
.action(x402ConfigureCommand);
|
|
732
|
+
x402Cmd
|
|
733
|
+
.command("deploy [name]")
|
|
734
|
+
.description("Bundle and deploy services to Bankr")
|
|
735
|
+
.action(x402DeployCommand);
|
|
736
|
+
x402Cmd
|
|
737
|
+
.command("list")
|
|
738
|
+
.description("List your deployed x402 endpoints")
|
|
739
|
+
.action(x402ListCommand);
|
|
740
|
+
x402Cmd
|
|
741
|
+
.command("pause <name>")
|
|
742
|
+
.description("Pause a deployed endpoint")
|
|
743
|
+
.action(async (name) => x402PauseResumeCommand(name, "pause"));
|
|
744
|
+
x402Cmd
|
|
745
|
+
.command("resume <name>")
|
|
746
|
+
.description("Resume a paused endpoint")
|
|
747
|
+
.action(async (name) => x402PauseResumeCommand(name, "resume"));
|
|
748
|
+
x402Cmd
|
|
749
|
+
.command("delete <name>")
|
|
750
|
+
.description("Delete a deployed endpoint")
|
|
751
|
+
.action(x402DeleteCommand);
|
|
752
|
+
x402Cmd
|
|
753
|
+
.command("revenue [name]")
|
|
754
|
+
.description("View endpoint earnings breakdown")
|
|
755
|
+
.action(x402RevenueCommand);
|
|
756
|
+
const x402EnvCmd = x402Cmd
|
|
757
|
+
.command("env")
|
|
758
|
+
.description("Manage encrypted environment variables");
|
|
759
|
+
x402EnvCmd
|
|
760
|
+
.command("set <keyValue>")
|
|
761
|
+
.description("Set an env var (KEY=VALUE)")
|
|
762
|
+
.action(x402EnvSetCommand);
|
|
763
|
+
x402EnvCmd
|
|
764
|
+
.command("list")
|
|
765
|
+
.description("List env var names")
|
|
766
|
+
.action(x402EnvListCommand);
|
|
767
|
+
x402EnvCmd
|
|
768
|
+
.command("unset <key>")
|
|
769
|
+
.description("Remove an env var")
|
|
770
|
+
.action(x402EnvUnsetCommand);
|
|
771
|
+
x402Cmd
|
|
772
|
+
.command("search [query...]")
|
|
773
|
+
.description("Search the x402 service marketplace (no auth required)")
|
|
774
|
+
.action(async (query) => x402SearchCommand(query));
|
|
473
775
|
// Default: treat unrecognized arguments as a prompt
|
|
474
|
-
program
|
|
776
|
+
program
|
|
777
|
+
.arguments("[text...]")
|
|
778
|
+
.option("--thread <id>", "Continue a specific conversation thread")
|
|
779
|
+
.option("-c, --continue", "Continue the most recent thread")
|
|
780
|
+
.action(async (text, opts) => {
|
|
475
781
|
if (text.length === 0) {
|
|
476
782
|
program.help();
|
|
477
783
|
return;
|
|
478
784
|
}
|
|
479
|
-
await promptCommand(text.join(" "));
|
|
785
|
+
await promptCommand(text.join(" "), opts);
|
|
480
786
|
});
|
|
481
787
|
async function main() {
|
|
482
788
|
try {
|