@settlemint/sdk-cli 2.1.4-main933472a6 → 2.1.4-main9cd49b9b
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 +81 -34
- package/dist/cli.js.map +14 -14
- 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-main9cd49b9b",
|
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-main9cd49b9b",
|
245393
|
+
"@settlemint/sdk-utils": "2.1.4-main9cd49b9b",
|
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
|
}
|
@@ -248203,6 +248210,7 @@ var getEnv = (gqlClient) => {
|
|
248203
248210
|
};
|
248204
248211
|
var LoadBalancerFragment = graphql(`
|
248205
248212
|
fragment LoadBalancer on LoadBalancer {
|
248213
|
+
__typename
|
248206
248214
|
id
|
248207
248215
|
uniqueName
|
248208
248216
|
name
|
@@ -250085,6 +250093,16 @@ function tryParseJson3(value2, defaultValue = null) {
|
|
250085
250093
|
return defaultValue;
|
250086
250094
|
}
|
250087
250095
|
}
|
250096
|
+
function extractJsonObject(value2) {
|
250097
|
+
if (value2.length > 5000) {
|
250098
|
+
throw new Error("Input too long");
|
250099
|
+
}
|
250100
|
+
const result = /\{([\s\S]*)\}/.exec(value2);
|
250101
|
+
if (!result) {
|
250102
|
+
return null;
|
250103
|
+
}
|
250104
|
+
return tryParseJson3(result[0]);
|
250105
|
+
}
|
250088
250106
|
async function retryWhenFailed2(fn, maxRetries = 5, initialSleepTime = 1000, stopOnError) {
|
250089
250107
|
let attempt = 0;
|
250090
250108
|
while (attempt < maxRetries) {
|
@@ -251848,7 +251866,13 @@ async function subgraphPrompt({
|
|
251848
251866
|
if (env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH) {
|
251849
251867
|
return [env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH];
|
251850
251868
|
}
|
251851
|
-
|
251869
|
+
if (subgraphNames.length === 1) {
|
251870
|
+
return subgraphNames;
|
251871
|
+
}
|
251872
|
+
if (subgraphNames.includes("kit")) {
|
251873
|
+
return ["kit"];
|
251874
|
+
}
|
251875
|
+
return [];
|
251852
251876
|
}
|
251853
251877
|
if (!allowNew) {
|
251854
251878
|
if (subgraphNames.length === 0) {
|
@@ -252033,7 +252057,8 @@ async function codegenBlockscout(env2) {
|
|
252033
252057
|
}
|
252034
252058
|
}
|
252035
252059
|
}
|
252036
|
-
|
252060
|
+
`,
|
252061
|
+
operationName: "IntrospectionQuery"
|
252037
252062
|
})
|
252038
252063
|
});
|
252039
252064
|
await writeFile6(introspectionJsonPath, JSON.stringify(data));
|
@@ -252800,7 +252825,7 @@ async function theGraphPrompt({
|
|
252800
252825
|
envKey: "SETTLEMINT_THEGRAPH",
|
252801
252826
|
isRequired,
|
252802
252827
|
defaultHandler: async ({ defaultService: defaultMiddleware, choices }) => {
|
252803
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => middleware
|
252828
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: middleware }) => isRunning(middleware)) : choices;
|
252804
252829
|
return esm_default3({
|
252805
252830
|
message: "Which The Graph instance do you want to connect to?",
|
252806
252831
|
choices: filteredChoices,
|
@@ -253128,7 +253153,7 @@ async function blockchainNodeOrLoadBalancerPrompt({
|
|
253128
253153
|
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
253129
253154
|
isRequired,
|
253130
253155
|
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
253131
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node
|
253156
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => isRunning(node)) : choices;
|
253132
253157
|
return esm_default3({
|
253133
253158
|
message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
|
253134
253159
|
choices: filteredChoices,
|
@@ -257773,22 +257798,26 @@ function blockscoutInsightsCreateCommand() {
|
|
257773
257798
|
if (!applicationUniqueName) {
|
257774
257799
|
return missingApplication();
|
257775
257800
|
}
|
257776
|
-
let blockchainNodeUniqueName =
|
257777
|
-
|
257801
|
+
let blockchainNodeUniqueName = blockchainNode;
|
257802
|
+
let loadBalancerUniqueName = loadBalancer;
|
257778
257803
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257779
257804
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257780
257805
|
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257781
|
-
const
|
257806
|
+
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257782
257807
|
env: env2,
|
257783
257808
|
nodes: blockchainNodes,
|
257784
257809
|
loadBalancers,
|
257785
257810
|
accept: acceptDefaults,
|
257786
257811
|
isRequired: true
|
257787
257812
|
});
|
257788
|
-
if (!
|
257813
|
+
if (!nodeOrLoadbalancer) {
|
257789
257814
|
return nothingSelectedError("blockchain node");
|
257790
257815
|
}
|
257791
|
-
|
257816
|
+
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257817
|
+
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257818
|
+
} else {
|
257819
|
+
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257820
|
+
}
|
257792
257821
|
}
|
257793
257822
|
const result = await showSpinner(() => settlemint.insights.create({
|
257794
257823
|
name: name3,
|
@@ -257901,7 +257930,17 @@ function loadBalancerEvmCreateCommand() {
|
|
257901
257930
|
type: "load balancer",
|
257902
257931
|
subType: "EVM",
|
257903
257932
|
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)").
|
257933
|
+
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, can be skipped if the --blockchain-nodes option is used (defaults to network from env)").action(async (name3, {
|
257934
|
+
application,
|
257935
|
+
provider,
|
257936
|
+
region,
|
257937
|
+
size,
|
257938
|
+
type: type4,
|
257939
|
+
blockchainNodes,
|
257940
|
+
blockchainNetwork,
|
257941
|
+
acceptDefaults,
|
257942
|
+
...defaultArgs
|
257943
|
+
}) => {
|
257905
257944
|
return baseAction({
|
257906
257945
|
...defaultArgs,
|
257907
257946
|
acceptDefaults,
|
@@ -257912,11 +257951,12 @@ function loadBalancerEvmCreateCommand() {
|
|
257912
257951
|
if (!applicationUniqueName) {
|
257913
257952
|
return missingApplication();
|
257914
257953
|
}
|
257915
|
-
|
257954
|
+
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257955
|
+
let networkUniqueName = blockchainNetwork;
|
257916
257956
|
let connectedNodesUniqueNames = blockchainNodes;
|
257917
257957
|
if (!connectedNodesUniqueNames) {
|
257918
257958
|
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257919
|
-
const network = await blockchainNetworkPrompt({
|
257959
|
+
const network = networkUniqueName ? networks.find((network2) => network2.uniqueName === networkUniqueName) : await blockchainNetworkPrompt({
|
257920
257960
|
env: env2,
|
257921
257961
|
networks,
|
257922
257962
|
accept: acceptDefaults,
|
@@ -257926,31 +257966,29 @@ function loadBalancerEvmCreateCommand() {
|
|
257926
257966
|
return nothingSelectedError("blockchain network");
|
257927
257967
|
}
|
257928
257968
|
networkUniqueName = network.uniqueName;
|
257929
|
-
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257930
257969
|
const connectedNodes = await blockchainNodePrompt({
|
257931
257970
|
env: env2,
|
257932
|
-
nodes:
|
257971
|
+
nodes: applicationBlockchainNodes.filter((node) => node.blockchainNetwork?.uniqueName === network.uniqueName),
|
257933
257972
|
accept: acceptDefaults,
|
257934
257973
|
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257935
257974
|
allowAll: true
|
257936
257975
|
});
|
257937
|
-
connectedNodesUniqueNames = Array.isArray(connectedNodes) ?
|
257976
|
+
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? applicationBlockchainNodes.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257938
257977
|
}
|
257939
257978
|
if (connectedNodesUniqueNames.length === 0) {
|
257940
257979
|
return cancel2("A load balancer must connect to at least one blockchain node");
|
257941
257980
|
}
|
257981
|
+
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257982
|
+
if (selectedBlockchainNodes.length === 0) {
|
257983
|
+
return cancel2(`Blockchain node(s) '${connectedNodesUniqueNames.join(", ")}' are not part of the application '${applicationUniqueName}'`);
|
257984
|
+
}
|
257942
257985
|
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
257986
|
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257953
257987
|
}
|
257988
|
+
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === networkUniqueName);
|
257989
|
+
if (!onTheSameNetwork) {
|
257990
|
+
return cancel2("Blockchain nodes must be on the same network");
|
257991
|
+
}
|
257954
257992
|
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257955
257993
|
applicationUniqueName,
|
257956
257994
|
name: name3,
|
@@ -257966,7 +258004,8 @@ function loadBalancerEvmCreateCommand() {
|
|
257966
258004
|
mapDefaultEnv: () => {
|
257967
258005
|
return {
|
257968
258006
|
SETTLEMINT_APPLICATION: applicationUniqueName,
|
257969
|
-
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
|
258007
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName,
|
258008
|
+
...getBlockchainNodeOrLoadBalancerEndpoints(result)
|
257970
258009
|
};
|
257971
258010
|
}
|
257972
258011
|
};
|
@@ -259278,6 +259317,8 @@ function getItemsForServiceType(services, serviceType) {
|
|
259278
259317
|
return services.blockchainNetworks;
|
259279
259318
|
case "blockchain-node":
|
259280
259319
|
return services.blockchainNodes;
|
259320
|
+
case "load-balancer":
|
259321
|
+
return services.loadBalancers;
|
259281
259322
|
default:
|
259282
259323
|
return [];
|
259283
259324
|
}
|
@@ -259742,15 +259783,21 @@ Please select another key or activate this key on the node and try again.`, "war
|
|
259742
259783
|
async function getHardhatConfigData(envConfig) {
|
259743
259784
|
try {
|
259744
259785
|
const { command, args } = await getPackageManagerExecutable();
|
259745
|
-
const output = await executeCommand(command, [
|
259746
|
-
|
259786
|
+
const output = await executeCommand(command, [
|
259787
|
+
...args,
|
259788
|
+
"ts-node",
|
259789
|
+
"-e",
|
259790
|
+
`import hardhat from "hardhat";
|
259791
|
+
console.log(JSON.stringify(hardhat.userConfig));`,
|
259792
|
+
"--transpileOnly"
|
259793
|
+
], {
|
259747
259794
|
env: {
|
259748
259795
|
...process.env,
|
259749
259796
|
...envConfig
|
259750
259797
|
},
|
259751
259798
|
silent: true
|
259752
259799
|
});
|
259753
|
-
const config3 =
|
259800
|
+
const config3 = extractJsonObject(output.join(" "));
|
259754
259801
|
if (isHardhatConfig(config3)) {
|
259755
259802
|
return config3;
|
259756
259803
|
}
|
@@ -260473,4 +260520,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
260473
260520
|
// src/cli.ts
|
260474
260521
|
sdkCliCommand();
|
260475
260522
|
|
260476
|
-
//# debugId=
|
260523
|
+
//# debugId=1EF6549CF10B1A3164756E2164756E21
|