@settlemint/sdk-cli 2.1.4-pr4f40641b → 2.1.4-pr66a97677

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 (3) hide show
  1. package/dist/cli.js +354 -66
  2. package/dist/cli.js.map +34 -29
  3. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -245085,7 +245085,7 @@ var DotEnvSchema = z.object({
245085
245085
  SETTLEMINT_APPLICATION: UniqueNameSchema.optional(),
245086
245086
  SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema.optional(),
245087
245087
  SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema.optional(),
245088
- SETTLEMINT_LOAD_BALANCER: UniqueNameSchema.optional(),
245088
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema.optional(),
245089
245089
  SETTLEMINT_HASURA: UniqueNameSchema.optional(),
245090
245090
  SETTLEMINT_HASURA_ENDPOINT: UrlSchema.optional(),
245091
245091
  SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
@@ -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-pr4f40641b",
245281
+ version: "2.1.4-pr66a97677",
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-pr4f40641b",
245331
- "@settlemint/sdk-utils": "2.1.4-pr4f40641b",
245330
+ "@settlemint/sdk-js": "2.1.4-pr66a97677",
245331
+ "@settlemint/sdk-utils": "2.1.4-pr66a97677",
245332
245332
  "@types/node": "22.14.1",
245333
245333
  "@types/semver": "7.7.0",
245334
245334
  "@types/which": "3.0.4",
@@ -246742,7 +246742,7 @@ var DotEnvSchema2 = z.object({
246742
246742
  SETTLEMINT_APPLICATION: UniqueNameSchema2.optional(),
246743
246743
  SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema2.optional(),
246744
246744
  SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema2.optional(),
246745
- SETTLEMINT_LOAD_BALANCER: UniqueNameSchema2.optional(),
246745
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: UniqueNameSchema2.optional(),
246746
246746
  SETTLEMINT_HASURA: UniqueNameSchema2.optional(),
246747
246747
  SETTLEMINT_HASURA_ENDPOINT: UrlSchema2.optional(),
246748
246748
  SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
@@ -248059,6 +248059,47 @@ var getLoadBalancer = graphql(`
248059
248059
  }
248060
248060
  }
248061
248061
  `, [LoadBalancerFragment]);
248062
+ var getLoadBalancers = graphql(`
248063
+ query getLoadBalancers($applicationUniqueName: String!) {
248064
+ loadBalancersByUniqueName(applicationUniqueName: $applicationUniqueName) {
248065
+ items {
248066
+ ...LoadBalancer
248067
+ }
248068
+ }
248069
+ }
248070
+ `, [LoadBalancerFragment]);
248071
+ var createLoadBalancer = graphql(`
248072
+ mutation createLoadBalancer(
248073
+ $applicationId: ID!
248074
+ $blockchainNetworkId: ID!
248075
+ $name: String!
248076
+ $provider: String!
248077
+ $region: String!
248078
+ $size: ClusterServiceSize
248079
+ $type: ClusterServiceType
248080
+ $connectedNodes: [ID!]!
248081
+ ) {
248082
+ createLoadBalancer(
248083
+ applicationId: $applicationId
248084
+ blockchainNetworkId: $blockchainNetworkId
248085
+ name: $name
248086
+ provider: $provider
248087
+ region: $region
248088
+ size: $size
248089
+ type: $type
248090
+ connectedNodes: $connectedNodes
248091
+ ) {
248092
+ ...LoadBalancer
248093
+ }
248094
+ }
248095
+ `, [LoadBalancerFragment]);
248096
+ var restartLoadBalancer = graphql(`
248097
+ mutation RestartLoadBalancer($uniqueName: String!) {
248098
+ restartLoadBalancerByUniqueName(uniqueName: $uniqueName) {
248099
+ ...LoadBalancer
248100
+ }
248101
+ }
248102
+ `, [LoadBalancerFragment]);
248062
248103
  var loadBalancerRead = (gqlClient) => {
248063
248104
  return async (loadBalancerUniqueName) => {
248064
248105
  const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {
@@ -248067,6 +248108,37 @@ var loadBalancerRead = (gqlClient) => {
248067
248108
  return loadBalancer;
248068
248109
  };
248069
248110
  };
248111
+ var loadBalancerList = (gqlClient) => {
248112
+ return async (applicationUniqueName) => {
248113
+ const {
248114
+ loadBalancersByUniqueName: { items }
248115
+ } = await gqlClient.request(getLoadBalancers, { applicationUniqueName });
248116
+ return items;
248117
+ };
248118
+ };
248119
+ var loadBalancerCreate = (gqlClient) => {
248120
+ return async (args) => {
248121
+ const { applicationUniqueName, blockchainNetworkUniqueName, connectedNodesUniqueNames, ...otherArgs } = args;
248122
+ const [application, blockchainNetwork, connectedNodes] = await Promise.all([
248123
+ applicationRead(gqlClient)(applicationUniqueName),
248124
+ blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName),
248125
+ Promise.all(connectedNodesUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName)))
248126
+ ]);
248127
+ const { createLoadBalancer: loadBalancer } = await gqlClient.request(createLoadBalancer, {
248128
+ ...otherArgs,
248129
+ applicationId: application.id,
248130
+ blockchainNetworkId: blockchainNetwork.id,
248131
+ connectedNodes: connectedNodes.map((node) => node.id)
248132
+ });
248133
+ return loadBalancer;
248134
+ };
248135
+ };
248136
+ var loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
248137
+ const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, {
248138
+ uniqueName: loadBalancerUniqueName
248139
+ });
248140
+ return loadBalancer;
248141
+ };
248070
248142
  var InsightsFragment = graphql(`
248071
248143
  fragment Insights on Insights {
248072
248144
  __typename
@@ -248767,6 +248839,12 @@ function createSettleMintClient(options) {
248767
248839
  create: blockchainNodeCreate(gqlClient),
248768
248840
  restart: blockchainNodeRestart(gqlClient)
248769
248841
  },
248842
+ loadBalancer: {
248843
+ list: loadBalancerList(gqlClient),
248844
+ read: loadBalancerRead(gqlClient),
248845
+ create: loadBalancerCreate(gqlClient),
248846
+ restart: loadBalancerRestart(gqlClient)
248847
+ },
248770
248848
  middleware: {
248771
248849
  list: middlewareList(gqlClient),
248772
248850
  read: middlewareRead(gqlClient),
@@ -252190,6 +252268,7 @@ async function applicationPrompt(env2, applications, accept) {
252190
252268
  }
252191
252269
 
252192
252270
  // src/prompts/cluster-service/service.prompt.ts
252271
+ var ALL2 = "All";
252193
252272
  async function servicePrompt({
252194
252273
  env: env2,
252195
252274
  services,
@@ -252198,12 +252277,13 @@ async function servicePrompt({
252198
252277
  defaultHandler,
252199
252278
  isRequired = false,
252200
252279
  isCi = is_in_ci_default,
252201
- singleOptionMessage
252280
+ singleOptionMessage,
252281
+ allowAll = false
252202
252282
  }) {
252203
252283
  if (services.length === 0) {
252204
252284
  return;
252205
252285
  }
252206
- const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
252286
+ const selectedService = services.find((service) => Array.isArray(service) ? false : service.uniqueName === env2[envKey]);
252207
252287
  const autoAccept = isCi || accept;
252208
252288
  if (autoAccept && selectedService) {
252209
252289
  return selectedService;
@@ -252212,7 +252292,7 @@ async function servicePrompt({
252212
252292
  return;
252213
252293
  }
252214
252294
  if (isRequired && services.length === 1) {
252215
- if (singleOptionMessage) {
252295
+ if (singleOptionMessage && !Array.isArray(services[0])) {
252216
252296
  note(singleOptionMessage(services[0].uniqueName));
252217
252297
  }
252218
252298
  return services[0];
@@ -252221,13 +252301,22 @@ async function servicePrompt({
252221
252301
  name: `${service.name} (${service.uniqueName})`,
252222
252302
  value: service
252223
252303
  }));
252304
+ if (allowAll) {
252305
+ choices.unshift({
252306
+ name: ALL2,
252307
+ value: services
252308
+ });
252309
+ }
252224
252310
  if (!isRequired) {
252225
252311
  choices.push({
252226
252312
  name: "None",
252227
252313
  value: undefined
252228
252314
  });
252229
252315
  }
252230
- return defaultHandler({ defaultService: selectedService, choices });
252316
+ return defaultHandler({
252317
+ defaultService: selectedService,
252318
+ choices
252319
+ });
252231
252320
  }
252232
252321
 
252233
252322
  // src/prompts/cluster-service/blockchain-node.prompt.ts
@@ -252238,7 +252327,8 @@ async function blockchainNodePrompt({
252238
252327
  singleOptionMessage,
252239
252328
  promptMessage,
252240
252329
  filterRunningOnly = false,
252241
- isRequired = false
252330
+ isRequired = false,
252331
+ allowAll = false
252242
252332
  }) {
252243
252333
  return servicePrompt({
252244
252334
  env: env2,
@@ -252247,14 +252337,25 @@ async function blockchainNodePrompt({
252247
252337
  envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
252248
252338
  isRequired,
252249
252339
  defaultHandler: async ({ defaultService: defaultNode, choices }) => {
252250
- const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
252340
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => {
252341
+ return Array.isArray(node) ? true : node === undefined || node?.status === "COMPLETED";
252342
+ }).map((item) => {
252343
+ if (Array.isArray(item.value)) {
252344
+ return {
252345
+ ...item,
252346
+ value: item.value.filter((n6) => n6 === undefined || n6.status === "COMPLETED")
252347
+ };
252348
+ }
252349
+ return item;
252350
+ }) : choices;
252251
252351
  return esm_default3({
252252
252352
  message: promptMessage ?? "Which blockchain node do you want to connect to?",
252253
252353
  choices: filteredChoices,
252254
252354
  default: defaultNode
252255
252355
  });
252256
252356
  },
252257
- singleOptionMessage
252357
+ singleOptionMessage,
252358
+ allowAll
252258
252359
  });
252259
252360
  }
252260
252361
 
@@ -252559,7 +252660,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252559
252660
  storages,
252560
252661
  privateKeys,
252561
252662
  insights,
252562
- customDeployments
252663
+ customDeployments,
252664
+ loadBalancers
252563
252665
  ] = await Promise.all([
252564
252666
  shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
252565
252667
  shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
@@ -252568,7 +252670,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252568
252670
  shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
252569
252671
  shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
252570
252672
  shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
252571
- shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
252673
+ shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([]),
252674
+ shouldFetch("load-balancer") ? settlemint.loadBalancer.list(applicationUniqueName) : Promise.resolve([])
252572
252675
  ]);
252573
252676
  return {
252574
252677
  blockchainNetworks,
@@ -252578,7 +252681,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
252578
252681
  storages,
252579
252682
  privateKeys,
252580
252683
  insights,
252581
- customDeployments
252684
+ customDeployments,
252685
+ loadBalancers
252582
252686
  };
252583
252687
  }
252584
252688
  });
@@ -252618,7 +252722,7 @@ async function writeEnvSpinner(prod, env2) {
252618
252722
  SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
252619
252723
  SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
252620
252724
  SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
252621
- SETTLEMINT_LOAD_BALANCER: env2.SETTLEMINT_LOAD_BALANCER,
252725
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER,
252622
252726
  SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
252623
252727
  SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
252624
252728
  SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
@@ -252727,6 +252831,35 @@ function getMinioEndpoints(service) {
252727
252831
  };
252728
252832
  }
252729
252833
 
252834
+ // src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
252835
+ async function blockchainNodeOrLoadBalancerPrompt({
252836
+ env: env2,
252837
+ nodes,
252838
+ loadBalancers,
252839
+ accept,
252840
+ singleOptionMessage,
252841
+ promptMessage,
252842
+ filterRunningOnly = false,
252843
+ isRequired = false
252844
+ }) {
252845
+ return servicePrompt({
252846
+ env: env2,
252847
+ services: [...nodes, ...loadBalancers],
252848
+ accept,
252849
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
252850
+ isRequired,
252851
+ defaultHandler: async ({ defaultService: defaultNode, choices }) => {
252852
+ const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
252853
+ return esm_default3({
252854
+ message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
252855
+ choices: filteredChoices,
252856
+ default: defaultNode
252857
+ });
252858
+ },
252859
+ singleOptionMessage
252860
+ });
252861
+ }
252862
+
252730
252863
  // src/commands/connect.ts
252731
252864
  function connectCommand() {
252732
252865
  return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod, instance }) => {
@@ -252746,11 +252879,30 @@ function connectCommand() {
252746
252879
  const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
252747
252880
  const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
252748
252881
  const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
252749
- const { middlewares, integrationTools, storages, privateKeys, insights, customDeployments, blockchainNodes } = await servicesSpinner(settlemint, application.uniqueName);
252882
+ const {
252883
+ middlewares,
252884
+ integrationTools,
252885
+ storages,
252886
+ privateKeys,
252887
+ insights,
252888
+ customDeployments,
252889
+ blockchainNodes,
252890
+ loadBalancers
252891
+ } = await servicesSpinner(settlemint, application.uniqueName);
252892
+ const nodesWithPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? Array.isArray(node?.privateKeys) && node?.privateKeys?.length > 0 : false);
252750
252893
  const blockchainNode = await blockchainNodePrompt({
252751
252894
  env: env2,
252752
- nodes: blockchainNodes,
252753
- accept: acceptDefaults
252895
+ nodes: nodesWithPrivateKey,
252896
+ accept: acceptDefaults,
252897
+ promptMessage: "Which blockchain node do you want to SEND unsigned transactions from?"
252898
+ });
252899
+ const nodesWithoutPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? !Array.isArray(node?.privateKeys) || node?.privateKeys?.length === 0 : true);
252900
+ const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
252901
+ env: env2,
252902
+ nodes: nodesWithoutPrivateKey,
252903
+ loadBalancers,
252904
+ 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"
252754
252906
  });
252755
252907
  const hasura = await hasuraPrompt({
252756
252908
  env: env2,
@@ -252820,6 +252972,11 @@ function connectCommand() {
252820
252972
  name: blockchainNode.name,
252821
252973
  uniqueName: blockchainNode.uniqueName
252822
252974
  },
252975
+ loadBalancerOrBlockchainNode && {
252976
+ type: "Blockchain Node or Load Balancer (signed transactions only)",
252977
+ name: loadBalancerOrBlockchainNode.name,
252978
+ uniqueName: loadBalancerOrBlockchainNode.uniqueName
252979
+ },
252823
252980
  hasura && {
252824
252981
  type: "Hasura",
252825
252982
  name: hasura.name,
@@ -252870,6 +253027,7 @@ function connectCommand() {
252870
253027
  SETTLEMINT_APPLICATION: application.uniqueName,
252871
253028
  SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
252872
253029
  SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
253030
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: loadBalancerOrBlockchainNode?.uniqueName,
252873
253031
  SETTLEMINT_HASURA: hasura?.uniqueName,
252874
253032
  ...getHasuraEndpoints(hasura),
252875
253033
  SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
@@ -256211,7 +256369,8 @@ var SETTLEMINT_CLIENT_MAP = {
256211
256369
  "integration tool": "integrationTool",
256212
256370
  storage: "storage",
256213
256371
  insights: "insights",
256214
- "application access token": "applicationAccessToken"
256372
+ "application access token": "applicationAccessToken",
256373
+ "load balancer": "loadBalancer"
256215
256374
  };
256216
256375
  var LABELS_MAP = {
256217
256376
  application: { singular: "application", plural: "applications", command: "app" },
@@ -256232,7 +256391,8 @@ var LABELS_MAP = {
256232
256391
  singular: "application access token",
256233
256392
  plural: "application access tokens",
256234
256393
  command: "application-access-token"
256235
- }
256394
+ },
256395
+ "load balancer": { singular: "load balancer", plural: "load balancers", command: "load-balancer" }
256236
256396
  };
256237
256397
 
256238
256398
  // src/spinners/service.spinner.ts
@@ -257322,12 +257482,14 @@ function blockscoutInsightsCreateCommand() {
257322
257482
  return missingApplication();
257323
257483
  }
257324
257484
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257325
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
257485
+ const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257326
257486
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257327
257487
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257328
- const node = await blockchainNodePrompt({
257488
+ const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257489
+ const node = await blockchainNodeOrLoadBalancerPrompt({
257329
257490
  env: env2,
257330
257491
  nodes: blockchainNodes,
257492
+ loadBalancers,
257331
257493
  accept: acceptDefaults,
257332
257494
  isRequired: true
257333
257495
  });
@@ -257440,6 +257602,104 @@ function integrationToolCreateCommand() {
257440
257602
  return cmd2;
257441
257603
  }
257442
257604
 
257605
+ // src/commands/platform/load-balancer/evm/create.ts
257606
+ function loadBalancerEvmCreateCommand() {
257607
+ return getCreateCommand({
257608
+ name: "evm",
257609
+ type: "load balancer",
257610
+ subType: "EVM",
257611
+ alias: "e",
257612
+ execute: (cmd2, baseAction) => {
257613
+ 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
+ return baseAction({
257615
+ ...defaultArgs,
257616
+ acceptDefaults,
257617
+ provider,
257618
+ region
257619
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257620
+ const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257621
+ if (!applicationUniqueName) {
257622
+ return missingApplication();
257623
+ }
257624
+ let networkUniqueName;
257625
+ let connectedNodesUniqueNames = blockchainNodes;
257626
+ if (!connectedNodesUniqueNames) {
257627
+ const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
257628
+ const network = await blockchainNetworkPrompt({
257629
+ env: env2,
257630
+ networks,
257631
+ accept: acceptDefaults,
257632
+ isRequired: true
257633
+ });
257634
+ if (!network) {
257635
+ return nothingSelectedError("blockchain network");
257636
+ }
257637
+ const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257638
+ const connectedNodes = await blockchainNodePrompt({
257639
+ env: env2,
257640
+ nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === networkUniqueName),
257641
+ accept: acceptDefaults,
257642
+ promptMessage: "Which blockchain node do you want to connect the load balancer to?",
257643
+ allowAll: true
257644
+ });
257645
+ connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
257646
+ }
257647
+ if (!networkUniqueName) {
257648
+ const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257649
+ const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
257650
+ if (selectedBlockchainNodes.length === 0) {
257651
+ return cancel2("blockchain network");
257652
+ }
257653
+ const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
257654
+ if (!onTheSameNetwork) {
257655
+ return cancel2("Blockchain nodes must be on the same network");
257656
+ }
257657
+ networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
257658
+ }
257659
+ const result = await showSpinner(() => settlemint.loadBalancer.create({
257660
+ applicationUniqueName,
257661
+ name: name3,
257662
+ blockchainNetworkUniqueName: networkUniqueName,
257663
+ provider: provider2,
257664
+ region: region2,
257665
+ size,
257666
+ type: type4,
257667
+ connectedNodesUniqueNames
257668
+ }));
257669
+ return {
257670
+ result,
257671
+ mapDefaultEnv: () => {
257672
+ return {
257673
+ SETTLEMINT_APPLICATION: applicationUniqueName,
257674
+ SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
257675
+ };
257676
+ }
257677
+ };
257678
+ });
257679
+ });
257680
+ },
257681
+ examples: [
257682
+ {
257683
+ description: "Create an EVM load balancer and save as default",
257684
+ command: "platform create load-balancer evm my-lb --accept-defaults -d"
257685
+ },
257686
+ {
257687
+ 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"
257689
+ },
257690
+ {
257691
+ description: "Create an EVM load balancer in a different application",
257692
+ command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
257693
+ }
257694
+ ]
257695
+ });
257696
+ }
257697
+
257698
+ // src/commands/platform/load-balancer/create.ts
257699
+ function loadBalancerCreateCommand() {
257700
+ return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
257701
+ }
257702
+
257443
257703
  // src/commands/platform/middleware/graph/create.ts
257444
257704
  function graphMiddlewareCreateCommand() {
257445
257705
  return getCreateCommand({
@@ -257448,7 +257708,7 @@ function graphMiddlewareCreateCommand() {
257448
257708
  subType: "The Graph",
257449
257709
  alias: "gr",
257450
257710
  execute: (cmd2, baseAction) => {
257451
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name3, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
257711
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").action(async (name3, { application, blockchainNode, loadBalancer, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
257452
257712
  return baseAction({
257453
257713
  ...defaultArgs,
257454
257714
  acceptDefaults,
@@ -257460,24 +257720,32 @@ function graphMiddlewareCreateCommand() {
257460
257720
  return missingApplication();
257461
257721
  }
257462
257722
  let blockchainNodeUniqueName = blockchainNode;
257463
- if (!blockchainNodeUniqueName) {
257723
+ let loadBalancerUniqueName = loadBalancer;
257724
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257464
257725
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257465
- const node = await blockchainNodePrompt({
257726
+ const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257727
+ const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257466
257728
  env: env2,
257467
257729
  nodes: blockchainNodes,
257730
+ loadBalancers,
257468
257731
  accept: acceptDefaults,
257469
257732
  isRequired: true
257470
257733
  });
257471
- if (!node) {
257472
- return nothingSelectedError("blockchain node");
257734
+ if (!nodeOrLoadbalancer) {
257735
+ return nothingSelectedError("blockchain node or load balancer");
257736
+ }
257737
+ if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
257738
+ loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
257739
+ } else {
257740
+ blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
257473
257741
  }
257474
- blockchainNodeUniqueName = node.uniqueName;
257475
257742
  }
257476
257743
  const result = await showSpinner(() => settlemint.middleware.create({
257477
257744
  name: name3,
257478
257745
  applicationUniqueName,
257479
257746
  interface: "HA_GRAPH",
257480
257747
  blockchainNodeUniqueName,
257748
+ loadBalancerUniqueName,
257481
257749
  provider: provider2,
257482
257750
  region: region2,
257483
257751
  size,
@@ -257543,19 +257811,25 @@ function smartContractPortalMiddlewareCreateCommand() {
257543
257811
  return missingApplication();
257544
257812
  }
257545
257813
  let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
257546
- const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
257814
+ let loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
257547
257815
  if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
257548
257816
  const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
257549
- const node = await blockchainNodePrompt({
257817
+ const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
257818
+ const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
257550
257819
  env: env2,
257551
257820
  nodes: blockchainNodes,
257821
+ loadBalancers,
257552
257822
  accept: acceptDefaults,
257553
257823
  isRequired: true
257554
257824
  });
257555
- if (!node) {
257556
- return nothingSelectedError("blockchain node");
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;
257557
257832
  }
257558
- blockchainNodeUniqueName = node.uniqueName;
257559
257833
  }
257560
257834
  const parsedAbis = [];
257561
257835
  if (abis && abis.length > 0) {
@@ -257926,7 +258200,7 @@ function storageCreateCommand() {
257926
258200
 
257927
258201
  // src/commands/platform/create.ts
257928
258202
  function createCommand3() {
257929
- return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand());
258203
+ return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand()).addCommand(loadBalancerCreateCommand());
257930
258204
  }
257931
258205
 
257932
258206
  // src/prompts/delete-confirmation.prompt.ts
@@ -258166,6 +258440,19 @@ function integrationToolRestartCommand() {
258166
258440
  return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
258167
258441
  }
258168
258442
 
258443
+ // src/commands/platform/load-balancer/restart.ts
258444
+ function loadBalancerRestartCommand() {
258445
+ return getRestartCommand({
258446
+ name: "load-balancer",
258447
+ type: "load balancer",
258448
+ alias: "lb",
258449
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
258450
+ restartFunction: async (settlemint, id) => {
258451
+ return settlemint.loadBalancer.restart(id);
258452
+ }
258453
+ });
258454
+ }
258455
+
258169
258456
  // src/commands/platform/middleware/graph/restart.ts
258170
258457
  function graphRestartCommand() {
258171
258458
  return getRestartCommand({
@@ -258232,7 +258519,7 @@ function storageRestartCommand() {
258232
258519
 
258233
258520
  // src/commands/platform/restart.ts
258234
258521
  function restartCommand() {
258235
- const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand());
258522
+ const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand()).addCommand(loadBalancerRestartCommand());
258236
258523
  return cmd2;
258237
258524
  }
258238
258525
 
@@ -259075,34 +259362,7 @@ function getStatusAction(status) {
259075
259362
  return "Please try again later.";
259076
259363
  }
259077
259364
 
259078
- // src/prompts/smart-contract-set/address.prompt.ts
259079
- async function addressPrompt({
259080
- env: env2,
259081
- accept,
259082
- prod,
259083
- node,
259084
- hardhatConfig
259085
- }) {
259086
- const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
259087
- const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
259088
- const defaultPossible = accept && defaultAddress;
259089
- if (defaultPossible) {
259090
- if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
259091
- return defaultAddress;
259092
- }
259093
- note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
259094
- Please select another key or activate this key on the node and try again.`, "warn");
259095
- }
259096
- const address = await esm_default3({
259097
- message: "Which private key do you want to deploy from?",
259098
- choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
259099
- name: name3,
259100
- value: address2
259101
- })),
259102
- default: defaultAddress ?? possiblePrivateKeys[0]?.address
259103
- });
259104
- return address;
259105
- }
259365
+ // src/utils/blockchain-node.ts
259106
259366
  function validPrivateKey(privateKey) {
259107
259367
  return privateKey.privateKeyType !== "HD_ECDSA_P256";
259108
259368
  }
