@settlemint/sdk-cli 1.0.9-pr24c97cf1 → 1.0.9-pr35556316

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.
package/dist/cli.js CHANGED
@@ -34802,7 +34802,7 @@ var require_cjs = __commonJS((exports) => {
34802
34802
  exports.sync = impl.sync;
34803
34803
  });
34804
34804
 
34805
- // ../../node_modules/@npmcli/promise-spawn/node_modules/which/lib/index.js
34805
+ // ../../node_modules/which/lib/index.js
34806
34806
  var require_lib4 = __commonJS((exports, module) => {
34807
34807
  var { isexe, sync: isexeSync } = require_cjs();
34808
34808
  var { join: join4, delimiter, sep: sep2, posix: posix2 } = __require("path");
@@ -35723,93 +35723,9 @@ var require_opts = __commonJS((exports, module) => {
35723
35723
  module.exports.loadGitConfig = loadGitConfig;
35724
35724
  });
35725
35725
 
35726
- // ../../node_modules/@npmcli/git/node_modules/which/lib/index.js
35727
- var require_lib6 = __commonJS((exports, module) => {
35728
- var { isexe, sync: isexeSync } = require_cjs();
35729
- var { join: join4, delimiter, sep: sep2, posix: posix2 } = __require("path");
35730
- var isWindows2 = process.platform === "win32";
35731
- var rSlash = new RegExp(`[${posix2.sep}${sep2 === posix2.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
35732
- var rRel = new RegExp(`^\\.${rSlash.source}`);
35733
- var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
35734
- var getPathInfo = (cmd, {
35735
- path: optPath = process.env.PATH,
35736
- pathExt: optPathExt = process.env.PATHEXT,
35737
- delimiter: optDelimiter = delimiter
35738
- }) => {
35739
- const pathEnv = cmd.match(rSlash) ? [""] : [
35740
- ...isWindows2 ? [process.cwd()] : [],
35741
- ...(optPath || "").split(optDelimiter)
35742
- ];
35743
- if (isWindows2) {
35744
- const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
35745
- const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
35746
- if (cmd.includes(".") && pathExt[0] !== "") {
35747
- pathExt.unshift("");
35748
- }
35749
- return { pathEnv, pathExt, pathExtExe };
35750
- }
35751
- return { pathEnv, pathExt: [""] };
35752
- };
35753
- var getPathPart = (raw, cmd) => {
35754
- const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
35755
- const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
35756
- return prefix + join4(pathPart, cmd);
35757
- };
35758
- var which = async (cmd, opt = {}) => {
35759
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
35760
- const found = [];
35761
- for (const envPart of pathEnv) {
35762
- const p = getPathPart(envPart, cmd);
35763
- for (const ext2 of pathExt) {
35764
- const withExt = p + ext2;
35765
- const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true });
35766
- if (is) {
35767
- if (!opt.all) {
35768
- return withExt;
35769
- }
35770
- found.push(withExt);
35771
- }
35772
- }
35773
- }
35774
- if (opt.all && found.length) {
35775
- return found;
35776
- }
35777
- if (opt.nothrow) {
35778
- return null;
35779
- }
35780
- throw getNotFoundError(cmd);
35781
- };
35782
- var whichSync = (cmd, opt = {}) => {
35783
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
35784
- const found = [];
35785
- for (const pathEnvPart of pathEnv) {
35786
- const p = getPathPart(pathEnvPart, cmd);
35787
- for (const ext2 of pathExt) {
35788
- const withExt = p + ext2;
35789
- const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
35790
- if (is) {
35791
- if (!opt.all) {
35792
- return withExt;
35793
- }
35794
- found.push(withExt);
35795
- }
35796
- }
35797
- }
35798
- if (opt.all && found.length) {
35799
- return found;
35800
- }
35801
- if (opt.nothrow) {
35802
- return null;
35803
- }
35804
- throw getNotFoundError(cmd);
35805
- };
35806
- module.exports = which;
35807
- which.sync = whichSync;
35808
- });
35809
-
35810
35726
  // ../../node_modules/@npmcli/git/lib/which.js
35811
35727
  var require_which = __commonJS((exports, module) => {
35812
- var which = require_lib6();
35728
+ var which = require_lib4();
35813
35729
  var gitPath;
35814
35730
  try {
35815
35731
  gitPath = which.sync("git");
@@ -37320,7 +37236,7 @@ var require_utils7 = __commonJS((exports) => {
37320
37236
  });
37321
37237
 
37322
37238
  // ../../node_modules/npm-package-arg/node_modules/validate-npm-package-name/lib/index.js
37323
- var require_lib7 = __commonJS((exports, module) => {
37239
+ var require_lib6 = __commonJS((exports, module) => {
37324
37240
  var { builtinModules: builtins } = __require("module");
37325
37241
  var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
37326
37242
  var blacklist = [
@@ -37412,7 +37328,7 @@ var require_npa = __commonJS((exports, module) => {
37412
37328
  var HostedGit = require_lib3();
37413
37329
  var semver = require_semver2();
37414
37330
  var path5 = global.FAKE_WINDOWS ? __require("path").win32 : __require("path");
37415
- var validatePackageName = require_lib7();
37331
+ var validatePackageName = require_lib6();
37416
37332
  var { homedir } = __require("os");
37417
37333
  var { log } = require_lib2();
37418
37334
  var isWindows2 = process.platform === "win32" || global.FAKE_WINDOWS;
@@ -37951,7 +37867,7 @@ var require_dev_engines = __commonJS((exports, module) => {
37951
37867
  });
37952
37868
 
37953
37869
  // ../../node_modules/npm-install-checks/lib/index.js
37954
- var require_lib8 = __commonJS((exports, module) => {
37870
+ var require_lib7 = __commonJS((exports, module) => {
37955
37871
  var semver = require_semver2();
37956
37872
  var currentEnv = require_current_env();
37957
37873
  var { checkDevEngines } = require_dev_engines();
@@ -38035,7 +37951,7 @@ var require_lib8 = __commonJS((exports, module) => {
38035
37951
  });
38036
37952
 
38037
37953
  // ../../node_modules/npm-normalize-package-bin/lib/index.js
38038
- var require_lib9 = __commonJS((exports, module) => {
37954
+ var require_lib8 = __commonJS((exports, module) => {
38039
37955
  var { join: join4, basename } = __require("path");
38040
37956
  var normalize2 = (pkg) => !pkg.bin ? removeBin(pkg) : typeof pkg.bin === "string" ? normalizeString(pkg) : Array.isArray(pkg.bin) ? normalizeArray(pkg) : typeof pkg.bin === "object" ? normalizeObject(pkg) : removeBin(pkg);
38041
37957
  var normalizeString = (pkg) => {
@@ -38083,11 +37999,11 @@ var require_lib9 = __commonJS((exports, module) => {
38083
37999
  });
38084
38000
 
38085
38001
  // ../../node_modules/npm-pick-manifest/lib/index.js
38086
- var require_lib10 = __commonJS((exports, module) => {
38002
+ var require_lib9 = __commonJS((exports, module) => {
38087
38003
  var npa = require_npa();
38088
38004
  var semver = require_semver2();
38089
- var { checkEngine } = require_lib8();
38090
- var normalizeBin = require_lib9();
38005
+ var { checkEngine } = require_lib7();
38006
+ var normalizeBin = require_lib8();
38091
38007
  var engineOk = (manifest, npmVersion, nodeVersion) => {
38092
38008
  try {
38093
38009
  checkEngine(manifest, npmVersion, nodeVersion);
@@ -38249,7 +38165,7 @@ var require_clone = __commonJS((exports, module) => {
38249
38165
  var getRevs = require_revs();
38250
38166
  var spawn2 = require_spawn();
38251
38167
  var { isWindows: isWindows2 } = require_utils7();
38252
- var pickManifest = require_lib10();
38168
+ var pickManifest = require_lib9();
38253
38169
  var fs3 = __require("fs/promises");
38254
38170
  module.exports = (repo, ref = "HEAD", target = null, opts = {}) => getRevs(repo, opts).then((revs) => clone(repo, revs, ref, resolveRef(revs, ref, opts), target || defaultTarget(repo, opts.cwd), opts));
38255
38171
  var maybeShallow = (repo, opts) => {
@@ -38381,7 +38297,7 @@ var require_is_clean = __commonJS((exports, module) => {
38381
38297
  });
38382
38298
 
38383
38299
  // ../../node_modules/@npmcli/git/lib/index.js
38384
- var require_lib11 = __commonJS((exports, module) => {
38300
+ var require_lib10 = __commonJS((exports, module) => {
38385
38301
  module.exports = {
38386
38302
  clone: require_clone(),
38387
38303
  revs: require_revs(),
@@ -40278,7 +40194,7 @@ var require_normalize = __commonJS((exports, module) => {
40278
40194
  normalizePackageBin(data, changes);
40279
40195
  }
40280
40196
  if (steps.includes("gitHead") && !data.gitHead) {
40281
- const git = require_lib11();
40197
+ const git = require_lib10();
40282
40198
  const gitRoot = await git.find({ cwd: pkg.path, root });
40283
40199
  let head;
40284
40200
  if (gitRoot) {
@@ -40564,7 +40480,7 @@ var require_sort2 = __commonJS((exports, module) => {
40564
40480
  });
40565
40481
 
40566
40482
  // ../../node_modules/@npmcli/package-json/lib/index.js
40567
- var require_lib12 = __commonJS((exports, module) => {
40483
+ var require_lib11 = __commonJS((exports, module) => {
40568
40484
  var { readFile: readFile2, writeFile: writeFile2 } = __require("node:fs/promises");
40569
40485
  var { resolve: resolve2 } = __require("node:path");
40570
40486
  var parseJSON = require_lib();
@@ -228156,7 +228072,7 @@ var require_wrap_ansi = __commonJS((exports, module) => {
228156
228072
  });
228157
228073
 
228158
228074
  // ../../node_modules/mute-stream/lib/index.js
228159
- var require_lib13 = __commonJS((exports, module) => {
228075
+ var require_lib12 = __commonJS((exports, module) => {
228160
228076
  var Stream3 = __require("stream");
228161
228077
 
228162
228078
  class MuteStream extends Stream3 {
@@ -241066,7 +240982,7 @@ var require_dist5 = __commonJS((exports) => {
241066
240982
  });
241067
240983
 
241068
240984
  // ../../node_modules/node-fetch-native/lib/index.cjs
241069
- var require_lib14 = __commonJS((exports, module) => {
240985
+ var require_lib13 = __commonJS((exports, module) => {
241070
240986
  var nodeFetch = require_dist5();
241071
240987
  function fetch2(input, options) {
241072
240988
  return nodeFetch.fetch(input, options);
@@ -241112,7 +241028,7 @@ var require_proxy = __commonJS((exports) => {
241112
241028
  var require$$3 = __require("events");
241113
241029
  var require$$5$4 = __require("url");
241114
241030
  var require$$2 = __require("assert");
241115
- var nodeFetchNative = require_lib14();
241031
+ var nodeFetchNative = require_lib13();
241116
241032
  function _interopDefaultCompat(A5) {
241117
241033
  return A5 && typeof A5 == "object" && "default" in A5 ? A5.default : A5;
241118
241034
  }
@@ -269198,6 +269114,97 @@ function pruneCurrentEnv(currentEnv, env2) {
269198
269114
  return true;
269199
269115
  }));
269200
269116
  }
269117
+ // package.json
269118
+ var package_default = {
269119
+ name: "@settlemint/sdk-cli",
269120
+ description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
269121
+ version: "1.0.9-pr35556316",
269122
+ type: "module",
269123
+ private: false,
269124
+ license: "FSL-1.1-MIT",
269125
+ author: {
269126
+ name: "SettleMint",
269127
+ email: "support@settlemint.com",
269128
+ url: "https://settlemint.com"
269129
+ },
269130
+ homepage: "https://github.com/settlemint/sdk/blob/main/sdk/cli/README.md",
269131
+ repository: {
269132
+ type: "git",
269133
+ url: "git+https://github.com/settlemint/sdk.git",
269134
+ directory: "sdk/cli"
269135
+ },
269136
+ bugs: {
269137
+ url: "https://github.com/settlemint/sdk/issues",
269138
+ email: "support@settlemint.com"
269139
+ },
269140
+ files: ["dist"],
269141
+ exports: {
269142
+ "./*": {
269143
+ types: "./dist/*.d.ts",
269144
+ default: "./dist/*.mjs"
269145
+ }
269146
+ },
269147
+ bin: {
269148
+ settlemint: "dist/cli.js"
269149
+ },
269150
+ scripts: {
269151
+ build: "bun run build.ts",
269152
+ dev: "tsup-node --watch",
269153
+ test: "bun test",
269154
+ "test:coverage": "bun test --coverage",
269155
+ typecheck: "tsc --noEmit",
269156
+ "publish-npm": "bun publish --tag ${TAG} --access public || exit 0",
269157
+ docs: "bun scripts/create-docs.ts",
269158
+ prepack: "cp ../../LICENSE ."
269159
+ },
269160
+ dependencies: {
269161
+ tinyexec: "0.3.2"
269162
+ },
269163
+ devDependencies: {
269164
+ "@commander-js/extra-typings": "13.1.0",
269165
+ "@inquirer/confirm": "5.1.3",
269166
+ "@inquirer/input": "4.1.3",
269167
+ "@inquirer/password": "4.0.6",
269168
+ "@inquirer/select": "4.0.6",
269169
+ "@settlemint/sdk-js": "1.0.9-pr35556316",
269170
+ "@settlemint/sdk-utils": "1.0.9-pr35556316",
269171
+ "@types/node": "22.10.10",
269172
+ "@types/semver": "7.5.8",
269173
+ "@types/which": "3.0.4",
269174
+ "get-tsconfig": "4.10.0",
269175
+ giget: "1.2.3",
269176
+ "is-in-ci": "1.0.0",
269177
+ semver: "7.6.3",
269178
+ slugify: "1.6.6",
269179
+ which: "5.0.0",
269180
+ yaml: "2.7.0",
269181
+ yoctocolors: "2.1.1"
269182
+ },
269183
+ peerDependencies: {
269184
+ hardhat: "2.22.18"
269185
+ },
269186
+ peerDependenciesMeta: {
269187
+ hardhat: {
269188
+ optional: true
269189
+ }
269190
+ },
269191
+ engines: {
269192
+ node: ">=20"
269193
+ },
269194
+ keywords: [
269195
+ "settlemint",
269196
+ "blockchain",
269197
+ "blockchain-development",
269198
+ "enterprise-blockchain",
269199
+ "web3",
269200
+ "web3-development",
269201
+ "web3-tools",
269202
+ "sdk",
269203
+ "typescript",
269204
+ "cli",
269205
+ "command-line"
269206
+ ]
269207
+ };
269201
269208
 
269202
269209
  // src/utils/telemetry.ts
269203
269210
  async function telemetry(data) {
@@ -269223,7 +269230,8 @@ async function telemetry(data) {
269223
269230
  status,
269224
269231
  message,
269225
269232
  workspace: env2.SETTLEMINT_WORKSPACE,
269226
- application: env2.SETTLEMINT_APPLICATION
269233
+ application: env2.SETTLEMINT_APPLICATION,
269234
+ cliVersion: package_default.version
269227
269235
  }),
269228
269236
  signal: controller.signal
269229
269237
  });
@@ -269270,9 +269278,6 @@ var cancel2 = (msg) => {
269270
269278
  throw new CancelError2(msg);
269271
269279
  };
269272
269280
  async function executeCommand(command, args, options) {
269273
- console.log("command", command);
269274
- console.log("args", args);
269275
- console.log("options", options);
269276
269281
  const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
269277
269282
  process.stdin.pipe(child.stdin);
269278
269283
  const output = [];
@@ -269380,95 +269385,6 @@ function table(title, data) {
269380
269385
  table2.addRows(data);
269381
269386
  table2.printTable();
269382
269387
  }
269383
- // package.json
269384
- var package_default = {
269385
- name: "@settlemint/sdk-cli",
269386
- description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
269387
- version: "1.0.9-pr24c97cf1",
269388
- type: "module",
269389
- private: false,
269390
- license: "FSL-1.1-MIT",
269391
- author: {
269392
- name: "SettleMint",
269393
- email: "support@settlemint.com",
269394
- url: "https://settlemint.com"
269395
- },
269396
- homepage: "https://github.com/settlemint/sdk/blob/main/sdk/cli/README.md",
269397
- repository: {
269398
- type: "git",
269399
- url: "git+https://github.com/settlemint/sdk.git",
269400
- directory: "sdk/cli"
269401
- },
269402
- bugs: {
269403
- url: "https://github.com/settlemint/sdk/issues",
269404
- email: "support@settlemint.com"
269405
- },
269406
- files: ["dist"],
269407
- exports: {
269408
- "./*": {
269409
- types: "./dist/*.d.ts",
269410
- default: "./dist/*.mjs"
269411
- }
269412
- },
269413
- bin: {
269414
- settlemint: "dist/cli.js"
269415
- },
269416
- scripts: {
269417
- build: "bun run build.ts",
269418
- dev: "tsup-node --watch",
269419
- test: "bun test",
269420
- "test:coverage": "bun test --coverage",
269421
- typecheck: "tsc --noEmit",
269422
- "publish-npm": "bun publish --tag ${TAG} --access public || exit 0",
269423
- docs: "bun scripts/create-docs.ts",
269424
- prepack: "cp ../../LICENSE ."
269425
- },
269426
- dependencies: {
269427
- tinyexec: "0.3.2"
269428
- },
269429
- devDependencies: {
269430
- "@types/semver": "7.5.8",
269431
- "@types/node": "22.10.10",
269432
- "is-in-ci": "1.0.0",
269433
- semver: "7.6.3",
269434
- slugify: "1.6.6",
269435
- yoctocolors: "2.1.1",
269436
- "@commander-js/extra-typings": "13.1.0",
269437
- "@inquirer/confirm": "5.1.3",
269438
- "@inquirer/input": "4.1.3",
269439
- "@inquirer/password": "4.0.6",
269440
- "@inquirer/select": "4.0.6",
269441
- "@settlemint/sdk-js": "1.0.9-pr24c97cf1",
269442
- "@settlemint/sdk-utils": "1.0.9-pr24c97cf1",
269443
- "get-tsconfig": "4.10.0",
269444
- giget: "1.2.3",
269445
- yaml: "2.7.0"
269446
- },
269447
- peerDependencies: {
269448
- hardhat: "2.22.18"
269449
- },
269450
- peerDependenciesMeta: {
269451
- hardhat: {
269452
- optional: true
269453
- }
269454
- },
269455
- engines: {
269456
- node: ">=20"
269457
- },
269458
- keywords: [
269459
- "settlemint",
269460
- "blockchain",
269461
- "blockchain-development",
269462
- "enterprise-blockchain",
269463
- "web3",
269464
- "web3-development",
269465
- "web3-tools",
269466
- "sdk",
269467
- "typescript",
269468
- "cli",
269469
- "command-line"
269470
- ]
269471
- };
269472
269388
 
269473
269389
  // ../utils/dist/http.mjs
269474
269390
  async function retryWhenFailed(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
@@ -271754,8 +271670,8 @@ async function installPackage(names, options = {}) {
271754
271670
 
271755
271671
  // ../utils/dist/package-manager.mjs
271756
271672
  var import_console_table_printer3 = __toESM(require_dist2(), 1);
271757
- var import_package_json = __toESM(require_lib12(), 1);
271758
- var import_package_json2 = __toESM(require_lib12(), 1);
271673
+ var import_package_json = __toESM(require_lib11(), 1);
271674
+ var import_package_json2 = __toESM(require_lib11(), 1);
271759
271675
  async function projectRoot2(fallbackToCwd = false, cwd) {
271760
271676
  const packageJsonPath = await findUp("package.json", { cwd });
271761
271677
  if (!packageJsonPath) {
@@ -271833,14 +271749,6 @@ async function isPackageInstalled(name, path5) {
271833
271749
  const inPeerDependencies = !!pkgJson.content.peerDependencies?.[name];
271834
271750
  return inDependencies || inDevDependencies || inPeerDependencies;
271835
271751
  }
271836
- async function isPackageInstalledGlobally(packageName) {
271837
- try {
271838
- const installedLocally = await isPackageInstalled(packageName);
271839
- return !installedLocally;
271840
- } catch {
271841
- return true;
271842
- }
271843
- }
271844
271752
  async function setName(name, path5) {
271845
271753
  const pkgJson = await import_package_json2.default.load(path5 ?? await projectRoot2());
271846
271754
  pkgJson.update({
@@ -271989,6 +271897,7 @@ async function setLastSdkVersionCheck(date) {
271989
271897
  }
271990
271898
 
271991
271899
  // src/utils/sdk-version.ts
271900
+ var SDK_PACKAGE_NAME = "@settlemint/sdk-cli";
271992
271901
  async function validateSdkVersionFromCommand(command, interval = 5 * 60 * 1000) {
271993
271902
  const now = Date.now();
271994
271903
  const config3 = await readConfig();
@@ -272029,20 +271938,27 @@ async function getInstanceFromCommand(command) {
272029
271938
  return env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
272030
271939
  }
272031
271940
  async function getUpgradeInstructions() {
272032
- const packageName = "@settlemint/sdk-cli";
272033
- const globallyInstalled = await isPackageInstalledGlobally(packageName);
271941
+ const globallyInstalled = await isSdkInstalledGlobally();
272034
271942
  if (globallyInstalled) {
272035
271943
  const executablePath = process.execPath;
272036
271944
  if (executablePath.endsWith("bun")) {
272037
271945
  return `To update, run:
272038
- bun install -g ${packageName}`;
271946
+ bun install -g ${SDK_PACKAGE_NAME}`;
272039
271947
  }
272040
271948
  return `To update:
272041
- - For npm, run: npm update -g ${packageName}
272042
- - For yarn, run: yarn global add ${packageName}
272043
- - For pnpm, run: pnpm update -g ${packageName}`;
271949
+ - For npm, run: npm update -g ${SDK_PACKAGE_NAME}
271950
+ - For yarn, run: yarn global add ${SDK_PACKAGE_NAME}
271951
+ - For pnpm, run: pnpm update -g ${SDK_PACKAGE_NAME}`;
271952
+ }
271953
+ return `Update your ${SDK_PACKAGE_NAME} version in the package.json file.`;
271954
+ }
271955
+ async function isSdkInstalledGlobally() {
271956
+ try {
271957
+ const installedLocally = await isPackageInstalled(SDK_PACKAGE_NAME);
271958
+ return !installedLocally;
271959
+ } catch {
271960
+ return true;
272044
271961
  }
272045
- return `Update your ${packageName} version in the package.json file.`;
272046
271962
  }
272047
271963
 
272048
271964
  // src/commands/codegen/utils/write-template.ts
@@ -274007,7 +273923,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
274007
273923
  `);
274008
273924
  }
274009
273925
  // ../../node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
274010
- var import_mute_stream = __toESM(require_lib13(), 1);
273926
+ var import_mute_stream = __toESM(require_lib12(), 1);
274011
273927
  init_mjs();
274012
273928
  import * as readline2 from "node:readline";
274013
273929
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
@@ -278851,6 +278767,17 @@ function formatUseCaseName(name2) {
278851
278767
  return name2;
278852
278768
  }
278853
278769
 
278770
+ // src/utils/smart-contract-set/execute-foundry-command.ts
278771
+ var import_which = __toESM(require_lib4(), 1);
278772
+ async function executeFoundryCommand(command, args) {
278773
+ try {
278774
+ await import_which.default(command);
278775
+ } catch (error5) {
278776
+ cancel2("Foundry is not installed. Instructions to install Foundry can be found here: https://book.getfoundry.sh/getting-started/installation");
278777
+ }
278778
+ return executeCommand(command, args);
278779
+ }
278780
+
278854
278781
  // src/commands/smart-contract-set/create.ts
278855
278782
  function createCommand4() {
278856
278783
  return new Command("create").description("Bootstrap your smart contract set").option("-n, --project-name <name>", "The name for your smart contract set project").option("--use-case <useCase>", "Use case for the smart contract set (run `settlemint platform config` to see available use cases)").option("-i, --instance <instance>", "The instance to connect to").action(async ({ projectName, useCase, instance }) => {
@@ -278883,7 +278810,7 @@ function createCommand4() {
278883
278810
  await spinner({
278884
278811
  startMessage: "Scaffolding the smart contract set",
278885
278812
  task: async () => {
278886
- await executeCommand("forge", [
278813
+ await executeFoundryCommand("forge", [
278887
278814
  "init",
278888
278815
  name2,
278889
278816
  "--template",
@@ -278927,7 +278854,7 @@ function foundryBuildCommand() {
278927
278854
  }
278928
278855
  ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
278929
278856
  const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
278930
- await executeCommand("forge", ["build", ...forgeOptions]);
278857
+ await executeFoundryCommand("forge", ["build", ...forgeOptions]);
278931
278858
  });
278932
278859
  }
278933
278860
 
@@ -278948,7 +278875,7 @@ function foundryFormatCommand() {
278948
278875
  }
278949
278876
  ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
278950
278877
  const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
278951
- await executeCommand("forge", ["fmt", ...forgeOptions]);
278878
+ await executeFoundryCommand("forge", ["fmt", ...forgeOptions]);
278952
278879
  note("Smart contract set formatted successfully!");
278953
278880
  });
278954
278881
  }
@@ -278970,7 +278897,7 @@ function foundryNetworkCommand() {
278970
278897
  }
278971
278898
  ])).helpOption(false).option("-h, --help", "Get list of possible anvil options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
278972
278899
  const anvilOptions = mapPassthroughOptions(passThroughOptions, cmd2);
278973
- await executeCommand("anvil", anvilOptions);
278900
+ await executeFoundryCommand("anvil", anvilOptions);
278974
278901
  });
278975
278902
  }
278976
278903
 
@@ -278991,10 +278918,26 @@ function foundryTestCommand() {
278991
278918
  }
278992
278919
  ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
278993
278920
  const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
278994
- await executeCommand("forge", ["test", ...forgeOptions]);
278921
+ await executeFoundryCommand("forge", ["test", ...forgeOptions]);
278995
278922
  });
