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

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 +559 -350
  2. package/dist/cli.js.map +51 -46
  3. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -19613,7 +19613,7 @@ var require_lib4 = __commonJS((exports, module) => {
19613
19613
  var rRel = new RegExp(`^\\.${rSlash.source}`);
19614
19614
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
19615
19615
  var getPathInfo = (cmd, {
19616
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19616
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.BFdQefgFym:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19617
19617
  pathExt: optPathExt = process.env.PATHEXT,
19618
19618
  delimiter: optDelimiter = delimiter
19619
19619
  }) => {
@@ -19817,7 +19817,7 @@ var require_lib5 = __commonJS((exports, module) => {
19817
19817
  let pathToInitial;
19818
19818
  try {
19819
19819
  pathToInitial = which.sync(initialCmd, {
19820
- path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19820
+ path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.BFdQefgFym:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19821
19821
  pathext: options.env && findInObject(options.env, "PATHEXT") || process.env.PATHEXT
19822
19822
  }).toLowerCase();
19823
19823
  } catch (err) {
@@ -20534,7 +20534,7 @@ var require_lib6 = __commonJS((exports, module) => {
20534
20534
  var rRel = new RegExp(`^\\.${rSlash.source}`);
20535
20535
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
20536
20536
  var getPathInfo = (cmd, {
20537
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
20537
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.BFdQefgFym:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
20538
20538
  pathExt: optPathExt = process.env.PATHEXT,
20539
20539
  delimiter: optDelimiter = delimiter
20540
20540
  }) => {
@@ -223327,7 +223327,7 @@ ${Bt.cyan(Yt)}
223327
223327
  code: "ENOENT"
223328
223328
  }), getPathInfo = (e9, t7) => {
223329
223329
  var r6 = t7.colon || or;
223330
- var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
223330
+ var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.BFdQefgFym:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
223331
223331
  var n6 = nr ? t7.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
223332
223332
  var a5 = nr ? n6.split(r6) : [""];
223333
223333
  if (nr) {
@@ -226464,7 +226464,7 @@ ${whileRunning(e9)}`;
226464
226464
  };
226465
226465
  ni = Object.assign(async function _main() {
226466
226466
  var e9 = new Cli({
226467
- binaryVersion: "0.9.3-main60569eea",
226467
+ binaryVersion: "0.9.3-mainaf7d49d5",
226468
226468
  binaryLabel: "gql.tada CLI",
226469
226469
  binaryName: "gql.tada"
226470
226470
  });
@@ -234964,7 +234964,7 @@ var require_which2 = __commonJS((exports, module) => {
234964
234964
  const colon = opt2.colon || COLON;
234965
234965
  const pathEnv = cmd2.match(/\//) || isWindows2 && cmd2.match(/\\/) ? [""] : [
234966
234966
  ...isWindows2 ? [process.cwd()] : [],
234967
- ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Ks5097XiXd:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234967
+ ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.BFdQefgFym:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234968
234968
  ];
234969
234969
  const pathExtExe = isWindows2 ? opt2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
234970
234970
  const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
@@ -256788,7 +256788,7 @@ ${error.stack}`));
256788
256788
  var package_default = {
256789
256789
  name: "@settlemint/sdk-cli",
256790
256790
  description: "SettleMint SDK, integrate SettleMint into your application with ease.",
256791
- version: "0.9.3-main60569eea",
256791
+ version: "0.9.3-mainaf7d49d5",
256792
256792
  type: "module",
256793
256793
  private: false,
256794
256794
  license: "FSL-1.1-MIT",
@@ -256841,8 +256841,8 @@ var package_default = {
256841
256841
  "@inquirer/input": "4.1.1",
256842
256842
  "@inquirer/password": "4.0.4",
256843
256843
  "@inquirer/select": "4.0.4",
256844
- "@settlemint/sdk-js": "0.9.3-main60569eea",
256845
- "@settlemint/sdk-utils": "0.9.3-main60569eea",
256844
+ "@settlemint/sdk-js": "0.9.3-mainaf7d49d5",
256845
+ "@settlemint/sdk-utils": "0.9.3-mainaf7d49d5",
256846
256846
  "get-tsconfig": "4.8.1",
256847
256847
  giget: "1.2.3"
256848
256848
  },
@@ -257143,6 +257143,9 @@ function missingAccessTokenError(personalAccessTokenExists) {
257143
257143
  function missingPersonalAccessTokenError() {
257144
257144
  return cancel("No personal access token found for instance, please run `settlemint login` to login to your instance");
257145
257145
  }
257146
+ function missingApplication() {
257147
+ return cancel("No application configured, please run `settlemint connect` to connect to your application");
257148
+ }
257146
257149
 
257147
257150
  // src/utils/config.ts
257148
257151
  import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
@@ -267903,7 +267906,13 @@ export const { client: theGraphClient${nameSuffix}, graphql: theGraphGraphql${na
267903
267906
  import { writeFile as writeFile4 } from "node:fs/promises";
267904
267907
 
267905
267908
  // src/commands/codegen/test-gql-endpoint.ts
267906
- async function testGqlEndpoint(accessToken, hasuraAdminSecret, gqlEndpoint, isHasura = false, maxRetries = 3) {
267909
+ async function testGqlEndpoint({
267910
+ accessToken,
267911
+ hasuraAdminSecret,
267912
+ gqlEndpoint,
267913
+ isHasura = false,
267914
+ maxRetries = 3
267915
+ }) {
267907
267916
  if (!gqlEndpoint) {
267908
267917
  return false;
267909
267918
  }
@@ -268845,12 +268854,29 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
268845
268854
  const name2 = gqlEndpoint.split("/").pop();
268846
268855
  return name2 && (!thegraphSubgraphNames || thegraphSubgraphNames.includes(name2));
268847
268856
  });
268848
- const [hasura, portal, thegraph, blockscout] = await Promise.all([
268849
- testGqlEndpoint(accessToken, env2.SETTLEMINT_HASURA_ADMIN_SECRET, env2.SETTLEMINT_HASURA_ENDPOINT, true),
268850
- testGqlEndpoint(accessToken, undefined, env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT),
268851
- testGqlEndpoint(accessToken, undefined, theGraphEndpoints[0]),
268852
- testGqlEndpoint(accessToken, undefined, env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT)
268857
+ const [hasura, portal, blockscout] = await Promise.all([
268858
+ testGqlEndpoint({
268859
+ accessToken,
268860
+ hasuraAdminSecret: env2.SETTLEMINT_HASURA_ADMIN_SECRET,
268861
+ gqlEndpoint: env2.SETTLEMINT_HASURA_ENDPOINT,
268862
+ isHasura: true
268863
+ }),
268864
+ testGqlEndpoint({
268865
+ accessToken,
268866
+ gqlEndpoint: env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT
268867
+ }),
268868
+ testGqlEndpoint({
268869
+ accessToken,
268870
+ gqlEndpoint: env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT
268871
+ })
268853
268872
  ]);
268873
+ const thegraph = await Promise.all(theGraphEndpoints.map((endpoint) => {
268874
+ const success = testGqlEndpoint({
268875
+ accessToken,
268876
+ gqlEndpoint: endpoint
268877
+ });
268878
+ return { success, endpoint };
268879
+ }));
268854
268880
  if (!tsconfig.config.compilerOptions) {
268855
268881
  tsconfig.config.compilerOptions = {};
268856
268882
  }
@@ -268869,7 +268895,7 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
268869
268895
  tadaTurboLocation: "hasura-cache.d.ts"
268870
268896
  }
268871
268897
  ] : [],
268872
- ...thegraph ? theGraphEndpoints.map((endpoint) => {
268898
+ ...thegraph ? thegraph.filter((endpoint) => endpoint.success).map(({ endpoint }) => {
268873
268899
  const name2 = endpoint.split("/").pop();
268874
268900
  return {
268875
268901
  name: `thegraph-${name2}`,
@@ -270508,7 +270534,7 @@ async function getGraphEndpoint(service, env2) {
270508
270534
  const isStarterKit = (id) => id.endsWith("-starterkits");
270509
270535
  const testEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => !isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
270510
270536
  const starterKitEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
270511
- const hasEndpoint = testEndpoint && env2.SETTLEMINT_ACCESS_TOKEN ? await testGqlEndpoint(env2.SETTLEMINT_ACCESS_TOKEN, undefined, testEndpoint) : false;
270537
+ const hasEndpoint = testEndpoint && env2.SETTLEMINT_ACCESS_TOKEN ? await testGqlEndpoint({ accessToken: env2.SETTLEMINT_ACCESS_TOKEN, gqlEndpoint: testEndpoint }) : false;
270512
270538
  const endpoints = hasEndpoint ? service.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue) : starterKitEndpoint ? [starterKitEndpoint] : [];
270513
270539
  if (endpoints.length === 0) {
270514
270540
  return {};
@@ -270567,6 +270593,17 @@ function getMinioEndpoints(service) {
270567
270593
  };
270568
270594
  }
270569
270595
 
270596
+ // src/utils/instance-url-utils.ts
270597
+ function sanitizeInstanceUrl(url) {
270598
+ const instanceUrl = new URL(url);
270599
+ return instanceUrl.origin;
270600
+ }
270601
+ function sanitizeAndValidateInstanceUrl(url) {
270602
+ const sanitizedUrl = sanitizeInstanceUrl(url);
270603
+ validate(UrlSchema, sanitizedUrl);
270604
+ return sanitizedUrl;
270605
+ }
270606
+
270570
270607
  // ../utils/dist/runtime.mjs
270571
270608
  function ensureServer() {
270572
270609
  if (isBrowser) {
@@ -272756,8 +272793,9 @@ var esm_default5 = createPrompt((config4, done) => {
272756
272793
 
272757
272794
  // src/commands/connect/aat.prompt.ts
272758
272795
  async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
272796
+ const autoAccept = !!accept || is_in_ci_default;
272759
272797
  const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
272760
- const defaultPossible = accept && defaultAccessToken;
272798
+ const defaultPossible = autoAccept && defaultAccessToken;
272761
272799
  if (defaultPossible || is_in_ci_default) {
272762
272800
  return defaultAccessToken;
272763
272801
  }
@@ -272852,16 +272890,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
272852
272890
  });
272853
272891
  }
272854
272892
 
272893
+ // src/error/nothing-selected-error.ts
272894
+ function nothingSelectedError(type4) {
272895
+ return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
272896
+ }
272897
+
272855
272898
  // src/commands/connect/application.prompt.ts
272856
272899
  async function applicationPrompt(env2, applications, accept) {
272900
+ const autoAccept = !!accept || is_in_ci_default;
272857
272901
  const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
272858
- const defaultPossible = accept && defaultApplication;
272902
+ const defaultPossible = autoAccept && defaultApplication;
272859
272903
  if (defaultPossible) {
272860
272904
  return defaultApplication;
272861
272905
  }
272862
272906
  if (applications.length === 0) {
272863
272907
  cancel("No applications found");
272864
272908
  }
272909
+ if (is_in_ci_default) {
272910
+ nothingSelectedError("application");
272911
+ }
272865
272912
  const application = await esm_default2({
272866
272913
  message: "Which application do you want to connect to?",
272867
272914
  choices: applications.map((applications2) => ({
@@ -272876,249 +272923,291 @@ async function applicationPrompt(env2, applications, accept) {
272876
272923
  return application;
272877
272924
  }
272878
272925
 
272879
- // src/commands/connect/blockchain-node.prompt.ts
272880
- async function blockchainNodePrompt(env2, nodes, accept) {
272881
- if (nodes.length === 0) {
272926
+ // src/commands/connect/service.prompt.ts
272927
+ async function servicePrompt({
272928
+ env: env2,
272929
+ services,
272930
+ accept,
272931
+ envKey,
272932
+ defaultHandler,
272933
+ isCi = is_in_ci_default
272934
+ }) {
272935
+ if (services.length === 0) {
272882
272936
  return;
272883
272937
  }
272884
- const defaultNode = nodes.find((node2) => node2.uniqueName === env2.SETTLEMINT_BLOCKCHAIN_NODE) ?? (nodes.length === 1 ? nodes[0] : undefined);
272885
- const defaultPossible = accept;
272886
- if (defaultPossible) {
272887
- return defaultNode;
272938
+ const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
272939
+ const autoAccept = isCi || accept;
272940
+ if (autoAccept && selectedService) {
272941
+ return selectedService;
272888
272942
  }
272889
- const node = await esm_default2({
272890
- message: "Which blockchain node do you want to connect to?",
272891
- choices: [
272892
- ...nodes.map((node2) => ({
272893
- name: node2.name,
272894
- value: node2
272895
- })),
272896
- {
272897
- name: "None",
272898
- value: undefined
272899
- }
272900
- ],
272901
- default: defaultNode
272943
+ if (isCi) {
272944
+ return;
272945
+ }
272946
+ if (services.length === 1) {
272947
+ return services[0];
272948
+ }
272949
+ return defaultHandler({ defaultService: selectedService });
272950
+ }
272951
+
272952
+ // src/commands/connect/blockchain-node.prompt.ts
272953
+ async function blockchainNodePrompt(env2, nodes, accept, filterRunningOnly = false) {
272954
+ const choices = filterRunningOnly ? nodes.filter((node) => node.status === "COMPLETED") : nodes;
272955
+ return servicePrompt({
272956
+ env: env2,
272957
+ services: nodes,
272958
+ accept,
272959
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
272960
+ defaultHandler: async ({ defaultService: defaultNode }) => {
272961
+ return esm_default2({
272962
+ message: "Which blockchain node do you want to connect to?",
272963
+ choices: [
272964
+ ...choices.map((node) => ({
272965
+ name: node.name,
272966
+ value: node
272967
+ })),
272968
+ {
272969
+ name: "None",
272970
+ value: undefined
272971
+ }
272972
+ ],
272973
+ default: defaultNode
272974
+ });
272975
+ }
272902
272976
  });
272903
- return node;
272904
272977
  }
272905
272978
 
272906
272979
  // src/commands/connect/blockscout.prompt.ts
272907
272980
  async function blockscoutPrompt(env2, insights, accept) {
272908
272981
  const possible = insights.filter((insight) => insight.insightsCategory === "BLOCKCHAIN_EXPLORER");
272909
- if (possible.length === 0) {
272910
- return;
272911
- }
272912
- const defaultBlockscout = insights.find((insight) => insight.uniqueName === env2.SETTLEMINT_BLOCKSCOUT) ?? (insights.length === 1 ? insights[0] : undefined);
272913
- const defaultPossible = accept;
272914
- if (defaultPossible) {
272915
- return defaultBlockscout;
272916
- }
272917
- const blockscout = await esm_default2({
272918
- message: "Which blockscout instance do you want to connect to?",
272919
- choices: [
272920
- ...insights.map((insight) => ({
272921
- name: insight.name,
272922
- value: insight
272923
- })),
272924
- {
272925
- name: "None",
272926
- value: undefined
272927
- }
272928
- ],
272929
- default: defaultBlockscout
272982
+ return servicePrompt({
272983
+ env: env2,
272984
+ services: possible,
272985
+ accept,
272986
+ envKey: "SETTLEMINT_BLOCKSCOUT",
272987
+ defaultHandler: async ({ defaultService: defaultBlockscout }) => {
272988
+ return esm_default2({
272989
+ message: "Which blockscout instance do you want to connect to?",
272990
+ choices: [
272991
+ ...possible.map((insight) => ({
272992
+ name: insight.name,
272993
+ value: insight
272994
+ })),
272995
+ {
272996
+ name: "None",
272997
+ value: undefined
272998
+ }
272999
+ ],
273000
+ default: defaultBlockscout
273001
+ });
273002
+ }
272930
273003
  });
272931
- return blockscout;
272932
273004
  }
272933
273005
 
272934
273006
  // src/commands/connect/custom-deployment.prompt.ts
272935
273007
  async function customDeploymentPrompt(env2, customDeployments, accept) {
272936
- if (customDeployments.length === 0) {
272937
- return;
272938
- }
272939
- const defaultCustomDeployment = customDeployments.find((customDeployment) => customDeployment.uniqueName === env2.SETTLEMINT_CUSTOM_DEPLOYMENT) ?? (customDeployments.length === 1 ? customDeployments[0] : undefined);
272940
- const defaultPossible = accept;
272941
- if (defaultPossible) {
272942
- return defaultCustomDeployment;
272943
- }
272944
- const middleware = await esm_default2({
272945
- message: "Which Custom Deployment do you want to connect to?",
272946
- choices: [
272947
- ...customDeployments.map((customDeployment) => ({
272948
- name: customDeployment.name,
272949
- value: customDeployment
272950
- })),
272951
- {
272952
- name: "None",
272953
- value: undefined
272954
- }
272955
- ],
272956
- default: defaultCustomDeployment
273008
+ return servicePrompt({
273009
+ env: env2,
273010
+ services: customDeployments,
273011
+ accept,
273012
+ envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
273013
+ defaultHandler: async ({
273014
+ defaultService: defaultCustomDeployment
273015
+ }) => {
273016
+ return esm_default2({
273017
+ message: "Which Custom Deployment do you want to connect to?",
273018
+ choices: [
273019
+ ...customDeployments.map((customDeployment) => ({
273020
+ name: customDeployment.name,
273021
+ value: customDeployment
273022
+ })),
273023
+ {
273024
+ name: "None",
273025
+ value: undefined
273026
+ }
273027
+ ],
273028
+ default: defaultCustomDeployment
273029
+ });
273030
+ }
272957
273031
  });
272958
- return middleware;
272959
273032
  }
272960
273033
 
272961
273034
  // src/commands/connect/hasura.prompt.ts
272962
273035
  async function hasuraPrompt(env2, integrations, accept) {
272963
273036
  const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
272964
- if (possible.length === 0) {
272965
- return;
272966
- }
272967
- const defaultIntegration = possible.find((integration) => integration.uniqueName === env2.SETTLEMINT_HASURA) ?? (possible.length === 1 ? possible[0] : undefined);
272968
- const defaultPossible = accept;
272969
- if (defaultPossible) {
272970
- return defaultIntegration;
272971
- }
272972
- const hasura = await esm_default2({
272973
- message: "Which Hasura instance do you want to connect to?",
272974
- choices: [
272975
- ...possible.map((integration) => ({
272976
- name: integration.name,
272977
- value: integration
272978
- })),
272979
- {
272980
- name: "None",
272981
- value: undefined
272982
- }
272983
- ],
272984
- default: defaultIntegration
273037
+ return servicePrompt({
273038
+ env: env2,
273039
+ services: possible,
273040
+ accept,
273041
+ envKey: "SETTLEMINT_HASURA",
273042
+ defaultHandler: async ({ defaultService: defaultHasura }) => {
273043
+ return esm_default2({
273044
+ message: "Which Hasura instance do you want to connect to?",
273045
+ choices: [
273046
+ ...possible.map((integration) => ({
273047
+ name: integration.name,
273048
+ value: integration
273049
+ })),
273050
+ {
273051
+ name: "None",
273052
+ value: undefined
273053
+ }
273054
+ ],
273055
+ default: defaultHasura
273056
+ });
273057
+ }
272985
273058
  });
272986
- return hasura;
272987
273059
  }
272988
273060
 
272989
273061
  // src/commands/connect/hd-private-keys.prompt.ts
272990
273062
  async function hdPrivateKeyPrompt(env2, privateKeys, accept) {
272991
- const possible = privateKeys.filter((privateKey2) => privateKey2.privateKeyType === "HD_ECDSA_P256");
272992
- if (possible.length === 0) {
272993
- return;
272994
- }
272995
- const defaultPrivateKey = possible.find((privateKey2) => privateKey2.uniqueName === env2.SETTLEMINT_HD_PRIVATE_KEY) ?? (possible.length === 1 ? possible[0] : undefined);
272996
- const defaultPossible = accept;
272997
- if (defaultPossible) {
272998
- return defaultPrivateKey;
272999
- }
273000
- const privateKey = await esm_default2({
273001
- message: "Which HD Private Key do you want to use?",
273002
- choices: [
273003
- ...possible.map((privateKey2) => ({
273004
- name: privateKey2.name,
273005
- value: privateKey2
273006
- })),
273007
- {
273008
- name: "None",
273009
- value: undefined
273010
- }
273011
- ],
273012
- default: defaultPrivateKey
273063
+ const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
273064
+ return servicePrompt({
273065
+ env: env2,
273066
+ services: possible,
273067
+ accept,
273068
+ envKey: "SETTLEMINT_HD_PRIVATE_KEY",
273069
+ defaultHandler: async ({ defaultService: defaultPrivateKey }) => {
273070
+ return esm_default2({
273071
+ message: "Which HD Private Key do you want to use?",
273072
+ choices: [
273073
+ ...possible.map((privateKey) => ({
273074
+ name: privateKey.name,
273075
+ value: privateKey
273076
+ })),
273077
+ {
273078
+ name: "None",
273079
+ value: undefined
273080
+ }
273081
+ ],
273082
+ default: defaultPrivateKey
273083
+ });
273084
+ }
273013
273085
  });
273014
- return privateKey;
273015
273086
  }
273016
273087
 
273017
273088
  // src/commands/connect/instance.prompt.ts
273018
- async function instancePrompt(env2, accept) {
273019
- const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
273020
- const defaultPossible = accept && defaultInstance;
273089
+ async function instancePrompt(env2, accept, freeTextInput = false) {
273090
+ const knownInstances = await getInstances();
273091
+ const autoAccept = !!accept || is_in_ci_default;
273092
+ const defaultInstance = env2.SETTLEMINT_INSTANCE ?? knownInstances[0] ?? "https://console.settlemint.com";
273093
+ const defaultPossible = autoAccept && defaultInstance;
273021
273094
  if (defaultPossible) {
273022
273095
  return defaultInstance;
273023
273096
  }
273024
- return esm_default4({
273025
- message: "What is the URL of your SettleMint instance?",
273026
- default: defaultInstance,
273027
- required: true,
273028
- validate(value4) {
273029
- try {
273030
- validate3(UrlSchema3, value4);
273031
- return true;
273032
- } catch (error5) {
273033
- return "Invalid URL";
273034
- }
273035
- },
273036
- transformer: (value4) => value4.trim()
273097
+ if (freeTextInput) {
273098
+ const instance = await esm_default4({
273099
+ message: "What is the URL of your SettleMint instance?",
273100
+ default: defaultInstance,
273101
+ required: true,
273102
+ validate(value4) {
273103
+ try {
273104
+ validate3(UrlSchema3, value4);
273105
+ return true;
273106
+ } catch (error5) {
273107
+ return "Invalid URL";
273108
+ }
273109
+ },
273110
+ transformer: (value4) => value4.trim()
273111
+ });
273112
+ return sanitizeInstanceUrl(instance);
273113
+ }
273114
+ if (knownInstances.length === 0) {
273115
+ cancel2("No instances found. Please run `settlemint login` to configure an instance.");
273116
+ }
273117
+ if (knownInstances.length === 1) {
273118
+ return knownInstances[0];
273119
+ }
273120
+ return esm_default2({
273121
+ message: "What SettleMint instance do you want to connect to?",
273122
+ choices: [
273123
+ ...knownInstances.map((instance) => ({
273124
+ name: instance,
273125
+ value: instance
273126
+ }))
273127
+ ],
273128
+ default: defaultInstance
273037
273129
  });
273038
273130
  }
273039
273131
 
273040
273132
  // src/commands/connect/ipfs.prompt.ts
273041
273133
  async function ipfsPrompt(env2, storages, accept) {
273042
273134
  const possible = storages.filter((storage) => storage.storageProtocol === "IPFS");
273043
- if (possible.length === 0) {
273044
- return;
273045
- }
273046
- const defaultStorage = possible.find((storage) => storage.uniqueName === env2.SETTLEMINT_IPFS) ?? (possible.length === 1 ? possible[0] : undefined);
273047
- const defaultPossible = accept;
273048
- if (defaultPossible) {
273049
- return defaultStorage;
273050
- }
273051
- const minio = await esm_default2({
273052
- message: "Which IPFS instance do you want to connect to?",
273053
- choices: [
273054
- ...possible.map((storage) => ({
273055
- name: storage.name,
273056
- value: storage
273057
- })),
273058
- {
273059
- name: "None",
273060
- value: undefined
273061
- }
273062
- ],
273063
- default: defaultStorage
273135
+ return servicePrompt({
273136
+ env: env2,
273137
+ services: possible,
273138
+ accept,
273139
+ envKey: "SETTLEMINT_IPFS",
273140
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273141
+ return esm_default2({
273142
+ message: "Which IPFS instance do you want to connect to?",
273143
+ choices: [
273144
+ ...possible.map((storage) => ({
273145
+ name: storage.name,
273146
+ value: storage
273147
+ })),
273148
+ {
273149
+ name: "None",
273150
+ value: undefined
273151
+ }
273152
+ ],
273153
+ default: defaultStorage
273154
+ });
273155
+ }
273064
273156
  });
273065
- return minio;
273066
273157
  }
273067
273158
 
273068
273159
  // src/commands/connect/minio.prompt.ts
273069
273160
  async function minioPrompt(env2, storages, accept) {
273070
273161
  const possible = storages.filter((storage) => storage.storageProtocol === "MINIO");
273071
- if (possible.length === 0) {
273072
- return;
273073
- }
273074
- const defaultStorage = possible.find((storage) => storage.uniqueName === env2.SETTLEMINT_MINIO) ?? (possible.length === 1 ? possible[0] : undefined);
273075
- const defaultPossible = accept;
273076
- if (defaultPossible) {
273077
- return defaultStorage;
273078
- }
273079
- const minio = await esm_default2({
273080
- message: "Which Minio instance do you want to connect to?",
273081
- choices: [
273082
- ...possible.map((storage) => ({
273083
- name: storage.name,
273084
- value: storage
273085
- })),
273086
- {
273087
- name: "None",
273088
- value: undefined
273089
- }
273090
- ],
273091
- default: defaultStorage
273162
+ return servicePrompt({
273163
+ env: env2,
273164
+ services: possible,
273165
+ accept,
273166
+ envKey: "SETTLEMINT_MINIO",
273167
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273168
+ return esm_default2({
273169
+ message: "Which MinIO instance do you want to connect to?",
273170
+ choices: [
273171
+ ...possible.map((storage) => ({
273172
+ name: storage.name,
273173
+ value: storage
273174
+ })),
273175
+ {
273176
+ name: "None",
273177
+ value: undefined
273178
+ }
273179
+ ],
273180
+ default: defaultStorage
273181
+ });
273182
+ }
273092
273183
  });
273093
- return minio;
273094
273184
  }
273095
273185
 
273096
273186
  // src/commands/connect/portal.prompt.ts
273097
273187
  async function portalPrompt(env2, middlewares, accept) {
273098
- const possible = middlewares.filter((middleware2) => middleware2.interface === "SMART_CONTRACT_PORTAL");
273099
- if (possible.length === 0) {
273100
- return;
273101
- }
273102
- const defaultMiddleware = possible.find((middleware2) => middleware2.uniqueName === env2.SETTLEMINT_PORTAL) ?? (possible.length === 1 ? possible[0] : undefined);
273103
- const defaultPossible = accept;
273104
- if (defaultPossible) {
273105
- return defaultMiddleware;
273106
- }
273107
- const middleware = await esm_default2({
273108
- message: "Which Smart Contract Portal instance do you want to connect to?",
273109
- choices: [
273110
- ...possible.map((middleware2) => ({
273111
- name: middleware2.name,
273112
- value: middleware2
273113
- })),
273114
- {
273115
- name: "None",
273116
- value: undefined
273117
- }
273118
- ],
273119
- default: defaultMiddleware
273188
+ const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
273189
+ return servicePrompt({
273190
+ env: env2,
273191
+ services: possible,
273192
+ accept,
273193
+ envKey: "SETTLEMINT_PORTAL",
273194
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273195
+ return esm_default2({
273196
+ message: "Which Smart Contract Portal instance do you want to connect to?",
273197
+ choices: [
273198
+ ...possible.map((middleware) => ({
273199
+ name: middleware.name,
273200
+ value: middleware
273201
+ })),
273202
+ {
273203
+ name: "None",
273204
+ value: undefined
273205
+ }
273206
+ ],
273207
+ default: defaultMiddleware
273208
+ });
273209
+ }
273120
273210
  });
273121
- return middleware;
273122
273211
  }
273123
273212
 
273124
273213
  // src/commands/connect/services.spinner.ts
@@ -273161,43 +273250,47 @@ async function servicesSpinner(settlemint, application) {
273161
273250
  }
273162
273251
 
273163
273252
  // src/commands/connect/thegraph.prompt.ts
273164
- async function theGraphPrompt(env2, middlewares, accept) {
273165
- const possible = middlewares.filter((middleware2) => middleware2.__typename === "HAGraphMiddleware");
273166
- if (possible.length === 0) {
273167
- return;
273168
- }
273169
- const defaultMiddleware = possible.find((middleware2) => middleware2.uniqueName === env2.SETTLEMINT_THEGRAPH) ?? (possible.length === 1 ? possible[0] : undefined);
273170
- const defaultPossible = accept;
273171
- if (defaultPossible) {
273172
- return defaultMiddleware;
273173
- }
273174
- const middleware = await esm_default2({
273175
- message: "Which The Graph instance do you want to connect to?",
273176
- choices: [
273177
- ...possible.map((middleware2) => ({
273178
- name: middleware2.name,
273179
- value: middleware2
273180
- })),
273181
- {
273182
- name: "None",
273183
- value: undefined
273184
- }
273185
- ],
273186
- default: defaultMiddleware
273253
+ async function theGraphPrompt(env2, middlewares, accept, filterRunningOnly = false) {
273254
+ const graphMiddlewares = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
273255
+ const choices = filterRunningOnly ? graphMiddlewares.filter((middleware) => middleware.status === "COMPLETED") : graphMiddlewares;
273256
+ return servicePrompt({
273257
+ env: env2,
273258
+ services: graphMiddlewares,
273259
+ accept,
273260
+ envKey: "SETTLEMINT_THEGRAPH",
273261
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273262
+ return esm_default2({
273263
+ message: "Which The Graph instance do you want to connect to?",
273264
+ choices: [
273265
+ ...choices.map((middleware) => ({
273266
+ name: middleware.name,
273267
+ value: middleware
273268
+ })),
273269
+ {
273270
+ name: "None",
273271
+ value: undefined
273272
+ }
273273
+ ],
273274
+ default: defaultMiddleware
273275
+ });
273276
+ }
273187
273277
  });
273188
- return middleware;
273189
273278
  }
273190
273279
 
273191
273280
  // src/commands/connect/workspace.prompt.ts
273192
273281
  async function workspacePrompt(env2, workspaces, accept) {
273282
+ const autoAccept = !!accept || is_in_ci_default;
273193
273283
  const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
273194
- const defaultPossible = accept && defaultWorkspace;
273284
+ const defaultPossible = autoAccept && defaultWorkspace;
273195
273285
  if (defaultPossible) {
273196
273286
  return defaultWorkspace;
273197
273287
  }
273198
273288
  if (workspaces.length === 0) {
273199
273289
  cancel2("No workspaces found");
273200
273290
  }
273291
+ if (is_in_ci_default) {
273292
+ nothingSelectedError("workspace");
273293
+ }
273201
273294
  const workspace = await esm_default2({
273202
273295
  message: "Which workspace do you want to connect to?",
273203
273296
  choices: workspaces.map((workspace2) => ({
@@ -273214,35 +273307,34 @@ async function workspacePrompt(env2, workspaces, accept) {
273214
273307
 
273215
273308
  // src/commands/connect.ts
273216
273309
  function connectCommand() {
273217
- return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod }) => {
273310
+ return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod, instance }) => {
273218
273311
  intro("Connecting your dApp to SettleMint");
273219
- const autoAccept = !!acceptDefaults || is_in_ci_default;
273220
273312
  const env2 = await loadEnv2(false, !!prod);
273221
- const instance = await instancePrompt(env2, autoAccept);
273222
- const personalAccessToken = await getInstanceCredentials(instance);
273313
+ const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
273314
+ const personalAccessToken = await getInstanceCredentials(selectedInstance);
273223
273315
  if (!personalAccessToken) {
273224
273316
  return missingPersonalAccessTokenError();
273225
273317
  }
273226
273318
  const accessToken = personalAccessToken.personalAccessToken;
273227
273319
  const settlemint = createSettleMintClient({
273228
273320
  accessToken,
273229
- instance
273321
+ instance: selectedInstance
273230
273322
  });
273231
273323
  const workspaces = await workspaceSpinner(settlemint);
273232
- const workspace = await workspacePrompt(env2, workspaces, autoAccept);
273233
- const application = await applicationPrompt(env2, workspace?.applications ?? [], autoAccept);
273234
- const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, autoAccept);
273324
+ const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
273325
+ const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
273326
+ const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
273235
273327
  const { middleware, integrationTool, storage, privateKey, insights, customDeployment, blockchainNodes } = await servicesSpinner(settlemint, application);
273236
- const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
273237
- const hasura = await hasuraPrompt(env2, integrationTool, autoAccept);
273238
- const thegraph = await theGraphPrompt(env2, middleware, autoAccept);
273239
- const portal = await portalPrompt(env2, middleware, autoAccept);
273240
- const ipfs = await ipfsPrompt(env2, storage, autoAccept);
273241
- const minio = await minioPrompt(env2, storage, autoAccept);
273242
- const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, autoAccept);
273243
- const cDeployment = await customDeploymentPrompt(env2, customDeployment, autoAccept);
273244
- const blockscout = await blockscoutPrompt(env2, insights, autoAccept);
273245
- if (autoAccept) {
273328
+ const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
273329
+ const hasura = await hasuraPrompt(env2, integrationTool, acceptDefaults);
273330
+ const thegraph = await theGraphPrompt(env2, middleware, acceptDefaults);
273331
+ const portal = await portalPrompt(env2, middleware, acceptDefaults);
273332
+ const ipfs = await ipfsPrompt(env2, storage, acceptDefaults);
273333
+ const minio = await minioPrompt(env2, storage, acceptDefaults);
273334
+ const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, acceptDefaults);
273335
+ const cDeployment = await customDeploymentPrompt(env2, customDeployment, acceptDefaults);
273336
+ const blockscout = await blockscoutPrompt(env2, insights, acceptDefaults);
273337
+ if (acceptDefaults) {
273246
273338
  const selectedServices = [
273247
273339
  `Workspace: ${workspace.name}`,
273248
273340
  `Application: ${application.name}`,
@@ -273264,7 +273356,7 @@ function connectCommand() {
273264
273356
  }
273265
273357
  await writeEnvSpinner(!!prod, {
273266
273358
  SETTLEMINT_ACCESS_TOKEN: aatToken,
273267
- SETTLEMINT_INSTANCE: instance,
273359
+ SETTLEMINT_INSTANCE: selectedInstance,
273268
273360
  SETTLEMINT_WORKSPACE: workspace.uniqueName,
273269
273361
  SETTLEMINT_APPLICATION: application.uniqueName,
273270
273362
  SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
@@ -274112,7 +274204,7 @@ function createCommand2() {
274112
274204
  }
274113
274205
  const selectedTemplate = await templatePrompt(templates, template);
274114
274206
  if (!selectedTemplate) {
274115
- cancel("No template selected. Please select a template to continue.");
274207
+ return nothingSelectedError("template");
274116
274208
  }
274117
274209
  await spinner({
274118
274210
  startMessage: "Scaffolding the project",
@@ -274183,7 +274275,10 @@ function loginCommand() {
274183
274275
  intro("Login to your SettleMint account");
274184
274276
  const autoAccept = !!acceptDefaults || !!tokenStdin;
274185
274277
  const env2 = await loadEnv2(false, false);
274186
- const selectedInstance = instance ?? await instancePrompt(env2, autoAccept);
274278
+ if (instance) {
274279
+ validate3(UrlSchema, instance);
274280
+ }
274281
+ const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, autoAccept, true);
274187
274282
  let personalAccessToken = "";
274188
274283
  if (tokenStdin) {
274189
274284
  if (cmd2.args.length > 0) {
@@ -274428,9 +274523,8 @@ function getCreateCommand({
274428
274523
  }
274429
274524
  execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout, provider, region }, createFunction) => {
274430
274525
  intro(`Creating ${type4} in the SettleMint platform`);
274431
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274432
274526
  const env2 = await loadEnv2(false, !!prod);
274433
- const instance = await instancePrompt(env2, autoAccept);
274527
+ const instance = await instancePrompt(env2, acceptDefaults);
274434
274528
  const accessToken = await getApplicationOrPersonalAccessToken({
274435
274529
  env: env2,
274436
274530
  instance,
@@ -274444,11 +274538,11 @@ function getCreateCommand({
274444
274538
  if (requiresDeployment) {
274445
274539
  const selectedProvider = await providerPrompt(platformConfig, provider);
274446
274540
  if (!selectedProvider) {
274447
- cancel("No provider selected. Please select a provider to continue.");
274541
+ return nothingSelectedError("provider");
274448
274542
  }
274449
274543
  const selectedRegion = await regionPrompt(selectedProvider, region);
274450
274544
  if (!selectedRegion) {
274451
- cancel("No region selected. Please select a region to continue.");
274545
+ return nothingSelectedError("region");
274452
274546
  }
274453
274547
  }
274454
274548
  const { result, waitFor, mapDefaultEnv } = await spinner({
@@ -274524,6 +274618,9 @@ function blockchainNetworkBesuCreateCommand() {
274524
274618
  region
274525
274619
  }, async (settlemint, env2) => {
274526
274620
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274621
+ if (!applicationUniqueName) {
274622
+ return missingApplication();
274623
+ }
274527
274624
  const result = await settlemint.blockchainNetwork.create({
274528
274625
  name: name2,
274529
274626
  applicationUniqueName,
@@ -274731,6 +274828,9 @@ function applicationAccessTokenCreateCommand() {
274731
274828
  cmd2.option("-a, --application <application>", "The application unique name to create the application access token for (defaults to application from env)").addOption(new Option("-v, --validity-period <period>", "The validity period for the token").choices(["DAYS_7", "DAYS_30", "DAYS_60", "DAYS_90", "NONE"]).default("DAYS_7")).action(async (name2, { application, validityPeriod, ...defaultArgs }) => {
274732
274829
  return baseAction(defaultArgs, async (settlemint, env2) => {
274733
274830
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274831
+ if (!applicationUniqueName) {
274832
+ return missingApplication();
274833
+ }
274734
274834
  const aatToken = await settlemint.applicationAccessToken.create({
274735
274835
  applicationUniqueName,
274736
274836
  name: name2,
@@ -274783,6 +274883,7 @@ function applicationAccessTokenCreateCommand() {
274783
274883
  uniqueName: ""
274784
274884
  },
274785
274885
  mapDefaultEnv: () => ({
274886
+ SETTLEMINT_APPLICATION: applicationUniqueName,
274786
274887
  SETTLEMINT_ACCESS_TOKEN: aatToken
274787
274888
  })
274788
274889
  };
@@ -274814,11 +274915,23 @@ function applicationCreateCommand() {
274814
274915
  type: "application",
274815
274916
  alias: "a",
274816
274917
  execute: (cmd2, baseAction) => {
274817
- cmd2.option("-w, --workspace <workspace>", "The workspace unique name to create the application in (defaults to workspace from env)").action(async (name2, { workspace, ...defaultArgs }) => {
274818
- return baseAction(defaultArgs, async (settlemint, env2) => {
274918
+ 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 }) => {
274919
+ return baseAction({
274920
+ ...defaultArgs,
274921
+ acceptDefaults
274922
+ }, async (settlemint, env2) => {
274923
+ let workspaceUniqueName = workspace;
274924
+ if (!workspaceUniqueName) {
274925
+ const workspaces = await settlemint.workspace.list();
274926
+ const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
274927
+ if (!workspace2) {
274928
+ return nothingSelectedError("workspace");
274929
+ }
274930
+ workspaceUniqueName = workspace2.uniqueName;
274931
+ }
274819
274932
  const result = await settlemint.application.create({
274820
274933
  name: name2,
274821
- workspaceUniqueName: workspace ?? env2.SETTLEMINT_WORKSPACE
274934
+ workspaceUniqueName
274822
274935
  });
274823
274936
  return {
274824
274937
  result,
@@ -274851,27 +274964,27 @@ function applicationCreateCommand() {
274851
274964
 
274852
274965
  // src/commands/connect/blockchain-network.prompt.ts
274853
274966
  async function blockchainNetworkPrompt(env2, networks, accept) {
274854
- if (networks.length === 0) {
274855
- return;
274856
- }
274857
- const defaultNetwork = networks.find((network) => network.uniqueName === env2.SETTLEMINT_BLOCKCHAIN_NETWORK) ?? (networks.length === 1 ? networks[0] : undefined);
274858
- const defaultPossible = accept;
274859
- if (defaultPossible) {
274860
- return defaultNetwork;
274861
- }
274862
- return esm_default2({
274863
- message: "Which blockchain network do you want to connect to?",
274864
- choices: [
274865
- ...networks.map((network) => ({
274866
- name: network.name,
274867
- value: network
274868
- })),
274869
- {
274870
- name: "None",
274871
- value: undefined
274872
- }
274873
- ],
274874
- default: defaultNetwork
274967
+ return servicePrompt({
274968
+ env: env2,
274969
+ services: networks,
274970
+ accept,
274971
+ envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
274972
+ defaultHandler: async ({ defaultService: defaultNetwork }) => {
274973
+ return esm_default2({
274974
+ message: "Which blockchain network do you want to connect to?",
274975
+ choices: [
274976
+ ...networks.map((network) => ({
274977
+ name: network.name,
274978
+ value: network
274979
+ })),
274980
+ {
274981
+ name: "None",
274982
+ value: undefined
274983
+ }
274984
+ ],
274985
+ default: defaultNetwork
274986
+ });
274987
+ }
274875
274988
  });
274876
274989
  }
274877
274990
 
@@ -274900,19 +275013,18 @@ function blockchainNodeBesuCreateCommand() {
274900
275013
  provider,
274901
275014
  region
274902
275015
  }, async (settlemint, env2) => {
274903
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274904
275016
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274905
275017
  if (!applicationUniqueName) {
274906
- cancel("No application found. Please specify an application or run `settlemint connect` to continue.");
275018
+ return missingApplication();
274907
275019
  }
274908
- let networkUniqueName = blockchainNetwork ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NETWORK : undefined);
275020
+ let networkUniqueName = blockchainNetwork;
274909
275021
  if (!networkUniqueName) {
274910
275022
  const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
274911
- const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults ?? false);
275023
+ const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
274912
275024
  if (!network) {
274913
- cancel("No network found. Please specify a network to continue.");
275025
+ return nothingSelectedError("blockchain network");
274914
275026
  }
274915
- networkUniqueName = network?.id;
275027
+ networkUniqueName = network?.uniqueName;
274916
275028
  }
274917
275029
  const result = await settlemint.blockchainNode.create({
274918
275030
  applicationUniqueName,
@@ -274930,7 +275042,7 @@ function blockchainNodeBesuCreateCommand() {
274930
275042
  mapDefaultEnv: () => {
274931
275043
  return {
274932
275044
  SETTLEMINT_APPLICATION: applicationUniqueName,
274933
- SETTLEMINT_BLOCKCHAIN_NODE: result.id
275045
+ SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
274934
275046
  };
274935
275047
  }
274936
275048
  };
@@ -274966,15 +275078,27 @@ function blockscoutInsightsCreateCommand() {
274966
275078
  type: "insights",
274967
275079
  alias: "bs",
274968
275080
  execute: (cmd2, baseAction) => {
274969
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").action(async (name2, { application, provider, region, size, type: type4, blockchainNode, loadBalancer, ...defaultArgs }) => {
275081
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").action(async (name2, { application, provider, region, size, type: type4, blockchainNode, loadBalancer, acceptDefaults, ...defaultArgs }) => {
274970
275082
  return baseAction({
274971
275083
  ...defaultArgs,
275084
+ acceptDefaults,
274972
275085
  provider,
274973
275086
  region
274974
275087
  }, async (settlemint, env2) => {
274975
275088
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274976
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275089
+ if (!applicationUniqueName) {
275090
+ return missingApplication();
275091
+ }
275092
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
274977
275093
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275094
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275095
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275096
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275097
+ if (!node) {
275098
+ return nothingSelectedError("blockchain node");
275099
+ }
275100
+ blockchainNodeUniqueName = node.uniqueName;
275101
+ }
274978
275102
  const result = await settlemint.insights.create({
274979
275103
  name: name2,
274980
275104
  applicationUniqueName,
@@ -275033,6 +275157,9 @@ function hasuraIntegrationCreateCommand() {
275033
275157
  region
275034
275158
  }, async (settlemint, env2) => {
275035
275159
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275160
+ if (!applicationUniqueName) {
275161
+ return missingApplication();
275162
+ }
275036
275163
  const result = await settlemint.integrationTool.create({
275037
275164
  name: name2,
275038
275165
  applicationUniqueName,
@@ -275082,14 +275209,26 @@ function graphMiddlewareCreateCommand() {
275082
275209
  type: "middleware",
275083
275210
  alias: "gr",
275084
275211
  execute: (cmd2, baseAction) => {
275085
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
275212
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
275086
275213
  return baseAction({
275087
275214
  ...defaultArgs,
275215
+ acceptDefaults,
275088
275216
  provider,
275089
275217
  region
275090
275218
  }, async (settlemint, env2) => {
275091
275219
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275092
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275220
+ if (!applicationUniqueName) {
275221
+ return missingApplication();
275222
+ }
275223
+ let blockchainNodeUniqueName = blockchainNode;
275224
+ if (!blockchainNodeUniqueName) {
275225
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275226
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275227
+ if (!node) {
275228
+ return nothingSelectedError("blockchain node");
275229
+ }
275230
+ blockchainNodeUniqueName = node.uniqueName;
275231
+ }
275093
275232
  const result = await settlemint.middleware.create({
275094
275233
  name: name2,
275095
275234
  applicationUniqueName,
@@ -275145,16 +275284,29 @@ function smartContractPortalMiddlewareCreateCommand() {
275145
275284
  type: type4,
275146
275285
  includePredeployedAbis,
275147
275286
  abis,
275287
+ acceptDefaults,
275148
275288
  ...defaultArgs
275149
275289
  }) => {
275150
275290
  return baseAction({
275151
275291
  ...defaultArgs,
275292
+ acceptDefaults,
275152
275293
  provider,
275153
275294
  region
275154
275295
  }, async (settlemint, env2) => {
275155
275296
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275156
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275297
+ if (!applicationUniqueName) {
275298
+ return missingApplication();
275299
+ }
275300
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275157
275301
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275302
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275303
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275304
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275305
+ if (!node) {
275306
+ return nothingSelectedError("blockchain node");
275307
+ }
275308
+ blockchainNodeUniqueName = node.uniqueName;
275309
+ }
275158
275310
  const parsedAbis = [];
275159
275311
  if (abis && abis.length > 0) {
275160
275312
  try {
@@ -275227,14 +275379,26 @@ function privateKeyHdCreateCommand() {
275227
275379
  type: "private key",
275228
275380
  alias: "hd",
275229
275381
  execute: (cmd2, baseAction) => {
275230
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
275382
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
275231
275383
  return baseAction({
275232
275384
  ...defaultArgs,
275385
+ acceptDefaults,
275233
275386
  provider,
275234
275387
  region
275235
275388
  }, async (settlemint, env2) => {
275236
275389
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275237
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275390
+ if (!applicationUniqueName) {
275391
+ return missingApplication();
275392
+ }
275393
+ let blockchainNodeUniqueName = blockchainNode;
275394
+ if (!blockchainNodeUniqueName) {
275395
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275396
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275397
+ if (!node) {
275398
+ return nothingSelectedError("blockchain node");
275399
+ }
275400
+ blockchainNodeUniqueName = node.uniqueName;
275401
+ }
275238
275402
  const result = await settlemint.privateKey.create({
275239
275403
  name: name2,
275240
275404
  applicationUniqueName,
@@ -275281,14 +275445,26 @@ function privateKeyHsmCreateCommand() {
275281
275445
  type: "private key",
275282
275446
  alias: "hd",
275283
275447
  execute: (cmd2, baseAction) => {
275284
- addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
275448
+ addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
275285
275449
  return baseAction({
275286
275450
  ...defaultArgs,
275451
+ acceptDefaults,
275287
275452
  provider,
275288
275453
  region
275289
275454
  }, async (settlemint, env2) => {
275290
275455
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275291
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275456
+ if (!applicationUniqueName) {
275457
+ return missingApplication();
275458
+ }
275459
+ let blockchainNodeUniqueName = blockchainNode;
275460
+ if (!blockchainNodeUniqueName) {
275461
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275462
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275463
+ if (!node) {
275464
+ return nothingSelectedError("blockchain node");
275465
+ }
275466
+ blockchainNodeUniqueName = node.uniqueName;
275467
+ }
275292
275468
  const result = await settlemint.privateKey.create({
275293
275469
  name: name2,
275294
275470
  applicationUniqueName,
@@ -275341,6 +275517,9 @@ function ipfsStorageCreateCommand() {
275341
275517
  region
275342
275518
  }, async (settlemint, env2) => {
275343
275519
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275520
+ if (!applicationUniqueName) {
275521
+ return missingApplication();
275522
+ }
275344
275523
  const result = await settlemint.storage.create({
275345
275524
  name: name2,
275346
275525
  applicationUniqueName,
@@ -275390,6 +275569,9 @@ function minioStorageCreateCommand() {
275390
275569
  region
275391
275570
  }, async (settlemint, env2) => {
275392
275571
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275572
+ if (!applicationUniqueName) {
275573
+ return missingApplication();
275574
+ }
275393
275575
  const result = await settlemint.storage.create({
275394
275576
  name: name2,
275395
275577
  applicationUniqueName,
@@ -275483,9 +275665,8 @@ function getDeleteCommand({
275483
275665
  if (!force) {
275484
275666
  await deleteConfirmationPrompt(`this ${type4}`);
275485
275667
  }
275486
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275487
275668
  const env2 = await loadEnv2(false, !!prod);
275488
- const instance = await instancePrompt(env2, autoAccept);
275669
+ const instance = await instancePrompt(env2, acceptDefaults);
275489
275670
  const accessToken = await getApplicationOrPersonalAccessToken({
275490
275671
  env: env2,
275491
275672
  instance,
@@ -275578,9 +275759,8 @@ function getRestartCommand({
275578
275759
  }
275579
275760
  ])).argument("<unique-name>", `The unique name of the ${type4}, use 'default' to restart the default one from your .env file`).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").option("-w, --wait", "Wait until restarted").action(async (uniqueName, { acceptDefaults, prod, wait }) => {
275580
275761
  intro(`Restarting ${type4} in the SettleMint platform`);
275581
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275582
275762
  const env2 = await loadEnv2(false, !!prod);
275583
- const instance = await instancePrompt(env2, autoAccept);
275763
+ const instance = await instancePrompt(env2, acceptDefaults);
275584
275764
  const accessToken = await getApplicationOrPersonalAccessToken({
275585
275765
  env: env2,
275586
275766
  instance,
@@ -275770,7 +275950,7 @@ function customDeploymentsUpdateCommand() {
275770
275950
  const env2 = await loadEnv2(false, !!prod);
275771
275951
  const customDeploymentUniqueName = uniqueName ?? env2.SETTLEMINT_CUSTOM_DEPLOYMENT;
275772
275952
  if (!customDeploymentUniqueName) {
275773
- throw new Error("No custom deployment unique name specified. Please provide it either via the --unique-name flag or by setting the SETTLEMINT_CUSTOM_DEPLOYMENT environment variable");
275953
+ cancel("No custom deployment unique name specified. Please provide it either via the --unique-name flag or by setting the SETTLEMINT_CUSTOM_DEPLOYMENT environment variable");
275774
275954
  }
275775
275955
  const instance = await instancePrompt(env2, true);
275776
275956
  const accessToken = await getApplicationOrPersonalAccessToken({
@@ -275808,18 +275988,18 @@ function updateCommand() {
275808
275988
 
275809
275989
  // src/commands/platform/config.ts
275810
275990
  function configCommand() {
275811
- return new Command("config").alias("c").description("Get platform configuration").option("--prod", "Connect to your production environment").action(async ({ prod }) => {
275991
+ return new Command("config").alias("c").description("Get platform configuration").option("--prod", "Connect to your production environment").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").action(async ({ prod, instance }) => {
275812
275992
  intro("Getting platform configuration");
275813
275993
  const env2 = await loadEnv2(false, !!prod);
275814
- const instance = await instancePrompt(env2, true);
275994
+ const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
275815
275995
  const accessToken = await getApplicationOrPersonalAccessToken({
275816
275996
  env: env2,
275817
- instance,
275997
+ instance: selectedInstance,
275818
275998
  prefer: "personal"
275819
275999
  });
275820
276000
  const settlemint = createSettleMintClient({
275821
276001
  accessToken,
275822
- instance
276002
+ instance: selectedInstance
275823
276003
  });
275824
276004
  const platformConfig = await settlemint.platform.config();
275825
276005
  note2(`Providers and regions:
@@ -275894,7 +276074,7 @@ function createCommand4() {
275894
276074
  const platformConfig = await settlemint.platform.config();
275895
276075
  const selectedUseCase = await useCasePrompt(platformConfig, useCase);
275896
276076
  if (!selectedUseCase) {
275897
- cancel("No use case selected. Please select a use case to continue.");
276077
+ return nothingSelectedError("use case");
275898
276078
  }
275899
276079
  const targetDir = formatTargetDir(name2);
275900
276080
  const projectDir = join8(process.cwd(), targetDir);
@@ -276080,6 +276260,60 @@ function hardhatDeployLocalCommand() {
276080
276260
  });
276081
276261
  }
276082
276262
 
276263
+ // src/error/service-not-running-error.ts
276264
+ function serviceNotRunningError(service, status) {
276265
+ return cancel2(`The ${service} service is not in a Running state (status: ${status}). ${getStatusAction(status)}`);
276266
+ }
276267
+ function getStatusAction(status) {
276268
+ if (status === "PAUSED" || status === "AUTO_PAUSED") {
276269
+ return "Please resume the service.";
276270
+ }
276271
+ if (status === "FAILED") {
276272
+ return "Please try restarting the service or contact support.";
276273
+ }
276274
+ return "Please try again later.";
276275
+ }
276276
+
276277
+ // src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
276278
+ async function selectTargetNode({
276279
+ env: env2,
276280
+ blockchainNodeUniqueName,
276281
+ autoAccept,
276282
+ settlemint
276283
+ }) {
276284
+ const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276285
+ let node = undefined;
276286
+ if (!nodeUniqueName) {
276287
+ if (!env2.SETTLEMINT_APPLICATION) {
276288
+ return missingApplication();
276289
+ }
276290
+ const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276291
+ const evmNodes = nodes.filter((node2) => node2.isEvm);
276292
+ if (evmNodes.length === 0) {
276293
+ cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
276294
+ }
276295
+ const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
276296
+ const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
276297
+ if (nodesWithActivePrivateKey.length === 0) {
276298
+ cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276299
+ }
276300
+ const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept, true);
276301
+ if (!blockchainNode) {
276302
+ return nothingSelectedError("EVM blockchain node");
276303
+ }
276304
+ node = blockchainNode;
276305
+ } else {
276306
+ node = await settlemint.blockchainNode.read(nodeUniqueName);
276307
+ if (!node.isEvm) {
276308
+ cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
276309
+ }
276310
+ }
276311
+ if (node.status !== "COMPLETED") {
276312
+ serviceNotRunningError("blockchain node", node.status);
276313
+ }
276314
+ return node;
276315
+ }
276316
+
276083
276317
  // src/commands/smart-contract-set/prompts/address.prompt.ts
276084
276318
  async function addressPrompt({
276085
276319
  env: env2,
@@ -276193,30 +276427,7 @@ function hardhatDeployRemoteCommand() {
276193
276427
  accessToken,
276194
276428
  instance
276195
276429
  });
276196
- const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276197
- let node = undefined;
276198
- if (!nodeUniqueName) {
276199
- const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276200
- const evmNodes = nodes.filter((node2) => node2.isEvm);
276201
- if (evmNodes.length === 0) {
276202
- cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
276203
- }
276204
- const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
276205
- const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
276206
- if (nodesWithActivePrivateKey.length === 0) {
276207
- cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276208
- }
276209
- const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
276210
- if (!blockchainNode) {
276211
- cancel("No EVM blockchain node selected. Please select one to continue.");
276212
- }
276213
- node = blockchainNode;
276214
- } else {
276215
- node = await settlemint.blockchainNode.read(nodeUniqueName);
276216
- if (!node.isEvm) {
276217
- cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
276218
- }
276219
- }
276430
+ const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
276220
276431
  const envConfig = await settlemint.foundry.env(node.uniqueName);
276221
276432
  const hardhatConfig = await getHardhatConfigData(envConfig);
276222
276433
  if (verify && !hardhatConfig?.etherscan?.apiKey) {
@@ -276224,7 +276435,7 @@ function hardhatDeployRemoteCommand() {
276224
276435
  }
276225
276436
  const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
276226
276437
  if (!address) {
276227
- cancel("No private key selected. Please select one to continue.");
276438
+ return nothingSelectedError("private key");
276228
276439
  }
276229
276440
  const { command, args } = await getPackageManagerExecutable();
276230
276441
  await executeCommand(command, [
@@ -276308,16 +276519,8 @@ function hardhatScriptRemoteCommand() {
276308
276519
  accessToken,
276309
276520
  instance
276310
276521
  });
276311
- let nodeUniqueName = blockchainNodeUniqueName;
276312
- if (!nodeUniqueName) {
276313
- const blockchainNodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276314
- const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
276315
- if (!blockchainNode) {
276316
- cancel("No Blockchain Node selected. Please select one to continue.");
276317
- }
276318
- nodeUniqueName = blockchainNode.uniqueName;
276319
- }
276320
- const envConfig = await settlemint.foundry.env(nodeUniqueName);
276522
+ const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
276523
+ const envConfig = await settlemint.foundry.env(node.uniqueName);
276321
276524
  const { command, args } = await getPackageManagerExecutable();
276322
276525
  await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env: envConfig });
276323
276526
  });
@@ -276534,8 +276737,11 @@ async function getTheGraphMiddleware({
276534
276737
  return defaultTheGraphMiddleware;
276535
276738
  }
276536
276739
  }
276740
+ if (!env2.SETTLEMINT_APPLICATION) {
276741
+ return missingApplication();
276742
+ }
276537
276743
  const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
276538
- return theGraphPrompt(env2, middlewares, autoAccept);
276744
+ return theGraphPrompt(env2, middlewares, autoAccept, true);
276539
276745
  }
276540
276746
  async function getTheGraphNetwork({
276541
276747
  theGraphMiddleware,
@@ -276643,7 +276849,10 @@ function subgraphDeployCommand() {
276643
276849
  });
276644
276850
  const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
276645
276851
  if (!theGraphMiddleware) {
276646
- cancel("No Graph Middleware selected. Please select one to continue.");
276852
+ return nothingSelectedError("graph middleware");
276853
+ }
276854
+ if (theGraphMiddleware.status !== "COMPLETED") {
276855
+ serviceNotRunningError("graph middleware", theGraphMiddleware.status);
276647
276856
  }
276648
276857
  const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
276649
276858
  await subgraphSetup({
@@ -276746,4 +276955,4 @@ function sdkCliCommand(exitOverride = undefined) {
276746
276955
  ascii();
276747
276956
  sdkCliCommand();
276748
276957
 
276749
- //# debugId=A97C376CB78E2CC864756E2164756E21
276958
+ //# debugId=0F1625D0AFD455D164756E2164756E21