@settlemint/sdk-cli 0.9.3-main60569eea → 0.9.3-pr14f171b0

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 +488 -312
  2. package/dist/cli.js.map +46 -43
  3. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -19613,7 +19613,7 @@ var require_lib4 = __commonJS((exports, module) => {
19613
19613
  var rRel = new RegExp(`^\\.${rSlash.source}`);
19614
19614
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
19615
19615
  var getPathInfo = (cmd, {
19616
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19616
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.WNCQIi5rAW:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19617
19617
  pathExt: optPathExt = process.env.PATHEXT,
19618
19618
  delimiter: optDelimiter = delimiter
19619
19619
  }) => {
@@ -19817,7 +19817,7 @@ var require_lib5 = __commonJS((exports, module) => {
19817
19817
  let pathToInitial;
19818
19818
  try {
19819
19819
  pathToInitial = which.sync(initialCmd, {
19820
- path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19820
+ path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.WNCQIi5rAW:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19821
19821
  pathext: options.env && findInObject(options.env, "PATHEXT") || process.env.PATHEXT
19822
19822
  }).toLowerCase();
19823
19823
  } catch (err) {
@@ -20534,7 +20534,7 @@ var require_lib6 = __commonJS((exports, module) => {
20534
20534
  var rRel = new RegExp(`^\\.${rSlash.source}`);
20535
20535
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
20536
20536
  var getPathInfo = (cmd, {
20537
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
20537
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.WNCQIi5rAW:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
20538
20538
  pathExt: optPathExt = process.env.PATHEXT,
20539
20539
  delimiter: optDelimiter = delimiter
20540
20540
  }) => {
@@ -223327,7 +223327,7 @@ ${Bt.cyan(Yt)}
223327
223327
  code: "ENOENT"
223328
223328
  }), getPathInfo = (e9, t7) => {
223329
223329
  var r6 = t7.colon || or;
223330
- var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
223330
+ var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.WNCQIi5rAW:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
223331
223331
  var n6 = nr ? t7.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
223332
223332
  var a5 = nr ? n6.split(r6) : [""];
223333
223333
  if (nr) {
@@ -226464,7 +226464,7 @@ ${whileRunning(e9)}`;
226464
226464
  };
226465
226465
  ni = Object.assign(async function _main() {
226466
226466
  var e9 = new Cli({
226467
- binaryVersion: "0.9.3-main60569eea",
226467
+ binaryVersion: "0.9.3-pr14f171b0",
226468
226468
  binaryLabel: "gql.tada CLI",
226469
226469
  binaryName: "gql.tada"
226470
226470
  });
@@ -234964,7 +234964,7 @@ var require_which2 = __commonJS((exports, module) => {
234964
234964
  const colon = opt2.colon || COLON;
234965
234965
  const pathEnv = cmd2.match(/\//) || isWindows2 && cmd2.match(/\\/) ? [""] : [
234966
234966
  ...isWindows2 ? [process.cwd()] : [],
234967
- ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234967
+ ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.WNCQIi5rAW:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234968
234968
  ];
234969
234969
  const pathExtExe = isWindows2 ? opt2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
234970
234970
  const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
@@ -256788,7 +256788,7 @@ ${error.stack}`));
256788
256788
  var package_default = {
256789
256789
  name: "@settlemint/sdk-cli",
256790
256790
  description: "SettleMint SDK, integrate SettleMint into your application with ease.",
256791
- version: "0.9.3-main60569eea",
256791
+ version: "0.9.3-pr14f171b0",
256792
256792
  type: "module",
256793
256793
  private: false,
256794
256794
  license: "FSL-1.1-MIT",
@@ -256841,8 +256841,8 @@ var package_default = {
256841
256841
  "@inquirer/input": "4.1.1",
256842
256842
  "@inquirer/password": "4.0.4",
256843
256843
  "@inquirer/select": "4.0.4",
256844
- "@settlemint/sdk-js": "0.9.3-main60569eea",
256845
- "@settlemint/sdk-utils": "0.9.3-main60569eea",
256844
+ "@settlemint/sdk-js": "0.9.3-pr14f171b0",
256845
+ "@settlemint/sdk-utils": "0.9.3-pr14f171b0",
256846
256846
  "get-tsconfig": "4.8.1",
256847
256847
  giget: "1.2.3"
256848
256848
  },
@@ -257143,6 +257143,9 @@ function missingAccessTokenError(personalAccessTokenExists) {
257143
257143
  function missingPersonalAccessTokenError() {
257144
257144
  return cancel("No personal access token found for instance, please run `settlemint login` to login to your instance");
257145
257145
  }
257146
+ function missingApplication() {
257147
+ return cancel("No application configured, please run `settlemint connect` to connect to your application");
257148
+ }
257146
257149
 
257147
257150
  // src/utils/config.ts
257148
257151
  import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
@@ -270567,6 +270570,12 @@ function getMinioEndpoints(service) {
270567
270570
  };
270568
270571
  }
270569
270572
 
270573
+ // src/utils/sanitize-instance-url.ts
270574
+ function sanitizeInstanceUrl(url) {
270575
+ const instanceUrl = new URL(url);
270576
+ return instanceUrl.origin;
270577
+ }
270578
+
270570
270579
  // ../utils/dist/runtime.mjs
270571
270580
  function ensureServer() {
270572
270581
  if (isBrowser) {
@@ -272756,8 +272765,9 @@ var esm_default5 = createPrompt((config4, done) => {
272756
272765
 
272757
272766
  // src/commands/connect/aat.prompt.ts
272758
272767
  async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
272768
+ const autoAccept = !!accept || is_in_ci_default;
272759
272769
  const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
272760
- const defaultPossible = accept && defaultAccessToken;
272770
+ const defaultPossible = autoAccept && defaultAccessToken;
272761
272771
  if (defaultPossible || is_in_ci_default) {
272762
272772
  return defaultAccessToken;
272763
272773
  }
@@ -272852,16 +272862,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
272852
272862
  });
272853
272863
  }
272854
272864
 
272865
+ // src/error/nothing-selected-error.ts
272866
+ function nothingSelectedError(type4) {
272867
+ return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
272868
+ }
272869
+
272855
272870
  // src/commands/connect/application.prompt.ts
272856
272871
  async function applicationPrompt(env2, applications, accept) {
272872
+ const autoAccept = !!accept || is_in_ci_default;
272857
272873
  const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
272858
- const defaultPossible = accept && defaultApplication;
272874
+ const defaultPossible = autoAccept && defaultApplication;
272859
272875
  if (defaultPossible) {
272860
272876
  return defaultApplication;
272861
272877
  }
272862
272878
  if (applications.length === 0) {
272863
272879
  cancel("No applications found");
272864
272880
  }
272881
+ if (is_in_ci_default) {
272882
+ nothingSelectedError("application");
272883
+ }
272865
272884
  const application = await esm_default2({
272866
272885
  message: "Which application do you want to connect to?",
272867
272886
  choices: applications.map((applications2) => ({
@@ -272876,249 +272895,290 @@ async function applicationPrompt(env2, applications, accept) {
272876
272895
  return application;
272877
272896
  }
272878
272897
 
272879
- // src/commands/connect/blockchain-node.prompt.ts
272880
- async function blockchainNodePrompt(env2, nodes, accept) {
272881
- if (nodes.length === 0) {
272898
+ // src/commands/connect/service.prompt.ts
272899
+ async function servicePrompt({
272900
+ env: env2,
272901
+ services,
272902
+ accept,
272903
+ envKey,
272904
+ defaultHandler,
272905
+ isCi = is_in_ci_default
272906
+ }) {
272907
+ if (services.length === 0) {
272882
272908
  return;
272883
272909
  }
272884
- const defaultNode = nodes.find((node2) => node2.uniqueName === env2.SETTLEMINT_BLOCKCHAIN_NODE) ?? (nodes.length === 1 ? nodes[0] : undefined);
272885
- const defaultPossible = accept;
272886
- if (defaultPossible) {
272887
- return defaultNode;
272910
+ const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
272911
+ const autoAccept = isCi || accept;
272912
+ if (autoAccept && selectedService) {
272913
+ return selectedService;
272888
272914
  }
272889
- const node = await esm_default2({
272890
- message: "Which blockchain node do you want to connect to?",
272891
- choices: [
272892
- ...nodes.map((node2) => ({
272893
- name: node2.name,
272894
- value: node2
272895
- })),
272896
- {
272897
- name: "None",
272898
- value: undefined
272899
- }
272900
- ],
272901
- default: defaultNode
272915
+ if (isCi) {
272916
+ return;
272917
+ }
272918
+ if (services.length === 1) {
272919
+ return services[0];
272920
+ }
272921
+ return defaultHandler({ defaultService: selectedService });
272922
+ }
272923
+
272924
+ // src/commands/connect/blockchain-node.prompt.ts
272925
+ async function blockchainNodePrompt(env2, nodes, accept) {
272926
+ return servicePrompt({
272927
+ env: env2,
272928
+ services: nodes,
272929
+ accept,
272930
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
272931
+ defaultHandler: async ({ defaultService: defaultNode }) => {
272932
+ return esm_default2({
272933
+ message: "Which blockchain node do you want to connect to?",
272934
+ choices: [
272935
+ ...nodes.map((node) => ({
272936
+ name: node.name,
272937
+ value: node
272938
+ })),
272939
+ {
272940
+ name: "None",
272941
+ value: undefined
272942
+ }
272943
+ ],
272944
+ default: defaultNode
272945
+ });
272946
+ }
272902
272947
  });
272903
- return node;
272904
272948
  }
272905
272949
 
272906
272950
  // src/commands/connect/blockscout.prompt.ts
272907
272951
  async function blockscoutPrompt(env2, insights, accept) {
272908
272952
  const possible = insights.filter((insight) => insight.insightsCategory === "BLOCKCHAIN_EXPLORER");
272909
- if (possible.length === 0) {
272910
- return;
272911
- }
272912
- const defaultBlockscout = insights.find((insight) => insight.uniqueName === env2.SETTLEMINT_BLOCKSCOUT) ?? (insights.length === 1 ? insights[0] : undefined);
272913
- const defaultPossible = accept;
272914
- if (defaultPossible) {
272915
- return defaultBlockscout;
272916
- }
272917
- const blockscout = await esm_default2({
272918
- message: "Which blockscout instance do you want to connect to?",
272919
- choices: [
272920
- ...insights.map((insight) => ({
272921
- name: insight.name,
272922
- value: insight
272923
- })),
272924
- {
272925
- name: "None",
272926
- value: undefined
272927
- }
272928
- ],
272929
- default: defaultBlockscout
272953
+ return servicePrompt({
272954
+ env: env2,
272955
+ services: possible,
272956
+ accept,
272957
+ envKey: "SETTLEMINT_BLOCKSCOUT",
272958
+ defaultHandler: async ({ defaultService: defaultBlockscout }) => {
272959
+ return esm_default2({
272960
+ message: "Which blockscout instance do you want to connect to?",
272961
+ choices: [
272962
+ ...possible.map((insight) => ({
272963
+ name: insight.name,
272964
+ value: insight
272965
+ })),
272966
+ {
272967
+ name: "None",
272968
+ value: undefined
272969
+ }
272970
+ ],
272971
+ default: defaultBlockscout
272972
+ });
272973
+ }
272930
272974
  });
272931
- return blockscout;
272932
272975
  }
272933
272976
 
272934
272977
  // src/commands/connect/custom-deployment.prompt.ts
272935
272978
  async function customDeploymentPrompt(env2, customDeployments, accept) {
272936
- if (customDeployments.length === 0) {
272937
- return;
272938
- }
272939
- const defaultCustomDeployment = customDeployments.find((customDeployment) => customDeployment.uniqueName === env2.SETTLEMINT_CUSTOM_DEPLOYMENT) ?? (customDeployments.length === 1 ? customDeployments[0] : undefined);
272940
- const defaultPossible = accept;
272941
- if (defaultPossible) {
272942
- return defaultCustomDeployment;
272943
- }
272944
- const middleware = await esm_default2({
272945
- message: "Which Custom Deployment do you want to connect to?",
272946
- choices: [
272947
- ...customDeployments.map((customDeployment) => ({
272948
- name: customDeployment.name,
272949
- value: customDeployment
272950
- })),
272951
- {
272952
- name: "None",
272953
- value: undefined
272954
- }
272955
- ],
272956
- default: defaultCustomDeployment
272979
+ return servicePrompt({
272980
+ env: env2,
272981
+ services: customDeployments,
272982
+ accept,
272983
+ envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
272984
+ defaultHandler: async ({
272985
+ defaultService: defaultCustomDeployment
272986
+ }) => {
272987
+ return esm_default2({
272988
+ message: "Which Custom Deployment do you want to connect to?",
272989
+ choices: [
272990
+ ...customDeployments.map((customDeployment) => ({
272991
+ name: customDeployment.name,
272992
+ value: customDeployment
272993
+ })),
272994
+ {
272995
+ name: "None",
272996
+ value: undefined
272997
+ }
272998
+ ],
272999
+ default: defaultCustomDeployment
273000
+ });
273001
+ }
272957
273002
  });
272958
- return middleware;
272959
273003
  }
272960
273004
 
272961
273005
  // src/commands/connect/hasura.prompt.ts
272962
273006
  async function hasuraPrompt(env2, integrations, accept) {
272963
273007
  const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
272964
- if (possible.length === 0) {
272965
- return;
272966
- }
272967
- const defaultIntegration = possible.find((integration) => integration.uniqueName === env2.SETTLEMINT_HASURA) ?? (possible.length === 1 ? possible[0] : undefined);
272968
- const defaultPossible = accept;
272969
- if (defaultPossible) {
272970
- return defaultIntegration;
272971
- }
272972
- const hasura = await esm_default2({
272973
- message: "Which Hasura instance do you want to connect to?",
272974
- choices: [
272975
- ...possible.map((integration) => ({
272976
- name: integration.name,
272977
- value: integration
272978
- })),
272979
- {
272980
- name: "None",
272981
- value: undefined
272982
- }
272983
- ],
272984
- default: defaultIntegration
273008
+ return servicePrompt({
273009
+ env: env2,
273010
+ services: possible,
273011
+ accept,
273012
+ envKey: "SETTLEMINT_HASURA",
273013
+ defaultHandler: async ({ defaultService: defaultHasura }) => {
273014
+ return esm_default2({
273015
+ message: "Which Hasura instance do you want to connect to?",
273016
+ choices: [
273017
+ ...possible.map((integration) => ({
273018
+ name: integration.name,
273019
+ value: integration
273020
+ })),
273021
+ {
273022
+ name: "None",
273023
+ value: undefined
273024
+ }
273025
+ ],
273026
+ default: defaultHasura
273027
+ });
273028
+ }
272985
273029
  });
272986
- return hasura;
272987
273030
  }
272988
273031
 
272989
273032
  // src/commands/connect/hd-private-keys.prompt.ts
272990
273033
  async function hdPrivateKeyPrompt(env2, privateKeys, accept) {
272991
- const possible = privateKeys.filter((privateKey2) => privateKey2.privateKeyType === "HD_ECDSA_P256");
272992
- if (possible.length === 0) {
272993
- return;
272994
- }
272995
- const defaultPrivateKey = possible.find((privateKey2) => privateKey2.uniqueName === env2.SETTLEMINT_HD_PRIVATE_KEY) ?? (possible.length === 1 ? possible[0] : undefined);
272996
- const defaultPossible = accept;
272997
- if (defaultPossible) {
272998
- return defaultPrivateKey;
272999
- }
273000
- const privateKey = await esm_default2({
273001
- message: "Which HD Private Key do you want to use?",
273002
- choices: [
273003
- ...possible.map((privateKey2) => ({
273004
- name: privateKey2.name,
273005
- value: privateKey2
273006
- })),
273007
- {
273008
- name: "None",
273009
- value: undefined
273010
- }
273011
- ],
273012
- default: defaultPrivateKey
273034
+ const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
273035
+ return servicePrompt({
273036
+ env: env2,
273037
+ services: possible,
273038
+ accept,
273039
+ envKey: "SETTLEMINT_HD_PRIVATE_KEY",
273040
+ defaultHandler: async ({ defaultService: defaultPrivateKey }) => {
273041
+ return esm_default2({
273042
+ message: "Which HD Private Key do you want to use?",
273043
+ choices: [
273044
+ ...possible.map((privateKey) => ({
273045
+ name: privateKey.name,
273046
+ value: privateKey
273047
+ })),
273048
+ {
273049
+ name: "None",
273050
+ value: undefined
273051
+ }
273052
+ ],
273053
+ default: defaultPrivateKey
273054
+ });
273055
+ }
273013
273056
  });
273014
- return privateKey;
273015
273057
  }
273016
273058
 
273017
273059
  // src/commands/connect/instance.prompt.ts
273018
- async function instancePrompt(env2, accept) {
273019
- const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
273020
- const defaultPossible = accept && defaultInstance;
273060
+ async function instancePrompt(env2, accept, freeTextInput = false) {
273061
+ const knownInstances = await getInstances();
273062
+ const autoAccept = !!accept || is_in_ci_default;
273063
+ const defaultInstance = env2.SETTLEMINT_INSTANCE ?? knownInstances[0] ?? "https://console.settlemint.com";
273064
+ const defaultPossible = autoAccept && defaultInstance;
273021
273065
  if (defaultPossible) {
273022
273066
  return defaultInstance;
273023
273067
  }
273024
- return esm_default4({
273025
- message: "What is the URL of your SettleMint instance?",
273026
- default: defaultInstance,
273027
- required: true,
273028
- validate(value4) {
273029
- try {
273030
- validate3(UrlSchema3, value4);
273031
- return true;
273032
- } catch (error5) {
273033
- return "Invalid URL";
273034
- }
273035
- },
273036
- transformer: (value4) => value4.trim()
273068
+ if (freeTextInput) {
273069
+ const instance = await esm_default4({
273070
+ message: "What is the URL of your SettleMint instance?",
273071
+ default: defaultInstance,
273072
+ required: true,
273073
+ validate(value4) {
273074
+ try {
273075
+ validate3(UrlSchema3, value4);
273076
+ return true;
273077
+ } catch (error5) {
273078
+ return "Invalid URL";
273079
+ }
273080
+ },
273081
+ transformer: (value4) => value4.trim()
273082
+ });
273083
+ return sanitizeInstanceUrl(instance);
273084
+ }
273085
+ if (knownInstances.length === 0) {
273086
+ cancel2("No instances found. Please run `settlemint login` to configure an instance.");
273087
+ }
273088
+ if (knownInstances.length === 1) {
273089
+ return knownInstances[0];
273090
+ }
273091
+ return esm_default2({
273092
+ message: "What SettleMint instance do you want to connect to?",
273093
+ choices: [
273094
+ ...knownInstances.map((instance) => ({
273095
+ name: instance,
273096
+ value: instance
273097
+ }))
273098
+ ],
273099
+ default: defaultInstance
273037
273100
  });
273038
273101
  }
273039
273102
 
273040
273103
  // src/commands/connect/ipfs.prompt.ts
273041
273104
  async function ipfsPrompt(env2, storages, accept) {
273042
273105
  const possible = storages.filter((storage) => storage.storageProtocol === "IPFS");
273043
- if (possible.length === 0) {
273044
- return;
273045
- }
273046
- const defaultStorage = possible.find((storage) => storage.uniqueName === env2.SETTLEMINT_IPFS) ?? (possible.length === 1 ? possible[0] : undefined);
273047
- const defaultPossible = accept;
273048
- if (defaultPossible) {
273049
- return defaultStorage;
273050
- }
273051
- const minio = await esm_default2({
273052
- message: "Which IPFS instance do you want to connect to?",
273053
- choices: [
273054
- ...possible.map((storage) => ({
273055
- name: storage.name,
273056
- value: storage
273057
- })),
273058
- {
273059
- name: "None",
273060
- value: undefined
273061
- }
273062
- ],
273063
- default: defaultStorage
273106
+ return servicePrompt({
273107
+ env: env2,
273108
+ services: possible,
273109
+ accept,
273110
+ envKey: "SETTLEMINT_IPFS",
273111
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273112
+ return esm_default2({
273113
+ message: "Which IPFS instance do you want to connect to?",
273114
+ choices: [
273115
+ ...possible.map((storage) => ({
273116
+ name: storage.name,
273117
+ value: storage
273118
+ })),
273119
+ {
273120
+ name: "None",
273121
+ value: undefined
273122
+ }
273123
+ ],
273124
+ default: defaultStorage
273125
+ });
273126
+ }
273064
273127
  });
273065
- return minio;
273066
273128
  }
273067
273129
 
273068
273130
  // src/commands/connect/minio.prompt.ts
273069
273131
  async function minioPrompt(env2, storages, accept) {
273070
273132
  const possible = storages.filter((storage) => storage.storageProtocol === "MINIO");
273071
- if (possible.length === 0) {
273072
- return;
273073
- }
273074
- const defaultStorage = possible.find((storage) => storage.uniqueName === env2.SETTLEMINT_MINIO) ?? (possible.length === 1 ? possible[0] : undefined);
273075
- const defaultPossible = accept;
273076
- if (defaultPossible) {
273077
- return defaultStorage;
273078
- }
273079
- const minio = await esm_default2({
273080
- message: "Which Minio instance do you want to connect to?",
273081
- choices: [
273082
- ...possible.map((storage) => ({
273083
- name: storage.name,
273084
- value: storage
273085
- })),
273086
- {
273087
- name: "None",
273088
- value: undefined
273089
- }
273090
- ],
273091
- default: defaultStorage
273133
+ return servicePrompt({
273134
+ env: env2,
273135
+ services: possible,
273136
+ accept,
273137
+ envKey: "SETTLEMINT_MINIO",
273138
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273139
+ return esm_default2({
273140
+ message: "Which MinIO instance do you want to connect to?",
273141
+ choices: [
273142
+ ...possible.map((storage) => ({
273143
+ name: storage.name,
273144
+ value: storage
273145
+ })),
273146
+ {
273147
+ name: "None",
273148
+ value: undefined
273149
+ }
273150
+ ],
273151
+ default: defaultStorage
273152
+ });
273153
+ }
273092
273154
  });
273093
- return minio;
273094
273155
  }
273095
273156
 
273096
273157
  // src/commands/connect/portal.prompt.ts
273097
273158
  async function portalPrompt(env2, middlewares, accept) {
273098
- const possible = middlewares.filter((middleware2) => middleware2.interface === "SMART_CONTRACT_PORTAL");
273099
- if (possible.length === 0) {
273100
- return;
273101
- }
273102
- const defaultMiddleware = possible.find((middleware2) => middleware2.uniqueName === env2.SETTLEMINT_PORTAL) ?? (possible.length === 1 ? possible[0] : undefined);
273103
- const defaultPossible = accept;
273104
- if (defaultPossible) {
273105
- return defaultMiddleware;
273106
- }
273107
- const middleware = await esm_default2({
273108
- message: "Which Smart Contract Portal instance do you want to connect to?",
273109
- choices: [
273110
- ...possible.map((middleware2) => ({
273111
- name: middleware2.name,
273112
- value: middleware2
273113
- })),
273114
- {
273115
- name: "None",
273116
- value: undefined
273117
- }
273118
- ],
273119
- default: defaultMiddleware
273159
+ const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
273160
+ return servicePrompt({
273161
+ env: env2,
273162
+ services: possible,
273163
+ accept,
273164
+ envKey: "SETTLEMINT_PORTAL",
273165
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273166
+ return esm_default2({
273167
+ message: "Which Smart Contract Portal instance do you want to connect to?",
273168
+ choices: [
273169
+ ...possible.map((middleware) => ({
273170
+ name: middleware.name,
273171
+ value: middleware
273172
+ })),
273173
+ {
273174
+ name: "None",
273175
+ value: undefined
273176
+ }
273177
+ ],
273178
+ default: defaultMiddleware
273179
+ });
273180
+ }
273120
273181
  });
273121
- return middleware;
273122
273182
  }
273123
273183
 
273124
273184
  // src/commands/connect/services.spinner.ts
@@ -273162,42 +273222,45 @@ async function servicesSpinner(settlemint, application) {
273162
273222
 
273163
273223
  // src/commands/connect/thegraph.prompt.ts
273164
273224
  async function theGraphPrompt(env2, middlewares, accept) {
273165
- const possible = middlewares.filter((middleware2) => middleware2.__typename === "HAGraphMiddleware");
273166
- if (possible.length === 0) {
273167
- return;
273168
- }
273169
- const defaultMiddleware = possible.find((middleware2) => middleware2.uniqueName === env2.SETTLEMINT_THEGRAPH) ?? (possible.length === 1 ? possible[0] : undefined);
273170
- const defaultPossible = accept;
273171
- if (defaultPossible) {
273172
- return defaultMiddleware;
273173
- }
273174
- const middleware = await esm_default2({
273175
- message: "Which The Graph instance do you want to connect to?",
273176
- choices: [
273177
- ...possible.map((middleware2) => ({
273178
- name: middleware2.name,
273179
- value: middleware2
273180
- })),
273181
- {
273182
- name: "None",
273183
- value: undefined
273184
- }
273185
- ],
273186
- default: defaultMiddleware
273225
+ const possible = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
273226
+ return servicePrompt({
273227
+ env: env2,
273228
+ services: possible,
273229
+ accept,
273230
+ envKey: "SETTLEMINT_THEGRAPH",
273231
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273232
+ return esm_default2({
273233
+ message: "Which The Graph instance do you want to connect to?",
273234
+ choices: [
273235
+ ...possible.map((middleware) => ({
273236
+ name: middleware.name,
273237
+ value: middleware
273238
+ })),
273239
+ {
273240
+ name: "None",
273241
+ value: undefined
273242
+ }
273243
+ ],
273244
+ default: defaultMiddleware
273245
+ });
273246
+ }
273187
273247
  });
273188
- return middleware;
273189
273248
  }
273190
273249
 
273191
273250
  // src/commands/connect/workspace.prompt.ts
273192
273251
  async function workspacePrompt(env2, workspaces, accept) {
273252
+ const autoAccept = !!accept || is_in_ci_default;
273193
273253
  const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
273194
- const defaultPossible = accept && defaultWorkspace;
273254
+ const defaultPossible = autoAccept && defaultWorkspace;
273195
273255
  if (defaultPossible) {
273196
273256
  return defaultWorkspace;
273197
273257
  }
273198
273258
  if (workspaces.length === 0) {
273199
273259
  cancel2("No workspaces found");
273200
273260
  }
273261
+ if (is_in_ci_default) {
273262
+ nothingSelectedError("workspace");
273263
+ }
273201
273264
  const workspace = await esm_default2({
273202
273265
  message: "Which workspace do you want to connect to?",
273203
273266
  choices: workspaces.map((workspace2) => ({
@@ -273214,35 +273277,37 @@ async function workspacePrompt(env2, workspaces, accept) {
273214
273277
 
273215
273278
  // src/commands/connect.ts
273216
273279
  function connectCommand() {
273217
- return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod }) => {
273280
+ 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 }) => {
273218
273281
  intro("Connecting your dApp to SettleMint");
273219
- const autoAccept = !!acceptDefaults || is_in_ci_default;
273220
273282
  const env2 = await loadEnv2(false, !!prod);
273221
- const instance = await instancePrompt(env2, autoAccept);
273222
- const personalAccessToken = await getInstanceCredentials(instance);
273283
+ if (instance) {
273284
+ validate(UrlSchema, instance);
273285
+ }
273286
+ const selectedInstance = instance ? sanitizeInstanceUrl(instance) : await instancePrompt(env2, true);
273287
+ const personalAccessToken = await getInstanceCredentials(selectedInstance);
273223
273288
  if (!personalAccessToken) {
273224
273289
  return missingPersonalAccessTokenError();
273225
273290
  }
273226
273291
  const accessToken = personalAccessToken.personalAccessToken;
273227
273292
  const settlemint = createSettleMintClient({
273228
273293
  accessToken,
273229
- instance
273294
+ instance: selectedInstance
273230
273295
  });
273231
273296
  const workspaces = await workspaceSpinner(settlemint);
273232
- const workspace = await workspacePrompt(env2, workspaces, autoAccept);
273233
- const application = await applicationPrompt(env2, workspace?.applications ?? [], autoAccept);
273234
- const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, autoAccept);
273297
+ const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
273298
+ const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
273299
+ const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
273235
273300
  const { middleware, integrationTool, storage, privateKey, insights, customDeployment, blockchainNodes } = await servicesSpinner(settlemint, application);
273236
- const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
273237
- const hasura = await hasuraPrompt(env2, integrationTool, autoAccept);
273238
- const thegraph = await theGraphPrompt(env2, middleware, autoAccept);
273239
- const portal = await portalPrompt(env2, middleware, autoAccept);
273240
- const ipfs = await ipfsPrompt(env2, storage, autoAccept);
273241
- const minio = await minioPrompt(env2, storage, autoAccept);
273242
- const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, autoAccept);
273243
- const cDeployment = await customDeploymentPrompt(env2, customDeployment, autoAccept);
273244
- const blockscout = await blockscoutPrompt(env2, insights, autoAccept);
273245
- if (autoAccept) {
273301
+ const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
273302
+ const hasura = await hasuraPrompt(env2, integrationTool, acceptDefaults);
273303
+ const thegraph = await theGraphPrompt(env2, middleware, acceptDefaults);
273304
+ const portal = await portalPrompt(env2, middleware, acceptDefaults);
273305
+ const ipfs = await ipfsPrompt(env2, storage, acceptDefaults);
273306
+ const minio = await minioPrompt(env2, storage, acceptDefaults);
273307
+ const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, acceptDefaults);
273308
+ const cDeployment = await customDeploymentPrompt(env2, customDeployment, acceptDefaults);
273309
+ const blockscout = await blockscoutPrompt(env2, insights, acceptDefaults);
273310
+ if (acceptDefaults) {
273246
273311
  const selectedServices = [
273247
273312
  `Workspace: ${workspace.name}`,
273248
273313
  `Application: ${application.name}`,
@@ -273264,7 +273329,7 @@ function connectCommand() {
273264
273329
  }
273265
273330
  await writeEnvSpinner(!!prod, {
273266
273331
  SETTLEMINT_ACCESS_TOKEN: aatToken,
273267
- SETTLEMINT_INSTANCE: instance,
273332
+ SETTLEMINT_INSTANCE: selectedInstance,
273268
273333
  SETTLEMINT_WORKSPACE: workspace.uniqueName,
273269
273334
  SETTLEMINT_APPLICATION: application.uniqueName,
273270
273335
  SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
@@ -274112,7 +274177,7 @@ function createCommand2() {
274112
274177
  }
274113
274178
  const selectedTemplate = await templatePrompt(templates, template);
274114
274179
  if (!selectedTemplate) {
274115
- cancel("No template selected. Please select a template to continue.");
274180
+ return nothingSelectedError("template");
274116
274181
  }
274117
274182
  await spinner({
274118
274183
  startMessage: "Scaffolding the project",
@@ -274183,7 +274248,10 @@ function loginCommand() {
274183
274248
  intro("Login to your SettleMint account");
274184
274249
  const autoAccept = !!acceptDefaults || !!tokenStdin;
274185
274250
  const env2 = await loadEnv2(false, false);
274186
- const selectedInstance = instance ?? await instancePrompt(env2, autoAccept);
274251
+ if (instance) {
274252
+ validate3(UrlSchema, instance);
274253
+ }
274254
+ const selectedInstance = instance ? sanitizeInstanceUrl(instance) : await instancePrompt(env2, autoAccept, true);
274187
274255
  let personalAccessToken = "";
274188
274256
  if (tokenStdin) {
274189
274257
  if (cmd2.args.length > 0) {
@@ -274428,9 +274496,8 @@ function getCreateCommand({
274428
274496
  }
274429
274497
  execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout, provider, region }, createFunction) => {
274430
274498
  intro(`Creating ${type4} in the SettleMint platform`);
274431
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274432
274499
  const env2 = await loadEnv2(false, !!prod);
274433
- const instance = await instancePrompt(env2, autoAccept);
274500
+ const instance = await instancePrompt(env2, acceptDefaults);
274434
274501
  const accessToken = await getApplicationOrPersonalAccessToken({
274435
274502
  env: env2,
274436
274503
  instance,
@@ -274444,11 +274511,11 @@ function getCreateCommand({
274444
274511
  if (requiresDeployment) {
274445
274512
  const selectedProvider = await providerPrompt(platformConfig, provider);
274446
274513
  if (!selectedProvider) {
274447
- cancel("No provider selected. Please select a provider to continue.");
274514
+ return nothingSelectedError("provider");
274448
274515
  }
274449
274516
  const selectedRegion = await regionPrompt(selectedProvider, region);
274450
274517
  if (!selectedRegion) {
274451
- cancel("No region selected. Please select a region to continue.");
274518
+ return nothingSelectedError("region");
274452
274519
  }
274453
274520
  }
274454
274521
  const { result, waitFor, mapDefaultEnv } = await spinner({
@@ -274524,6 +274591,9 @@ function blockchainNetworkBesuCreateCommand() {
274524
274591
  region
274525
274592
  }, async (settlemint, env2) => {
274526
274593
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274594
+ if (!applicationUniqueName) {
274595
+ return missingApplication();
274596
+ }
274527
274597
  const result = await settlemint.blockchainNetwork.create({
274528
274598
  name: name2,
274529
274599
  applicationUniqueName,
@@ -274731,6 +274801,9 @@ function applicationAccessTokenCreateCommand() {
274731
274801
  cmd2.option("-a, --application <application>", "The application unique name to create the application access token for (defaults to application from env)").addOption(new Option("-v, --validity-period <period>", "The validity period for the token").choices(["DAYS_7", "DAYS_30", "DAYS_60", "DAYS_90", "NONE"]).default("DAYS_7")).action(async (name2, { application, validityPeriod, ...defaultArgs }) => {
274732
274802
  return baseAction(defaultArgs, async (settlemint, env2) => {
274733
274803
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274804
+ if (!applicationUniqueName) {
274805
+ return missingApplication();
274806
+ }
274734
274807
  const aatToken = await settlemint.applicationAccessToken.create({
274735
274808
  applicationUniqueName,
274736
274809
  name: name2,
@@ -274783,6 +274856,7 @@ function applicationAccessTokenCreateCommand() {
274783
274856
  uniqueName: ""
274784
274857
  },
274785
274858
  mapDefaultEnv: () => ({
274859
+ SETTLEMINT_APPLICATION: applicationUniqueName,
274786
274860
  SETTLEMINT_ACCESS_TOKEN: aatToken
274787
274861
  })
274788
274862
  };
@@ -274814,11 +274888,23 @@ function applicationCreateCommand() {
274814
274888
  type: "application",
274815
274889
  alias: "a",
274816
274890
  execute: (cmd2, baseAction) => {
274817
- cmd2.option("-w, --workspace <workspace>", "The workspace unique name to create the application in (defaults to workspace from env)").action(async (name2, { workspace, ...defaultArgs }) => {
274818
- return baseAction(defaultArgs, async (settlemint, env2) => {
274891
+ cmd2.option("-w, --workspace <workspace>", "The workspace unique name to create the application in (defaults to workspace from env)").action(async (name2, { workspace, acceptDefaults, ...defaultArgs }) => {
274892
+ return baseAction({
274893
+ ...defaultArgs,
274894
+ acceptDefaults
274895
+ }, async (settlemint, env2) => {
274896
+ let workspaceUniqueName = workspace;
274897
+ if (!workspaceUniqueName) {
274898
+ const workspaces = await settlemint.workspace.list();
274899
+ const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
274900
+ if (!workspace2) {
274901
+ return nothingSelectedError("workspace");
274902
+ }
274903
+ workspaceUniqueName = workspace2.uniqueName;
274904
+ }
274819
274905
  const result = await settlemint.application.create({
274820
274906
  name: name2,
274821
- workspaceUniqueName: workspace ?? env2.SETTLEMINT_WORKSPACE
274907
+ workspaceUniqueName
274822
274908
  });
274823
274909
  return {
274824
274910
  result,
@@ -274851,27 +274937,27 @@ function applicationCreateCommand() {
274851
274937
 
274852
274938
  // src/commands/connect/blockchain-network.prompt.ts
274853
274939
  async function blockchainNetworkPrompt(env2, networks, accept) {
274854
- if (networks.length === 0) {
274855
- return;
274856
- }
274857
- const defaultNetwork = networks.find((network) => network.uniqueName === env2.SETTLEMINT_BLOCKCHAIN_NETWORK) ?? (networks.length === 1 ? networks[0] : undefined);
274858
- const defaultPossible = accept;
274859
- if (defaultPossible) {
274860
- return defaultNetwork;
274861
- }
274862
- return esm_default2({
274863
- message: "Which blockchain network do you want to connect to?",
274864
- choices: [
274865
- ...networks.map((network) => ({
274866
- name: network.name,
274867
- value: network
274868
- })),
274869
- {
274870
- name: "None",
274871
- value: undefined
274872
- }
274873
- ],
274874
- default: defaultNetwork
274940
+ return servicePrompt({
274941
+ env: env2,
274942
+ services: networks,
274943
+ accept,
274944
+ envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
274945
+ defaultHandler: async ({ defaultService: defaultNetwork }) => {
274946
+ return esm_default2({
274947
+ message: "Which blockchain network do you want to connect to?",
274948
+ choices: [
274949
+ ...networks.map((network) => ({
274950
+ name: network.name,
274951
+ value: network
274952
+ })),
274953
+ {
274954
+ name: "None",
274955
+ value: undefined
274956
+ }
274957
+ ],
274958
+ default: defaultNetwork
274959
+ });
274960
+ }
274875
274961
  });
274876
274962
  }
274877
274963
 
@@ -274900,19 +274986,18 @@ function blockchainNodeBesuCreateCommand() {
274900
274986
  provider,
274901
274987
  region
274902
274988
  }, async (settlemint, env2) => {
274903
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274904
274989
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274905
274990
  if (!applicationUniqueName) {
274906
- cancel("No application found. Please specify an application or run `settlemint connect` to continue.");
274991
+ return missingApplication();
274907
274992
  }
274908
- let networkUniqueName = blockchainNetwork ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NETWORK : undefined);
274993
+ let networkUniqueName = blockchainNetwork;
274909
274994
  if (!networkUniqueName) {
274910
274995
  const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
274911
- const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults ?? false);
274996
+ const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
274912
274997
  if (!network) {
274913
- cancel("No network found. Please specify a network to continue.");
274998
+ return nothingSelectedError("blockchain network");
274914
274999
  }
274915
- networkUniqueName = network?.id;
275000
+ networkUniqueName = network?.uniqueName;
274916
275001
  }
274917
275002
  const result = await settlemint.blockchainNode.create({
274918
275003
  applicationUniqueName,
@@ -274930,7 +275015,7 @@ function blockchainNodeBesuCreateCommand() {
274930
275015
  mapDefaultEnv: () => {
274931
275016
  return {
274932
275017
  SETTLEMINT_APPLICATION: applicationUniqueName,
274933
- SETTLEMINT_BLOCKCHAIN_NODE: result.id
275018
+ SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
274934
275019
  };
274935
275020
  }
274936
275021
  };
@@ -274966,15 +275051,27 @@ function blockscoutInsightsCreateCommand() {
274966
275051
  type: "insights",
274967
275052
  alias: "bs",
274968
275053
  execute: (cmd2, baseAction) => {
274969
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").action(async (name2, { application, provider, region, size, type: type4, blockchainNode, loadBalancer, ...defaultArgs }) => {
275054
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").action(async (name2, { application, provider, region, size, type: type4, blockchainNode, loadBalancer, acceptDefaults, ...defaultArgs }) => {
274970
275055
  return baseAction({
274971
275056
  ...defaultArgs,
275057
+ acceptDefaults,
274972
275058
  provider,
274973
275059
  region
274974
275060
  }, async (settlemint, env2) => {
274975
275061
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274976
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275062
+ if (!applicationUniqueName) {
275063
+ return missingApplication();
275064
+ }
275065
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
274977
275066
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275067
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275068
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275069
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275070
+ if (!node) {
275071
+ return nothingSelectedError("blockchain node");
275072
+ }
275073
+ blockchainNodeUniqueName = node.uniqueName;
275074
+ }
274978
275075
  const result = await settlemint.insights.create({
274979
275076
  name: name2,
274980
275077
  applicationUniqueName,
@@ -275033,6 +275130,9 @@ function hasuraIntegrationCreateCommand() {
275033
275130
  region
275034
275131
  }, async (settlemint, env2) => {
275035
275132
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275133
+ if (!applicationUniqueName) {
275134
+ return missingApplication();
275135
+ }
275036
275136
  const result = await settlemint.integrationTool.create({
275037
275137
  name: name2,
275038
275138
  applicationUniqueName,
@@ -275082,14 +275182,26 @@ function graphMiddlewareCreateCommand() {
275082
275182
  type: "middleware",
275083
275183
  alias: "gr",
275084
275184
  execute: (cmd2, baseAction) => {
275085
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
275185
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
275086
275186
  return baseAction({
275087
275187
  ...defaultArgs,
275188
+ acceptDefaults,
275088
275189
  provider,
275089
275190
  region
275090
275191
  }, async (settlemint, env2) => {
275091
275192
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275092
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275193
+ if (!applicationUniqueName) {
275194
+ return missingApplication();
275195
+ }
275196
+ let blockchainNodeUniqueName = blockchainNode;
275197
+ if (!blockchainNodeUniqueName) {
275198
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275199
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275200
+ if (!node) {
275201
+ return nothingSelectedError("blockchain node");
275202
+ }
275203
+ blockchainNodeUniqueName = node.uniqueName;
275204
+ }
275093
275205
  const result = await settlemint.middleware.create({
275094
275206
  name: name2,
275095
275207
  applicationUniqueName,
@@ -275145,16 +275257,29 @@ function smartContractPortalMiddlewareCreateCommand() {
275145
275257
  type: type4,
275146
275258
  includePredeployedAbis,
275147
275259
  abis,
275260
+ acceptDefaults,
275148
275261
  ...defaultArgs
275149
275262
  }) => {
275150
275263
  return baseAction({
275151
275264
  ...defaultArgs,
275265
+ acceptDefaults,
275152
275266
  provider,
275153
275267
  region
275154
275268
  }, async (settlemint, env2) => {
275155
275269
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275156
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275270
+ if (!applicationUniqueName) {
275271
+ return missingApplication();
275272
+ }
275273
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275157
275274
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275275
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275276
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275277
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275278
+ if (!node) {
275279
+ return nothingSelectedError("blockchain node");
275280
+ }
275281
+ blockchainNodeUniqueName = node.uniqueName;
275282
+ }
275158
275283
  const parsedAbis = [];
275159
275284
  if (abis && abis.length > 0) {
275160
275285
  try {
@@ -275227,14 +275352,26 @@ function privateKeyHdCreateCommand() {
275227
275352
  type: "private key",
275228
275353
  alias: "hd",
275229
275354
  execute: (cmd2, baseAction) => {
275230
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
275355
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
275231
275356
  return baseAction({
275232
275357
  ...defaultArgs,
275358
+ acceptDefaults,
275233
275359
  provider,
275234
275360
  region
275235
275361
  }, async (settlemint, env2) => {
275236
275362
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275237
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275363
+ if (!applicationUniqueName) {
275364
+ return missingApplication();
275365
+ }
275366
+ let blockchainNodeUniqueName = blockchainNode;
275367
+ if (!blockchainNodeUniqueName) {
275368
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275369
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275370
+ if (!node) {
275371
+ return nothingSelectedError("blockchain node");
275372
+ }
275373
+ blockchainNodeUniqueName = node.uniqueName;
275374
+ }
275238
275375
  const result = await settlemint.privateKey.create({
275239
275376
  name: name2,
275240
275377
  applicationUniqueName,
@@ -275281,14 +275418,26 @@ function privateKeyHsmCreateCommand() {
275281
275418
  type: "private key",
275282
275419
  alias: "hd",
275283
275420
  execute: (cmd2, baseAction) => {
275284
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
275421
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
275285
275422
  return baseAction({
275286
275423
  ...defaultArgs,
275424
+ acceptDefaults,
275287
275425
  provider,
275288
275426
  region
275289
275427
  }, async (settlemint, env2) => {
275290
275428
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275291
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275429
+ if (!applicationUniqueName) {
275430
+ return missingApplication();
275431
+ }
275432
+ let blockchainNodeUniqueName = blockchainNode;
275433
+ if (!blockchainNodeUniqueName) {
275434
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275435
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275436
+ if (!node) {
275437
+ return nothingSelectedError("blockchain node");
275438
+ }
275439
+ blockchainNodeUniqueName = node.uniqueName;
275440
+ }
275292
275441
  const result = await settlemint.privateKey.create({
275293
275442
  name: name2,
275294
275443
  applicationUniqueName,
@@ -275341,6 +275490,9 @@ function ipfsStorageCreateCommand() {
275341
275490
  region
275342
275491
  }, async (settlemint, env2) => {
275343
275492
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275493
+ if (!applicationUniqueName) {
275494
+ return missingApplication();
275495
+ }
275344
275496
  const result = await settlemint.storage.create({
275345
275497
  name: name2,
275346
275498
  applicationUniqueName,
@@ -275390,6 +275542,9 @@ function minioStorageCreateCommand() {
275390
275542
  region
275391
275543
  }, async (settlemint, env2) => {
275392
275544
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275545
+ if (!applicationUniqueName) {
275546
+ return missingApplication();
275547
+ }
275393
275548
  const result = await settlemint.storage.create({
275394
275549
  name: name2,
275395
275550
  applicationUniqueName,
@@ -275483,9 +275638,8 @@ function getDeleteCommand({
275483
275638
  if (!force) {
275484
275639
  await deleteConfirmationPrompt(`this ${type4}`);
275485
275640
  }
275486
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275487
275641
  const env2 = await loadEnv2(false, !!prod);
275488
- const instance = await instancePrompt(env2, autoAccept);
275642
+ const instance = await instancePrompt(env2, acceptDefaults);
275489
275643
  const accessToken = await getApplicationOrPersonalAccessToken({
275490
275644
  env: env2,
275491
275645
  instance,
@@ -275578,9 +275732,8 @@ function getRestartCommand({
275578
275732
  }
275579
275733
  ])).argument("<unique-name>", `The unique name of the ${type4}, use 'default' to restart the default one from your .env file`).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").option("-w, --wait", "Wait until restarted").action(async (uniqueName, { acceptDefaults, prod, wait }) => {
275580
275734
  intro(`Restarting ${type4} in the SettleMint platform`);
275581
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275582
275735
  const env2 = await loadEnv2(false, !!prod);
275583
- const instance = await instancePrompt(env2, autoAccept);
275736
+ const instance = await instancePrompt(env2, acceptDefaults);
275584
275737
  const accessToken = await getApplicationOrPersonalAccessToken({
275585
275738
  env: env2,
275586
275739
  instance,
@@ -275770,7 +275923,7 @@ function customDeploymentsUpdateCommand() {
275770
275923
  const env2 = await loadEnv2(false, !!prod);
275771
275924
  const customDeploymentUniqueName = uniqueName ?? env2.SETTLEMINT_CUSTOM_DEPLOYMENT;
275772
275925
  if (!customDeploymentUniqueName) {
275773
- throw new Error("No custom deployment unique name specified. Please provide it either via the --unique-name flag or by setting the SETTLEMINT_CUSTOM_DEPLOYMENT environment variable");
275926
+ cancel("No custom deployment unique name specified. Please provide it either via the --unique-name flag or by setting the SETTLEMINT_CUSTOM_DEPLOYMENT environment variable");
275774
275927
  }
275775
275928
  const instance = await instancePrompt(env2, true);
275776
275929
  const accessToken = await getApplicationOrPersonalAccessToken({
@@ -275808,18 +275961,18 @@ function updateCommand() {
275808
275961
 
275809
275962
  // src/commands/platform/config.ts
275810
275963
  function configCommand() {
275811
- return new Command("config").alias("c").description("Get platform configuration").option("--prod", "Connect to your production environment").action(async ({ prod }) => {
275964
+ return new Command("config").alias("c").description("Get platform configuration").option("--prod", "Connect to your production environment").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").action(async ({ prod, instance }) => {
275812
275965
  intro("Getting platform configuration");
275813
275966
  const env2 = await loadEnv2(false, !!prod);
275814
- const instance = await instancePrompt(env2, true);
275967
+ const selectedInstance = instance ? sanitizeInstanceUrl(instance) : await instancePrompt(env2, true);
275815
275968
  const accessToken = await getApplicationOrPersonalAccessToken({
275816
275969
  env: env2,
275817
- instance,
275970
+ instance: selectedInstance,
275818
275971
  prefer: "personal"
275819
275972
  });
275820
275973
  const settlemint = createSettleMintClient({
275821
275974
  accessToken,
275822
- instance
275975
+ instance: selectedInstance
275823
275976
  });
275824
275977
  const platformConfig = await settlemint.platform.config();
275825
275978
  note2(`Providers and regions:
@@ -275894,7 +276047,7 @@ function createCommand4() {
275894
276047
  const platformConfig = await settlemint.platform.config();
275895
276048
  const selectedUseCase = await useCasePrompt(platformConfig, useCase);
275896
276049
  if (!selectedUseCase) {
275897
- cancel("No use case selected. Please select a use case to continue.");
276050
+ return nothingSelectedError("use case");
275898
276051
  }
275899
276052
  const targetDir = formatTargetDir(name2);
275900
276053
  const projectDir = join8(process.cwd(), targetDir);
@@ -276196,6 +276349,9 @@ function hardhatDeployRemoteCommand() {
276196
276349
  const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276197
276350
  let node = undefined;
276198
276351
  if (!nodeUniqueName) {
276352
+ if (!env2.SETTLEMINT_APPLICATION) {
276353
+ return missingApplication();
276354
+ }
276199
276355
  const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276200
276356
  const evmNodes = nodes.filter((node2) => node2.isEvm);
276201
276357
  if (evmNodes.length === 0) {
@@ -276206,9 +276362,9 @@ function hardhatDeployRemoteCommand() {
276206
276362
  if (nodesWithActivePrivateKey.length === 0) {
276207
276363
  cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276208
276364
  }
276209
- const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
276365
+ const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, acceptDefaults);
276210
276366
  if (!blockchainNode) {
276211
- cancel("No EVM blockchain node selected. Please select one to continue.");
276367
+ return nothingSelectedError("EVM blockchain node");
276212
276368
  }
276213
276369
  node = blockchainNode;
276214
276370
  } else {
@@ -276224,7 +276380,7 @@ function hardhatDeployRemoteCommand() {
276224
276380
  }
276225
276381
  const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
276226
276382
  if (!address) {
276227
- cancel("No private key selected. Please select one to continue.");
276383
+ return nothingSelectedError("private key");
276228
276384
  }
276229
276385
  const { command, args } = await getPackageManagerExecutable();
276230
276386
  await executeCommand(command, [
@@ -276308,14 +276464,31 @@ function hardhatScriptRemoteCommand() {
276308
276464
  accessToken,
276309
276465
  instance
276310
276466
  });
276311
- let nodeUniqueName = blockchainNodeUniqueName;
276467
+ let nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276312
276468
  if (!nodeUniqueName) {
276313
- const blockchainNodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276314
- const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
276469
+ if (!env2.SETTLEMINT_APPLICATION) {
276470
+ return missingApplication();
276471
+ }
276472
+ const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276473
+ const evmNodes = nodes.filter((node) => node.isEvm);
276474
+ if (evmNodes.length === 0) {
276475
+ cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
276476
+ }
276477
+ const nodesWithPrivateKey = await Promise.all(nodes.map((node) => settlemint.blockchainNode.read(node.uniqueName)));
276478
+ const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node) => node.privateKeys && node.privateKeys.length > 0);
276479
+ if (nodesWithActivePrivateKey.length === 0) {
276480
+ cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276481
+ }
276482
+ const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, acceptDefaults);
276315
276483
  if (!blockchainNode) {
276316
- cancel("No Blockchain Node selected. Please select one to continue.");
276484
+ return nothingSelectedError("EVM blockchain node");
276317
276485
  }
276318
276486
  nodeUniqueName = blockchainNode.uniqueName;
276487
+ } else {
276488
+ const node = await settlemint.blockchainNode.read(nodeUniqueName);
276489
+ if (!node.isEvm) {
276490
+ cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
276491
+ }
276319
276492
  }
276320
276493
  const envConfig = await settlemint.foundry.env(nodeUniqueName);
276321
276494
  const { command, args } = await getPackageManagerExecutable();
@@ -276534,6 +276707,9 @@ async function getTheGraphMiddleware({
276534
276707
  return defaultTheGraphMiddleware;
276535
276708
  }
276536
276709
  }
276710
+ if (!env2.SETTLEMINT_APPLICATION) {
276711
+ return missingApplication();
276712
+ }
276537
276713
  const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
276538
276714
  return theGraphPrompt(env2, middlewares, autoAccept);
276539
276715
  }
@@ -276643,7 +276819,7 @@ function subgraphDeployCommand() {
276643
276819
  });
276644
276820
  const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
276645
276821
  if (!theGraphMiddleware) {
276646
- cancel("No Graph Middleware selected. Please select one to continue.");
276822
+ return nothingSelectedError("graph middleware");
276647
276823
  }
276648
276824
  const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
276649
276825
  await subgraphSetup({
@@ -276746,4 +276922,4 @@ function sdkCliCommand(exitOverride = undefined) {
276746
276922
  ascii();
276747
276923
  sdkCliCommand();
276748
276924
 
276749
- //# debugId=A97C376CB78E2CC864756E2164756E21
276925
+ //# debugId=078DB7D6E26E376964756E2164756E21