@layr-labs/ecloud-cli 1.0.0-devep7 → 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 +82 -4
- package/dist/commands/billing/__tests__/status.test.js.map +1 -1
- package/dist/commands/billing/__tests__/subscribe.test.js +10 -2
- package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -1
- package/dist/commands/billing/__tests__/top-up.test.js +565 -13
- package/dist/commands/billing/__tests__/top-up.test.js.map +1 -1
- package/dist/commands/billing/cancel.js +11 -4
- package/dist/commands/billing/cancel.js.map +1 -1
- package/dist/commands/billing/list-cards.js +10 -2
- 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 +36 -2
- package/dist/commands/billing/status.js.map +1 -1
- package/dist/commands/billing/subscribe.js +10 -2
- package/dist/commands/billing/subscribe.js.map +1 -1
- package/dist/commands/billing/top-up.js +392 -11
- 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";
|
|
@@ -361,7 +368,8 @@ async function createBillingClient(flags) {
|
|
|
361
368
|
walletClient,
|
|
362
369
|
publicClient,
|
|
363
370
|
environment,
|
|
364
|
-
skipTelemetry: true
|
|
371
|
+
skipTelemetry: true,
|
|
372
|
+
privateKey
|
|
365
373
|
});
|
|
366
374
|
}
|
|
367
375
|
var init_client = __esm({
|
|
@@ -373,6 +381,18 @@ var init_client = __esm({
|
|
|
373
381
|
}
|
|
374
382
|
});
|
|
375
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
|
+
|
|
376
396
|
// src/telemetry.ts
|
|
377
397
|
import {
|
|
378
398
|
createTelemetryClient,
|
|
@@ -443,6 +463,8 @@ __export(status_exports, {
|
|
|
443
463
|
default: () => BillingStatus
|
|
444
464
|
});
|
|
445
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";
|
|
446
468
|
import chalk2 from "chalk";
|
|
447
469
|
var BillingStatus;
|
|
448
470
|
var init_status = __esm({
|
|
@@ -450,6 +472,8 @@ var init_status = __esm({
|
|
|
450
472
|
"use strict";
|
|
451
473
|
init_client();
|
|
452
474
|
init_flags();
|
|
475
|
+
init_viemClients();
|
|
476
|
+
init_exitCodes();
|
|
453
477
|
init_telemetry();
|
|
454
478
|
BillingStatus = class _BillingStatus extends Command {
|
|
455
479
|
static description = "Show subscription status";
|
|
@@ -498,6 +522,21 @@ var init_status = __esm({
|
|
|
498
522
|
this.log(`
|
|
499
523
|
${chalk2.bold("Subscription Status:")}`);
|
|
500
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
|
+
}
|
|
501
540
|
this.log(` Status: ${formatStatus(result.subscriptionStatus)}`);
|
|
502
541
|
this.log(` Product: ${result.productId}`);
|
|
503
542
|
if (result.currentPeriodStart && result.currentPeriodEnd) {
|
|
@@ -555,6 +594,7 @@ ${chalk2.bold("Need more credits?")}`);
|
|
|
555
594
|
|
|
556
595
|
// src/commands/billing/__tests__/status.test.ts
|
|
557
596
|
init_client();
|
|
597
|
+
init_viemClients();
|
|
558
598
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
559
599
|
vi.mock("../../../client", () => ({
|
|
560
600
|
createBillingClient: vi.fn()
|
|
@@ -562,25 +602,37 @@ vi.mock("../../../client", () => ({
|
|
|
562
602
|
vi.mock("../../../telemetry", () => ({
|
|
563
603
|
withTelemetry: vi.fn((_cmd, fn) => fn())
|
|
564
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
|
+
}));
|
|
565
611
|
describe("ecloud billing status \u2014 top-up hint", () => {
|
|
566
612
|
let logOutput;
|
|
567
613
|
let mockBilling;
|
|
568
614
|
beforeEach(() => {
|
|
569
615
|
logOutput = [];
|
|
616
|
+
warnOutput = [];
|
|
570
617
|
mockBilling = {
|
|
571
618
|
address: "0xabcdef1234567890abcdef1234567890abcdef12",
|
|
572
619
|
getStatus: vi.fn()
|
|
573
620
|
};
|
|
574
621
|
createBillingClient.mockResolvedValue(mockBilling);
|
|
575
622
|
});
|
|
576
|
-
|
|
623
|
+
let warnOutput;
|
|
624
|
+
async function runStatusCommand(statusResult, flagOverrides = {}) {
|
|
577
625
|
const { default: BillingStatus2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
578
626
|
mockBilling.getStatus.mockResolvedValue(statusResult);
|
|
579
627
|
const cmd = new BillingStatus2([], {});
|
|
580
628
|
cmd.parse = vi.fn().mockResolvedValue({
|
|
581
|
-
flags: { product: "compute", verbose: false }
|
|
629
|
+
flags: { product: "compute", verbose: false, ...flagOverrides }
|
|
582
630
|
});
|
|
583
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
|
+
});
|
|
584
636
|
cmd.debug = vi.fn();
|
|
585
637
|
await cmd.run();
|
|
586
638
|
return logOutput;
|
|
@@ -621,5 +673,31 @@ describe("ecloud billing status \u2014 top-up hint", () => {
|
|
|
621
673
|
const fullOutput = output.join("\n");
|
|
622
674
|
expect(fullOutput).not.toContain("Need more credits?");
|
|
623
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
|
+
});
|
|
624
702
|
});
|
|
625
703
|
//# sourceMappingURL=status.test.js.map
|