@bankr/cli 0.3.13 → 0.3.23
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 +28 -10
- package/dist/cli.js +28 -7
- package/dist/commands/balances.js +2 -1
- package/dist/commands/cancel.js +2 -1
- package/dist/commands/fees.js +65 -40
- package/dist/commands/launch.d.ts +4 -0
- package/dist/commands/launch.js +42 -5
- package/dist/commands/llm.d.ts +2 -0
- package/dist/commands/llm.js +245 -43
- package/dist/commands/login.d.ts +14 -0
- package/dist/commands/login.js +41 -30
- package/dist/commands/portfolio.js +3 -2
- package/dist/commands/profile.js +6 -5
- package/dist/commands/prompt.js +19 -6
- package/dist/commands/sign.js +2 -1
- package/dist/commands/sounds.js +4 -3
- package/dist/commands/status.js +3 -2
- package/dist/commands/submit.js +3 -2
- package/dist/commands/swap.js +9 -7
- package/dist/commands/tokens.js +3 -2
- package/dist/commands/transfer.js +8 -6
- package/dist/commands/update.js +2 -1
- package/dist/commands/webhooks.js +6 -2
- package/dist/commands/whoami.js +3 -2
- package/dist/commands/x402.d.ts +3 -0
- package/dist/commands/x402.js +63 -19
- package/dist/lib/api.d.ts +13 -1
- package/dist/lib/api.js +32 -41
- package/dist/lib/output.d.ts +1 -0
- package/dist/lib/output.js +6 -0
- package/dist/lib/passthrough.d.ts +21 -0
- package/dist/lib/passthrough.js +26 -0
- package/dist/lib/tokens.d.ts +0 -5
- package/dist/lib/tokens.js +0 -5
- package/package.json +1 -1
package/dist/lib/api.d.ts
CHANGED
|
@@ -69,7 +69,11 @@ export declare function getUserInfo(): Promise<UserInfoResponse>;
|
|
|
69
69
|
export interface TokenBalanceInfo {
|
|
70
70
|
network: string;
|
|
71
71
|
token: {
|
|
72
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Wire shape of `GET /wallet/portfolio`: an exact decimal string.
|
|
74
|
+
* Coerce with `Number(...)` before arithmetic or comparison.
|
|
75
|
+
*/
|
|
76
|
+
balance: string;
|
|
73
77
|
balanceUSD: number;
|
|
74
78
|
baseToken: {
|
|
75
79
|
name: string;
|
|
@@ -206,6 +210,11 @@ export interface DeployTokenRequest {
|
|
|
206
210
|
value: string;
|
|
207
211
|
};
|
|
208
212
|
simulateOnly?: boolean;
|
|
213
|
+
/** Turn off the default 15% creator vesting (100% of supply sold into the pool). */
|
|
214
|
+
disableVesting?: boolean;
|
|
215
|
+
/** Collect all creator fees in the pool's quote token (e.g. WETH) instead of
|
|
216
|
+
* a mix of the launched token and the quote token. */
|
|
217
|
+
quoteOnlyFees?: boolean;
|
|
209
218
|
}
|
|
210
219
|
export interface DeployTokenResponse {
|
|
211
220
|
success: boolean;
|
|
@@ -264,6 +273,9 @@ export interface BeneficiaryFeesResponse {
|
|
|
264
273
|
totalLaunches: number;
|
|
265
274
|
poolsWithShares: number;
|
|
266
275
|
tokens: CreatorFeesTokenResult[];
|
|
276
|
+
/** Server stopped the scan early — more claimable fees may exist. */
|
|
277
|
+
truncated?: boolean;
|
|
278
|
+
scanned?: number;
|
|
267
279
|
}
|
|
268
280
|
export interface DopplerClaimTxResponse {
|
|
269
281
|
to: string;
|
package/dist/lib/api.js
CHANGED
|
@@ -19,7 +19,9 @@ async function handleResponse(res) {
|
|
|
19
19
|
const body = (await res
|
|
20
20
|
.json()
|
|
21
21
|
.catch(() => ({ message: res.statusText })));
|
|
22
|
-
const msg = body.message
|
|
22
|
+
const msg = (typeof body.message === "string" && body.message) ||
|
|
23
|
+
(typeof body.error === "string" && body.error) ||
|
|
24
|
+
res.statusText;
|
|
23
25
|
throw new Error(`API error (${res.status}): ${msg}`);
|
|
24
26
|
}
|
|
25
27
|
return res.json();
|
|
@@ -32,10 +34,19 @@ export class ApiError extends Error {
|
|
|
32
34
|
this.body = body;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
37
|
+
/** Choke point for every authenticated request. Injects auth headers. */
|
|
38
|
+
async function authedFetch(url, init = {}) {
|
|
39
|
+
return fetch(url, {
|
|
40
|
+
...init,
|
|
41
|
+
headers: {
|
|
42
|
+
...authHeaders(),
|
|
43
|
+
...init.headers,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
35
47
|
export async function submitPrompt(prompt, threadId, maxMode) {
|
|
36
|
-
const res = await
|
|
48
|
+
const res = await authedFetch(`${getApiUrl()}/agent/prompt`, {
|
|
37
49
|
method: "POST",
|
|
38
|
-
headers: authHeaders(),
|
|
39
50
|
body: JSON.stringify({
|
|
40
51
|
prompt,
|
|
41
52
|
...(threadId && { threadId }),
|
|
@@ -52,15 +63,12 @@ export async function submitPrompt(prompt, threadId, maxMode) {
|
|
|
52
63
|
return res.json();
|
|
53
64
|
}
|
|
54
65
|
export async function getJobStatus(jobId) {
|
|
55
|
-
const res = await
|
|
56
|
-
headers: authHeaders(),
|
|
57
|
-
});
|
|
66
|
+
const res = await authedFetch(`${getApiUrl()}/agent/job/${jobId}`);
|
|
58
67
|
return handleResponse(res);
|
|
59
68
|
}
|
|
60
69
|
export async function cancelJob(jobId) {
|
|
61
|
-
const res = await
|
|
70
|
+
const res = await authedFetch(`${getApiUrl()}/agent/job/${jobId}/cancel`, {
|
|
62
71
|
method: "POST",
|
|
63
|
-
headers: authHeaders(),
|
|
64
72
|
});
|
|
65
73
|
return handleResponse(res);
|
|
66
74
|
}
|
|
@@ -76,9 +84,7 @@ export async function validateApiKey() {
|
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
export async function getUserInfo() {
|
|
79
|
-
const res = await
|
|
80
|
-
headers: authHeaders(),
|
|
81
|
-
});
|
|
87
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/me`);
|
|
82
88
|
return handleResponse(res);
|
|
83
89
|
}
|
|
84
90
|
export async function getPortfolio(opts = {}) {
|
|
@@ -90,7 +96,7 @@ export async function getPortfolio(opts = {}) {
|
|
|
90
96
|
if (opts.include?.length)
|
|
91
97
|
query.set("include", opts.include.join(","));
|
|
92
98
|
const qs = query.toString();
|
|
93
|
-
const res = await
|
|
99
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/portfolio${qs ? `?${qs}` : ""}`);
|
|
94
100
|
return handleResponse(res);
|
|
95
101
|
}
|
|
96
102
|
/** @deprecated Use getPortfolio instead */
|
|
@@ -110,25 +116,22 @@ export async function pollJob(jobId, opts = {}) {
|
|
|
110
116
|
throw new Error(`Polling timed out after ${maxAttempts} attempts`);
|
|
111
117
|
}
|
|
112
118
|
export async function sign(request) {
|
|
113
|
-
const res = await
|
|
119
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/sign`, {
|
|
114
120
|
method: "POST",
|
|
115
|
-
headers: authHeaders(),
|
|
116
121
|
body: JSON.stringify(request),
|
|
117
122
|
});
|
|
118
123
|
return handleResponse(res);
|
|
119
124
|
}
|
|
120
125
|
export async function submit(request) {
|
|
121
|
-
const res = await
|
|
126
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/submit`, {
|
|
122
127
|
method: "POST",
|
|
123
|
-
headers: authHeaders(),
|
|
124
128
|
body: JSON.stringify(request),
|
|
125
129
|
});
|
|
126
130
|
return handleResponse(res);
|
|
127
131
|
}
|
|
128
132
|
export async function deployToken(request) {
|
|
129
|
-
const res = await
|
|
133
|
+
const res = await authedFetch(`${getApiUrl()}/token-launches/deploy`, {
|
|
130
134
|
method: "POST",
|
|
131
|
-
headers: authHeaders(),
|
|
132
135
|
body: JSON.stringify(request),
|
|
133
136
|
});
|
|
134
137
|
return handleResponse(res);
|
|
@@ -239,9 +242,8 @@ export async function getTokenCreatorFees(tokenAddress, days) {
|
|
|
239
242
|
* to work through the deprecation window.
|
|
240
243
|
*/
|
|
241
244
|
export async function buildDopplerClaimTx(tokenAddress) {
|
|
242
|
-
const res = await
|
|
245
|
+
const res = await authedFetch(`${getApiUrl()}/agent/doppler/claim`, {
|
|
243
246
|
method: "POST",
|
|
244
|
-
headers: authHeaders(),
|
|
245
247
|
body: JSON.stringify({ tokenAddress }),
|
|
246
248
|
});
|
|
247
249
|
return handleResponse(res);
|
|
@@ -253,17 +255,14 @@ export async function buildDopplerClaimTx(tokenAddress) {
|
|
|
253
255
|
* Replaces the two-step `buildDopplerClaimTx` + `submit` flow.
|
|
254
256
|
*/
|
|
255
257
|
export async function claimTokenLaunchFees(tokenAddress) {
|
|
256
|
-
const res = await
|
|
258
|
+
const res = await authedFetch(`${getApiUrl()}/token-launches/${tokenAddress}/fees/claim`, {
|
|
257
259
|
method: "POST",
|
|
258
|
-
headers: authHeaders(),
|
|
259
260
|
body: JSON.stringify({}),
|
|
260
261
|
});
|
|
261
262
|
return handleResponse(res);
|
|
262
263
|
}
|
|
263
264
|
export async function getOwnProfiles() {
|
|
264
|
-
const res = await
|
|
265
|
-
headers: authHeaders(),
|
|
266
|
-
});
|
|
265
|
+
const res = await authedFetch(`${getApiUrl()}/agent/profile?multi=true`);
|
|
267
266
|
return handleResponse(res);
|
|
268
267
|
}
|
|
269
268
|
/** @deprecated Use getOwnProfiles() — returns first profile for backward compat */
|
|
@@ -272,32 +271,28 @@ export async function getOwnProfile() {
|
|
|
272
271
|
return profiles[0];
|
|
273
272
|
}
|
|
274
273
|
export async function createProfile(data) {
|
|
275
|
-
const res = await
|
|
274
|
+
const res = await authedFetch(`${getApiUrl()}/agent/profile?multi=true`, {
|
|
276
275
|
method: "POST",
|
|
277
|
-
headers: authHeaders(),
|
|
278
276
|
body: JSON.stringify(data),
|
|
279
277
|
});
|
|
280
278
|
return handleResponse(res);
|
|
281
279
|
}
|
|
282
280
|
export async function updateProfile(slug, data) {
|
|
283
|
-
const res = await
|
|
281
|
+
const res = await authedFetch(`${getApiUrl()}/agent/profile/${encodeURIComponent(slug)}`, {
|
|
284
282
|
method: "PUT",
|
|
285
|
-
headers: authHeaders(),
|
|
286
283
|
body: JSON.stringify(data),
|
|
287
284
|
});
|
|
288
285
|
return handleResponse(res);
|
|
289
286
|
}
|
|
290
287
|
export async function deleteProfile(slug) {
|
|
291
|
-
const res = await
|
|
288
|
+
const res = await authedFetch(`${getApiUrl()}/agent/profile/${encodeURIComponent(slug)}`, {
|
|
292
289
|
method: "DELETE",
|
|
293
|
-
headers: authHeaders(),
|
|
294
290
|
});
|
|
295
291
|
return handleResponse(res);
|
|
296
292
|
}
|
|
297
293
|
export async function addProjectUpdate(slug, data) {
|
|
298
|
-
const res = await
|
|
294
|
+
const res = await authedFetch(`${getApiUrl()}/agent/profile/${encodeURIComponent(slug)}/update`, {
|
|
299
295
|
method: "POST",
|
|
300
|
-
headers: authHeaders(),
|
|
301
296
|
body: JSON.stringify(data),
|
|
302
297
|
});
|
|
303
298
|
return handleResponse(res);
|
|
@@ -314,25 +309,22 @@ export async function searchTokens(query, chainId) {
|
|
|
314
309
|
return handleResponse(res);
|
|
315
310
|
}
|
|
316
311
|
export async function transfer(request) {
|
|
317
|
-
const res = await
|
|
312
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/transfer`, {
|
|
318
313
|
method: "POST",
|
|
319
|
-
headers: authHeaders(),
|
|
320
314
|
body: JSON.stringify(request),
|
|
321
315
|
});
|
|
322
316
|
return handleResponse(res);
|
|
323
317
|
}
|
|
324
318
|
export async function getSwapQuote(request) {
|
|
325
|
-
const res = await
|
|
319
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/swap-quote`, {
|
|
326
320
|
method: "POST",
|
|
327
|
-
headers: authHeaders(),
|
|
328
321
|
body: JSON.stringify(request),
|
|
329
322
|
});
|
|
330
323
|
return handleResponse(res);
|
|
331
324
|
}
|
|
332
325
|
export async function executeSwap(request) {
|
|
333
|
-
const res = await
|
|
326
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/swap`, {
|
|
334
327
|
method: "POST",
|
|
335
|
-
headers: authHeaders(),
|
|
336
328
|
body: JSON.stringify(request),
|
|
337
329
|
});
|
|
338
330
|
return handleResponse(res);
|
|
@@ -347,9 +339,8 @@ export async function resolveRecipient(value, type) {
|
|
|
347
339
|
return handleResponse(res);
|
|
348
340
|
}
|
|
349
341
|
export async function x402Pay(request) {
|
|
350
|
-
const res = await
|
|
342
|
+
const res = await authedFetch(`${getApiUrl()}/wallet/x402-pay`, {
|
|
351
343
|
method: "POST",
|
|
352
|
-
headers: authHeaders(),
|
|
353
344
|
body: JSON.stringify(request),
|
|
354
345
|
});
|
|
355
346
|
return handleResponse(res);
|
package/dist/lib/output.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const fmt: {
|
|
|
6
6
|
readonly dim: import("chalk").ChalkInstance;
|
|
7
7
|
readonly success: import("chalk").ChalkInstance;
|
|
8
8
|
readonly warn: import("chalk").ChalkInstance;
|
|
9
|
+
readonly magic: import("chalk").ChalkInstance;
|
|
9
10
|
};
|
|
10
11
|
export declare const bankrTheme: {
|
|
11
12
|
prefix: string;
|
package/dist/lib/output.js
CHANGED
|
@@ -3,6 +3,11 @@ import ora from "ora";
|
|
|
3
3
|
const BRAND_HEX = "#FF613D";
|
|
4
4
|
const brandColor = chalk.hex(BRAND_HEX);
|
|
5
5
|
const brandColorBold = brandColor.bold;
|
|
6
|
+
/**
|
|
7
|
+
* The web's `--background-magic-color-bg-magic` token, so the Private (TEE)
|
|
8
|
+
* tier reads as the same thing in the terminal as it does in the catalogue.
|
|
9
|
+
*/
|
|
10
|
+
const MAGIC_HEX = "#8B5CF6";
|
|
6
11
|
/** String formatters (return colored strings without logging). */
|
|
7
12
|
export const fmt = {
|
|
8
13
|
brand: brandColor,
|
|
@@ -10,6 +15,7 @@ export const fmt = {
|
|
|
10
15
|
dim: chalk.dim,
|
|
11
16
|
success: chalk.green,
|
|
12
17
|
warn: chalk.yellow,
|
|
18
|
+
magic: chalk.hex(MAGIC_HEX),
|
|
13
19
|
};
|
|
14
20
|
export const bankrTheme = {
|
|
15
21
|
prefix: brandColor("▸"),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything the user typed after `name`, forwarded verbatim to a spawned tool.
|
|
3
|
+
*
|
|
4
|
+
* Read off argv rather than commander's parsed args so the tool's own flags
|
|
5
|
+
* (`--model`, `--resume`, …) reach it untouched — `allowUnknownOption()` alone
|
|
6
|
+
* isn't enough, since commander still consumes and reorders what it recognizes.
|
|
7
|
+
* This is what lets `--model "claude-opus-5[1m]"` survive.
|
|
8
|
+
*
|
|
9
|
+
* The search starts at index 2 to skip `[node, script]`, so the command token
|
|
10
|
+
* is always matched ahead of any later occurrence in prompt text.
|
|
11
|
+
*/
|
|
12
|
+
export declare function passthroughArgs(name: string, argv?: string[]): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Whether the forwarded args are just asking the tool to print its own help.
|
|
15
|
+
*
|
|
16
|
+
* Such a run makes no gateway request, so the launcher spawns the tool
|
|
17
|
+
* directly — skipping the auth gate (which would otherwise exit with "Not
|
|
18
|
+
* authenticated") and the "Launching…" banner.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isHelpRequest(args: string[]): boolean;
|
|
21
|
+
//# sourceMappingURL=passthrough.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything the user typed after `name`, forwarded verbatim to a spawned tool.
|
|
3
|
+
*
|
|
4
|
+
* Read off argv rather than commander's parsed args so the tool's own flags
|
|
5
|
+
* (`--model`, `--resume`, …) reach it untouched — `allowUnknownOption()` alone
|
|
6
|
+
* isn't enough, since commander still consumes and reorders what it recognizes.
|
|
7
|
+
* This is what lets `--model "claude-opus-5[1m]"` survive.
|
|
8
|
+
*
|
|
9
|
+
* The search starts at index 2 to skip `[node, script]`, so the command token
|
|
10
|
+
* is always matched ahead of any later occurrence in prompt text.
|
|
11
|
+
*/
|
|
12
|
+
export function passthroughArgs(name, argv = process.argv) {
|
|
13
|
+
const idx = argv.indexOf(name, 2);
|
|
14
|
+
return idx >= 0 ? argv.slice(idx + 1) : [];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Whether the forwarded args are just asking the tool to print its own help.
|
|
18
|
+
*
|
|
19
|
+
* Such a run makes no gateway request, so the launcher spawns the tool
|
|
20
|
+
* directly — skipping the auth gate (which would otherwise exit with "Not
|
|
21
|
+
* authenticated") and the "Launching…" banner.
|
|
22
|
+
*/
|
|
23
|
+
export function isHelpRequest(args) {
|
|
24
|
+
return args.some((arg) => arg === "--help" || arg === "-h");
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=passthrough.js.map
|
package/dist/lib/tokens.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Native-token sentinel (zero address). The API detects + sanitizes native
|
|
3
|
-
* tokens from this, so callers send it instead of a real contract address.
|
|
4
|
-
*/
|
|
5
|
-
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
6
1
|
/** Shorten an address for display, e.g. `0x8335…2913`. */
|
|
7
2
|
export declare function shortenAddress(address: string): string;
|
|
8
3
|
/**
|
package/dist/lib/tokens.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { isAddress } from "viem";
|
|
2
2
|
import { searchTokens } from "./api.js";
|
|
3
3
|
import { CHAIN_IDS } from "./chains.js";
|
|
4
|
-
/**
|
|
5
|
-
* Native-token sentinel (zero address). The API detects + sanitizes native
|
|
6
|
-
* tokens from this, so callers send it instead of a real contract address.
|
|
7
|
-
*/
|
|
8
|
-
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
9
4
|
/** Shorten an address for display, e.g. `0x8335…2913`. */
|
|
10
5
|
export function shortenAddress(address) {
|
|
11
6
|
return `${address.slice(0, 6)}…${address.slice(-4)}`;
|