@layr-labs/ecloud-cli 0.3.4 → 0.4.0-dev.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.
Files changed (56) hide show
  1. package/dist/commands/auth/whoami.js +1 -0
  2. package/dist/commands/auth/whoami.js.map +1 -1
  3. package/dist/commands/billing/__tests__/status.test.js +552 -0
  4. package/dist/commands/billing/__tests__/status.test.js.map +1 -0
  5. package/dist/commands/billing/__tests__/subscribe.test.js +580 -0
  6. package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -0
  7. package/dist/commands/billing/__tests__/top-up.test.js +729 -0
  8. package/dist/commands/billing/__tests__/top-up.test.js.map +1 -0
  9. package/dist/commands/billing/cancel.js +8 -7
  10. package/dist/commands/billing/cancel.js.map +1 -1
  11. package/dist/commands/billing/status.js +25 -19
  12. package/dist/commands/billing/status.js.map +1 -1
  13. package/dist/commands/billing/subscribe.js +43 -14
  14. package/dist/commands/billing/subscribe.js.map +1 -1
  15. package/dist/commands/billing/top-up.js +491 -0
  16. package/dist/commands/billing/top-up.js.map +1 -0
  17. package/dist/commands/compute/app/create.js +1 -0
  18. package/dist/commands/compute/app/create.js.map +1 -1
  19. package/dist/commands/compute/app/deploy.js +62 -23
  20. package/dist/commands/compute/app/deploy.js.map +1 -1
  21. package/dist/commands/compute/app/info.js +32 -31
  22. package/dist/commands/compute/app/info.js.map +1 -1
  23. package/dist/commands/compute/app/list.js +31 -30
  24. package/dist/commands/compute/app/list.js.map +1 -1
  25. package/dist/commands/compute/app/logs.js +2 -1
  26. package/dist/commands/compute/app/logs.js.map +1 -1
  27. package/dist/commands/compute/app/profile/set.js +6 -5
  28. package/dist/commands/compute/app/profile/set.js.map +1 -1
  29. package/dist/commands/compute/app/releases.js +18 -17
  30. package/dist/commands/compute/app/releases.js.map +1 -1
  31. package/dist/commands/compute/app/start.js +6 -5
  32. package/dist/commands/compute/app/start.js.map +1 -1
  33. package/dist/commands/compute/app/stop.js +6 -5
  34. package/dist/commands/compute/app/stop.js.map +1 -1
  35. package/dist/commands/compute/app/terminate.js +6 -5
  36. package/dist/commands/compute/app/terminate.js.map +1 -1
  37. package/dist/commands/compute/app/upgrade.js +51 -22
  38. package/dist/commands/compute/app/upgrade.js.map +1 -1
  39. package/dist/commands/compute/build/info.js +16 -15
  40. package/dist/commands/compute/build/info.js.map +1 -1
  41. package/dist/commands/compute/build/list.js +13 -12
  42. package/dist/commands/compute/build/list.js.map +1 -1
  43. package/dist/commands/compute/build/logs.js +4 -3
  44. package/dist/commands/compute/build/logs.js.map +1 -1
  45. package/dist/commands/compute/build/status.js +9 -8
  46. package/dist/commands/compute/build/status.js.map +1 -1
  47. package/dist/commands/compute/build/submit.js +16 -15
  48. package/dist/commands/compute/build/submit.js.map +1 -1
  49. package/dist/commands/compute/build/verify.js +10 -9
  50. package/dist/commands/compute/build/verify.js.map +1 -1
  51. package/dist/commands/compute/environment/set.js +1 -0
  52. package/dist/commands/compute/environment/set.js.map +1 -1
  53. package/dist/commands/compute/undelegate.js +6 -5
  54. package/dist/commands/compute/undelegate.js.map +1 -1
  55. package/package.json +3 -2
  56. package/VERSION +0 -2
@@ -21,6 +21,7 @@ import { getBuildType as getBuildType2 } from "@layr-labs/ecloud-sdk";
21
21
 
22
22
  // src/utils/prompts.ts
23
23
  import { input, select, password, confirm as inquirerConfirm } from "@inquirer/prompts";
24
+ import chalk from "chalk";
24
25
  import fs3 from "fs";
25
26
  import path3 from "path";
26
27
  import os3 from "os";
@@ -228,8 +229,9 @@ async function createBillingClient(flags) {
228
229
  }
229
230
 
230
231
  // src/commands/billing/subscribe.ts
231
- import chalk from "chalk";
232
+ import chalk2 from "chalk";
232
233
  import open from "open";
234
+ import { select as select2 } from "@inquirer/prompts";
233
235
 
234
236
  // src/telemetry.ts
