create-mn-app 0.3.14 → 0.3.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mn-app",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "Create Midnight Network applications with zero configuration",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -285,8 +285,8 @@ async function main() {
285
285
 
286
286
  console.log(' Deploying contract...\n');
287
287
 
288
- const MAX_RETRIES = 5;
289
- const RETRY_DELAY_MS = 30000; // 30 seconds between retries
288
+ const MAX_RETRIES = 8;
289
+ const RETRY_DELAY_MS = 15000; // 15 seconds between retries
290
290
 
291
291
  let deployed: Awaited<ReturnType<typeof deployContract>> | undefined;
292
292
 
@@ -303,33 +303,48 @@ async function main() {
303
303
 
304
304
  // Check if it's a DUST-related error
305
305
  if (errMsg.includes('Not enough Dust') || errMsg.includes('Wallet.Transacting')) {
306
+ // Get current DUST balance
307
+ const currentState = await Rx.firstValueFrom(walletCtx.wallet.state().pipe(Rx.filter((s) => s.isSynced)));
308
+ const dustBalance = currentState.dust.walletBalance(new Date());
309
+
306
310
  if (attempt < MAX_RETRIES) {
307
- console.log(` ⏳ Waiting for more DUST to generate (attempt ${attempt}/${MAX_RETRIES})...`);
308
- console.log(' DUST generates as blocks are produced (~30s per block)');
309
- console.log(` Retrying in ${RETRY_DELAY_MS / 1000}s...\n`);
311
+ console.log(` ⏳ DUST balance: ${dustBalance.toLocaleString()} (need more for tx fees)`);
312
+ console.log(` Attempt ${attempt}/${MAX_RETRIES} - waiting for DUST to accumulate...`);
310
313
 
311
314
  // Countdown display
312
315
  for (let i = RETRY_DELAY_MS / 1000; i > 0; i -= 5) {
316
+ process.stdout.write(`\r Retrying in ${i}s... `);
313
317
  await new Promise((r) => setTimeout(r, 5000));
314
- if (i > 5) process.stdout.write(`\r ${i - 5}s remaining... `);
315
318
  }
316
- process.stdout.write('\r \r');
319
+ process.stdout.write('\r \r\n');
317
320
  } else {
318
321
  // All retries exhausted
319
- console.log(' ❌ Not enough DUST generated yet.\n');
320
- console.log(' DUST is generated over time as blocks are produced.');
321
- console.log(' Your wallet and funds are saved - just retry later:\n');
322
- console.log(' $ npm run deploy\n');
322
+ console.log(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
323
+ console.log(' Not enough DUST for transaction fees\n');
324
+ console.log(` Current DUST: ${dustBalance.toLocaleString()}`);
325
+ console.log(' This is a new wallet - DUST generates over time.\n');
326
+ console.log(' ┌─ Options ─────────────────────────────────────────────────┐');
327
+ console.log(' │ │');
328
+ console.log(' │ [1] Wait & retry $ npm run deploy │');
329
+ console.log(' │ (DUST accumulates as blocks are produced) │');
330
+ console.log(' │ │');
331
+ console.log(' │ [2] Send DUST from existing wallet to this address: │');
332
+ console.log(` │ ${address.slice(0, 50)}... │`);
333
+ console.log(' │ │');
334
+ console.log(' │ [3] Import wallet with DUST (choose option 2 on retry) │');
335
+ console.log(' │ │');
336
+ console.log(' └───────────────────────────────────────────────────────────┘\n');
323
337
 
324
338
  // Save partial deployment info so user can resume
325
339
  const partialInfo = {
326
340
  seed,
341
+ address,
327
342
  network: 'preprod',
328
343
  status: 'pending_dust',
329
344
  lastAttempt: new Date().toISOString(),
330
345
  };
331
346
  fs.writeFileSync('deployment.json', JSON.stringify(partialInfo, null, 2));
332
- console.log(' Seed saved to deployment.json for retry.\n');
347
+ console.log(' Wallet saved to deployment.json\n');
333
348
 
334
349
  await walletCtx.wallet.stop();
335
350
  process.exit(1);