@settlemint/sdk-cli 0.9.3-pr85e672fd → 0.9.3-prc02a8001

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 +427 -282
  2. package/dist/cli.js.map +42 -40
  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.sCw11EyGmn:/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.Ylu6Ro45BP:/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.sCw11EyGmn:/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.Ylu6Ro45BP:/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.sCw11EyGmn:/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.Ylu6Ro45BP:/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.sCw11EyGmn:/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.Ylu6Ro45BP:/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-pr85e672fd",
226467
+ binaryVersion: "0.9.3-prc02a8001",
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.sCw11EyGmn:/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.Ylu6Ro45BP:/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-pr85e672fd",
256791
+ version: "0.9.3-prc02a8001",
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-pr85e672fd",
256845
- "@settlemint/sdk-utils": "0.9.3-pr85e672fd",
256844
+ "@settlemint/sdk-js": "0.9.3-prc02a8001",
256845
+ "@settlemint/sdk-utils": "0.9.3-prc02a8001",
256846
256846
  "get-tsconfig": "4.8.1",
256847
256847
  giget: "1.2.3"
256848
256848
  },
@@ -257140,6 +257140,9 @@ function missingAccessTokenError(personalAccessTokenExists) {
257140
257140
  function missingPersonalAccessTokenError() {
257141
257141
  return cancel("No personal access token found for instance, please run `settlemint login` to login to your instance");
257142
257142
  }
257143
+ function missingApplication() {
257144
+ return cancel("No application configured, please run `settlemint connect` to connect to your application");
257145
+ }
257143
257146
 
257144
257147
  // src/utils/config.ts
257145
257148
  import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
@@ -272750,8 +272753,9 @@ var esm_default5 = createPrompt((config4, done) => {
272750
272753
 
272751
272754
  // src/commands/connect/aat.prompt.ts
272752
272755
  async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
272756
+ const autoAccept = !!accept || is_in_ci_default;
272753
272757
  const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
272754
- const defaultPossible = accept && defaultAccessToken;
272758
+ const defaultPossible = autoAccept && defaultAccessToken;
272755
272759
  if (defaultPossible || is_in_ci_default) {
272756
272760
  return defaultAccessToken;
272757
272761
  }
@@ -272846,16 +272850,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
272846
272850
  });
272847
272851
  }
272848
272852
 
272853
+ // src/error/nothing-selected-error.ts
272854
+ function nothingSelectedError(type4) {
272855
+ return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
272856
+ }
272857
+
272849
272858
  // src/commands/connect/application.prompt.ts
