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

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 +551 -366
  2. package/dist/cli.js.map +54 -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.sCw11EyGmn:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19616
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.LQXdwujUdZ:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19617
19617
  pathExt: optPathExt = process.env.PATHEXT,
19618
19618
  delimiter: optDelimiter = delimiter
19619
19619
  }) => {
@@ -19817,7 +19817,7 @@ var require_lib5 = __commonJS((exports, module) => {
19817
19817
  let pathToInitial;
19818
19818
  try {
19819
19819
  pathToInitial = which.sync(initialCmd, {
19820
- path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.sCw11EyGmn:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19820
+ path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.LQXdwujUdZ:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
19821
19821
  pathext: options.env && findInObject(options.env, "PATHEXT") || process.env.PATHEXT
19822
19822
  }).toLowerCase();
19823
19823
  } catch (err) {
@@ -20534,7 +20534,7 @@ var require_lib6 = __commonJS((exports, module) => {
20534
20534
  var rRel = new RegExp(`^\\.${rSlash.source}`);
20535
20535
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
20536
20536
  var getPathInfo = (cmd, {
20537
- path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.sCw11EyGmn:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
20537
+ path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.LQXdwujUdZ:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
20538
20538
  pathExt: optPathExt = process.env.PATHEXT,
20539
20539
  delimiter: optDelimiter = delimiter
20540
20540
  }) => {
@@ -223327,7 +223327,7 @@ ${Bt.cyan(Yt)}
223327
223327
  code: "ENOENT"
223328
223328
  }), getPathInfo = (e9, t7) => {
223329
223329
  var r6 = t7.colon || or;
223330
- var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.sCw11EyGmn:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
223330
+ var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.LQXdwujUdZ:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
223331
223331
  var n6 = nr ? t7.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
223332
223332
  var a5 = nr ? n6.split(r6) : [""];
223333
223333
  if (nr) {
@@ -226464,7 +226464,7 @@ ${whileRunning(e9)}`;
226464
226464
  };
226465
226465
  ni = Object.assign(async function _main() {
226466
226466
  var e9 = new Cli({
226467
- binaryVersion: "0.9.3-pr85e672fd",
226467
+ binaryVersion: "0.9.3-pr928eae3a",
226468
226468
  binaryLabel: "gql.tada CLI",
226469
226469
  binaryName: "gql.tada"
226470
226470
  });
@@ -234964,7 +234964,7 @@ var require_which2 = __commonJS((exports, module) => {
234964
234964
  const colon = opt2.colon || COLON;
234965
234965
  const pathEnv = cmd2.match(/\//) || isWindows2 && cmd2.match(/\\/) ? [""] : [
234966
234966
  ...isWindows2 ? [process.cwd()] : [],
234967
- ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.sCw11EyGmn:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234967
+ ...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.LQXdwujUdZ:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
234968
234968
  ];
234969
234969
  const pathExtExe = isWindows2 ? opt2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
234970
234970
  const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
@@ -256788,7 +256788,7 @@ ${error.stack}`));
256788
256788
  var package_default = {
256789
256789
  name: "@settlemint/sdk-cli",
256790
256790
  description: "SettleMint SDK, integrate SettleMint into your application with ease.",
256791
- version: "0.9.3-pr85e672fd",
256791
+ version: "0.9.3-pr928eae3a",
256792
256792
  type: "module",
256793
256793
  private: false,
256794
256794
  license: "FSL-1.1-MIT",
@@ -256841,8 +256841,8 @@ var package_default = {
256841
256841
  "@inquirer/input": "4.1.1",
256842
256842
  "@inquirer/password": "4.0.4",
256843
256843
  "@inquirer/select": "4.0.4",
256844
- "@settlemint/sdk-js": "0.9.3-pr85e672fd",
256845
- "@settlemint/sdk-utils": "0.9.3-pr85e672fd",
256844
+ "@settlemint/sdk-js": "0.9.3-pr928eae3a",
256845
+ "@settlemint/sdk-utils": "0.9.3-pr928eae3a",
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";
@@ -267732,6 +267738,57 @@ var getApplicationOrPersonalAccessToken = async ({
267732
267738
  // ../../node_modules/@gql.tada/cli-utils/dist/gql-tada-cli.mjs
267733
267739
  init_index_chunk();
267734
267740
 
267741
+ // src/commands/codegen/test-gql-endpoint.ts
267742
+ async function testGqlEndpoint({
267743
+ accessToken,
267744
+ hasuraAdminSecret,
267745
+ gqlEndpoint,
267746
+ isHasura = false,
267747
+ maxRetries = 3
267748
+ }) {
267749
+ if (!gqlEndpoint) {
267750
+ return false;
267751
+ }
267752
+ for (let attempt = 0;attempt < maxRetries; attempt++) {
267753
+ try {
267754
+ const response = await fetch(gqlEndpoint, {
267755
+ method: "POST",
267756
+ headers: {
267757
+ "x-auth-token": accessToken,
267758
+ ...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {},
267759
+ "Content-Type": "application/json"
267760
+ },
267761
+ body: JSON.stringify({
267762
+ query: `
267763
+ query {
267764
+ __schema {
267765
+ types {
267766
+ name
267767
+ }
267768
+ }
267769
+ }
267770
+ `
267771
+ })
267772
+ });
267773
+ if (!response.ok) {
267774
+ throw new Error(`HTTP error! status: ${response.status}`);
267775
+ }
267776
+ const data = await response.json();
267777
+ if (data.errors) {
267778
+ throw new Error("GraphQL errors in response");
267779
+ }
267780
+ return true;
267781
+ } catch (error5) {
267782
+ if (attempt === maxRetries - 1) {
267783
+ return false;
267784
+ }
267785
+ const delay2 = 2 ** attempt * 1000;
267786
+ await new Promise((resolve3) => setTimeout(resolve3, delay2));
267787
+ }
267788
+ }
267789
+ return false;
267790
+ }
267791
+
267735
267792
  // src/commands/codegen/codegen-hasura.ts
267736
267793
  async function codegenHasura(env2) {
267737
267794
  const gqlEndpoint = env2.SETTLEMINT_HASURA_ENDPOINT;
@@ -267747,6 +267804,12 @@ async function codegenHasura(env2) {
267747
267804
  return;
267748
267805
  }
267749
267806
  if (gqlEndpoint && accessToken && adminSecret) {
267807
+ await testGqlEndpoint({
267808
+ accessToken,
267809
+ hasuraAdminSecret: adminSecret,
267810
+ gqlEndpoint,
267811
+ isHasura: true
267812
+ });
267750
267813
  await generateSchema({
267751
267814
  input: gqlEndpoint,
267752
267815
  output: "hasura-schema.graphql",
@@ -267802,6 +267865,10 @@ async function codegenPortal(env2) {
267802
267865
  if (!accessToken) {
267803
267866
  return;
267804
267867
  }
267868
+ await testGqlEndpoint({
267869
+ accessToken,
267870
+ gqlEndpoint
267871
+ });
267805
267872
  await generateSchema({
267806
267873
  input: gqlEndpoint,
267807
267874
  output: "portal-schema.graphql",
@@ -267862,6 +267929,10 @@ async function codegenTheGraph(env2, subgraphNames) {
267862
267929
  for (const gqlEndpoint of toGenerate) {
267863
267930
  const name2 = gqlEndpoint.split("/").pop();
267864
267931
  note(`Generating TheGraph subgraph ${name2}`);
267932
+ await testGqlEndpoint({
267933
+ accessToken,
267934
+ gqlEndpoint
267935
+ });
267865
267936
  await generateSchema({
267866
267937
  input: gqlEndpoint,
267867
267938
  output: `the-graph-schema-${name2}.graphql`,
@@ -267899,51 +267970,6 @@ export const { client: theGraphClient${nameSuffix}, graphql: theGraphGraphql${na
267899
267970
  // src/commands/codegen/codegen-tsconfig.ts
267900
267971
  import { writeFile as writeFile4 } from "node:fs/promises";
267901
267972
 
267902
- // src/commands/codegen/test-gql-endpoint.ts
267903
- async function testGqlEndpoint(accessToken, hasuraAdminSecret, gqlEndpoint, isHasura = false, maxRetries = 3) {
267904
- if (!gqlEndpoint) {
267905
- return false;
267906
- }
267907
- for (let attempt = 0;attempt < maxRetries; attempt++) {
267908
- try {
267909
- const response = await fetch(gqlEndpoint, {
267910
- method: "POST",
267911
- headers: {
267912
- "x-auth-token": accessToken,
267913
- ...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {},
267914
- "Content-Type": "application/json"
267915
- },
267916
- body: JSON.stringify({
267917
- query: `
267918
- query {
267919
- __schema {
267920
- types {
267921
- name
267922
- }
267923
- }
267924
- }
267925
- `
267926
- })
267927
- });
267928
- if (!response.ok) {
267929
- throw new Error(`HTTP error! status: ${response.status}`);
267930
- }
267931
- const data = await response.json();
267932
- if (data.errors) {
267933
- throw new Error("GraphQL errors in response");
267934
- }
267935
- return true;
267936
- } catch (error5) {
267937
- if (attempt === maxRetries - 1) {
267938
- return false;
267939
- }
267940
- const delay2 = 2 ** attempt * 1000;
267941
- await new Promise((resolve3) => setTimeout(resolve3, delay2));
267942
- }
267943
- }
267944
- return false;
267945
- }
267946
-
267947
267973
  // ../../node_modules/get-tsconfig/dist/index.mjs
267948
267974
  import a6 from "node:path";
267949
267975
  import ee2 from "node:fs";
@@ -268843,10 +268869,24 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
268843
268869
  return name2 && (!thegraphSubgraphNames || thegraphSubgraphNames.includes(name2));
268844
268870
  });
268845
268871
  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)
268872
+ testGqlEndpoint({
268873
+ accessToken,
268874
+ hasuraAdminSecret: env2.SETTLEMINT_HASURA_ADMIN_SECRET,
268875
+ gqlEndpoint: env2.SETTLEMINT_HASURA_ENDPOINT,
268876
+ isHasura: true
268877
+ }),
268878
+ testGqlEndpoint({
268879
+ accessToken,
268880
+ gqlEndpoint: env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT
268881
+ }),
268882
+ testGqlEndpoint({
268883
+ accessToken,
268884
+ gqlEndpoint: theGraphEndpoints[0]
268885
+ }),
268886
+ testGqlEndpoint({
268887
+ accessToken,
268888
+ gqlEndpoint: env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT
268889
+ })
268850
268890
  ]);
268851
268891
  if (!tsconfig.config.compilerOptions) {
268852
268892
  tsconfig.config.compilerOptions = {};
@@ -270060,9 +270100,12 @@ async function loadEnvironmentEnv2(validateEnv, prod, path5 = process.cwd()) {
270060
270100
  return {};
270061
270101
  }
270062
270102
  }
270063
- async function projectRoot2() {
270103
+ async function projectRoot2(fallbackToCwd = false) {
270064
270104
  const packageJsonPath = await findUp("package.json");
270065
270105
  if (!packageJsonPath) {
270106
+ if (fallbackToCwd) {
270107
+ return process.cwd();
270108
+ }
270066
270109
  throw new Error("Unable to find project root (no package.json found)");
270067
270110
  }
270068
270111
  return dirname5(packageJsonPath);
@@ -270113,7 +270156,7 @@ async function findMonoRepoPackages(projectDir) {
270113
270156
  }
270114
270157
  }
270115
270158
  async function writeEnv(prod, env2, secrets) {
270116
- const projectDir = await projectRoot2();
270159
+ const projectDir = await projectRoot2(true);
270117
270160
  if (prod) {
270118
270161
  process.env.NODE_ENV = "production";
270119
270162
  }
@@ -270502,7 +270545,7 @@ async function getGraphEndpoint(service, env2) {
270502
270545
  const isStarterKit = (id) => id.endsWith("-starterkits");
270503
270546
  const testEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => !isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
270504
270547
  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;
270548
+ const hasEndpoint = testEndpoint && env2.SETTLEMINT_ACCESS_TOKEN ? await testGqlEndpoint({ accessToken: env2.SETTLEMINT_ACCESS_TOKEN, gqlEndpoint: testEndpoint }) : false;
270506
270549
  const endpoints = hasEndpoint ? service.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue) : starterKitEndpoint ? [starterKitEndpoint] : [];
270507
270550
  if (endpoints.length === 0) {
270508
270551
  return {};
@@ -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,146 +272923,170 @@ 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) {
272954
+ return servicePrompt({
272955
+ env: env2,
272956
+ services: nodes,
272957
+ accept,
272958
+ envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
272959
+ defaultHandler: async ({ defaultService: defaultNode }) => {
272960
+ return esm_default2({
272961
+ message: "Which blockchain node do you want to connect to?",
272962
+ choices: [
272963
+ ...nodes.map((node) => ({
272964
+ name: node.name,
272965
+ value: node
272966
+ })),
272967
+ {
272968
+ name: "None",
272969
+ value: undefined
272970
+ }
272971
+ ],
272972
+ default: defaultNode
272973
+ });
272974
+ }
272896
272975
  });
272897
- return node;
272898
272976
  }
272899
272977
 
272900
272978
  // src/commands/connect/blockscout.prompt.ts
272901
272979
  async function blockscoutPrompt(env2, insights, accept) {
272902
272980
  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
272981
+ return servicePrompt({
272982
+ env: env2,
272983
+ services: possible,
272984
+ accept,
272985
+ envKey: "SETTLEMINT_BLOCKSCOUT",
272986
+ defaultHandler: async ({ defaultService: defaultBlockscout }) => {
272987
+ return esm_default2({
272988
+ message: "Which blockscout instance do you want to connect to?",
272989
+ choices: [
272990
+ ...possible.map((insight) => ({
272991
+ name: insight.name,
272992
+ value: insight
272993
+ })),
272994
+ {
272995
+ name: "None",
272996
+ value: undefined
272997
+ }
272998
+ ],
272999
+ default: defaultBlockscout
273000
+ });
273001
+ }
272924
273002
  });
272925
- return blockscout;
272926
273003
  }
272927
273004
 
272928
273005
  // src/commands/connect/custom-deployment.prompt.ts
272929
273006
  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
273007
+ return servicePrompt({
273008
+ env: env2,
273009
+ services: customDeployments,
273010
+ accept,
273011
+ envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
273012
+ defaultHandler: async ({
273013
+ defaultService: defaultCustomDeployment
273014
+ }) => {
273015
+ return esm_default2({
273016
+ message: "Which Custom Deployment do you want to connect to?",
273017
+ choices: [
273018
+ ...customDeployments.map((customDeployment) => ({
273019
+ name: customDeployment.name,
273020
+ value: customDeployment
273021
+ })),
273022
+ {
273023
+ name: "None",
273024
+ value: undefined
273025
+ }
273026
+ ],
273027
+ default: defaultCustomDeployment
273028
+ });
273029
+ }
272951
273030
  });
272952
- return middleware;
272953
273031
  }
272954
273032
 
272955
273033
  // src/commands/connect/hasura.prompt.ts
272956
273034
  async function hasuraPrompt(env2, integrations, accept) {
272957
273035
  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
273036
+ return servicePrompt({
273037
+ env: env2,
273038
+ services: possible,
273039
+ accept,
273040
+ envKey: "SETTLEMINT_HASURA",
273041
+ defaultHandler: async ({ defaultService: defaultHasura }) => {
273042
+ return esm_default2({
273043
+ message: "Which Hasura instance do you want to connect to?",
273044
+ choices: [
273045
+ ...possible.map((integration) => ({
273046
+ name: integration.name,
273047
+ value: integration
273048
+ })),
273049
+ {
273050
+ name: "None",
273051
+ value: undefined
273052
+ }
273053
+ ],
273054
+ default: defaultHasura
273055
+ });
273056
+ }
272979
273057
  });
272980
- return hasura;
272981
273058
  }
272982
273059
 
272983
273060
  // src/commands/connect/hd-private-keys.prompt.ts
272984
273061
  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
273062
+ const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
273063
+ return servicePrompt({
273064
+ env: env2,
273065
+ services: possible,
273066
+ accept,
273067
+ envKey: "SETTLEMINT_HD_PRIVATE_KEY",
273068
+ defaultHandler: async ({ defaultService: defaultPrivateKey }) => {
273069
+ return esm_default2({
273070
+ message: "Which HD Private Key do you want to use?",
273071
+ choices: [
273072
+ ...possible.map((privateKey) => ({
273073
+ name: privateKey.name,
273074
+ value: privateKey
273075
+ })),
273076
+ {
273077
+ name: "None",
273078
+ value: undefined
273079
+ }
273080
+ ],
273081
+ default: defaultPrivateKey
273082
+ });
273083
+ }
273007
273084
  });
273008
- return privateKey;
273009
273085
  }
273010
273086
 
273011
273087
  // src/commands/connect/instance.prompt.ts
273012
273088
  async function instancePrompt(env2, accept) {
273089
+ const autoAccept = !!accept || is_in_ci_default;
273013
273090
  const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
273014
273091
  const defaultPossible = accept && defaultInstance;
273015
273092
  if (defaultPossible) {
@@ -273034,85 +273111,82 @@ async function instancePrompt(env2, accept) {
273034
273111
  // src/commands/connect/ipfs.prompt.ts
273035
273112
  async function ipfsPrompt(env2, storages, accept) {
273036
273113
  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
273114
+ return servicePrompt({
273115
+ env: env2,
273116
+ services: possible,
273117
+ accept,
273118
+ envKey: "SETTLEMINT_IPFS",
273119
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273120
+ return esm_default2({
273121
+ message: "Which IPFS instance do you want to connect to?",
273122
+ choices: [
273123
+ ...possible.map((storage) => ({
273124
+ name: storage.name,
273125
+ value: storage
273126
+ })),
273127
+ {
273128
+ name: "None",
273129
+ value: undefined
273130
+ }
273131
+ ],
273132
+ default: defaultStorage
273133
+ });
273134
+ }
273058
273135
  });
273059
- return minio;
273060
273136
  }
273061
273137
 
273062
273138
  // src/commands/connect/minio.prompt.ts
273063
273139
  async function minioPrompt(env2, storages, accept) {
273064
273140
  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
273141
+ return servicePrompt({
273142
+ env: env2,
273143
+ services: possible,
273144
+ accept,
273145
+ envKey: "SETTLEMINT_MINIO",
273146
+ defaultHandler: async ({ defaultService: defaultStorage }) => {
273147
+ return esm_default2({
273148
+ message: "Which MinIO instance do you want to connect to?",
273149
+ choices: [
273150
+ ...possible.map((storage) => ({
273151
+ name: storage.name,
273152
+ value: storage
273153
+ })),
273154
+ {
273155
+ name: "None",
273156
+ value: undefined
273157
+ }
273158
+ ],
273159
+ default: defaultStorage
273160
+ });
273161
+ }
273086
273162
  });
273087
- return minio;
273088
273163
  }
273089
273164
 
273090
273165
  // src/commands/connect/portal.prompt.ts
273091
273166
  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
273167
+ const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
273168
+ return servicePrompt({
273169
+ env: env2,
273170
+ services: possible,
273171
+ accept,
273172
+ envKey: "SETTLEMINT_PORTAL",
273173
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273174
+ return esm_default2({
273175
+ message: "Which Smart Contract Portal instance do you want to connect to?",
273176
+ choices: [
273177
+ ...possible.map((middleware) => ({
273178
+ name: middleware.name,
273179
+ value: middleware
273180
+ })),
273181
+ {
273182
+ name: "None",
273183
+ value: undefined
273184
+ }
273185
+ ],
273186
+ default: defaultMiddleware
273187
+ });
273188
+ }
273114
273189
  });
273115
- return middleware;
273116
273190
  }
273117
273191
 
273118
273192
  // src/commands/connect/services.spinner.ts
@@ -273156,42 +273230,45 @@ async function servicesSpinner(settlemint, application) {
273156
273230
 
273157
273231
  // src/commands/connect/thegraph.prompt.ts
273158
273232
  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
273233
+ const possible = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
273234
+ return servicePrompt({
273235
+ env: env2,
273236
+ services: possible,
273237
+ accept,
273238
+ envKey: "SETTLEMINT_THEGRAPH",
273239
+ defaultHandler: async ({ defaultService: defaultMiddleware }) => {
273240
+ return esm_default2({
273241
+ message: "Which The Graph instance do you want to connect to?",
273242
+ choices: [
273243
+ ...possible.map((middleware) => ({
273244
+ name: middleware.name,
273245
+ value: middleware
273246
+ })),
273247
+ {
273248
+ name: "None",
273249
+ value: undefined
273250
+ }
273251
+ ],
273252
+ default: defaultMiddleware
273253
+ });
273254
+ }
273181
273255
  });
273182
- return middleware;
273183
273256
  }
273184
273257
 
273185
273258
  // src/commands/connect/workspace.prompt.ts
273186
273259
  async function workspacePrompt(env2, workspaces, accept) {
273260
+ const autoAccept = !!accept || is_in_ci_default;
273187
273261
  const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
273188
- const defaultPossible = accept && defaultWorkspace;
273262
+ const defaultPossible = autoAccept && defaultWorkspace;
273189
273263
  if (defaultPossible) {
273190
273264
  return defaultWorkspace;
273191
273265
  }
273192
273266
  if (workspaces.length === 0) {
273193
273267
  cancel2("No workspaces found");
273194
273268
  }
273269
+ if (is_in_ci_default) {
273270
+ nothingSelectedError("workspace");
273271
+ }
273195
273272
  const workspace = await esm_default2({
273196
273273
  message: "Which workspace do you want to connect to?",
273197
273274
  choices: workspaces.map((workspace2) => ({
@@ -273210,9 +273287,8 @@ async function workspacePrompt(env2, workspaces, accept) {
273210
273287
  function connectCommand() {
273211
273288
  return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod }) => {
273212
273289
  intro("Connecting your dApp to SettleMint");
273213
- const autoAccept = !!acceptDefaults || is_in_ci_default;
273214
273290
  const env2 = await loadEnv2(false, !!prod);
273215
- const instance = await instancePrompt(env2, autoAccept);
273291
+ const instance = await instancePrompt(env2, acceptDefaults);
273216
273292
  const personalAccessToken = await getInstanceCredentials(instance);
273217
273293
  if (!personalAccessToken) {
273218
273294
  return missingPersonalAccessTokenError();
@@ -273223,20 +273299,20 @@ function connectCommand() {
273223
273299
  instance
273224
273300
  });
273225
273301
  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);
273302
+ const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
273303
+ const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
273304
+ const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
273229
273305
  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) {
273306
+ const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
273307
+ const hasura = await hasuraPrompt(env2, integrationTool, acceptDefaults);
273308
+ const thegraph = await theGraphPrompt(env2, middleware, acceptDefaults);
273309
+ const portal = await portalPrompt(env2, middleware, acceptDefaults);
273310
+ const ipfs = await ipfsPrompt(env2, storage, acceptDefaults);
273311
+ const minio = await minioPrompt(env2, storage, acceptDefaults);
273312
+ const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, acceptDefaults);
273313
+ const cDeployment = await customDeploymentPrompt(env2, customDeployment, acceptDefaults);
273314
+ const blockscout = await blockscoutPrompt(env2, insights, acceptDefaults);
273315
+ if (acceptDefaults) {
273240
273316
  const selectedServices = [
273241
273317
  `Workspace: ${workspace.name}`,
273242
273318
  `Application: ${application.name}`,
@@ -273340,9 +273416,12 @@ import { dirname as dirname6 } from "node:path";
273340
273416
  import { stat as stat8 } from "node:fs/promises";
273341
273417
  var import_package_json3 = __toESM(require_lib12(), 1);
273342
273418
  var import_package_json4 = __toESM(require_lib12(), 1);
273343
- async function projectRoot3() {
273419
+ async function projectRoot3(fallbackToCwd = false) {
273344
273420
  const packageJsonPath = await findUp("package.json");
273345
273421
  if (!packageJsonPath) {
273422
+ if (fallbackToCwd) {
273423
+ return process.cwd();
273424
+ }
273346
273425
  throw new Error("Unable to find project root (no package.json found)");
273347
273426
  }
273348
273427
  return dirname6(packageJsonPath);
@@ -274103,7 +274182,7 @@ function createCommand2() {
274103
274182
  }
274104
274183
  const selectedTemplate = await templatePrompt(templates, template);
274105
274184
  if (!selectedTemplate) {
274106
- cancel("No template selected. Please select a template to continue.");
274185
+ return nothingSelectedError("template");
274107
274186
  }
274108
274187
  await spinner({
274109
274188
  startMessage: "Scaffolding the project",
@@ -274435,11 +274514,11 @@ function getCreateCommand({
274435
274514
  if (requiresDeployment) {
274436
274515
  const selectedProvider = await providerPrompt(platformConfig, provider);
274437
274516
  if (!selectedProvider) {
274438
- cancel("No provider selected. Please select a provider to continue.");
274517
+ return nothingSelectedError("provider");
274439
274518
  }
274440
274519
  const selectedRegion = await regionPrompt(selectedProvider, region);
274441
274520
  if (!selectedRegion) {
274442
- cancel("No region selected. Please select a region to continue.");
274521
+ return nothingSelectedError("region");
274443
274522
  }
274444
274523
  }
274445
274524
  const { result, waitFor, mapDefaultEnv } = await spinner({
@@ -274515,6 +274594,9 @@ function blockchainNetworkBesuCreateCommand() {
274515
274594
  region
274516
274595
  }, async (settlemint, env2) => {
274517
274596
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274597
+ if (!applicationUniqueName) {
274598
+ return missingApplication();
274599
+ }
274518
274600
  const result = await settlemint.blockchainNetwork.create({
274519
274601
  name: name2,
274520
274602
  applicationUniqueName,
@@ -274722,6 +274804,9 @@ function applicationAccessTokenCreateCommand() {
274722
274804
  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
274805
  return baseAction(defaultArgs, async (settlemint, env2) => {
274724
274806
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274807
+ if (!applicationUniqueName) {
274808
+ return missingApplication();
274809
+ }
274725
274810
  const aatToken = await settlemint.applicationAccessToken.create({
274726
274811
  applicationUniqueName,
274727
274812
  name: name2,
@@ -274774,6 +274859,7 @@ function applicationAccessTokenCreateCommand() {
274774
274859
  uniqueName: ""
274775
274860
  },
274776
274861
  mapDefaultEnv: () => ({
274862
+ SETTLEMINT_APPLICATION: applicationUniqueName,
274777
274863
  SETTLEMINT_ACCESS_TOKEN: aatToken
274778
274864
  })
274779
274865
  };
@@ -274805,11 +274891,23 @@ function applicationCreateCommand() {
274805
274891
  type: "application",
274806
274892
  alias: "a",
274807
274893
  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) => {
274894
+ 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 }) => {
274895
+ return baseAction({
274896
+ ...defaultArgs,
274897
+ acceptDefaults
274898
+ }, async (settlemint, env2) => {
274899
+ let workspaceUniqueName = workspace;
274900
+ if (!workspaceUniqueName) {
274901
+ const workspaces = await settlemint.workspace.list();
274902
+ const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
274903
+ if (!workspace2) {
274904
+ return nothingSelectedError("workspace");
274905
+ }
274906
+ workspaceUniqueName = workspace2.uniqueName;
274907
+ }
274810
274908
  const result = await settlemint.application.create({
274811
274909
  name: name2,
274812
- workspaceUniqueName: workspace ?? env2.SETTLEMINT_WORKSPACE
274910
+ workspaceUniqueName
274813
274911
  });
274814
274912
  return {
274815
274913
  result,
@@ -274842,27 +274940,27 @@ function applicationCreateCommand() {
274842
274940
 
274843
274941
  // src/commands/connect/blockchain-network.prompt.ts
274844
274942
  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
274943
+ return servicePrompt({
274944
+ env: env2,
274945
+ services: networks,
274946
+ accept,
274947
+ envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
274948
+ defaultHandler: async ({ defaultService: defaultNetwork }) => {
274949
+ return esm_default2({
274950
+ message: "Which blockchain network do you want to connect to?",
274951
+ choices: [
274952
+ ...networks.map((network) => ({
274953
+ name: network.name,
274954
+ value: network
274955
+ })),
274956
+ {
274957
+ name: "None",
274958
+ value: undefined
274959
+ }
274960
+ ],
274961
+ default: defaultNetwork
274962
+ });
274963
+ }
274866
274964
  });
274867
274965
  }
274868
274966
 
@@ -274891,19 +274989,18 @@ function blockchainNodeBesuCreateCommand() {
274891
274989
  provider,
274892
274990
  region
274893
274991
  }, async (settlemint, env2) => {
274894
- const autoAccept = !!acceptDefaults || is_in_ci_default;
274895
274992
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274896
274993
  if (!applicationUniqueName) {
274897
- cancel("No application found. Please specify an application or run `settlemint connect` to continue.");
274994
+ return missingApplication();
274898
274995
  }
274899
- let networkUniqueName = blockchainNetwork ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NETWORK : undefined);
274996
+ let networkUniqueName = blockchainNetwork;
274900
274997
  if (!networkUniqueName) {
274901
274998
  const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
274902
- const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults ?? false);
274999
+ const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
274903
275000
  if (!network) {
274904
- cancel("No network found. Please specify a network to continue.");
275001
+ return nothingSelectedError("blockchain network");
274905
275002
  }
274906
- networkUniqueName = network?.id;
275003
+ networkUniqueName = network?.uniqueName;
274907
275004
  }
274908
275005
  const result = await settlemint.blockchainNode.create({
274909
275006
  applicationUniqueName,
@@ -274921,7 +275018,7 @@ function blockchainNodeBesuCreateCommand() {
274921
275018
  mapDefaultEnv: () => {
274922
275019
  return {
274923
275020
  SETTLEMINT_APPLICATION: applicationUniqueName,
274924
- SETTLEMINT_BLOCKCHAIN_NODE: result.id
275021
+ SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
274925
275022
  };
274926
275023
  }
274927
275024
  };
@@ -274957,15 +275054,27 @@ function blockscoutInsightsCreateCommand() {
274957
275054
  type: "insights",
274958
275055
  alias: "bs",
274959
275056
  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 }) => {
275057
+ 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
275058
  return baseAction({
274962
275059
  ...defaultArgs,
275060
+ acceptDefaults,
274963
275061
  provider,
274964
275062
  region
274965
275063
  }, async (settlemint, env2) => {
274966
275064
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
274967
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275065
+ if (!applicationUniqueName) {
275066
+ return missingApplication();
275067
+ }
275068
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
274968
275069
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275070
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275071
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275072
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275073
+ if (!node) {
275074
+ return nothingSelectedError("blockchain node");
275075
+ }
275076
+ blockchainNodeUniqueName = node.uniqueName;
275077
+ }
274969
275078
  const result = await settlemint.insights.create({
274970
275079
  name: name2,
274971
275080
  applicationUniqueName,
@@ -275024,6 +275133,9 @@ function hasuraIntegrationCreateCommand() {
275024
275133
  region
275025
275134
  }, async (settlemint, env2) => {
275026
275135
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275136
+ if (!applicationUniqueName) {
275137
+ return missingApplication();
275138
+ }
275027
275139
  const result = await settlemint.integrationTool.create({
275028
275140
  name: name2,
275029
275141
  applicationUniqueName,
@@ -275073,14 +275185,26 @@ function graphMiddlewareCreateCommand() {
275073
275185
  type: "middleware",
275074
275186
  alias: "gr",
275075
275187
  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 }) => {
275188
+ 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
275189
  return baseAction({
275078
275190
  ...defaultArgs,
275191
+ acceptDefaults,
275079
275192
  provider,
275080
275193
  region
275081
275194
  }, async (settlemint, env2) => {
275082
275195
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275083
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275196
+ if (!applicationUniqueName) {
275197
+ return missingApplication();
275198
+ }
275199
+ let blockchainNodeUniqueName = blockchainNode;
275200
+ if (!blockchainNodeUniqueName) {
275201
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275202
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275203
+ if (!node) {
275204
+ return nothingSelectedError("blockchain node");
275205
+ }
275206
+ blockchainNodeUniqueName = node.uniqueName;
275207
+ }
275084
275208
  const result = await settlemint.middleware.create({
275085
275209
  name: name2,
275086
275210
  applicationUniqueName,
@@ -275136,16 +275260,29 @@ function smartContractPortalMiddlewareCreateCommand() {
275136
275260
  type: type4,
275137
275261
  includePredeployedAbis,
275138
275262
  abis,
275263
+ acceptDefaults,
275139
275264
  ...defaultArgs
275140
275265
  }) => {
275141
275266
  return baseAction({
275142
275267
  ...defaultArgs,
275268
+ acceptDefaults,
275143
275269
  provider,
275144
275270
  region
275145
275271
  }, async (settlemint, env2) => {
275146
275272
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275147
- const blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275273
+ if (!applicationUniqueName) {
275274
+ return missingApplication();
275275
+ }
275276
+ let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275148
275277
  const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
275278
+ if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
275279
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275280
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275281
+ if (!node) {
275282
+ return nothingSelectedError("blockchain node");
275283
+ }
275284
+ blockchainNodeUniqueName = node.uniqueName;
275285
+ }
275149
275286
  const parsedAbis = [];
275150
275287
  if (abis && abis.length > 0) {
275151
275288
  try {
@@ -275218,14 +275355,26 @@ function privateKeyHdCreateCommand() {
275218
275355
  type: "private key",
275219
275356
  alias: "hd",
275220
275357
  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 }) => {
275358
+ 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
275359
  return baseAction({
275223
275360
  ...defaultArgs,
275361
+ acceptDefaults,
275224
275362
  provider,
275225
275363
  region
275226
275364
  }, async (settlemint, env2) => {
275227
275365
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275228
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275366
+ if (!applicationUniqueName) {
275367
+ return missingApplication();
275368
+ }
275369
+ let blockchainNodeUniqueName = blockchainNode;
275370
+ if (!blockchainNodeUniqueName) {
275371
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275372
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275373
+ if (!node) {
275374
+ return nothingSelectedError("blockchain node");
275375
+ }
275376
+ blockchainNodeUniqueName = node.uniqueName;
275377
+ }
275229
275378
  const result = await settlemint.privateKey.create({
275230
275379
  name: name2,
275231
275380
  applicationUniqueName,
@@ -275272,14 +275421,26 @@ function privateKeyHsmCreateCommand() {
275272
275421
  type: "private key",
275273
275422
  alias: "hd",
275274
275423
  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 }) => {
275424
+ 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
275425
  return baseAction({
275277
275426
  ...defaultArgs,
275427
+ acceptDefaults,
275278
275428
  provider,
275279
275429
  region
275280
275430
  }, async (settlemint, env2) => {
275281
275431
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275282
- const blockchainNodeUniqueName = blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
275432
+ if (!applicationUniqueName) {
275433
+ return missingApplication();
275434
+ }
275435
+ let blockchainNodeUniqueName = blockchainNode;
275436
+ if (!blockchainNodeUniqueName) {
275437
+ const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
275438
+ const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
275439
+ if (!node) {
275440
+ return nothingSelectedError("blockchain node");
275441
+ }
275442
+ blockchainNodeUniqueName = node.uniqueName;
275443
+ }
275283
275444
  const result = await settlemint.privateKey.create({
275284
275445
  name: name2,
275285
275446
  applicationUniqueName,
@@ -275332,6 +275493,9 @@ function ipfsStorageCreateCommand() {
275332
275493
  region
275333
275494
  }, async (settlemint, env2) => {
275334
275495
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275496
+ if (!applicationUniqueName) {
275497
+ return missingApplication();
275498
+ }
275335
275499
  const result = await settlemint.storage.create({
275336
275500
  name: name2,
275337
275501
  applicationUniqueName,
@@ -275381,6 +275545,9 @@ function minioStorageCreateCommand() {
275381
275545
  region
275382
275546
  }, async (settlemint, env2) => {
275383
275547
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
275548
+ if (!applicationUniqueName) {
275549
+ return missingApplication();
275550
+ }
275384
275551
  const result = await settlemint.storage.create({
275385
275552
  name: name2,
275386
275553
  applicationUniqueName,
@@ -275474,9 +275641,8 @@ function getDeleteCommand({
275474
275641
  if (!force) {
275475
275642
  await deleteConfirmationPrompt(`this ${type4}`);
275476
275643
  }
275477
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275478
275644
  const env2 = await loadEnv2(false, !!prod);
275479
- const instance = await instancePrompt(env2, autoAccept);
275645
+ const instance = await instancePrompt(env2, acceptDefaults);
275480
275646
  const accessToken = await getApplicationOrPersonalAccessToken({
275481
275647
  env: env2,
275482
275648
  instance,
@@ -275569,9 +275735,8 @@ function getRestartCommand({
275569
275735
  }
275570
275736
  ])).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
275737
  intro(`Restarting ${type4} in the SettleMint platform`);
275572
- const autoAccept = !!acceptDefaults || is_in_ci_default;
275573
275738
  const env2 = await loadEnv2(false, !!prod);
275574
- const instance = await instancePrompt(env2, autoAccept);
275739
+ const instance = await instancePrompt(env2, acceptDefaults);
275575
275740
  const accessToken = await getApplicationOrPersonalAccessToken({
275576
275741
  env: env2,
275577
275742
  instance,
@@ -275885,7 +276050,7 @@ function createCommand4() {
275885
276050
  const platformConfig = await settlemint.platform.config();
275886
276051
  const selectedUseCase = await useCasePrompt(platformConfig, useCase);
275887
276052
  if (!selectedUseCase) {
275888
- cancel("No use case selected. Please select a use case to continue.");
276053
+ return nothingSelectedError("use case");
275889
276054
  }
275890
276055
  const targetDir = formatTargetDir(name2);
275891
276056
  const projectDir = join8(process.cwd(), targetDir);
@@ -276071,6 +276236,51 @@ function hardhatDeployLocalCommand() {
276071
276236
  });
276072
276237
  }
276073
276238
 
276239
+ // src/error/service-not-running-error.ts
276240
+ function serviceNotRunningError(service, status) {
276241
+ return cancel2(`The ${service} service is not in a Running state (status: ${status}).`);
276242
+ }
276243
+
276244
+ // src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
276245
+ async function selectTargetNode({
276246
+ env: env2,
276247
+ blockchainNodeUniqueName,
276248
+ autoAccept,
276249
+ settlemint
276250
+ }) {
276251
+ const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
276252
+ let node = undefined;
276253
+ if (!nodeUniqueName) {
276254
+ if (!env2.SETTLEMINT_APPLICATION) {
276255
+ return missingApplication();
276256
+ }
276257
+ const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
276258
+ const evmNodes = nodes.filter((node2) => node2.isEvm);
276259
+ if (evmNodes.length === 0) {
276260
+ cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
276261
+ }
276262
+ const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
276263
+ const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
276264
+ if (nodesWithActivePrivateKey.length === 0) {
276265
+ cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
276266
+ }
276267
+ const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
276268
+ if (!blockchainNode) {
276269
+ return nothingSelectedError("EVM blockchain node");
276270
+ }
276271
+ node = blockchainNode;
276272
+ } else {
276273
+ node = await settlemint.blockchainNode.read(nodeUniqueName);
276274
+ if (!node.isEvm) {
276275
+ cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
276276
+ }
276277
+ }
276278
+ if (node.status !== "COMPLETED") {
276279
+ serviceNotRunningError("blockchain node", node.status);
276280
+ }
276281
+ return node;
276282
+ }
276283
+
276074
276284
  // src/commands/smart-contract-set/prompts/address.prompt.ts
276075
276285
  async function addressPrompt({
276076
276286
  env: env2,
@@ -276184,30 +276394,7 @@ function hardhatDeployRemoteCommand() {
276184
276394
  accessToken,
276185
276395
  instance
276186
276396
  });
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
- }
276397
+ const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
276211
276398
  const envConfig = await settlemint.foundry.env(node.uniqueName);
276212
276399
  const hardhatConfig = await getHardhatConfigData(envConfig);
276213
276400
  if (verify && !hardhatConfig?.etherscan?.apiKey) {
@@ -276215,7 +276402,7 @@ function hardhatDeployRemoteCommand() {
276215
276402
  }
276216
276403
  const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
276217
276404
  if (!address) {
276218
- cancel("No private key selected. Please select one to continue.");
276405
+ return nothingSelectedError("private key");
276219
276406
  }
276220
276407
  const { command, args } = await getPackageManagerExecutable();
276221
276408
  await executeCommand(command, [
@@ -276299,16 +276486,8 @@ function hardhatScriptRemoteCommand() {
276299
276486
  accessToken,
276300
276487
  instance
276301
276488
  });
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);
276489
+ const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
276490
+ const envConfig = await settlemint.foundry.env(node.uniqueName);
276312
276491
  const { command, args } = await getPackageManagerExecutable();
276313
276492
  await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env: envConfig });
276314
276493
  });
@@ -276525,6 +276704,9 @@ async function getTheGraphMiddleware({
276525
276704
  return defaultTheGraphMiddleware;
276526
276705
  }
276527
276706
  }
276707
+ if (!env2.SETTLEMINT_APPLICATION) {
276708
+ return missingApplication();
276709
+ }
276528
276710
  const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
276529
276711
  return theGraphPrompt(env2, middlewares, autoAccept);
276530
276712
  }
@@ -276634,7 +276816,10 @@ function subgraphDeployCommand() {
276634
276816
  });
276635
276817
  const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
276636
276818
  if (!theGraphMiddleware) {
276637
- cancel("No Graph Middleware selected. Please select one to continue.");
276819
+ return nothingSelectedError("graph middleware");
276820
+ }
276821
+ if (theGraphMiddleware.status !== "COMPLETED") {
276822
+ serviceNotRunningError("graph middleware", theGraphMiddleware.status);
276638
276823
  }
276639
276824
  const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
276640
276825
  await subgraphSetup({
@@ -276737,4 +276922,4 @@ function sdkCliCommand(exitOverride = undefined) {
276737
276922
  ascii();
276738
276923
  sdkCliCommand();
276739
276924
 
276740
- //# debugId=C85F1DF1902E5ECA64756E2164756E21
276925
+ //# debugId=1C924CF2E2DC954664756E2164756E21