@layr-labs/ecloud-cli 0.4.0 → 0.4.1

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/VERSION +2 -2
  2. package/dist/commands/auth/whoami.js +15 -0
  3. package/dist/commands/auth/whoami.js.map +1 -1
  4. package/dist/commands/billing/__tests__/status.test.js +15 -0
  5. package/dist/commands/billing/__tests__/status.test.js.map +1 -1
  6. package/dist/commands/billing/__tests__/subscribe.test.js +15 -0
  7. package/dist/commands/billing/__tests__/subscribe.test.js.map +1 -1
  8. package/dist/commands/billing/__tests__/top-up.test.js +15 -0
  9. package/dist/commands/billing/__tests__/top-up.test.js.map +1 -1
  10. package/dist/commands/billing/cancel.js +15 -0
  11. package/dist/commands/billing/cancel.js.map +1 -1
  12. package/dist/commands/billing/status.js +15 -0
  13. package/dist/commands/billing/status.js.map +1 -1
  14. package/dist/commands/billing/subscribe.js +15 -0
  15. package/dist/commands/billing/subscribe.js.map +1 -1
  16. package/dist/commands/billing/top-up.js +15 -0
  17. package/dist/commands/billing/top-up.js.map +1 -1
  18. package/dist/commands/compute/app/deploy.js +64 -3
  19. package/dist/commands/compute/app/deploy.js.map +1 -1
  20. package/dist/commands/compute/app/info.js +16 -1
  21. package/dist/commands/compute/app/info.js.map +1 -1
  22. package/dist/commands/compute/app/list.js +16 -1
  23. package/dist/commands/compute/app/list.js.map +1 -1
  24. package/dist/commands/compute/app/logs.js +16 -1
  25. package/dist/commands/compute/app/logs.js.map +1 -1
  26. package/dist/commands/compute/app/profile/set.js +16 -1
  27. package/dist/commands/compute/app/profile/set.js.map +1 -1
  28. package/dist/commands/compute/app/releases.js +16 -1
  29. package/dist/commands/compute/app/releases.js.map +1 -1
  30. package/dist/commands/compute/app/start.js +63 -3
  31. package/dist/commands/compute/app/start.js.map +1 -1
  32. package/dist/commands/compute/app/stop.js +63 -3
  33. package/dist/commands/compute/app/stop.js.map +1 -1
  34. package/dist/commands/compute/app/terminate.js +63 -3
  35. package/dist/commands/compute/app/terminate.js.map +1 -1
  36. package/dist/commands/compute/app/upgrade.js +69 -8
  37. package/dist/commands/compute/app/upgrade.js.map +1 -1
  38. package/dist/commands/compute/build/info.js +16 -1
  39. package/dist/commands/compute/build/info.js.map +1 -1
  40. package/dist/commands/compute/build/list.js +16 -1
  41. package/dist/commands/compute/build/list.js.map +1 -1
  42. package/dist/commands/compute/build/logs.js +16 -1
  43. package/dist/commands/compute/build/logs.js.map +1 -1
  44. package/dist/commands/compute/build/status.js +16 -1
  45. package/dist/commands/compute/build/status.js.map +1 -1
  46. package/dist/commands/compute/build/submit.js +16 -1
  47. package/dist/commands/compute/build/submit.js.map +1 -1
  48. package/dist/commands/compute/build/verify.js +16 -1
  49. package/dist/commands/compute/build/verify.js.map +1 -1
  50. package/dist/commands/compute/undelegate.js +16 -1
  51. package/dist/commands/compute/undelegate.js.map +1 -1
  52. package/dist/hooks/init/__tests__/version-check.test.js +565 -0
  53. package/dist/hooks/init/__tests__/version-check.test.js.map +1 -0
  54. package/dist/hooks/init/version-check.js +344 -0
  55. package/dist/hooks/init/version-check.js.map +1 -0
  56. package/package.json +5 -2
