@settlemint/sdk-cli 2.1.4-pr04de2cca → 2.1.4-pr0d9f8515
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 +59 -27
- package/dist/cli.js.map +7 -7
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -245340,7 +245340,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
245340
245340
|
var package_default = {
|
245341
245341
|
name: "@settlemint/sdk-cli",
|
245342
245342
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
245343
|
-
version: "2.1.4-
|
245343
|
+
version: "2.1.4-pr0d9f8515",
|
245344
245344
|
type: "module",
|
245345
245345
|
private: false,
|
245346
245346
|
license: "FSL-1.1-MIT",
|
@@ -245389,8 +245389,8 @@ var package_default = {
|
|
245389
245389
|
"@inquirer/input": "4.1.9",
|
245390
245390
|
"@inquirer/password": "4.0.12",
|
245391
245391
|
"@inquirer/select": "4.1.1",
|
245392
|
-
"@settlemint/sdk-js": "2.1.4-
|
245393
|
-
"@settlemint/sdk-utils": "2.1.4-
|
245392
|
+
"@settlemint/sdk-js": "2.1.4-pr0d9f8515",
|
245393
|
+
"@settlemint/sdk-utils": "2.1.4-pr0d9f8515",
|
245394
245394
|
"@types/node": "22.14.1",
|
245395
245395
|
"@types/semver": "7.7.0",
|
245396
245396
|
"@types/which": "3.0.4",
|
@@ -246566,6 +246566,13 @@ var cancel2 = (msg) => {
|
|
246566
246566
|
console.log("");
|
246567
246567
|
throw new CancelError2(msg);
|
246568
246568
|
};
|
246569
|
+
var CommandError = class extends Error {
|
246570
|
+
constructor(message, code, output) {
|
246571
|
+
super(message);
|
246572
|
+
this.code = code;
|
246573
|
+
this.output = output;
|
246574
|
+
}
|
246575
|
+
};
|
246569
246576
|
async function executeCommand(command, args, options) {
|
246570
246577
|
const child = spawn(command, args, { env: { ...process.env, ...options?.env } });
|
246571
246578
|
process.stdin.pipe(child.stdin);
|
@@ -246585,14 +246592,14 @@ async function executeCommand(command, args, options) {
|
|
246585
246592
|
}
|
246586
246593
|
output.push(maskedData);
|
246587
246594
|
});
|
246588
|
-
child.on("error", (err) => reject(err));
|
246595
|
+
child.on("error", (err) => reject(new CommandError(err.message, "code" in err && typeof err.code === "number" ? err.code : 1, output)));
|
246589
246596
|
child.on("close", (code) => {
|
246590
246597
|
if (code === 0 || code === null || code === 143) {
|
246591
246598
|
process.stdin.unpipe(child.stdin);
|
246592
246599
|
resolve(output);
|
246593
246600
|
return;
|
246594
246601
|
}
|
246595
|
-
reject(new
|
246602
|
+
reject(new CommandError(`Command "${command}" exited with code ${code}`, code, output));
|
246596
246603
|
});
|
246597
246604
|
});
|
246598
246605
|
}
|
@@ -250085,6 +250092,13 @@ function tryParseJson3(value2, defaultValue = null) {
|
|
250085
250092
|
return defaultValue;
|
250086
250093
|
}
|
250087
250094
|
}
|
250095
|
+
function extractJsonObject(value2) {
|
250096
|
+
const result = /\{([\s\S]*)\}/.exec(value2);
|
250097
|
+
if (!result) {
|
250098
|
+
return null;
|
250099
|
+
}
|
250100
|
+
return tryParseJson3(result[0]);
|
250101
|
+
}
|
250088
250102
|
async function retryWhenFailed2(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
|
250089
250103
|
let attempt = 0;
|
250090
250104
|
while (attempt < maxRetries) {
|
@@ -252033,7 +252047,8 @@ async function codegenBlockscout(env2) {
|
|
252033
252047
|
}
|
252034
252048
|
}
|
252035
252049
|
}
|
252036
|
-
|
252050
|
+
`,
|
252051
|
+
operationName: "IntrospectionQuery"
|
252037
252052
|
})
|
252038
252053
|
});
|
252039
252054
|
await writeFile6(introspectionJsonPath, JSON.stringify(data));
|
@@ -257901,7 +257916,17 @@ function loadBalancerEvmCreateCommand() {
|
|
257901
257916
|
type: "load balancer",
|
257902
257917
|
subType: "EVM",
|
257903
257918
|
execute: (cmd2, baseAction) => {
|
257904
|
-
addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").
|
257919
|
+
addClusterServiceArgs(cmd2).option("--app, --application <application>", "The application unique name to create the load balancer in (defaults to application from env)").option("--blockchain-nodes <blockchainNodes...>", "Blockchain node unique names where the load balancer connects to (must be from the same network)").option("--blockchain-network <blockchainNetwork>", "Blockchain network unique name where the load balancer connects to").action(async (name3, {
|
257920
|
+
application,
|
257921
|
+
provider,
|
257922
|
+
region,
|
257923
|
+
size,
|
257924
|
+
type: type4,
|
257925
|
+
blockchainNodes,
|
257926
|
+
blockchainNetwork,
|
257927
|
+
acceptDefaults,
|
257928
|
+
...defaultArgs
|
257929
|
+
}) => {
|
257905
257930
|
return baseAction({
|
257906
257931
|
...defaultArgs,
|
257907
257932
|
acceptDefaults,
|
@@ -257912,11 +257937,12 @@ function loadBalancerEvmCreateCommand() {
|
|
257912
257937
|
if (!applicationUniqueName) {
|
257913
257938
|
return missingApplication();
|
257914
257939
|
}
|
257915
|
-
|
257940
|
+
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257941
|
+
let networkUniqueName = blockchainNetwork;
|
257916
257942
|
let connectedNodesUniqueNames = blockchainNodes;
|
257917
257943
|
if (!connectedNodesUniqueNames) {
|
257918
257944
|
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257919
|
-
const network = await blockchainNetworkPrompt({
|
257945
|
+
const network = networkUniqueName ? networks.find((network2) => network2.uniqueName === networkUniqueName) : await blockchainNetworkPrompt({
|
257920
257946
|
env: env2,
|
257921
257947
|
networks,
|
257922
257948
|
accept: acceptDefaults,
|
@@ -257926,31 +257952,29 @@ function loadBalancerEvmCreateCommand() {
|
|
257926
257952
|
return nothingSelectedError("blockchain network");
|
257927
257953
|
}
|
257928
257954
|
networkUniqueName = network.uniqueName;
|
257929
|
-
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257930
257955
|
const connectedNodes = await blockchainNodePrompt({
|
257931
257956
|
env: env2,
|
257932
|
-
nodes:
|
257957
|
+
nodes: applicationBlockchainNodes.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
|
257933
257958
|
accept: acceptDefaults,
|
257934
257959
|
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257935
257960
|
allowAll: true
|
257936
257961
|
});
|
257937
|
-
connectedNodesUniqueNames = Array.isArray(connectedNodes) ?
|
257962
|
+
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? applicationBlockchainNodes.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257938
257963
|
}
|
257939
257964
|
if (connectedNodesUniqueNames.length === 0) {
|
257940
257965
|
return cancel2("A load balancer must connect to at least one blockchain node");
|
257941
257966
|
}
|
257967
|
+
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257968
|
+
if (selectedBlockchainNodes.length === 0) {
|
257969
|
+
return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
|
257970
|
+
}
|
257942
257971
|
if (!networkUniqueName) {
|
257943
|
-
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257944
|
-
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257945
|
-
if (selectedBlockchainNodes.length === 0) {
|
257946
|
-
return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
|
257947
|
-
}
|
257948
|
-
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
|
257949
|
-
if (!onTheSameNetwork) {
|
257950
|
-
return cancel2("Blockchain nodes must be on the same network");
|
257951
|
-
}
|
257952
257972
|
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257953
257973
|
}
|
257974
|
+
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === networkUniqueName);
|
257975
|
+
if (!onTheSameNetwork) {
|
257976
|
+
return cancel2("Blockchain nodes must be on the same network");
|
257977
|
+
}
|
257954
257978
|
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257955
257979
|
applicationUniqueName,
|
257956
257980
|
name: name3,
|
@@ -259742,22 +259766,30 @@ Please select another key or activate this key on the node and try again.`, "war
|
|
259742
259766
|
async function getHardhatConfigData(envConfig) {
|
259743
259767
|
try {
|
259744
259768
|
const { command, args } = await getPackageManagerExecutable();
|
259745
|
-
const output = await executeCommand(command, [
|
259746
|
-
|
259769
|
+
const output = await executeCommand(command, [
|
259770
|
+
...args,
|
259771
|
+
"ts-node",
|
259772
|
+
"-e",
|
259773
|
+
`import hardhat from "hardhat";
|
259774
|
+
console.log(JSON.stringify(hardhat.userConfig));`,
|
259775
|
+
"--transpileOnly"
|
259776
|
+
], {
|
259747
259777
|
env: {
|
259748
259778
|
...process.env,
|
259749
259779
|
...envConfig
|
259750
259780
|
},
|
259751
259781
|
silent: true
|
259752
259782
|
});
|
259753
|
-
const config3 =
|
259783
|
+
const config3 = extractJsonObject(output.join(" "));
|
259754
259784
|
if (isHardhatConfig(config3)) {
|
259755
259785
|
return config3;
|
259756
259786
|
}
|
259757
|
-
throw new Error(
|
259787
|
+
throw new Error(`Invalid hardhat config: ${output.join(`
|
259788
|
+
`)}`);
|
259758
259789
|
} catch (err) {
|
259759
259790
|
const error5 = err;
|
259760
|
-
note(`Error reading hardhat.config.ts: ${error5.
|
259791
|
+
note(`Error reading hardhat.config.ts: ${error5.output?.join(`
|
259792
|
+
`) ?? error5.message}`);
|
259761
259793
|
return {};
|
259762
259794
|
}
|
259763
259795
|
}
|
@@ -260473,4 +260505,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
260473
260505
|
// src/cli.ts
|
260474
260506
|
sdkCliCommand();
|
260475
260507
|
|
260476
|
-
//# debugId=
|
260508
|
+
//# debugId=BB52F044285C9A7564756E2164756E21
|