@settlemint/sdk-cli 2.1.4-prcda675ba → 2.1.4-prd4abaa86

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/dist/cli.js CHANGED
@@ -245340,7 +245340,7 @@ function pruneCurrentEnv(currentEnv, env2) {
245340
245340
  var package_default = {
245341
245341
  name: "@settlemint/sdk-cli",
245342
245342
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
245343
- version: "2.1.4-prcda675ba",
245343
+ version: "2.1.4-prd4abaa86",
245344
245344
  type: "module",
245345
245345
  private: false,
245346
245346
  license: "FSL-1.1-MIT",
@@ -245389,8 +245389,8 @@ var package_default = {
245389
245389
  "@inquirer/input": "4.1.9",
245390
245390
  "@inquirer/password": "4.0.12",
245391
245391
  "@inquirer/select": "4.1.1",
245392
- "@settlemint/sdk-js": "2.1.4-prcda675ba",
245393
- "@settlemint/sdk-utils": "2.1.4-prcda675ba",
245392
+ "@settlemint/sdk-js": "2.1.4-prd4abaa86",
245393
+ "@settlemint/sdk-utils": "2.1.4-prd4abaa86",
245394
245394
  "@types/node": "22.14.1",
245395
245395
  "@types/semver": "7.7.0",
245396
245396
  "@types/which": "3.0.4",
@@ -246566,6 +246566,13 @@ var cancel2 = (msg) => {
246566
246566
  console.log("");
246567
246567
  throw new CancelError2(msg);
246568
246568
  };
246569
+ var CommandError = class extends Error {
246570
+ constructor(message, code, output) {
246571
+ super(message);
246572
+ this.code = code;
246573
+ this.output = output;
246574
+ }
246575
+ };
246569
246576
  async function executeCommand(command, args, options) {
246570
246577
  const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
246571
246578
  process.stdin.pipe(child.stdin);
@@ -246585,14 +246592,14 @@ async function executeCommand(command, args, options) {
246585
246592
  }
246586
246593
  output.push(maskedData);
246587
246594
  });
246588
- child.on("error", (err) => reject(err));
246595
+ child.on("error", (err) => reject(new CommandError(err.message, "code" in err && typeof err.code === "number" ? err.code : 1, output)));
246589
246596
  child.on("close", (code) => {
246590
246597
  if (code === 0 || code === null || code === 143) {
246591
246598
  process.stdin.unpipe(child.stdin);
246592
246599
  resolve(output);
246593
246600
  return;
246594
246601
  }
246595
- reject(new Error(`Command "${command}" exited with code ${code}`));
246602
+ reject(new CommandError(`Command "${command}" exited with code ${code}`, code, output));
246596
246603
  });
246597
246604
  });
246598
246605
  }
@@ -250085,6 +250092,16 @@ function tryParseJson3(value2, defaultValue = null) {
250085
250092
  return defaultValue;
250086
250093
  }
250087
250094
  }
250095
+ function extractJsonObject(value2) {
250096
+ if (value2.length > 1000) {
250097
+ throw new Error("Input too long");
250098
+ }
250099
+ const result = /\{([\s\S]*)\}/.exec(value2);
250100
+ if (!result) {
250101
+ return null;
250102
+ }
250103
+ return tryParseJson3(result[0]);
250104
+ }
250088
250105
  async function retryWhenFailed2(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
250089
250106
  let attempt = 0;
250090
250107
  while (attempt < maxRetries) {
@@ -252033,7 +252050,8 @@ async function codegenBlockscout(env2) {
252033
252050
  }
252034
252051
  }
252035
252052
  }
252036
- `
252053
+ `,
252054
+ operationName: "IntrospectionQuery"
252037
252055
  })
252038
252056
  });
252039
252057
  await writeFile6(introspectionJsonPath, JSON.stringify(data));
