@settlemint/sdk-cli 2.1.4-pr4cff9a3b → 2.1.4-pr585a70cc
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 +72 -363
- package/dist/cli.js.map +29 -34
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -245085,7 +245085,7 @@ var DotEnvSchema = z.object({
|
|
245085
245085
|
SETTLEMINT_APPLICATION: UniqueNameSchema.optional(),
|
245086
245086
|
SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema.optional(),
|
245087
245087
|
SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema.optional(),
|
245088
|
-
|
245088
|
+
SETTLEMINT_LOAD_BALANCER: UniqueNameSchema.optional(),
|
245089
245089
|
SETTLEMINT_HASURA: UniqueNameSchema.optional(),
|
245090
245090
|
SETTLEMINT_HASURA_ENDPOINT: UrlSchema.optional(),
|
245091
245091
|
SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
|
@@ -245278,7 +245278,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
245278
245278
|
var package_default = {
|
245279
245279
|
name: "@settlemint/sdk-cli",
|
245280
245280
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
245281
|
-
version: "2.1.4-
|
245281
|
+
version: "2.1.4-pr585a70cc",
|
245282
245282
|
type: "module",
|
245283
245283
|
private: false,
|
245284
245284
|
license: "FSL-1.1-MIT",
|
@@ -245327,8 +245327,8 @@ var package_default = {
|
|
245327
245327
|
"@inquirer/input": "4.1.9",
|
245328
245328
|
"@inquirer/password": "4.0.12",
|
245329
245329
|
"@inquirer/select": "4.1.1",
|
245330
|
-
"@settlemint/sdk-js": "2.1.4-
|
245331
|
-
"@settlemint/sdk-utils": "2.1.4-
|
245330
|
+
"@settlemint/sdk-js": "2.1.4-pr585a70cc",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.4-pr585a70cc",
|
245332
245332
|
"@types/node": "22.14.1",
|
245333
245333
|
"@types/semver": "7.7.0",
|
245334
245334
|
"@types/which": "3.0.4",
|
@@ -246742,7 +246742,7 @@ var DotEnvSchema2 = z.object({
|
|
246742
246742
|
SETTLEMINT_APPLICATION: UniqueNameSchema2.optional(),
|
246743
246743
|
SETTLEMINT_BLOCKCHAIN_NETWORK: UniqueNameSchema2.optional(),
|
246744
246744
|
SETTLEMINT_BLOCKCHAIN_NODE: UniqueNameSchema2.optional(),
|
246745
|
-
|
246745
|
+
SETTLEMINT_LOAD_BALANCER: UniqueNameSchema2.optional(),
|
246746
246746
|
SETTLEMINT_HASURA: UniqueNameSchema2.optional(),
|
246747
246747
|
SETTLEMINT_HASURA_ENDPOINT: UrlSchema2.optional(),
|
246748
246748
|
SETTLEMINT_HASURA_ADMIN_SECRET: z.string().optional(),
|
@@ -248059,47 +248059,6 @@ var getLoadBalancer = graphql(`
|
|
248059
248059
|
}
|
248060
248060
|
}
|
248061
248061
|
`, [LoadBalancerFragment]);
|
248062
|
-
var getLoadBalancers = graphql(`
|
248063
|
-
query getLoadBalancers($applicationUniqueName: String!) {
|
248064
|
-
loadBalancersByUniqueName(applicationUniqueName: $applicationUniqueName) {
|
248065
|
-
items {
|
248066
|
-
...LoadBalancer
|
248067
|
-
}
|
248068
|
-
}
|
248069
|
-
}
|
248070
|
-
`, [LoadBalancerFragment]);
|
248071
|
-
var createLoadBalancer = graphql(`
|
248072
|
-
mutation createLoadBalancer(
|
248073
|
-
$applicationId: ID!
|
248074
|
-
$blockchainNetworkId: ID!
|
248075
|
-
$name: String!
|
248076
|
-
$provider: String!
|
248077
|
-
$region: String!
|
248078
|
-
$size: ClusterServiceSize
|
248079
|
-
$type: ClusterServiceType
|
248080
|
-
$connectedNodes: [ID!]!
|
248081
|
-
) {
|
248082
|
-
createLoadBalancer(
|
248083
|
-
applicationId: $applicationId
|
248084
|
-
blockchainNetworkId: $blockchainNetworkId
|
248085
|
-
name: $name
|
248086
|
-
provider: $provider
|
248087
|
-
region: $region
|
248088
|
-
size: $size
|
248089
|
-
type: $type
|
248090
|
-
connectedNodes: $connectedNodes
|
248091
|
-
) {
|
248092
|
-
...LoadBalancer
|
248093
|
-
}
|
248094
|
-
}
|
248095
|
-
`, [LoadBalancerFragment]);
|
248096
|
-
var restartLoadBalancer = graphql(`
|
248097
|
-
mutation RestartLoadBalancer($uniqueName: String!) {
|
248098
|
-
restartLoadBalancerByUniqueName(uniqueName: $uniqueName) {
|
248099
|
-
...LoadBalancer
|
248100
|
-
}
|
248101
|
-
}
|
248102
|
-
`, [LoadBalancerFragment]);
|
248103
248062
|
var loadBalancerRead = (gqlClient) => {
|
248104
248063
|
return async (loadBalancerUniqueName) => {
|
248105
248064
|
const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {
|
@@ -248108,37 +248067,6 @@ var loadBalancerRead = (gqlClient) => {
|
|
248108
248067
|
return loadBalancer;
|
248109
248068
|
};
|
248110
248069
|
};
|
248111
|
-
var loadBalancerList = (gqlClient) => {
|
248112
|
-
return async (applicationUniqueName) => {
|
248113
|
-
const {
|
248114
|
-
loadBalancersByUniqueName: { items }
|
248115
|
-
} = await gqlClient.request(getLoadBalancers, { applicationUniqueName });
|
248116
|
-
return items;
|
248117
|
-
};
|
248118
|
-
};
|
248119
|
-
var loadBalancerCreate = (gqlClient) => {
|
248120
|
-
return async (args) => {
|
248121
|
-
const { applicationUniqueName, blockchainNetworkUniqueName, connectedNodesUniqueNames, ...otherArgs } = args;
|
248122
|
-
const [application, blockchainNetwork, connectedNodes] = await Promise.all([
|
248123
|
-
applicationRead(gqlClient)(applicationUniqueName),
|
248124
|
-
blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName),
|
248125
|
-
Promise.all(connectedNodesUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName)))
|
248126
|
-
]);
|
248127
|
-
const { createLoadBalancer: loadBalancer } = await gqlClient.request(createLoadBalancer, {
|
248128
|
-
...otherArgs,
|
248129
|
-
applicationId: application.id,
|
248130
|
-
blockchainNetworkId: blockchainNetwork.id,
|
248131
|
-
connectedNodes: connectedNodes.map((node) => node.id)
|
248132
|
-
});
|
248133
|
-
return loadBalancer;
|
248134
|
-
};
|
248135
|
-
};
|
248136
|
-
var loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
|
248137
|
-
const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, {
|
248138
|
-
uniqueName: loadBalancerUniqueName
|
248139
|
-
});
|
248140
|
-
return loadBalancer;
|
248141
|
-
};
|
248142
248070
|
var InsightsFragment = graphql(`
|
248143
248071
|
fragment Insights on Insights {
|
248144
248072
|
__typename
|
@@ -248839,12 +248767,6 @@ function createSettleMintClient(options) {
|
|
248839
248767
|
create: blockchainNodeCreate(gqlClient),
|
248840
248768
|
restart: blockchainNodeRestart(gqlClient)
|
248841
248769
|
},
|
248842
|
-
loadBalancer: {
|
248843
|
-
list: loadBalancerList(gqlClient),
|
248844
|
-
read: loadBalancerRead(gqlClient),
|
248845
|
-
create: loadBalancerCreate(gqlClient),
|
248846
|
-
restart: loadBalancerRestart(gqlClient)
|
248847
|
-
},
|
248848
248770
|
middleware: {
|
248849
248771
|
list: middlewareList(gqlClient),
|
248850
248772
|
read: middlewareRead(gqlClient),
|
@@ -252268,7 +252190,6 @@ async function applicationPrompt(env2, applications, accept) {
|
|
252268
252190
|
}
|
252269
252191
|
|
252270
252192
|
// src/prompts/cluster-service/service.prompt.ts
|
252271
|
-
var ALL2 = "All";
|
252272
252193
|
async function servicePrompt({
|
252273
252194
|
env: env2,
|
252274
252195
|
services,
|
@@ -252277,13 +252198,12 @@ async function servicePrompt({
|
|
252277
252198
|
defaultHandler,
|
252278
252199
|
isRequired = false,
|
252279
252200
|
isCi = is_in_ci_default,
|
252280
|
-
singleOptionMessage
|
252281
|
-
allowAll = false
|
252201
|
+
singleOptionMessage
|
252282
252202
|
}) {
|
252283
252203
|
if (services.length === 0) {
|
252284
252204
|
return;
|
252285
252205
|
}
|
252286
|
-
const selectedService = services.find((service) =>
|
252206
|
+
const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
|
252287
252207
|
const autoAccept = isCi || accept;
|
252288
252208
|
if (autoAccept && selectedService) {
|
252289
252209
|
return selectedService;
|
@@ -252292,7 +252212,7 @@ async function servicePrompt({
|
|
252292
252212
|
return;
|
252293
252213
|
}
|
252294
252214
|
if (isRequired && services.length === 1) {
|
252295
|
-
if (singleOptionMessage
|
252215
|
+
if (singleOptionMessage) {
|
252296
252216
|
note(singleOptionMessage(services[0].uniqueName));
|
252297
252217
|
}
|
252298
252218
|
return services[0];
|
@@ -252301,30 +252221,13 @@ async function servicePrompt({
|
|
252301
252221
|
name: `${service.name} (${service.uniqueName})`,
|
252302
252222
|
value: service
|
252303
252223
|
}));
|
252304
|
-
if (allowAll) {
|
252305
|
-
choices.unshift({
|
252306
|
-
name: ALL2,
|
252307
|
-
value: services
|
252308
|
-
});
|
252309
|
-
}
|
252310
252224
|
if (!isRequired) {
|
252311
252225
|
choices.push({
|
252312
252226
|
name: "None",
|
252313
252227
|
value: undefined
|
252314
252228
|
});
|
252315
252229
|
}
|
252316
|
-
return defaultHandler({
|
252317
|
-
defaultService: selectedService,
|
252318
|
-
choices
|
252319
|
-
});
|
252320
|
-
}
|
252321
|
-
|
252322
|
-
// src/utils/cluster-service.ts
|
252323
|
-
function hasValidPrivateKey(privateKey) {
|
252324
|
-
return privateKey.privateKeyType !== "HD_ECDSA_P256";
|
252325
|
-
}
|
252326
|
-
function isRunning(service) {
|
252327
|
-
return service === undefined || service?.status === "COMPLETED";
|
252230
|
+
return defaultHandler({ defaultService: selectedService, choices });
|
252328
252231
|
}
|
252329
252232
|
|
252330
252233
|
// src/prompts/cluster-service/blockchain-node.prompt.ts
|
@@ -252335,8 +252238,7 @@ async function blockchainNodePrompt({
|
|
252335
252238
|
singleOptionMessage,
|
252336
252239
|
promptMessage,
|
252337
252240
|
filterRunningOnly = false,
|
252338
|
-
isRequired = false
|
252339
|
-
allowAll = false
|
252241
|
+
isRequired = false
|
252340
252242
|
}) {
|
252341
252243
|
return servicePrompt({
|
252342
252244
|
env: env2,
|
@@ -252345,25 +252247,14 @@ async function blockchainNodePrompt({
|
|
252345
252247
|
envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
|
252346
252248
|
isRequired,
|
252347
252249
|
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252348
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) =>
|
252349
|
-
return Array.isArray(node) ? true : isRunning(node);
|
252350
|
-
}).map((item) => {
|
252351
|
-
if (Array.isArray(item.value)) {
|
252352
|
-
return {
|
252353
|
-
...item,
|
252354
|
-
value: item.value.filter(isRunning)
|
252355
|
-
};
|
252356
|
-
}
|
252357
|
-
return item;
|
252358
|
-
}) : choices;
|
252250
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
|
252359
252251
|
return esm_default3({
|
252360
252252
|
message: promptMessage ?? "Which blockchain node do you want to connect to?",
|
252361
252253
|
choices: filteredChoices,
|
252362
252254
|
default: defaultNode
|
252363
252255
|
});
|
252364
252256
|
},
|
252365
|
-
singleOptionMessage
|
252366
|
-
allowAll
|
252257
|
+
singleOptionMessage
|
252367
252258
|
});
|
252368
252259
|
}
|
252369
252260
|
|
@@ -252668,8 +252559,7 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252668
252559
|
storages,
|
252669
252560
|
privateKeys,
|
252670
252561
|
insights,
|
252671
|
-
customDeployments
|
252672
|
-
loadBalancers
|
252562
|
+
customDeployments
|
252673
252563
|
] = await Promise.all([
|
252674
252564
|
shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
|
252675
252565
|
shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
|
@@ -252678,8 +252568,7 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252678
252568
|
shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
|
252679
252569
|
shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
|
252680
252570
|
shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
|
252681
|
-
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
|
252682
|
-
shouldFetch("load-balancer") ? settlemint.loadBalancer.list(applicationUniqueName) : Promise.resolve([])
|
252571
|
+
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
|
252683
252572
|
]);
|
252684
252573
|
return {
|
252685
252574
|
blockchainNetworks,
|
@@ -252689,8 +252578,7 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252689
252578
|
storages,
|
252690
252579
|
privateKeys,
|
252691
252580
|
insights,
|
252692
|
-
customDeployments
|
252693
|
-
loadBalancers
|
252581
|
+
customDeployments
|
252694
252582
|
};
|
252695
252583
|
}
|
252696
252584
|
});
|
@@ -252730,7 +252618,7 @@ async function writeEnvSpinner(prod, env2) {
|
|
252730
252618
|
SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
|
252731
252619
|
SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
|
252732
252620
|
SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
|
252733
|
-
|
252621
|
+
SETTLEMINT_LOAD_BALANCER: env2.SETTLEMINT_LOAD_BALANCER,
|
252734
252622
|
SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
|
252735
252623
|
SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
|
252736
252624
|
SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
|
@@ -252839,35 +252727,6 @@ function getMinioEndpoints(service) {
|
|
252839
252727
|
};
|
252840
252728
|
}
|
252841
252729
|
|
252842
|
-
// src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
|
252843
|
-
async function blockchainNodeOrLoadBalancerPrompt({
|
252844
|
-
env: env2,
|
252845
|
-
nodes,
|
252846
|
-
loadBalancers,
|
252847
|
-
accept,
|
252848
|
-
singleOptionMessage,
|
252849
|
-
promptMessage,
|
252850
|
-
filterRunningOnly = false,
|
252851
|
-
isRequired = false
|
252852
|
-
}) {
|
252853
|
-
return servicePrompt({
|
252854
|
-
env: env2,
|
252855
|
-
services: [...loadBalancers, ...nodes],
|
252856
|
-
accept,
|
252857
|
-
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
252858
|
-
isRequired,
|
252859
|
-
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252860
|
-
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
|
252861
|
-
return esm_default3({
|
252862
|
-
message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
|
252863
|
-
choices: filteredChoices,
|
252864
|
-
default: defaultNode
|
252865
|
-
});
|
252866
|
-
},
|
252867
|
-
singleOptionMessage
|
252868
|
-
});
|
252869
|
-
}
|
252870
|
-
|
252871
252730
|
// src/commands/connect.ts
|
252872
252731
|
function connectCommand() {
|
252873
252732
|
return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod, instance }) => {
|
@@ -252887,30 +252746,11 @@ function connectCommand() {
|
|
252887
252746
|
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
252888
252747
|
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
252889
252748
|
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
252890
|
-
const {
|
252891
|
-
middlewares,
|
252892
|
-
integrationTools,
|
252893
|
-
storages,
|
252894
|
-
privateKeys,
|
252895
|
-
insights,
|
252896
|
-
customDeployments,
|
252897
|
-
blockchainNodes,
|
252898
|
-
loadBalancers
|
252899
|
-
} = await servicesSpinner(settlemint, application.uniqueName);
|
252900
|
-
const nodesWithPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? Array.isArray(node?.privateKeys) && node?.privateKeys?.length > 0 : false);
|
252749
|
+
const { middlewares, integrationTools, storages, privateKeys, insights, customDeployments, blockchainNodes } = await servicesSpinner(settlemint, application.uniqueName);
|
252901
252750
|
const blockchainNode = await blockchainNodePrompt({
|
252902
252751
|
env: env2,
|
252903
|
-
nodes:
|
252904
|
-
accept: acceptDefaults
|
252905
|
-
promptMessage: "Which blockchain node do you want to use for sending transactions?"
|
252906
|
-
});
|
252907
|
-
const nodesWithoutPrivateKey = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? !Array.isArray(node?.privateKeys) || node?.privateKeys?.length === 0 : true);
|
252908
|
-
const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
|
252909
|
-
env: env2,
|
252910
|
-
nodes: nodesWithoutPrivateKey,
|
252911
|
-
loadBalancers,
|
252912
|
-
accept: acceptDefaults,
|
252913
|
-
promptMessage: "Which blockchain node or load balancer do you want to use for read operations?"
|
252752
|
+
nodes: blockchainNodes,
|
252753
|
+
accept: acceptDefaults
|
252914
252754
|
});
|
252915
252755
|
const hasura = await hasuraPrompt({
|
252916
252756
|
env: env2,
|
@@ -252976,15 +252816,10 @@ function connectCommand() {
|
|
252976
252816
|
uniqueName: blockchainNode.blockchainNetwork?.uniqueName
|
252977
252817
|
},
|
252978
252818
|
blockchainNode && {
|
252979
|
-
type: "Blockchain Node
|
252819
|
+
type: "Blockchain Node",
|
252980
252820
|
name: blockchainNode.name,
|
252981
252821
|
uniqueName: blockchainNode.uniqueName
|
252982
252822
|
},
|
252983
|
-
loadBalancerOrBlockchainNode && {
|
252984
|
-
type: "Blockchain Node or Load Balancer (without private key, use for read operations)",
|
252985
|
-
name: loadBalancerOrBlockchainNode.name,
|
252986
|
-
uniqueName: loadBalancerOrBlockchainNode.uniqueName
|
252987
|
-
},
|
252988
252823
|
hasura && {
|
252989
252824
|
type: "Hasura",
|
252990
252825
|
name: hasura.name,
|
@@ -253035,7 +252870,6 @@ function connectCommand() {
|
|
253035
252870
|
SETTLEMINT_APPLICATION: application.uniqueName,
|
253036
252871
|
SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
|
253037
252872
|
SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
|
253038
|
-
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: loadBalancerOrBlockchainNode?.uniqueName,
|
253039
252873
|
SETTLEMINT_HASURA: hasura?.uniqueName,
|
253040
252874
|
...getHasuraEndpoints(hasura),
|
253041
252875
|
SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
|
@@ -256377,8 +256211,7 @@ var SETTLEMINT_CLIENT_MAP = {
|
|
256377
256211
|
"integration tool": "integrationTool",
|
256378
256212
|
storage: "storage",
|
256379
256213
|
insights: "insights",
|
256380
|
-
"application access token": "applicationAccessToken"
|
256381
|
-
"load balancer": "loadBalancer"
|
256214
|
+
"application access token": "applicationAccessToken"
|
256382
256215
|
};
|
256383
256216
|
var LABELS_MAP = {
|
256384
256217
|
application: { singular: "application", plural: "applications", command: "app" },
|
@@ -256399,8 +256232,7 @@ var LABELS_MAP = {
|
|
256399
256232
|
singular: "application access token",
|
256400
256233
|
plural: "application access tokens",
|
256401
256234
|
command: "application-access-token"
|
256402
|
-
}
|
256403
|
-
"load balancer": { singular: "load balancer", plural: "load balancers", command: "load-balancer" }
|
256235
|
+
}
|
256404
256236
|
};
|
256405
256237
|
|
256406
256238
|
// src/spinners/service.spinner.ts
|
@@ -257490,14 +257322,12 @@ function blockscoutInsightsCreateCommand() {
|
|
257490
257322
|
return missingApplication();
|
257491
257323
|
}
|
257492
257324
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257493
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257325
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
257494
257326
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257495
257327
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257496
|
-
const
|
257497
|
-
const node = await blockchainNodeOrLoadBalancerPrompt({
|
257328
|
+
const node = await blockchainNodePrompt({
|
257498
257329
|
env: env2,
|
257499
257330
|
nodes: blockchainNodes,
|
257500
|
-
loadBalancers,
|
257501
257331
|
accept: acceptDefaults,
|
257502
257332
|
isRequired: true
|
257503
257333
|
});
|
@@ -257610,104 +257440,6 @@ function integrationToolCreateCommand() {
|
|
257610
257440
|
return cmd2;
|
257611
257441
|
}
|
257612
257442
|
|
257613
|
-
// src/commands/platform/load-balancer/evm/create.ts
|
257614
|
-
function loadBalancerEvmCreateCommand() {
|
257615
|
-
return getCreateCommand({
|
257616
|
-
name: "evm",
|
257617
|
-
type: "load balancer",
|
257618
|
-
subType: "EVM",
|
257619
|
-
alias: "e",
|
257620
|
-
execute: (cmd2, baseAction) => {
|
257621
|
-
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)").action(async (name3, { application, provider, region, size, type: type4, blockchainNodes, acceptDefaults, ...defaultArgs }) => {
|
257622
|
-
return baseAction({
|
257623
|
-
...defaultArgs,
|
257624
|
-
acceptDefaults,
|
257625
|
-
provider,
|
257626
|
-
region
|
257627
|
-
}, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
|
257628
|
-
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
257629
|
-
if (!applicationUniqueName) {
|
257630
|
-
return missingApplication();
|
257631
|
-
}
|
257632
|
-
let networkUniqueName;
|
257633
|
-
let connectedNodesUniqueNames = blockchainNodes;
|
257634
|
-
if (!connectedNodesUniqueNames) {
|
257635
|
-
const networks = await serviceSpinner("blockchain network", () => settlemint.blockchainNetwork.list(applicationUniqueName));
|
257636
|
-
const network = await blockchainNetworkPrompt({
|
257637
|
-
env: env2,
|
257638
|
-
networks,
|
257639
|
-
accept: acceptDefaults,
|
257640
|
-
isRequired: true
|
257641
|
-
});
|
257642
|
-
if (!network) {
|
257643
|
-
return nothingSelectedError("blockchain network");
|
257644
|
-
}
|
257645
|
-
const blockchainNodes2 = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257646
|
-
const connectedNodes = await blockchainNodePrompt({
|
257647
|
-
env: env2,
|
257648
|
-
nodes: blockchainNodes2.filter((node) => node.blockchainNetwork?.uniqueName === networkUniqueName),
|
257649
|
-
accept: acceptDefaults,
|
257650
|
-
promptMessage: "Which blockchain node do you want to connect the load balancer to?",
|
257651
|
-
allowAll: true
|
257652
|
-
});
|
257653
|
-
connectedNodesUniqueNames = Array.isArray(connectedNodes) ? blockchainNodes2.map((node) => node.uniqueName) : connectedNodes ? [connectedNodes.uniqueName] : [];
|
257654
|
-
}
|
257655
|
-
if (!networkUniqueName) {
|
257656
|
-
const applicationBlockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257657
|
-
const selectedBlockchainNodes = applicationBlockchainNodes.filter((node) => connectedNodesUniqueNames.includes(node.uniqueName));
|
257658
|
-
if (selectedBlockchainNodes.length === 0) {
|
257659
|
-
return cancel2("blockchain network");
|
257660
|
-
}
|
257661
|
-
const onTheSameNetwork = selectedBlockchainNodes.every((node) => node.blockchainNetwork?.uniqueName === selectedBlockchainNodes[0].blockchainNetwork?.uniqueName);
|
257662
|
-
if (!onTheSameNetwork) {
|
257663
|
-
return cancel2("Blockchain nodes must be on the same network");
|
257664
|
-
}
|
257665
|
-
networkUniqueName = selectedBlockchainNodes[0].blockchainNetwork?.uniqueName;
|
257666
|
-
}
|
257667
|
-
const result = await showSpinner(() => settlemint.loadBalancer.create({
|
257668
|
-
applicationUniqueName,
|
257669
|
-
name: name3,
|
257670
|
-
blockchainNetworkUniqueName: networkUniqueName,
|
257671
|
-
provider: provider2,
|
257672
|
-
region: region2,
|
257673
|
-
size,
|
257674
|
-
type: type4,
|
257675
|
-
connectedNodesUniqueNames
|
257676
|
-
}));
|
257677
|
-
return {
|
257678
|
-
result,
|
257679
|
-
mapDefaultEnv: () => {
|
257680
|
-
return {
|
257681
|
-
SETTLEMINT_APPLICATION: applicationUniqueName,
|
257682
|
-
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: result.uniqueName
|
257683
|
-
};
|
257684
|
-
}
|
257685
|
-
};
|
257686
|
-
});
|
257687
|
-
});
|
257688
|
-
},
|
257689
|
-
examples: [
|
257690
|
-
{
|
257691
|
-
description: "Create an EVM load balancer and save as default",
|
257692
|
-
command: "platform create load-balancer evm my-lb --accept-defaults -d"
|
257693
|
-
},
|
257694
|
-
{
|
257695
|
-
description: "Create an EVM load balancer and connect to specific blockchain nodes",
|
257696
|
-
command: "platform create load-balancer evm my-lb --blockchain-nodes my-node1 my-node2 --accept-defaults"
|
257697
|
-
},
|
257698
|
-
{
|
257699
|
-
description: "Create an EVM load balancer in a different application",
|
257700
|
-
command: "platform create load-balancer evm my-lb --application my-app --accept-defaults"
|
257701
|
-
}
|
257702
|
-
]
|
257703
|
-
});
|
257704
|
-
}
|
257705
|
-
|
257706
|
-
// src/commands/platform/load-balancer/create.ts
|
257707
|
-
function loadBalancerCreateCommand() {
|
257708
|
-
return new Command("load-balancer").alias("lb").description("Create a load balancer in the SettleMint platform").addCommand(loadBalancerEvmCreateCommand());
|
257709
|
-
}
|
257710
|
-
|
257711
257443
|
// src/commands/platform/middleware/graph/create.ts
|
257712
257444
|
function graphMiddlewareCreateCommand() {
|
257713
257445
|
return getCreateCommand({
|
@@ -257716,7 +257448,7 @@ function graphMiddlewareCreateCommand() {
|
|
257716
257448
|
subType: "The Graph",
|
257717
257449
|
alias: "gr",
|
257718
257450
|
execute: (cmd2, baseAction) => {
|
257719
|
-
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name
|
257451
|
+
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name3, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
|
257720
257452
|
return baseAction({
|
257721
257453
|
...defaultArgs,
|
257722
257454
|
acceptDefaults,
|
@@ -257728,32 +257460,24 @@ function graphMiddlewareCreateCommand() {
|
|
257728
257460
|
return missingApplication();
|
257729
257461
|
}
|
257730
257462
|
let blockchainNodeUniqueName = blockchainNode;
|
257731
|
-
|
257732
|
-
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257463
|
+
if (!blockchainNodeUniqueName) {
|
257733
257464
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257734
|
-
const
|
257735
|
-
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257465
|
+
const node = await blockchainNodePrompt({
|
257736
257466
|
env: env2,
|
257737
257467
|
nodes: blockchainNodes,
|
257738
|
-
loadBalancers,
|
257739
257468
|
accept: acceptDefaults,
|
257740
257469
|
isRequired: true
|
257741
257470
|
});
|
257742
|
-
if (!
|
257743
|
-
return nothingSelectedError("blockchain node
|
257744
|
-
}
|
257745
|
-
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257746
|
-
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257747
|
-
} else {
|
257748
|
-
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257471
|
+
if (!node) {
|
257472
|
+
return nothingSelectedError("blockchain node");
|
257749
257473
|
}
|
257474
|
+
blockchainNodeUniqueName = node.uniqueName;
|
257750
257475
|
}
|
257751
257476
|
const result = await showSpinner(() => settlemint.middleware.create({
|
257752
257477
|
name: name3,
|
257753
257478
|
applicationUniqueName,
|
257754
257479
|
interface: "HA_GRAPH",
|
257755
257480
|
blockchainNodeUniqueName,
|
257756
|
-
loadBalancerUniqueName,
|
257757
257481
|
provider: provider2,
|
257758
257482
|
region: region2,
|
257759
257483
|
size,
|
@@ -257819,25 +257543,19 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
257819
257543
|
return missingApplication();
|
257820
257544
|
}
|
257821
257545
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257822
|
-
|
257546
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
257823
257547
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257824
257548
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257825
|
-
const
|
257826
|
-
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257549
|
+
const node = await blockchainNodePrompt({
|
257827
257550
|
env: env2,
|
257828
257551
|
nodes: blockchainNodes,
|
257829
|
-
loadBalancers,
|
257830
257552
|
accept: acceptDefaults,
|
257831
257553
|
isRequired: true
|
257832
257554
|
});
|
257833
|
-
if (!
|
257834
|
-
return nothingSelectedError("blockchain node
|
257835
|
-
}
|
257836
|
-
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257837
|
-
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257838
|
-
} else {
|
257839
|
-
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257555
|
+
if (!node) {
|
257556
|
+
return nothingSelectedError("blockchain node");
|
257840
257557
|
}
|
257558
|
+
blockchainNodeUniqueName = node.uniqueName;
|
257841
257559
|
}
|
257842
257560
|
const parsedAbis = [];
|
257843
257561
|
if (abis && abis.length > 0) {
|
@@ -258208,7 +257926,7 @@ function storageCreateCommand() {
|
|
258208
257926
|
|
258209
257927
|
// src/commands/platform/create.ts
|
258210
257928
|
function createCommand3() {
|
258211
|
-
return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand())
|
257929
|
+
return new Command("create").alias("c").description("Create a resource in the SettleMint platform").addCommand(workspaceCreateCommand()).addCommand(applicationCreateCommand()).addCommand(blockchainNetworkCreateCommand()).addCommand(blockchainNodeCreateCommand()).addCommand(privateKeyCreateCommand()).addCommand(middlewareCreateCommand()).addCommand(storageCreateCommand()).addCommand(integrationToolCreateCommand()).addCommand(insightsCreateCommand()).addCommand(applicationAccessTokenCreateCommand());
|
258212
257930
|
}
|
258213
257931
|
|
258214
257932
|
// src/prompts/delete-confirmation.prompt.ts
|
@@ -258448,19 +258166,6 @@ function integrationToolRestartCommand() {
|
|
258448
258166
|
return new Command("integration-tool").alias("it").description("Restart an integration tool service in the SettleMint platform").addCommand(hasuraRestartCommand());
|
258449
258167
|
}
|
258450
258168
|
|
258451
|
-
// src/commands/platform/load-balancer/restart.ts
|
258452
|
-
function loadBalancerRestartCommand() {
|
258453
|
-
return getRestartCommand({
|
258454
|
-
name: "load-balancer",
|
258455
|
-
type: "load balancer",
|
258456
|
-
alias: "lb",
|
258457
|
-
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
258458
|
-
restartFunction: async (settlemint, id) => {
|
258459
|
-
return settlemint.loadBalancer.restart(id);
|
258460
|
-
}
|
258461
|
-
});
|
258462
|
-
}
|
258463
|
-
|
258464
258169
|
// src/commands/platform/middleware/graph/restart.ts
|
258465
258170
|
function graphRestartCommand() {
|
258466
258171
|
return getRestartCommand({
|
@@ -258527,7 +258232,7 @@ function storageRestartCommand() {
|
|
258527
258232
|
|
258528
258233
|
// src/commands/platform/restart.ts
|
258529
258234
|
function restartCommand() {
|
258530
|
-
const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand())
|
258235
|
+
const cmd2 = new Command("restart").description("Restart a resource in the SettleMint platform").addCommand(blockchainNetworkRestartCommand()).addCommand(customDeploymentRestartCommand()).addCommand(insightsRestartCommand()).addCommand(integrationToolRestartCommand()).addCommand(middlewareRestartCommand()).addCommand(storageRestartCommand());
|
258531
258236
|
return cmd2;
|
258532
258237
|
}
|
258533
258238
|
|
@@ -259370,6 +259075,38 @@ function getStatusAction(status) {
|
|
259370
259075
|
return "Please try again later.";
|
259371
259076
|
}
|
259372
259077
|
|
259078
|
+
// src/prompts/smart-contract-set/address.prompt.ts
|
259079
|
+
async function addressPrompt({
|
259080
|
+
env: env2,
|
259081
|
+
accept,
|
259082
|
+
prod,
|
259083
|
+
node,
|
259084
|
+
hardhatConfig
|
259085
|
+
}) {
|
259086
|
+
const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
|
259087
|
+
const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
|
259088
|
+
const defaultPossible = accept && defaultAddress;
|
259089
|
+
if (defaultPossible) {
|
259090
|
+
if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
|
259091
|
+
return defaultAddress;
|
259092
|
+
}
|
259093
|
+
note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
|
259094
|
+
Please select another key or activate this key on the node and try again.`, "warn");
|
259095
|
+
}
|
259096
|
+
const address = await esm_default3({
|
259097
|
+
message: "Which private key do you want to deploy from?",
|
259098
|
+
choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
|
259099
|
+
name: name3,
|
259100
|
+
value: address2
|
259101
|
+
})),
|
259102
|
+
default: defaultAddress ?? possiblePrivateKeys[0]?.address
|
259103
|
+
});
|
259104
|
+
return address;
|
259105
|
+
}
|
259106
|
+
function validPrivateKey(privateKey) {
|
259107
|
+
return privateKey.privateKeyType !== "HD_ECDSA_P256";
|
259108
|
+
}
|
259109
|
+
|
259373
259110
|
// src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
|
259374
259111
|
async function selectTargetNode({
|
259375
259112
|
env: env2,
|
@@ -259393,7 +259130,6 @@ async function selectTargetNode({
|
|
259393
259130
|
nodes: validNodes,
|
259394
259131
|
accept: autoAccept,
|
259395
259132
|
isRequired: true,
|
259396
|
-
filterRunningOnly: true,
|
259397
259133
|
promptMessage: "Which blockchain node do you want to connect to? (Only nodes with private keys activated are shown)",
|
259398
259134
|
singleOptionMessage: (node2) => `Using '${node2}' - the only node with active private keys. To use a different node, ensure it has a private key activated.`
|
259399
259135
|
});
|
@@ -259415,7 +259151,7 @@ function validateNode(node, cancelOnError = true) {
|
|
259415
259151
|
}
|
259416
259152
|
return false;
|
259417
259153
|
}
|
259418
|
-
if (node.privateKeys?.filter(
|
259154
|
+
if (node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)).length === 0) {
|
259419
259155
|
if (cancelOnError) {
|
259420
259156
|
cancel2(`The specified blockchain node '${node.uniqueName}' does not have an ECDSA P256 or HSM ECDSA P256 private key activated. Please activate an ECDSA P256 or HSM ECDSA P256 private key on your node and try again.`);
|
259421
259157
|
}
|
@@ -259430,33 +259166,6 @@ function validateNode(node, cancelOnError = true) {
|
|
259430
259166
|
return true;
|
259431
259167
|
}
|
259432
259168
|
|
259433
|
-
// src/prompts/smart-contract-set/address.prompt.ts
|
259434
|
-
async function addressPrompt({
|
259435
|
-
accept,
|
259436
|
-
node,
|
259437
|
-
hardhatConfig
|
259438
|
-
}) {
|
259439
|
-
const possiblePrivateKeys = node.privateKeys?.filter(hasValidPrivateKey) ?? [];
|
259440
|
-
const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
|
259441
|
-
const defaultPossible = accept && defaultAddress;
|
259442
|
-
if (defaultPossible) {
|
259443
|
-
if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
|
259444
|
-
return defaultAddress;
|
259445
|
-
}
|
259446
|
-
note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
|
259447
|
-
Please select another key or activate this key on the node and try again.`, "warn");
|
259448
|
-
}
|
259449
|
-
const address = await esm_default3({
|
259450
|
-
message: "Which private key do you want to deploy from?",
|
259451
|
-
choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
|
259452
|
-
name: name3,
|
259453
|
-
value: address2
|
259454
|
-
})),
|
259455
|
-
default: defaultAddress
|
259456
|
-
});
|
259457
|
-
return address;
|
259458
|
-
}
|
259459
|
-
|
259460
259169
|
// src/utils/smart-contract-set/hardhat-config.ts
|
259461
259170
|
async function getHardhatConfigData(envConfig) {
|
259462
259171
|
try {
|
@@ -259546,7 +259255,7 @@ function hardhatDeployRemoteCommand() {
|
|
259546
259255
|
}
|
259547
259256
|
let address = defaultSender ?? null;
|
259548
259257
|
if (!defaultSender) {
|
259549
|
-
address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
|
259258
|
+
address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
|
259550
259259
|
}
|
259551
259260
|
if (!address) {
|
259552
259261
|
return nothingSelectedError("private key");
|
@@ -260192,4 +259901,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
260192
259901
|
// src/cli.ts
|
260193
259902
|
sdkCliCommand();
|
260194
259903
|
|
260195
|
-
//# debugId=
|
259904
|
+
//# debugId=DEE98450FE7ED53964756E2164756E21
|