@settlemint/sdk-cli 0.9.3-main725ad562 → 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 +572 -354
  2. package/dist/cli.js.map +55 -50
  3. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -19613,7 +19613,7 @@ var require_lib4 = __commonJS((exports, module) => {
19613
19613
  var rRel = new RegExp(`^\\.${rSlash.source}`);
19614
19614
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
19615
19615
  var getPathInfo = (cmd, {
19616
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.U27iGwQVyk:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19616
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.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.U27iGwQVyk:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19820
+ path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.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.U27iGwQVyk:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
20537
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.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.U27iGwQVyk:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
223330
+ var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.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-main725ad562",
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.U27iGwQVyk:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234967
+ ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.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-main725ad562",
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-main725ad562",
256845
- "@settlemint/sdk-utils": "0.9.3-main725ad562",
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
  },
@@ -257103,9 +257103,12 @@ async function findUp(name, options = {}) {
257103
257103
 
257104
257104
  // ../utils/dist/filesystem.mjs
257105
257105
  import { stat } from "node:fs/promises";
257106
- async function projectRoot() {
257106
+ async function projectRoot(fallbackToCwd = false) {
257107
257107
  const packageJsonPath = await findUp("package.json");
257108
257108
  if (!packageJsonPath) {
257109
+ if (fallbackToCwd) {
257110
+ return process.cwd();
257111
+ }
257109
257112
  throw new Error("Unable to find project root (no package.json found)");
257110
257113
  }
257111
257114
  return dirname(packageJsonPath);
@@ -257140,6 +257143,9 @@ function missingAccessTokenError(personalAccessTokenExists) {
257140
257143
  function missingPersonalAccessTokenError() {
257141
257144
  return cancel("No personal access token found for instance, please run `settlemint login` to login to your instance");
257142
257145
  }
257146
+ function missingApplication() {
257147
+ return cancel("No application configured, please run `settlemint connect` to connect to your application");
257148
+ }
257143
257149
 
257144
257150
  // src/utils/config.ts
257145
257151
  import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
@@ -267900,7 +267906,13 @@ export const { client: theGraphClient${nameSuffix}, graphql: theGraphGraphql${na
267900
267906
  import { writeFile as writeFile4 } from "node:fs/promises";
267901
267907
 
267902
267908
  // src/commands/codegen/test-gql-endpoint.ts
267903
- 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
+ }) {
267904
267916
  if (!gqlEndpoint) {
267905
267917
  return false;
267906
267918
  }
@@ -268842,12 +268854,29 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
268842
268854
  const name2 = gqlEndpoint.split("/").pop();
268843
268855
  return name2 && (!thegraphSubgraphNames || thegraphSubgraphNames.includes(name2));
268844
268856
  });
268845
- const [hasura, portal, thegraph, blockscout] = await Promise.all([
268846
- testGqlEndpoint(accessToken, env2.SETTLEMINT_HASURA_ADMIN_SECRET, env2.SETTLEMINT_HASURA_ENDPOINT, true),
268847
- testGqlEndpoint(accessToken, undefined, env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT),
268848
- testGqlEndpoint(accessToken, undefined, theGraphEndpoints[0]),
268849
- 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
+ })
268850
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
+ }));
268851
268880
  if (!tsconfig.config.compilerOptions) {
268852
268881
  tsconfig.config.compilerOptions = {};
268853
268882
  }
@@ -268866,7 +268895,7 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
268866
268895
  tadaTurboLocation: "hasura-cache.d.ts"
268867
268896
  }
268868
268897
  ] : [],
268869
- ...thegraph ? theGraphEndpoints.map((endpoint) => {
268898
+ ...thegraph ? thegraph.filter((endpoint) => endpoint.success).map(({ endpoint }) => {
268870
268899
  const name2 = endpoint.split("/").pop();
268871
268900
  return {
268872
268901
  name: `thegraph-${name2}`,
@@ -270060,9 +270089,12 @@ async function loadEnvironmentEnv2(validateEnv, prod, path5 = process.cwd()) {
270060
270089
  return {};
270061
270090
  }
270062
270091
  }
270063
- async function projectRoot2() {
270092
+ async function projectRoot2(fallbackToCwd = false) {
270064
270093
  const packageJsonPath = await findUp("package.json");
270065
270094
  if (!packageJsonPath) {
270095
+ if (fallbackToCwd) {
270096
+ return process.cwd();
270097
+ }
270066
270098
  throw new Error("Unable to find project root (no package.json found)");
270067
270099
  }
270068
270100
  return dirname5(packageJsonPath);
@@ -270113,7 +270145,7 @@ async function findMonoRepoPackages(projectDir) {
270113
270145
  }
270114
270146
  }
270115
270147
  async function writeEnv(prod, env2, secrets) {
270116
- const projectDir = await projectRoot2();
270148
+ const projectDir = await projectRoot2(true);
270117
270149
  if (prod) {
270118
270150
  process.env.NODE_ENV = "production";
270119
270151
  }
@@ -270502,7 +270534,7 @@ async function getGraphEndpoint(service, env2) {
270502
270534
  const isStarterKit = (id) => id.endsWith("-starterkits");
270503
270535
  const testEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => !isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
270504
270536
  const starterKitEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
270505
- 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;
270506
270538
  const endpoints = hasEndpoint ? service.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue) : starterKitEndpoint ? [starterKitEndpoint] : [];
270507
270539
  if (endpoints.length === 0) {
270508
270540
  return {};
@@ -270561,6 +270593,17 @@ function getMinioEndpoints(service) {
270561
270593
  };
270562
270594
  }
270563
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
+
270564
270607
  // ../utils/dist/runtime.mjs
270565
270608
  function ensureServer() {
270566
270609
  if (isBrowser) {
@@ -272750,8 +272793,9 @@ var esm_default5 = createPrompt((config4, done) => {
272750
272793
 
272751
272794
  // src/commands/connect/aat.prompt.ts
272752
272795
  async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
272796
+ const autoAccept = !!accept || is_in_ci_default;
272753
272797
  const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
272754
- const defaultPossible = accept && defaultAccessToken;
272798
+ const defaultPossible = autoAccept && defaultAccessToken;
272755
272799
  if (defaultPossible || is_in_ci_default) {
272756
272800
  return defaultAccessToken;
272757
272801
  }
@@ -272846,16 +272890,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
272846
272890
  });
272847
272891
  }
272848
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
+
272849
272898
  // src/commands/connect/application.prompt.ts
272850
272899
  async function applicationPrompt(env2, applications, accept) {
272900
+ const autoAccept = !!accept || is_in_ci_default;
272851
272901
  const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
272852
- const defaultPossible = accept && defaultApplication;
272902
+ const defaultPossible = autoAccept && defaultApplication;
272853
272903
  if (defaultPossible) {
272854
272904
  return defaultApplication;
272855
272905
  }
272856
272906
  if (applications.length === 0) {
272857
272907
  cancel("No applications found");
272858
272908
  }
272909
+ if (is_in_ci_default) {
272910
+ nothingSelectedError("application");
272911
+ }
272859
272912
  const application = await esm_default2({
272860
272913
  message: "Which application do you want to connect to?",
272861
272914
  choices: applications.map((applications2) => ({
@@ -272870,249 +272923,291 @@ async function applicationPrompt(env2, applications, accept) {
272870
272923
  return application;
272871
272924
  }
272872
272925
 
272873
- // src/commands/connect/blockchain-node.prompt.ts
272874
- async function blockchainNodePrompt(env2, nodes, accept) {
272875
- 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) {
272876
272936
  return;
272877
272937
  }
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;
272938
+ const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
272939
+ const autoAccept = isCi || accept;
272940
+ if (autoAccept && selectedService) {
272941
+ return selectedService;
272882
272942
  }
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
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
+ }
272896
272976
  });
272897
- return node;
272898
272977
  }
272899
272978
 
272900
272979
  // src/commands/connect/blockscout.prompt.ts
272901
272980
  async function blockscoutPrompt(env2, insights, accept) {
272902
272981
  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
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
+ }
272924
273003
  });
272925
- return blockscout;
272926
273004
  }
272927
273005
 
272928
273006
  // src/commands/connect/custom-deployment.prompt.ts
272929
273007
  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
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
+ }
272951
273031
  });
272952
- return middleware;
272953
273032
  }
272954
273033
 
272955
273034
  // src/commands/connect/hasura.prompt.ts
272956
273035
  async function hasuraPrompt(env2, integrations, accept) {
272957
273036
  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
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
+ }
272979
273058
  });
272980
- return hasura;
272981
273059
  }
