@settlemint/sdk-cli 1.0.9-pr961dae20 → 1.0.9-pr9bf11a11
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/README.md +3 -3
- package/dist/cli.js +131 -13
- package/dist/cli.js.map +23 -20
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -84,10 +84,10 @@ npm install -g @settlemint/sdk-cli
|
|
|
84
84
|
bun install -g @settlemint/sdk-cli
|
|
85
85
|
|
|
86
86
|
# pnpm
|
|
87
|
-
pnpm
|
|
87
|
+
pnpm add -g @settlemint/sdk-cli
|
|
88
88
|
|
|
89
89
|
# yarn
|
|
90
|
-
yarn
|
|
90
|
+
yarn global add @settlemint/sdk-cli
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
You can access the CLI globally by running `settlemint` in your terminal.
|
|
@@ -249,7 +249,7 @@ settlemint scs subgraph deploy --accept-defaults <subgraph-name>
|
|
|
249
249
|
|
|
250
250
|
## API Reference
|
|
251
251
|
|
|
252
|
-
See the [documentation](https://github.com/settlemint/sdk/tree/v1.0.
|
|
252
|
+
See the [documentation](https://github.com/settlemint/sdk/tree/v1.0.9/sdk/cli/docs/settlemint.md) for available commands.
|
|
253
253
|
|
|
254
254
|
## Contributing
|
|
255
255
|
|
package/dist/cli.js
CHANGED
|
@@ -258165,6 +258165,90 @@ 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
|
+
|
|
258168
258252
|
// ../../node_modules/slugify/slugify.js
|
|
258169
258253
|
var require_slugify = __commonJS((exports, module) => {
|
|
258170
258254
|
(function(name2, root, factory) {
|
|
@@ -269202,7 +269286,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
|
269202
269286
|
var package_default = {
|
|
269203
269287
|
name: "@settlemint/sdk-cli",
|
|
269204
269288
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
|
269205
|
-
version: "1.0.9-
|
|
269289
|
+
version: "1.0.9-pr9bf11a11",
|
|
269206
269290
|
type: "module",
|
|
269207
269291
|
private: false,
|
|
269208
269292
|
license: "FSL-1.1-MIT",
|
|
@@ -269256,8 +269340,8 @@ var package_default = {
|
|
|
269256
269340
|
"@inquirer/input": "4.1.3",
|
|
269257
269341
|
"@inquirer/password": "4.0.6",
|
|
269258
269342
|
"@inquirer/select": "4.0.6",
|
|
269259
|
-
"@settlemint/sdk-js": "1.0.9-
|
|
269260
|
-
"@settlemint/sdk-utils": "1.0.9-
|
|
269343
|
+
"@settlemint/sdk-js": "1.0.9-pr9bf11a11",
|
|
269344
|
+
"@settlemint/sdk-utils": "1.0.9-pr9bf11a11",
|
|
269261
269345
|
"get-tsconfig": "4.10.0",
|
|
269262
269346
|
giget: "1.2.3",
|
|
269263
269347
|
yaml: "2.7.0"
|
|
@@ -269360,9 +269444,6 @@ var cancel2 = (msg) => {
|
|
|
269360
269444
|
throw new CancelError2(msg);
|
|
269361
269445
|
};
|
|
269362
269446
|
async function executeCommand(command, args, options) {
|
|
269363
|
-
console.log("command", command);
|
|
269364
|
-
console.log("args", args);
|
|
269365
|
-
console.log("options", options);
|
|
269366
269447
|
const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
|
|
269367
269448
|
process.stdin.pipe(child.stdin);
|
|
269368
269449
|
const output = [];
|
|
@@ -278852,6 +278933,17 @@ function formatUseCaseName(name2) {
|
|
|
278852
278933
|
return name2;
|
|
278853
278934
|
}
|
|
278854
278935
|
|
|
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
|
+
|
|
278855
278947
|
// src/commands/smart-contract-set/create.ts
|
|
278856
278948
|
function createCommand4() {
|
|
278857
278949
|
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 }) => {
|
|
@@ -278884,7 +278976,7 @@ function createCommand4() {
|
|
|
278884
278976
|
await spinner({
|
|
278885
278977
|
startMessage: "Scaffolding the smart contract set",
|
|
278886
278978
|
task: async () => {
|
|
278887
|
-
await
|
|
278979
|
+
await executeFoundryCommand("forge", [
|
|
278888
278980
|
"init",
|
|
278889
278981
|
name2,
|
|
278890
278982
|
"--template",
|
|
@@ -278928,7 +279020,7 @@ function foundryBuildCommand() {
|
|
|
278928
279020
|
}
|
|
278929
279021
|
])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
|
278930
279022
|
const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
|
278931
|
-
await
|
|
279023
|
+
await executeFoundryCommand("forge", ["build", ...forgeOptions]);
|
|
278932
279024
|
});
|
|
278933
279025
|
}
|
|
278934
279026
|
|
|
@@ -278949,7 +279041,7 @@ function foundryFormatCommand() {
|
|
|
278949
279041
|
}
|
|
278950
279042
|
])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
|
278951
279043
|
const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
|
278952
|
-
await
|
|
279044
|
+
await executeFoundryCommand("forge", ["fmt", ...forgeOptions]);
|
|
278953
279045
|
note("Smart contract set formatted successfully!");
|
|
278954
279046
|
});
|
|
278955
279047
|
}
|
|
@@ -278971,7 +279063,7 @@ function foundryNetworkCommand() {
|
|
|
278971
279063
|
}
|
|
278972
279064
|
])).helpOption(false).option("-h, --help", "Get list of possible anvil options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
|
278973
279065
|
const anvilOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
|
278974
|
-
await
|
|
279066
|
+
await executeFoundryCommand("anvil", anvilOptions);
|
|
278975
279067
|
});
|
|
278976
279068
|
}
|
|
278977
279069
|
|
|
@@ -278992,10 +279084,26 @@ function foundryTestCommand() {
|
|
|
278992
279084
|
}
|
|
278993
279085
|
])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
|
278994
279086
|
const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
|
278995
|
-
await
|
|
279087
|
+
await executeFoundryCommand("forge", ["test", ...forgeOptions]);
|
|
278996
279088
|
});
|
|
278997
279089
|
}
|
|
278998
279090
|
|
|
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
|
+
|
|
278999
279107
|
// src/commands/smart-contract-set/hardhat/build.ts
|
|
279000
279108
|
function hardhatBuildCommand() {
|
|
279001
279109
|
return new Command("build").description("Build the smart contracts using Hardhat").usage(createExamples([
|
|
@@ -279012,6 +279120,7 @@ function hardhatBuildCommand() {
|
|
|
279012
279120
|
command: "scs hardhat build --concurrency 2"
|
|
279013
279121
|
}
|
|
279014
279122
|
])).helpOption(false).option("-h, --help", "Get list of possible hardhat compile options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
|
279123
|
+
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
|
279015
279124
|
const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
|
279016
279125
|
const { command, args } = await getPackageManagerExecutable();
|
|
279017
279126
|
await executeCommand(command, [...args, "hardhat", "compile", ...hardhatOptions]);
|
|
@@ -279038,6 +279147,7 @@ function hardhatDeployLocalCommand() {
|
|
|
279038
279147
|
command: "scs hardhat deploy local --verify"
|
|
279039
279148
|
}
|
|
279040
279149
|
])).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"]);
|
|
279041
279151
|
const { command, args } = await getPackageManagerExecutable();
|
|
279042
279152
|
await executeCommand(command, [
|
|
279043
279153
|
...args,
|
|
@@ -279214,6 +279324,7 @@ function hardhatDeployRemoteCommand() {
|
|
|
279214
279324
|
acceptDefaults,
|
|
279215
279325
|
blockchainNode: blockchainNodeUniqueName
|
|
279216
279326
|
}) => {
|
|
279327
|
+
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
|
279217
279328
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
279218
279329
|
const env2 = await loadEnv(false, !!prod);
|
|
279219
279330
|
const instance = await instancePrompt(env2, true);
|
|
@@ -279284,6 +279395,7 @@ function hardhatNetworkCommand() {
|
|
|
279284
279395
|
command: "scs hardhat network --port 3000"
|
|
279285
279396
|
}
|
|
279286
279397
|
])).helpOption(false).option("-h, --help", "Get list of possible hardhat node options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
|
279398
|
+
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
|
279287
279399
|
const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
|
279288
279400
|
const { command, args } = await getPackageManagerExecutable();
|
|
279289
279401
|
await executeCommand(command, [...args, "hardhat", "node", ...hardhatOptions]);
|
|
@@ -279293,6 +279405,7 @@ function hardhatNetworkCommand() {
|
|
|
279293
279405
|
// src/commands/smart-contract-set/hardhat/script/local.ts
|
|
279294
279406
|
function hardhatScriptLocalCommand() {
|
|
279295
279407
|
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"]);
|
|
279296
279409
|
const { command, args } = await getPackageManagerExecutable();
|
|
279297
279410
|
await executeCommand(command, [
|
|
279298
279411
|
...args,
|
|
@@ -279310,6 +279423,7 @@ function hardhatScriptLocalCommand() {
|
|
|
279310
279423
|
function hardhatScriptRemoteCommand() {
|
|
279311
279424
|
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");
|
|
279312
279425
|
cmd2.action(async ({ script, prod, blockchainNode: blockchainNodeUniqueName, acceptDefaults, compile }) => {
|
|
279426
|
+
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
|
279313
279427
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
279314
279428
|
const env2 = await loadEnv(false, !!prod);
|
|
279315
279429
|
const instance = await instancePrompt(env2, true);
|
|
@@ -279358,6 +279472,7 @@ function hardhatTestCommand() {
|
|
|
279358
279472
|
command: "scs hardhat test test/token.test.ts"
|
|
279359
279473
|
}
|
|
279360
279474
|
])).helpOption(false).option("-h, --help", "Get list of possible hardhat test options").passThroughOptions().allowUnknownOption().action(async (options, cmd2) => {
|
|
279475
|
+
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
|
279361
279476
|
const hardhatOptions = mapPassthroughOptions(options, cmd2);
|
|
279362
279477
|
const { command, args } = await getPackageManagerExecutable();
|
|
279363
279478
|
await executeCommand(command, [...args, "hardhat", "test", ...hardhatOptions]);
|
|
@@ -279426,7 +279541,7 @@ var SETTLEMINT_NETWORK = "settlemint";
|
|
|
279426
279541
|
async function subgraphSetup({ network }) {
|
|
279427
279542
|
const generated = await isGenerated();
|
|
279428
279543
|
if (generated) {
|
|
279429
|
-
await
|
|
279544
|
+
await executeFoundryCommand("forge", ["build"]);
|
|
279430
279545
|
}
|
|
279431
279546
|
if (await exists3("./generated")) {
|
|
279432
279547
|
await rm4("./generated", { recursive: true, force: true });
|
|
@@ -279529,6 +279644,7 @@ async function getNodeName({
|
|
|
279529
279644
|
// src/commands/smart-contract-set/subgraph/build.ts
|
|
279530
279645
|
function subgraphBuildCommand() {
|
|
279531
279646
|
return new Command("build").description("Build the subgraph").action(async () => {
|
|
279647
|
+
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
|
279532
279648
|
await subgraphSetup({
|
|
279533
279649
|
network: SETTLEMINT_NETWORK
|
|
279534
279650
|
});
|
|
@@ -279544,6 +279660,7 @@ function subgraphBuildCommand() {
|
|
|
279544
279660
|
import { dirname as dirname11 } from "node:path";
|
|
279545
279661
|
function subgraphCodegenCommand() {
|
|
279546
279662
|
return new Command("codegen").description("Codegen the subgraph types").action(async () => {
|
|
279663
|
+
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
|
279547
279664
|
await subgraphSetup({
|
|
279548
279665
|
network: SETTLEMINT_NETWORK
|
|
279549
279666
|
});
|
|
@@ -279602,6 +279719,7 @@ function subgraphDeployCommand() {
|
|
|
279602
279719
|
command: "scs subgraph deploy my-subgraph"
|
|
279603
279720
|
}
|
|
279604
279721
|
])).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"]);
|
|
279605
279723
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
279606
279724
|
const env2 = await loadEnv(false, !!prod);
|
|
279607
279725
|
const instance = await instancePrompt(env2, true);
|
|
@@ -279791,4 +279909,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
|
279791
279909
|
// src/cli.ts
|
|
279792
279910
|
sdkCliCommand();
|
|
279793
279911
|
|
|
279794
|
-
//# debugId=
|
|
279912
|
+
//# debugId=9B8A955B0FD572C564756E2164756E21
|