@bankr/cli 0.3.35 → 0.3.37

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/README.md CHANGED
@@ -94,9 +94,11 @@ bankr launch --name "TESTCOIN" --image "https://example.com/img.png" \
94
94
  # Quick launch (name only, skip confirmation)
95
95
  bankr launch --name "TESTCOIN" -y
96
96
 
97
- # Pair the pool with a tokenized stock instead of WETH (Robinhood Chain or Base)
97
+ # Pair the pool with a tokenized stock or another listed quote token instead of WETH (Robinhood Chain or Base)
98
98
  bankr launch quotes --chain robinhood # list the quote tokens you can pair with
99
99
  bankr launch --name "TESTCOIN" --chain robinhood --quote TSLA -y
100
+ bankr launch --name "TESTCOIN" --chain robinhood --quote musebook -y
101
+ bankr launch --name "TESTCOIN" --chain robinhood --quote BNKR -y # the Robinhood Chain BNKR contract
100
102
 
101
103
  # Fee recipient types: x, farcaster, ens, wallet
102
104
  bankr launch --name "TESTCOIN" --fee "vitalik.eth" --fee-type ens -y
package/dist/cli.js CHANGED
@@ -126,8 +126,10 @@ loginCmd
126
126
  .option("--accept-terms", "Accept Terms of Service (skips prompt)")
127
127
  .option("--key-name <name>", "API key name (default: CLI)")
128
128
  .optionsGroup("API Permissions")
129
- .option("--read-write", "Disable read-only mode (allow transactions)")
129
+ .option("--read-only", "Restrict the API key to read operations")
130
+ .option("--read-write", "Allow transactions (the default for new keys)")
130
131
  .option("--no-wallet-api", "Disable Wallet API (enabled by default)")
132
+ .option("--no-agent-api", "Disable Agent API (enabled by default)")
131
133
  .option("--no-token-launch", "Disable Token Launch API (enabled by default)")
132
134
  .option("--llm", "Enable LLM gateway on the API key")
133
135
  .optionsGroup("Security")
@@ -142,8 +144,10 @@ loginCmd
142
144
  code: opts.code,
143
145
  acceptTerms: opts.acceptTerms,
144
146
  keyName: opts.keyName,
147
+ readOnly: opts.readOnly,
145
148
  readWrite: opts.readWrite,
146
149
  walletApi: opts.walletApi,
150
+ agentApi: opts.agentApi,
147
151
  tokenLaunch: opts.tokenLaunch,
148
152
  llm: opts.llm,
149
153
  allowedIps: opts.allowedIps,
@@ -158,6 +162,7 @@ loginCmd
158
162
  .optionsGroup("API Permissions")
159
163
  .option("--read-write", "Disable read-only mode (allow transactions)")
160
164
  .option("--no-wallet-api", "Disable Wallet API (enabled by default)")
165
+ .option("--no-agent-api", "Disable Agent API (enabled by default)")
161
166
  .option("--no-token-launch", "Disable Token Launch API (enabled by default)")
162
167
  .optionsGroup("Security")
163
168
  .option("--allowed-ips <ips>", "Comma-separated IP/CIDR allowlist, e.g. 1.2.3.4,10.0.0.0/24")
@@ -171,6 +176,7 @@ loginCmd
171
176
  keyName: opts.keyName,
172
177
  readWrite: opts.readWrite,
173
178
  walletApi: opts.walletApi,
179
+ agentApi: opts.agentApi,
174
180
  tokenLaunch: opts.tokenLaunch,
175
181
  allowedIps: opts.allowedIps,
176
182
  allowedRecipients: opts.allowedRecipients,
@@ -869,10 +869,10 @@ export async function modelsCommand(opts = {}) {
869
869
  output.dim(` Gateway: ${getLlmUrl()}`);
870
870
  output.dim(` ${shown.length} model${shown.length === 1 ? "" : "s"}${view?.countSuffix ?? " available"}${live ? "" : " (cached)"}`);
871
871
  if (!view && shown.some((m) => m.private)) {
872
- output.dim(" Private (TEE) — append :private to the model id (e.g. glm-5.2:private). List: bankr llm models --private");
872
+ output.dim(" Private (TEE) — append :private to the model id (e.g. glm-5.3-flash:private). List: bankr llm models --private");
873
873
  }
874
874
  if (!view && shown.some((m) => m.zdr)) {
875
- output.dim(" Zero data retention — append :zdr to the model id (e.g. glm-5.2:zdr), or turn it on account-wide under Settings in the web terminal. List: bankr llm models --zdr");
875
+ output.dim(" Zero data retention — append :zdr to the model id (e.g. glm-5.3-flash:zdr), or turn it on account-wide under Settings in the web terminal. List: bankr llm models --zdr");
876
876
  }
877
877
  }
