@settlemint/sdk-cli 0.9.3-main725ad562 → 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 +501 -316
  2. package/dist/cli.js.map +50 -47
  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.U27iGwQVyk:/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.U27iGwQVyk:/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.U27iGwQVyk:/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.U27iGwQVyk:/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-main725ad562",
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.U27iGwQVyk:/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-main725ad562",
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-main725ad562",
256845
- "@settlemint/sdk-utils": "0.9.3-main725ad562",
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
  },
@@ -257103,9 +257103,12 @@ async function findUp(name, options = {}) {
257103
257103
 
257104
257104
  // ../utils/dist/filesystem.mjs
257105
257105
  import { stat } from "node:fs/promises";
257106
- async function projectRoot() {
257106
+ async function projectRoot(fallbackToCwd = false) {
257107
257107
  const packageJsonPath = await findUp("package.json");
257108
257108
  if (!packageJsonPath) {
257109
+ if (fallbackToCwd) {
257110
+ return process.cwd();
257111
+ }
257109
257112
  throw new Error("Unable to find project root (no package.json found)");
257110
257113
  }
257111
257114
  return dirname(packageJsonPath);
@@ -257140,6 +257143,9 @@ function missingAccessTokenError(personalAccessTokenExists) {
257140
257143
  function missingPersonalAccessTokenError() {
257141
257144
  return cancel("No personal access token found for instance, please run `settlemint login` to login to your instance");
257142
257145
  }
257146
+ function missingApplication() {
257147
+ return cancel("No application configured, please run `settlemint connect` to connect to your application");
257148
+ }
257143
257149
 
257144
257150
  // src/utils/config.ts
257145
257151
  import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
@@ -270060,9 +270066,12 @@ async function loadEnvironmentEnv2(validateEnv, prod, path5 = process.cwd()) {
270060
270066
  return {};
270061
270067
  }
270062
270068
  }
270063
- async function projectRoot2() {
270069
+ async function projectRoot2(fallbackToCwd = false) {
270064
270070
  const packageJsonPath = await findUp("package.json");
270065
270071
  if (!packageJsonPath) {
270072
+ if (fallbackToCwd) {
270073
+ return process.cwd();
270074
+ }
270066
270075
  throw new Error("Unable to find project root (no package.json found)");
270067
270076
  }
270068
270077
  return dirname5(packageJsonPath);
@@ -270113,7 +270122,7 @@ async function findMonoRepoPackages(projectDir) {
270113
270122
  }
270114
270123
  }
270115
270124
  async function writeEnv(prod, env2, secrets) {
270116
- const projectDir = await projectRoot2();
270125
+ const projectDir = await projectRoot2(true);
270117
270126
  if (prod) {
270118
270127
  process.env.NODE_ENV = "production";
270119
270128
  }
@@ -270561,6 +270570,12 @@ function getMinioEndpoints(service) {
270561
270570
  };
270562
270571
  }
270563
270572
 
270573
+ // src/utils/sanitize-instance-url.ts
270574
+ function sanitizeInstanceUrl(url) {
270575
+ const instanceUrl = new URL(url);
270576
+ return instanceUrl.origin;
270577
+ }
270578
+
270564
270579
  // ../utils/dist/runtime.mjs
270565
270580
  function ensureServer() {
270566
270581
  if (isBrowser) {
@@ -272750,8 +272765,9 @@ var esm_default5 = createPrompt((config4, done) => {
272750
272765
 
272751
272766
  // src/commands/connect/aat.prompt.ts
272752
272767
  async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
272768
+ const autoAccept = !!accept || is_in_ci_default;
272753
272769
  const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
272754
- const defaultPossible = accept && defaultAccessToken;
272770
+ const defaultPossible = autoAccept && defaultAccessToken;
272755
272771
  if (defaultPossible || is_in_ci_default) {
272756
272772
  return defaultAccessToken;
272757
272773
  }
@@ -272846,16 +272862,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
272846
272862
  });
272847
272863
  }
272848
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
+
272849
272870
  // src/commands/connect/application.prompt.ts
272850
272871
  async function applicationPrompt(env2, applications, accept) {
272872
+ const autoAccept = !!accept || is_in_ci_default;
272851
272873
  const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
272852
- const defaultPossible = accept && defaultApplication;
272874
+ const defaultPossible = autoAccept && defaultApplication;
272853
272875
  if (defaultPossible) {
272854
272876
  return defaultApplication;
272855
272877
  }
272856
272878
  if (applications.length === 0) {
272857
272879
  cancel("No applications found");
272858
272880
  }
272881
+ if (is_in_ci_default) {
272882
+ nothingSelectedError("application");
272883
+ }
272859
272884
  const application = await esm_default2({
272860
272885
  message: "Which application do you want to connect to?",
272861
272886
  choices: applications.map((applications2) => ({
@@ -272870,249 +272895,290 @@ async function applicationPrompt(env2, applications, accept) {
272870
272895
  return application;
272871
272896
  }
272872
272897
 
272873
- // src/commands/connect/blockchain-node.prompt.ts
272874
- async function blockchainNodePrompt(env2, nodes, accept) {
272875
- 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) {
272876
272908
  return;
272877
272909
  }
272878
- const defaultNode = nodes.find((node2) => node2.uniqueName === env2.SETTLEMINT_BLOCKCHAIN_NODE) ?? (nodes.length === 1 ? nodes[0] : undefined);
272879
- const defaultPossible = accept;
272880
- if (defaultPossible) {
272881
- return defaultNode;
272910
+ const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
272911
+ const autoAccept = isCi || accept;
272912
+ if (autoAccept && selectedService) {
272913
+ return selectedService;
272882
272914
  }
272883
- const node = await esm_default2({
272884
- message: "Which blockchain node do you want to connect to?",
272885
- choices: [
272886
- ...nodes.map((node2) => ({
272887
- name: node2.name,
272888
- value: node2
272889
- })),
272890
- {
272891
- name: "None",
272892
- value: undefined
272893
- }
272894
- ],
272895
- 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
+ }
272896
272947
  });
272897
- return node;
272898
272948
  }
272899
272949
 
272900
272950
  // src/commands/connect/blockscout.prompt.ts
272901
272951
  async function blockscoutPrompt(env2, insights, accept) {
272902
272952
  const possible = insights.filter((insight) => insight.insightsCategory === "BLOCKCHAIN_EXPLORER");
272903
- if (possible.length === 0) {
272904
- return;
272905
- }
272906
- const defaultBlockscout = insights.find((insight) => insight.uniqueName === env2.SETTLEMINT_BLOCKSCOUT) ?? (insights.length === 1 ? insights[0] : undefined);
272907
- const defaultPossible = accept;
272908
- if (defaultPossible) {
272909
- return defaultBlockscout;
272910
- }
272911
- const blockscout = await esm_default2({
272912
- message: "Which blockscout instance do you want to connect to?",
272913
- choices: [
272914
- ...insights.map((insight) => ({
272915
- name: insight.name,
272916
- value: insight
272917
- })),
272918
- {
272919
- name: "None",
272920
- value: undefined
272921
- }
272922
- ],
272923
- 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
+ }
272924
272974
  });
272925
- return blockscout;
272926
272975
  }
272927
272976
 
272928
272977
  // src/commands/connect/custom-deployment.prompt.ts
272929
272978
  async function customDeploymentPrompt(env2, customDeployments, accept) {
272930
- if (customDeployments.length === 0) {
272931
- return;
272932
- }
272933
- const defaultCustomDeployment = customDeployments.find((customDeployment) => customDeployment.uniqueName === env2.SETTLEMINT_CUSTOM_DEPLOYMENT) ?? (customDeployments.length === 1 ? customDeployments[0] : undefined);
272934
- const defaultPossible = accept;
272935
- if (defaultPossible) {
272936
- return defaultCustomDeployment;
272937
- }
272938
- const middleware = await esm_default2({
272939
- message: "Which Custom Deployment do you want to connect to?",
272940
- choices: [
272941
- ...customDeployments.map((customDeployment) => ({
272942
- name: customDeployment.name,
272943
- value: customDeployment
272944
- })),
272945
- {
272946
- name: "None",
272947
- value: undefined
272948
- }
272949
- ],
272950
- 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
+ }
272951
273002
  });
272952
- return middleware;
272953
273003
  }
272954
273004
 
272955
273005
  // src/commands/connect/hasura.prompt.ts
272956
273006
  async function hasuraPrompt(env2, integrations, accept) {
272957
273007
  const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
272958
- if (possible.length === 0) {
272959
- return;
272960
- }
272961
- const defaultIntegration = possible.find((integration) => integration.uniqueName === env2.SETTLEMINT_HASURA) ?? (possible.length === 1 ? possible[0] : undefined);
272962
- const defaultPossible = accept;
272963
- if (defaultPossible) {
272964
- return defaultIntegration;
272965
- }
272966
- const hasura = await esm_default2({
272967
- message: "Which Hasura instance do you want to connect to?",
272968
- choices: [
272969
- ...possible.map((integration) => ({
272970
- name: integration.name,
272971
- value: integration
272972
- })),
272973
- {
272974
- name: "None",
272975
- value: undefined
272976
- }
272977
- ],
272978
- 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
+ }
272979
273029
  });
272980
- return hasura;
272981
273030
  }
272982
273031
 
272983
273032
  // src/commands/connect/hd-private-keys.prompt.ts
272984
273033
  async function hdPrivateKeyPrompt(env2, privateKeys, accept) {
272985
- const possible = privateKeys.filter((privateKey2) => privateKey2.privateKeyType === "HD_ECDSA_P256");
272986
- if (possible.length === 0) {
272987
- return;
272988
- }
272989
- const defaultPrivateKey = possible.find((privateKey2) => privateKey2.uniqueName === env2.SETTLEMINT_HD_PRIVATE_KEY) ?? (possible.length === 1 ? possible[0] : undefined);
272990
- const defaultPossible = accept;
272991
- if (defaultPossible) {
272992
- return defaultPrivateKey;
272993
- }
272994
- const privateKey = await esm_default2({
272995
- message: "Which HD Private Key do you want to use?",
272996
- choices: [
272997
- ...possible.map((privateKey2) => ({
272998
- name: privateKey2.name,
272999
- value: privateKey2
273000
- })),
273001
- {
273002
- name: "None",
273003
- value: undefined
273004
- }
273005
- ],
273006
- 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
+ }
273007
273056
  });
273008
- return privateKey;
273009
273057
  }
273010
273058
 
273011
273059
  // src/commands/connect/instance.prompt.ts
273012
- async function instancePrompt(env2, accept) {
273013
- const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
273014
- 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;
273015
273065
  if (defaultPossible) {
273016
273066
  return defaultInstance;
273017
273067
  }
273018
- return esm_default4({
273019
- message: "What is the URL of your SettleMint instance?",
273020
- default: defaultInstance,
273021
- required: true,
273022
- validate(value4) {
273023
- try {
273024
- validate3(UrlSchema3, value4);
273025
- return true;
273026
- } catch (error5) {
273027
- return "Invalid URL";
273028
- }
273029
- },
273030
- 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
273031
273100
  });
273032
273101
  }
273033
273102
 
273034
273103
  // src/commands/connect/ipfs.prompt.ts
273035
273104
  async function ipfsPrompt(env2, storages, accept) {
273036
273105
  const possible = storages.filter((storage) => storage.storageProtocol === "IPFS");
273037
- if (possible.length === 0) {
273038
- return;
273039
- }
273040
- const defaultStorage = possible.find((storage) => storage.uniqueName === env2.SETTLEMINT_IPFS) ?? (possible.length === 1 ? possible[0] : undefined);
273041
- const defaultPossible = accept;
273042
- if (defaultPossible) {
273043
- return defaultStorage;
273044
- }
273045
- const minio = await esm_default2({
273046
- message: "Which IPFS instance do you want to connect to?",
273047
- choices: [
273048
- ...possible.map((storage) => ({
273049
- name: storage.name,
273050
- value: storage
273051
- })),
273052
- {
273053
- name: "None",
273054
- value: undefined
273055
- }
273056
- ],
273057
- 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
+ }
273058
273127
  });
273059
- return minio;
273060
273128
  }
273061
273129
 
273062
273130
  // src/commands/connect/minio.prompt.ts
273063
273131
  async function minioPrompt(env2, storages, accept) {
273064
273132
  const possible = storages.filter((storage) => storage.storageProtocol === "MINIO");
273065
- if (possible.length === 0) {
273066
- return;
273067
- }
273068
- const defaultStorage = possible.find((storage) => storage.uniqueName === env2.SETTLEMINT_MINIO) ?? (possible.length === 1 ? possible[0] : undefined);
273069
- const defaultPossible = accept;
273070
- if (defaultPossible) {
273071
- return defaultStorage;
273072
- }
273073
- const minio = await esm_default2({
273074
- message: "Which Minio instance do you want to connect to?",
273075
- choices: [
273076
- ...possible.map((storage) => ({
273077
- name: storage.name,
273078
- value: storage
273079
- })),
273080
- {
273081
- name: "None",
273082
- value: undefined
273083
- }
273084
- ],
273085
- 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
+ }
273086
273154
  });
273087
- return minio;
273088
273155
  }
273089
273156
 
273090
273157
  // src/commands/connect/portal.prompt.ts
273091
273158
  async function portalPrompt(env2, middlewares, accept) {
273092
- const possible = middlewares.filter((middleware2) => middleware2.interface === "SMART_CONTRACT_PORTAL");
273093
- if (possible.length === 0) {
273094
- return;
273095
- }
273096
- const defaultMiddleware = possible.find((middleware2) => middleware2.uniqueName === env2.SETTLEMINT_PORTAL) ?? (possible.length === 1 ? possible[0] : undefined);
273097
- const defaultPossible = accept;
273098
- if (defaultPossible) {
273099
- return defaultMiddleware;
273100
- }
273101
- const middleware = await esm_default2({
273102
- message: "Which Smart Contract Portal instance do you want to connect to?",
273103
- choices: [
273104
- ...possible.map((middleware2) => ({
273105
- name: middleware2.name,
273106
- value: middleware2
273107
- })),
273108
- {
273109
- name: "None",
273110
- value: undefined
273111
- }
273112
- ],
273113
- 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
+ }
273114
273181
  });
273115
- return middleware;
273116
273182
  }
273117
273183
 
273118
273184
  // src/commands/connect/services.spinner.ts
@@ -273156,42 +273222,45 @@ async function servicesSpinner(settlemint, application) {
273156
273222
 
273157
273223
  // src/commands/connect/thegraph.prompt.ts
273158
273224
  async function theGraphPrompt(env2, middlewares, accept) {
273159
- const possible = middlewares.filter((middleware2) => middleware2.__typename === "HAGraphMiddleware");
273160
- if (possible.length === 0) {
273161
- return;
273162
- }
273163
- const defaultMiddleware = possible.find((middleware2) => middleware2.uniqueName === env2.SETTLEMINT_THEGRAPH) ?? (possible.length === 1 ? possible[0] : undefined);
273164
- const defaultPossible = accept;
273165
- if (defaultPossible) {
273166
- return defaultMiddleware;
273167
- }
273168
- const middleware = await esm_default2({
273169
- message: "Which The Graph instance do you want to connect to?",
273170
- choices: [
273171
- ...possible.map((middleware2) => ({
273172
- name: middleware2.name,
273173
- value: middleware2
273174
- })),
273175
- {
273176
- name: "None",
273177
- value: undefined
273178
- }
273179
- ],
273180
- 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
+ }
273181
273247
  });
273182
- return middleware;
273183
273248
  }
273184
273249
 
273185
273250
  // src/commands/connect/workspace.prompt.ts
273186
273251
  async function workspacePrompt(env2, workspaces, accept) {
273252
+ const autoAccept = !!accept || is_in_ci_default;
273187
273253
  const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
273188
- const defaultPossible = accept && defaultWorkspace;
273254
+ const defaultPossible = autoAccept && defaultWorkspace;
273189
273255
  if (defaultPossible) {
273190
273256
  return defaultWorkspace;
273191
273257
  }
273192
273258
  if (workspaces.length === 0) {
273193
273259
  cancel2("No workspaces found");
273194
273260
  }
273261
+ if (is_in_ci_default) {
273262
+ nothingSelectedError("workspace");
273263
+ }
273195
273264
  const workspace = await esm_default2({
273196
273265
  message: "Which workspace do you want to connect to?",
273197
273266
  choices: workspaces.map((workspace2) => ({
@@ -273208,35 +273277,37 @@ async function workspacePrompt(env2, workspaces, accept) {
273208
273277
 
273209
273278
  // src/commands/connect.ts
273210
273279
  function connectCommand() {
273211
- 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 }) => {
273212
273281
  intro("Connecting your dApp to SettleMint");
273213
- const autoAccept = !!acceptDefaults || is_in_ci_default;
273214
273282
  const env2 = await loadEnv2(false, !!prod);
273215
- const instance = await instancePrompt(env2, autoAccept);
273216
- 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);
273217
273288
  if (!personalAccessToken) {
273218
273289
  return missingPersonalAccessTokenError();
273219
273290
  }
273220
273291
  const accessToken = personalAccessToken.personalAccessToken;
273221
273292
  const settlemint = createSettleMintClient({
273222
273293
  accessToken,
273223
- instance
273294
+ instance: selectedInstance
273224
273295
  });
273225
273296
  const workspaces = await workspaceSpinner(settlemint);
273226
- const workspace = await workspacePrompt(env2, workspaces, autoAccept);
273227
- const application = await applicationPrompt(env2, workspace?.applications ?? [], autoAccept);
273228
- 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);
273229
273300
  const { middleware, integrationTool, storage, privateKey, insights, customDeployment, blockchainNodes } = await servicesSpinner(settlemint, application);
273230
- const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
273231
- const hasura = await hasuraPrompt(env2, integrationTool, autoAccept);
273232
- const thegraph = await theGraphPrompt(env2, middleware, autoAccept);
273233
- const portal = await portalPrompt(env2, middleware, autoAccept);
273234
- const ipfs = await ipfsPrompt(env2, storage, autoAccept);
273235
- const minio = await minioPrompt(env2, storage, autoAccept);
273236
- const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, autoAccept);
273237
- const cDeployment = await customDeploymentPrompt(env2, customDeployment, autoAccept);
273238
- const blockscout = await blockscoutPrompt(env2, insights, autoAccept);
273239
- 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) {
273240
273311
  const selectedServices = [
273241
273312
  `Workspace: ${workspace.name}`,
273242
273313
  `Application: ${application.name}`,
@@ -273258,7 +273329,7 @@ function connectCommand() {
273258
273329
  }
273259
273330
  await writeEnvSpinner(!!prod, {
273260
273331
  SETTLEMINT_ACCESS_TOKEN: aatToken,
273261
- SETTLEMINT_INSTANCE: instance,
273332
+ SETTLEMINT_INSTANCE: selectedInstance,
273262
273333
  SETTLEMINT_WORKSPACE: workspace.uniqueName,
273263
273334
  SETTLEMINT_APPLICATION: application.uniqueName,
273264
273335
  SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
@@ -273340,9 +273411,12 @@ import { dirname as dirname6 } from "node:path";
273340
273411
  import { stat as stat8 } from "node:fs/promises";
273341
273412
  var import_package_json3 = __toESM(require_lib12(), 1);
273342
273413
  var import_package_json4 = __toESM(require_lib12(), 1);
273343
- async function projectRoot3() {
273414
+ async function projectRoot3(fallbackToCwd = false) {
273344
273415
  const packageJsonPath = await findUp("package.json");
273345
273416
  if (!packageJsonPath) {
273417
+ if (fallbackToCwd) {
273418
+ return process.cwd();
273419
+ }
273346
273420
  throw new Error("Unable to find project root (no package.json found)");
273347
273421
  }
273348
273422
  return dirname6(packageJsonPath);
@@ -274103,7 +274177,7 @@ function createCommand2() {
274103
274177
  }
274104
274178
  const selectedTemplate = await templatePrompt(templates, template);
274105
274179
  if (!selectedTemplate) {
274106
- cancel("No template selected. Please select a template to continue.");
274180
+ return nothingSelectedError("template");
274107
274181
  }
274108
274182
  await spinner({
274109
274183
  startMessage: "Scaffolding the project",
@@ -274174,7 +274248,10 @@ function loginCommand() {
274174
274248
  intro("Login to your SettleMint account");
274175
274249
  const autoAccept = !!acceptDefaults || !!tokenStdin;
274176
274250
  const env2 = await loadEnv2(false, false);
274177
- 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);
274178
274255
  let personalAccessToken = "";
274179
274256
  if (tokenStdin) {
274180
274257
  if (cmd2.args.length > 0) {
@@ -274419,9 +274496,8 @@ function getCreateCommand({
274419
274496
  }
274420
274497
  execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout, provider, region }, createFunction) => {
274421
274498
  intro(`Creating ${type4} in the SettleMint platform`);
274422
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274423
274499
  const env2 = await loadEnv2(false, !!prod);
274424
- const instance = await instancePrompt(env2, autoAccept);
274500
+ const instance = await instancePrompt(env2, acceptDefaults);
274425
274501
  const accessToken = await getApplicationOrPersonalAccessToken({
274426
274502
  env: env2,
274427
274503
  instance,
@@ -274435,11 +274511,11 @@ function getCreateCommand({
274435
274511
  if (requiresDeployment) {
274436
274512
  const selectedProvider = await providerPrompt(platformConfig, provider);
274437
274513
  if (!selectedProvider) {
274438
- cancel("No provider selected. Please select a provider to continue.");
274514
+ return nothingSelectedError("provider");
274439
274515
  }
274440
274516
  const selectedRegion = await regionPrompt(selectedProvider, region);
274441
274517
  if (!selectedRegion) {
274442
- cancel("No region selected. Please select a region to continue.");
274518
+ return nothingSelectedError("region");
274443
274519
  }
274444
274520
  }
274445
274521
  const { result, waitFor, mapDefaultEnv } = await spinner({
@@ -274515,6 +274591,9 @@ function blockchainNetworkBesuCreateCommand() {
274515
274591
  region
274516
274592
  }, async (settlemint, env2) => {
274517
274593
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274594
+ if (!applicationUniqueName) {
274595
+ return missingApplication();
274596
+ }
274518
274597
  const result = await settlemint.blockchainNetwork.create({
274519
274598
  name: name2,
274520
274599
  applicationUniqueName,
@@ -274722,6 +274801,9 @@ function applicationAccessTokenCreateCommand() {
274722
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 }) => {
274723
274802
  return baseAction(defaultArgs, async (settlemint, env2) => {
274724
274803
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274804
+ if (!applicationUniqueName) {
274805
+ return missingApplication();
274806
+ }
274725
274807
  const aatToken = await settlemint.applicationAccessToken.create({
274726
274808
  applicationUniqueName,
274727
274809
  name: name2,
@@ -274774,6 +274856,7 @@ function applicationAccessTokenCreateCommand() {
274774
274856
  uniqueName: ""
274775
274857
  },
274776
274858
  mapDefaultEnv: () => ({
274859
+ SETTLEMINT_APPLICATION: applicationUniqueName,
274777
274860
  SETTLEMINT_ACCESS_TOKEN: aatToken
274778
274861
  })
274779
274862
  };
@@ -274805,11 +274888,23 @@ function applicationCreateCommand() {
274805
274888
  type: "application",
274806
274889
  alias: "a",
274807
274890
  execute: (cmd2, baseAction) => {
274808
- cmd2.option("-w, --workspace <workspace>", "The workspace unique name to create the application in (defaults to workspace from env)").action(async (name2, { workspace, ...defaultArgs }) => {
274809
- 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
+ }
274810
274905
  const result = await settlemint.application.create({
274811
274906
  name: name2,
274812
- workspaceUniqueName: workspace ?? env2.SETTLEMINT_WORKSPACE
274907
+ workspaceUniqueName
274813
274908
  });
274814
274909
  return {
274815
274910
  result,
@@ -274842,27 +274937,27 @@ function applicationCreateCommand() {
274842
274937
 
274843
274938
  // src/commands/connect/blockchain-network.prompt.ts
274844
274939
  async function blockchainNetworkPrompt(env2, networks, accept) {
274845
- if (networks.length === 0) {
274846
- return;
274847
- }
274848
- const defaultNetwork = networks.find((network) => network.uniqueName === env2.SETTLEMINT_BLOCKCHAIN_NETWORK) ?? (networks.length === 1 ? networks[0] : undefined);
274849
- const defaultPossible = accept;
274850
- if (defaultPossible) {
274851
- return defaultNetwork;
274852
- }
274853
- return esm_default2({
274854
- message: "Which blockchain network do you want to connect to?",
274855
- choices: [
274856
- ...networks.map((network) => ({
274857
- name: network.name,
274858
- value: network
274859
- })),
274860
- {
274861
- name: "None",
274862
- value: undefined
274863
- }
274864
- ],
274865
- 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
+ }
274866
274961
  });
274867
274962
  }
274868
274963
 
@@ -274891,19 +274986,18 @@ function blockchainNodeBesuCreateCommand() {
274891
274986
  provider,
274892
274987
  region
274893
274988
  }, async (settlemint, env2) => {
274894
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274895
274989
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274896
274990
  if (!applicationUniqueName) {
274897
- cancel("No application found. Please specify an application or run `settlemint connect` to continue.");
274991
+ return missingApplication();
274898
274992
  }
274899
- let networkUniqueName = blockchainNetwork ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NETWORK : undefined);
274993
+ let networkUniqueName = blockchainNetwork;
274900
274994
  if (!networkUniqueName) {
274901
274995
  const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
274902
- const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults ?? false);
274996
+ const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
274903
274997
  if (!network) {
274904
- cancel("No network found. Please specify a network to continue.");
274998
+ return nothingSelectedError("blockchain network");
274905
274999
  }
274906
- networkUniqueName = network?.id;
275000
+ networkUniqueName = network?.uniqueName;
274907
275001
  }
274908
275002
  const result = await settlemint.blockchainNode.create({
274909
275003
  applicationUniqueName,
@@ -274921,7 +275015,7 @@ function blockchainNodeBesuCreateCommand() {
274921
275015
  mapDefaultEnv: () => {
274922
275016
  return {
274923
275017
  SETTLEMINT_APPLICATION: applicationUniqueName,
274924
- SETTLEMINT_BLOCKCHAIN_NODE: result.id
275018
+ SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
274925
275019
  };
274926
275020
  }
274927
275021
  };
@@ -274957,15 +275051,27 @@ function blockscoutInsightsCreateCommand() {
274957
275051
  type: "insights",
274958
275052
  alias: "bs",
274959
275053
  execute: (cmd2, baseAction) => {
274960
- 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 }) => {
274961
275055
  return baseAction({
274962
275056
  ...defaultArgs,
275057
+ acceptDefaults,
274963
275058
  provider,
274964
275059
  region
274965
275060
  }, async (settlemint, env2) => {
274966
275061
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274967
- 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;
274968
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
+ }
274969
275075
  const result = await settlemint.insights.create({
274970
275076
  name: name2,
274971
275077
  applicationUniqueName,
@@ -275024,6 +275130,9 @@ function hasuraIntegrationCreateCommand() {
275024
275130
  region
275025
275131
  }, async (settlemint, env2) => {
275026
275132
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275133
+ if (!applicationUniqueName) {
275134
+ return missingApplication();
275135
+ }
275027
275136
  const result = await settlemint.integrationTool.create({
275028
275137
  name: name2,
275029
275138
  applicationUniqueName,
@@ -275073,14 +275182,26 @@ function graphMiddlewareCreateCommand() {
275073
275182
  type: "middleware",
275074
275183
  alias: "gr",
275075
275184
  execute: (cmd2, baseAction) => {
275076
- 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 }) => {
275077
275186
  return baseAction({
275078
275187
  ...defaultArgs,
275188
+ acceptDefaults,
275079
275189
  provider,
275080
275190
  region
275081
275191
  }, async (settlemint, env2) => {
275082
275192
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275083
- 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
+ }
275084
275205
  const result = await settlemint.middleware.create({
275085
275206
  name: name2,
275086
275207
  applicationUniqueName,
@@ -275136,16 +275257,29 @@ function smartContractPortalMiddlewareCreateCommand() {
275136
275257
  type: type4,
275137
275258
  includePredeployedAbis,
275138
275259
  abis,
275260
+ acceptDefaults,
275139
275261
  ...defaultArgs
275140
275262
  }) => {
275141
275263
  return baseAction({
275142
275264
  ...defaultArgs,
275265
+ acceptDefaults,
275143
275266
  provider,
275144
275267
  region
275145
275268
  }, async (settlemint, env2) => {
275146
275269
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275147
- 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;
275148
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
+ }
275149
275283
  const parsedAbis = [];
275150
275284
  if (abis && abis.length > 0) {
275151
275285
  try {
@@ -275218,14 +275352,26 @@ function privateKeyHdCreateCommand() {
275218
275352
  type: "private key",
275219
275353
  alias: "hd",
275220
275354
  execute: (cmd2, baseAction) => {
275221
- 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 }) => {
275222
275356
  return baseAction({
275223
275357
  ...defaultArgs,
275358
+ acceptDefaults,
275224
275359
  provider,
275225
275360
  region
275226
275361
  }, async (settlemint, env2) => {
275227
275362
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275228
- 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
+ }
275229
275375
  const result = await settlemint.privateKey.create({
275230
275376
  name: name2,
275231
275377
  applicationUniqueName,
@@ -275272,14 +275418,26 @@ function privateKeyHsmCreateCommand() {
275272
275418
  type: "private key",
275273
275419
  alias: "hd",
275274
275420
  execute: (cmd2, baseAction) => {
275275
- 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 }) => {
275276
275422
  return baseAction({
275277
275423
  ...defaultArgs,
275424
+ acceptDefaults,
275278
275425
  provider,
275279
275426
  region
275280
275427
  }, async (settlemint, env2) => {
275281
275428
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275282
- 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
+ }
275283
275441
  const result = await settlemint.privateKey.create({
275284
275442
  name: name2,
275285
275443
  applicationUniqueName,
@@ -275332,6 +275490,9 @@ function ipfsStorageCreateCommand() {
275332
275490
  region
275333
275491
  }, async (settlemint, env2) => {
275334
275492
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275493
+ if (!applicationUniqueName) {
275494
+ return missingApplication();
275495
+ }
275335
275496
  const result = await settlemint.storage.create({
275336
275497
  name: name2,
275337
275498
  applicationUniqueName,
@@ -275381,6 +275542,9 @@ function minioStorageCreateCommand() {
275381
275542
  region
275382
275543
  }, async (settlemint, env2) => {
275383
275544
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275545
+ if (!applicationUniqueName) {
275546
+ return missingApplication();
275547
+ }
275384
275548
  const result = await settlemint.storage.create({
275385
275549
  name: name2,
275386
275550
  applicationUniqueName,
@@ -275474,9 +275638,8 @@ function getDeleteCommand({
275474
275638
  if (!force) {
275475
275639
  await deleteConfirmationPrompt(`this ${type4}`);
275476
275640
  }
275477
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275478
275641
  const env2 = await loadEnv2(false, !!prod);
275479
- const instance = await instancePrompt(env2, autoAccept);
275642
+ const instance = await instancePrompt(env2, acceptDefaults);
275480
275643
  const accessToken = await getApplicationOrPersonalAccessToken({
275481
275644
  env: env2,
275482
275645
  instance,
@@ -275569,9 +275732,8 @@ function getRestartCommand({
275569
275732
  }
275570
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 }) => {
275571
275734
  intro(`Restarting ${type4} in the SettleMint platform`);
275572
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275573
275735
  const env2 = await loadEnv2(false, !!prod);
275574
- const instance = await instancePrompt(env2, autoAccept);
275736
+ const instance = await instancePrompt(env2, acceptDefaults);
275575
275737
  const accessToken = await getApplicationOrPersonalAccessToken({
275576
275738
  env: env2,
275577
275739
  instance,
@@ -275761,7 +275923,7 @@ function customDeploymentsUpdateCommand() {
275761
275923
  const env2 = await loadEnv2(false, !!prod);
275762
275924
  const customDeploymentUniqueName = uniqueName ?? env2.SETTLEMINT_CUSTOM_DEPLOYMENT;
275763
275925
  if (!customDeploymentUniqueName) {
275764
- 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");
275765
275927
  }
275766
275928
  const instance = await instancePrompt(env2, true);
275767
275929
  const accessToken = await getApplicationOrPersonalAccessToken({
@@ -275799,18 +275961,18 @@ function updateCommand() {
275799
275961
 
275800
275962
  // src/commands/platform/config.ts
275801
275963
  function configCommand() {
275802
- 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 }) => {
275803
275965
  intro("Getting platform configuration");
275804
275966
  const env2 = await loadEnv2(false, !!prod);
275805
- const instance = await instancePrompt(env2, true);
275967
+ const selectedInstance = instance ? sanitizeInstanceUrl(instance) : await instancePrompt(env2, true);
275806
275968
  const accessToken = await getApplicationOrPersonalAccessToken({
275807
275969
  env: env2,
275808
- instance,
275970
+ instance: selectedInstance,
275809
275971
  prefer: "personal"
275810
275972
  });
275811
275973
  const settlemint = createSettleMintClient({
275812
275974
  accessToken,
275813
- instance
275975
+ instance: selectedInstance
275814
275976
  });
275815
275977
  const platformConfig = await settlemint.platform.config();
275816
275978
  note2(`Providers and regions:
@@ -275885,7 +276047,7 @@ function createCommand4() {
275885
276047
  const platformConfig = await settlemint.platform.config();
275886
276048
  const selectedUseCase = await useCasePrompt(platformConfig, useCase);
275887
276049
  if (!selectedUseCase) {
275888
- cancel("No use case selected. Please select a use case to continue.");
276050
+ return nothingSelectedError("use case");
275889
276051
  }
275890
276052
  const targetDir = formatTargetDir(name2);
275891
276053
  const projectDir = join8(process.cwd(), targetDir);
@@ -276187,6 +276349,9 @@ function hardhatDeployRemoteCommand() {
276187
276349
  const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276188
276350
  let node = undefined;
276189
276351
  if (!nodeUniqueName) {
276352
+ if (!env2.SETTLEMINT_APPLICATION) {
276353
+ return missingApplication();
276354
+ }
276190
276355
  const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276191
276356
  const evmNodes = nodes.filter((node2) => node2.isEvm);
276192
276357
  if (evmNodes.length === 0) {
@@ -276197,9 +276362,9 @@ function hardhatDeployRemoteCommand() {
276197
276362
  if (nodesWithActivePrivateKey.length === 0) {
276198
276363
  cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276199
276364
  }
276200
- const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
276365
+ const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, acceptDefaults);
276201
276366
  if (!blockchainNode) {
276202
- cancel("No EVM blockchain node selected. Please select one to continue.");
276367
+ return nothingSelectedError("EVM blockchain node");
276203
276368
  }
276204
276369
  node = blockchainNode;
276205
276370
  } else {
@@ -276215,7 +276380,7 @@ function hardhatDeployRemoteCommand() {
276215
276380
  }
276216
276381
  const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
276217
276382
  if (!address) {
276218
- cancel("No private key selected. Please select one to continue.");
276383
+ return nothingSelectedError("private key");
276219
276384
  }
276220
276385
  const { command, args } = await getPackageManagerExecutable();
276221
276386
  await executeCommand(command, [
@@ -276299,14 +276464,31 @@ function hardhatScriptRemoteCommand() {
276299
276464
  accessToken,
276300
276465
  instance
276301
276466
  });
276302
- let nodeUniqueName = blockchainNodeUniqueName;
276467
+ let nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276303
276468
  if (!nodeUniqueName) {
276304
- const blockchainNodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276305
- 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);
276306
276483
  if (!blockchainNode) {
276307
- cancel("No Blockchain Node selected. Please select one to continue.");
276484
+ return nothingSelectedError("EVM blockchain node");
276308
276485
  }
276309
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
+ }
276310
276492
  }
276311
276493
  const envConfig = await settlemint.foundry.env(nodeUniqueName);
276312
276494
  const { command, args } = await getPackageManagerExecutable();
@@ -276525,6 +276707,9 @@ async function getTheGraphMiddleware({
276525
276707
  return defaultTheGraphMiddleware;
276526
276708
  }
276527
276709
  }
276710
+ if (!env2.SETTLEMINT_APPLICATION) {
276711
+ return missingApplication();
276712
+ }
276528
276713
  const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
276529
276714
  return theGraphPrompt(env2, middlewares, autoAccept);
276530
276715
  }
@@ -276634,7 +276819,7 @@ function subgraphDeployCommand() {
276634
276819
  });
276635
276820
  const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
276636
276821
  if (!theGraphMiddleware) {
276637
- cancel("No Graph Middleware selected. Please select one to continue.");
276822
+ return nothingSelectedError("graph middleware");
276638
276823
  }
276639
276824
  const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
276640
276825
  await subgraphSetup({
@@ -276737,4 +276922,4 @@ function sdkCliCommand(exitOverride = undefined) {
276737
276922
  ascii();
276738
276923
  sdkCliCommand();
276739
276924
 
276740
- //# debugId=5654333BA10A5E3B64756E2164756E21
276925
+ //# debugId=078DB7D6E26E376964756E2164756E21