@settlemint/sdk-cli 1.0.9-pr9bf11a11 → 1.0.9-prac55277e

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 +13 -133
  2. package/dist/cli.js.map +20 -23
  3. package/package.json +3 -3
package/dist/cli.js CHANGED
@@ -258165,90 +258165,6 @@ var require_public_api = __commonJS((exports) => {
258165
258165
  exports.stringify = stringify3;
258166
258166
  });
258167
258167
 
258168
- // ../../node_modules/which/lib/index.js
258169
- var require_lib15 = __commonJS((exports, module) => {
258170
- var { isexe, sync: isexeSync } = require_cjs();
258171
- var { join: join5, delimiter: delimiter2, sep: sep3, posix: posix2 } = __require("path");
258172
- var isWindows2 = process.platform === "win32";
258173
- var rSlash = new RegExp(`[${posix2.sep}${sep3 === posix2.sep ? "" : sep3}]`.replace(/(\\)/g, "\\$1"));
258174
- var rRel = new RegExp(`^\\.${rSlash.source}`);
258175
- var getNotFoundError2 = (cmd2) => Object.assign(new Error(`not found: ${cmd2}`), { code: "ENOENT" });
258176
- var getPathInfo2 = (cmd2, {
258177
- path: optPath = process.env.PATH,
258178
- pathExt: optPathExt = process.env.PATHEXT,
258179
- delimiter: optDelimiter = delimiter2
258180
- }) => {
258181
- const pathEnv = cmd2.match(rSlash) ? [""] : [
258182
- ...isWindows2 ? [process.cwd()] : [],
258183
- ...(optPath || "").split(optDelimiter)
258184
- ];
258185
- if (isWindows2) {
258186
- const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
258187
- const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
258188
- if (cmd2.includes(".") && pathExt[0] !== "") {
258189
- pathExt.unshift("");
258190
- }
258191
- return { pathEnv, pathExt, pathExtExe };
258192
- }
258193
- return { pathEnv, pathExt: [""] };
258194
- };
258195
- var getPathPart = (raw, cmd2) => {
258196
- const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
258197
- const prefix = !pathPart && rRel.test(cmd2) ? cmd2.slice(0, 2) : "";
258198
- return prefix + join5(pathPart, cmd2);
258199
- };
258200
- var which = async (cmd2, opt2 = {}) => {
258201
- const { pathEnv, pathExt, pathExtExe } = getPathInfo2(cmd2, opt2);
258202
- const found = [];
258203
- for (const envPart of pathEnv) {
258204
- const p6 = getPathPart(envPart, cmd2);
258205
- for (const ext2 of pathExt) {
258206
- const withExt = p6 + ext2;
258207
- const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true });
258208
- if (is) {
258209
- if (!opt2.all) {
258210
- return withExt;
258211
- }
258212
- found.push(withExt);
258213
- }
258214
- }
258215
- }
258216
- if (opt2.all && found.length) {
258217
- return found;
258218
- }
258219
- if (opt2.nothrow) {
258220
- return null;
258221
- }
258222
- throw getNotFoundError2(cmd2);
258223
- };
258224
- var whichSync = (cmd2, opt2 = {}) => {
258225
- const { pathEnv, pathExt, pathExtExe } = getPathInfo2(cmd2, opt2);
258226
- const found = [];
258227
- for (const pathEnvPart of pathEnv) {
258228
- const p6 = getPathPart(pathEnvPart, cmd2);
258229
- for (const ext2 of pathExt) {
258230
- const withExt = p6 + ext2;
258231
- const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
258232
- if (is) {
258233
- if (!opt2.all) {
258234
- return withExt;
258235
- }
258236
- found.push(withExt);
258237
- }
258238
- }
258239
- }
258240
- if (opt2.all && found.length) {
258241
- return found;
258242
- }
258243
- if (opt2.nothrow) {
258244
- return null;
258245
- }
258246
- throw getNotFoundError2(cmd2);
258247
- };
258248
- module.exports = which;
258249
- which.sync = whichSync;
258250
- });
258251
-
258252
258168
  // ../../node_modules/slugify/slugify.js