878
878
  /* ─────────────────────── bankr llm credits ─────────────────────────────────── */
@@ -11,6 +11,19 @@ interface CliAuthTokens {
11
11
  /** The auth headers every authenticated CLI call sends — one place, so a new
12
12
  * endpoint can't silently omit the access token and go unrevocable again. */
13
13
  export declare function authHeaders(tokens: CliAuthTokens): Record<string, string>;
14
+ /**
15
+ * Maps the permission opt-out flags to the create-key body. Omitted fields
16
+ * are dropped by JSON.stringify so the server's API_KEY_CREATE_DEFAULTS
17
+ * decide them; only an explicit flag sends a value.
18
+ */
19
+ export declare function resolveKeyPermissionOverrides(opts: {
20
+ readOnly?: boolean;
21
+ readWrite?: boolean;
22
+ agentApi?: boolean;
23
+ }): {
24
+ readOnly?: boolean;
25
+ agentApiEnabled?: boolean;
26
+ };
14
27
  export declare function loginCommand(opts: {
15
28
  apiUrl?: string;
16
29
  apiKey?: string;
@@ -18,8 +31,10 @@ export declare function loginCommand(opts: {
18
31
  code?: string;
19
32
  acceptTerms?: boolean;
20
33
  keyName?: string;
34
+ readOnly?: boolean;
21
35
  readWrite?: boolean;
22
36
  walletApi?: boolean;
37
+ agentApi?: boolean;
23
38
  tokenLaunch?: boolean;
24
39
  llm?: boolean;
25
40
  llmKey?: string;
@@ -52,6 +52,26 @@ export function authHeaders(tokens) {
52
52
  "x-access-token": tokens.accessToken,
53
53
  };
54
54
  }
55
+ /**
56
+ * Maps the permission opt-out flags to the create-key body. Omitted fields
57
+ * are dropped by JSON.stringify so the server's API_KEY_CREATE_DEFAULTS
58
+ * decide them; only an explicit flag sends a value.
59
+ */
60
+ export function resolveKeyPermissionOverrides(opts) {
61
+ if (opts.readOnly && opts.readWrite) {
62
+ throw new Error("--read-only and --read-write are mutually exclusive");
63
+ }
64
+ // Build conditionally: an own `undefined` key would clobber a value the
65
+ // caller set before spreading this in.
66
+ const overrides = {};
67
+ if (opts.readOnly)
68
+ overrides.readOnly = true;
69
+ else if (opts.readWrite)
70
+ overrides.readOnly = false;
71
+ if (opts.agentApi === false)
72
+ overrides.agentApiEnabled = false;
73
+ return overrides;
74
+ }
55
75
  async function verifyPrivyOtp(privyConfig, email, code) {
56
76
  const res = await fetch("https://auth.privy.io/api/v1/passwordless/authenticate", {
57
77
  method: "POST",
@@ -266,10 +286,12 @@ async function emailLoginFlow(apiUrl, opts) {
266
286
  validate: (v) => v.trim().length >= 3 ? true : "Name must be at least 3 characters.",
267
287
  }));
268
288
  // Fine-grained API flags. walletApi and tokenLaunch default to enabled.
269
- // --read-write only controls readOnly, not which APIs are enabled.
289
+ // --read-only/--read-write only control readOnly, not which APIs are enabled.
270
290
  const enableWallet = opts.walletApi ?? true;
271
- // Agent API must be enabled from the website (bankr.bot/api-keys), not the CLI.
272
- const enableAgent = false;
291
+ // readOnly and agentApiEnabled are only sent when a flag asks for it, so the
292
+ // server's API_KEY_CREATE_DEFAULTS (the bankr.bot/api-keys form) decide them.
293
+ // The --read-only/--read-write conflict was already rejected in loginCommand.
294
+ const overrides = resolveKeyPermissionOverrides(opts);
273
295
  const enableTokenLaunch = opts.tokenLaunch ?? true;
274
296
  const enableLlm = opts.llm ??
275
297
  (headless
@@ -279,17 +301,13 @@ async function emailLoginFlow(apiUrl, opts) {
279
301
  default: false,
280
302
  theme: output.bankrTheme,
281
303
  }));
282
- if (opts.readWrite && !enableWallet) {
283
- output.warn("--read-write has no effect when Wallet API is disabled");
284
- }
285
304
  const keySpin = output.spinner("Generating API key...");
286
305
  let apiKeyResult;
287
306
  try {
288
307
  apiKeyResult = await callGenerateApiKey(apiUrl, tokens, {
289
308
  name: keyName.trim(),
290
309
  walletApiEnabled: enableWallet,
291
- agentApiEnabled: enableAgent,
292
- readOnly: opts.readWrite ? false : undefined,
310
+ ...overrides,
293
311
  tokenLaunchApiEnabled: enableTokenLaunch,
294
312
  llmGatewayEnabled: enableLlm,
295
313
  allowedIps: opts.allowedIps,
@@ -304,7 +322,7 @@ async function emailLoginFlow(apiUrl, opts) {
304
322
  output.blank();
305
323
  const features = [
306
324
  enableWallet && "Wallet",
307
- enableAgent && "Agent",
325
+ apiKeyResult.agentApiEnabled && "Agent",
308
326
  enableTokenLaunch && "Token Launch",
309
327
  enableLlm && "LLM",
310
328
  ].filter(Boolean);
@@ -321,7 +339,6 @@ async function emailLoginFlow(apiUrl, opts) {
321
339
  ];
322
340
  output.dim(` Recipients: ${parts.join(", ")}`);
323
341
  }
324
- output.dim(" Agent API: enable at bankr.bot/api-keys");
325
342
  output.dim(" Manage keys at bankr.bot/api-keys");
326
343
  return apiKeyResult.apiKey;
327
344
  }
@@ -372,7 +389,7 @@ async function siweLoginFlow(apiUrl, opts) {
372
389
  keyName: opts.keyName ?? `SIWE-${new Date().toISOString().slice(0, 10)}`,
373
390
  readOnly: opts.readOnly ?? false,
374
391
  walletApiEnabled: opts.walletApi ?? true,
375
- agentApiEnabled: false,
392
+ ...resolveKeyPermissionOverrides({ agentApi: opts.agentApi }),
376
393
  tokenLaunchApiEnabled: opts.tokenLaunch ?? true,
377
394
  allowedIps: opts.allowedIps,
378
395
  allowedRecipients: opts.allowedRecipients,
@@ -492,6 +509,11 @@ export async function loginCommand(opts) {
492
509
  if (opts.apiKey !== undefined && !opts.apiKey.trim()) {
493
510
  output.fatal("--api-key requires a non-empty value");
494
511
  }
512
+ // Reject conflicting permission flags before any network call, so a
513
+ // headless step-2 login doesn't burn its one-time code on a usage error.
514
+ if (opts.readOnly && opts.readWrite) {
515
+ output.fatal("--read-only and --read-write are mutually exclusive");
516
+ }
495
517
  // Non-interactive mode requires a headless flag combo. Without one, the
496
518
  // command would hang on a prompt — fail fast with the available paths.
497
519
  // Email step 1 (`login email <addr>` without --code) is also headless:
@@ -569,6 +591,7 @@ export async function loginCommand(opts) {
569
591
  keyName: opts.keyName,
570
592
  readOnly: !opts.readWrite,
571
593
  walletApi: opts.walletApi,
594
+ agentApi: opts.agentApi,
572
595
  tokenLaunch: opts.tokenLaunch,
573
596
  ...getParsedRestrictions(),
574
597
  });
package/dist/lib/api.d.ts CHANGED
@@ -224,7 +224,8 @@ export interface DeployTokenRequest {
224
224
  provider?: LaunchProvider;
225
225
  /** Quote the pool in a tokenized stock (Robinhood Chain / Base, Doppler). */
226
226
  pairedStockAddress?: string;
227
- /** Quote the pool in one of the fixed Base allowlist tokens (Doppler). */
227
+ /** Quote the pool in one of the chain's fixed Doppler allowlist tokens
228
+ * (Base or Robinhood Chain). */
228
229
  pairedTokenAddress?: string;
229
230
  /** Bankr Launch v3 options; `quoteAddress` picks the pool's quote token. */
230
231
  launchV3?: {
@@ -243,7 +244,7 @@ export interface LaunchQuoteTokenOption {
243
244
  deployField: LaunchQuoteTokenDeployField | null;
244
245
  /** Stocks only: advisory thin-pool verdict, null when unmeasured. */
245
246
  illiquid?: boolean | null;
246
- /** Base allowlist only: reviewed-liquidity gate. */
247
+ /** Doppler allowlist tokens only (pairedTokenAddress): reviewed-liquidity gate. */
247
248
  readiness?: "live" | "pending" | "unknown";
248
249
  }
249
250
  export interface LaunchQuoteTokensResponse {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bankr/cli",
3
- "version": "0.3.35",
3
+ "version": "0.3.37",
4
4
  "description": "Official CLI for the Bankr AI agent platform",
5
5
  "type": "module",
6
6
  "bin": {