235
237
  import {
@@ -295,8 +297,7 @@ var POLL_INTERVAL_MS = 3e3;
295
297
  var BillingSubscribe = class _BillingSubscribe extends Command {
296
298
  static description = "Create subscription to start deploying apps";
297
299
  static flags = {
298
- "private-key": commonFlags["private-key"],
299
- verbose: commonFlags.verbose,
300
+ ...commonFlags,
300
301
  product: Flags2.string({
301
302
  required: false,
302
303
  description: "Product ID",
@@ -317,31 +318,59 @@ Checking subscription status for ${flags.product}...`);
317
318
  if (result.type === "already_active") {
318
319
  this.log(
319
320
  `
320
- ${chalk.green("\u2713")} Wallet ${chalk.bold(billing.address)} is already subscribed to ${flags.product}.`
321
+ ${chalk2.green("\u2713")} Wallet ${chalk2.bold(billing.address)} is already subscribed to ${flags.product}.`
321
322
  );
322
- this.log(chalk.gray("Run 'ecloud billing status' for details."));
323
+ this.log(chalk2.gray("Run 'ecloud billing status' for details."));
323
324
  return;
324
325
  }
325
326
  if (result.type === "payment_issue") {
326
327
  this.log(
327
328
  `
328
- ${chalk.yellow("\u26A0")} You already have a subscription on ${flags.product}, but it has a payment issue.`
329
+ ${chalk2.yellow("\u26A0")} You already have a subscription on ${flags.product}, but it has a payment issue.`
329
330
  );
330
331
  this.log("Please update your payment method to restore access.");
331
332
  if (result.portalUrl) {
332
333
  this.log(`
333
- ${chalk.bold("Update payment method:")}`);
334
+ ${chalk2.bold("Update payment method:")}`);
334
335
  this.log(` ${result.portalUrl}`);
335
336
  }
336
337
  return;
337
338
  }
339
+ const paymentMethod = await select2({
340
+ message: "How would you like to pay for EigenCompute?",
341
+ choices: [
342
+ {
343
+ value: "card",
344
+ name: "Credit card",
345
+ description: "Pay via Stripe checkout (opens browser)"
346
+ },
347
+ {
348
+ value: "usdc",
349
+ name: "Purchase credits with USDC",
350
+ description: "Pay on-chain \u2014 no credit card needed"
351
+ }
352
+ ]
353
+ });
354
+ if (paymentMethod === "usdc") {
355
+ await this.config.runCommand("billing:top-up", [
356
+ ...flags["private-key"] ? ["--private-key", flags["private-key"]] : [],
357
+ ...flags.verbose ? ["--verbose"] : [],
358
+ ...flags.environment ? ["--environment", flags.environment] : [],
359
+ ...flags["rpc-url"] ? ["--rpc-url", flags["rpc-url"]] : [],
360
+ "--product",
361
+ flags.product
362
+ ]);
363
+ return;
364
+ }
338
365
  this.log(`
339
- Opening checkout for wallet ${chalk.bold(billing.address)}...`);
340
- this.log(chalk.gray(`
366
+ Opening checkout for wallet ${chalk2.bold(billing.address)}...`);
367
+ this.log(chalk2.gray(`
341
368
  URL: ${result.checkoutUrl}`));
369
+ this.log(chalk2.gray(`
370
+ Prefer to pay with USDC? Run: ecloud billing top-up`));
342
371
  await open(result.checkoutUrl);
343
372
  this.log(`
344
- ${chalk.gray("Waiting for payment confirmation...")}`);
373
+ ${chalk2.gray("Waiting for payment confirmation...")}`);
345
374
  const startTime = Date.now();
346
375
  while (Date.now() - startTime < PAYMENT_TIMEOUT_MS) {
347
376
  await new Promise((resolve2) => setTimeout(resolve2, POLL_INTERVAL_MS));
@@ -352,10 +381,10 @@ ${chalk.gray("Waiting for payment confirmation...")}`);
352
381
  if (isSubscriptionActive(status.subscriptionStatus)) {
353
382
  this.log(
354
383
  `
355
- ${chalk.green("\u2713")} Subscription activated successfully for ${flags.product}!`
384
+ ${chalk2.green("\u2713")} Subscription activated successfully for ${flags.product}!`
356
385
  );
357
386
  this.log(`
358
- ${chalk.gray("Start deploying with:")} ecloud compute app deploy`);
387
+ ${chalk2.gray("Start deploying with:")} ecloud compute app deploy`);
359
388
  return;
360
389
  }
361
390
  } catch (error) {
@@ -363,9 +392,9 @@ ${chalk.gray("Start deploying with:")} ecloud compute app deploy`);
363
392
  }
364
393
  }
365
394
  this.log(`
366
- ${chalk.yellow("\u26A0")} Payment confirmation timed out after 5 minutes.`);
395
+ ${chalk2.yellow("\u26A0")} Payment confirmation timed out after 5 minutes.`);
367
396
  this.log(
368
- chalk.gray(`If you completed payment, run 'ecloud billing status' to check status.`)
397
+ chalk2.gray(`If you completed payment, run 'ecloud billing status' to check status.`)
369
398
  );
370
399
  });
371
400
  }