@settlemint/sdk-cli 2.5.3-main08284871 → 2.5.3-main3b21b3b1

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
@@ -264081,7 +264081,7 @@ function pruneCurrentEnv(currentEnv, env2) {
264081
264081
  var package_default = {
264082
264082
  name: "@settlemint/sdk-cli",
264083
264083
  description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
264084
- version: "2.5.3-main08284871",
264084
+ version: "2.5.3-main3b21b3b1",
264085
264085
  type: "module",
264086
264086
  private: false,
264087
264087
  license: "FSL-1.1-MIT",
@@ -264135,10 +264135,10 @@ var package_default = {
264135
264135
  "@inquirer/input": "4.2.1",
264136
264136
  "@inquirer/password": "4.0.17",
264137
264137
  "@inquirer/select": "4.3.1",
264138
- "@settlemint/sdk-hasura": "2.5.3-main08284871",
264139
- "@settlemint/sdk-js": "2.5.3-main08284871",
264140
- "@settlemint/sdk-utils": "2.5.3-main08284871",
264141
- "@settlemint/sdk-viem": "2.5.3-main08284871",
264138
+ "@settlemint/sdk-hasura": "2.5.3-main3b21b3b1",
264139
+ "@settlemint/sdk-js": "2.5.3-main3b21b3b1",
264140
+ "@settlemint/sdk-utils": "2.5.3-main3b21b3b1",
264141
+ "@settlemint/sdk-viem": "2.5.3-main3b21b3b1",
264142
264142
  "@types/node": "24.1.0",
264143
264143
  "@types/semver": "7.7.0",
264144
264144
  "@types/which": "3.0.4",
@@ -264155,7 +264155,7 @@ var package_default = {
264155
264155
  },
264156
264156
  peerDependencies: {
264157
264157
  hardhat: "2.26.1",
264158
- "@settlemint/sdk-js": "2.5.3-main08284871"
264158
+ "@settlemint/sdk-js": "2.5.3-main3b21b3b1"
264159
264159
  },
264160
264160
  peerDependenciesMeta: {
264161
264161
  hardhat: {
@@ -268640,6 +268640,10 @@ export const portalWebsocketClient = getWebsocketClient({
268640
268640
  }
268641
268641
  }
268642
268642
 
268643
+ // src/commands/codegen/codegen-the-graph.ts
268644
+ import { readFile as readFile7, writeFile as writeFile5 } from "node:fs/promises";
268645
+ import { join as join7 } from "node:path";
268646
+
268643
268647
  // ../utils/dist/index.js
268644
268648
  var maskTokens5 = (output) => {
268645
268649
  return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
@@ -268796,14 +268800,16 @@ async function codegenTheGraph(env2, subgraphNames) {
268796
268800
  }
268797
268801
  const introspectionVariable = getVariableName(`${name4}Introspection`);
268798
268802
  note(`Generating TheGraph subgraph ${name4}`);
268803
+ const schemaName = `the-graph-schema-${name4}.graphql`;
268799
268804
  await generateSchema({
268800
268805
  input: gqlEndpoint,
268801
- output: `the-graph-schema-${name4}.graphql`,
268806
+ output: schemaName,
268802
268807
  tsconfig: undefined,
268803
268808
  headers: accessToken ? {
268804
268809
  "x-auth-token": accessToken
268805
268810
  } : {}
268806
268811
  });
268812
+ await injectFetchAllDirective(schemaName);
268807
268813
  const nameSuffix = capitalizeFirstLetter2(name4);
268808
268814
  const graphqlClientVariable = getVariableName(`theGraphClient${nameSuffix}`);
268809
268815
  const graphqlVariable = getVariableName(`theGraphGraphql${nameSuffix}`);
@@ -268852,9 +268858,32 @@ export const theGraphGraphql = ${graphqlVariable};
268852
268858
  await installDependencies(PACKAGE_NAME3, projectDir);
268853
268859
  }
268854
268860
  }
268861
+ async function injectFetchAllDirective(schemaName) {
268862
+ try {
268863
+ const schemaPath = join7(process.cwd(), schemaName);
268864
+ const schema = await readFile7(schemaPath, "utf8");
268865
+ const directive = `"""
268866
+ Indicates that the field should fetch data for all pages.
268867
+ """
268868
+ directive @fetchAll on FIELD`;
268869
+ const newSchema = `${directive}
268870
+ ${schema}`;
268871
+ const schemaLines = newSchema.split(`
268872
+ `);
268873
+ for (let i7 = 0;i7 < schemaLines.length; i7++) {
268874
+ if (schemaLines[i7].includes("skip: Int = 0")) {
268875
+ schemaLines[i7] += " @fetchAll";
268876
+ }
268877
+ }
268878
+ await writeFile5(schemaPath, schemaLines.join(`
268879
+ `), "utf8");
268880
+ } catch (error45) {
268881
+ note(`Error injecting fetchAll directive into ${schemaName}: ${error45 instanceof Error ? error45.message : String(error45)}`, "warn");
268882
+ }
268883
+ }
268855
268884
 
268856
268885
  // src/commands/codegen/codegen-tsconfig.ts
268857
- import { writeFile as writeFile5 } from "node:fs/promises";
268886
+ import { writeFile as writeFile6 } from "node:fs/promises";
268858
268887
 
268859
268888
  // ../../node_modules/.bun/get-tsconfig@4.10.1/node_modules/get-tsconfig/dist/index.mjs
268860
268889
  import m6 from "node:path";
@@ -269901,7 +269930,7 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
269901
269930
  tsconfig.config.compilerOptions.paths = {};
269902
269931
  }
269903
269932
  tsconfig.config.compilerOptions.paths["@schemas/*"] = ["./*.d.ts"];
269904
- await writeFile5(tsconfig.path, JSON.stringify(tsconfig.config, null, 2), "utf8");
269933
+ await writeFile6(tsconfig.path, JSON.stringify(tsconfig.config, null, 2), "utf8");
269905
269934
  return {
269906
269935
  hasura,
269907
269936
  portal,
@@ -270260,7 +270289,7 @@ ${examples.map(({ description, command, commandPrefix }) => {
270260
270289
  }
270261
270290
 
270262
270291
  // src/commands/codegen/codegen-blockscout.ts
270263
- import { rm as rm2, writeFile as writeFile6 } from "node:fs/promises";
270292
+ import { rm as rm2, writeFile as writeFile7 } from "node:fs/promises";
270264
270293
  import { basename, resolve as resolve5 } from "node:path";
270265
270294
  var PACKAGE_NAME4 = "@settlemint/sdk-blockscout";
270266
270295
  async function codegenBlockscout(env2) {
@@ -270384,7 +270413,7 @@ async function codegenBlockscout(env2) {
270384
270413
  operationName: "IntrospectionQuery"
270385
270414
  })
270386
270415
  });
270387
- await writeFile6(introspectionJsonPath, JSON.stringify(data));
270416
+ await writeFile7(introspectionJsonPath, JSON.stringify(data));
270388
270417
  } catch (err) {
270389
270418
  const error45 = err;
270390
270419
  note(`GraphQL endpoint '${endpoint}' is not reachable: ${error45.message}`, "warn");
@@ -277864,7 +277893,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
277864
277893
 
277865
277894
  // src/commands/create.ts
277866
277895
  import { mkdir as mkdir6 } from "node:fs/promises";
277867
- import { join as join8 } from "node:path";
277896
+ import { join as join9 } from "node:path";
277868
277897
 
277869
277898
  // src/utils/platform-utils.ts
277870
277899
  function getUseCases(platformConfig) {
@@ -277925,7 +277954,7 @@ async function projectNamePrompt(env2, argument) {
277925
277954
  import { mkdir as mkdir5 } from "node:fs/promises";
277926
277955
 
277927
277956
  // ../../node_modules/.bun/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs
277928
- import { readFile as readFile8, writeFile as writeFile7, mkdir as mkdir4, rm as rm3 } from "node:fs/promises";
277957
+ import { readFile as readFile9, writeFile as writeFile8, mkdir as mkdir4, rm as rm3 } from "node:fs/promises";
277929
277958
  import { existsSync as existsSync3, renameSync, createWriteStream, readdirSync as readdirSync2 } from "node:fs";
277930
277959
  import j$1 from "assert";
277931
277960
  import H$2 from "path";
@@ -277979,7 +278008,7 @@ var normalize3 = function(path5) {
277979
278008
  }
277980
278009
  return isPathAbsolute && !isAbsolute(path5) ? `/${path5}` : path5;
277981
278010
  };
277982
- var join7 = function(...segments) {
278011
+ var join8 = function(...segments) {
277983
278012
  let path5 = "";
277984
278013
  for (const seg of segments) {
277985
278014
  if (!seg) {
@@ -278682,7 +278711,7 @@ var be3 = ve4;
278682
278711
 
278683
278712
  // ../../node_modules/.bun/nypm@0.6.0/node_modules/nypm/dist/shared/nypm.Bcw9TJOu.mjs
278684
278713
  import { existsSync as existsSync2 } from "node:fs";
278685
- import { readFile as readFile7 } from "node:fs/promises";
278714
+ import { readFile as readFile8 } from "node:fs/promises";
278686
278715
  async function findup(cwd2, match2, options = {}) {
278687
278716
  const segments = normalize3(cwd2).split("/");
278688
278717
  while (segments.length > 0) {
@@ -278796,9 +278825,9 @@ var packageManagers = [
278796
278825
  async function detectPackageManager2(cwd2, options = {}) {
278797
278826
  const detected = await findup(resolve6(cwd2 || "."), async (path5) => {
278798
278827
  if (!options.ignorePackageJSON) {
278799
- const packageJSONPath = join7(path5, "package.json");
278828
+ const packageJSONPath = join8(path5, "package.json");
278800
278829
  if (existsSync2(packageJSONPath)) {
278801
- const packageJSON = JSON.parse(await readFile7(packageJSONPath, "utf8"));
278830
+ const packageJSON = JSON.parse(await readFile8(packageJSONPath, "utf8"));
278802
278831
  if (packageJSON?.packageManager) {
278803
278832
  const {
278804
278833
  name: name4,
@@ -278822,7 +278851,7 @@ async function detectPackageManager2(cwd2, options = {}) {
278822
278851
  }
278823
278852
  }
278824
278853
  }
278825
- const denoJSONPath = join7(path5, "deno.json");
278854
+ const denoJSONPath = join8(path5, "deno.json");
278826
278855
  if (existsSync2(denoJSONPath)) {
278827
278856
  return packageManagers.find((pm) => pm.name === "deno");
278828
278857
  }
@@ -281306,7 +281335,7 @@ var r6 = v6();
281306
281335
  var tarExtract = getDefaultExportFromCjs3(r6);
281307
281336
  async function download(url2, filePath, options = {}) {
281308
281337
  const infoPath = filePath + ".json";
281309
- const info = JSON.parse(await readFile8(infoPath, "utf8").catch(() => "{}"));
281338
+ const info = JSON.parse(await readFile9(infoPath, "utf8").catch(() => "{}"));
281310
281339
  const headResponse = await sendFetch(url2, {
281311
281340
  method: "HEAD",
281312
281341
  headers: options.headers
@@ -281326,7 +281355,7 @@ async function download(url2, filePath, options = {}) {
281326
281355
  }
281327
281356
  const stream2 = createWriteStream(filePath);
281328
281357
  await promisify(pipeline)(response.body, stream2);
281329
- await writeFile7(infoPath, JSON.stringify(info), "utf8");
281358
+ await writeFile8(infoPath, JSON.stringify(info), "utf8");
281330
281359
  }
281331
281360
  var inputRegex = /^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;
281332
281361
  function parseGitURI(input) {
@@ -281669,7 +281698,7 @@ function createCommand2() {
281669
281698
  }
281670
281699
  const name4 = await projectNamePrompt(env2, projectName);
281671
281700
  const targetDir = formatTargetDir(name4);
281672
- const projectDir = join8(process.cwd(), targetDir);
281701
+ const projectDir = join9(process.cwd(), targetDir);
281673
281702
  if (!await exists3(projectDir)) {
281674
281703
  await mkdir6(projectDir, { recursive: true });
281675
281704
  }
@@ -285137,7 +285166,7 @@ function platformCommand() {
285137
285166
 
285138
285167
  // src/commands/smart-contract-set/create.ts
285139
285168
  import { rmdir } from "node:fs/promises";
285140
- import { join as join9 } from "node:path";
285169
+ import { join as join10 } from "node:path";
285141
285170
 
285142
285171
  // src/prompts/smart-contract-set/use-case.prompt.ts
285143
285172
  async function useCasePrompt(platformConfig, argument) {
@@ -285214,7 +285243,7 @@ function createCommand4() {
285214
285243
  return nothingSelectedError("use case");
285215
285244
  }
285216
285245
  const targetDir = formatTargetDir(name4);
285217
- const projectDir = join9(process.cwd(), targetDir);
285246
+ const projectDir = join10(process.cwd(), targetDir);
285218
285247
  if (await exists3(projectDir) && !await isEmpty(projectDir)) {
285219
285248
  const confirmEmpty = await esm_default4({
285220
285249
  message: `The folder ${projectDir} already exists. Do you want to delete it?`,
@@ -285821,39 +285850,39 @@ function hardhatTestCommand() {
285821
285850
  }
285822
285851
 
285823
285852
  // src/commands/smart-contract-set/subgraph/add.ts
285824
- import { copyFile, mkdir as mkdir7, readFile as readFile10, unlink as unlink2, writeFile as writeFile9 } from "node:fs/promises";
285825
- import { basename as basename5, dirname as dirname8, isAbsolute as isAbsolute2, join as join11, relative as relative4 } from "node:path";
285853
+ import { copyFile, mkdir as mkdir7, readFile as readFile11, unlink as unlink2, writeFile as writeFile10 } from "node:fs/promises";
285854
+ import { basename as basename5, dirname as dirname8, isAbsolute as isAbsolute2, join as join12, relative as relative4 } from "node:path";
285826
285855
 
285827
285856
  // src/utils/subgraph/subgraph-config.ts
285828
- import { readFile as readFile9, writeFile as writeFile8 } from "node:fs/promises";
285829
- import { basename as basename4, join as join10 } from "node:path";
285857
+ import { readFile as readFile10, writeFile as writeFile9 } from "node:fs/promises";
285858
+ import { basename as basename4, join as join11 } from "node:path";
285830
285859
  var CONFIG_FILE_PATH = "./subgraph/subgraph.config.json";
285831
- var isGenerated = (path5 = process.cwd()) => exists3(join10(path5, CONFIG_FILE_PATH));
285860
+ var isGenerated = (path5 = process.cwd()) => exists3(join11(path5, CONFIG_FILE_PATH));
285832
285861
  var getSubgraphYamlFile = async (path5 = process.cwd()) => {
285833
285862
  const generated = await isGenerated(path5);
285834
- if (generated && await exists3(join10(path5, "generated/scs.subgraph.yaml"))) {
285835
- return join10(path5, "generated/scs.subgraph.yaml");
285863
+ if (generated && await exists3(join11(path5, "generated/scs.subgraph.yaml"))) {
285864
+ return join11(path5, "generated/scs.subgraph.yaml");
285836
285865
  }
285837
- if (await exists3(join10(path5, "subgraph/subgraph.yaml"))) {
285838
- return join10(path5, "subgraph/subgraph.yaml");
285866
+ if (await exists3(join11(path5, "subgraph/subgraph.yaml"))) {
285867
+ return join11(path5, "subgraph/subgraph.yaml");
285839
285868
  }
285840
- if (await exists3(join10(path5, "subgraph.yaml"))) {
285841
- return join10(path5, "subgraph.yaml");
285869
+ if (await exists3(join11(path5, "subgraph.yaml"))) {
285870
+ return join11(path5, "subgraph.yaml");
285842
285871
  }
285843
285872
  throw new Error("Subgraph configuration file not found");
285844
285873
  };
285845
285874
  var getSubgraphYamlConfig = async (path5 = process.cwd()) => {
285846
285875
  const subgraphYamlFile = await getSubgraphYamlFile(path5);
285847
- const rawYamlConfig = await readFile9(subgraphYamlFile);
285876
+ const rawYamlConfig = await readFile10(subgraphYamlFile);
285848
285877
  return $parse(rawYamlConfig.toString());
285849
285878
  };
285850
285879
  var updateSubgraphYamlConfig = async (config3, cwd2 = process.cwd()) => {
285851
285880
  const subgraphYamlFile = await getSubgraphYamlFile(cwd2);
285852
- await writeFile8(subgraphYamlFile, $stringify(config3));
285881
+ await writeFile9(subgraphYamlFile, $stringify(config3));
285853
285882
  };
285854
285883
  var getSubgraphConfig = async (path5 = process.cwd()) => {
285855
285884
  try {
285856
- const configContents = await readFile9(join10(path5, CONFIG_FILE_PATH));
285885
+ const configContents = await readFile10(join11(path5, CONFIG_FILE_PATH));
285857
285886
  const currentConfig = tryParseJson4(configContents.toString());
285858
285887
  return currentConfig;
285859
285888
  } catch (err) {
@@ -285873,7 +285902,7 @@ function subgraphAddCommand() {
285873
285902
  }
285874
285903
  ])).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 }) => {
285875
285904
  intro(`Adding subgraph config for contract ${contractName}`);
285876
- const abiPath = isAbsolute2(abi2) ? abi2 : join11(process.cwd(), abi2);
285905
+ const abiPath = isAbsolute2(abi2) ? abi2 : join12(process.cwd(), abi2);
285877
285906
  if (!await exists3(abiPath)) {
285878
285907
  throw new Error("ABI file not found");
285879
285908
  }
@@ -285885,8 +285914,8 @@ function subgraphAddCommand() {
285885
285914
  const subgraphYamlFile = await getSubgraphYamlFile();
285886
285915
  const abiName = basename5(abiPath);
285887
285916
  const subgraphYamlDir = dirname8(subgraphYamlFile);
285888
- await mkdir7(join11(subgraphYamlDir, "abis"), { recursive: true });
285889
- const localAbiPath = join11(subgraphYamlDir, "abis", abiName);
285917
+ await mkdir7(join12(subgraphYamlDir, "abis"), { recursive: true });
285918
+ const localAbiPath = join12(subgraphYamlDir, "abis", abiName);
285890
285919
  await copyFile(abiPath, localAbiPath);
285891
285920
  try {
285892
285921
  const root = await projectRoot4();
@@ -285934,12 +285963,12 @@ function subgraphAddCommand() {
285934
285963
  });
285935
285964
  }
285936
285965
  async function fixPackageJson(packageJsonDir, requiresCodegenScript = true) {
285937
- const packageJsonPath = join11(packageJsonDir, "package.json");
285966
+ const packageJsonPath = join12(packageJsonDir, "package.json");
285938
285967
  if (!await exists3(packageJsonPath)) {
285939
285968
  return;
285940
285969
  }
285941
285970
  let hasPackageJsonChanged = false;
285942
- const subgraphPackageJson = await readFile10(packageJsonPath);
285971
+ const subgraphPackageJson = await readFile11(packageJsonPath);
285943
285972
  const subgraphPackageJsonData = JSON.parse(subgraphPackageJson.toString());
285944
285973
  if (subgraphPackageJsonData.packageManager?.includes("bun")) {
285945
285974
  note("Removing package manager from package.json (bun is not an official package manager)");
@@ -285952,7 +285981,7 @@ async function fixPackageJson(packageJsonDir, requiresCodegenScript = true) {
285952
285981
  hasPackageJsonChanged = true;
285953
285982
  }
285954
285983
  if (hasPackageJsonChanged) {
285955
- await writeFile9(packageJsonPath, JSON.stringify(subgraphPackageJsonData, null, 2));
285984
+ await writeFile10(packageJsonPath, JSON.stringify(subgraphPackageJsonData, null, 2));
285956
285985
  }
285957
285986
  }
285958
285987
 
@@ -286479,4 +286508,4 @@ async function sdkCliCommand(argv = process.argv) {
286479
286508
  // src/cli.ts
286480
286509
  sdkCliCommand();
286481
286510
 
286482
- //# debugId=D47ECEF51906EA0864756E2164756E21
286511
+ //# debugId=992608E72B20CBDB64756E2164756E21