@@ -245,7 +245,7 @@ function listApps(environment) {
245
245
 
246
246
  // src/utils/version.ts
247
247
  function getCliVersion() {
248
- return true ? "0.4.0" : "0.0.0";
248
+ return true ? "0.4.1" : "0.0.0";
249
249
  }
250
250
  function getClientId() {
251
251
  return `ecloud-cli/v${getCliVersion()}`;
@@ -663,6 +663,7 @@ async function getEnvironmentInteractive(environment) {
663
663
  var MAX_IMAGE_SIZE = 4 * 1024 * 1024;
664
664
 
665
665
  // src/flags.ts
666
+ import { formatEther, parseGwei } from "viem";
666
667
  var commonFlags = {
667
668
  environment: Flags.string({
668
669
  required: false,
@@ -684,8 +685,60 @@ var commonFlags = {
684
685
  required: false,
685
686
  description: "Enable verbose logging (default: false)",
686
687
  default: false
688
+ }),
689
+ "max-fee-per-gas": Flags.string({
690
+ required: false,
691
+ description: "Override max fee per gas in gwei (e.g., 50)",
692
+ env: "ECLOUD_MAX_FEE_PER_GAS"
693
+ }),
694
+ "max-priority-fee": Flags.string({
695
+ required: false,
696
+ description: "Override max priority fee per gas in gwei (e.g., 5)",
697
+ env: "ECLOUD_MAX_PRIORITY_FEE"
698
+ }),
699
+ nonce: Flags.string({
700
+ required: false,
701
+ description: 'Override transaction nonce (integer or "latest" to replace a stuck transaction)'
687
702
  })
688
703
  };
704
+ async function applyTxOverrides(estimate, flags, opts) {
705
+ const maxFeeStr = flags["max-fee-per-gas"];
706
+ const priorityFeeStr = flags["max-priority-fee"];
707
+ const nonceStr = flags.nonce;
708
+ if (!maxFeeStr && !priorityFeeStr && nonceStr == null) return estimate;
709
+ let { gasLimit, maxFeePerGas, maxPriorityFeePerGas } = estimate;
710
+ if (maxFeeStr) {
711
+ maxFeePerGas = parseGwei(maxFeeStr);
712
+ }
713
+ if (priorityFeeStr) {
714
+ maxPriorityFeePerGas = parseGwei(priorityFeeStr);
715
+ }
716
+ if (maxFeePerGas < maxPriorityFeePerGas) {
717
+ maxFeePerGas = maxPriorityFeePerGas;
718
+ }
719
+ const maxCostWei = gasLimit * maxFeePerGas;
720
+ const eth = Number(formatEther(maxCostWei));
721
+ const maxCostEth = eth.toFixed(6).replace(/\.?0+$/, "") || "<0.000001";
722
+ let nonce;
723
+ if (nonceStr != null) {
724
+ if (nonceStr === "latest") {
725
+ if (!opts?.publicClient || !opts?.address) {
726
+ throw new Error("--nonce latest requires a public client and address");
727
+ }
728
+ nonce = await opts.publicClient.getTransactionCount({
729
+ address: opts.address,
730
+ blockTag: "latest"
731
+ });
732
+ } else {
733
+ const parsed = Number(nonceStr);
734
+ if (!Number.isInteger(parsed) || parsed < 0) {
735
+ throw new Error(`Invalid nonce: "${nonceStr}". Must be a non-negative integer or "latest".`);
736
+ }
737
+ nonce = parsed;
738
+ }
739
+ }
740
+ return { gasLimit, maxFeePerGas, maxPriorityFeePerGas, maxCostWei, maxCostEth, nonce };
741
+ }
689
742
  async function validateCommonFlags(flags, options) {
690
743
  flags["environment"] = await getEnvironmentInteractive(flags["environment"]);
691
744
  if (options?.requirePrivateKey !== false) {
@@ -833,8 +886,15 @@ var AppLifecycleTerminate = class _AppLifecycleTerminate extends Command {
833
886
  to: environmentConfig.appControllerAddress,
834
887
  data: callData
835
888
  });
889
+ const finalTx = await applyTxOverrides(estimate, flags, { publicClient, address });
890
+ if (flags["max-fee-per-gas"] || flags["max-priority-fee"]) {
891
+ this.log(chalk2.yellow(`Gas override active \u2014 max fee: ${flags["max-fee-per-gas"] || "estimated"} gwei, priority fee: ${flags["max-priority-fee"] || "estimated"} gwei`));
892
+ }
893
+ if (finalTx.nonce != null) {
894
+ this.log(chalk2.yellow(`Nonce override active \u2014 nonce: ${finalTx.nonce}`));
895
+ }
836
896
  if (!flags.force) {
837
- const costInfo = isMainnet(environmentConfig) ? ` (cost: up to ${estimate.maxCostEth} ETH)` : "";
897
+ const costInfo = isMainnet(environmentConfig) ? ` (cost: up to ${finalTx.maxCostEth} ETH)` : "";
838
898
  const confirmed = await confirm(`\u26A0\uFE0F Permanently destroy app ${appId}${costInfo}?`);
839
899
  if (!confirmed) {
840
900
  this.log(`
@@ -843,7 +903,7 @@ ${chalk2.gray(`Termination aborted`)}`);
843
903
  }
844
904
  }
845
905
  const res = await compute.app.terminate(appId, {
846
- gas: estimate
906
+ gas: finalTx
847
907
  });
848
908
  if (!res.tx) {
849
909
  this.log(`