@settlemint/sdk-cli 2.1.4-pr2c3c56a2 → 2.1.4-pr3b65e859
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 +152 -56
- package/dist/cli.js.map +18 -16
- 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_BLOCKCHAIN_NODE_OR_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-pr3b65e859",
|
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-pr3b65e859",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.4-pr3b65e859",
|
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_BLOCKCHAIN_NODE_OR_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,6 +248059,15 @@ 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]);
|
248062
248071
|
var loadBalancerRead = (gqlClient) => {
|
248063
248072
|
return async (loadBalancerUniqueName) => {
|
248064
248073
|
const { loadBalancerByUniqueName: loadBalancer } = await gqlClient.request(getLoadBalancer, {
|
@@ -248067,6 +248076,14 @@ var loadBalancerRead = (gqlClient) => {
|
|
248067
248076
|
return loadBalancer;
|
248068
248077
|
};
|
248069
248078
|
};
|
248079
|
+
var loadBalancerList = (gqlClient) => {
|
248080
|
+
return async (applicationUniqueName) => {
|
248081
|
+
const {
|
248082
|
+
loadBalancersByUniqueName: { items }
|
248083
|
+
} = await gqlClient.request(getLoadBalancers, { applicationUniqueName });
|
248084
|
+
return items;
|
248085
|
+
};
|
248086
|
+
};
|
248070
248087
|
var InsightsFragment = graphql(`
|
248071
248088
|
fragment Insights on Insights {
|
248072
248089
|
__typename
|
@@ -248767,6 +248784,10 @@ function createSettleMintClient(options) {
|
|
248767
248784
|
create: blockchainNodeCreate(gqlClient),
|
248768
248785
|
restart: blockchainNodeRestart(gqlClient)
|
248769
248786
|
},
|
248787
|
+
loadBalancer: {
|
248788
|
+
list: loadBalancerList(gqlClient),
|
248789
|
+
read: loadBalancerRead(gqlClient)
|
248790
|
+
},
|
248770
248791
|
middleware: {
|
248771
248792
|
list: middlewareList(gqlClient),
|
248772
248793
|
read: middlewareRead(gqlClient),
|
@@ -252559,7 +252580,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252559
252580
|
storages,
|
252560
252581
|
privateKeys,
|
252561
252582
|
insights,
|
252562
|
-
customDeployments
|
252583
|
+
customDeployments,
|
252584
|
+
loadBalancers
|
252563
252585
|
] = await Promise.all([
|
252564
252586
|
shouldFetch("blockchain-network") ? settlemint.blockchainNetwork.list(applicationUniqueName) : Promise.resolve([]),
|
252565
252587
|
shouldFetch("blockchain-node") ? settlemint.blockchainNode.list(applicationUniqueName) : Promise.resolve([]),
|
@@ -252568,7 +252590,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252568
252590
|
shouldFetch("storage") ? settlemint.storage.list(applicationUniqueName) : Promise.resolve([]),
|
252569
252591
|
shouldFetch("private-key") ? settlemint.privateKey.list(applicationUniqueName) : Promise.resolve([]),
|
252570
252592
|
shouldFetch("insights") ? settlemint.insights.list(applicationUniqueName) : Promise.resolve([]),
|
252571
|
-
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([])
|
252593
|
+
shouldFetch("custom-deployment") ? settlemint.customDeployment.list(applicationUniqueName) : Promise.resolve([]),
|
252594
|
+
shouldFetch("load-balancer") ? settlemint.loadBalancer.list(applicationUniqueName) : Promise.resolve([])
|
252572
252595
|
]);
|
252573
252596
|
return {
|
252574
252597
|
blockchainNetworks,
|
@@ -252578,7 +252601,8 @@ async function servicesSpinner(settlemint, applicationUniqueName, types2) {
|
|
252578
252601
|
storages,
|
252579
252602
|
privateKeys,
|
252580
252603
|
insights,
|
252581
|
-
customDeployments
|
252604
|
+
customDeployments,
|
252605
|
+
loadBalancers
|
252582
252606
|
};
|
252583
252607
|
}
|
252584
252608
|
});
|
@@ -252618,7 +252642,7 @@ async function writeEnvSpinner(prod, env2) {
|
|
252618
252642
|
SETTLEMINT_APPLICATION: env2.SETTLEMINT_APPLICATION,
|
252619
252643
|
SETTLEMINT_BLOCKCHAIN_NETWORK: env2.SETTLEMINT_BLOCKCHAIN_NETWORK,
|
252620
252644
|
SETTLEMINT_BLOCKCHAIN_NODE: env2.SETTLEMINT_BLOCKCHAIN_NODE,
|
252621
|
-
|
252645
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER,
|
252622
252646
|
SETTLEMINT_HASURA: env2.SETTLEMINT_HASURA,
|
252623
252647
|
SETTLEMINT_HASURA_ENDPOINT: env2.SETTLEMINT_HASURA_ENDPOINT,
|
252624
252648
|
SETTLEMINT_THEGRAPH: env2.SETTLEMINT_THEGRAPH,
|
@@ -252727,6 +252751,35 @@ function getMinioEndpoints(service) {
|
|
252727
252751
|
};
|
252728
252752
|
}
|
252729
252753
|
|
252754
|
+
// src/prompts/cluster-service/blockchain-node-or-load-balancer.prompt.ts
|
252755
|
+
async function blockchainNodeOrLoadBalancerPrompt({
|
252756
|
+
env: env2,
|
252757
|
+
nodes,
|
252758
|
+
loadBalancers,
|
252759
|
+
accept,
|
252760
|
+
singleOptionMessage,
|
252761
|
+
promptMessage,
|
252762
|
+
filterRunningOnly = false,
|
252763
|
+
isRequired = false
|
252764
|
+
}) {
|
252765
|
+
return servicePrompt({
|
252766
|
+
env: env2,
|
252767
|
+
services: [...nodes, ...loadBalancers],
|
252768
|
+
accept,
|
252769
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER",
|
252770
|
+
isRequired,
|
252771
|
+
defaultHandler: async ({ defaultService: defaultNode, choices }) => {
|
252772
|
+
const filteredChoices = filterRunningOnly ? choices.filter(({ value: node }) => node === undefined || node?.status === "COMPLETED") : choices;
|
252773
|
+
return esm_default3({
|
252774
|
+
message: promptMessage ?? "Which blockchain node or load balancer do you want to connect to?",
|
252775
|
+
choices: filteredChoices,
|
252776
|
+
default: defaultNode
|
252777
|
+
});
|
252778
|
+
},
|
252779
|
+
singleOptionMessage
|
252780
|
+
});
|
252781
|
+
}
|
252782
|
+
|
252730
252783
|
// src/commands/connect.ts
|
252731
252784
|
function connectCommand() {
|
252732
252785
|
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 }) => {
|
@@ -252746,11 +252799,29 @@ function connectCommand() {
|
|
252746
252799
|
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
252747
252800
|
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
252748
252801
|
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
252749
|
-
const {
|
252802
|
+
const {
|
252803
|
+
middlewares,
|
252804
|
+
integrationTools,
|
252805
|
+
storages,
|
252806
|
+
privateKeys,
|
252807
|
+
insights,
|
252808
|
+
customDeployments,
|
252809
|
+
blockchainNodes,
|
252810
|
+
loadBalancers
|
252811
|
+
} = await servicesSpinner(settlemint, application.uniqueName);
|
252750
252812
|
const blockchainNode = await blockchainNodePrompt({
|
252751
252813
|
env: env2,
|
252752
252814
|
nodes: blockchainNodes,
|
252753
|
-
accept: acceptDefaults
|
252815
|
+
accept: acceptDefaults,
|
252816
|
+
promptMessage: "Which blockchain node do you want to SEND unsigned transactions from?"
|
252817
|
+
});
|
252818
|
+
const nodesWithNoSigning = blockchainNodes.filter((node) => node && ("privateKeys" in node) ? !Array.isArray(node?.privateKeys) || node?.privateKeys?.length === 0 : true);
|
252819
|
+
const loadBalancerOrBlockchainNode = await blockchainNodeOrLoadBalancerPrompt({
|
252820
|
+
env: env2,
|
252821
|
+
nodes: nodesWithNoSigning,
|
252822
|
+
loadBalancers,
|
252823
|
+
accept: acceptDefaults,
|
252824
|
+
promptMessage: "Which blockchain node or load balancer do you want to READ/WRITE from/to? Transactions should be signed before sending to this node or load balancer"
|
252754
252825
|
});
|
252755
252826
|
const hasura = await hasuraPrompt({
|
252756
252827
|
env: env2,
|
@@ -252820,6 +252891,11 @@ function connectCommand() {
|
|
252820
252891
|
name: blockchainNode.name,
|
252821
252892
|
uniqueName: blockchainNode.uniqueName
|
252822
252893
|
},
|
252894
|
+
loadBalancerOrBlockchainNode && {
|
252895
|
+
type: "Blockchain Node or Load Balancer (signed transactions only)",
|
252896
|
+
name: loadBalancerOrBlockchainNode.name,
|
252897
|
+
uniqueName: loadBalancerOrBlockchainNode.uniqueName
|
252898
|
+
},
|
252823
252899
|
hasura && {
|
252824
252900
|
type: "Hasura",
|
252825
252901
|
name: hasura.name,
|
@@ -252870,6 +252946,7 @@ function connectCommand() {
|
|
252870
252946
|
SETTLEMINT_APPLICATION: application.uniqueName,
|
252871
252947
|
SETTLEMINT_BLOCKCHAIN_NETWORK: blockchainNode?.blockchainNetwork?.uniqueName,
|
252872
252948
|
SETTLEMINT_BLOCKCHAIN_NODE: blockchainNode?.uniqueName,
|
252949
|
+
SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER: loadBalancerOrBlockchainNode?.uniqueName,
|
252873
252950
|
SETTLEMINT_HASURA: hasura?.uniqueName,
|
252874
252951
|
...getHasuraEndpoints(hasura),
|
252875
252952
|
SETTLEMINT_THEGRAPH: thegraph?.uniqueName,
|
@@ -256211,7 +256288,8 @@ var SETTLEMINT_CLIENT_MAP = {
|
|
256211
256288
|
"integration tool": "integrationTool",
|
256212
256289
|
storage: "storage",
|
256213
256290
|
insights: "insights",
|
256214
|
-
"application access token": "applicationAccessToken"
|
256291
|
+
"application access token": "applicationAccessToken",
|
256292
|
+
"load balancer": "loadBalancer"
|
256215
256293
|
};
|
256216
256294
|
var LABELS_MAP = {
|
256217
256295
|
application: { singular: "application", plural: "applications", command: "app" },
|
@@ -256232,7 +256310,8 @@ var LABELS_MAP = {
|
|
256232
256310
|
singular: "application access token",
|
256233
256311
|
plural: "application access tokens",
|
256234
256312
|
command: "application-access-token"
|
256235
|
-
}
|
256313
|
+
},
|
256314
|
+
"load balancer": { singular: "load balancer", plural: "load balancers", command: "load-balancer" }
|
256236
256315
|
};
|
256237
256316
|
|
256238
256317
|
// src/spinners/service.spinner.ts
|
@@ -257322,12 +257401,14 @@ function blockscoutInsightsCreateCommand() {
|
|
257322
257401
|
return missingApplication();
|
257323
257402
|
}
|
257324
257403
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257325
|
-
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.
|
257404
|
+
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257326
257405
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257327
257406
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257328
|
-
const
|
257407
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257408
|
+
const node = await blockchainNodeOrLoadBalancerPrompt({
|
257329
257409
|
env: env2,
|
257330
257410
|
nodes: blockchainNodes,
|
257411
|
+
loadBalancers,
|
257331
257412
|
accept: acceptDefaults,
|
257332
257413
|
isRequired: true
|
257333
257414
|
});
|
@@ -257448,7 +257529,7 @@ function graphMiddlewareCreateCommand() {
|
|
257448
257529
|
subType: "The Graph",
|
257449
257530
|
alias: "gr",
|
257450
257531
|
execute: (cmd2, baseAction) => {
|
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 }) => {
|
257532
|
+
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").action(async (name3, { application, blockchainNode, loadBalancer, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
|
257452
257533
|
return baseAction({
|
257453
257534
|
...defaultArgs,
|
257454
257535
|
acceptDefaults,
|
@@ -257460,24 +257541,32 @@ function graphMiddlewareCreateCommand() {
|
|
257460
257541
|
return missingApplication();
|
257461
257542
|
}
|
257462
257543
|
let blockchainNodeUniqueName = blockchainNode;
|
257463
|
-
|
257544
|
+
let loadBalancerUniqueName = loadBalancer;
|
257545
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257464
257546
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257465
|
-
const
|
257547
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257548
|
+
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257466
257549
|
env: env2,
|
257467
257550
|
nodes: blockchainNodes,
|
257551
|
+
loadBalancers,
|
257468
257552
|
accept: acceptDefaults,
|
257469
257553
|
isRequired: true
|
257470
257554
|
});
|
257471
|
-
if (!
|
257472
|
-
return nothingSelectedError("blockchain node");
|
257555
|
+
if (!nodeOrLoadbalancer) {
|
257556
|
+
return nothingSelectedError("blockchain node or load balancer");
|
257557
|
+
}
|
257558
|
+
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257559
|
+
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257560
|
+
} else {
|
257561
|
+
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257473
257562
|
}
|
257474
|
-
blockchainNodeUniqueName = node.uniqueName;
|
257475
257563
|
}
|
257476
257564
|
const result = await showSpinner(() => settlemint.middleware.create({
|
257477
257565
|
name: name3,
|
257478
257566
|
applicationUniqueName,
|
257479
257567
|
interface: "HA_GRAPH",
|
257480
257568
|
blockchainNodeUniqueName,
|
257569
|
+
loadBalancerUniqueName,
|
257481
257570
|
provider: provider2,
|
257482
257571
|
region: region2,
|
257483
257572
|
size,
|
@@ -257543,19 +257632,25 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
257543
257632
|
return missingApplication();
|
257544
257633
|
}
|
257545
257634
|
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
257546
|
-
|
257635
|
+
let loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER;
|
257547
257636
|
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
257548
257637
|
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
257549
|
-
const
|
257638
|
+
const loadBalancers = await serviceSpinner("load balancer", () => settlemint.loadBalancer.list(applicationUniqueName));
|
257639
|
+
const nodeOrLoadbalancer = await blockchainNodeOrLoadBalancerPrompt({
|
257550
257640
|
env: env2,
|
257551
257641
|
nodes: blockchainNodes,
|
257642
|
+
loadBalancers,
|
257552
257643
|
accept: acceptDefaults,
|
257553
257644
|
isRequired: true
|
257554
257645
|
});
|
257555
|
-
if (!
|
257556
|
-
return nothingSelectedError("blockchain node");
|
257646
|
+
if (!nodeOrLoadbalancer) {
|
257647
|
+
return nothingSelectedError("blockchain node or load balancer");
|
257648
|
+
}
|
257649
|
+
if (nodeOrLoadbalancer.__typename?.endsWith("LoadBalancer")) {
|
257650
|
+
loadBalancerUniqueName = nodeOrLoadbalancer.uniqueName;
|
257651
|
+
} else {
|
257652
|
+
blockchainNodeUniqueName = nodeOrLoadbalancer.uniqueName;
|
257557
257653
|
}
|
257558
|
-
blockchainNodeUniqueName = node.uniqueName;
|
257559
257654
|
}
|
257560
257655
|
const parsedAbis = [];
|
257561
257656
|
if (abis && abis.length > 0) {
|
@@ -259075,34 +259170,7 @@ function getStatusAction(status) {
|
|
259075
259170
|
return "Please try again later.";
|
259076
259171
|
}
|
259077
259172
|
|
259078
|
-
// src/
|
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
|
-
}
|
259173
|
+
// src/utils/blockchain-node.ts
|
259106
259174
|
function validPrivateKey(privateKey) {
|
259107
259175
|
return privateKey.privateKeyType !== "HD_ECDSA_P256";
|
259108
259176
|
}
|
@@ -259130,6 +259198,7 @@ async function selectTargetNode({
|
|
259130
259198
|
nodes: validNodes,
|
259131
259199
|
accept: autoAccept,
|
259132
259200
|
isRequired: true,
|
259201
|
+
filterRunningOnly: true,
|
259133
259202
|
promptMessage: "Which blockchain node do you want to connect to? (Only nodes with private keys activated are shown)",
|
259134
259203
|
singleOptionMessage: (node2) => `Using '${node2}' - the only node with active private keys. To use a different node, ensure it has a private key activated.`
|
259135
259204
|
});
|
@@ -259166,6 +259235,33 @@ function validateNode(node, cancelOnError = true) {
|
|
259166
259235
|
return true;
|
259167
259236
|
}
|
259168
259237
|
|
259238
|
+
// src/prompts/smart-contract-set/address.prompt.ts
|
259239
|
+
async function addressPrompt({
|
259240
|
+
accept,
|
259241
|
+
node,
|
259242
|
+
hardhatConfig
|
259243
|
+
}) {
|
259244
|
+
const possiblePrivateKeys = node.privateKeys?.filter((privateKey) => validPrivateKey(privateKey)) ?? [];
|
259245
|
+
const defaultAddress = hardhatConfig.networks?.btp?.from ?? possiblePrivateKeys[0]?.address;
|
259246
|
+
const defaultPossible = accept && defaultAddress;
|
259247
|
+
if (defaultPossible) {
|
259248
|
+
if (possiblePrivateKeys.some((privateKey) => privateKey.address?.toLowerCase() === defaultAddress?.toLowerCase())) {
|
259249
|
+
return defaultAddress;
|
259250
|
+
}
|
259251
|
+
note(`Private key with address '${defaultAddress}' is not activated on the node '${node.uniqueName}'.
|
259252
|
+
Please select another key or activate this key on the node and try again.`, "warn");
|
259253
|
+
}
|
259254
|
+
const address = await esm_default3({
|
259255
|
+
message: "Which private key do you want to deploy from?",
|
259256
|
+
choices: possiblePrivateKeys.map(({ address: address2, name: name3 }) => ({
|
259257
|
+
name: name3,
|
259258
|
+
value: address2
|
259259
|
+
})),
|
259260
|
+
default: defaultAddress
|
259261
|
+
});
|
259262
|
+
return address;
|
259263
|
+
}
|
259264
|
+
|
259169
259265
|
// src/utils/smart-contract-set/hardhat-config.ts
|
259170
259266
|
async function getHardhatConfigData(envConfig) {
|
259171
259267
|
try {
|
@@ -259255,7 +259351,7 @@ function hardhatDeployRemoteCommand() {
|
|
259255
259351
|
}
|
259256
259352
|
let address = defaultSender ?? null;
|
259257
259353
|
if (!defaultSender) {
|
259258
|
-
address = await addressPrompt({
|
259354
|
+
address = await addressPrompt({ accept: autoAccept, node, hardhatConfig });
|
259259
259355
|
}
|
259260
259356
|
if (!address) {
|
259261
259357
|
return nothingSelectedError("private key");
|
@@ -259901,4 +259997,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
259901
259997
|
// src/cli.ts
|
259902
259998
|
sdkCliCommand();
|
259903
259999
|
|
259904
|
-
//# debugId=
|
260000
|
+
//# debugId=5250BB52C7AD397564756E2164756E21
|