278996
278923
  }
278997
278924
 
278925
+ // src/utils/validate-required-packages.ts
278926
+ var validateIfRequiredPackagesAreInstalled = async (packages, cwd2) => {
278927
+ const results = await Promise.all(packages.map(async (pkg) => {
278928
+ try {
278929
+ const isInstalled = await isPackageInstalled(pkg, cwd2);
278930
+ return { packageName: pkg, isInstalled };
278931
+ } catch (err) {
278932
+ return { packageName: pkg, isInstalled: false };
278933
+ }
278934
+ }));
278935
+ const notInstalled = results.filter((result) => !result.isInstalled);
278936
+ if (notInstalled.length > 0) {
278937
+ cancel2(`The following required npm packages are not installed: ${notInstalled.map((pkg) => pkg.packageName).join(", ")}. Please install them and try again.`);
278938
+ }
278939
+ };
278940
+
278998
278941
  // src/commands/smart-contract-set/hardhat/build.ts
278999
278942
  function hardhatBuildCommand() {
279000
278943
  return new Command("build").description("Build the smart contracts using Hardhat").usage(createExamples([
@@ -279011,6 +278954,7 @@ function hardhatBuildCommand() {
279011
278954
  command: "scs hardhat build --concurrency 2"
279012
278955
  }
279013
278956
  ])).helpOption(false).option("-h, --help", "Get list of possible hardhat compile options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
278957
+ await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279014
278958
  const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279015
278959
  const { command, args } = await getPackageManagerExecutable();
279016
278960
  await executeCommand(command, [...args, "hardhat", "compile", ...hardhatOptions]);
@@ -279037,6 +278981,7 @@ function hardhatDeployLocalCommand() {
279037
278981
  command: "scs hardhat deploy local --verify"
279038
278982
  }
279039
278983
  ])).option("-m, --module <ignitionmodule>", 'The module to deploy with Ignition, defaults to "ignition/modules/main.ts"').option("-r, --reset", "Wipes the existing deployment state before deploying").option("-v, --verify", "Verify the deployment on Etherscan").action(async ({ module, reset: reset2, verify }) => {
278984
+ await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279040
278985
  const { command, args } = await getPackageManagerExecutable();
279041
278986
  await executeCommand(command, [
279042
278987
  ...args,
@@ -279213,6 +279158,7 @@ function hardhatDeployRemoteCommand() {
279213
279158
  acceptDefaults,
279214
279159
  blockchainNode: blockchainNodeUniqueName
279215
279160
  }) => {
279161
+ await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279216
279162
  const autoAccept = !!acceptDefaults || is_in_ci_default;
279217
279163
  const env2 = await loadEnv(false, !!prod);
279218
279164
  const instance = await instancePrompt(env2, true);
@@ -279283,6 +279229,7 @@ function hardhatNetworkCommand() {
279283
279229
  command: "scs hardhat network --port 3000"
279284
279230
  }
279285
279231
  ])).helpOption(false).option("-h, --help", "Get list of possible hardhat node options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
279232
+ await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279286
279233
  const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279287
279234
  const { command, args } = await getPackageManagerExecutable();
279288
279235
  await executeCommand(command, [...args, "hardhat", "node", ...hardhatOptions]);
@@ -279292,6 +279239,7 @@ function hardhatNetworkCommand() {
279292
279239
  // src/commands/smart-contract-set/hardhat/script/local.ts
279293
279240
  function hardhatScriptLocalCommand() {
279294
279241
  return new Command("local").description("Run a Hardhat script to deploy a contract on the platform or interact with a deployed contract.").requiredOption("-s, --script <script>", 'The script to run with Hardhat , e.g. "scripts/deploy.ts"').option("--no-compile", "Don't compile before running this task").action(async ({ script, compile }) => {
279242
+ await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279295
279243
  const { command, args } = await getPackageManagerExecutable();
279296
279244
  await executeCommand(command, [
279297
279245
  ...args,
@@ -279309,6 +279257,7 @@ function hardhatScriptLocalCommand() {
279309
279257
  function hardhatScriptRemoteCommand() {
279310
279258
  const cmd2 = new Command("remote").description("Run a Hardhat script to deploy a contract on the platform or interact with a deployed contract.").requiredOption("-s, --script <script>", 'The script to run with Hardhat , e.g. "scripts/deploy.ts"').option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (optional, defaults to the blockchain node in the environment)").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("--no-compile", "Don't compile before running this task");
279311
279259
  cmd2.action(async ({ script, prod, blockchainNode: blockchainNodeUniqueName, acceptDefaults, compile }) => {
279260
+ await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279312
279261
  const autoAccept = !!acceptDefaults || is_in_ci_default;
279313
279262
  const env2 = await loadEnv(false, !!prod);
279314
279263
  const instance = await instancePrompt(env2, true);
@@ -279357,6 +279306,7 @@ function hardhatTestCommand() {
279357
279306
  command: "scs hardhat test test/token.test.ts"
279358
279307
  }
279359
279308
  ])).helpOption(false).option("-h, --help", "Get list of possible hardhat test options").passThroughOptions().allowUnknownOption().action(async (options, cmd2) => {
279309
+ await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279360
279310
  const hardhatOptions = mapPassthroughOptions(options, cmd2);
279361
279311
  const { command, args } = await getPackageManagerExecutable();
279362
279312
  await executeCommand(command, [...args, "hardhat", "test", ...hardhatOptions]);
@@ -279425,7 +279375,7 @@ var SETTLEMINT_NETWORK = "settlemint";
279425
279375
  async function subgraphSetup({ network }) {
279426
279376
  const generated = await isGenerated();
279427
279377
  if (generated) {
279428
- await executeCommand("forge", ["build"]);
279378
+ await executeFoundryCommand("forge", ["build"]);
279429
279379
  }
279430
279380
  if (await exists3("./generated")) {
279431
279381
  await rm4("./generated", { recursive: true, force: true });
@@ -279528,6 +279478,7 @@ async function getNodeName({
279528
279478
  // src/commands/smart-contract-set/subgraph/build.ts
279529
279479
  function subgraphBuildCommand() {
279530
279480
  return new Command("build").description("Build the subgraph").action(async () => {
279481
+ await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
279531
279482
  await subgraphSetup({
279532
279483
  network: SETTLEMINT_NETWORK
279533
279484
  });
@@ -279543,6 +279494,7 @@ function subgraphBuildCommand() {
279543
279494
  import { dirname as dirname11 } from "node:path";
279544
279495
  function subgraphCodegenCommand() {
279545
279496
  return new Command("codegen").description("Codegen the subgraph types").action(async () => {
279497
+ await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
279546
279498
  await subgraphSetup({
279547
279499
  network: SETTLEMINT_NETWORK
279548
279500
  });
@@ -279601,6 +279553,7 @@ function subgraphDeployCommand() {
279601
279553
  command: "scs subgraph deploy my-subgraph"
279602
279554
  }
279603
279555
  ])).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").argument("[subgraph-name]", "The name of the subgraph to deploy (defaults to value in .env if not provided)").action(async (subgraphName, { prod, acceptDefaults }) => {
279556
+ await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
279604
279557
  const autoAccept = !!acceptDefaults || is_in_ci_default;
279605
279558
  const env2 = await loadEnv(false, !!prod);
279606
279559
  const instance = await instancePrompt(env2, true);
@@ -279790,4 +279743,4 @@ async function sdkCliCommand(argv = process.argv) {
279790
279743
  // src/cli.ts
279791
279744
  sdkCliCommand();
279792
279745
 
279793
- //# debugId=A513CCABE969121F64756E2164756E21
279746
+ //# debugId=322D2C25FCE1531464756E2164756E21