272982
273060
 
272983
273061
  // src/commands/connect/hd-private-keys.prompt.ts
272984
273062
  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
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
+ }
273007
273085
  });
273008
- return privateKey;
273009
273086
  }
273010
273087
 
273011
273088
  // src/commands/connect/instance.prompt.ts
273012
- async function instancePrompt(env2, accept) {
273013
- const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
273014
- const defaultPossible = accept && defaultInstance;
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;
273015
273094
  if (defaultPossible) {
273016
273095
  return defaultInstance;
273017
273096
  }
273018
- return esm_default4({
273019
- message: "What is the URL of your SettleMint instance?",
273020
- default: defaultInstance,
273021
- required: true,
273022
- validate(value4) {
273023
- try {
273024
- validate3(UrlSchema3, value4);
273025
- return true;
273026
- } catch (error5) {
273027
- return "Invalid URL";
273028
- }
273029
- },
273030
- transformer: (value4) => value4.trim()
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
273031
273129
  });
273032
273130
  }
273033
273131
 
273034
273132
  // src/commands/connect/ipfs.prompt.ts
273035
273133
  async function ipfsPrompt(env2, storages, accept) {
273036
273134
  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
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
+ }
273058
273156
  });
273059
- return minio;
273060
273157
  }
273061
273158
 