258253
258169
  var require_slugify = __commonJS((exports, module) => {
258254
258170
  (function(name2, root, factory) {
@@ -269286,7 +269202,7 @@ function pruneCurrentEnv(currentEnv, env2) {
269286
269202
  var package_default = {
269287
269203
  name: "@settlemint/sdk-cli",
269288
269204
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
269289
- version: "1.0.9-pr9bf11a11",
269205
+ version: "1.0.9-prac55277e",
269290
269206
  type: "module",
269291
269207
  private: false,
269292
269208
  license: "FSL-1.1-MIT",
@@ -269340,8 +269256,8 @@ var package_default = {
269340
269256
  "@inquirer/input": "4.1.3",
269341
269257
  "@inquirer/password": "4.0.6",
269342
269258
  "@inquirer/select": "4.0.6",
269343
- "@settlemint/sdk-js": "1.0.9-pr9bf11a11",
269344
- "@settlemint/sdk-utils": "1.0.9-pr9bf11a11",
269259
+ "@settlemint/sdk-js": "1.0.9-prac55277e",
269260
+ "@settlemint/sdk-utils": "1.0.9-prac55277e",
269345
269261
  "get-tsconfig": "4.10.0",
269346
269262
  giget: "1.2.3",
269347
269263
  yaml: "2.7.0"
@@ -274896,8 +274812,9 @@ var esm_default5 = createPrompt((config3, done) => {
274896
274812
  // src/prompts/aat.prompt.ts
274897
274813
  async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
274898
274814
  const autoAccept = !!accept || is_in_ci_default;
274899
- const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
274900
- const defaultPossible = autoAccept && defaultAccessToken;
274815
+ const hasApplicationChanged = env2.SETTLEMINT_APPLICATION !== application.uniqueName;
274816
+ const defaultAccessToken = hasApplicationChanged ? undefined : env2.SETTLEMINT_ACCESS_TOKEN;
274817
+ const defaultPossible = autoAccept && !!defaultAccessToken;
274901
274818
  if (defaultPossible || is_in_ci_default) {
274902
274819
  return defaultAccessToken;
274903
274820
  }
@@ -278933,17 +278850,6 @@ function formatUseCaseName(name2) {
278933
278850
  return name2;
278934
278851
  }
278935
278852
 
278936
- // src/utils/smart-contract-set/execute-foundry-command.ts
278937
- var import_which = __toESM(require_lib15(), 1);
278938
- async function executeFoundryCommand(command, args) {
278939
- try {
278940
- await import_which.default(command);
278941
- } catch (error5) {
278942
- cancel2("Foundry is not installed. Instructions to install Foundry can be found here: https://book.getfoundry.sh/getting-started/installation");
278943
- }
278944
- return executeCommand(command, args);
278945
- }
278946
-
278947
278853
  // src/commands/smart-contract-set/create.ts
278948
278854
  function createCommand4() {
278949
278855
  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 }) => {
@@ -278976,7 +278882,7 @@ function createCommand4() {
278976
278882
  await spinner({
278977
278883
  startMessage: "Scaffolding the smart contract set",
278978
278884
  task: async () => {
278979
- await executeFoundryCommand("forge", [
278885
+ await executeCommand("forge", [
278980
278886
  "init",
278981
278887
  name2,
278982
278888
  "--template",
@@ -279020,7 +278926,7 @@ function foundryBuildCommand() {
279020
278926
  }
279021
278927
  ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
279022
278928
  const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279023
- await executeFoundryCommand("forge", ["build", ...forgeOptions]);
278929
+ await executeCommand("forge", ["build", ...forgeOptions]);
279024
278930
  });
279025
278931
  }
279026
278932
 
@@ -279041,7 +278947,7 @@ function foundryFormatCommand() {
279041
278947
  }
279042
278948
  ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
279043
278949
  const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279044
- await executeFoundryCommand("forge", ["fmt", ...forgeOptions]);
278950
+ await executeCommand("forge", ["fmt", ...forgeOptions]);
279045
278951
  note("Smart contract set formatted successfully!");
279046
278952
  });
279047
278953
  }
@@ -279063,7 +278969,7 @@ function foundryNetworkCommand() {
279063
278969
  }
279064
278970
  ])).helpOption(false).option("-h, --help", "Get list of possible anvil options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
279065
278971
  const anvilOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279066
- await executeFoundryCommand("anvil", anvilOptions);
278972
+ await executeCommand("anvil", anvilOptions);
279067
278973
  });
279068
278974
  }
279069
278975
 
@@ -279084,26 +278990,10 @@ function foundryTestCommand() {
279084
278990
  }
279085
278991
  ])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
279086
278992
  const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279087
- await executeFoundryCommand("forge", ["test", ...forgeOptions]);
278993
+ await executeCommand("forge", ["test", ...forgeOptions]);
279088
278994
  });
279089
278995
  }
279090
278996
 
279091
- // src/utils/validate-required-packages.ts
279092
- var validateIfRequiredPackagesAreInstalled = async (packages, cwd2) => {
279093
- const results = await Promise.all(packages.map(async (pkg) => {
279094
- try {
279095
- const isInstalled = await isPackageInstalled(pkg, cwd2);
279096
- return { packageName: pkg, isInstalled };
279097
- } catch (err) {
279098
- return { packageName: pkg, isInstalled: false };
279099
- }
279100
- }));
279101
- const notInstalled = results.filter((result) => !result.isInstalled);
279102
- if (notInstalled.length > 0) {
279103
- cancel2(`The following required npm packages are not installed: ${notInstalled.map((pkg) => pkg.packageName).join(", ")}. Please install them and try again.`);
279104
- }
279105
- };
279106
-
279107
278997
  // src/commands/smart-contract-set/hardhat/build.ts
279108
278998
  function hardhatBuildCommand() {
279109
278999
  return new Command("build").description("Build the smart contracts using Hardhat").usage(createExamples([
@@ -279120,7 +279010,6 @@ function hardhatBuildCommand() {
279120
279010
  command: "scs hardhat build --concurrency 2"
279121
279011
  }
279122
279012
  ])).helpOption(false).option("-h, --help", "Get list of possible hardhat compile options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
279123
- await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279124
279013
  const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279125
279014
  const { command, args } = await getPackageManagerExecutable();
279126
279015
  await executeCommand(command, [...args, "hardhat", "compile", ...hardhatOptions]);
@@ -279147,7 +279036,6 @@ function hardhatDeployLocalCommand() {
279147
279036
  command: "scs hardhat deploy local --verify"
279148
279037
  }
279149
279038
  ])).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 }) => {
279150
- await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279151
279039
  const { command, args } = await getPackageManagerExecutable();
279152
279040
  await executeCommand(command, [
279153
279041
  ...args,
@@ -279324,7 +279212,6 @@ function hardhatDeployRemoteCommand() {
279324
279212
  acceptDefaults,
279325
279213
  blockchainNode: blockchainNodeUniqueName
279326
279214
  }) => {
279327
- await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279328
279215
  const autoAccept = !!acceptDefaults || is_in_ci_default;
279329
279216
  const env2 = await loadEnv(false, !!prod);
279330
279217
  const instance = await instancePrompt(env2, true);
@@ -279395,7 +279282,6 @@ function hardhatNetworkCommand() {
279395
279282
  command: "scs hardhat network --port 3000"
279396
279283
  }
279397
279284
  ])).helpOption(false).option("-h, --help", "Get list of possible hardhat node options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
279398
- await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279399
279285
  const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
279400
279286
  const { command, args } = await getPackageManagerExecutable();
279401
279287
  await executeCommand(command, [...args, "hardhat", "node", ...hardhatOptions]);
@@ -279405,7 +279291,6 @@ function hardhatNetworkCommand() {
279405
279291
  // src/commands/smart-contract-set/hardhat/script/local.ts
279406
279292
  function hardhatScriptLocalCommand() {
279407
279293
  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 }) => {
279408
- await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279409
279294
  const { command, args } = await getPackageManagerExecutable();
279410
279295
  await executeCommand(command, [
279411
279296
  ...args,
@@ -279423,7 +279308,6 @@ function hardhatScriptLocalCommand() {
279423
279308
  function hardhatScriptRemoteCommand() {
279424
279309
  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");
279425
279310
  cmd2.action(async ({ script, prod, blockchainNode: blockchainNodeUniqueName, acceptDefaults, compile }) => {
279426
- await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279427
279311
  const autoAccept = !!acceptDefaults || is_in_ci_default;
279428
279312
  const env2 = await loadEnv(false, !!prod);
279429
279313
  const instance = await instancePrompt(env2, true);
@@ -279472,7 +279356,6 @@ function hardhatTestCommand() {
279472
279356
  command: "scs hardhat test test/token.test.ts"
279473
279357
  }
279474
279358
  ])).helpOption(false).option("-h, --help", "Get list of possible hardhat test options").passThroughOptions().allowUnknownOption().action(async (options, cmd2) => {
279475
- await validateIfRequiredPackagesAreInstalled(["hardhat"]);
279476
279359
  const hardhatOptions = mapPassthroughOptions(options, cmd2);
279477
279360
  const { command, args } = await getPackageManagerExecutable();
279478
279361
  await executeCommand(command, [...args, "hardhat", "test", ...hardhatOptions]);
@@ -279541,7 +279424,7 @@ var SETTLEMINT_NETWORK = "settlemint";
279541
279424
  async function subgraphSetup({ network }) {
279542
279425
  const generated = await isGenerated();
279543
279426
  if (generated) {
279544
- await executeFoundryCommand("forge", ["build"]);
279427
+ await executeCommand("forge", ["build"]);
279545
279428
  }
279546
279429
  if (await exists3("./generated")) {
279547
279430
  await rm4("./generated", { recursive: true, force: true });
@@ -279644,7 +279527,6 @@ async function getNodeName({
279644
279527
  // src/commands/smart-contract-set/subgraph/build.ts
279645
279528
  function subgraphBuildCommand() {
279646
279529
  return new Command("build").description("Build the subgraph").action(async () => {
279647
- await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
279648
279530
  await subgraphSetup({
279649
279531
  network: SETTLEMINT_NETWORK
279650
279532
  });
@@ -279660,7 +279542,6 @@ function subgraphBuildCommand() {
279660
279542
  import { dirname as dirname11 } from "node:path";
279661
279543
  function subgraphCodegenCommand() {
279662
279544
  return new Command("codegen").description("Codegen the subgraph types").action(async () => {
279663
- await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
279664
279545
  await subgraphSetup({
279665
279546
  network: SETTLEMINT_NETWORK
279666
279547
  });
@@ -279719,7 +279600,6 @@ function subgraphDeployCommand() {
279719
279600
  command: "scs subgraph deploy my-subgraph"
279720
279601
  }
279721
279602
  ])).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 }) => {
279722
- await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
279723
279603
  const autoAccept = !!acceptDefaults || is_in_ci_default;
279724
279604
  const env2 = await loadEnv(false, !!prod);
279725
279605
  const instance = await instancePrompt(env2, true);
@@ -279909,4 +279789,4 @@ async function sdkCliCommand(argv = process.argv) {
279909
279789
  // src/cli.ts
279910
279790
  sdkCliCommand();
279911
279791
 
279912
- //# debugId=9B8A955B0FD572C564756E2164756E21
279792
+ //# debugId=ED48CCEAACF575EE64756E2164756E21