@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.
- package/dist/commands/auth/whoami.js +1 -0
- package/dist/commands/auth/whoami.js.map +1 -1
- package/dist/commands/billing/__tests__/status.test.js +552 -0
- package/dist/commands/billing/__tests__/status.test.js.map +1 -0
- package/dist/commands/billing/__tests__/subscribe.test.js +580 -0
- package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -0
- package/dist/commands/billing/__tests__/top-up.test.js +729 -0
- package/dist/commands/billing/__tests__/top-up.test.js.map +1 -0
- package/dist/commands/billing/cancel.js +8 -7
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/status.js +25 -19
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +43 -14
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/billing/top-up.js +491 -0
- package/dist/commands/billing/top-up.js.map +1 -0
- package/dist/commands/compute/app/create.js +1 -0
- package/dist/commands/compute/app/create.js.map +1 -1
- package/dist/commands/compute/app/deploy.js +62 -23
- package/dist/commands/compute/app/deploy.js.map +1 -1
- package/dist/commands/compute/app/info.js +32 -31
- package/dist/commands/compute/app/info.js.map +1 -1
- package/dist/commands/compute/app/list.js +31 -30
- package/dist/commands/compute/app/list.js.map +1 -1
- package/dist/commands/compute/app/logs.js +2 -1
- package/dist/commands/compute/app/logs.js.map +1 -1
- package/dist/commands/compute/app/profile/set.js +6 -5
- package/dist/commands/compute/app/profile/set.js.map +1 -1
- package/dist/commands/compute/app/releases.js +18 -17
- package/dist/commands/compute/app/releases.js.map +1 -1
- package/dist/commands/compute/app/start.js +6 -5
- package/dist/commands/compute/app/start.js.map +1 -1
- package/dist/commands/compute/app/stop.js +6 -5
- package/dist/commands/compute/app/stop.js.map +1 -1
- package/dist/commands/compute/app/terminate.js +6 -5
- package/dist/commands/compute/app/terminate.js.map +1 -1
- package/dist/commands/compute/app/upgrade.js +51 -22
- package/dist/commands/compute/app/upgrade.js.map +1 -1
- package/dist/commands/compute/build/info.js +16 -15
- package/dist/commands/compute/build/info.js.map +1 -1
- package/dist/commands/compute/build/list.js +13 -12
- package/dist/commands/compute/build/list.js.map +1 -1
- package/dist/commands/compute/build/logs.js +4 -3
- package/dist/commands/compute/build/logs.js.map +1 -1
- package/dist/commands/compute/build/status.js +9 -8
- package/dist/commands/compute/build/status.js.map +1 -1
- package/dist/commands/compute/build/submit.js +16 -15
- package/dist/commands/compute/build/submit.js.map +1 -1
- package/dist/commands/compute/build/verify.js +10 -9
- package/dist/commands/compute/build/verify.js.map +1 -1
- package/dist/commands/compute/environment/set.js +1 -0
- package/dist/commands/compute/environment/set.js.map +1 -1
- package/dist/commands/compute/undelegate.js +6 -5
- package/dist/commands/compute/undelegate.js.map +1 -1
- package/package.json +3 -2
- 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
|
|
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
|
-
|
|
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
|
-
${
|
|
321
|
+
${chalk2.green("\u2713")} Wallet ${chalk2.bold(billing.address)} is already subscribed to ${flags.product}.`
|
|
321
322
|
);
|
|
322
|
-
this.log(
|
|
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
|
-
${
|
|
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
|
-
${
|
|
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 ${
|
|
340
|
-
this.log(
|
|
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
|
-
${
|
|
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
|
-
${
|
|
384
|
+
${chalk2.green("\u2713")} Subscription activated successfully for ${flags.product}!`
|
|
356
385
|
);
|
|
357
386
|
this.log(`
|
|
358
|
-
${
|
|
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
|
-
${
|
|
395
|
+
${chalk2.yellow("\u26A0")} Payment confirmation timed out after 5 minutes.`);
|
|
367
396
|
this.log(
|
|
368
|
-
|
|
397
|
+
chalk2.gray(`If you completed payment, run 'ecloud billing status' to check status.`)
|
|
369
398
|
);
|
|
370
399
|
});
|
|
371
400
|
}
|