@settlemint/sdk-cli 2.1.4-pr342331b7 → 2.1.4-pr3684fc8b

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
@@ -245278,7 +245278,7 @@ function pruneCurrentEnv(currentEnv, env2) {
245278
245278
  var package_default = {
245279
245279
  name: "@settlemint/sdk-cli",
245280
245280
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
245281
- version: "2.1.4-pr342331b7",
245281
+ version: "2.1.4-pr3684fc8b",
245282
245282
  type: "module",
245283
245283
  private: false,
245284
245284
  license: "FSL-1.1-MIT",
@@ -245327,8 +245327,8 @@ var package_default = {
245327
245327
  "@inquirer/input": "4.1.9",
245328
245328
  "@inquirer/password": "4.0.12",
245329
245329
  "@inquirer/select": "4.1.1",
245330
- "@settlemint/sdk-js": "2.1.4-pr342331b7",
245331
- "@settlemint/sdk-utils": "2.1.4-pr342331b7",
245330
+ "@settlemint/sdk-js": "2.1.4-pr3684fc8b",
245331
+ "@settlemint/sdk-utils": "2.1.4-pr3684fc8b",
245332
245332
  "@types/node": "22.14.1",
245333
245333
  "@types/semver": "7.7.0",
245334
245334
  "@types/which": "3.0.4",
@@ -252319,6 +252319,17 @@ async function servicePrompt({
252319
252319
  });
252320
252320
  }
252321
252321
 
252322
+ // src/utils/cluster-service.ts
252323
+ function isValidPrivateKey(privateKey) {
252324
+ return privateKey.privateKeyType !== "HD_ECDSA_P256";
252325
+ }
252326
+ function hasValidPrivateKey(service) {
252327
+ return (service.privateKeys ?? []).some(isValidPrivateKey);
252328
+ }
252329
+ function isRunning(service) {
252330
+ return service === undefined || service?.status === "COMPLETED";
252331
+ }
252332
+
252322
252333
  // src/prompts/cluster-service/blockchain-node.prompt.ts
252323
252334
  async function blockchainNodePrompt({
252324
252335
  env: env2,
@@ -252338,12 +252349,12 @@ async function blockchainNodePrompt({
252338
252349
  isRequired,
252339
252350
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
252340
252351
  const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
252341
- return Array.isArray(node) ? true : node === undefined || node?.status === "COMPLETED";
252352
+ return Array.isArray(node) ? true : isRunning(node);
252342
252353
  }).map((item) => {
252343
252354
  if (Array.isArray(item.value)) {
252344
252355
  return {
252345
252356
  ...item,
252346
- value: item.value.filter((n6) => n6 === undefined || n6.status === "COMPLETED")
252357
+ value: item.value.filter(isRunning)
252347
252358
  };
252348
252359
  }
252349
252360
  return item;
@@ -252351,7 +252362,7 @@ async function blockchainNodePrompt({
252351
252362
  return esm_default3({
252352
252363
  message: promptMessage ?? "Which blockchain node do you want to connect to?",
252353
252364
  choices: filteredChoices,
252354
- default: defaultNode
252365
+ default: allowAll ? nodes : defaultNode
252355
252366
  });
252356
252367
  },
252357
252368
  singleOptionMessage,
@@ -252844,7 +252855,7 @@ async function blockchainNodeOrLoadBalancerPrompt({
252844
252855
  }) {
252845
252856
  return servicePrompt({
252846
252857
  env: env2,
252847
- services: [...nodes, ...loadBalancers],
252858
+ services: [...loadBalancers, ...nodes],
252848
252859
  accept,
252849
252860
  envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
252850
252861
  isRequired,
@@ -252894,7 +252905,7 @@ function connectCommand() {
252894
252905
  env: env2,
252895
252906
  nodes: nodesWithPrivateKey,
252896
252907
  accept: acceptDefaults,
252897
- promptMessage: "Which blockchain node do you want to SEND unsigned transactions from?"
252908
+ promptMessage: "Which blockchain node do you want to use for sending transactions?"
252898
252909
  });
252899
252910
  const nodesWithoutPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? !Array.isArray(node?.privateKeys) || node?.privateKeys?.length === 0 : true);
252900
252911
  const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
@@ -252902,7 +252913,7 @@ function connectCommand() {
252902
252913
  nodes: nodesWithoutPrivateKey,
252903
252914
  loadBalancers,
252904
252915
  accept: acceptDefaults,
252905
- promptMessage: "Which blockchain node or load balancer do you want to READ/WRITE from/to? Transactions should be signed before sending to this node or load balancer"
252916
+ promptMessage: "Which blockchain node or load balancer do you want to use for read operations?"
252906
252917
  });
252907
252918
  const hasura = await hasuraPrompt({
252908
252919
  env: env2,
@@ -252968,12 +252979,12 @@ function connectCommand() {
252968
252979
  uniqueName: blockchainNode.blockchainNetwork?.uniqueName
252969
252980
  },
252970
252981
  blockchainNode && {
252971
- type: "Blockchain Node",
252982
+ type: "Blockchain Node (with private key, use for sending transactions)",
252972
252983
  name: blockchainNode.name,
252973
252984
  uniqueName: blockchainNode.uniqueName
252974
252985
  },
252975
252986
  loadBalancerOrBlockchainNode && {
252976
- type: "Blockchain Node or Load Balancer (signed transactions only)",
252987
+ type: "Blockchain Node or Load Balancer (without private key, use for read operations)",
252977
252988
  name: loadBalancerOrBlockchainNode.name,
252978
252989
  uniqueName: loadBalancerOrBlockchainNode.uniqueName
252979
252990
  },
@@ -256894,7 +256905,10 @@ function getCreateCommand({
256894
256905
  usePersonalAccessToken = true,
256895
256906
  requiresDeployment = true
256896
256907
  }) {
256897
- const cmd2 = new Command(sanitizeCommandName(name3)).alias(alias).description(`Create a new ${subType ? `${subType} ${type4}` : type4} in the SettleMint platform.`).usage(createExamples(examples)).argument("<name>", `The ${subType ? `${subType} ${type4}` : type4} name`).option("-a, --accept-defaults", "Accept the default values").option("-d, --default", `Save as default ${type4}`).option("--prod", "Connect to production environment");
256908
+ const cmd2 = new Command(sanitizeCommandName(name3)).description(`Create a new ${subType ? `${subType} ${type4}` : type4} in the SettleMint platform.`).usage(createExamples(examples)).argument("<name>", `The ${subType ? `${subType} ${type4}` : type4} name`).option("-a, --accept-defaults", "Accept the default values").option("-d, --default", `Save as default ${type4}`).option("--prod", "Connect to production environment");
256909
+ if (alias) {
256910
+ cmd2.alias(alias);
256911
+ }
256898
256912
  if (requiresDeployment) {
256899
256913
  cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
256900
256914
  }
@@ -257608,7 +257622,6 @@ function loadBalancerEvmCreateCommand() {
257608
257622
  name: "evm",
257609
257623
  type: "load balancer",
257610
257624
  subType: "EVM",
257611
- alias: "e",
257612
257625
  execute: (cmd2, baseAction) => {
257613
257626
  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 }) => {
257614
257627
  return baseAction({
@@ -257634,21 +257647,25 @@ function loadBalancerEvmCreateCommand() {
257634
257647
  if (!network) {
257635
257648
  return nothingSelectedError("blockchain network");
257636
257649
  }
257650
+ networkUniqueName = network.uniqueName;
257637
257651
  const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257638
257652
  const connectedNodes = await blockchainNodePrompt({
257639
257653
  env: env2,
257640
- nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === networkUniqueName),
257654
+ nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
257641
257655
  accept: acceptDefaults,
257642
257656
  promptMessage: "Which blockchain node do you want to connect the load balancer to?",
257643
257657
  allowAll: true
257644
257658
  });
257645
257659
  connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
257646
257660
  }
257661
+ if (connectedNodesUniqueNames.length === 0) {
257662
+ return cancel2("A load balancer must connect to at least one blockchain node");
257663
+ }
257647
257664
  if (!networkUniqueName) {
257648
257665
  const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257649
257666
  const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
257650
257667
  if (selectedBlockchainNodes.length === 0) {
257651
- return cancel2("blockchain network");
257668
+ return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
257652
257669
  }
257653
257670
  const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
257654
257671
  if (!onTheSameNetwork) {
@@ -257685,7 +257702,7 @@ function loadBalancerEvmCreateCommand() {
257685
257702
  },
257686
257703
  {
257687
257704
  description: "Create an EVM load balancer and connect to specific blockchain nodes",
257688
- command: "platform create load-balancer evm my-lb --blockchain-nodes my-node1 my-node2 --accept-defaults"
257705
+ command: "platform create load-balancer evm my-lb --blockchain-network my-network --accept-defaults"
257689
257706
  },
257690
257707
  {
257691
257708
  description: "Create an EVM load balancer in a different application",
@@ -257811,25 +257828,19 @@ function smartContractPortalMiddlewareCreateCommand() {
257811
257828
  return missingApplication();
257812
257829
  }
257813
257830
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257814
- let loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257831
+ const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257815
257832
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257816
257833
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257817
- const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257818
- const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257834
+ const node = await blockchainNodePrompt({
257819
257835
  env: env2,
257820
- nodes: blockchainNodes,
257821
- loadBalancers,
257836
+ nodes: blockchainNodes.filter(hasValidPrivateKey),
257822
257837
  accept: acceptDefaults,
257823
257838
  isRequired: true
257824
257839
  });
257825
- if (!nodeOrLoadbalancer) {
257826
- return nothingSelectedError("blockchain node or load balancer");
257827
- }
257828
- if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
257829
- loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
257830
- } else {
257831
- blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
257840
+ if (!node) {
257841
+ return nothingSelectedError("blockchain node");
257832
257842
  }
257843
+ blockchainNodeUniqueName = node.uniqueName;
257833
257844
  }
257834
257845
  const parsedAbis = [];
257835
257846
  if (abis && abis.length > 0) {
@@ -259362,11 +259373,6 @@ function getStatusAction(status) {
259362
259373
  return "Please try again later.";
259363
259374
  }
259364
259375
 
259365
- // src/utils/blockchain-node.ts
259366
- function validPrivateKey(privateKey) {
259367
- return privateKey.privateKeyType !== "HD_ECDSA_P256";
259368
- }
259369
-
259370
259376
  // src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
259371
259377
  async function selectTargetNode({
259372
259378
  env: env2,
@@ -259412,7 +259418,7 @@ function validateNode(node, cancelOnError = true) {
259412
259418
  }
259413
259419
  return false;
259414
259420
  }
259415
- if (node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)).length === 0) {
259421
+ if (!hasValidPrivateKey(node)) {
259416
259422
  if (cancelOnError) {
259417
259423
  cancel2(`The specified blockchain node '${node.uniqueName}' does not have an ECDSA P256 or HSM ECDSA P256 private key activated. Please activate an ECDSA P256 or HSM ECDSA P256 private key on your node and try again.`);
259418
259424
  }
@@ -259433,7 +259439,7 @@ async function addressPrompt({
259433
259439
  node,
259434
259440
  hardhatConfig
259435
259441
  }) {
259436
- const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
259442
+ const possiblePrivateKeys = node.privateKeys?.filter(isValidPrivateKey) ?? [];
259437
259443
  const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
259438
259444
  const defaultPossible = accept && defaultAddress;
259439
259445
  if (defaultPossible) {
@@ -260189,4 +260195,4 @@ async function sdkCliCommand(argv = process.argv) {
260189
260195
  // src/cli.ts
260190
260196
  sdkCliCommand();
260191
260197
 
260192
- //# debugId=3C7A15E5B9DDE09164756E2164756E21
260198
+ //# debugId=AE33F8D2DF044D0964756E2164756E21