@settlemint/sdk-cli 2.3.14-maina78e17fa → 2.3.14-maind8180c4b

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
@@ -48857,7 +48857,7 @@ var require_typescript = __commonJS((exports, module) => {
48857
48857
  tryGetPropertyNameOfBindingOrAssignmentElement: () => tryGetPropertyNameOfBindingOrAssignmentElement,
48858
48858
  tryGetSourceMappingURL: () => tryGetSourceMappingURL,
48859
48859
  tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
48860
- tryParseJson: () => tryParseJson5,
48860
+ tryParseJson: () => tryParseJson4,
48861
48861
  tryParsePattern: () => tryParsePattern,
48862
48862
  tryParsePatterns: () => tryParsePatterns,
48863
48863
  tryParseRawSourceMap: () => tryParseRawSourceMap,
@@ -66862,7 +66862,7 @@ ${lanes.join(`
66862
66862
  function readJson(path7, host) {
66863
66863
  return readJsonOrUndefined(path7, host) || {};
66864
66864
  }
66865
- function tryParseJson5(text) {
66865
+ function tryParseJson4(text) {
66866
66866
  try {
66867
66867
  return JSON.parse(text);
66868
66868
  } catch {
@@ -92927,7 +92927,7 @@ ${lanes.join(`
92927
92927
  if (isMissingPackageJsonInfo(cachedPackageJson) || !host.fileExists(packageJsonPath)) {
92928
92928
  return;
92929
92929
  }
92930
- const packageJsonContent = (cachedPackageJson == null ? undefined : cachedPackageJson.contents.packageJsonContent) || tryParseJson5(host.readFile(packageJsonPath));
92930
+ const packageJsonContent = (cachedPackageJson == null ? undefined : cachedPackageJson.contents.packageJsonContent) || tryParseJson4(host.readFile(packageJsonPath));
92931
92931
  const imports = packageJsonContent == null ? undefined : packageJsonContent.imports;
92932
92932
  if (!imports) {
92933
92933
  return;
@@ -93013,7 +93013,7 @@ ${lanes.join(`
93013
93013
  let maybeBlockedByTypesVersions = false;
93014
93014
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? undefined : _a.call(host)) == null ? undefined : _b.getPackageJsonInfo(packageJsonPath);
93015
93015
  if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
93016
- const packageJsonContent = (cachedPackageJson == null ? undefined : cachedPackageJson.contents.packageJsonContent) || tryParseJson5(host.readFile(packageJsonPath));
93016
+ const packageJsonContent = (cachedPackageJson == null ? undefined : cachedPackageJson.contents.packageJsonContent) || tryParseJson4(host.readFile(packageJsonPath));
93017
93017
  const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
93018
93018
  if (getResolvePackageJsonExports(options)) {
93019
93019
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
@@ -166185,7 +166185,7 @@ ${lanes.join(`
166185
166185
  }
166186
166186
  const dependencyKeys = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
166187
166187
  const stringContent = host.readFile(fileName) || "";
166188
- const content = tryParseJson5(stringContent);
166188
+ const content = tryParseJson4(stringContent);
166189
166189
  const info = {};
166190
166190
  if (content) {
166191
166191
  for (const key2 of dependencyKeys) {
@@ -204120,7 +204120,7 @@ ${options.prefix}` : `
204120
204120
  tryGetPropertyNameOfBindingOrAssignmentElement: () => tryGetPropertyNameOfBindingOrAssignmentElement,
204121
204121
  tryGetSourceMappingURL: () => tryGetSourceMappingURL,
204122
204122
  tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
204123
- tryParseJson: () => tryParseJson5,
204123
+ tryParseJson: () => tryParseJson4,
204124
204124
  tryParsePattern: () => tryParsePattern,
204125
204125
  tryParsePatterns: () => tryParsePatterns,
204126
204126
  tryParseRawSourceMap: () => tryParseRawSourceMap,
@@ -231623,7 +231623,7 @@ function size(value4) {
231623
231623
  var init_size = () => {};
231624
231624
 
231625
231625
  // ../../node_modules/viem/_esm/errors/version.js
231626
- var version5 = "2.31.1";
231626
+ var version5 = "2.31.0";
231627
231627
 
231628
231628
  // ../../node_modules/viem/_esm/errors/base.js
231629
231629
  function walk(err, fn) {
@@ -263764,7 +263764,7 @@ function pruneCurrentEnv(currentEnv, env2) {
263764
263764
  var package_default = {
263765
263765
  name: "@settlemint/sdk-cli",
263766
263766
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
263767
- version: "2.3.14-maina78e17fa",
263767
+ version: "2.3.14-maind8180c4b",
263768
263768
  type: "module",
263769
263769
  private: false,
263770
263770
  license: "FSL-1.1-MIT",
@@ -263783,9 +263783,7 @@ var package_default = {
263783
263783
  url: "https://github.com/settlemint/sdk/issues",
263784
263784
  email: "support@settlemint.com"
263785
263785
  },
263786
- files: [
263787
- "dist"
263788
- ],
263786
+ files: ["dist"],
263789
263787
  exports: {
263790
263788
  "./*": {
263791
263789
  types: "./dist/*.d.ts",
@@ -263815,10 +263813,9 @@ var package_default = {
263815
263813
  "@inquirer/input": "4.1.12",
263816
263814
  "@inquirer/password": "4.0.15",
263817
263815
  "@inquirer/select": "4.2.3",
263818
- "@settlemint/sdk-js": "2.3.14-maina78e17fa",
263819
- "@settlemint/sdk-utils": "2.3.14-maina78e17fa",
263820
- "@settlemint/sdk-viem": "2.3.14-maina78e17fa",
263821
- "@types/node": "24.0.1",
263816
+ "@settlemint/sdk-js": "2.3.14-maind8180c4b",
263817
+ "@settlemint/sdk-utils": "2.3.14-maind8180c4b",
263818
+ "@types/node": "24.0.0",
263822
263819
  "@types/semver": "7.7.0",
263823
263820
  "@types/which": "3.0.4",
263824
263821
  "get-tsconfig": "4.10.1",
@@ -263826,13 +263823,13 @@ var package_default = {
263826
263823
  "is-in-ci": "1.0.0",
263827
263824
  semver: "7.7.2",
263828
263825
  slugify: "1.6.6",
263829
- viem: "2.31.1",
263826
+ viem: "2.31.0",
263830
263827
  which: "5.0.0",
263831
263828
  yaml: "2.8.0",
263832
263829
  yoctocolors: "2.1.1"
263833
263830
  },
263834
263831
  peerDependencies: {
263835
- hardhat: "2.24.3"
263832
+ hardhat: "2.24.2"
263836
263833
  },
263837
263834
  peerDependenciesMeta: {
263838
263835
  hardhat: {
@@ -295795,17 +295792,6 @@ async function exists3(path$1) {
295795
295792
  return false;
295796
295793
  }
295797
295794
  }
295798
- function tryParseJson3(value2, defaultValue = null) {
295799
- try {
295800
- const parsed = JSON.parse(value2);
295801
- if (parsed === undefined || parsed === null) {
295802
- return defaultValue;
295803
- }
295804
- return parsed;
295805
- } catch (err) {
295806
- return defaultValue;
295807
- }
295808
- }
295809
295795
  var require_balanced_match4 = __commonJS4({ "../../node_modules/balanced-match/index.js"(exports, module) {
295810
295796
  module.exports = balanced$1;
295811
295797
  function balanced$1(a3, b, str) {
@@ -301284,45 +301270,9 @@ var glob3 = Object.assign(glob_3, {
301284
301270
  unescape: unescape4
301285
301271
  });
301286
301272
  glob3.glob = glob3;
301287
- async function findMonoRepoRoot2(startDir) {
301288
- const lockFilePath = await findUp([
301289
- "package-lock.json",
301290
- "yarn.lock",
301291
- "pnpm-lock.yaml",
301292
- "bun.lockb",
301293
- "bun.lock"
301294
- ], { cwd: startDir });
301295
- if (lockFilePath) {
301296
- const packageJsonPath = join3(dirname3(lockFilePath), "package.json");
301297
- const hasWorkSpaces = await packageJsonHasWorkspaces2(packageJsonPath);
301298
- return hasWorkSpaces ? dirname3(lockFilePath) : null;
301299
- }
301300
- let currentDir = startDir;
301301
- while (currentDir !== "/") {
301302
- const packageJsonPath = join3(currentDir, "package.json");
301303
- if (await packageJsonHasWorkspaces2(packageJsonPath)) {
301304
- return currentDir;
301305
- }
301306
- const parentDir = dirname3(currentDir);
301307
- if (parentDir === currentDir) {
301308
- break;
301309
- }
301310
- currentDir = parentDir;
301311
- }
301312
- return null;
301313
- }
301314
- async function packageJsonHasWorkspaces2(packageJsonPath) {
301315
- if (await exists3(packageJsonPath)) {
301316
- const packageJson = tryParseJson3(await readFile3(packageJsonPath, "utf-8"));
301317
- if (packageJson?.workspaces && Array.isArray(packageJson?.workspaces) && packageJson?.workspaces.length > 0) {
301318
- return true;
301319
- }
301320
- }
301321
- return false;
301322
- }
301323
301273
 
301324
301274
  // ../utils/dist/json.js
301325
- function tryParseJson4(value2, defaultValue = null) {
301275
+ function tryParseJson3(value2, defaultValue = null) {
301326
301276
  try {
301327
301277
  const parsed = JSON.parse(value2);
301328
301278
  if (parsed === undefined || parsed === null) {
@@ -301341,7 +301291,7 @@ function extractJsonObject(value2) {
301341
301291
  if (!result) {
301342
301292
  return null;
301343
301293
  }
301344
- return tryParseJson4(result[0]);
301294
+ return tryParseJson3(result[0]);
301345
301295
  }
301346
301296
 
301347
301297
  // src/utils/config.ts
@@ -301356,7 +301306,7 @@ async function readConfig() {
301356
301306
  await ensureConfigDir();
301357
301307
  try {
301358
301308
  const content = await readFile4(CONFIG_FILE, "utf-8");
301359
- return tryParseJson4(content, { instances: {} });
301309
+ return tryParseJson3(content, { instances: {} });
301360
301310
  } catch (error41) {
301361
301311
  return { instances: {} };
301362
301312
  }
@@ -329363,9 +329313,9 @@ function hardhatTestCommand() {
329363
329313
  });
329364
329314
  }
329365
329315
 
329366
- // src/commands/smart-contract-set/subgraph/add.ts
329367
- import { copyFile, mkdir as mkdir7, readFile as readFile10, unlink as unlink2, writeFile as writeFile9 } from "node:fs/promises";
329368
- import { basename as basename5, dirname as dirname8, isAbsolute as isAbsolute2, join as join11, relative as relative4 } from "node:path";
329316
+ // src/utils/subgraph/setup.ts
329317
+ import { rm as rm4 } from "node:fs/promises";
329318
+ var import_semver = __toESM(require_semver2(), 1);
329369
329319
 
329370
329320
  // src/utils/subgraph/subgraph-config.ts
329371
329321
  import { readFile as readFile9, writeFile as writeFile8 } from "node:fs/promises";
@@ -329397,7 +329347,7 @@ var updateSubgraphYamlConfig = async (config5, cwd2 = process.cwd()) => {
329397
329347
  var getSubgraphConfig = async (path7 = process.cwd()) => {
329398
329348
  try {
329399
329349
  const configContents = await readFile9(join10(path7, CONFIG_FILE_PATH));
329400
- const currentConfig = tryParseJson4(configContents.toString());
329350
+ const currentConfig = tryParseJson3(configContents.toString());
329401
329351
  return currentConfig;
329402
329352
  } catch (err) {
329403
329353
  const error45 = err;
@@ -329406,102 +329356,7 @@ var getSubgraphConfig = async (path7 = process.cwd()) => {
329406
329356
  }
329407
329357
  };
329408
329358
 
329409
- // src/commands/smart-contract-set/subgraph/add.ts
329410
- var DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
329411
- function subgraphAddCommand() {
329412
- return new Command("add").description("Add a contract to the subgraph").usage(createExamples([
329413
- {
329414
- description: "Add a contract to the subgraph",
329415
- command: "scs subgraph add --abi=./abis/bond.json --contract-name=bond"
329416
- }
329417
- ])).requiredOption("--abi <abi>", "Path to the contract ABI.").requiredOption("--contract-name <contract-name>", "Name of the contract.").option("--address <contract-address>", `Address of the contract (defaults to ${DEFAULT_ADDRESS}).`).option("--start-block <start-block>", "Start block of the contract (defaults to 0).").option("--network <network>", "Network name (defaults to settlemint).").action(async ({ abi: abi2, contractName, address, startBlock, network }) => {
329418
- intro(`Adding subgraph config for contract ${contractName}`);
329419
- const abiPath = isAbsolute2(abi2) ? abi2 : join11(process.cwd(), abi2);
329420
- if (!await exists3(abiPath)) {
329421
- throw new Error("ABI file not found");
329422
- }
329423
- await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
329424
- if (await isGenerated()) {
329425
- throw new Error("This command does not support automatically generated subgraph configs");
329426
- }
329427
- const { command, args } = await getPackageManagerExecutable();
329428
- const subgraphYamlFile = await getSubgraphYamlFile();
329429
- const abiName = basename5(abiPath);
329430
- const subgraphYamlDir = dirname8(subgraphYamlFile);
329431
- await mkdir7(join11(subgraphYamlDir, "abis"), { recursive: true });
329432
- const localAbiPath = join11(subgraphYamlDir, "abis", abiName);
329433
- await copyFile(abiPath, localAbiPath);
329434
- try {
329435
- const root = await projectRoot3();
329436
- await fixPackageJson(root);
329437
- const monoRepoRoot = await findMonoRepoRoot2(root);
329438
- if (monoRepoRoot) {
329439
- await fixPackageJson(monoRepoRoot, false);
329440
- }
329441
- await executeCommand(command, [
329442
- ...args,
329443
- "graph",
329444
- "add",
329445
- "--abi",
329446
- abi2,
329447
- "--contract-name",
329448
- contractName,
329449
- "--start-block",
329450
- startBlock ?? "0",
329451
- address ?? DEFAULT_ADDRESS,
329452
- subgraphYamlFile
329453
- ]);
329454
- const subgraphYamlConfig = await getSubgraphYamlConfig();
329455
- if (subgraphYamlConfig) {
329456
- const updatedDataSources = subgraphYamlConfig?.dataSources.map((dataSource) => {
329457
- if (dataSource.name === contractName) {
329458
- dataSource.network = network ?? "settlemint";
329459
- dataSource.mapping.abis = [
329460
- {
329461
- name: contractName,
329462
- file: relative4(subgraphYamlDir, abiPath)
329463
- }
329464
- ];
329465
- }
329466
- return dataSource;
329467
- });
329468
- await updateSubgraphYamlConfig({
329469
- ...subgraphYamlConfig,
329470
- dataSources: updatedDataSources
329471
- });
329472
- }
329473
- } finally {
329474
- await unlink2(localAbiPath);
329475
- }
329476
- outro(`Subgraph config for contract ${contractName} added successfully`);
329477
- });
329478
- }
329479
- async function fixPackageJson(packageJsonDir, requiresCodegenScript = true) {
329480
- const packageJsonPath = join11(packageJsonDir, "package.json");
329481
- if (!await exists3(packageJsonPath)) {
329482
- return;
329483
- }
329484
- let hasPackageJsonChanged = false;
329485
- const subgraphPackageJson = await readFile10(packageJsonPath);
329486
- const subgraphPackageJsonData = JSON.parse(subgraphPackageJson.toString());
329487
- if (subgraphPackageJsonData.packageManager?.includes("bun")) {
329488
- note("Removing package manager from package.json (bun is not an official package manager)");
329489
- delete subgraphPackageJsonData.packageManager;
329490
- hasPackageJsonChanged = true;
329491
- }
329492
- if (requiresCodegenScript && !subgraphPackageJsonData.scripts?.codegen) {
329493
- note("Adding codegen script to package.json");
329494
- subgraphPackageJsonData.scripts.codegen = "settlemint scs subgraph codegen";
329495
- hasPackageJsonChanged = true;
329496
- }
329497
- if (hasPackageJsonChanged) {
329498
- await writeFile9(packageJsonPath, JSON.stringify(subgraphPackageJsonData, null, 2));
329499
- }
329500
- }
329501
-
329502
329359
  // src/utils/subgraph/setup.ts
329503
- import { rm as rm4 } from "node:fs/promises";
329504
- var import_semver = __toESM(require_semver2(), 1);
329505
329360
  var SETTLEMINT_NETWORK = "settlemint";
329506
329361
  async function subgraphSetup({ network }) {
329507
329362
  const generated = await isGenerated();
@@ -329891,7 +329746,6 @@ function smartContractSetCommand() {
329891
329746
  hardhat.addCommand(hardhatScriptCommand());
329892
329747
  hardhat.addCommand(hardhatTestCommand());
329893
329748
  const subgraph = new Command("subgraph").alias("sg").enablePositionalOptions().description("Commands for managing TheGraph subgraphs for smart contract indexing");
329894
- subgraph.addCommand(subgraphAddCommand());
329895
329749
  subgraph.addCommand(subgraphBuildCommand());
329896
329750
  subgraph.addCommand(subgraphCodegenCommand());
329897
329751
  subgraph.addCommand(subgraphDeployCommand());
@@ -330021,4 +329875,4 @@ async function sdkCliCommand(argv = process.argv) {
330021
329875
  // src/cli.ts
330022
329876
  sdkCliCommand();
330023
329877
 
330024
- //# debugId=252464843DFF08D264756E2164756E21
329878
+ //# debugId=BD00B89885DD0D5764756E2164756E21