272850
272859
  async function applicationPrompt(env2, applications, accept) {
272860
+ const autoAccept = !!accept || is_in_ci_default;
272851
272861
  const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
272852
- const defaultPossible = accept && defaultApplication;
272862
+ const defaultPossible = autoAccept && defaultApplication;
272853
272863
  if (defaultPossible) {
272854
272864
  return defaultApplication;
272855
272865
  }
272856
272866
  if (applications.length === 0) {
272857
272867
  cancel("No applications found");
272858
272868
  }
272869
+ if (is_in_ci_default) {
272870
+ nothingSelectedError("application");
272871
+ }
272859
272872
  const application = await esm_default2({
272860
272873
  message: "Which application do you want to connect to?",
272861
272874
  choices: applications.map((applications2) => ({
@@ -272870,146 +272883,170 @@ async function applicationPrompt(env2, applications, accept) {
272870
272883
  return application;
272871
272884
  }
272872
272885
 
272873
- // src/commands/connect/blockchain-node.prompt.ts
272874
- async function blockchainNodePrompt(env2, nodes, accept) {
272875
- if (nodes.length === 0) {
272886
+ // src/commands/connect/service.prompt.ts
272887
+ async function servicePrompt({
272888
+ env: env2,
272889
+ services,
272890
+ accept,
272891
+ envKey,
272892
+ defaultHandler,
272893
+ isCi = is_in_ci_default
272894
+ }) {
272895
+ if (services.length === 0) {
272876
272896
  return;
272877
272897
  }
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;
272898
+ const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
272899
+ const autoAccept = isCi || accept;
272900
+ if (autoAccept && selectedService) {
272901
+ return selectedService;
272882
272902
  }
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
272903
+ if (isCi) {
272904
+ return;
272905
+ }
272906
+ if (services.length === 1) {
272907
+ return services[0];
272908
+ }
272909
+ return defaultHandler({ defaultService: selectedService });
272910
+ }
272911
+
272912
+ // src/commands/connect/blockchain-node.prompt.ts
272913
+ async function blockchainNodePrompt(env2, nodes, accept) {
272914
+ return servicePrompt({
272915
+ env: env2,
272916
+ services: nodes,
272917
+ accept,
272918
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
272919
+ defaultHandler: async ({ defaultService: defaultNode }) => {
272920
+ return esm_default2({
272921
+ message: "Which blockchain node do you want to connect to?",
272922
+ choices: [
272923
+ ...nodes.map((node) => ({
272924
+ name: node.name,
272925
+ value: node
272926
+ })),
272927
+ {
272928
+ name: "None",
272929
+ value: undefined
272930
+ }
272931
+ ],
272932
+ default: defaultNode
272933
+ });
272934
+ }
272896
272935
  });
272897
- return node;
272898
272936
  }
272899
272937
 
272900
272938
  // src/commands/connect/blockscout.prompt.ts
272901
272939
  async function blockscoutPrompt(env2, insights, accept) {
272902
272940
  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
272941
+ return servicePrompt({
272942
+ env: env2,
272943
+ services: possible,
272944
+ accept,
272945
+ envKey: "SETTLEMINT_BLOCKSCOUT",
272946
+ defaultHandler: async ({ defaultService: defaultBlockscout }) => {
272947
+ return esm_default2({
272948
+ message: "Which blockscout instance do you want to connect to?",
272949
+ choices: [
272950
+ ...possible.map((insight) => ({
272951
+ name: insight.name,
272952
+ value: insight
272953
+ })),
272954
+ {
272955
+ name: "None",
272956
+ value: undefined
272957
+ }
272958
+ ],
272959
+ default: defaultBlockscout
272960
+ });
272961
+ }
272924
272962
  });
272925
- return blockscout;
272926
272963
  }
272927
272964
 
272928
272965
  // src/commands/connect/custom-deployment.prompt.ts
272929
272966
  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
272967
+ return servicePrompt({
272968
+ env: env2,
272969
+ services: customDeployments,
272970
+ accept,
272971
+ envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
272972
+ defaultHandler: async ({
272973
+ defaultService: defaultCustomDeployment
272974
+ }) => {
272975
+ return esm_default2({
272976
+ message: "Which Custom Deployment do you want to connect to?",
272977
+ choices: [
272978
+ ...customDeployments.map((customDeployment) => ({
272979
+ name: customDeployment.name,
272980
+ value: customDeployment
272981
+ })),
272982
+ {
272983
+ name: "None",
272984
+ value: undefined
272985
+ }
272986
+ ],
272987
+ default: defaultCustomDeployment
272988
+ });
272989
+ }
272951
272990
  });
272952
- return middleware;
272953
272991
  }
272954
272992
 
272955
272993
  // src/commands/connect/hasura.prompt.ts
272956
272994
  async function hasuraPrompt(env2, integrations, accept) {
272957
272995
  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
272996
+ return servicePrompt({
272997
+ env: env2,
272998
+ services: possible,
272999
+ accept,
273000
+ envKey: "SETTLEMINT_HASURA",
273001
+ defaultHandler: async ({ defaultService: defaultHasura }) => {
273002
+ return esm_default2({
273003
+ message: "Which Hasura instance do you want to connect to?",
273004
+ choices: [
273005
+ ...possible.map((integration) => ({
273006
+ name: integration.name,
273007
+ value: integration
273008
+ })),
273009
+ {
273010
+ name: "None",
273011
+ value: undefined
273012
+ }
273013
+ ],
273014
+ default: defaultHasura
273015
+ });
273016
+ }
272979
273017
  });
272980
- return hasura;
272981
273018
  }
272982
273019
 
272983
273020
  // src/commands/connect/hd-private-keys.prompt.ts
272984
273021
  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
273022
+ const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
273023
+ return servicePrompt({
273024
+ env: env2,
273025
+ services: possible,
273026
+ accept,
273027
+ envKey: "SETTLEMINT_HD_PRIVATE_KEY",
273028
+ defaultHandler: async ({ defaultService: defaultPrivateKey }) => {
273029
+ return esm_default2({
273030
+ message: "Which HD Private Key do you want to use?",
273031
+ choices: [
273032
+ ...possible.map((privateKey) => ({
273033
+ name: privateKey.name,
273034
+ value: privateKey
273035
+ })),
273036
+ {
273037
+ name: "None",
273038
+ value: undefined
273039
+ }
273040
+ ],
273041
+ default: defaultPrivateKey
273042
+ });
273043
+ }
273007
273044
  });
273008
- return privateKey;
273009
273045
  }
273010
273046
 
273011
273047
  // src/commands/connect/instance.prompt.ts
273012
273048
  async function instancePrompt(env2, accept) {
273049
+ const autoAccept = !!accept || is_in_ci_default;
273013
273050
  const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
273014
273051
  const defaultPossible = accept && defaultInstance;
273015
273052
  if (defaultPossible) {
@@ -273034,85 +273071,82 @@ async function instancePrompt(env2, accept) {
273034
273071
  // src/commands/connect/ipfs.prompt.ts
273035
273072
  async function ipfsPrompt(env2, storages, accept) {
273036
273073
  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
273074
+ return servicePrompt({
273075
+ env: env2,
273076
+ services: possible,
273077
+ accept,
273078
+ envKey: "SETTLEMINT_IPFS",
273079
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273080
+ return esm_default2({
273081
+ message: "Which IPFS instance do you want to connect to?",
273082
+ choices: [
273083
+ ...possible.map((storage) => ({
273084
+ name: storage.name,
273085
+ value: storage
273086
+ })),
273087
+ {
273088
+ name: "None",
273089
+ value: undefined
273090
+ }
273091
+ ],
273092
+ default: defaultStorage
273093
+ });
273094
+ }
273058
273095
  });
273059
- return minio;
273060
273096
  }
273061
273097
 
273062
273098
  // src/commands/connect/minio.prompt.ts
273063
273099
  async function minioPrompt(env2, storages, accept) {
273064
273100
  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
273101
+ return servicePrompt({
273102
+ env: env2,
273103
+ services: possible,
273104
+ accept,
273105
+ envKey: "SETTLEMINT_MINIO",
273106
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273107
+ return esm_default2({
273108
+ message: "Which MinIO instance do you want to connect to?",
273109
+ choices: [
273110
+ ...possible.map((storage) => ({
273111
+ name: storage.name,
273112
+ value: storage
273113
+ })),
273114
+ {
273115
+ name: "None",
273116
+ value: undefined
273117
+ }
273118
+ ],
273119
+ default: defaultStorage
273120
+ });
273121
+ }
273086
273122
  });
273087
- return minio;
273088
273123
  }
273089
273124
 
273090
273125
  // src/commands/connect/portal.prompt.ts
273091
273126
  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
273127
+ const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
273128
+ return servicePrompt({
273129
+ env: env2,
273130
+ services: possible,
273131
+ accept,
273132
+ envKey: "SETTLEMINT_PORTAL",
273133
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273134
+ return esm_default2({
273135
+ message: "Which Smart Contract Portal instance do you want to connect to?",
273136
+ choices: [
273137
+ ...possible.map((middleware) => ({
273138
+ name: middleware.name,
273139
+ value: middleware
273140
+ })),
273141
+ {
273142
+ name: "None",
273143
+ value: undefined
273144
+ }
273145
+ ],
273146
+ default: defaultMiddleware
273147
+ });
273148
+ }
273114
273149
  });
273115
- return middleware;
273116
273150
  }
273117
273151
 
273118
273152
  // src/commands/connect/services.spinner.ts
@@ -273156,42 +273190,45 @@ async function servicesSpinner(settlemint, application) {
273156
273190
 
273157
273191
  // src/commands/connect/thegraph.prompt.ts
273158
273192
  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
273193
+ const possible = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
273194
+ return servicePrompt({
273195
+ env: env2,
273196
+ services: possible,
273197
+ accept,
273198
+ envKey: "SETTLEMINT_THEGRAPH",
273199
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273200
+ return esm_default2({
273201
+ message: "Which The Graph instance do you want to connect to?",
273202
+ choices: [
273203
+ ...possible.map((middleware) => ({
273204
+ name: middleware.name,
273205
+ value: middleware
273206
+ })),
273207
+ {
273208
+ name: "None",
273209
+ value: undefined
273210
+ }
273211
+ ],
273212
+ default: defaultMiddleware
273213
+ });
273214
+ }
273181
273215
  });
273182
- return middleware;
273183
273216
  }
273184
273217
 
273185
273218
  // src/commands/connect/workspace.prompt.ts
273186
273219
  async function workspacePrompt(env2, workspaces, accept) {
273220
+ const autoAccept = !!accept || is_in_ci_default;
273187
273221
  const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
273188
- const defaultPossible = accept && defaultWorkspace;
273222
+ const defaultPossible = autoAccept && defaultWorkspace;
273189
273223
  if (defaultPossible) {
273190
273224
  return defaultWorkspace;
273191
273225
  }
273192
273226
  if (workspaces.length === 0) {
273193
273227
  cancel2("No workspaces found");
273194
273228
  }
273229
+ if (is_in_ci_default) {
273230
+ nothingSelectedError("workspace");
273231
+ }
273195
273232
  const workspace = await esm_default2({
273196
273233
  message: "Which workspace do you want to connect to?",
273197
273234
  choices: workspaces.map((workspace2) => ({
@@ -273210,9 +273247,8 @@ async function workspacePrompt(env2, workspaces, accept) {
273210
273247
  function connectCommand() {
273211
273248
  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 }) => {
273212
273249
  intro("Connecting your dApp to SettleMint");
273213
- const autoAccept = !!acceptDefaults || is_in_ci_default;
273214
273250
  const env2 = await loadEnv2(false, !!prod);
273215
- const instance = await instancePrompt(env2, autoAccept);
273251
+ const instance = await instancePrompt(env2, acceptDefaults);
273216
273252
  const personalAccessToken = await getInstanceCredentials(instance);
273217
273253
  if (!personalAccessToken) {
273218
273254
  return missingPersonalAccessTokenError();
@@ -273223,20 +273259,20 @@ function connectCommand() {
273223
273259
  instance
273224
273260
  });
273225
273261
  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);
273262
+ const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
273263
+ const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
273264
+ const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
273229
273265
  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) {
273266
+ const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
273267
+ const hasura = await hasuraPrompt(env2, integrationTool, acceptDefaults);
273268
+ const thegraph = await theGraphPrompt(env2, middleware, acceptDefaults);
273269
+ const portal = await portalPrompt(env2, middleware, acceptDefaults);
273270
+ const ipfs = await ipfsPrompt(env2, storage, acceptDefaults);
273271
+ const minio = await minioPrompt(env2, storage, acceptDefaults);
273272
+ const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, acceptDefaults);
273273
+ const cDeployment = await customDeploymentPrompt(env2, customDeployment, acceptDefaults);
273274
+ const blockscout = await blockscoutPrompt(env2, insights, acceptDefaults);
273275
+ if (acceptDefaults) {
273240
273276
  const selectedServices = [
273241
273277
  `Workspace: ${workspace.name}`,
273242
273278
  `Application: ${application.name}`,
@@ -274103,7 +274139,7 @@ function createCommand2() {
274103
274139
  }
274104
274140
  const selectedTemplate = await templatePrompt(templates, template);
274105
274141
  if (!selectedTemplate) {
274106
- cancel("No template selected. Please select a template to continue.");
274142
+ return nothingSelectedError("template");
274107
274143
  }
274108
274144
  await spinner({
274109
274145
  startMessage: "Scaffolding the project",
@@ -274435,11 +274471,11 @@ function getCreateCommand({
274435
274471
  if (requiresDeployment) {
274436
274472
  const selectedProvider = await providerPrompt(platformConfig, provider);
274437
274473
  if (!selectedProvider) {
274438
- cancel("No provider selected. Please select a provider to continue.");
274474
+ return nothingSelectedError("provider");
274439
274475
  }
274440
274476
  const selectedRegion = await regionPrompt(selectedProvider, region);
274441
274477
  if (!selectedRegion) {
274442
- cancel("No region selected. Please select a region to continue.");
274478
+ return nothingSelectedError("region");
274443
274479
  }
274444
274480
  }
274445
274481
  const { result, waitFor, mapDefaultEnv } = await spinner({
@@ -274515,6 +274551,9 @@ function blockchainNetworkBesuCreateCommand() {
274515
274551
  region
274516
274552
  }, async (settlemint, env2) => {
274517
274553
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274554
+ if (!applicationUniqueName) {
274555
+ return missingApplication();
274556
+ }
274518
274557
  const result = await settlemint.blockchainNetwork.create({
274519
274558
  name: name2,
274520
274559
  applicationUniqueName,
@@ -274722,6 +274761,9 @@ function applicationAccessTokenCreateCommand() {
274722
274761
  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
274762
  return baseAction(defaultArgs, async (settlemint, env2) => {
274724
274763
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274764
+ if (!applicationUniqueName) {
274765
+ return missingApplication();
274766
+ }
274725
274767
  const aatToken = await settlemint.applicationAccessToken.create({
274726
274768
  applicationUniqueName,
274727
274769
  name: name2,
@@ -274774,6 +274816,7 @@ function applicationAccessTokenCreateCommand() {
274774
274816
  uniqueName: ""
274775
274817
  },
274776
274818
  mapDefaultEnv: () => ({
274819
+ SETTLEMINT_APPLICATION: applicationUniqueName,
274777
274820
  SETTLEMINT_ACCESS_TOKEN: aatToken
274778
274821
  })
274779
274822
  };
@@ -274805,11 +274848,23 @@ function applicationCreateCommand() {
274805
274848
  type: "application",
274806
274849
  alias: "a",
274807
274850
  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) => {
274851
+ 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 }) => {
274852
+ return baseAction({
274853
+ ...defaultArgs,
274854
+ acceptDefaults
274855
+ }, async (settlemint, env2) => {
274856
+ let workspaceUniqueName = workspace;
274857
+ if (!workspaceUniqueName) {
274858
+ const workspaces = await settlemint.workspace.list();
274859
+ const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
274860
+ if (!workspace2) {
274861
+ return nothingSelectedError("workspace");
274862
+ }
274863
+ workspaceUniqueName = workspace2.uniqueName;
274864
+ }
274810
274865
  const result = await settlemint.application.create({
274811
274866
  name: name2,
274812
- workspaceUniqueName: workspace ?? env2.SETTLEMINT_WORKSPACE
274867
+ workspaceUniqueName
274813
274868
  });
274814
274869
  return {
274815
274870
  result,
@@ -274842,27 +274897,27 @@ function applicationCreateCommand() {
274842
274897
 
274843
274898
  // src/commands/connect/blockchain-network.prompt.ts
274844
274899
  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
274900
+ return servicePrompt({
274901
+ env: env2,
274902
+ services: networks,
274903
+ accept,
274904
+ envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
274905
+ defaultHandler: async ({ defaultService: defaultNetwork }) => {
274906
+ return esm_default2({
274907
+ message: "Which blockchain network do you want to connect to?",
274908
+ choices: [
274909
+ ...networks.map((network) => ({
274910
+ name: network.name,
274911
+ value: network
274912
+ })),
274913
+ {
274914
+ name: "None",
274915
+ value: undefined
274916
+ }
274917
+ ],
274918
+ default: defaultNetwork
274919
+ });
274920
+ }
274866
274921
  });
274867
274922
  }
274868
274923
 
@@ -274891,17 +274946,16 @@ function blockchainNodeBesuCreateCommand() {
274891
274946
  provider,
274892
274947
  region
274893
274948
  }, async (settlemint, env2) => {
274894
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274895
274949
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274896
274950
  if (!applicationUniqueName) {
274897
- cancel("No application found. Please specify an application or run `settlemint connect` to continue.");
274951
+ return missingApplication();
274898
274952
  }
274899
- let networkUniqueName = blockchainNetwork ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NETWORK : undefined);
274953
+ let networkUniqueName = blockchainNetwork;
274900
274954
  if (!networkUniqueName) {
274901
274955
  const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
274902
- const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults ?? false);
274956
+ const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
274903
274957
  if (!network) {
274904
- cancel("No network found. Please specify a network to continue.");
274958
+ return nothingSelectedError("blockchain network");
274905
274959
  }
274906
274960
  networkUniqueName = network?.id;
274907
274961
  }
@@ -274957,15 +275011,27 @@ function blockscoutInsightsCreateCommand() {
274957
275011
  type: "insights",
274958
275012
  alias: "bs",
274959
275013
  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 }) => {
275014
+ 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
275015
  return baseAction({
274962
275016
  ...defaultArgs,
275017
+ acceptDefaults,
274963
275018
  provider,
274964
275019
  region
274965
275020
  }, async (settlemint, env2) => {
274966
275021
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274967
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275022
+ if (!applicationUniqueName) {
275023
+ return missingApplication();
275024
+ }
275025
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
274968
275026
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275027
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275028
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275029
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275030
+ if (!node) {
275031
+ return nothingSelectedError("blockchain node");
275032
+ }
275033
+ blockchainNodeUniqueName = node.uniqueName;
275034
+ }
274969
275035
  const result = await settlemint.insights.create({
274970
275036
  name: name2,
274971
275037
  applicationUniqueName,
@@ -275024,6 +275090,9 @@ function hasuraIntegrationCreateCommand() {
275024
275090
  region
275025
275091
  }, async (settlemint, env2) => {
275026
275092
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275093
+ if (!applicationUniqueName) {
275094
+ return missingApplication();
275095
+ }
275027
275096
  const result = await settlemint.integrationTool.create({
275028
275097
  name: name2,
275029
275098
  applicationUniqueName,
@@ -275073,14 +275142,26 @@ function graphMiddlewareCreateCommand() {
275073
275142
  type: "middleware",
275074
275143
  alias: "gr",
275075
275144
  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 }) => {
275145
+ 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
275146
  return baseAction({
275078
275147
  ...defaultArgs,
275148
+ acceptDefaults,
275079
275149
  provider,
275080
275150
  region
275081
275151
  }, async (settlemint, env2) => {
275082
275152
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275083
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275153
+ if (!applicationUniqueName) {
275154
+ return missingApplication();
275155
+ }
275156
+ let blockchainNodeUniqueName = blockchainNode;
275157
+ if (!blockchainNodeUniqueName) {
275158
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275159
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275160
+ if (!node) {
275161
+ return nothingSelectedError("blockchain node");
275162
+ }
275163
+ blockchainNodeUniqueName = node.uniqueName;
275164
+ }
275084
275165
  const result = await settlemint.middleware.create({
275085
275166
  name: name2,
275086
275167
  applicationUniqueName,
@@ -275136,16 +275217,29 @@ function smartContractPortalMiddlewareCreateCommand() {
275136
275217
  type: type4,
275137
275218
  includePredeployedAbis,
275138
275219
  abis,
275220
+ acceptDefaults,
275139
275221
  ...defaultArgs
275140
275222
  }) => {
275141
275223
  return baseAction({
275142
275224
  ...defaultArgs,
275225
+ acceptDefaults,
275143
275226
  provider,
275144
275227
  region
275145
275228
  }, async (settlemint, env2) => {
275146
275229
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275147
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275230
+ if (!applicationUniqueName) {
275231
+ return missingApplication();
275232
+ }
275233
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275148
275234
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275235
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275236
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275237
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275238
+ if (!node) {
275239
+ return nothingSelectedError("blockchain node");
275240
+ }
275241
+ blockchainNodeUniqueName = node.uniqueName;
275242
+ }
275149
275243
  const parsedAbis = [];
275150
275244
  if (abis && abis.length > 0) {
275151
275245
  try {
@@ -275218,14 +275312,26 @@ function privateKeyHdCreateCommand() {
275218
275312
  type: "private key",
275219
275313
  alias: "hd",
275220
275314
  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 }) => {
275315
+ 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
275316
  return baseAction({
275223
275317
  ...defaultArgs,
275318
+ acceptDefaults,
275224
275319
  provider,
275225
275320
  region
275226
275321
  }, async (settlemint, env2) => {
275227
275322
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275228
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275323
+ if (!applicationUniqueName) {
275324
+ return missingApplication();
275325
+ }
275326
+ let blockchainNodeUniqueName = blockchainNode;
275327
+ if (!blockchainNodeUniqueName) {
275328
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275329
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275330
+ if (!node) {
275331
+ return nothingSelectedError("blockchain node");
275332
+ }
275333
+ blockchainNodeUniqueName = node.uniqueName;
275334
+ }
275229
275335
  const result = await settlemint.privateKey.create({
275230
275336
  name: name2,
275231
275337
  applicationUniqueName,
@@ -275272,14 +275378,26 @@ function privateKeyHsmCreateCommand() {
275272
275378
  type: "private key",
275273
275379
  alias: "hd",
275274
275380
  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 }) => {
275381
+ 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
275382
  return baseAction({
275277
275383
  ...defaultArgs,
275384
+ acceptDefaults,
275278
275385
  provider,
275279
275386
  region
275280
275387
  }, async (settlemint, env2) => {
275281
275388
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275282
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275389
+ if (!applicationUniqueName) {
275390
+ return missingApplication();
275391
+ }
275392
+ let blockchainNodeUniqueName = blockchainNode;
275393
+ if (!blockchainNodeUniqueName) {
275394
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275395
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275396
+ if (!node) {
275397
+ return nothingSelectedError("blockchain node");
275398
+ }
275399
+ blockchainNodeUniqueName = node.uniqueName;
275400
+ }
275283
275401
  const result = await settlemint.privateKey.create({
275284
275402
  name: name2,
275285
275403
  applicationUniqueName,
@@ -275332,6 +275450,9 @@ function ipfsStorageCreateCommand() {
275332
275450
  region
275333
275451
  }, async (settlemint, env2) => {
275334
275452
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275453
+ if (!applicationUniqueName) {
275454
+ return missingApplication();
275455
+ }
275335
275456
  const result = await settlemint.storage.create({
275336
275457
  name: name2,
275337
275458
  applicationUniqueName,
@@ -275381,6 +275502,9 @@ function minioStorageCreateCommand() {
275381
275502
  region
275382
275503
  }, async (settlemint, env2) => {
275383
275504
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275505
+ if (!applicationUniqueName) {
275506
+ return missingApplication();
275507
+ }
275384
275508
  const result = await settlemint.storage.create({
275385
275509
  name: name2,
275386
275510
  applicationUniqueName,
@@ -275474,9 +275598,8 @@ function getDeleteCommand({
275474
275598
  if (!force) {
275475
275599
  await deleteConfirmationPrompt(`this ${type4}`);
275476
275600
  }
275477
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275478
275601
  const env2 = await loadEnv2(false, !!prod);
275479
- const instance = await instancePrompt(env2, autoAccept);
275602
+ const instance = await instancePrompt(env2, acceptDefaults);
275480
275603
  const accessToken = await getApplicationOrPersonalAccessToken({
275481
275604
  env: env2,
275482
275605
  instance,
@@ -275569,9 +275692,8 @@ function getRestartCommand({
275569
275692
  }
275570
275693
  ])).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
275694
  intro(`Restarting ${type4} in the SettleMint platform`);
275572
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275573
275695
  const env2 = await loadEnv2(false, !!prod);
275574
- const instance = await instancePrompt(env2, autoAccept);
275696
+ const instance = await instancePrompt(env2, acceptDefaults);
275575
275697
  const accessToken = await getApplicationOrPersonalAccessToken({
275576
275698
  env: env2,
275577
275699
  instance,
@@ -275885,7 +276007,7 @@ function createCommand4() {
275885
276007
  const platformConfig = await settlemint.platform.config();
275886
276008
  const selectedUseCase = await useCasePrompt(platformConfig, useCase);
275887
276009
  if (!selectedUseCase) {
275888
- cancel("No use case selected. Please select a use case to continue.");
276010
+ return nothingSelectedError("use case");
275889
276011
  }
275890
276012
  const targetDir = formatTargetDir(name2);
275891
276013
  const projectDir = join8(process.cwd(), targetDir);
@@ -276187,6 +276309,9 @@ function hardhatDeployRemoteCommand() {
276187
276309
  const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276188
276310
  let node = undefined;
276189
276311
  if (!nodeUniqueName) {
276312
+ if (!env2.SETTLEMINT_APPLICATION) {
276313
+ return missingApplication();
276314
+ }
276190
276315
  const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276191
276316
  const evmNodes = nodes.filter((node2) => node2.isEvm);
276192
276317
  if (evmNodes.length === 0) {
@@ -276197,9 +276322,9 @@ function hardhatDeployRemoteCommand() {
276197
276322
  if (nodesWithActivePrivateKey.length === 0) {
276198
276323
  cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276199
276324
  }
276200
- const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
276325
+ const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, acceptDefaults);
276201
276326
  if (!blockchainNode) {
276202
- cancel("No EVM blockchain node selected. Please select one to continue.");
276327
+ return nothingSelectedError("EVM blockchain node");
276203
276328
  }
276204
276329
  node = blockchainNode;
276205
276330
  } else {
@@ -276215,7 +276340,7 @@ function hardhatDeployRemoteCommand() {
276215
276340
  }
276216
276341
  const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
276217
276342
  if (!address) {
276218
- cancel("No private key selected. Please select one to continue.");
276343
+ return nothingSelectedError("private key");
276219
276344
  }
276220
276345
  const { command, args } = await getPackageManagerExecutable();
276221
276346
  await executeCommand(command, [
@@ -276299,14 +276424,31 @@ function hardhatScriptRemoteCommand() {
276299
276424
  accessToken,
276300
276425
  instance
276301
276426
  });
276302
- let nodeUniqueName = blockchainNodeUniqueName;
276427
+ let nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276303
276428
  if (!nodeUniqueName) {
276304
- const blockchainNodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276305
- const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
276429
+ if (!env2.SETTLEMINT_APPLICATION) {
276430
+ return missingApplication();
276431
+ }
276432
+ const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276433
+ const evmNodes = nodes.filter((node) => node.isEvm);
276434
+ if (evmNodes.length === 0) {
276435
+ cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
276436
+ }
276437
+ const nodesWithPrivateKey = await Promise.all(nodes.map((node) => settlemint.blockchainNode.read(node.uniqueName)));
276438
+ const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node) => node.privateKeys && node.privateKeys.length > 0);
276439
+ if (nodesWithActivePrivateKey.length === 0) {
276440
+ cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276441
+ }
276442
+ const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, acceptDefaults);
276306
276443
  if (!blockchainNode) {
276307
- cancel("No Blockchain Node selected. Please select one to continue.");
276444
+ return nothingSelectedError("EVM blockchain node");
276308
276445
  }
276309
276446
  nodeUniqueName = blockchainNode.uniqueName;
276447
+ } else {
276448
+ const node = await settlemint.blockchainNode.read(nodeUniqueName);
276449
+ if (!node.isEvm) {
276450
+ cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
276451
+ }
276310
276452
  }
276311
276453
  const envConfig = await settlemint.foundry.env(nodeUniqueName);
276312
276454
  const { command, args } = await getPackageManagerExecutable();
@@ -276525,6 +276667,9 @@ async function getTheGraphMiddleware({
276525
276667
  return defaultTheGraphMiddleware;
276526
276668
  }
276527
276669
  }
276670
+ if (!env2.SETTLEMINT_APPLICATION) {
276671
+ return missingApplication();
276672
+ }
276528
276673
  const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
276529
276674
  return theGraphPrompt(env2, middlewares, autoAccept);
276530
276675
  }
@@ -276634,7 +276779,7 @@ function subgraphDeployCommand() {
276634
276779
  });
276635
276780
  const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
276636
276781
  if (!theGraphMiddleware) {
276637
- cancel("No Graph Middleware selected. Please select one to continue.");
276782
+ return nothingSelectedError("graph middleware");
276638
276783
  }
276639
276784
  const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
276640
276785
  await subgraphSetup({
@@ -276737,4 +276882,4 @@ function sdkCliCommand(exitOverride = undefined) {
276737
276882
  ascii();
276738
276883
  sdkCliCommand();
276739
276884
 
276740
- //# debugId=C85F1DF1902E5ECA64756E2164756E21
276885
+ //# debugId=2D07E6EF3B7E100764756E2164756E21