@@ -257901,7 +257919,17 @@ function loadBalancerEvmCreateCommand() {
257901
257919
  type: "load balancer",
257902
257920
  subType: "EVM",
257903
257921
  execute: (cmd2, baseAction) => {
257904
- addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").action(async (name3, { application, provider, region, size, type: type4, blockchainNodes, acceptDefaults, ...defaultArgs }) => {
257922
+ addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").option("--blockchain-network <blockchainNetwork>", "Blockchain network unique name where the load balancer connects to").action(async (name3, {
257923
+ application,
257924
+ provider,
257925
+ region,
257926
+ size,
257927
+ type: type4,
257928
+ blockchainNodes,
257929
+ blockchainNetwork,
257930
+ acceptDefaults,
257931
+ ...defaultArgs
257932
+ }) => {
257905
257933
  return baseAction({
257906
257934
  ...defaultArgs,
257907
257935
  acceptDefaults,
@@ -257912,11 +257940,12 @@ function loadBalancerEvmCreateCommand() {
257912
257940
  if (!applicationUniqueName) {
257913
257941
  return missingApplication();
257914
257942
  }
257915
- let networkUniqueName;
257943
+ const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257944
+ let networkUniqueName = blockchainNetwork;
257916
257945
  let connectedNodesUniqueNames = blockchainNodes;
257917
257946
  if (!connectedNodesUniqueNames) {
257918
257947
  const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
257919
- const network = await blockchainNetworkPrompt({
257948
+ const network = networkUniqueName ? networks.find((network2) => network2.uniqueName === networkUniqueName) : await blockchainNetworkPrompt({
257920
257949
  env: env2,
257921
257950
  networks,
257922
257951
  accept: acceptDefaults,
@@ -257926,31 +257955,29 @@ function loadBalancerEvmCreateCommand() {
257926
257955
  return nothingSelectedError("blockchain network");
257927
257956
  }
257928
257957
  networkUniqueName = network.uniqueName;
257929
- const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257930
257958
  const connectedNodes = await blockchainNodePrompt({
257931
257959
  env: env2,
257932
- nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
257960
+ nodes: applicationBlockchainNodes.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
257933
257961
  accept: acceptDefaults,
257934
257962
  promptMessage: "Which blockchain node do you want to connect the load balancer to?",
257935
257963
  allowAll: true
257936
257964
  });
257937
- connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
257965
+ connectedNodesUniqueNames = Array.isArray(connectedNodes) ? applicationBlockchainNodes.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
257938
257966
  }
257939
257967
  if (connectedNodesUniqueNames.length === 0) {
257940
257968
  return cancel2("A load balancer must connect to at least one blockchain node");
257941
257969
  }
257970
+ const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
257971
+ if (selectedBlockchainNodes.length === 0) {
257972
+ return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
257973
+ }
257942
257974
  if (!networkUniqueName) {
257943
- const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257944
- const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
257945
- if (selectedBlockchainNodes.length === 0) {
257946
- return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
257947
- }
257948
- const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
257949
- if (!onTheSameNetwork) {
257950
- return cancel2("Blockchain nodes must be on the same network");
257951
- }
257952
257975
  networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
257953
257976
  }
257977
+ const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === networkUniqueName);
257978
+ if (!onTheSameNetwork) {
257979
+ return cancel2("Blockchain nodes must be on the same network");
257980
+ }
257954
257981
  const result = await showSpinner(() => settlemint.loadBalancer.create({
257955
257982
  applicationUniqueName,
257956
257983
  name: name3,
@@ -259742,15 +259769,21 @@ Please select another key or activate this key on the node and try again.`, "war
259742
259769
  async function getHardhatConfigData(envConfig) {
259743
259770
  try {
259744
259771
  const { command, args } = await getPackageManagerExecutable();
259745
- const output = await executeCommand(command, [...args, "ts-node", "-e", `import hardhat from "hardhat";
259746
- console.log(JSON.stringify(hardhat.userConfig));`], {
259772
+ const output = await executeCommand(command, [
259773
+ ...args,
259774
+ "ts-node",
259775
+ "-e",
259776
+ `import hardhat from "hardhat";
259777
+ console.log(JSON.stringify(hardhat.userConfig));`,
259778
+ "--transpileOnly"
259779
+ ], {
259747
259780
  env: {
259748
259781
  ...process.env,
259749
259782
  ...envConfig
259750
259783
  },
259751
259784
  silent: true
259752
259785
  });
259753
- const config3 = tryParseJson3(output.join(" "));
259786
+ const config3 = extractJsonObject(output.join(" "));
259754
259787
  if (isHardhatConfig(config3)) {
259755
259788
  return config3;
259756
259789
  }
@@ -260473,4 +260506,4 @@ async function sdkCliCommand(argv = process.argv) {
260473
260506
  // src/cli.ts
260474
260507
  sdkCliCommand();
260475
260508
 
260476
- //# debugId=8290A2EBAC128E3064756E2164756E21
260509
+ //# debugId=121DC85F3324605764756E2164756E21