@@ -259130,6 +259390,7 @@ async function selectTargetNode({
259130
259390
  nodes: validNodes,
259131
259391
  accept: autoAccept,
259132
259392
  isRequired: true,
259393
+ filterRunningOnly: true,
259133
259394
  promptMessage: "Which blockchain node do you want to connect to? (Only nodes with private keys activated are shown)",
259134
259395
  singleOptionMessage: (node2) => `Using '${node2}' - the only node with active private keys. To use a different node, ensure it has a private key activated.`
259135
259396
  });
@@ -259166,6 +259427,33 @@ function validateNode(node, cancelOnError = true) {
259166
259427
  return true;
259167
259428
  }
259168
259429
 
259430
+ // src/prompts/smart-contract-set/address.prompt.ts
259431
+ async function addressPrompt({
259432
+ accept,
259433
+ node,
259434
+ hardhatConfig
259435
+ }) {
259436
+ const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
259437
+ const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
259438
+ const defaultPossible = accept && defaultAddress;
259439
+ if (defaultPossible) {
259440
+ if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
259441
+ return defaultAddress;
259442
+ }
259443
+ note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
259444
+ Please select another key or activate this key on the node and try again.`, "warn");
259445
+ }
259446
+ const address = await esm_default3({
259447
+ message: "Which private key do you want to deploy from?",
259448
+ choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
259449
+ name: name3,
259450
+ value: address2
259451
+ })),
259452
+ default: defaultAddress
259453
+ });
259454
+ return address;
259455
+ }
259456
+
259169
259457
  // src/utils/smart-contract-set/hardhat-config.ts
259170
259458
  async function getHardhatConfigData(envConfig) {
259171
259459
  try {
@@ -259255,7 +259543,7 @@ function hardhatDeployRemoteCommand() {
259255
259543
  }
259256
259544
  let address = defaultSender ?? null;
259257
259545
  if (!defaultSender) {
259258
- address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
259546
+ address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
259259
259547
  }
259260
259548
  if (!address) {
259261
259549
  return nothingSelectedError("private key");
@@ -259901,4 +260189,4 @@ async function sdkCliCommand(argv = process.argv) {
259901
260189
  // src/cli.ts
259902
260190
  sdkCliCommand();
259903
260191
 
259904
- //# debugId=6D092F736CE53E8E64756E2164756E21
260192
+ //# debugId=D101F2647E41002564756E2164756E21