@settlemint/sdk-cli 2.3.14-praeeb9d7e → 2.3.14-prbb564ea5
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 +20 -160
- package/dist/cli.js.map +7 -8
- package/package.json +5 -6
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: () =>
|
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
|
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) ||
|
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) ||
|
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 =
|
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: () =>
|
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.
|
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-
|
263767
|
+
version: "2.3.14-prbb564ea5",
|
263768
263768
|
type: "module",
|
263769
263769
|
private: false,
|
263770
263770
|
license: "FSL-1.1-MIT",
|
@@ -263813,9 +263813,8 @@ var package_default = {
|
|
263813
263813
|
"@inquirer/input": "4.1.12",
|
263814
263814
|
"@inquirer/password": "4.0.15",
|
263815
263815
|
"@inquirer/select": "4.2.3",
|
263816
|
-
"@settlemint/sdk-js": "2.3.14-
|
263817
|
-
"@settlemint/sdk-utils": "2.3.14-
|
263818
|
-
"@settlemint/sdk-viem": "2.3.14-praeeb9d7e",
|
263816
|
+
"@settlemint/sdk-js": "2.3.14-prbb564ea5",
|
263817
|
+
"@settlemint/sdk-utils": "2.3.14-prbb564ea5",
|
263819
263818
|
"@types/node": "24.0.1",
|
263820
263819
|
"@types/semver": "7.7.0",
|
263821
263820
|
"@types/which": "3.0.4",
|
@@ -263824,13 +263823,13 @@ var package_default = {
|
|
263824
263823
|
"is-in-ci": "1.0.0",
|
263825
263824
|
semver: "7.7.2",
|
263826
263825
|
slugify: "1.6.6",
|
263827
|
-
viem: "2.31.
|
263826
|
+
viem: "2.31.0",
|
263828
263827
|
which: "5.0.0",
|
263829
263828
|
yaml: "2.8.0",
|
263830
263829
|
yoctocolors: "2.1.1"
|
263831
263830
|
},
|
263832
263831
|
peerDependencies: {
|
263833
|
-
hardhat: "2.24.
|
263832
|
+
hardhat: "2.24.2"
|
263834
263833
|
},
|
263835
263834
|
peerDependenciesMeta: {
|
263836
263835
|
hardhat: {
|
@@ -295793,17 +295792,6 @@ async function exists3(path$1) {
|
|
295793
295792
|
return false;
|
295794
295793
|
}
|
295795
295794
|
}
|
295796
|
-
function tryParseJson3(value2, defaultValue = null) {
|
295797
|
-
try {
|
295798
|
-
const parsed = JSON.parse(value2);
|
295799
|
-
if (parsed === undefined || parsed === null) {
|
295800
|
-
return defaultValue;
|
295801
|
-
}
|
295802
|
-
return parsed;
|
295803
|
-
} catch (err) {
|
295804
|
-
return defaultValue;
|
295805
|
-
}
|
295806
|
-
}
|
295807
295795
|
var require_balanced_match4 = __commonJS4({ "../../node_modules/balanced-match/index.js"(exports, module) {
|
295808
295796
|
module.exports = balanced$1;
|
295809
295797
|
function balanced$1(a3, b, str) {
|
@@ -301282,45 +301270,9 @@ var glob3 = Object.assign(glob_3, {
|
|
301282
301270
|
unescape: unescape4
|
301283
301271
|
});
|
301284
301272
|
glob3.glob = glob3;
|
301285
|
-
async function findMonoRepoRoot2(startDir) {
|
301286
|
-
const lockFilePath = await findUp([
|
301287
|
-
"package-lock.json",
|
301288
|
-
"yarn.lock",
|
301289
|
-
"pnpm-lock.yaml",
|
301290
|
-
"bun.lockb",
|
301291
|
-
"bun.lock"
|
301292
|
-
], { cwd: startDir });
|
301293
|
-
if (lockFilePath) {
|
301294
|
-
const packageJsonPath = join3(dirname3(lockFilePath), "package.json");
|
301295
|
-
const hasWorkSpaces = await packageJsonHasWorkspaces2(packageJsonPath);
|
301296
|
-
return hasWorkSpaces ? dirname3(lockFilePath) : null;
|
301297
|
-
}
|
301298
|
-
let currentDir = startDir;
|
301299
|
-
while (currentDir !== "/") {
|
301300
|
-
const packageJsonPath = join3(currentDir, "package.json");
|
301301
|
-
if (await packageJsonHasWorkspaces2(packageJsonPath)) {
|
301302
|
-
return currentDir;
|
301303
|
-
}
|
301304
|
-
const parentDir = dirname3(currentDir);
|
301305
|
-
if (parentDir === currentDir) {
|
301306
|
-
break;
|
301307
|
-
}
|
301308
|
-
currentDir = parentDir;
|
301309
|
-
}
|
301310
|
-
return null;
|
301311
|
-
}
|
301312
|
-
async function packageJsonHasWorkspaces2(packageJsonPath) {
|
301313
|
-
if (await exists3(packageJsonPath)) {
|
301314
|
-
const packageJson = tryParseJson3(await readFile3(packageJsonPath, "utf-8"));
|
301315
|
-
if (packageJson?.workspaces && Array.isArray(packageJson?.workspaces) && packageJson?.workspaces.length > 0) {
|
301316
|
-
return true;
|
301317
|
-
}
|
301318
|
-
}
|
301319
|
-
return false;
|
301320
|
-
}
|
301321
301273
|
|
301322
301274
|
// ../utils/dist/json.js
|
301323
|
-
function
|
301275
|
+
function tryParseJson3(value2, defaultValue = null) {
|
301324
301276
|
try {
|
301325
301277
|
const parsed = JSON.parse(value2);
|
301326
301278
|
if (parsed === undefined || parsed === null) {
|
@@ -301339,7 +301291,7 @@ function extractJsonObject(value2) {
|
|
301339
301291
|
if (!result) {
|
301340
301292
|
return null;
|
301341
301293
|
}
|
301342
|
-
return
|
301294
|
+
return tryParseJson3(result[0]);
|
301343
301295
|
}
|
301344
301296
|
|
301345
301297
|
// src/utils/config.ts
|
@@ -301354,7 +301306,7 @@ async function readConfig() {
|
|
301354
301306
|
await ensureConfigDir();
|
301355
301307
|
try {
|
301356
301308
|
const content = await readFile4(CONFIG_FILE, "utf-8");
|
301357
|
-
return
|
301309
|
+
return tryParseJson3(content, { instances: {} });
|
301358
301310
|
} catch (error41) {
|
301359
301311
|
return { instances: {} };
|
301360
301312
|
}
|
@@ -329361,9 +329313,9 @@ function hardhatTestCommand() {
|
|
329361
329313
|
});
|
329362
329314
|
}
|
329363
329315
|
|
329364
|
-
// src/
|
329365
|
-
import {
|
329366
|
-
|
329316
|
+
// src/utils/subgraph/setup.ts
|
329317
|
+
import { rm as rm4 } from "node:fs/promises";
|
329318
|
+
var import_semver = __toESM(require_semver2(), 1);
|
329367
329319
|
|
329368
329320
|
// src/utils/subgraph/subgraph-config.ts
|
329369
329321
|
import { readFile as readFile9, writeFile as writeFile8 } from "node:fs/promises";
|
@@ -329395,7 +329347,7 @@ var updateSubgraphYamlConfig = async (config5, cwd2 = process.cwd()) => {
|
|
329395
329347
|
var getSubgraphConfig = async (path7 = process.cwd()) => {
|
329396
329348
|
try {
|
329397
329349
|
const configContents = await readFile9(join10(path7, CONFIG_FILE_PATH));
|
329398
|
-
const currentConfig =
|
329350
|
+
const currentConfig = tryParseJson3(configContents.toString());
|
329399
329351
|
return currentConfig;
|
329400
329352
|
} catch (err) {
|
329401
329353
|
const error45 = err;
|
@@ -329404,98 +329356,7 @@ var getSubgraphConfig = async (path7 = process.cwd()) => {
|
|
329404
329356
|
}
|
329405
329357
|
};
|
329406
329358
|
|
329407
|
-
// src/commands/smart-contract-set/subgraph/add.ts
|
329408
|
-
var DEFAULT_ADDRESS = "0x0000000000000000000000000000000000000000";
|
329409
|
-
function subgraphAddCommand() {
|
329410
|
-
return new Command("add").description("Add a contract to the subgraph").usage(createExamples([
|
329411
|
-
{
|
329412
|
-
description: "Add a contract to the subgraph",
|
329413
|
-
command: "scs subgraph add --abi=./abis/bond.json --contract-name=bond"
|
329414
|
-
}
|
329415
|
-
])).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 }) => {
|
329416
|
-
intro("Adding subgraph");
|
329417
|
-
const abiPath = isAbsolute2(abi2) ? abi2 : join11(process.cwd(), abi2);
|
329418
|
-
if (!await exists3(abiPath)) {
|
329419
|
-
throw new Error("ABI file not found");
|
329420
|
-
}
|
329421
|
-
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
329422
|
-
if (await isGenerated()) {
|
329423
|
-
throw new Error("This command does not support automatically generated subgraph configs");
|
329424
|
-
}
|
329425
|
-
const { command, args } = await getPackageManagerExecutable();
|
329426
|
-
const subgraphYamlFile = await getSubgraphYamlFile();
|
329427
|
-
const abiName = basename5(abiPath);
|
329428
|
-
const subgraphYamlDir = dirname8(subgraphYamlFile);
|
329429
|
-
await mkdir7(join11(subgraphYamlDir, "abis"), { recursive: true });
|
329430
|
-
const localAbiPath = join11(subgraphYamlDir, "abis", abiName);
|
329431
|
-
await copyFile(abiPath, localAbiPath);
|
329432
|
-
try {
|
329433
|
-
const root = await projectRoot3();
|
329434
|
-
const monoRepoRoot = await findMonoRepoRoot2(root);
|
329435
|
-
await fixPackageJson(root);
|
329436
|
-
if (monoRepoRoot) {
|
329437
|
-
await fixPackageJson(monoRepoRoot, false);
|
329438
|
-
}
|
329439
|
-
await executeCommand(command, [
|
329440
|
-
...args,
|
329441
|
-
"graph",
|
329442
|
-
"add",
|
329443
|
-
"--abi",
|
329444
|
-
abi2,
|
329445
|
-
"--contract-name",
|
329446
|
-
contractName,
|
329447
|
-
"--start-block",
|
329448
|
-
startBlock ?? "0",
|
329449
|
-
address ?? DEFAULT_ADDRESS,
|
329450
|
-
subgraphYamlFile
|
329451
|
-
]);
|
329452
|
-
const subgraphYamlConfig = await getSubgraphYamlConfig(subgraphYamlFile);
|
329453
|
-
if (subgraphYamlConfig) {
|
329454
|
-
const updatedDataSources = subgraphYamlConfig?.dataSources.map((dataSource) => {
|
329455
|
-
if (dataSource.name === contractName) {
|
329456
|
-
dataSource.network = network ?? "settlemint";
|
329457
|
-
dataSource.mapping.abis = [
|
329458
|
-
{
|
329459
|
-
name: contractName,
|
329460
|
-
file: relative4(subgraphYamlDir, abiPath)
|
329461
|
-
}
|
329462
|
-
];
|
329463
|
-
}
|
329464
|
-
return dataSource;
|
329465
|
-
});
|
329466
|
-
await updateSubgraphYamlConfig({
|
329467
|
-
...subgraphYamlConfig,
|
329468
|
-
dataSources: updatedDataSources
|
329469
|
-
});
|
329470
|
-
}
|
329471
|
-
} finally {
|
329472
|
-
await unlink2(localAbiPath);
|
329473
|
-
}
|
329474
|
-
outro("Subgraph added successfully");
|
329475
|
-
});
|
329476
|
-
}
|
329477
|
-
async function fixPackageJson(packageJsonPath, requiresCodegenScript = true) {
|
329478
|
-
let hasPackageJsonChanged = false;
|
329479
|
-
const subgraphPackageJson = await readFile10(packageJsonPath);
|
329480
|
-
const subgraphPackageJsonData = JSON.parse(subgraphPackageJson.toString());
|
329481
|
-
if (subgraphPackageJsonData.packageManager?.includes("bun")) {
|
329482
|
-
note("Removing package manager from package.json (bun is not an official package manager)");
|
329483
|
-
delete subgraphPackageJsonData.packageManager;
|
329484
|
-
hasPackageJsonChanged = true;
|
329485
|
-
}
|
329486
|
-
if (requiresCodegenScript && !subgraphPackageJsonData.scripts?.codegen) {
|
329487
|
-
note("Adding codegen script to package.json");
|
329488
|
-
subgraphPackageJsonData.scripts.codegen = "settlemint scs subgraph codegen";
|
329489
|
-
hasPackageJsonChanged = true;
|
329490
|
-
}
|
329491
|
-
if (hasPackageJsonChanged) {
|
329492
|
-
await writeFile9(packageJsonPath, JSON.stringify(subgraphPackageJsonData, null, 2));
|
329493
|
-
}
|
329494
|
-
}
|
329495
|
-
|
329496
329359
|
// src/utils/subgraph/setup.ts
|
329497
|
-
import { rm as rm4 } from "node:fs/promises";
|
329498
|
-
var import_semver = __toESM(require_semver2(), 1);
|
329499
329360
|
var SETTLEMINT_NETWORK = "settlemint";
|
329500
329361
|
async function subgraphSetup({ network }) {
|
329501
329362
|
const generated = await isGenerated();
|
@@ -329885,7 +329746,6 @@ function smartContractSetCommand() {
|
|
329885
329746
|
hardhat.addCommand(hardhatScriptCommand());
|
329886
329747
|
hardhat.addCommand(hardhatTestCommand());
|
329887
329748
|
const subgraph = new Command("subgraph").alias("sg").enablePositionalOptions().description("Commands for managing TheGraph subgraphs for smart contract indexing");
|
329888
|
-
subgraph.addCommand(subgraphAddCommand());
|
329889
329749
|
subgraph.addCommand(subgraphBuildCommand());
|
329890
329750
|
subgraph.addCommand(subgraphCodegenCommand());
|
329891
329751
|
subgraph.addCommand(subgraphDeployCommand());
|
@@ -330015,4 +329875,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
330015
329875
|
// src/cli.ts
|
330016
329876
|
sdkCliCommand();
|
330017
329877
|
|
330018
|
-
//# debugId=
|
329878
|
+
//# debugId=93A4EEF6C7884D8164756E2164756E21
|