@layr-labs/ecloud-cli 0.4.0 → 0.4.1-dev

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
@@ -305,7 +305,7 @@ function findAvailableName(environment, baseName) {
305
305
 
306
306
  // src/utils/version.ts
307
307
  function getCliVersion() {
308
- return true ? "0.4.0" : "0.0.0";
308
+ return true ? "0.4.1-dev" : "0.0.0";
309
309
  }
310
310
  function getClientId() {
311
311
  return `ecloud-cli/v${getCliVersion()}`;
@@ -1218,6 +1218,7 @@ function imagePathToBlob(imagePath) {
1218
1218
  }
1219
1219
 
1220
1220
  // src/flags.ts
1221
+ import { formatEther, parseGwei } from "viem";
1221
1222
  var commonFlags = {
1222
1223
  environment: Flags.string({
1223
1224
  required: false,
@@ -1239,8 +1240,60 @@ var commonFlags = {
1239
1240
  required: false,
1240
1241
  description: "Enable verbose logging (default: false)",
1241
1242
  default: false
1243
+ }),
1244
+ "max-fee-per-gas": Flags.string({
1245
+ required: false,
1246
+ description: "Override max fee per gas in gwei (e.g., 50)",
1247
+ env: "ECLOUD_MAX_FEE_PER_GAS"
1248
+ }),
1249
+ "max-priority-fee": Flags.string({
1250
+ required: false,
1251
+ description: "Override max priority fee per gas in gwei (e.g., 5)",
1252
+ env: "ECLOUD_MAX_PRIORITY_FEE"
1253
+ }),
1254
+ nonce: Flags.string({
1255
+ required: false,
1256
+ description: 'Override transaction nonce (integer or "latest" to replace a stuck transaction)'
1242
1257
  })
1243
1258
  };
1259
+ async function applyTxOverrides(estimate, flags, opts) {
1260
+ const maxFeeStr = flags["max-fee-per-gas"];
1261
+ const priorityFeeStr = flags["max-priority-fee"];
1262
+ const nonceStr = flags.nonce;
1263
+ if (!maxFeeStr && !priorityFeeStr && nonceStr == null) return estimate;
1264
+ let { gasLimit, maxFeePerGas, maxPriorityFeePerGas } = estimate;
1265
+ if (maxFeeStr) {
1266
+ maxFeePerGas = parseGwei(maxFeeStr);
1267
+ }
1268
+ if (priorityFeeStr) {
1269
+ maxPriorityFeePerGas = parseGwei(priorityFeeStr);
1270
+ }
1271
+ if (maxFeePerGas < maxPriorityFeePerGas) {
1272
+ maxFeePerGas = maxPriorityFeePerGas;
1273
+ }
1274
+ const maxCostWei = gasLimit * maxFeePerGas;
1275
+ const eth = Number(formatEther(maxCostWei));
1276
+ const maxCostEth = eth.toFixed(6).replace(/\.?0+$/, "") || "<0.000001";
1277
+ let nonce;
1278
+ if (nonceStr != null) {
1279
+ if (nonceStr === "latest") {
1280
+ if (!opts?.publicClient || !opts?.address) {
1281
+ throw new Error("--nonce latest requires a public client and address");
1282
+ }
1283
+ nonce = await opts.publicClient.getTransactionCount({
1284
+ address: opts.address,
1285
+ blockTag: "latest"
1286
+ });
1287
+ } else {
1288
+ const parsed = Number(nonceStr);
1289
+ if (!Number.isInteger(parsed) || parsed < 0) {
1290
+ throw new Error(`Invalid nonce: "${nonceStr}". Must be a non-negative integer or "latest".`);
1291
+ }
1292
+ nonce = parsed;
1293
+ }
1294
+ }
1295
+ return { gasLimit, maxFeePerGas, maxPriorityFeePerGas, maxCostWei, maxCostEth, nonce };
1296
+ }
1244
1297
  async function validateCommonFlags(flags, options) {
1245
1298
  flags["environment"] = await getEnvironmentInteractive(flags["environment"]);
1246
1299
  if (options?.requirePrivateKey !== false) {
@@ -1800,8 +1853,16 @@ Warning: Wallet ${chalk2.bold(address)} has zero balance on ${environment}.`)
1800
1853
  resourceUsageMonitoring,
1801
1854
  billTo: "developer"
1802
1855
  });
1856
+ const finalTx = await applyTxOverrides(gasEstimate, flags, { publicClient, address });
1857
+ if (flags["max-fee-per-gas"] || flags["max-priority-fee"]) {
1858
+ this.log(chalk2.yellow(`
1859
+ Gas override active \u2014 max fee: ${flags["max-fee-per-gas"] || "estimated"} gwei, priority fee: ${flags["max-priority-fee"] || "estimated"} gwei`));
1860
+ }
1861
+ if (finalTx.nonce != null) {
1862
+ this.log(chalk2.yellow(`Nonce override active \u2014 nonce: ${finalTx.nonce}`));
1863
+ }
1803
1864
  this.log(`
1804
- Estimated transaction cost: ${chalk2.cyan(gasEstimate.maxCostEth)} ETH`);
1865
+ Estimated transaction cost: ${chalk2.cyan(finalTx.maxCostEth)} ETH`);
1805
1866
  if (isMainnet(environmentConfig)) {
1806
1867
  const confirmed = await confirm(`Continue with deployment?`);
1807
1868
  if (!confirmed) {
@@ -1810,7 +1871,7 @@ ${chalk2.gray(`Deployment cancelled`)}`);
1810
1871
  return;
1811
1872
  }
1812
1873
  }
1813
- const res = await compute.app.executeDeploy(prepared, gasEstimate);
1874
+ const res = await compute.app.executeDeploy(prepared, finalTx);
1814
1875
  if (!flags["skip-profile"]) {
1815
1876
  const hasProfileFlags = flags.website || flags.description || flags["x-url"] || flags.image;
1816
1877
  let profile = null;