273062
273159
  // src/commands/connect/minio.prompt.ts
273063
273160
  async function minioPrompt(env2, storages, accept) {
273064
273161
  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
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
+ }
273086
273183
  });
273087
- return minio;
273088
273184
  }
273089
273185
 
273090
273186
  // src/commands/connect/portal.prompt.ts
273091
273187
  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
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
+ }
273114
273210
  });
273115
- return middleware;
273116
273211
  }
273117
273212
 
273118
273213
  // src/commands/connect/services.spinner.ts
@@ -273155,43 +273250,47 @@ async function servicesSpinner(settlemint, application) {
273155
273250
  }
273156
273251
 
273157
273252
  // src/commands/connect/thegraph.prompt.ts
273158
- 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
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
+ }
273181
273277
  });
273182
- return middleware;
273183
273278
  }
273184
273279
 
273185
273280
  // src/commands/connect/workspace.prompt.ts
273186
273281
  async function workspacePrompt(env2, workspaces, accept) {
273282
+ const autoAccept = !!accept || is_in_ci_default;
273187
273283
  const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
273188
- const defaultPossible = accept && defaultWorkspace;
273284
+ const defaultPossible = autoAccept && defaultWorkspace;
273189
273285
  if (defaultPossible) {
273190
273286
  return defaultWorkspace;
273191
273287
  }
273192
273288
  if (workspaces.length === 0) {
273193
273289
  cancel2("No workspaces found");
273194
273290
  }
273291
+ if (is_in_ci_default) {
273292
+ nothingSelectedError("workspace");
273293
+ }
273195
273294
  const workspace = await esm_default2({
273196
273295
  message: "Which workspace do you want to connect to?",
273197
273296
  choices: workspaces.map((workspace2) => ({
@@ -273208,35 +273307,34 @@ async function workspacePrompt(env2, workspaces, accept) {
273208
273307
 
273209
273308
  // src/commands/connect.ts
273210
273309
  function connectCommand() {
273211
- return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod }) => {
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 }) => {
273212
273311
  intro("Connecting your dApp to SettleMint");
273213
- const autoAccept = !!acceptDefaults || is_in_ci_default;
273214
273312
  const env2 = await loadEnv2(false, !!prod);
273215
- const instance = await instancePrompt(env2, autoAccept);
273216
- const personalAccessToken = await getInstanceCredentials(instance);
273313
+ const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
273314
+ const personalAccessToken = await getInstanceCredentials(selectedInstance);
273217
273315
  if (!personalAccessToken) {
273218
273316
  return missingPersonalAccessTokenError();
273219
273317
  }
273220
273318
  const accessToken = personalAccessToken.personalAccessToken;
273221
273319
  const settlemint = createSettleMintClient({
273222
273320
  accessToken,
273223
- instance
273321
+ instance: selectedInstance
273224
273322
  });
273225
273323
  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);
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);
273229
273327
  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) {
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) {
273240
273338
  const selectedServices = [
273241
273339
  `Workspace: ${workspace.name}`,
273242
273340
  `Application: ${application.name}`,
@@ -273258,7 +273356,7 @@ function connectCommand() {
273258
273356
  }
273259
273357
  await writeEnvSpinner(!!prod, {
273260
273358
  SETTLEMINT_ACCESS_TOKEN: aatToken,
273261
- SETTLEMINT_INSTANCE: instance,
273359
+ SETTLEMINT_INSTANCE: selectedInstance,
273262
273360
  SETTLEMINT_WORKSPACE: workspace.uniqueName,
273263
273361
  SETTLEMINT_APPLICATION: application.uniqueName,
273264
273362
  SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
@@ -273340,9 +273438,12 @@ import { dirname as dirname6 } from "node:path";
273340
273438
  import { stat as stat8 } from "node:fs/promises";
273341
273439
  var import_package_json3 = __toESM(require_lib12(), 1);
273342
273440
  var import_package_json4 = __toESM(require_lib12(), 1);
273343
- async function projectRoot3() {
273441
+ async function projectRoot3(fallbackToCwd = false) {
273344
273442
  const packageJsonPath = await findUp("package.json");
273345
273443
  if (!packageJsonPath) {
273444
+ if (fallbackToCwd) {
273445
+ return process.cwd();
273446
+ }
273346
273447
  throw new Error("Unable to find project root (no package.json found)");
273347
273448
  }
273348
273449
  return dirname6(packageJsonPath);
@@ -274103,7 +274204,7 @@ function createCommand2() {
274103
274204
  }
274104
274205
  const selectedTemplate = await templatePrompt(templates, template);
274105
274206
  if (!selectedTemplate) {
274106
- cancel("No template selected. Please select a template to continue.");
274207
+ return nothingSelectedError("template");
274107
274208
  }
274108
274209
  await spinner({
274109
274210
  startMessage: "Scaffolding the project",
@@ -274174,7 +274275,10 @@ function loginCommand() {
274174
274275
  intro("Login to your SettleMint account");
274175
274276
  const autoAccept = !!acceptDefaults || !!tokenStdin;
274176
274277
  const env2 = await loadEnv2(false, false);
274177
- 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);
274178
274282
  let personalAccessToken = "";
274179
274283
  if (tokenStdin) {
274180
274284
  if (cmd2.args.length > 0) {
@@ -274419,9 +274523,8 @@ function getCreateCommand({
274419
274523
  }
274420
274524
  execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout, provider, region }, createFunction) => {
274421
274525
  intro(`Creating ${type4} in the SettleMint platform`);
274422
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274423
274526
  const env2 = await loadEnv2(false, !!prod);
274424
- const instance = await instancePrompt(env2, autoAccept);
274527
+ const instance = await instancePrompt(env2, acceptDefaults);
274425
274528
  const accessToken = await getApplicationOrPersonalAccessToken({
274426
274529
  env: env2,
274427
274530
  instance,
@@ -274435,11 +274538,11 @@ function getCreateCommand({
274435
274538
  if (requiresDeployment) {
274436
274539
  const selectedProvider = await providerPrompt(platformConfig, provider);
274437
274540
  if (!selectedProvider) {
274438
- cancel("No provider selected. Please select a provider to continue.");
274541
+ return nothingSelectedError("provider");
274439
274542
  }
274440
274543
  const selectedRegion = await regionPrompt(selectedProvider, region);
274441
274544
  if (!selectedRegion) {
274442
- cancel("No region selected. Please select a region to continue.");
274545
+ return nothingSelectedError("region");
274443
274546
  }
274444
274547
  }
274445
274548
  const { result, waitFor, mapDefaultEnv } = await spinner({
@@ -274515,6 +274618,9 @@ function blockchainNetworkBesuCreateCommand() {
274515
274618
  region
274516
274619
  }, async (settlemint, env2) => {
274517
274620
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274621
+ if (!applicationUniqueName) {
274622
+ return missingApplication();
274623
+ }
274518
274624
  const result = await settlemint.blockchainNetwork.create({
274519
274625
  name: name2,
274520
274626
  applicationUniqueName,
@@ -274722,6 +274828,9 @@ function applicationAccessTokenCreateCommand() {
274722
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 }) => {
274723
274829
  return baseAction(defaultArgs, async (settlemint, env2) => {
274724
274830
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274831
+ if (!applicationUniqueName) {
274832
+ return missingApplication();
274833
+ }
274725
274834
  const aatToken = await settlemint.applicationAccessToken.create({
274726
274835
  applicationUniqueName,
274727
274836
  name: name2,
@@ -274774,6 +274883,7 @@ function applicationAccessTokenCreateCommand() {
274774
274883
  uniqueName: ""
274775
274884
  },
274776
274885
  mapDefaultEnv: () => ({
274886
+ SETTLEMINT_APPLICATION: applicationUniqueName,
274777
274887
  SETTLEMINT_ACCESS_TOKEN: aatToken
274778
274888
  })
274779
274889
  };
@@ -274805,11 +274915,23 @@ function applicationCreateCommand() {
274805
274915
  type: "application",
274806
274916
  alias: "a",
274807
274917
  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) => {
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
+ }
274810
274932
  const result = await settlemint.application.create({
274811
274933
  name: name2,
274812
- workspaceUniqueName: workspace ?? env2.SETTLEMINT_WORKSPACE
274934
+ workspaceUniqueName
274813
274935
  });
274814
274936
  return {
274815
274937
  result,
@@ -274842,27 +274964,27 @@ function applicationCreateCommand() {
274842
274964
 
274843
274965
  // src/commands/connect/blockchain-network.prompt.ts
274844
274966
  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
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
+ }
274866
274988
  });
274867
274989
  }
274868
274990
 
@@ -274891,19 +275013,18 @@ function blockchainNodeBesuCreateCommand() {
274891
275013
  provider,
274892
275014
  region
274893
275015
  }, async (settlemint, env2) => {
274894
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274895
275016
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274896
275017
  if (!applicationUniqueName) {
274897
- cancel("No application found. Please specify an application or run `settlemint connect` to continue.");
275018
+ return missingApplication();
274898
275019
  }
274899
- let networkUniqueName = blockchainNetwork ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NETWORK : undefined);
275020
+ let networkUniqueName = blockchainNetwork;
274900
275021
  if (!networkUniqueName) {
274901
275022
  const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
274902
- const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults ?? false);
275023
+ const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
274903
275024
  if (!network) {
274904
- cancel("No network found. Please specify a network to continue.");
275025
+ return nothingSelectedError("blockchain network");
274905
275026
  }
274906
- networkUniqueName = network?.id;
275027
+ networkUniqueName = network?.uniqueName;
274907
275028
  }
274908
275029
  const result = await settlemint.blockchainNode.create({
274909
275030
  applicationUniqueName,
@@ -274921,7 +275042,7 @@ function blockchainNodeBesuCreateCommand() {
274921
275042
  mapDefaultEnv: () => {
274922
275043
  return {
274923
275044
  SETTLEMINT_APPLICATION: applicationUniqueName,
274924
- SETTLEMINT_BLOCKCHAIN_NODE: result.id
275045
+ SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
274925
275046
  };
274926
275047
  }
274927
275048
  };
@@ -274957,15 +275078,27 @@ function blockscoutInsightsCreateCommand() {
274957
275078
  type: "insights",
274958
275079
  alias: "bs",
274959
275080
  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 }) => {
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 }) => {
274961
275082
  return baseAction({
274962
275083
  ...defaultArgs,
275084
+ acceptDefaults,
274963
275085
  provider,
274964
275086
  region
274965
275087
  }, async (settlemint, env2) => {
274966
275088
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274967
- 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;
274968
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
+ }
274969
275102
  const result = await settlemint.insights.create({
274970
275103
  name: name2,
274971
275104
  applicationUniqueName,
@@ -275024,6 +275157,9 @@ function hasuraIntegrationCreateCommand() {
275024
275157
  region
275025
275158
  }, async (settlemint, env2) => {
275026
275159
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275160
+ if (!applicationUniqueName) {
275161
+ return missingApplication();
275162
+ }
275027
275163
  const result = await settlemint.integrationTool.create({
275028
275164
  name: name2,
275029
275165
  applicationUniqueName,
@@ -275073,14 +275209,26 @@ function graphMiddlewareCreateCommand() {
275073
275209
  type: "middleware",
275074
275210
  alias: "gr",
275075
275211
  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 }) => {
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 }) => {
275077
275213
  return baseAction({
275078
275214
  ...defaultArgs,
275215
+ acceptDefaults,
275079
275216
  provider,
275080
275217
  region
275081
275218
  }, async (settlemint, env2) => {
275082
275219
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275083
- 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
+ }
275084
275232
  const result = await settlemint.middleware.create({
275085
275233
  name: name2,
275086
275234
  applicationUniqueName,
@@ -275136,16 +275284,29 @@ function smartContractPortalMiddlewareCreateCommand() {
275136
275284
  type: type4,
275137
275285
  includePredeployedAbis,
275138
275286
  abis,
275287
+ acceptDefaults,
275139
275288
  ...defaultArgs
275140
275289
  }) => {
275141
275290
  return baseAction({
275142
275291
  ...defaultArgs,
275292
+ acceptDefaults,
275143
275293
  provider,
275144
275294
  region
275145
275295
  }, async (settlemint, env2) => {
275146
275296
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275147
- 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;
275148
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
+ }
275149
275310
  const parsedAbis = [];
275150
275311
  if (abis && abis.length > 0) {
275151
275312
  try {
@@ -275218,14 +275379,26 @@ function privateKeyHdCreateCommand() {
275218
275379
  type: "private key",
275219
275380
  alias: "hd",
275220
275381
  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 }) => {
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 }) => {
275222
275383
  return baseAction({
275223
275384
  ...defaultArgs,
275385
+ acceptDefaults,
275224
275386
  provider,
275225
275387
  region
275226
275388
  }, async (settlemint, env2) => {
275227
275389
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275228
- 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
+ }
275229
275402
  const result = await settlemint.privateKey.create({
275230
275403
  name: name2,
275231
275404
  applicationUniqueName,
@@ -275272,14 +275445,26 @@ function privateKeyHsmCreateCommand() {
275272
275445
  type: "private key",
275273
275446
  alias: "hd",
275274
275447
  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 }) => {
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 }) => {
275276
275449
  return baseAction({
275277
275450
  ...defaultArgs,
275451
+ acceptDefaults,
275278
275452
  provider,
275279
275453
  region
275280
275454
  }, async (settlemint, env2) => {
275281
275455
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275282
- 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
+ }
275283
275468
  const result = await settlemint.privateKey.create({
275284
275469
  name: name2,
275285
275470
  applicationUniqueName,
@@ -275332,6 +275517,9 @@ function ipfsStorageCreateCommand() {
275332
275517
  region
275333
275518
  }, async (settlemint, env2) => {
275334
275519
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275520
+ if (!applicationUniqueName) {
275521
+ return missingApplication();
275522
+ }
275335
275523
  const result = await settlemint.storage.create({
275336
275524
  name: name2,
275337
275525
  applicationUniqueName,
@@ -275381,6 +275569,9 @@ function minioStorageCreateCommand() {
275381
275569
  region
275382
275570
  }, async (settlemint, env2) => {
275383
275571
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275572
+ if (!applicationUniqueName) {
275573
+ return missingApplication();
275574
+ }
275384
275575
  const result = await settlemint.storage.create({
275385
275576
  name: name2,
275386
275577
  applicationUniqueName,
@@ -275474,9 +275665,8 @@ function getDeleteCommand({
275474
275665
  if (!force) {
275475
275666
  await deleteConfirmationPrompt(`this ${type4}`);
275476
275667
  }
275477
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275478
275668
  const env2 = await loadEnv2(false, !!prod);
275479
- const instance = await instancePrompt(env2, autoAccept);
275669
+ const instance = await instancePrompt(env2, acceptDefaults);
275480
275670
  const accessToken = await getApplicationOrPersonalAccessToken({
275481
275671
  env: env2,
275482
275672
  instance,
@@ -275569,9 +275759,8 @@ function getRestartCommand({
275569
275759
  }
275570
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 }) => {
275571
275761
  intro(`Restarting ${type4} in the SettleMint platform`);
275572
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275573
275762
  const env2 = await loadEnv2(false, !!prod);
275574
- const instance = await instancePrompt(env2, autoAccept);
275763
+ const instance = await instancePrompt(env2, acceptDefaults);
275575
275764
  const accessToken = await getApplicationOrPersonalAccessToken({
275576
275765
  env: env2,
275577
275766
  instance,
@@ -275761,7 +275950,7 @@ function customDeploymentsUpdateCommand() {
275761
275950
  const env2 = await loadEnv2(false, !!prod);
275762
275951
  const customDeploymentUniqueName = uniqueName ?? env2.SETTLEMINT_CUSTOM_DEPLOYMENT;
275763
275952
  if (!customDeploymentUniqueName) {
275764
- throw new Error("No custom deployment unique name specified. Please provide it either via the --unique-name flag or by setting the SETTLEMINT_CUSTOM_DEPLOYMENT environment variable");
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");
275765
275954
  }
275766
275955
  const instance = await instancePrompt(env2, true);
275767
275956
  const accessToken = await getApplicationOrPersonalAccessToken({
@@ -275799,18 +275988,18 @@ function updateCommand() {
275799
275988
 
275800
275989
  // src/commands/platform/config.ts
275801
275990
  function configCommand() {
275802
- 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 }) => {
275803
275992
  intro("Getting platform configuration");
275804
275993
  const env2 = await loadEnv2(false, !!prod);
275805
- const instance = await instancePrompt(env2, true);
275994
+ const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
275806
275995
  const accessToken = await getApplicationOrPersonalAccessToken({
275807
275996
  env: env2,
275808
- instance,
275997
+ instance: selectedInstance,
275809
275998
  prefer: "personal"
275810
275999
  });
275811
276000
  const settlemint = createSettleMintClient({
275812
276001
  accessToken,
275813
- instance
276002
+ instance: selectedInstance
275814
276003
  });
275815
276004
  const platformConfig = await settlemint.platform.config();
275816
276005
  note2(`Providers and regions:
@@ -275885,7 +276074,7 @@ function createCommand4() {
275885
276074
  const platformConfig = await settlemint.platform.config();
275886
276075
  const selectedUseCase = await useCasePrompt(platformConfig, useCase);
275887
276076
  if (!selectedUseCase) {
275888
- cancel("No use case selected. Please select a use case to continue.");
276077
+ return nothingSelectedError("use case");
275889
276078
  }
275890
276079
  const targetDir = formatTargetDir(name2);
275891
276080
  const projectDir = join8(process.cwd(), targetDir);
@@ -276071,6 +276260,60 @@ function hardhatDeployLocalCommand() {
276071
276260
  });
276072
276261
  }
276073
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
+
276074
276317
  // src/commands/smart-contract-set/prompts/address.prompt.ts
276075
276318
  async function addressPrompt({
276076
276319
  env: env2,
@@ -276184,30 +276427,7 @@ function hardhatDeployRemoteCommand() {
276184
276427
  accessToken,
276185
276428
  instance
276186
276429
  });
276187
- const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276188
- let node = undefined;
276189
- if (!nodeUniqueName) {
276190
- const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276191
- const evmNodes = nodes.filter((node2) => node2.isEvm);
276192
- if (evmNodes.length === 0) {
276193
- cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
276194
- }
276195
- const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
276196
- const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
276197
- if (nodesWithActivePrivateKey.length === 0) {
276198
- cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276199
- }
276200
- const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
276201
- if (!blockchainNode) {
276202
- cancel("No EVM blockchain node selected. Please select one to continue.");
276203
- }
276204
- node = blockchainNode;
276205
- } else {
276206
- node = await settlemint.blockchainNode.read(nodeUniqueName);
276207
- if (!node.isEvm) {
276208
- cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
276209
- }
276210
- }
276430
+ const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
276211
276431
  const envConfig = await settlemint.foundry.env(node.uniqueName);
276212
276432
  const hardhatConfig = await getHardhatConfigData(envConfig);
276213
276433
  if (verify && !hardhatConfig?.etherscan?.apiKey) {
@@ -276215,7 +276435,7 @@ function hardhatDeployRemoteCommand() {
276215
276435
  }
276216
276436
  const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
276217
276437
  if (!address) {
276218
- cancel("No private key selected. Please select one to continue.");
276438
+ return nothingSelectedError("private key");
276219
276439
  }
276220
276440
  const { command, args } = await getPackageManagerExecutable();
276221
276441
  await executeCommand(command, [
@@ -276299,16 +276519,8 @@ function hardhatScriptRemoteCommand() {
276299
276519
  accessToken,
276300
276520
  instance
276301
276521
  });
276302
- let nodeUniqueName = blockchainNodeUniqueName;
276303
- if (!nodeUniqueName) {
276304
- const blockchainNodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276305
- const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
276306
- if (!blockchainNode) {
276307
- cancel("No Blockchain Node selected. Please select one to continue.");
276308
- }
276309
- nodeUniqueName = blockchainNode.uniqueName;
276310
- }
276311
- 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);
276312
276524
  const { command, args } = await getPackageManagerExecutable();
276313
276525
  await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env: envConfig });
276314
276526
  });
@@ -276525,8 +276737,11 @@ async function getTheGraphMiddleware({
276525
276737
  return defaultTheGraphMiddleware;
276526
276738
  }
276527
276739
  }
276740
+ if (!env2.SETTLEMINT_APPLICATION) {
276741
+ return missingApplication();
276742
+ }
276528
276743
  const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
276529
- return theGraphPrompt(env2, middlewares, autoAccept);
276744
+ return theGraphPrompt(env2, middlewares, autoAccept, true);
276530
276745
  }
276531
276746
  async function getTheGraphNetwork({
276532
276747
  theGraphMiddleware,
@@ -276634,7 +276849,10 @@ function subgraphDeployCommand() {
276634
276849
  });
276635
276850
  const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
276636
276851
  if (!theGraphMiddleware) {
276637
- 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);
276638
276856
  }
276639
276857
  const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
276640
276858
  await subgraphSetup({
@@ -276737,4 +276955,4 @@ function sdkCliCommand(exitOverride = undefined) {
276737
276955
  ascii();
276738
276956
  sdkCliCommand();
276739
276957
 
276740
- //# debugId=5654333BA10A5E3B64756E2164756E21
276958
+ //# debugId=0F1625D0AFD455D164756E2164756E21