moltlaunch 0.2.1 → 0.3.0
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 +12 -9
- package/dist/index.js +307 -82
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,17 +5,19 @@ CLI for AI agents to launch tokens on Base via [Flaunch](https://flaunch.gg). On
|
|
|
5
5
|
## Install & Launch
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx moltlaunch --name "My Token" --symbol "MYTKN" --description "A cool token"
|
|
8
|
+
npx moltlaunch --name "My Token" --symbol "MYTKN" --description "A cool token"
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
That's it. No wallet setup, no gas, no
|
|
11
|
+
That's it. No wallet setup, no gas, no image file needed. Flaunch handles the on-chain deployment.
|
|
12
|
+
|
|
13
|
+
A unique logo is auto-generated from your token name (gradient + identicon pattern). Passing `--image ./logo.png` is recommended for a custom look, but not required.
|
|
12
14
|
|
|
13
15
|
First run creates a wallet at `~/.moltlaunch/wallet.json` — the private key is shown once on creation.
|
|
14
16
|
|
|
15
17
|
### JSON output (for agents)
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
|
-
npx moltlaunch --name "My Token" --symbol "MYTKN" --description "..." --
|
|
20
|
+
npx moltlaunch --name "My Token" --symbol "MYTKN" --description "..." --json
|
|
19
21
|
```
|
|
20
22
|
|
|
21
23
|
Returns:
|
|
@@ -51,7 +53,8 @@ All commands support `--json` for structured output.
|
|
|
51
53
|
Attach your identity and links to tokens you launch:
|
|
52
54
|
|
|
53
55
|
```bash
|
|
54
|
-
npx moltlaunch --name "My Token" --symbol "TKN" --description "..."
|
|
56
|
+
npx moltlaunch --name "My Token" --symbol "TKN" --description "..." \
|
|
57
|
+
--image ./logo.png \
|
|
55
58
|
--profile "MyAgent" \
|
|
56
59
|
--website "https://myproject.com"
|
|
57
60
|
```
|
|
@@ -66,11 +69,11 @@ All commands support `--json` for structured output.
|
|
|
66
69
|
## How It Works
|
|
67
70
|
|
|
68
71
|
```
|
|
69
|
-
npx moltlaunch --name "X" --symbol "X" --
|
|
72
|
+
npx moltlaunch --name "X" --symbol "X" --description "..."
|
|
70
73
|
│
|
|
71
74
|
├─ 1. Load/create wallet (~/.moltlaunch/wallet.json)
|
|
72
75
|
│
|
|
73
|
-
├─ 2.
|
|
76
|
+
├─ 2. Generate unique logo (or use --image) & upload to IPFS
|
|
74
77
|
│ POST web2-api.flaunch.gg/api/v1/upload-image
|
|
75
78
|
│ → returns ipfsHash
|
|
76
79
|
│
|
|
@@ -162,7 +165,7 @@ import subprocess, json
|
|
|
162
165
|
|
|
163
166
|
result = subprocess.run(
|
|
164
167
|
["npx", "moltlaunch", "--name", "AgentCoin", "--symbol", "AGT",
|
|
165
|
-
"--description", "Launched by AI", "--
|
|
168
|
+
"--description", "Launched by AI", "--json"],
|
|
166
169
|
capture_output=True, text=True
|
|
167
170
|
)
|
|
168
171
|
|
|
@@ -177,7 +180,7 @@ if result.returncode == 0:
|
|
|
177
180
|
import { execSync } from "child_process";
|
|
178
181
|
|
|
179
182
|
const raw = execSync(
|
|
180
|
-
'npx moltlaunch --name "AgentCoin" --symbol "AGT" --description "Launched by AI" --
|
|
183
|
+
'npx moltlaunch --name "AgentCoin" --symbol "AGT" --description "Launched by AI" --json',
|
|
181
184
|
{ encoding: "utf-8" }
|
|
182
185
|
);
|
|
183
186
|
const { tokenAddress, flaunch } = JSON.parse(raw);
|
|
@@ -185,7 +188,7 @@ const { tokenAddress, flaunch } = JSON.parse(raw);
|
|
|
185
188
|
|
|
186
189
|
### Shell
|
|
187
190
|
```bash
|
|
188
|
-
OUTPUT=$(npx moltlaunch --name "AgentCoin" --symbol "AGT" --description "test" --
|
|
191
|
+
OUTPUT=$(npx moltlaunch --name "AgentCoin" --symbol "AGT" --description "test" --json)
|
|
189
192
|
[ $? -eq 0 ] && echo "$OUTPUT" | jq -r '.tokenAddress'
|
|
190
193
|
```
|
|
191
194
|
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,8 @@ async function createWallet() {
|
|
|
75
75
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
76
76
|
};
|
|
77
77
|
const dir = getWalletDir();
|
|
78
|
-
await mkdir(dir, { recursive: true });
|
|
78
|
+
await mkdir(dir, { recursive: true, mode: 448 });
|
|
79
|
+
await chmod(dir, 448);
|
|
79
80
|
const path = getWalletPath();
|
|
80
81
|
await writeFile(path, JSON.stringify(data, null, 2), { mode: 384 });
|
|
81
82
|
await chmod(path, 384);
|
|
@@ -183,23 +184,30 @@ async function fetchWithRetry(url, options, retries = 3) {
|
|
|
183
184
|
}
|
|
184
185
|
throw new Error("Max retries exceeded (429 rate limit)");
|
|
185
186
|
}
|
|
186
|
-
async function uploadImage(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
187
|
+
async function uploadImage(source) {
|
|
188
|
+
let base64;
|
|
189
|
+
let mime;
|
|
190
|
+
if (typeof source === "string") {
|
|
191
|
+
const fileStat = await stat(source);
|
|
192
|
+
if (fileStat.size > MAX_IMAGE_SIZE_BYTES) {
|
|
193
|
+
throw new UploadError(`Image exceeds 5MB limit (${(fileStat.size / 1024 / 1024).toFixed(1)}MB)`);
|
|
194
|
+
}
|
|
195
|
+
const imageBuffer = await readFile2(source);
|
|
196
|
+
base64 = imageBuffer.toString("base64");
|
|
197
|
+
const ext = source.split(".").pop()?.toLowerCase();
|
|
198
|
+
const mimeMap = {
|
|
199
|
+
png: "image/png",
|
|
200
|
+
jpg: "image/jpeg",
|
|
201
|
+
jpeg: "image/jpeg",
|
|
202
|
+
gif: "image/gif",
|
|
203
|
+
webp: "image/webp",
|
|
204
|
+
svg: "image/svg+xml"
|
|
205
|
+
};
|
|
206
|
+
mime = mimeMap[ext ?? ""] ?? "image/png";
|
|
207
|
+
} else {
|
|
208
|
+
base64 = source.buffer.toString("base64");
|
|
209
|
+
mime = source.mime;
|
|
210
|
+
}
|
|
203
211
|
const dataUrl = `data:${mime};base64,${base64}`;
|
|
204
212
|
const response = await fetchWithRetry(`${FLAUNCH_API_BASE}/api/v1/upload-image`, {
|
|
205
213
|
method: "POST",
|
|
@@ -245,12 +253,32 @@ async function launchMemecoin(params) {
|
|
|
245
253
|
}
|
|
246
254
|
async function pollLaunchStatus(jobId, onPoll) {
|
|
247
255
|
const startTime = Date.now();
|
|
256
|
+
let consecutiveErrors = 0;
|
|
248
257
|
while (Date.now() - startTime < POLL_TIMEOUT_MS) {
|
|
249
|
-
|
|
258
|
+
let response;
|
|
259
|
+
try {
|
|
260
|
+
response = await fetch(`${FLAUNCH_API_BASE}/api/v1/launch-status/${jobId}`);
|
|
261
|
+
} catch {
|
|
262
|
+
consecutiveErrors++;
|
|
263
|
+
if (consecutiveErrors >= 5) {
|
|
264
|
+
throw new LaunchError("Lost connection to Flaunch API during deployment");
|
|
265
|
+
}
|
|
266
|
+
await sleep(POLL_INTERVAL_MS);
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (response.status === 429 || response.status >= 500) {
|
|
270
|
+
consecutiveErrors++;
|
|
271
|
+
if (consecutiveErrors >= 5) {
|
|
272
|
+
throw new LaunchError(`Status check failed after retries: ${response.status}`);
|
|
273
|
+
}
|
|
274
|
+
await sleep(POLL_INTERVAL_MS * (consecutiveErrors + 1));
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
250
277
|
if (!response.ok) {
|
|
251
278
|
const text = await response.text();
|
|
252
279
|
throw new LaunchError(`Status check failed: ${response.status} \u2014 ${text}`);
|
|
253
280
|
}
|
|
281
|
+
consecutiveErrors = 0;
|
|
254
282
|
const data = await response.json();
|
|
255
283
|
onPoll?.(data.state, data.queuePosition);
|
|
256
284
|
if (data.state === "completed") return data;
|
|
@@ -262,6 +290,171 @@ async function pollLaunchStatus(jobId, onPoll) {
|
|
|
262
290
|
throw new TimeoutError();
|
|
263
291
|
}
|
|
264
292
|
|
|
293
|
+
// src/lib/generate-logo.ts
|
|
294
|
+
import { deflateSync } from "zlib";
|
|
295
|
+
var SIZE = 512;
|
|
296
|
+
function hashString(str) {
|
|
297
|
+
let hash = 0;
|
|
298
|
+
for (let i = 0; i < str.length; i++) {
|
|
299
|
+
hash = (hash << 5) - hash + str.charCodeAt(i) | 0;
|
|
300
|
+
}
|
|
301
|
+
return Math.abs(hash);
|
|
302
|
+
}
|
|
303
|
+
function mulberry32(seed) {
|
|
304
|
+
let s = seed | 0;
|
|
305
|
+
return () => {
|
|
306
|
+
s = s + 1831565813 | 0;
|
|
307
|
+
let t = Math.imul(s ^ s >>> 15, 1 | s);
|
|
308
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
309
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
function hslToRgb(h, s, l) {
|
|
313
|
+
const a = s * Math.min(l, 1 - l);
|
|
314
|
+
const f = (n) => {
|
|
315
|
+
const k = (n + h / 30) % 12;
|
|
316
|
+
return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
317
|
+
};
|
|
318
|
+
return {
|
|
319
|
+
r: Math.round(255 * f(0)),
|
|
320
|
+
g: Math.round(255 * f(8)),
|
|
321
|
+
b: Math.round(255 * f(4))
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function lerpColor(c1, c2, t) {
|
|
325
|
+
return {
|
|
326
|
+
r: Math.round(c1.r + (c2.r - c1.r) * t),
|
|
327
|
+
g: Math.round(c1.g + (c2.g - c1.g) * t),
|
|
328
|
+
b: Math.round(c1.b + (c2.b - c1.b) * t)
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function blendColor(base, overlay, alpha) {
|
|
332
|
+
return {
|
|
333
|
+
r: Math.round(base.r * (1 - alpha) + overlay.r * alpha),
|
|
334
|
+
g: Math.round(base.g * (1 - alpha) + overlay.g * alpha),
|
|
335
|
+
b: Math.round(base.b * (1 - alpha) + overlay.b * alpha)
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function generatePattern(rand) {
|
|
339
|
+
const grid = [];
|
|
340
|
+
for (let row = 0; row < 7; row++) {
|
|
341
|
+
grid[row] = [];
|
|
342
|
+
for (let col = 0; col < 4; col++) {
|
|
343
|
+
grid[row][col] = rand() > 0.5;
|
|
344
|
+
}
|
|
345
|
+
grid[row][4] = grid[row][2];
|
|
346
|
+
grid[row][5] = grid[row][1];
|
|
347
|
+
grid[row][6] = grid[row][0];
|
|
348
|
+
}
|
|
349
|
+
return grid;
|
|
350
|
+
}
|
|
351
|
+
function encodePng(width, height, pixels) {
|
|
352
|
+
const rawData = Buffer.alloc(height * (1 + width * 3));
|
|
353
|
+
for (let y = 0; y < height; y++) {
|
|
354
|
+
const rowOffset = y * (1 + width * 3);
|
|
355
|
+
rawData[rowOffset] = 0;
|
|
356
|
+
for (let x = 0; x < width; x++) {
|
|
357
|
+
const srcIdx = (y * width + x) * 3;
|
|
358
|
+
const dstIdx = rowOffset + 1 + x * 3;
|
|
359
|
+
rawData[dstIdx] = pixels[srcIdx];
|
|
360
|
+
rawData[dstIdx + 1] = pixels[srcIdx + 1];
|
|
361
|
+
rawData[dstIdx + 2] = pixels[srcIdx + 2];
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
const compressed = deflateSync(rawData);
|
|
365
|
+
const signature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
366
|
+
const ihdrData = Buffer.alloc(13);
|
|
367
|
+
ihdrData.writeUInt32BE(width, 0);
|
|
368
|
+
ihdrData.writeUInt32BE(height, 4);
|
|
369
|
+
ihdrData[8] = 8;
|
|
370
|
+
ihdrData[9] = 2;
|
|
371
|
+
ihdrData[10] = 0;
|
|
372
|
+
ihdrData[11] = 0;
|
|
373
|
+
ihdrData[12] = 0;
|
|
374
|
+
const ihdr = makeChunk("IHDR", ihdrData);
|
|
375
|
+
const idat = makeChunk("IDAT", compressed);
|
|
376
|
+
const iend = makeChunk("IEND", Buffer.alloc(0));
|
|
377
|
+
return Buffer.concat([signature, ihdr, idat, iend]);
|
|
378
|
+
}
|
|
379
|
+
function makeChunk(type, data) {
|
|
380
|
+
const length = Buffer.alloc(4);
|
|
381
|
+
length.writeUInt32BE(data.length, 0);
|
|
382
|
+
const typeBytes = Buffer.from(type, "ascii");
|
|
383
|
+
const crcInput = Buffer.concat([typeBytes, data]);
|
|
384
|
+
const crc = Buffer.alloc(4);
|
|
385
|
+
crc.writeUInt32BE(crc32(crcInput), 0);
|
|
386
|
+
return Buffer.concat([length, typeBytes, data, crc]);
|
|
387
|
+
}
|
|
388
|
+
function crc32(buf) {
|
|
389
|
+
let crc = 4294967295;
|
|
390
|
+
for (let i = 0; i < buf.length; i++) {
|
|
391
|
+
crc ^= buf[i];
|
|
392
|
+
for (let j = 0; j < 8; j++) {
|
|
393
|
+
crc = crc & 1 ? crc >>> 1 ^ 3988292384 : crc >>> 1;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return (crc ^ 4294967295) >>> 0;
|
|
397
|
+
}
|
|
398
|
+
function generateTokenLogo(name, symbol) {
|
|
399
|
+
const seed = hashString(`${name}:${symbol}`);
|
|
400
|
+
const rand = mulberry32(seed);
|
|
401
|
+
const hue1 = Math.floor(rand() * 360);
|
|
402
|
+
const hue2 = (hue1 + 90 + Math.floor(rand() * 90)) % 360;
|
|
403
|
+
const color1 = hslToRgb(hue1, 0.65, 0.5);
|
|
404
|
+
const color2 = hslToRgb(hue2, 0.55, 0.35);
|
|
405
|
+
const patternColor = hslToRgb(hue1, 0.4, 0.9);
|
|
406
|
+
const pattern = generatePattern(rand);
|
|
407
|
+
const pixels = Buffer.alloc(SIZE * SIZE * 3);
|
|
408
|
+
const gridSize = 7;
|
|
409
|
+
const cellPx = 36;
|
|
410
|
+
const gridWidth = gridSize * cellPx;
|
|
411
|
+
const offsetX = Math.floor((SIZE - gridWidth) / 2);
|
|
412
|
+
const offsetY = Math.floor((SIZE - gridWidth) / 2);
|
|
413
|
+
const cornerRadius = 48;
|
|
414
|
+
for (let y = 0; y < SIZE; y++) {
|
|
415
|
+
for (let x = 0; x < SIZE; x++) {
|
|
416
|
+
const idx = (y * SIZE + x) * 3;
|
|
417
|
+
const inCorner = isOutsideRoundedRect(x, y, SIZE, SIZE, cornerRadius);
|
|
418
|
+
if (inCorner) {
|
|
419
|
+
pixels[idx] = 0;
|
|
420
|
+
pixels[idx + 1] = 0;
|
|
421
|
+
pixels[idx + 2] = 0;
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
const t = (x + y) / (SIZE * 2);
|
|
425
|
+
let color = lerpColor(color1, color2, t);
|
|
426
|
+
const gx = x - offsetX;
|
|
427
|
+
const gy = y - offsetY;
|
|
428
|
+
if (gx >= 0 && gx < gridWidth && gy >= 0 && gy < gridWidth) {
|
|
429
|
+
const col = Math.floor(gx / cellPx);
|
|
430
|
+
const row = Math.floor(gy / cellPx);
|
|
431
|
+
if (col < gridSize && row < gridSize && pattern[row][col]) {
|
|
432
|
+
color = blendColor(color, patternColor, 0.35);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
pixels[idx] = color.r;
|
|
436
|
+
pixels[idx + 1] = color.g;
|
|
437
|
+
pixels[idx + 2] = color.b;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return encodePng(SIZE, SIZE, pixels);
|
|
441
|
+
}
|
|
442
|
+
function isOutsideRoundedRect(x, y, w, h, r) {
|
|
443
|
+
if (x < r && y < r) {
|
|
444
|
+
return (r - x) ** 2 + (r - y) ** 2 > r ** 2;
|
|
445
|
+
}
|
|
446
|
+
if (x >= w - r && y < r) {
|
|
447
|
+
return (x - (w - r - 1)) ** 2 + (r - y) ** 2 > r ** 2;
|
|
448
|
+
}
|
|
449
|
+
if (x < r && y >= h - r) {
|
|
450
|
+
return (r - x) ** 2 + (y - (h - r - 1)) ** 2 > r ** 2;
|
|
451
|
+
}
|
|
452
|
+
if (x >= w - r && y >= h - r) {
|
|
453
|
+
return (x - (w - r - 1)) ** 2 + (y - (h - r - 1)) ** 2 > r ** 2;
|
|
454
|
+
}
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
|
|
265
458
|
// src/lib/output.ts
|
|
266
459
|
function formatOutput(data, json) {
|
|
267
460
|
if (json) {
|
|
@@ -298,16 +491,23 @@ Error: ${message}
|
|
|
298
491
|
|
|
299
492
|
// src/commands/launch.ts
|
|
300
493
|
async function launch(opts) {
|
|
301
|
-
const { name, symbol, description,
|
|
494
|
+
const { name, symbol, description, profile, website, testnet, json } = opts;
|
|
302
495
|
const network = testnet ? "testnet" : "mainnet";
|
|
303
496
|
const chain = testnet ? CHAIN.testnet : CHAIN.mainnet;
|
|
304
497
|
try {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
498
|
+
let imageSource;
|
|
499
|
+
if (opts.imagePath) {
|
|
500
|
+
const resolvedImage = resolve(opts.imagePath);
|
|
501
|
+
try {
|
|
502
|
+
await access2(resolvedImage);
|
|
503
|
+
} catch {
|
|
504
|
+
printError(`Image not found: ${resolvedImage}`, json, EXIT_CODES.UPLOAD_FAIL);
|
|
505
|
+
process.exit(EXIT_CODES.UPLOAD_FAIL);
|
|
506
|
+
}
|
|
507
|
+
imageSource = resolvedImage;
|
|
508
|
+
} else {
|
|
509
|
+
if (!json) console.log("Generating unique logo from token name...");
|
|
510
|
+
imageSource = { buffer: generateTokenLogo(name, symbol), mime: "image/png" };
|
|
311
511
|
}
|
|
312
512
|
const { wallet: wallet2, isNew } = await loadOrCreateWallet();
|
|
313
513
|
if (!json) {
|
|
@@ -322,7 +522,7 @@ Using wallet: ${wallet2.address}`);
|
|
|
322
522
|
}
|
|
323
523
|
}
|
|
324
524
|
if (!json) process.stdout.write("Uploading image...");
|
|
325
|
-
const imageIpfs = await uploadImage(
|
|
525
|
+
const imageIpfs = await uploadImage(imageSource);
|
|
326
526
|
if (!json) console.log(` ${imageIpfs.slice(0, 16)}...`);
|
|
327
527
|
if (!json) process.stdout.write("Submitting launch...");
|
|
328
528
|
const twitterUrl = profile ? `https://www.moltbook.com/u/${profile}` : void 0;
|
|
@@ -349,6 +549,12 @@ Using wallet: ${wallet2.address}`);
|
|
|
349
549
|
}
|
|
350
550
|
});
|
|
351
551
|
if (!json) console.log(" done");
|
|
552
|
+
if (!result.collectionToken?.address || !result.transactionHash) {
|
|
553
|
+
throw new MoltlaunchError(
|
|
554
|
+
"Launch completed but missing token address or transaction hash",
|
|
555
|
+
EXIT_CODES.LAUNCH_FAIL
|
|
556
|
+
);
|
|
557
|
+
}
|
|
352
558
|
const tokenAddress = result.collectionToken.address;
|
|
353
559
|
const flaunchUrl = `${chain.flaunchUrl}/coin/${tokenAddress}`;
|
|
354
560
|
await saveLaunchRecord({
|
|
@@ -390,55 +596,71 @@ Using wallet: ${wallet2.address}`);
|
|
|
390
596
|
// src/commands/wallet.ts
|
|
391
597
|
async function wallet(opts) {
|
|
392
598
|
const { showKey, json } = opts;
|
|
393
|
-
const data = await loadWallet();
|
|
394
|
-
if (!data) {
|
|
395
|
-
printError("No wallet found. Run `moltlaunch` to create one.", json, EXIT_CODES.NO_WALLET);
|
|
396
|
-
process.exit(EXIT_CODES.NO_WALLET);
|
|
397
|
-
}
|
|
398
|
-
let balance = "unknown";
|
|
399
599
|
try {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
output
|
|
600
|
+
const data = await loadWallet();
|
|
601
|
+
if (!data) {
|
|
602
|
+
printError("No wallet found. Run `moltlaunch` to create one.", json, EXIT_CODES.NO_WALLET);
|
|
603
|
+
process.exit(EXIT_CODES.NO_WALLET);
|
|
604
|
+
}
|
|
605
|
+
let balance = "unknown";
|
|
606
|
+
try {
|
|
607
|
+
balance = await getWalletBalance(data.address, "mainnet");
|
|
608
|
+
} catch {
|
|
609
|
+
}
|
|
610
|
+
const output = {
|
|
611
|
+
address: data.address,
|
|
612
|
+
balance: json ? balance : `${balance} ETH (Base)`,
|
|
613
|
+
network: json ? "Base" : void 0,
|
|
614
|
+
createdAt: data.createdAt
|
|
615
|
+
};
|
|
616
|
+
if (showKey) {
|
|
617
|
+
output.privateKey = data.privateKey;
|
|
618
|
+
}
|
|
619
|
+
printSuccess("Wallet info", output, json);
|
|
620
|
+
} catch (error) {
|
|
621
|
+
if (error instanceof MoltlaunchError) {
|
|
622
|
+
printError(error.message, json, error.exitCode);
|
|
623
|
+
process.exit(error.exitCode);
|
|
624
|
+
}
|
|
625
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
626
|
+
printError(message, json, EXIT_CODES.GENERAL);
|
|
627
|
+
process.exit(EXIT_CODES.GENERAL);
|
|
411
628
|
}
|
|
412
|
-
printSuccess("Wallet info", output, json);
|
|
413
629
|
}
|
|
414
630
|
|
|
415
631
|
// src/commands/status.ts
|
|
416
632
|
async function status(opts) {
|
|
417
633
|
const { json } = opts;
|
|
418
|
-
|
|
419
|
-
|
|
634
|
+
try {
|
|
635
|
+
const records = await loadLaunchRecords();
|
|
636
|
+
if (records.length === 0) {
|
|
637
|
+
if (json) {
|
|
638
|
+
console.log(JSON.stringify({ success: true, launches: [] }));
|
|
639
|
+
} else {
|
|
640
|
+
console.log("\nNo tokens launched yet. Run `moltlaunch` to launch one.\n");
|
|
641
|
+
}
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
420
644
|
if (json) {
|
|
421
|
-
console.log(JSON.stringify({ success: true, launches:
|
|
422
|
-
|
|
423
|
-
console.log("\nNo tokens launched yet. Run `moltlaunch` to launch one.\n");
|
|
645
|
+
console.log(JSON.stringify({ success: true, launches: records }, null, 2));
|
|
646
|
+
return;
|
|
424
647
|
}
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
if (json) {
|
|
428
|
-
console.log(JSON.stringify({ success: true, launches: records }, null, 2));
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
console.log(`
|
|
648
|
+
console.log(`
|
|
432
649
|
Launched tokens (${records.length}):
|
|
433
650
|
`);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
651
|
+
for (const record of records) {
|
|
652
|
+
console.log(` ${record.name} (${record.symbol})`);
|
|
653
|
+
console.log(` Token: ${record.tokenAddress}`);
|
|
654
|
+
console.log(` TX: ${record.transactionHash}`);
|
|
655
|
+
console.log(` Flaunch: ${record.flaunchUrl}`);
|
|
656
|
+
console.log(` Network: ${record.network}`);
|
|
657
|
+
console.log(` Launched: ${record.launchedAt}`);
|
|
658
|
+
console.log();
|
|
659
|
+
}
|
|
660
|
+
} catch (error) {
|
|
661
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
662
|
+
printError(message, json, EXIT_CODES.GENERAL);
|
|
663
|
+
process.exit(EXIT_CODES.GENERAL);
|
|
442
664
|
}
|
|
443
665
|
}
|
|
444
666
|
|
|
@@ -479,6 +701,9 @@ Claimable: ${claimableEth} ETH`);
|
|
|
479
701
|
if (!json) console.log(` tx ${tx.hash}`);
|
|
480
702
|
if (!json) process.stdout.write("Waiting for confirmation...");
|
|
481
703
|
const receipt = await tx.wait();
|
|
704
|
+
if (!receipt) {
|
|
705
|
+
throw new MoltlaunchError("Transaction was dropped or replaced", EXIT_CODES.GENERAL);
|
|
706
|
+
}
|
|
482
707
|
if (!json) console.log(" confirmed");
|
|
483
708
|
printSuccess("Fees claimed successfully!", {
|
|
484
709
|
transactionHash: receipt.hash,
|
|
@@ -541,29 +766,29 @@ var require2 = createRequire(import.meta.url);
|
|
|
541
766
|
var { version } = require2("../package.json");
|
|
542
767
|
var program = new Command();
|
|
543
768
|
program.name("moltlaunch").description("CLI for AI agents to launch tokens on Base via Flaunch").version(version);
|
|
544
|
-
program.command("launch", { isDefault: true }).description("Launch a new token on Base").requiredOption("--name <name>", "Token name").requiredOption("--symbol <symbol>", "Token symbol").requiredOption("--description <desc>", "Token description").
|
|
545
|
-
launch({
|
|
769
|
+
program.command("launch", { isDefault: true }).description("Launch a new token on Base").requiredOption("--name <name>", "Token name").requiredOption("--symbol <symbol>", "Token symbol").requiredOption("--description <desc>", "Token description").option("--image <path>", "Path to token image (max 5MB, uses default logo if omitted)").option("--profile <name>", "Moltbook profile name (shown as creator on Flaunch)").option("--website <url>", "Website URL for the token (community, post, etc.)").option("--testnet", "Use Base Sepolia testnet", false).option("--json", "Output as JSON (for agents)", false).action(
|
|
770
|
+
(opts) => launch({
|
|
546
771
|
name: opts.name,
|
|
547
772
|
symbol: opts.symbol,
|
|
548
773
|
description: opts.description,
|
|
549
|
-
imagePath: opts.image,
|
|
774
|
+
imagePath: opts.image ?? void 0,
|
|
550
775
|
profile: opts.profile,
|
|
551
776
|
website: opts.website,
|
|
552
777
|
testnet: opts.testnet,
|
|
553
778
|
json: opts.json
|
|
554
|
-
})
|
|
555
|
-
|
|
556
|
-
program.command("wallet").description("Show wallet address and balance").option("--show-key", "Show private key", false).option("--json", "Output as JSON", false).action(
|
|
557
|
-
wallet({ showKey: opts.showKey, json: opts.json })
|
|
558
|
-
|
|
559
|
-
program.command("status").description("List launched tokens").option("--json", "Output as JSON", false).action(
|
|
560
|
-
status({ json: opts.json })
|
|
561
|
-
|
|
562
|
-
program.command("fees").description("Check claimable fee balance (read-only, no gas needed)").option("--testnet", "Use Base Sepolia testnet", false).option("--json", "Output as JSON", false).action(
|
|
563
|
-
fees({ testnet: opts.testnet, json: opts.json })
|
|
564
|
-
|
|
565
|
-
program.command("claim").description("Withdraw accumulated fees from PositionManager escrow").option("--testnet", "Use Base Sepolia testnet", false).option("--json", "Output as JSON", false).action(
|
|
566
|
-
claim({ testnet: opts.testnet, json: opts.json })
|
|
567
|
-
|
|
779
|
+
})
|
|
780
|
+
);
|
|
781
|
+
program.command("wallet").description("Show wallet address and balance").option("--show-key", "Show private key", false).option("--json", "Output as JSON", false).action(
|
|
782
|
+
(opts) => wallet({ showKey: opts.showKey, json: opts.json })
|
|
783
|
+
);
|
|
784
|
+
program.command("status").description("List launched tokens").option("--json", "Output as JSON", false).action(
|
|
785
|
+
(opts) => status({ json: opts.json })
|
|
786
|
+
);
|
|
787
|
+
program.command("fees").description("Check claimable fee balance (read-only, no gas needed)").option("--testnet", "Use Base Sepolia testnet", false).option("--json", "Output as JSON", false).action(
|
|
788
|
+
(opts) => fees({ testnet: opts.testnet, json: opts.json })
|
|
789
|
+
);
|
|
790
|
+
program.command("claim").description("Withdraw accumulated fees from PositionManager escrow").option("--testnet", "Use Base Sepolia testnet", false).option("--json", "Output as JSON", false).action(
|
|
791
|
+
(opts) => claim({ testnet: opts.testnet, json: opts.json })
|
|
792
|
+
);
|
|
568
793
|
program.parse();
|
|
569
794
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/launch.ts","../src/lib/wallet.ts","../src/lib/config.ts","../src/lib/flaunch-api.ts","../src/lib/errors.ts","../src/lib/output.ts","../src/commands/wallet.ts","../src/commands/status.ts","../src/commands/claim.ts","../src/commands/fees.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { Command } from \"commander\";\nimport { launch } from \"./commands/launch.js\";\nimport { wallet } from \"./commands/wallet.js\";\nimport { status } from \"./commands/status.js\";\nimport { claim } from \"./commands/claim.js\";\nimport { fees } from \"./commands/fees.js\";\n\nconst require = createRequire(import.meta.url);\nconst { version } = require(\"../package.json\") as { version: string };\n\nconst program = new Command();\n\nprogram\n .name(\"moltlaunch\")\n .description(\"CLI for AI agents to launch tokens on Base via Flaunch\")\n .version(version);\n\n// Default command: launch a token\nprogram\n .command(\"launch\", { isDefault: true })\n .description(\"Launch a new token on Base\")\n .requiredOption(\"--name <name>\", \"Token name\")\n .requiredOption(\"--symbol <symbol>\", \"Token symbol\")\n .requiredOption(\"--description <desc>\", \"Token description\")\n .requiredOption(\"--image <path>\", \"Path to token image (max 5MB)\")\n .option(\"--profile <name>\", \"Moltbook profile name (shown as creator on Flaunch)\")\n .option(\"--website <url>\", \"Website URL for the token (community, post, etc.)\")\n .option(\"--testnet\", \"Use Base Sepolia testnet\", false)\n .option(\"--json\", \"Output as JSON (for agents)\", false)\n .action((opts) => {\n launch({\n name: opts.name,\n symbol: opts.symbol,\n description: opts.description,\n imagePath: opts.image,\n profile: opts.profile,\n website: opts.website,\n testnet: opts.testnet,\n json: opts.json,\n });\n });\n\nprogram\n .command(\"wallet\")\n .description(\"Show wallet address and balance\")\n .option(\"--show-key\", \"Show private key\", false)\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) => {\n wallet({ showKey: opts.showKey, json: opts.json });\n });\n\nprogram\n .command(\"status\")\n .description(\"List launched tokens\")\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) => {\n status({ json: opts.json });\n });\n\nprogram\n .command(\"fees\")\n .description(\"Check claimable fee balance (read-only, no gas needed)\")\n .option(\"--testnet\", \"Use Base Sepolia testnet\", false)\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) => {\n fees({ testnet: opts.testnet, json: opts.json });\n });\n\nprogram\n .command(\"claim\")\n .description(\"Withdraw accumulated fees from PositionManager escrow\")\n .option(\"--testnet\", \"Use Base Sepolia testnet\", false)\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) => {\n claim({ testnet: opts.testnet, json: opts.json });\n });\n\nprogram.parse();\n","import { resolve } from \"node:path\";\nimport { access } from \"node:fs/promises\";\nimport { loadOrCreateWallet, saveLaunchRecord } from \"../lib/wallet.js\";\nimport { uploadImage, launchMemecoin, pollLaunchStatus } from \"../lib/flaunch-api.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { CHAIN, REVENUE_MANAGER_ADDRESS } from \"../lib/config.js\";\nimport { MoltlaunchError, EXIT_CODES } from \"../lib/errors.js\";\nimport type { LaunchParams, Network } from \"../types.js\";\n\nexport async function launch(opts: LaunchParams): Promise<void> {\n const { name, symbol, description, imagePath, profile, website, testnet, json } = opts;\n const network: Network = testnet ? \"testnet\" : \"mainnet\";\n const chain = testnet ? CHAIN.testnet : CHAIN.mainnet;\n\n try {\n // Validate image exists\n const resolvedImage = resolve(imagePath);\n try {\n await access(resolvedImage);\n } catch {\n printError(`Image not found: ${resolvedImage}`, json, EXIT_CODES.UPLOAD_FAIL);\n process.exit(EXIT_CODES.UPLOAD_FAIL);\n }\n\n // Step 1: Load or create wallet\n const { wallet, isNew } = await loadOrCreateWallet();\n\n if (!json) {\n if (isNew) {\n console.log(`\\nWallet created: ${wallet.address}`);\n console.log(`Private key: ${wallet.privateKey}`);\n console.log(\"(Save this key — it will not be shown again)\\n\");\n } else {\n console.log(`\\nUsing wallet: ${wallet.address}`);\n }\n }\n\n // Step 2: Upload image to IPFS\n if (!json) process.stdout.write(\"Uploading image...\");\n const imageIpfs = await uploadImage(resolvedImage);\n if (!json) console.log(` ${imageIpfs.slice(0, 16)}...`);\n\n // Step 3: Launch via Flaunch Web2 API (gasless — Flaunch handles on-chain tx)\n if (!json) process.stdout.write(\"Submitting launch...\");\n // Profile maps to twitterUrl on Flaunch (shows as creator link)\n const twitterUrl = profile\n ? `https://www.moltbook.com/u/${profile}`\n : undefined;\n\n const jobId = await launchMemecoin({\n name,\n symbol,\n description,\n imageIpfs,\n creatorAddress: wallet.address,\n revenueManagerAddress: REVENUE_MANAGER_ADDRESS,\n twitterUrl,\n websiteUrl: website,\n network,\n });\n if (!json) console.log(` queued (job ${jobId})`);\n\n // Step 4: Poll for completion\n if (!json) process.stdout.write(\"Deploying on-chain\");\n const result = await pollLaunchStatus(jobId, (state, position) => {\n if (!json) {\n if (position > 0) {\n process.stdout.write(` [queue: ${position}]`);\n } else {\n process.stdout.write(\".\");\n }\n }\n });\n if (!json) console.log(\" done\");\n\n const tokenAddress = result.collectionToken!.address;\n const flaunchUrl = `${chain.flaunchUrl}/coin/${tokenAddress}`;\n\n // Step 5: Save launch record\n await saveLaunchRecord({\n name,\n symbol,\n tokenAddress,\n transactionHash: result.transactionHash!,\n network,\n walletAddress: wallet.address,\n launchedAt: new Date().toISOString(),\n flaunchUrl,\n });\n\n // Output result\n const outputData: Record<string, unknown> = {\n tokenAddress,\n transactionHash: result.transactionHash,\n name,\n symbol,\n network: chain.name,\n explorer: `${chain.explorer}/token/${tokenAddress}`,\n flaunch: flaunchUrl,\n wallet: wallet.address,\n };\n\n if (isNew) {\n outputData.privateKey = wallet.privateKey;\n outputData.walletNote = \"Save this private key — it will not be shown again\";\n }\n\n printSuccess(\"Token launched successfully!\", outputData, json);\n } catch (error) {\n if (error instanceof MoltlaunchError) {\n printError(error.message, json, error.exitCode);\n process.exit(error.exitCode);\n }\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n","import { ethers } from \"ethers\";\nimport { readFile, writeFile, mkdir, chmod, access } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { WALLET_DIR, WALLET_FILE, LAUNCHES_FILE, CHAIN } from \"./config.js\";\nimport type { WalletData, LaunchRecord, Network } from \"../types.js\";\n\nfunction getWalletDir(): string {\n return join(homedir(), WALLET_DIR);\n}\n\nfunction getWalletPath(): string {\n return join(getWalletDir(), WALLET_FILE);\n}\n\nfunction getLaunchesPath(): string {\n return join(getWalletDir(), LAUNCHES_FILE);\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function walletExists(): Promise<boolean> {\n return fileExists(getWalletPath());\n}\n\nexport async function loadWallet(): Promise<WalletData | null> {\n const path = getWalletPath();\n if (!(await fileExists(path))) return null;\n\n const raw = await readFile(path, \"utf-8\");\n return JSON.parse(raw) as WalletData;\n}\n\nexport async function createWallet(): Promise<WalletData> {\n const wallet = ethers.Wallet.createRandom();\n const data: WalletData = {\n address: wallet.address,\n privateKey: wallet.privateKey,\n createdAt: new Date().toISOString(),\n };\n\n const dir = getWalletDir();\n await mkdir(dir, { recursive: true });\n\n const path = getWalletPath();\n await writeFile(path, JSON.stringify(data, null, 2), { mode: 0o600 });\n await chmod(path, 0o600);\n\n return data;\n}\n\nexport async function loadOrCreateWallet(): Promise<{ wallet: WalletData; isNew: boolean }> {\n const existing = await loadWallet();\n if (existing) return { wallet: existing, isNew: false };\n\n const wallet = await createWallet();\n return { wallet, isNew: true };\n}\n\nexport async function getWalletBalance(address: string, network: Network): Promise<string> {\n const chain = network === \"testnet\" ? CHAIN.testnet : CHAIN.mainnet;\n const provider = new ethers.JsonRpcProvider(chain.rpcUrl);\n const balance = await provider.getBalance(address);\n return ethers.formatEther(balance);\n}\n\nexport async function getSigner(privateKey: string, network: Network): Promise<ethers.Wallet> {\n const chain = network === \"testnet\" ? CHAIN.testnet : CHAIN.mainnet;\n const provider = new ethers.JsonRpcProvider(chain.rpcUrl);\n return new ethers.Wallet(privateKey, provider);\n}\n\nexport async function saveLaunchRecord(record: LaunchRecord): Promise<void> {\n const path = getLaunchesPath();\n let records: LaunchRecord[] = [];\n\n if (await fileExists(path)) {\n const raw = await readFile(path, \"utf-8\");\n records = JSON.parse(raw) as LaunchRecord[];\n }\n\n records.push(record);\n\n const dir = getWalletDir();\n await mkdir(dir, { recursive: true });\n await writeFile(path, JSON.stringify(records, null, 2), { mode: 0o600 });\n}\n\nexport async function loadLaunchRecords(): Promise<LaunchRecord[]> {\n const path = getLaunchesPath();\n if (!(await fileExists(path))) return [];\n\n const raw = await readFile(path, \"utf-8\");\n return JSON.parse(raw) as LaunchRecord[];\n}\n","export const REVENUE_MANAGER_ADDRESS = \"0x3Bc08524d9DaaDEC9d1Af87818d809611F0fD669\";\n\n// Flaunch PositionManager — fees accumulate here in escrow\nexport const POSITION_MANAGER_ADDRESS = \"0x51Bba15255406Cfe7099a42183302640ba7dAFDC\";\n\nexport const FLAUNCH_API_BASE = \"https://web2-api.flaunch.gg\";\n\nexport const CHAIN = {\n mainnet: {\n id: 8453,\n name: \"Base\",\n network: \"base\",\n rpcUrl: \"https://mainnet.base.org\",\n explorer: \"https://basescan.org\",\n flaunchUrl: \"https://flaunch.gg/base\",\n },\n testnet: {\n id: 84532,\n name: \"Base Sepolia\",\n network: \"base-sepolia\",\n rpcUrl: \"https://sepolia.base.org\",\n explorer: \"https://sepolia.basescan.org\",\n flaunchUrl: \"https://flaunch.gg/base-sepolia\",\n },\n} as const;\n\nexport const WALLET_DIR = \".moltlaunch\";\nexport const WALLET_FILE = \"wallet.json\";\nexport const LAUNCHES_FILE = \"launches.json\";\n\nexport const MAX_IMAGE_SIZE_BYTES = 5 * 1024 * 1024; // 5MB\nexport const POLL_INTERVAL_MS = 2000;\nexport const POLL_TIMEOUT_MS = 120_000;\n","import { readFile, stat } from \"node:fs/promises\";\nimport {\n FLAUNCH_API_BASE,\n CHAIN,\n MAX_IMAGE_SIZE_BYTES,\n POLL_INTERVAL_MS,\n POLL_TIMEOUT_MS,\n} from \"./config.js\";\nimport { UploadError, LaunchError, TimeoutError } from \"./errors.js\";\nimport type {\n Network,\n FlaunchUploadResponse,\n FlaunchLaunchResponse,\n FlaunchStatusResponse,\n} from \"../types.js\";\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function fetchWithRetry(\n url: string,\n options: RequestInit,\n retries = 3,\n): Promise<Response> {\n for (let attempt = 0; attempt < retries; attempt++) {\n const response = await fetch(url, options);\n\n if (response.status === 429) {\n const retryAfter = response.headers.get(\"retry-after\");\n const waitMs = retryAfter ? parseInt(retryAfter, 10) * 1000 : 2000 * (attempt + 1);\n await sleep(waitMs);\n continue;\n }\n\n return response;\n }\n\n throw new Error(\"Max retries exceeded (429 rate limit)\");\n}\n\n/**\n * Upload image to IPFS via Flaunch Web2 API.\n * Reads file as base64 data URL, returns IPFS hash.\n */\nexport async function uploadImage(imagePath: string): Promise<string> {\n const fileStat = await stat(imagePath);\n if (fileStat.size > MAX_IMAGE_SIZE_BYTES) {\n throw new UploadError(`Image exceeds 5MB limit (${(fileStat.size / 1024 / 1024).toFixed(1)}MB)`);\n }\n\n const imageBuffer = await readFile(imagePath);\n const base64 = imageBuffer.toString(\"base64\");\n\n const ext = imagePath.split(\".\").pop()?.toLowerCase();\n const mimeMap: Record<string, string> = {\n png: \"image/png\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n svg: \"image/svg+xml\",\n };\n const mime = mimeMap[ext ?? \"\"] ?? \"image/png\";\n const dataUrl = `data:${mime};base64,${base64}`;\n\n const response = await fetchWithRetry(`${FLAUNCH_API_BASE}/api/v1/upload-image`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ base64Image: dataUrl }),\n });\n\n if (!response.ok) {\n const text = await response.text();\n throw new UploadError(`${response.status} — ${text}`);\n }\n\n const data = (await response.json()) as FlaunchUploadResponse;\n return data.ipfsHash;\n}\n\n/**\n * Launch a memecoin via Flaunch Web2 API.\n * This is gasless — Flaunch handles the on-chain transaction server-side.\n */\nexport async function launchMemecoin(params: {\n name: string;\n symbol: string;\n description: string;\n imageIpfs: string;\n creatorAddress: string;\n revenueManagerAddress?: string;\n twitterUrl?: string;\n websiteUrl?: string;\n network: Network;\n}): Promise<string> {\n const chain = params.network === \"testnet\" ? CHAIN.testnet : CHAIN.mainnet;\n\n const body: Record<string, string | undefined> = {\n name: params.name,\n symbol: params.symbol,\n description: params.description,\n imageIpfs: params.imageIpfs,\n creatorAddress: params.creatorAddress,\n revenueManagerAddress: params.revenueManagerAddress,\n twitterUrl: params.twitterUrl,\n websiteUrl: params.websiteUrl,\n };\n\n // Strip undefined values so we don't send nulls to the API\n for (const key of Object.keys(body)) {\n if (body[key] === undefined) delete body[key];\n }\n\n const response = await fetchWithRetry(\n `${FLAUNCH_API_BASE}/api/v1/${chain.network}/launch-memecoin`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n },\n );\n\n if (!response.ok) {\n const text = await response.text();\n throw new LaunchError(`${response.status} — ${text}`);\n }\n\n const data = (await response.json()) as FlaunchLaunchResponse;\n return data.jobId;\n}\n\n/**\n * Poll launch status until completed or failed.\n */\nexport async function pollLaunchStatus(\n jobId: string,\n onPoll?: (state: string, position: number) => void,\n): Promise<FlaunchStatusResponse> {\n const startTime = Date.now();\n\n while (Date.now() - startTime < POLL_TIMEOUT_MS) {\n const response = await fetch(`${FLAUNCH_API_BASE}/api/v1/launch-status/${jobId}`);\n\n if (!response.ok) {\n const text = await response.text();\n throw new LaunchError(`Status check failed: ${response.status} — ${text}`);\n }\n\n const data = (await response.json()) as FlaunchStatusResponse;\n onPoll?.(data.state, data.queuePosition);\n\n if (data.state === \"completed\") return data;\n if (data.state === \"failed\") {\n throw new LaunchError(data.error ?? \"Launch failed with no error message\");\n }\n\n await sleep(POLL_INTERVAL_MS);\n }\n\n throw new TimeoutError();\n}\n","export const EXIT_CODES = {\n SUCCESS: 0,\n GENERAL: 1,\n NO_WALLET: 2,\n UPLOAD_FAIL: 3,\n LAUNCH_FAIL: 4,\n TIMEOUT: 5,\n NO_GAS: 6,\n} as const;\n\nexport class MoltlaunchError extends Error {\n constructor(\n message: string,\n public readonly exitCode: number,\n ) {\n super(message);\n this.name = \"MoltlaunchError\";\n }\n}\n\nexport class NoWalletError extends MoltlaunchError {\n constructor() {\n super(\"No wallet found. Run `moltlaunch` to create one.\", EXIT_CODES.NO_WALLET);\n }\n}\n\nexport class UploadError extends MoltlaunchError {\n constructor(detail: string) {\n super(`Image upload failed: ${detail}`, EXIT_CODES.UPLOAD_FAIL);\n }\n}\n\nexport class LaunchError extends MoltlaunchError {\n constructor(detail: string) {\n super(`Token launch failed: ${detail}`, EXIT_CODES.LAUNCH_FAIL);\n }\n}\n\nexport class TimeoutError extends MoltlaunchError {\n constructor() {\n super(\"Launch timed out waiting for confirmation.\", EXIT_CODES.TIMEOUT);\n }\n}\n\nexport class NoGasError extends MoltlaunchError {\n constructor(address: string) {\n super(\n `Wallet ${address} has no ETH for gas. Send Base ETH to this address and retry.`,\n EXIT_CODES.NO_GAS,\n );\n }\n}\n","export function formatOutput(data: Record<string, unknown>, json: boolean): string {\n if (json) {\n return JSON.stringify(data, null, 2);\n }\n\n const lines: string[] = [];\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined || value === null) continue;\n const label = key.replace(/([A-Z])/g, \" $1\").replace(/^./, (s) => s.toUpperCase());\n lines.push(` ${label}: ${String(value)}`);\n }\n return lines.join(\"\\n\");\n}\n\nexport function printSuccess(message: string, data: Record<string, unknown>, json: boolean): void {\n if (json) {\n console.log(JSON.stringify({ success: true, ...data }, null, 2));\n } else {\n console.log(`\\n${message}\\n`);\n console.log(formatOutput(data, false));\n console.log();\n }\n}\n\nexport function printError(message: string, json: boolean, exitCode: number): void {\n if (json) {\n console.error(JSON.stringify({ success: false, error: message, exitCode }));\n } else {\n console.error(`\\nError: ${message}\\n`);\n }\n}\n","import { loadWallet, getWalletBalance } from \"../lib/wallet.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { EXIT_CODES } from \"../lib/errors.js\";\n\ninterface WalletOpts {\n showKey: boolean;\n json: boolean;\n}\n\nexport async function wallet(opts: WalletOpts): Promise<void> {\n const { showKey, json } = opts;\n\n const data = await loadWallet();\n if (!data) {\n printError(\"No wallet found. Run `moltlaunch` to create one.\", json, EXIT_CODES.NO_WALLET);\n process.exit(EXIT_CODES.NO_WALLET);\n }\n\n let balance = \"unknown\";\n try {\n balance = await getWalletBalance(data.address, \"mainnet\");\n } catch {\n // RPC may be unreachable\n }\n\n const output: Record<string, unknown> = {\n address: data.address,\n balance: json ? balance : `${balance} ETH (Base)`,\n network: json ? \"Base\" : undefined,\n createdAt: data.createdAt,\n };\n\n if (showKey) {\n output.privateKey = data.privateKey;\n }\n\n printSuccess(\"Wallet info\", output, json);\n}\n","import { loadLaunchRecords } from \"../lib/wallet.js\";\n\ninterface StatusOpts {\n json: boolean;\n}\n\nexport async function status(opts: StatusOpts): Promise<void> {\n const { json } = opts;\n const records = await loadLaunchRecords();\n\n if (records.length === 0) {\n if (json) {\n console.log(JSON.stringify({ success: true, launches: [] }));\n } else {\n console.log(\"\\nNo tokens launched yet. Run `moltlaunch` to launch one.\\n\");\n }\n return;\n }\n\n if (json) {\n console.log(JSON.stringify({ success: true, launches: records }, null, 2));\n return;\n }\n\n console.log(`\\nLaunched tokens (${records.length}):\\n`);\n for (const record of records) {\n console.log(` ${record.name} (${record.symbol})`);\n console.log(` Token: ${record.tokenAddress}`);\n console.log(` TX: ${record.transactionHash}`);\n console.log(` Flaunch: ${record.flaunchUrl}`);\n console.log(` Network: ${record.network}`);\n console.log(` Launched: ${record.launchedAt}`);\n console.log();\n }\n}\n","import { ethers } from \"ethers\";\nimport { loadWallet, getSigner, getWalletBalance } from \"../lib/wallet.js\";\nimport { POSITION_MANAGER_ADDRESS } from \"../lib/config.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { EXIT_CODES, NoWalletError, NoGasError, MoltlaunchError } from \"../lib/errors.js\";\nimport type { Network } from \"../types.js\";\n\n// Fees accumulate in escrow on the PositionManager, not on the Revenue Manager\nconst POSITION_MANAGER_ABI = [\n \"function balances(address) external view returns (uint256)\",\n \"function withdrawFees(address _recipient, bool _unwrap) external\",\n];\n\ninterface ClaimOpts {\n testnet: boolean;\n json: boolean;\n}\n\nexport async function claim(opts: ClaimOpts): Promise<void> {\n const { testnet, json } = opts;\n const network: Network = testnet ? \"testnet\" : \"mainnet\";\n\n try {\n const walletData = await loadWallet();\n if (!walletData) {\n throw new NoWalletError();\n }\n\n // Check gas balance\n const balance = await getWalletBalance(walletData.address, network);\n if (parseFloat(balance) === 0) {\n throw new NoGasError(walletData.address);\n }\n\n const signer = await getSigner(walletData.privateKey, network);\n const pm = new ethers.Contract(POSITION_MANAGER_ADDRESS, POSITION_MANAGER_ABI, signer);\n\n // Check claimable balance\n const claimable = await pm.balances(walletData.address);\n const claimableEth = ethers.formatEther(claimable);\n\n if (claimable === 0n) {\n printSuccess(\"No fees to claim\", {\n claimable: \"0 ETH\",\n wallet: walletData.address,\n network,\n }, json);\n return;\n }\n\n if (!json) console.log(`\\nClaimable: ${claimableEth} ETH`);\n if (!json) process.stdout.write(\"Submitting withdraw transaction...\");\n\n // withdrawFees sends to _recipient, _unwrap=true converts flETH→ETH\n const tx = await pm.withdrawFees(walletData.address, true);\n if (!json) console.log(` tx ${tx.hash}`);\n\n if (!json) process.stdout.write(\"Waiting for confirmation...\");\n const receipt = await tx.wait();\n if (!json) console.log(\" confirmed\");\n\n printSuccess(\"Fees claimed successfully!\", {\n transactionHash: receipt.hash,\n claimed: `${claimableEth} ETH`,\n wallet: walletData.address,\n network,\n }, json);\n } catch (error) {\n if (error instanceof MoltlaunchError) {\n printError(error.message, json, error.exitCode);\n process.exit(error.exitCode);\n }\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n","import { ethers } from \"ethers\";\nimport { loadWallet, getWalletBalance } from \"../lib/wallet.js\";\nimport { POSITION_MANAGER_ADDRESS, CHAIN } from \"../lib/config.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { EXIT_CODES, NoWalletError, MoltlaunchError } from \"../lib/errors.js\";\nimport type { Network } from \"../types.js\";\n\nconst POSITION_MANAGER_ABI = [\n \"function balances(address) external view returns (uint256)\",\n];\n\ninterface FeesOpts {\n testnet: boolean;\n json: boolean;\n}\n\nexport async function fees(opts: FeesOpts): Promise<void> {\n const { testnet, json } = opts;\n const network: Network = testnet ? \"testnet\" : \"mainnet\";\n\n try {\n const walletData = await loadWallet();\n if (!walletData) {\n throw new NoWalletError();\n }\n\n const chain = testnet ? CHAIN.testnet : CHAIN.mainnet;\n const provider = new ethers.JsonRpcProvider(chain.rpcUrl);\n const pm = new ethers.Contract(POSITION_MANAGER_ADDRESS, POSITION_MANAGER_ABI, provider);\n\n const claimable = await pm.balances(walletData.address);\n const claimableEth = ethers.formatEther(claimable);\n\n const walletBalance = await getWalletBalance(walletData.address, network);\n const hasGas = parseFloat(walletBalance) > 0;\n\n printSuccess(\"Fee balance\", {\n claimable: `${claimableEth} ETH`,\n wallet: walletData.address,\n walletBalance: `${walletBalance} ETH`,\n hasGas,\n network: chain.name,\n canClaim: hasGas && claimable > 0n,\n }, json);\n } catch (error) {\n if (error instanceof MoltlaunchError) {\n printError(error.message, json, error.exitCode);\n process.exit(error.exitCode);\n }\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;;;ACDxB,SAAS,eAAe;AACxB,SAAS,UAAAA,eAAc;;;ACDvB,SAAS,cAAc;AACvB,SAAS,UAAU,WAAW,OAAO,OAAO,cAAc;AAC1D,SAAS,YAAY;AACrB,SAAS,eAAe;;;ACHjB,IAAM,0BAA0B;AAGhC,IAAM,2BAA2B;AAEjC,IAAM,mBAAmB;AAEzB,IAAM,QAAQ;AAAA,EACnB,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AACF;AAEO,IAAM,aAAa;AACnB,IAAM,cAAc;AACpB,IAAM,gBAAgB;AAEtB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MANAGER_ABI","ethers","require"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/launch.ts","../src/lib/wallet.ts","../src/lib/config.ts","../src/lib/flaunch-api.ts","../src/lib/errors.ts","../src/lib/generate-logo.ts","../src/lib/output.ts","../src/commands/wallet.ts","../src/commands/status.ts","../src/commands/claim.ts","../src/commands/fees.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { Command } from \"commander\";\nimport { launch } from \"./commands/launch.js\";\nimport { wallet } from \"./commands/wallet.js\";\nimport { status } from \"./commands/status.js\";\nimport { claim } from \"./commands/claim.js\";\nimport { fees } from \"./commands/fees.js\";\n\nconst require = createRequire(import.meta.url);\nconst { version } = require(\"../package.json\") as { version: string };\n\nconst program = new Command();\n\nprogram\n .name(\"moltlaunch\")\n .description(\"CLI for AI agents to launch tokens on Base via Flaunch\")\n .version(version);\n\n// Default command: launch a token\nprogram\n .command(\"launch\", { isDefault: true })\n .description(\"Launch a new token on Base\")\n .requiredOption(\"--name <name>\", \"Token name\")\n .requiredOption(\"--symbol <symbol>\", \"Token symbol\")\n .requiredOption(\"--description <desc>\", \"Token description\")\n .option(\"--image <path>\", \"Path to token image (max 5MB, uses default logo if omitted)\")\n .option(\"--profile <name>\", \"Moltbook profile name (shown as creator on Flaunch)\")\n .option(\"--website <url>\", \"Website URL for the token (community, post, etc.)\")\n .option(\"--testnet\", \"Use Base Sepolia testnet\", false)\n .option(\"--json\", \"Output as JSON (for agents)\", false)\n .action((opts) =>\n launch({\n name: opts.name,\n symbol: opts.symbol,\n description: opts.description,\n imagePath: opts.image ?? undefined,\n profile: opts.profile,\n website: opts.website,\n testnet: opts.testnet,\n json: opts.json,\n })\n );\n\nprogram\n .command(\"wallet\")\n .description(\"Show wallet address and balance\")\n .option(\"--show-key\", \"Show private key\", false)\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) =>\n wallet({ showKey: opts.showKey, json: opts.json })\n );\n\nprogram\n .command(\"status\")\n .description(\"List launched tokens\")\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) =>\n status({ json: opts.json })\n );\n\nprogram\n .command(\"fees\")\n .description(\"Check claimable fee balance (read-only, no gas needed)\")\n .option(\"--testnet\", \"Use Base Sepolia testnet\", false)\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) =>\n fees({ testnet: opts.testnet, json: opts.json })\n );\n\nprogram\n .command(\"claim\")\n .description(\"Withdraw accumulated fees from PositionManager escrow\")\n .option(\"--testnet\", \"Use Base Sepolia testnet\", false)\n .option(\"--json\", \"Output as JSON\", false)\n .action((opts) =>\n claim({ testnet: opts.testnet, json: opts.json })\n );\n\nprogram.parse();\n","import { resolve } from \"node:path\";\nimport { access } from \"node:fs/promises\";\nimport { loadOrCreateWallet, saveLaunchRecord } from \"../lib/wallet.js\";\nimport { uploadImage, launchMemecoin, pollLaunchStatus } from \"../lib/flaunch-api.js\";\nimport { generateTokenLogo } from \"../lib/generate-logo.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { CHAIN, REVENUE_MANAGER_ADDRESS } from \"../lib/config.js\";\nimport { MoltlaunchError, EXIT_CODES } from \"../lib/errors.js\";\nimport type { LaunchParams, Network } from \"../types.js\";\n\nexport async function launch(opts: LaunchParams): Promise<void> {\n const { name, symbol, description, profile, website, testnet, json } = opts;\n const network: Network = testnet ? \"testnet\" : \"mainnet\";\n const chain = testnet ? CHAIN.testnet : CHAIN.mainnet;\n\n try {\n // Resolve image: use provided path or generate a unique one\n let imageSource: string | { buffer: Buffer; mime: string };\n\n if (opts.imagePath) {\n const resolvedImage = resolve(opts.imagePath);\n try {\n await access(resolvedImage);\n } catch {\n printError(`Image not found: ${resolvedImage}`, json, EXIT_CODES.UPLOAD_FAIL);\n process.exit(EXIT_CODES.UPLOAD_FAIL);\n }\n imageSource = resolvedImage;\n } else {\n if (!json) console.log(\"Generating unique logo from token name...\");\n imageSource = { buffer: generateTokenLogo(name, symbol), mime: \"image/png\" };\n }\n\n // Step 1: Load or create wallet\n const { wallet, isNew } = await loadOrCreateWallet();\n\n if (!json) {\n if (isNew) {\n console.log(`\\nWallet created: ${wallet.address}`);\n console.log(`Private key: ${wallet.privateKey}`);\n console.log(\"(Save this key — it will not be shown again)\\n\");\n } else {\n console.log(`\\nUsing wallet: ${wallet.address}`);\n }\n }\n\n // Step 2: Upload image to IPFS\n if (!json) process.stdout.write(\"Uploading image...\");\n const imageIpfs = await uploadImage(imageSource);\n if (!json) console.log(` ${imageIpfs.slice(0, 16)}...`);\n\n // Step 3: Launch via Flaunch Web2 API (gasless — Flaunch handles on-chain tx)\n if (!json) process.stdout.write(\"Submitting launch...\");\n // Profile maps to twitterUrl on Flaunch (shows as creator link)\n const twitterUrl = profile\n ? `https://www.moltbook.com/u/${profile}`\n : undefined;\n\n const jobId = await launchMemecoin({\n name,\n symbol,\n description,\n imageIpfs,\n creatorAddress: wallet.address,\n revenueManagerAddress: REVENUE_MANAGER_ADDRESS,\n twitterUrl,\n websiteUrl: website,\n network,\n });\n if (!json) console.log(` queued (job ${jobId})`);\n\n // Step 4: Poll for completion\n if (!json) process.stdout.write(\"Deploying on-chain\");\n const result = await pollLaunchStatus(jobId, (state, position) => {\n if (!json) {\n if (position > 0) {\n process.stdout.write(` [queue: ${position}]`);\n } else {\n process.stdout.write(\".\");\n }\n }\n });\n if (!json) console.log(\" done\");\n\n if (!result.collectionToken?.address || !result.transactionHash) {\n throw new MoltlaunchError(\n \"Launch completed but missing token address or transaction hash\",\n EXIT_CODES.LAUNCH_FAIL,\n );\n }\n\n const tokenAddress = result.collectionToken.address;\n const flaunchUrl = `${chain.flaunchUrl}/coin/${tokenAddress}`;\n\n // Step 5: Save launch record\n await saveLaunchRecord({\n name,\n symbol,\n tokenAddress,\n transactionHash: result.transactionHash,\n network,\n walletAddress: wallet.address,\n launchedAt: new Date().toISOString(),\n flaunchUrl,\n });\n\n // Output result\n const outputData: Record<string, unknown> = {\n tokenAddress,\n transactionHash: result.transactionHash,\n name,\n symbol,\n network: chain.name,\n explorer: `${chain.explorer}/token/${tokenAddress}`,\n flaunch: flaunchUrl,\n wallet: wallet.address,\n };\n\n if (isNew) {\n outputData.privateKey = wallet.privateKey;\n outputData.walletNote = \"Save this private key — it will not be shown again\";\n }\n\n printSuccess(\"Token launched successfully!\", outputData, json);\n } catch (error) {\n if (error instanceof MoltlaunchError) {\n printError(error.message, json, error.exitCode);\n process.exit(error.exitCode);\n }\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n","import { ethers } from \"ethers\";\nimport { readFile, writeFile, mkdir, chmod, access } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { WALLET_DIR, WALLET_FILE, LAUNCHES_FILE, CHAIN } from \"./config.js\";\nimport type { WalletData, LaunchRecord, Network } from \"../types.js\";\n\nfunction getWalletDir(): string {\n return join(homedir(), WALLET_DIR);\n}\n\nfunction getWalletPath(): string {\n return join(getWalletDir(), WALLET_FILE);\n}\n\nfunction getLaunchesPath(): string {\n return join(getWalletDir(), LAUNCHES_FILE);\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function walletExists(): Promise<boolean> {\n return fileExists(getWalletPath());\n}\n\nexport async function loadWallet(): Promise<WalletData | null> {\n const path = getWalletPath();\n if (!(await fileExists(path))) return null;\n\n const raw = await readFile(path, \"utf-8\");\n return JSON.parse(raw) as WalletData;\n}\n\nexport async function createWallet(): Promise<WalletData> {\n const wallet = ethers.Wallet.createRandom();\n const data: WalletData = {\n address: wallet.address,\n privateKey: wallet.privateKey,\n createdAt: new Date().toISOString(),\n };\n\n const dir = getWalletDir();\n await mkdir(dir, { recursive: true, mode: 0o700 });\n await chmod(dir, 0o700);\n\n const path = getWalletPath();\n await writeFile(path, JSON.stringify(data, null, 2), { mode: 0o600 });\n await chmod(path, 0o600);\n\n return data;\n}\n\nexport async function loadOrCreateWallet(): Promise<{ wallet: WalletData; isNew: boolean }> {\n const existing = await loadWallet();\n if (existing) return { wallet: existing, isNew: false };\n\n const wallet = await createWallet();\n return { wallet, isNew: true };\n}\n\nexport async function getWalletBalance(address: string, network: Network): Promise<string> {\n const chain = network === \"testnet\" ? CHAIN.testnet : CHAIN.mainnet;\n const provider = new ethers.JsonRpcProvider(chain.rpcUrl);\n const balance = await provider.getBalance(address);\n return ethers.formatEther(balance);\n}\n\nexport async function getSigner(privateKey: string, network: Network): Promise<ethers.Wallet> {\n const chain = network === \"testnet\" ? CHAIN.testnet : CHAIN.mainnet;\n const provider = new ethers.JsonRpcProvider(chain.rpcUrl);\n return new ethers.Wallet(privateKey, provider);\n}\n\nexport async function saveLaunchRecord(record: LaunchRecord): Promise<void> {\n const path = getLaunchesPath();\n let records: LaunchRecord[] = [];\n\n if (await fileExists(path)) {\n const raw = await readFile(path, \"utf-8\");\n records = JSON.parse(raw) as LaunchRecord[];\n }\n\n records.push(record);\n\n const dir = getWalletDir();\n await mkdir(dir, { recursive: true });\n await writeFile(path, JSON.stringify(records, null, 2), { mode: 0o600 });\n}\n\nexport async function loadLaunchRecords(): Promise<LaunchRecord[]> {\n const path = getLaunchesPath();\n if (!(await fileExists(path))) return [];\n\n const raw = await readFile(path, \"utf-8\");\n return JSON.parse(raw) as LaunchRecord[];\n}\n","export const REVENUE_MANAGER_ADDRESS = \"0x3Bc08524d9DaaDEC9d1Af87818d809611F0fD669\";\n\n// Flaunch PositionManager — fees accumulate here in escrow\nexport const POSITION_MANAGER_ADDRESS = \"0x51Bba15255406Cfe7099a42183302640ba7dAFDC\";\n\nexport const FLAUNCH_API_BASE = \"https://web2-api.flaunch.gg\";\n\nexport const CHAIN = {\n mainnet: {\n id: 8453,\n name: \"Base\",\n network: \"base\",\n rpcUrl: \"https://mainnet.base.org\",\n explorer: \"https://basescan.org\",\n flaunchUrl: \"https://flaunch.gg/base\",\n },\n testnet: {\n id: 84532,\n name: \"Base Sepolia\",\n network: \"base-sepolia\",\n rpcUrl: \"https://sepolia.base.org\",\n explorer: \"https://sepolia.basescan.org\",\n flaunchUrl: \"https://flaunch.gg/base-sepolia\",\n },\n} as const;\n\nexport const WALLET_DIR = \".moltlaunch\";\nexport const WALLET_FILE = \"wallet.json\";\nexport const LAUNCHES_FILE = \"launches.json\";\n\nexport const MAX_IMAGE_SIZE_BYTES = 5 * 1024 * 1024; // 5MB\nexport const POLL_INTERVAL_MS = 2000;\nexport const POLL_TIMEOUT_MS = 120_000;\n","import { readFile, stat } from \"node:fs/promises\";\nimport {\n FLAUNCH_API_BASE,\n CHAIN,\n MAX_IMAGE_SIZE_BYTES,\n POLL_INTERVAL_MS,\n POLL_TIMEOUT_MS,\n} from \"./config.js\";\nimport { UploadError, LaunchError, TimeoutError } from \"./errors.js\";\nimport type {\n Network,\n FlaunchUploadResponse,\n FlaunchLaunchResponse,\n FlaunchStatusResponse,\n} from \"../types.js\";\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function fetchWithRetry(\n url: string,\n options: RequestInit,\n retries = 3,\n): Promise<Response> {\n for (let attempt = 0; attempt < retries; attempt++) {\n const response = await fetch(url, options);\n\n if (response.status === 429) {\n const retryAfter = response.headers.get(\"retry-after\");\n const waitMs = retryAfter ? parseInt(retryAfter, 10) * 1000 : 2000 * (attempt + 1);\n await sleep(waitMs);\n continue;\n }\n\n return response;\n }\n\n throw new Error(\"Max retries exceeded (429 rate limit)\");\n}\n\n/**\n * Upload image to IPFS via Flaunch Web2 API.\n * Accepts a file path or a {buffer, mime} object for generated images.\n */\nexport async function uploadImage(\n source: string | { buffer: Buffer; mime: string },\n): Promise<string> {\n let base64: string;\n let mime: string;\n\n if (typeof source === \"string\") {\n const fileStat = await stat(source);\n if (fileStat.size > MAX_IMAGE_SIZE_BYTES) {\n throw new UploadError(`Image exceeds 5MB limit (${(fileStat.size / 1024 / 1024).toFixed(1)}MB)`);\n }\n\n const imageBuffer = await readFile(source);\n base64 = imageBuffer.toString(\"base64\");\n\n const ext = source.split(\".\").pop()?.toLowerCase();\n const mimeMap: Record<string, string> = {\n png: \"image/png\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n svg: \"image/svg+xml\",\n };\n mime = mimeMap[ext ?? \"\"] ?? \"image/png\";\n } else {\n base64 = source.buffer.toString(\"base64\");\n mime = source.mime;\n }\n\n const dataUrl = `data:${mime};base64,${base64}`;\n\n const response = await fetchWithRetry(`${FLAUNCH_API_BASE}/api/v1/upload-image`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ base64Image: dataUrl }),\n });\n\n if (!response.ok) {\n const text = await response.text();\n throw new UploadError(`${response.status} — ${text}`);\n }\n\n const data = (await response.json()) as FlaunchUploadResponse;\n return data.ipfsHash;\n}\n\n/**\n * Launch a memecoin via Flaunch Web2 API.\n * This is gasless — Flaunch handles the on-chain transaction server-side.\n */\nexport async function launchMemecoin(params: {\n name: string;\n symbol: string;\n description: string;\n imageIpfs: string;\n creatorAddress: string;\n revenueManagerAddress?: string;\n twitterUrl?: string;\n websiteUrl?: string;\n network: Network;\n}): Promise<string> {\n const chain = params.network === \"testnet\" ? CHAIN.testnet : CHAIN.mainnet;\n\n const body: Record<string, string | undefined> = {\n name: params.name,\n symbol: params.symbol,\n description: params.description,\n imageIpfs: params.imageIpfs,\n creatorAddress: params.creatorAddress,\n revenueManagerAddress: params.revenueManagerAddress,\n twitterUrl: params.twitterUrl,\n websiteUrl: params.websiteUrl,\n };\n\n // Strip undefined values so we don't send nulls to the API\n for (const key of Object.keys(body)) {\n if (body[key] === undefined) delete body[key];\n }\n\n const response = await fetchWithRetry(\n `${FLAUNCH_API_BASE}/api/v1/${chain.network}/launch-memecoin`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n },\n );\n\n if (!response.ok) {\n const text = await response.text();\n throw new LaunchError(`${response.status} — ${text}`);\n }\n\n const data = (await response.json()) as FlaunchLaunchResponse;\n return data.jobId;\n}\n\n/**\n * Poll launch status until completed or failed.\n */\nexport async function pollLaunchStatus(\n jobId: string,\n onPoll?: (state: string, position: number) => void,\n): Promise<FlaunchStatusResponse> {\n const startTime = Date.now();\n\n let consecutiveErrors = 0;\n\n while (Date.now() - startTime < POLL_TIMEOUT_MS) {\n let response: Response;\n try {\n response = await fetch(`${FLAUNCH_API_BASE}/api/v1/launch-status/${jobId}`);\n } catch {\n // Network error — retry up to 5 times before giving up\n consecutiveErrors++;\n if (consecutiveErrors >= 5) {\n throw new LaunchError(\"Lost connection to Flaunch API during deployment\");\n }\n await sleep(POLL_INTERVAL_MS);\n continue;\n }\n\n if (response.status === 429 || response.status >= 500) {\n consecutiveErrors++;\n if (consecutiveErrors >= 5) {\n throw new LaunchError(`Status check failed after retries: ${response.status}`);\n }\n await sleep(POLL_INTERVAL_MS * (consecutiveErrors + 1));\n continue;\n }\n\n if (!response.ok) {\n const text = await response.text();\n throw new LaunchError(`Status check failed: ${response.status} — ${text}`);\n }\n\n consecutiveErrors = 0;\n const data = (await response.json()) as FlaunchStatusResponse;\n onPoll?.(data.state, data.queuePosition);\n\n if (data.state === \"completed\") return data;\n if (data.state === \"failed\") {\n throw new LaunchError(data.error ?? \"Launch failed with no error message\");\n }\n\n await sleep(POLL_INTERVAL_MS);\n }\n\n throw new TimeoutError();\n}\n","export const EXIT_CODES = {\n SUCCESS: 0,\n GENERAL: 1,\n NO_WALLET: 2,\n UPLOAD_FAIL: 3,\n LAUNCH_FAIL: 4,\n TIMEOUT: 5,\n NO_GAS: 6,\n} as const;\n\nexport class MoltlaunchError extends Error {\n constructor(\n message: string,\n public readonly exitCode: number,\n ) {\n super(message);\n this.name = \"MoltlaunchError\";\n }\n}\n\nexport class NoWalletError extends MoltlaunchError {\n constructor() {\n super(\"No wallet found. Run `moltlaunch` to create one.\", EXIT_CODES.NO_WALLET);\n }\n}\n\nexport class UploadError extends MoltlaunchError {\n constructor(detail: string) {\n super(`Image upload failed: ${detail}`, EXIT_CODES.UPLOAD_FAIL);\n }\n}\n\nexport class LaunchError extends MoltlaunchError {\n constructor(detail: string) {\n super(`Token launch failed: ${detail}`, EXIT_CODES.LAUNCH_FAIL);\n }\n}\n\nexport class TimeoutError extends MoltlaunchError {\n constructor() {\n super(\"Launch timed out waiting for confirmation.\", EXIT_CODES.TIMEOUT);\n }\n}\n\nexport class NoGasError extends MoltlaunchError {\n constructor(address: string) {\n super(\n `Wallet ${address} has no ETH for gas. Send Base ETH to this address and retry.`,\n EXIT_CODES.NO_GAS,\n );\n }\n}\n","/**\n * Generate a unique token logo PNG from the token name and symbol.\n * Zero external dependencies — produces a valid PNG using raw pixel data + zlib.\n * Deterministic: same inputs always produce the same image.\n */\n\nimport { deflateSync } from \"node:zlib\";\n\nconst SIZE = 512;\n\nfunction hashString(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;\n }\n return Math.abs(hash);\n}\n\nfunction mulberry32(seed: number): () => number {\n let s = seed | 0;\n return () => {\n s = (s + 0x6d2b79f5) | 0;\n let t = Math.imul(s ^ (s >>> 15), 1 | s);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\ninterface RGB {\n r: number;\n g: number;\n b: number;\n}\n\nfunction hslToRgb(h: number, s: number, l: number): RGB {\n const a = s * Math.min(l, 1 - l);\n const f = (n: number) => {\n const k = (n + h / 30) % 12;\n return l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n };\n return {\n r: Math.round(255 * f(0)),\n g: Math.round(255 * f(8)),\n b: Math.round(255 * f(4)),\n };\n}\n\nfunction lerpColor(c1: RGB, c2: RGB, t: number): RGB {\n return {\n r: Math.round(c1.r + (c2.r - c1.r) * t),\n g: Math.round(c1.g + (c2.g - c1.g) * t),\n b: Math.round(c1.b + (c2.b - c1.b) * t),\n };\n}\n\nfunction blendColor(base: RGB, overlay: RGB, alpha: number): RGB {\n return {\n r: Math.round(base.r * (1 - alpha) + overlay.r * alpha),\n g: Math.round(base.g * (1 - alpha) + overlay.g * alpha),\n b: Math.round(base.b * (1 - alpha) + overlay.b * alpha),\n };\n}\n\n/** Generate a 7x7 vertically symmetric pattern */\nfunction generatePattern(rand: () => number): boolean[][] {\n const grid: boolean[][] = [];\n for (let row = 0; row < 7; row++) {\n grid[row] = [];\n for (let col = 0; col < 4; col++) {\n grid[row][col] = rand() > 0.5;\n }\n // Mirror horizontally\n grid[row][4] = grid[row][2];\n grid[row][5] = grid[row][1];\n grid[row][6] = grid[row][0];\n }\n return grid;\n}\n\n/** Encode raw RGBA pixels into a minimal PNG file */\nfunction encodePng(width: number, height: number, pixels: Buffer): Buffer {\n // Build raw image data with filter byte (0 = None) per row\n const rawData = Buffer.alloc(height * (1 + width * 3));\n for (let y = 0; y < height; y++) {\n const rowOffset = y * (1 + width * 3);\n rawData[rowOffset] = 0; // filter: None\n for (let x = 0; x < width; x++) {\n const srcIdx = (y * width + x) * 3;\n const dstIdx = rowOffset + 1 + x * 3;\n rawData[dstIdx] = pixels[srcIdx];\n rawData[dstIdx + 1] = pixels[srcIdx + 1];\n rawData[dstIdx + 2] = pixels[srcIdx + 2];\n }\n }\n\n const compressed = deflateSync(rawData);\n\n // PNG signature\n const signature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);\n\n // IHDR chunk\n const ihdrData = Buffer.alloc(13);\n ihdrData.writeUInt32BE(width, 0);\n ihdrData.writeUInt32BE(height, 4);\n ihdrData[8] = 8; // bit depth\n ihdrData[9] = 2; // color type: RGB\n ihdrData[10] = 0; // compression\n ihdrData[11] = 0; // filter\n ihdrData[12] = 0; // interlace\n const ihdr = makeChunk(\"IHDR\", ihdrData);\n\n // IDAT chunk\n const idat = makeChunk(\"IDAT\", compressed);\n\n // IEND chunk\n const iend = makeChunk(\"IEND\", Buffer.alloc(0));\n\n return Buffer.concat([signature, ihdr, idat, iend]);\n}\n\nfunction makeChunk(type: string, data: Buffer): Buffer {\n const length = Buffer.alloc(4);\n length.writeUInt32BE(data.length, 0);\n\n const typeBytes = Buffer.from(type, \"ascii\");\n const crcInput = Buffer.concat([typeBytes, data]);\n const crc = Buffer.alloc(4);\n crc.writeUInt32BE(crc32(crcInput), 0);\n\n return Buffer.concat([length, typeBytes, data, crc]);\n}\n\nfunction crc32(buf: Buffer): number {\n let crc = 0xffffffff;\n for (let i = 0; i < buf.length; i++) {\n crc ^= buf[i];\n for (let j = 0; j < 8; j++) {\n crc = crc & 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1;\n }\n }\n return (crc ^ 0xffffffff) >>> 0;\n}\n\nexport function generateTokenLogo(name: string, symbol: string): Buffer {\n const seed = hashString(`${name}:${symbol}`);\n const rand = mulberry32(seed);\n\n // Pick gradient colors\n const hue1 = Math.floor(rand() * 360);\n const hue2 = (hue1 + 90 + Math.floor(rand() * 90)) % 360;\n const color1 = hslToRgb(hue1, 0.65, 0.5);\n const color2 = hslToRgb(hue2, 0.55, 0.35);\n\n // Pattern overlay color\n const patternColor = hslToRgb(hue1, 0.4, 0.9);\n\n const pattern = generatePattern(rand);\n\n // Render pixels\n const pixels = Buffer.alloc(SIZE * SIZE * 3);\n\n const gridSize = 7;\n const cellPx = 36;\n const gridWidth = gridSize * cellPx;\n const offsetX = Math.floor((SIZE - gridWidth) / 2);\n const offsetY = Math.floor((SIZE - gridWidth) / 2);\n const cornerRadius = 48;\n\n for (let y = 0; y < SIZE; y++) {\n for (let x = 0; x < SIZE; x++) {\n const idx = (y * SIZE + x) * 3;\n\n // Rounded corner mask — draw as square outside the radius\n const inCorner = isOutsideRoundedRect(x, y, SIZE, SIZE, cornerRadius);\n if (inCorner) {\n pixels[idx] = 0;\n pixels[idx + 1] = 0;\n pixels[idx + 2] = 0;\n continue;\n }\n\n // Diagonal gradient background\n const t = (x + y) / (SIZE * 2);\n let color = lerpColor(color1, color2, t);\n\n // Check if pixel is in the identicon pattern area\n const gx = x - offsetX;\n const gy = y - offsetY;\n if (gx >= 0 && gx < gridWidth && gy >= 0 && gy < gridWidth) {\n const col = Math.floor(gx / cellPx);\n const row = Math.floor(gy / cellPx);\n if (col < gridSize && row < gridSize && pattern[row][col]) {\n color = blendColor(color, patternColor, 0.35);\n }\n }\n\n pixels[idx] = color.r;\n pixels[idx + 1] = color.g;\n pixels[idx + 2] = color.b;\n }\n }\n\n return encodePng(SIZE, SIZE, pixels);\n}\n\nfunction isOutsideRoundedRect(\n x: number,\n y: number,\n w: number,\n h: number,\n r: number,\n): boolean {\n // Only check corners\n if (x < r && y < r) {\n return (r - x) ** 2 + (r - y) ** 2 > r ** 2;\n }\n if (x >= w - r && y < r) {\n return (x - (w - r - 1)) ** 2 + (r - y) ** 2 > r ** 2;\n }\n if (x < r && y >= h - r) {\n return (r - x) ** 2 + (y - (h - r - 1)) ** 2 > r ** 2;\n }\n if (x >= w - r && y >= h - r) {\n return (x - (w - r - 1)) ** 2 + (y - (h - r - 1)) ** 2 > r ** 2;\n }\n return false;\n}\n","export function formatOutput(data: Record<string, unknown>, json: boolean): string {\n if (json) {\n return JSON.stringify(data, null, 2);\n }\n\n const lines: string[] = [];\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined || value === null) continue;\n const label = key.replace(/([A-Z])/g, \" $1\").replace(/^./, (s) => s.toUpperCase());\n lines.push(` ${label}: ${String(value)}`);\n }\n return lines.join(\"\\n\");\n}\n\nexport function printSuccess(message: string, data: Record<string, unknown>, json: boolean): void {\n if (json) {\n console.log(JSON.stringify({ success: true, ...data }, null, 2));\n } else {\n console.log(`\\n${message}\\n`);\n console.log(formatOutput(data, false));\n console.log();\n }\n}\n\nexport function printError(message: string, json: boolean, exitCode: number): void {\n if (json) {\n console.error(JSON.stringify({ success: false, error: message, exitCode }));\n } else {\n console.error(`\\nError: ${message}\\n`);\n }\n}\n","import { loadWallet, getWalletBalance } from \"../lib/wallet.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { EXIT_CODES, MoltlaunchError } from \"../lib/errors.js\";\n\ninterface WalletOpts {\n showKey: boolean;\n json: boolean;\n}\n\nexport async function wallet(opts: WalletOpts): Promise<void> {\n const { showKey, json } = opts;\n\n try {\n const data = await loadWallet();\n if (!data) {\n printError(\"No wallet found. Run `moltlaunch` to create one.\", json, EXIT_CODES.NO_WALLET);\n process.exit(EXIT_CODES.NO_WALLET);\n }\n\n let balance = \"unknown\";\n try {\n balance = await getWalletBalance(data.address, \"mainnet\");\n } catch {\n // RPC may be unreachable\n }\n\n const output: Record<string, unknown> = {\n address: data.address,\n balance: json ? balance : `${balance} ETH (Base)`,\n network: json ? \"Base\" : undefined,\n createdAt: data.createdAt,\n };\n\n if (showKey) {\n output.privateKey = data.privateKey;\n }\n\n printSuccess(\"Wallet info\", output, json);\n } catch (error) {\n if (error instanceof MoltlaunchError) {\n printError(error.message, json, error.exitCode);\n process.exit(error.exitCode);\n }\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n","import { loadLaunchRecords } from \"../lib/wallet.js\";\nimport { printError } from \"../lib/output.js\";\nimport { EXIT_CODES } from \"../lib/errors.js\";\n\ninterface StatusOpts {\n json: boolean;\n}\n\nexport async function status(opts: StatusOpts): Promise<void> {\n const { json } = opts;\n\n try {\n const records = await loadLaunchRecords();\n\n if (records.length === 0) {\n if (json) {\n console.log(JSON.stringify({ success: true, launches: [] }));\n } else {\n console.log(\"\\nNo tokens launched yet. Run `moltlaunch` to launch one.\\n\");\n }\n return;\n }\n\n if (json) {\n console.log(JSON.stringify({ success: true, launches: records }, null, 2));\n return;\n }\n\n console.log(`\\nLaunched tokens (${records.length}):\\n`);\n for (const record of records) {\n console.log(` ${record.name} (${record.symbol})`);\n console.log(` Token: ${record.tokenAddress}`);\n console.log(` TX: ${record.transactionHash}`);\n console.log(` Flaunch: ${record.flaunchUrl}`);\n console.log(` Network: ${record.network}`);\n console.log(` Launched: ${record.launchedAt}`);\n console.log();\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n","import { ethers } from \"ethers\";\nimport { loadWallet, getSigner, getWalletBalance } from \"../lib/wallet.js\";\nimport { POSITION_MANAGER_ADDRESS } from \"../lib/config.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { EXIT_CODES, NoWalletError, NoGasError, MoltlaunchError } from \"../lib/errors.js\";\nimport type { Network } from \"../types.js\";\n\n// Fees accumulate in escrow on the PositionManager, not on the Revenue Manager\nconst POSITION_MANAGER_ABI = [\n \"function balances(address) external view returns (uint256)\",\n \"function withdrawFees(address _recipient, bool _unwrap) external\",\n];\n\ninterface ClaimOpts {\n testnet: boolean;\n json: boolean;\n}\n\nexport async function claim(opts: ClaimOpts): Promise<void> {\n const { testnet, json } = opts;\n const network: Network = testnet ? \"testnet\" : \"mainnet\";\n\n try {\n const walletData = await loadWallet();\n if (!walletData) {\n throw new NoWalletError();\n }\n\n // Check gas balance\n const balance = await getWalletBalance(walletData.address, network);\n if (parseFloat(balance) === 0) {\n throw new NoGasError(walletData.address);\n }\n\n const signer = await getSigner(walletData.privateKey, network);\n const pm = new ethers.Contract(POSITION_MANAGER_ADDRESS, POSITION_MANAGER_ABI, signer);\n\n // Check claimable balance\n const claimable = await pm.balances(walletData.address);\n const claimableEth = ethers.formatEther(claimable);\n\n if (claimable === 0n) {\n printSuccess(\"No fees to claim\", {\n claimable: \"0 ETH\",\n wallet: walletData.address,\n network,\n }, json);\n return;\n }\n\n if (!json) console.log(`\\nClaimable: ${claimableEth} ETH`);\n if (!json) process.stdout.write(\"Submitting withdraw transaction...\");\n\n // withdrawFees sends to _recipient, _unwrap=true converts flETH→ETH\n const tx = await pm.withdrawFees(walletData.address, true);\n if (!json) console.log(` tx ${tx.hash}`);\n\n if (!json) process.stdout.write(\"Waiting for confirmation...\");\n const receipt = await tx.wait();\n if (!receipt) {\n throw new MoltlaunchError(\"Transaction was dropped or replaced\", EXIT_CODES.GENERAL);\n }\n if (!json) console.log(\" confirmed\");\n\n printSuccess(\"Fees claimed successfully!\", {\n transactionHash: receipt.hash,\n claimed: `${claimableEth} ETH`,\n wallet: walletData.address,\n network,\n }, json);\n } catch (error) {\n if (error instanceof MoltlaunchError) {\n printError(error.message, json, error.exitCode);\n process.exit(error.exitCode);\n }\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n","import { ethers } from \"ethers\";\nimport { loadWallet, getWalletBalance } from \"../lib/wallet.js\";\nimport { POSITION_MANAGER_ADDRESS, CHAIN } from \"../lib/config.js\";\nimport { printSuccess, printError } from \"../lib/output.js\";\nimport { EXIT_CODES, NoWalletError, MoltlaunchError } from \"../lib/errors.js\";\nimport type { Network } from \"../types.js\";\n\nconst POSITION_MANAGER_ABI = [\n \"function balances(address) external view returns (uint256)\",\n];\n\ninterface FeesOpts {\n testnet: boolean;\n json: boolean;\n}\n\nexport async function fees(opts: FeesOpts): Promise<void> {\n const { testnet, json } = opts;\n const network: Network = testnet ? \"testnet\" : \"mainnet\";\n\n try {\n const walletData = await loadWallet();\n if (!walletData) {\n throw new NoWalletError();\n }\n\n const chain = testnet ? CHAIN.testnet : CHAIN.mainnet;\n const provider = new ethers.JsonRpcProvider(chain.rpcUrl);\n const pm = new ethers.Contract(POSITION_MANAGER_ADDRESS, POSITION_MANAGER_ABI, provider);\n\n const claimable = await pm.balances(walletData.address);\n const claimableEth = ethers.formatEther(claimable);\n\n const walletBalance = await getWalletBalance(walletData.address, network);\n const hasGas = parseFloat(walletBalance) > 0;\n\n printSuccess(\"Fee balance\", {\n claimable: `${claimableEth} ETH`,\n wallet: walletData.address,\n walletBalance: `${walletBalance} ETH`,\n hasGas,\n network: chain.name,\n canClaim: hasGas && claimable > 0n,\n }, json);\n } catch (error) {\n if (error instanceof MoltlaunchError) {\n printError(error.message, json, error.exitCode);\n process.exit(error.exitCode);\n }\n const message = error instanceof Error ? error.message : String(error);\n printError(message, json, EXIT_CODES.GENERAL);\n process.exit(EXIT_CODES.GENERAL);\n }\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;;;ACDxB,SAAS,eAAe;AACxB,SAAS,UAAAA,eAAc;;;ACDvB,SAAS,cAAc;AACvB,SAAS,UAAU,WAAW,OAAO,OAAO,cAAc;AAC1D,SAAS,YAAY;AACrB,SAAS,eAAe;;;ACHjB,IAAM,0BAA0B;AAGhC,IAAM,2BAA2B;AAEjC,IAAM,mBAAmB;AAEzB,IAAM,QAAQ;AAAA,EACnB,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AACF;AAEO,IAAM,aAAa;AACnB,IAAM,cAAc;AACpB,IAAM,gBAAgB;AAEtB,IAAM,uBAAuB,IAAI,OAAO;AACxC,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;;;ADzB/B,SAAS,eAAuB;AAC9B,SAAO,KAAK,QAAQ,GAAG,UAAU;AACnC;AAEA,SAAS,gBAAwB;AAC/B,SAAO,KAAK,aAAa,GAAG,WAAW;AACzC;AAEA,SAAS,kBAA0B;AACjC,SAAO,KAAK,aAAa,GAAG,aAAa;AAC3C;AAEA,eAAe,WAAW,MAAgC;AACxD,MAAI;AACF,UAAM,OAAO,IAAI;AACjB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMA,eAAsB,aAAyC;AAC7D,QAAM,OAAO,cAAc;A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Q,MAAM,EACd,YAAY,wDAAwD,EACpE,OAAO,aAAa,4BAA4B,KAAK,EACrD,OAAO,UAAU,kBAAkB,KAAK,EACxC;AAAA,EAAO,CAAC,SACP,KAAK,EAAE,SAAS,KAAK,SAAS,MAAM,KAAK,KAAK,CAAC;AACjD;AAEF,QACG,QAAQ,OAAO,EACf,YAAY,uDAAuD,EACnE,OAAO,aAAa,4BAA4B,KAAK,EACrD,OAAO,UAAU,kBAAkB,KAAK,EACxC;AAAA,EAAO,CAAC,SACP,MAAM,EAAE,SAAS,KAAK,SAAS,MAAM,KAAK,KAAK,CAAC;AAClD;AAEF,QAAQ,MAAM;","names":["access","wallet","readFile","resolve","readFile","access","wallet","ethers","ethers","ethers","POSITION_MANAGER_ABI","ethers","require"]}
|