@settlemint/sdk-cli 1.1.5-main78fe7704 → 1.1.5-main8beca133
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 +102 -11
- package/dist/cli.js.map +21 -20
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -274462,7 +274462,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
274462
274462
|
var package_default = {
|
274463
274463
|
name: "@settlemint/sdk-cli",
|
274464
274464
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
274465
|
-
version: "1.1.5-
|
274465
|
+
version: "1.1.5-main8beca133",
|
274466
274466
|
type: "module",
|
274467
274467
|
private: false,
|
274468
274468
|
license: "FSL-1.1-MIT",
|
@@ -274510,8 +274510,8 @@ var package_default = {
|
|
274510
274510
|
"@inquirer/input": "4.1.5",
|
274511
274511
|
"@inquirer/password": "4.0.8",
|
274512
274512
|
"@inquirer/select": "4.0.8",
|
274513
|
-
"@settlemint/sdk-js": "1.1.5-
|
274514
|
-
"@settlemint/sdk-utils": "1.1.5-
|
274513
|
+
"@settlemint/sdk-js": "1.1.5-main8beca133",
|
274514
|
+
"@settlemint/sdk-utils": "1.1.5-main8beca133",
|
274515
274515
|
"@types/node": "22.13.1",
|
274516
274516
|
"@types/semver": "7.5.8",
|
274517
274517
|
"@types/which": "3.0.4",
|
@@ -275760,6 +275760,11 @@ var outro = (msg) => {
|
|
275760
275760
|
console.log("");
|
275761
275761
|
};
|
275762
275762
|
var SpinnerError = class extends Error {
|
275763
|
+
constructor(message, originalError) {
|
275764
|
+
super(message);
|
275765
|
+
this.originalError = originalError;
|
275766
|
+
this.name = "SpinnerError";
|
275767
|
+
}
|
275763
275768
|
};
|
275764
275769
|
var spinner = async (options) => {
|
275765
275770
|
const handleError = (error) => {
|
@@ -275767,7 +275772,7 @@ var spinner = async (options) => {
|
|
275767
275772
|
note(redBright(`${errorMessage}
|
275768
275773
|
|
275769
275774
|
${error.stack}`));
|
275770
|
-
throw new SpinnerError(errorMessage);
|
275775
|
+
throw new SpinnerError(errorMessage, error);
|
275771
275776
|
};
|
275772
275777
|
if (is_in_ci_default) {
|
275773
275778
|
try {
|
@@ -282422,7 +282427,8 @@ async function waitForCompletion({
|
|
282422
282427
|
try {
|
282423
282428
|
return await showSpinner();
|
282424
282429
|
} catch (error5) {
|
282425
|
-
|
282430
|
+
const isTimeoutError = error5 instanceof SpinnerError && error5.originalError instanceof TimeoutError;
|
282431
|
+
if (restartIfTimeout && isTimeoutError) {
|
282426
282432
|
note(`Restarting ${capitalizeFirstLetter2(type4)}`);
|
282427
282433
|
await service.restart(uniqueName);
|
282428
282434
|
return showSpinner();
|
@@ -284676,8 +284682,10 @@ function foundryBuildCommand() {
|
|
284676
284682
|
command: "scs foundry build --optimize --force"
|
284677
284683
|
}
|
284678
284684
|
])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
284685
|
+
intro("Building smart contracts using Foundry");
|
284679
284686
|
const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
284680
284687
|
await executeFoundryCommand("forge", ["build", ...forgeOptions]);
|
284688
|
+
outro("Smart contracts built successfully");
|
284681
284689
|
});
|
284682
284690
|
}
|
284683
284691
|
|
@@ -284697,9 +284705,10 @@ function foundryFormatCommand() {
|
|
284697
284705
|
command: "scs foundry format --check"
|
284698
284706
|
}
|
284699
284707
|
])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
284708
|
+
intro("Formatting smart contracts using Foundry");
|
284700
284709
|
const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
284701
284710
|
await executeFoundryCommand("forge", ["fmt", ...forgeOptions]);
|
284702
|
-
|
284711
|
+
outro("Smart contracts formatted successfully");
|
284703
284712
|
});
|
284704
284713
|
}
|
284705
284714
|
|
@@ -284740,8 +284749,10 @@ function foundryTestCommand() {
|
|
284740
284749
|
command: "scs foundry test --match-test testToken"
|
284741
284750
|
}
|
284742
284751
|
])).helpOption(false).option("-h, --help", "Get list of possible forge options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
284752
|
+
intro("Running smart contract tests using Foundry");
|
284743
284753
|
const forgeOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
284744
284754
|
await executeFoundryCommand("forge", ["test", ...forgeOptions]);
|
284755
|
+
outro("Smart contract tests completed");
|
284745
284756
|
});
|
284746
284757
|
}
|
284747
284758
|
|
@@ -284777,10 +284788,12 @@ function hardhatBuildCommand() {
|
|
284777
284788
|
command: "scs hardhat build --concurrency 2"
|
284778
284789
|
}
|
284779
284790
|
])).helpOption(false).option("-h, --help", "Get list of possible hardhat compile options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
284791
|
+
intro("Building smart contracts using Hardhat");
|
284780
284792
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
284781
284793
|
const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
284782
284794
|
const { command, args } = await getPackageManagerExecutable();
|
284783
284795
|
await executeCommand(command, [...args, "hardhat", "compile", ...hardhatOptions]);
|
284796
|
+
outro("Smart contracts built successfully");
|
284784
284797
|
});
|
284785
284798
|
}
|
284786
284799
|
|
@@ -284804,6 +284817,7 @@ function hardhatDeployLocalCommand() {
|
|
284804
284817
|
command: "scs hardhat deploy local --verify"
|
284805
284818
|
}
|
284806
284819
|
])).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 }) => {
|
284820
|
+
intro("Deploying smart contracts to local network using Hardhat/Ignition");
|
284807
284821
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
284808
284822
|
const { command, args } = await getPackageManagerExecutable();
|
284809
284823
|
await executeCommand(command, [
|
@@ -284817,6 +284831,7 @@ function hardhatDeployLocalCommand() {
|
|
284817
284831
|
"localhost",
|
284818
284832
|
module ?? "ignition/modules/main.ts"
|
284819
284833
|
].filter(Boolean));
|
284834
|
+
outro("Smart contracts deployed successfully to local network");
|
284820
284835
|
});
|
284821
284836
|
}
|
284822
284837
|
|
@@ -284981,6 +284996,7 @@ function hardhatDeployRemoteCommand() {
|
|
284981
284996
|
acceptDefaults,
|
284982
284997
|
blockchainNode: blockchainNodeUniqueName
|
284983
284998
|
}) => {
|
284999
|
+
intro("Deploying smart contracts to remote network using Hardhat/Ignition");
|
284984
285000
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
284985
285001
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
284986
285002
|
const env2 = await loadEnv(false, !!prod);
|
@@ -285024,6 +285040,7 @@ function hardhatDeployRemoteCommand() {
|
|
285024
285040
|
address,
|
285025
285041
|
module ?? "ignition/modules/main.ts"
|
285026
285042
|
].filter(Boolean), { env: envConfig });
|
285043
|
+
outro("Smart contracts deployed successfully to remote network");
|
285027
285044
|
});
|
285028
285045
|
return cmd2;
|
285029
285046
|
}
|
@@ -285052,16 +285069,19 @@ function hardhatNetworkCommand() {
|
|
285052
285069
|
command: "scs hardhat network --port 3000"
|
285053
285070
|
}
|
285054
285071
|
])).helpOption(false).option("-h, --help", "Get list of possible hardhat node options").passThroughOptions().allowUnknownOption(true).action(async (passThroughOptions, cmd2) => {
|
285072
|
+
intro("Starting development network using Hardhat");
|
285055
285073
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
285056
285074
|
const hardhatOptions = mapPassthroughOptions(passThroughOptions, cmd2);
|
285057
285075
|
const { command, args } = await getPackageManagerExecutable();
|
285058
285076
|
await executeCommand(command, [...args, "hardhat", "node", ...hardhatOptions]);
|
285077
|
+
outro("Development network started successfully");
|
285059
285078
|
});
|
285060
285079
|
}
|
285061
285080
|
|
285062
285081
|
// src/commands/smart-contract-set/hardhat/script/local.ts
|
285063
285082
|
function hardhatScriptLocalCommand() {
|
285064
285083
|
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 }) => {
|
285084
|
+
intro("Running Hardhat script on local network");
|
285065
285085
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
285066
285086
|
const { command, args } = await getPackageManagerExecutable();
|
285067
285087
|
await executeCommand(command, [
|
@@ -285073,6 +285093,7 @@ function hardhatScriptLocalCommand() {
|
|
285073
285093
|
"localhost",
|
285074
285094
|
...compile ? ["--no-compile"] : []
|
285075
285095
|
]);
|
285096
|
+
outro("Script execution completed successfully");
|
285076
285097
|
});
|
285077
285098
|
}
|
285078
285099
|
|
@@ -285080,6 +285101,7 @@ function hardhatScriptLocalCommand() {
|
|
285080
285101
|
function hardhatScriptRemoteCommand() {
|
285081
285102
|
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");
|
285082
285103
|
cmd2.action(async ({ script, prod, blockchainNode: blockchainNodeUniqueName, acceptDefaults, compile }) => {
|
285104
|
+
intro("Running Hardhat script on remote network");
|
285083
285105
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
285084
285106
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
285085
285107
|
const env2 = await loadEnv(false, !!prod);
|
@@ -285097,6 +285119,7 @@ function hardhatScriptRemoteCommand() {
|
|
285097
285119
|
const envConfig = await settlemint.foundry.env(node.uniqueName);
|
285098
285120
|
const { command, args } = await getPackageManagerExecutable();
|
285099
285121
|
await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env: envConfig });
|
285122
|
+
outro("Script execution completed successfully");
|
285100
285123
|
});
|
285101
285124
|
return cmd2;
|
285102
285125
|
}
|
@@ -285129,10 +285152,12 @@ function hardhatTestCommand() {
|
|
285129
285152
|
command: "scs hardhat test test/token.test.ts"
|
285130
285153
|
}
|
285131
285154
|
])).helpOption(false).option("-h, --help", "Get list of possible hardhat test options").passThroughOptions().allowUnknownOption().action(async (options, cmd2) => {
|
285155
|
+
intro("Running smart contract tests using Hardhat");
|
285132
285156
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
285133
285157
|
const hardhatOptions = mapPassthroughOptions(options, cmd2);
|
285134
285158
|
const { command, args } = await getPackageManagerExecutable();
|
285135
285159
|
await executeCommand(command, [...args, "hardhat", "test", ...hardhatOptions]);
|
285160
|
+
outro("Smart contract tests completed");
|
285136
285161
|
});
|
285137
285162
|
}
|
285138
285163
|
|
@@ -285301,6 +285326,7 @@ async function getNodeName({
|
|
285301
285326
|
// src/commands/smart-contract-set/subgraph/build.ts
|
285302
285327
|
function subgraphBuildCommand() {
|
285303
285328
|
return new Command("build").description("Build the subgraph").action(async () => {
|
285329
|
+
intro("Building subgraph");
|
285304
285330
|
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
285305
285331
|
await subgraphSetup({
|
285306
285332
|
network: SETTLEMINT_NETWORK
|
@@ -285310,6 +285336,7 @@ function subgraphBuildCommand() {
|
|
285310
285336
|
const cwd2 = dirname10(subgraphYamlFile);
|
285311
285337
|
await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile], { cwd: cwd2 });
|
285312
285338
|
await executeCommand(command, [...args, "graph", "build", subgraphYamlFile], { cwd: cwd2 });
|
285339
|
+
outro("Subgraph built successfully");
|
285313
285340
|
});
|
285314
285341
|
}
|
285315
285342
|
|
@@ -285317,6 +285344,7 @@ function subgraphBuildCommand() {
|
|
285317
285344
|
import { dirname as dirname11 } from "node:path";
|
285318
285345
|
function subgraphCodegenCommand() {
|
285319
285346
|
return new Command("codegen").description("Codegen the subgraph types").action(async () => {
|
285347
|
+
intro("Generating subgraph types");
|
285320
285348
|
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
285321
285349
|
await subgraphSetup({
|
285322
285350
|
network: SETTLEMINT_NETWORK
|
@@ -285326,6 +285354,7 @@ function subgraphCodegenCommand() {
|
|
285326
285354
|
await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile], {
|
285327
285355
|
cwd: dirname11(subgraphYamlFile)
|
285328
285356
|
});
|
285357
|
+
outro("Subgraph types generated successfully");
|
285329
285358
|
});
|
285330
285359
|
}
|
285331
285360
|
|
@@ -285376,6 +285405,7 @@ function subgraphDeployCommand() {
|
|
285376
285405
|
command: "scs subgraph deploy my-subgraph"
|
285377
285406
|
}
|
285378
285407
|
])).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 }) => {
|
285408
|
+
intro("Deploying subgraph");
|
285379
285409
|
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
285380
285410
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
285381
285411
|
const env2 = await loadEnv(false, !!prod);
|
@@ -285444,6 +285474,7 @@ function subgraphDeployCommand() {
|
|
285444
285474
|
SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
|
285445
285475
|
...graphEndpoints
|
285446
285476
|
});
|
285477
|
+
outro(`Subgraph ${graphName} deployed successfully`);
|
285447
285478
|
});
|
285448
285479
|
}
|
285449
285480
|
async function updateSpecVersion(specVersion) {
|
@@ -285452,6 +285483,55 @@ async function updateSpecVersion(specVersion) {
|
|
285452
285483
|
await updateSubgraphYamlConfig(yamlConfig);
|
285453
285484
|
}
|
285454
285485
|
|
285486
|
+
// src/commands/smart-contract-set/subgraph/remove.ts
|
285487
|
+
import { dirname as dirname13 } from "node:path";
|
285488
|
+
function subgraphRemoveCommand() {
|
285489
|
+
return new Command("remove").description("Remove a subgraph").usage(createExamples([
|
285490
|
+
{
|
285491
|
+
description: "Remove a subgraph",
|
285492
|
+
command: "scs subgraph remove my-subgraph"
|
285493
|
+
}
|
285494
|
+
])).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").option("-f, --force", "Force remove the subgraph without confirmation").argument("<subgraph-name>", "The name of the subgraph to remove").action(async (subgraphName, { prod, acceptDefaults, force }) => {
|
285495
|
+
intro("Removing subgraph");
|
285496
|
+
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
285497
|
+
if (!force) {
|
285498
|
+
await deleteConfirmationPrompt(`the subgraph ${subgraphName}`);
|
285499
|
+
}
|
285500
|
+
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
285501
|
+
const env2 = await loadEnv(false, !!prod);
|
285502
|
+
const instance = await instancePrompt(env2, true);
|
285503
|
+
const accessToken = await getApplicationOrPersonalAccessToken({
|
285504
|
+
env: env2,
|
285505
|
+
instance,
|
285506
|
+
prefer: "application"
|
285507
|
+
});
|
285508
|
+
const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
|
285509
|
+
if (!theGraphMiddleware) {
|
285510
|
+
return nothingSelectedError("graph middleware");
|
285511
|
+
}
|
285512
|
+
if (theGraphMiddleware.status !== "COMPLETED") {
|
285513
|
+
serviceNotRunningError("graph middleware", theGraphMiddleware.status);
|
285514
|
+
}
|
285515
|
+
const subgraphYamlFile = await getSubgraphYamlFile();
|
285516
|
+
const cwd2 = dirname13(subgraphYamlFile);
|
285517
|
+
const { command, args } = await getPackageManagerExecutable();
|
285518
|
+
const middlewareAdminUrl = new URL(`/${encodeURIComponent(accessToken)}/admin`, theGraphMiddleware.serviceUrl).toString();
|
285519
|
+
await executeCommand(command, [...args, "graph", "remove", "--node", middlewareAdminUrl, subgraphName]);
|
285520
|
+
const settlemintClient = createSettleMintClient({
|
285521
|
+
accessToken,
|
285522
|
+
instance
|
285523
|
+
});
|
285524
|
+
const middleware = await settlemintClient.middleware.read(theGraphMiddleware.uniqueName);
|
285525
|
+
const graphEndpoints = await getGraphEndpoint(settlemintClient, middleware);
|
285526
|
+
await writeEnvSpinner(!!prod, {
|
285527
|
+
...env2,
|
285528
|
+
SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
|
285529
|
+
...graphEndpoints
|
285530
|
+
});
|
285531
|
+
outro(`Subgraph ${subgraphName} removed successfully`);
|
285532
|
+
});
|
285533
|
+
}
|
285534
|
+
|
285455
285535
|
// src/commands/smart-contract.set.ts
|
285456
285536
|
function smartContractSetCommand() {
|
285457
285537
|
const foundry = new Command("foundry").alias("f").description("Foundry commands for building and testing smart contracts");
|
@@ -285469,6 +285549,7 @@ function smartContractSetCommand() {
|
|
285469
285549
|
subgraph.addCommand(subgraphBuildCommand());
|
285470
285550
|
subgraph.addCommand(subgraphCodegenCommand());
|
285471
285551
|
subgraph.addCommand(subgraphDeployCommand());
|
285552
|
+
subgraph.addCommand(subgraphRemoveCommand());
|
285472
285553
|
return new Command("smart-contract-set").alias("scs").description("Manage smart contract sets and subgraphs").addCommand(createCommand4()).addCommand(foundry).addCommand(hardhat).addCommand(subgraph);
|
285473
285554
|
}
|
285474
285555
|
|
@@ -285526,12 +285607,22 @@ function addHooksToCommand(cmd2, rootCmd, argv) {
|
|
285526
285607
|
addHooksToCommand(subcmd, rootCmd, argv);
|
285527
285608
|
}
|
285528
285609
|
}
|
285610
|
+
var ERRORS_TO_IGNORE = [ExitPromptError, AbortPromptError, ValidationError, CancelPromptError];
|
285611
|
+
var ERROR_CODES_TO_IGNORE = [
|
285612
|
+
"commander.help",
|
285613
|
+
"commander.missingArgument",
|
285614
|
+
"commander.optionMissingArgument",
|
285615
|
+
"commander.missingMandatoryOptionValue",
|
285616
|
+
"commander.conflictingOption",
|
285617
|
+
"commander.unknownOption",
|
285618
|
+
"commander.excessArguments",
|
285619
|
+
"commander.unknownCommand"
|
285620
|
+
];
|
285529
285621
|
async function onError(sdkcli, argv, error5) {
|
285530
|
-
|
285531
|
-
if (errorsToIgnore.some((errorToIgnore) => error5 instanceof errorToIgnore)) {
|
285622
|
+
if (ERRORS_TO_IGNORE.some((errorToIgnore) => error5 instanceof errorToIgnore)) {
|
285532
285623
|
process.exit(0);
|
285533
285624
|
}
|
285534
|
-
if (error5 instanceof CommanderError && (error5.exitCode === 0 || error5.code
|
285625
|
+
if (error5 instanceof CommanderError && (error5.exitCode === 0 || ERROR_CODES_TO_IGNORE.includes(error5.code))) {
|
285535
285626
|
process.exit(error5.exitCode);
|
285536
285627
|
}
|
285537
285628
|
if (!(error5 instanceof CancelError2 || error5 instanceof SpinnerError)) {
|
@@ -285552,7 +285643,7 @@ ${error5.stack}`));
|
|
285552
285643
|
}
|
285553
285644
|
function registerCommands() {
|
285554
285645
|
const sdkcli = new Command;
|
285555
|
-
sdkcli.name("settlemint").usage("[command]").description(`CLI for SettleMint (v${package_default.version})`).version(package_default.version, "-v, --version", "Output the current version").helpOption("-h, --help", "Display help for command").allowUnknownOption().showSuggestionAfterError(true).showHelpAfterError();
|
285646
|
+
sdkcli.name("settlemint").usage("[command]").description(`CLI for SettleMint (v${package_default.version})`).version(package_default.version, "-v, --version", "Output the current version").helpOption("-h, --help", "Display help for command").allowUnknownOption().showSuggestionAfterError(true).showHelpAfterError().passThroughOptions();
|
285556
285647
|
sdkcli.addCommand(connectCommand());
|
285557
285648
|
sdkcli.addCommand(codegenCommand());
|
285558
285649
|
sdkcli.addCommand(platformCommand());
|
@@ -285580,4 +285671,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
285580
285671
|
// src/cli.ts
|
285581
285672
|
sdkCliCommand();
|
285582
285673
|
|
285583
|
-
//# debugId=
|
285674
|
+
//# debugId=A22AA1F7CEFF78EB64756E2164756E21
|