@layr-labs/ecloud-cli 1.0.0-dev.7 → 1.0.0-dev.8
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/VERSION +2 -2
- package/dist/commands/admin/admins/add.js +7 -1
- package/dist/commands/admin/admins/add.js.map +1 -1
- package/dist/commands/admin/admins/list.js +7 -1
- package/dist/commands/admin/admins/list.js.map +1 -1
- package/dist/commands/admin/admins/remove.js +7 -1
- package/dist/commands/admin/admins/remove.js.map +1 -1
- package/dist/commands/admin/coupons/create.js +7 -1
- package/dist/commands/admin/coupons/create.js.map +1 -1
- package/dist/commands/admin/coupons/deactivate.js +7 -1
- package/dist/commands/admin/coupons/deactivate.js.map +1 -1
- package/dist/commands/admin/coupons/get.js +7 -1
- package/dist/commands/admin/coupons/get.js.map +1 -1
- package/dist/commands/admin/coupons/list.js +7 -1
- package/dist/commands/admin/coupons/list.js.map +1 -1
- package/dist/commands/admin/coupons/redeem.js +7 -1
- package/dist/commands/admin/coupons/redeem.js.map +1 -1
- package/dist/commands/auth/whoami.js +7 -1
- package/dist/commands/auth/whoami.js.map +1 -1
- package/dist/commands/billing/__tests__/status.test.js +79 -3
- package/dist/commands/billing/__tests__/status.test.js.map +1 -1
- package/dist/commands/billing/__tests__/subscribe.test.js +7 -1
- package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -1
- package/dist/commands/billing/__tests__/top-up.test.js +473 -6
- package/dist/commands/billing/__tests__/top-up.test.js.map +1 -1
- package/dist/commands/billing/cancel.js +8 -3
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/list-cards.js +7 -1
- package/dist/commands/billing/list-cards.js.map +1 -1
- package/dist/commands/billing/redeem-coupon.js +7 -1
- package/dist/commands/billing/redeem-coupon.js.map +1 -1
- package/dist/commands/billing/status.js +33 -1
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +7 -1
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/billing/top-up.js +369 -7
- package/dist/commands/billing/top-up.js.map +1 -1
- package/dist/commands/compute/app/__tests__/status.test.js +1017 -0
- package/dist/commands/compute/app/__tests__/status.test.js.map +1 -0
- package/dist/commands/compute/app/create.js.map +1 -1
- package/dist/commands/compute/app/deploy.js +300 -68
- package/dist/commands/compute/app/deploy.js.map +1 -1
- package/dist/commands/compute/app/info.js +8 -2
- package/dist/commands/compute/app/info.js.map +1 -1
- package/dist/commands/compute/app/list.js +8 -2
- package/dist/commands/compute/app/list.js.map +1 -1
- package/dist/commands/compute/app/logs.js +11 -4
- package/dist/commands/compute/app/logs.js.map +1 -1
- package/dist/commands/compute/app/profile/set.js +11 -4
- package/dist/commands/compute/app/profile/set.js.map +1 -1
- package/dist/commands/compute/app/releases.js +8 -2
- package/dist/commands/compute/app/releases.js.map +1 -1
- package/dist/commands/compute/app/start.js +15 -8
- package/dist/commands/compute/app/start.js.map +1 -1
- package/dist/commands/compute/app/status.js +845 -0
- package/dist/commands/compute/app/status.js.map +1 -0
- package/dist/commands/compute/app/stop.js +15 -8
- package/dist/commands/compute/app/stop.js.map +1 -1
- package/dist/commands/compute/app/terminate.js +15 -8
- package/dist/commands/compute/app/terminate.js.map +1 -1
- package/dist/commands/compute/app/upgrade.js +297 -67
- package/dist/commands/compute/app/upgrade.js.map +1 -1
- package/dist/commands/compute/build/info.js +8 -2
- package/dist/commands/compute/build/info.js.map +1 -1
- package/dist/commands/compute/build/list.js +8 -2
- package/dist/commands/compute/build/list.js.map +1 -1
- package/dist/commands/compute/build/logs.js +8 -2
- package/dist/commands/compute/build/logs.js.map +1 -1
- package/dist/commands/compute/build/status.js +8 -2
- package/dist/commands/compute/build/status.js.map +1 -1
- package/dist/commands/compute/build/submit.js +8 -2
- package/dist/commands/compute/build/submit.js.map +1 -1
- package/dist/commands/compute/build/verify.js +8 -2
- package/dist/commands/compute/build/verify.js.map +1 -1
- package/dist/commands/compute/environment/set.js.map +1 -1
- package/dist/commands/compute/undelegate.js +11 -4
- package/dist/commands/compute/undelegate.js.map +1 -1
- package/dist/hooks/init/__tests__/version-check.test.js +32 -2
- package/dist/hooks/init/__tests__/version-check.test.js.map +1 -1
- package/dist/hooks/init/version-check.js +6 -1
- package/dist/hooks/init/version-check.js.map +1 -1
- package/package.json +2 -2
|
@@ -297,7 +297,7 @@ var init_flags = __esm({
|
|
|
297
297
|
required: false,
|
|
298
298
|
description: "Deployment environment to use",
|
|
299
299
|
env: "ECLOUD_ENV",
|
|
300
|
-
default: async () => getDefaultEnvironment() || (getBuildType2() === "dev" ? "sepolia-dev" : "
|
|
300
|
+
default: async () => getDefaultEnvironment() || (getBuildType2() === "dev" ? "sepolia-dev" : "mainnet-alpha")
|
|
301
301
|
}),
|
|
302
302
|
"private-key": Flags.string({
|
|
303
303
|
required: false,
|
|
@@ -327,6 +327,12 @@ var init_flags = __esm({
|
|
|
327
327
|
nonce: Flags.string({
|
|
328
328
|
required: false,
|
|
329
329
|
description: 'Override transaction nonce (integer or "latest" to replace a stuck transaction)'
|
|
330
|
+
}),
|
|
331
|
+
"non-interactive": Flags.boolean({
|
|
332
|
+
required: false,
|
|
333
|
+
description: "Assume non-interactive mode: default safe prompts and error all-at-once on missing required inputs",
|
|
334
|
+
env: "ECLOUD_NON_INTERACTIVE",
|
|
335
|
+
default: false
|
|
330
336
|
})
|
|
331
337
|
};
|
|
332
338
|
}
|
|
@@ -375,6 +381,18 @@ var init_client = __esm({
|
|
|
375
381
|
}
|
|
376
382
|
});
|
|
377
383
|
|
|
384
|
+
// src/utils/exitCodes.ts
|
|
385
|
+
import { InsufficientGasError } from "@layr-labs/ecloud-sdk";
|
|
386
|
+
function errorMessage(err) {
|
|
387
|
+
if (err instanceof Error) return err.message;
|
|
388
|
+
return String(err);
|
|
389
|
+
}
|
|
390
|
+
var init_exitCodes = __esm({
|
|
391
|
+
"src/utils/exitCodes.ts"() {
|
|
392
|
+
"use strict";
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
|
|
378
396
|
// src/telemetry.ts
|
|
379
397
|
import {
|
|
380
398
|
createTelemetryClient,
|
|
@@ -445,6 +463,8 @@ __export(status_exports, {
|
|
|
445
463
|
default: () => BillingStatus
|
|
446
464
|
});
|
|
447
465
|
import { Command, Flags as Flags2 } from "@oclif/core";
|
|
466
|
+
import { getEnvironmentConfig as getEnvironmentConfig4 } from "@layr-labs/ecloud-sdk";
|
|
467
|
+
import { formatEther as formatEther2 } from "viem";
|
|
448
468
|
import chalk2 from "chalk";
|
|
449
469
|
var BillingStatus;
|
|
450
470
|
var init_status = __esm({
|
|
@@ -452,6 +472,8 @@ var init_status = __esm({
|
|
|
452
472
|
"use strict";
|
|
453
473
|
init_client();
|
|
454
474
|
init_flags();
|
|
475
|
+
init_viemClients();
|
|
476
|
+
init_exitCodes();
|
|
455
477
|
init_telemetry();
|
|
456
478
|
BillingStatus = class _BillingStatus extends Command {
|
|
457
479
|
static description = "Show subscription status";
|
|
@@ -500,6 +522,21 @@ var init_status = __esm({
|
|
|
500
522
|
this.log(`
|
|
501
523
|
${chalk2.bold("Subscription Status:")}`);
|
|
502
524
|
this.log(` Wallet: ${billing.address}`);
|
|
525
|
+
try {
|
|
526
|
+
const privateKey = flags["private-key"];
|
|
527
|
+
if (privateKey) {
|
|
528
|
+
const environment = flags.environment;
|
|
529
|
+
const environmentConfig = getEnvironmentConfig4(environment);
|
|
530
|
+
const rpcUrl = flags["rpc-url"] || environmentConfig.defaultRPCURL;
|
|
531
|
+
const { publicClient, address } = createViemClients({ privateKey, rpcUrl, environment });
|
|
532
|
+
const balanceWei = await publicClient.getBalance({ address });
|
|
533
|
+
const eth = formatEther2(balanceWei);
|
|
534
|
+
const note = balanceWei === BigInt(0) ? chalk2.yellow(" (fund with ETH to pay deploy/upgrade gas)") : "";
|
|
535
|
+
this.log(` Wallet ETH (${environment}): ${chalk2.cyan(`${eth} ETH`)}${note}`);
|
|
536
|
+
}
|
|
537
|
+
} catch (err) {
|
|
538
|
+
this.warn(`Could not read wallet ETH balance: ${errorMessage(err)}`);
|
|
539
|
+
}
|
|
503
540
|
this.log(` Status: ${formatStatus(result.subscriptionStatus)}`);
|
|
504
541
|
this.log(` Product: ${result.productId}`);
|
|
505
542
|
if (result.currentPeriodStart && result.currentPeriodEnd) {
|
|
@@ -557,6 +594,7 @@ ${chalk2.bold("Need more credits?")}`);
|
|
|
557
594
|
|
|
558
595
|
// src/commands/billing/__tests__/status.test.ts
|
|
559
596
|
init_client();
|
|
597
|
+
init_viemClients();
|
|
560
598
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
561
599
|
vi.mock("../../../client", () => ({
|
|
562
600
|
createBillingClient: vi.fn()
|
|
@@ -564,25 +602,37 @@ vi.mock("../../../client", () => ({
|
|
|
564
602
|
vi.mock("../../../telemetry", () => ({
|
|
565
603
|
withTelemetry: vi.fn((_cmd, fn) => fn())
|
|
566
604
|
}));
|
|
605
|
+
vi.mock("@layr-labs/ecloud-sdk", () => ({
|
|
606
|
+
getEnvironmentConfig: vi.fn(() => ({ defaultRPCURL: "https://rpc.example" }))
|
|
607
|
+
}));
|
|
608
|
+
vi.mock("../../../utils/viemClients", () => ({
|
|
609
|
+
createViemClients: vi.fn()
|
|
610
|
+
}));
|
|
567
611
|
describe("ecloud billing status \u2014 top-up hint", () => {
|
|
568
612
|
let logOutput;
|
|
569
613
|
let mockBilling;
|
|
570
614
|
beforeEach(() => {
|
|
571
615
|
logOutput = [];
|
|
616
|
+
warnOutput = [];
|
|
572
617
|
mockBilling = {
|
|
573
618
|
address: "0xabcdef1234567890abcdef1234567890abcdef12",
|
|
574
619
|
getStatus: vi.fn()
|
|
575
620
|
};
|
|
576
621
|
createBillingClient.mockResolvedValue(mockBilling);
|
|
577
622
|
});
|
|
578
|
-
|
|
623
|
+
let warnOutput;
|
|
624
|
+
async function runStatusCommand(statusResult, flagOverrides = {}) {
|
|
579
625
|
const { default: BillingStatus2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
580
626
|
mockBilling.getStatus.mockResolvedValue(statusResult);
|
|
581
627
|
const cmd = new BillingStatus2([], {});
|
|
582
628
|
cmd.parse = vi.fn().mockResolvedValue({
|
|
583
|
-
flags: { product: "compute", verbose: false }
|
|
629
|
+
flags: { product: "compute", verbose: false, ...flagOverrides }
|
|
584
630
|
});
|
|
585
631
|
cmd.log = vi.fn((...args) => logOutput.push(args.join(" ")));
|
|
632
|
+
cmd.warn = vi.fn((msg) => {
|
|
633
|
+
warnOutput.push(typeof msg === "string" ? msg : msg.message);
|
|
634
|
+
return msg;
|
|
635
|
+
});
|
|
586
636
|
cmd.debug = vi.fn();
|
|
587
637
|
await cmd.run();
|
|
588
638
|
return logOutput;
|
|
@@ -623,5 +673,31 @@ describe("ecloud billing status \u2014 top-up hint", () => {
|
|
|
623
673
|
const fullOutput = output.join("\n");
|
|
624
674
|
expect(fullOutput).not.toContain("Need more credits?");
|
|
625
675
|
});
|
|
676
|
+
describe("wallet ETH balance line", () => {
|
|
677
|
+
it("warns (does not silently swallow) when the balance read fails, but still completes", async () => {
|
|
678
|
+
createViemClients.mockImplementation(() => {
|
|
679
|
+
throw new Error("invalid private key");
|
|
680
|
+
});
|
|
681
|
+
const output = await runStatusCommand(
|
|
682
|
+
{ subscriptionStatus: "active", productId: "compute" },
|
|
683
|
+
{ "private-key": "0xbad", environment: "sepolia" }
|
|
684
|
+
);
|
|
685
|
+
expect(output.join("\n")).toContain("Subscription Status:");
|
|
686
|
+
expect(warnOutput.join("\n")).toMatch(/wallet ETH|balance/i);
|
|
687
|
+
expect(warnOutput.join("\n")).toContain("invalid private key");
|
|
688
|
+
});
|
|
689
|
+
it("prints the ETH line on a successful balance read", async () => {
|
|
690
|
+
createViemClients.mockReturnValue({
|
|
691
|
+
publicClient: { getBalance: vi.fn().mockResolvedValue(1000000000000000000n) },
|
|
692
|
+
address: "0xabcdef1234567890abcdef1234567890abcdef12"
|
|
693
|
+
});
|
|
694
|
+
const output = await runStatusCommand(
|
|
695
|
+
{ subscriptionStatus: "active", productId: "compute" },
|
|
696
|
+
{ "private-key": "0xgood", environment: "sepolia" }
|
|
697
|
+
);
|
|
698
|
+
expect(output.join("\n")).toMatch(/Wallet ETH.*1 ETH/);
|
|
699
|
+
expect(warnOutput).toHaveLength(0);
|
|
700
|
+
});
|
|
701
|
+
});
|
|
626
702
|
});
|
|
627
703
|
//# sourceMappingURL=status.test.js.map
|