@layr-labs/ecloud-cli 1.0.0-devep8 → 1.0.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/VERSION +2 -2
- package/dist/commands/admin/admins/add.js +411 -0
- package/dist/commands/admin/admins/add.js.map +1 -0
- package/dist/commands/admin/admins/list.js +414 -0
- package/dist/commands/admin/admins/list.js.map +1 -0
- package/dist/commands/admin/admins/remove.js +409 -0
- package/dist/commands/admin/admins/remove.js.map +1 -0
- package/dist/commands/admin/coupons/create.js +424 -0
- package/dist/commands/admin/coupons/create.js.map +1 -0
- package/dist/commands/admin/coupons/deactivate.js +409 -0
- package/dist/commands/admin/coupons/deactivate.js.map +1 -0
- package/dist/commands/admin/coupons/get.js +418 -0
- package/dist/commands/admin/coupons/get.js.map +1 -0
- package/dist/commands/admin/coupons/list.js +442 -0
- package/dist/commands/admin/coupons/list.js.map +1 -0
- package/dist/commands/admin/coupons/redeem.js +413 -0
- package/dist/commands/admin/coupons/redeem.js.map +1 -0
- 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 +80 -3
- package/dist/commands/billing/__tests__/status.test.js.map +1 -1
- package/dist/commands/billing/__tests__/subscribe.test.js +8 -1
- package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -1
- package/dist/commands/billing/__tests__/top-up.test.js +474 -6
- package/dist/commands/billing/__tests__/top-up.test.js.map +1 -1
- package/dist/commands/billing/cancel.js +9 -3
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/list-cards.js +8 -1
- package/dist/commands/billing/list-cards.js.map +1 -1
- package/dist/commands/billing/redeem-coupon.js +421 -0
- package/dist/commands/billing/redeem-coupon.js.map +1 -0
- package/dist/commands/billing/status.js +34 -1
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +8 -1
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/billing/top-up.js +370 -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/configure/tls.js +70 -30
- package/dist/commands/compute/app/configure/tls.js.map +1 -1
- package/dist/commands/compute/app/create.js.map +1 -1
- package/dist/commands/compute/app/deploy.js +301 -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 +12 -4
- package/dist/commands/compute/app/logs.js.map +1 -1
- package/dist/commands/compute/app/profile/set.js +12 -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 +16 -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 +16 -8
- package/dist/commands/compute/app/stop.js.map +1 -1
- package/dist/commands/compute/app/terminate.js +16 -8
- package/dist/commands/compute/app/terminate.js.map +1 -1
- package/dist/commands/compute/app/upgrade.js +298 -67
- package/dist/commands/compute/app/upgrade.js.map +1 -1
- package/dist/commands/compute/build/info.js +9 -2
- package/dist/commands/compute/build/info.js.map +1 -1
- package/dist/commands/compute/build/list.js +9 -2
- package/dist/commands/compute/build/list.js.map +1 -1
- package/dist/commands/compute/build/logs.js +9 -2
- package/dist/commands/compute/build/logs.js.map +1 -1
- package/dist/commands/compute/build/status.js +9 -2
- package/dist/commands/compute/build/status.js.map +1 -1
- package/dist/commands/compute/build/submit.js +9 -2
- package/dist/commands/compute/build/submit.js.map +1 -1
- package/dist/commands/compute/build/verify.js +9 -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 +12 -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 +11 -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
|
}
|
|
@@ -337,6 +343,7 @@ import {
|
|
|
337
343
|
createComputeModule,
|
|
338
344
|
createBillingModule,
|
|
339
345
|
createBuildModule,
|
|
346
|
+
createAdminModule,
|
|
340
347
|
getEnvironmentConfig as getEnvironmentConfig3,
|
|
341
348
|
requirePrivateKey
|
|
342
349
|
} from "@layr-labs/ecloud-sdk";
|
|
@@ -374,6 +381,18 @@ var init_client = __esm({
|
|
|
374
381
|
}
|
|
375
382
|
});
|
|
376
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
|
+
|
|
377
396
|
// src/telemetry.ts
|
|
378
397
|
import {
|
|
379
398
|
createTelemetryClient,
|
|
@@ -444,6 +463,8 @@ __export(status_exports, {
|
|
|
444
463
|
default: () => BillingStatus
|
|
445
464
|
});
|
|
446
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";
|
|
447
468
|
import chalk2 from "chalk";
|
|
448
469
|
var BillingStatus;
|
|
449
470
|
var init_status = __esm({
|
|
@@ -451,6 +472,8 @@ var init_status = __esm({
|
|
|
451
472
|
"use strict";
|
|
452
473
|
init_client();
|
|
453
474
|
init_flags();
|
|
475
|
+
init_viemClients();
|
|
476
|
+
init_exitCodes();
|
|
454
477
|
init_telemetry();
|
|
455
478
|
BillingStatus = class _BillingStatus extends Command {
|
|
456
479
|
static description = "Show subscription status";
|
|
@@ -499,6 +522,21 @@ var init_status = __esm({
|
|
|
499
522
|
this.log(`
|
|
500
523
|
${chalk2.bold("Subscription Status:")}`);
|
|
501
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
|
+
}
|
|
502
540
|
this.log(` Status: ${formatStatus(result.subscriptionStatus)}`);
|
|
503
541
|
this.log(` Product: ${result.productId}`);
|
|
504
542
|
if (result.currentPeriodStart && result.currentPeriodEnd) {
|
|
@@ -556,6 +594,7 @@ ${chalk2.bold("Need more credits?")}`);
|
|
|
556
594
|
|
|
557
595
|
// src/commands/billing/__tests__/status.test.ts
|
|
558
596
|
init_client();
|
|
597
|
+
init_viemClients();
|
|
559
598
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
560
599
|
vi.mock("../../../client", () => ({
|
|
561
600
|
createBillingClient: vi.fn()
|
|
@@ -563,25 +602,37 @@ vi.mock("../../../client", () => ({
|
|
|
563
602
|
vi.mock("../../../telemetry", () => ({
|
|
564
603
|
withTelemetry: vi.fn((_cmd, fn) => fn())
|
|
565
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
|
+
}));
|
|
566
611
|
describe("ecloud billing status \u2014 top-up hint", () => {
|
|
567
612
|
let logOutput;
|
|
568
613
|
let mockBilling;
|
|
569
614
|
beforeEach(() => {
|
|
570
615
|
logOutput = [];
|
|
616
|
+
warnOutput = [];
|
|
571
617
|
mockBilling = {
|
|
572
618
|
address: "0xabcdef1234567890abcdef1234567890abcdef12",
|
|
573
619
|
getStatus: vi.fn()
|
|
574
620
|
};
|
|
575
621
|
createBillingClient.mockResolvedValue(mockBilling);
|
|
576
622
|
});
|
|
577
|
-
|
|
623
|
+
let warnOutput;
|
|
624
|
+
async function runStatusCommand(statusResult, flagOverrides = {}) {
|
|
578
625
|
const { default: BillingStatus2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
579
626
|
mockBilling.getStatus.mockResolvedValue(statusResult);
|
|
580
627
|
const cmd = new BillingStatus2([], {});
|
|
581
628
|
cmd.parse = vi.fn().mockResolvedValue({
|
|
582
|
-
flags: { product: "compute", verbose: false }
|
|
629
|
+
flags: { product: "compute", verbose: false, ...flagOverrides }
|
|
583
630
|
});
|
|
584
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
|
+
});
|
|
585
636
|
cmd.debug = vi.fn();
|
|
586
637
|
await cmd.run();
|
|
587
638
|
return logOutput;
|
|
@@ -622,5 +673,31 @@ describe("ecloud billing status \u2014 top-up hint", () => {
|
|
|
622
673
|
const fullOutput = output.join("\n");
|
|
623
674
|
expect(fullOutput).not.toContain("Need more credits?");
|
|
624
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
|
+
});
|
|
625
702
|
});
|
|
626
703
|
//# sourceMappingURL=status.test.js.map
|