@settlemint/sdk-cli 1.1.3-main3dbd1505 → 1.1.3-main4697075f
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 +22 -125
- package/dist/cli.js.map +9 -10
- package/package.json +4 -4
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.3-
|
|
274465
|
+
version: "1.1.3-main4697075f",
|
|
274466
274466
|
type: "module",
|
|
274467
274467
|
private: false,
|
|
274468
274468
|
license: "FSL-1.1-MIT",
|
|
@@ -274510,9 +274510,9 @@ 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.3-
|
|
274514
|
-
"@settlemint/sdk-utils": "1.1.3-
|
|
274515
|
-
"@types/node": "22.13.
|
|
274513
|
+
"@settlemint/sdk-js": "1.1.3-main4697075f",
|
|
274514
|
+
"@settlemint/sdk-utils": "1.1.3-main4697075f",
|
|
274515
|
+
"@types/node": "22.13.0",
|
|
274516
274516
|
"@types/semver": "7.5.8",
|
|
274517
274517
|
"@types/which": "3.0.4",
|
|
274518
274518
|
"get-tsconfig": "4.10.0",
|
|
@@ -276551,7 +276551,6 @@ function initGraphQLTada() {
|
|
|
276551
276551
|
var t2 = initGraphQLTada();
|
|
276552
276552
|
|
|
276553
276553
|
// ../js/dist/settlemint.mjs
|
|
276554
|
-
import { createHash } from "node:crypto";
|
|
276555
276554
|
var graphql = initGraphQLTada();
|
|
276556
276555
|
var WorkspaceFragment = graphql(`
|
|
276557
276556
|
fragment Workspace on Workspace {
|
|
@@ -277852,50 +277851,6 @@ var ClientOptionsSchema = z.object({
|
|
|
277852
277851
|
accessToken: AccessTokenSchema2,
|
|
277853
277852
|
instance: UrlSchema2
|
|
277854
277853
|
});
|
|
277855
|
-
function hashPincode(pincode, salt) {
|
|
277856
|
-
return createHash("sha256").update(`${salt}${pincode}`).digest("hex");
|
|
277857
|
-
}
|
|
277858
|
-
function generateResponse(pincode, salt, challenge) {
|
|
277859
|
-
const hashedPincode = hashPincode(pincode, salt);
|
|
277860
|
-
return createHash("sha256").update(`${hashedPincode}_${challenge}`).digest("hex");
|
|
277861
|
-
}
|
|
277862
|
-
async function getPincodeVerificationResponse({
|
|
277863
|
-
userWalletAddress,
|
|
277864
|
-
pincode,
|
|
277865
|
-
accessToken,
|
|
277866
|
-
instance,
|
|
277867
|
-
nodeId
|
|
277868
|
-
}) {
|
|
277869
|
-
const response = await fetch(`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges`, {
|
|
277870
|
-
method: "POST",
|
|
277871
|
-
headers: {
|
|
277872
|
-
"Content-Type": "application/json",
|
|
277873
|
-
"x-auth-token": accessToken
|
|
277874
|
-
},
|
|
277875
|
-
body: JSON.stringify({
|
|
277876
|
-
pincode,
|
|
277877
|
-
verificationType: "PINCODE",
|
|
277878
|
-
name: "pincode"
|
|
277879
|
-
})
|
|
277880
|
-
});
|
|
277881
|
-
if (!response.ok) {
|
|
277882
|
-
if (response.status === 404) {
|
|
277883
|
-
throw new Error(`No user wallet found with address '${userWalletAddress}' for node '${nodeId}'`);
|
|
277884
|
-
}
|
|
277885
|
-
throw new Error("Failed to get verification challenge");
|
|
277886
|
-
}
|
|
277887
|
-
const verificationChallenges = await response.json();
|
|
277888
|
-
if (!verificationChallenges.length) {
|
|
277889
|
-
throw new Error("No verification challenges received");
|
|
277890
|
-
}
|
|
277891
|
-
const firstChallenge = verificationChallenges[0];
|
|
277892
|
-
const challenge = firstChallenge?.challenge;
|
|
277893
|
-
if (!challenge?.secret || !challenge?.salt) {
|
|
277894
|
-
throw new Error("Could not authenticate pin code, invalid challenge format");
|
|
277895
|
-
}
|
|
277896
|
-
const { secret, salt } = challenge;
|
|
277897
|
-
return generateResponse(pincode, salt, secret);
|
|
277898
|
-
}
|
|
277899
277854
|
function createSettleMintClient(options) {
|
|
277900
277855
|
ensureServer();
|
|
277901
277856
|
const validatedOptions = options.anonymous ? validate2(z.object({
|
|
@@ -277993,13 +277948,6 @@ function createSettleMintClient(options) {
|
|
|
277993
277948
|
},
|
|
277994
277949
|
platform: {
|
|
277995
277950
|
config: getPlatformConfig(gqlClient)
|
|
277996
|
-
},
|
|
277997
|
-
wallet: {
|
|
277998
|
-
pincodeVerificationResponse: (args) => getPincodeVerificationResponse({
|
|
277999
|
-
...args,
|
|
278000
|
-
instance: validatedOptions.instance,
|
|
278001
|
-
accessToken: validatedOptions.accessToken
|
|
278002
|
-
})
|
|
278003
277951
|
}
|
|
278004
277952
|
};
|
|
278005
277953
|
}
|
|
@@ -282158,6 +282106,11 @@ function logoutCommand() {
|
|
|
282158
282106
|
});
|
|
282159
282107
|
}
|
|
282160
282108
|
|
|
282109
|
+
// src/commands/platform/common/cluster-service.args.ts
|
|
282110
|
+
function addClusterServiceArgs(cmd2) {
|
|
282111
|
+
return cmd2.option("--provider <provider>", "Network provider (run `settlemint platform config` to see available providers)").option("--region <region>", "Deployment region (run `settlemint platform config` to see available regions)").addOption(new Option("--size <size>", "Network size").choices(["CUSTOM", "LARGE", "MEDIUM", "SMALL"]).argParser((value4) => value4).default("SMALL")).addOption(new Option("--type <type>", "Network type").choices(["DEDICATED", "SHARED"]).argParser((value4) => value4).default("SHARED"));
|
|
282112
|
+
}
|
|
282113
|
+
|
|
282161
282114
|
// src/constants/resource-type.ts
|
|
282162
282115
|
var SETTLEMINT_CLIENT_MAP = {
|
|
282163
282116
|
application: "application",
|
|
@@ -282194,71 +282147,6 @@ var LABELS_MAP = {
|
|
|
282194
282147
|
}
|
|
282195
282148
|
};
|
|
282196
282149
|
|
|
282197
|
-
// src/spinners/service.spinner.ts
|
|
282198
|
-
async function serviceSpinner(type4, task) {
|
|
282199
|
-
const { plural } = LABELS_MAP[type4];
|
|
282200
|
-
return spinner({
|
|
282201
|
-
startMessage: `Loading ${plural} services`,
|
|
282202
|
-
stopMessage: `Loaded ${plural} services`,
|
|
282203
|
-
task
|
|
282204
|
-
});
|
|
282205
|
-
}
|
|
282206
|
-
|
|
282207
|
-
// src/commands/pincode-verification-response.ts
|
|
282208
|
-
function pincodeVerificationResponseCommand() {
|
|
282209
|
-
return new Command("pincode-verification-response").alias("pvr").description("Get pincode verification response for a blockchain node").requiredOption("--wallet-address <walletAddress>", "The wallet address to get pincode verification response for").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name to get pincode verification response for").action(async ({ instance, blockchainNode, walletAddress }) => {
|
|
282210
|
-
intro("Generating pincode verification response for wallet address");
|
|
282211
|
-
const env2 = await loadEnv(false, false);
|
|
282212
|
-
const applicationUniqueName = env2.SETTLEMINT_APPLICATION;
|
|
282213
|
-
if (!applicationUniqueName) {
|
|
282214
|
-
return missingApplication();
|
|
282215
|
-
}
|
|
282216
|
-
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
|
|
282217
|
-
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
|
282218
|
-
if (!personalAccessToken) {
|
|
282219
|
-
return missingPersonalAccessTokenError();
|
|
282220
|
-
}
|
|
282221
|
-
const settlemint = createSettleMintClient({
|
|
282222
|
-
accessToken: personalAccessToken.personalAccessToken,
|
|
282223
|
-
instance: selectedInstance
|
|
282224
|
-
});
|
|
282225
|
-
const blockchainNodes = await serviceSpinner("blockchain node", () => settlemint.blockchainNode.list(applicationUniqueName));
|
|
282226
|
-
let selectedBlockchainNode = blockchainNode ? blockchainNodes.find((node) => node.uniqueName === blockchainNode) : undefined;
|
|
282227
|
-
if (!selectedBlockchainNode) {
|
|
282228
|
-
selectedBlockchainNode = await blockchainNodePrompt({
|
|
282229
|
-
env: env2,
|
|
282230
|
-
nodes: blockchainNodes,
|
|
282231
|
-
accept: false,
|
|
282232
|
-
isRequired: true
|
|
282233
|
-
});
|
|
282234
|
-
if (!selectedBlockchainNode) {
|
|
282235
|
-
return nothingSelectedError("blockchain node");
|
|
282236
|
-
}
|
|
282237
|
-
}
|
|
282238
|
-
const pincode = await esm_default5({
|
|
282239
|
-
message: "Enter your pincode",
|
|
282240
|
-
validate(value4) {
|
|
282241
|
-
if (!value4.trim()) {
|
|
282242
|
-
return "Pincode is required";
|
|
282243
|
-
}
|
|
282244
|
-
return true;
|
|
282245
|
-
}
|
|
282246
|
-
});
|
|
282247
|
-
const pincodeVerificationResponse = await settlemint.wallet.pincodeVerificationResponse({
|
|
282248
|
-
userWalletAddress: walletAddress,
|
|
282249
|
-
pincode,
|
|
282250
|
-
nodeId: selectedBlockchainNode.id
|
|
282251
|
-
});
|
|
282252
|
-
note(`Pincode verification response: ${pincodeVerificationResponse}`);
|
|
282253
|
-
outro("Pincode verification response generated");
|
|
282254
|
-
});
|
|
282255
|
-
}
|
|
282256
|
-
|
|
282257
|
-
// src/commands/platform/common/cluster-service.args.ts
|
|
282258
|
-
function addClusterServiceArgs(cmd2) {
|
|
282259
|
-
return cmd2.option("--provider <provider>", "Network provider (run `settlemint platform config` to see available providers)").option("--region <region>", "Deployment region (run `settlemint platform config` to see available regions)").addOption(new Option("--size <size>", "Network size").choices(["CUSTOM", "LARGE", "MEDIUM", "SMALL"]).argParser((value4) => value4).default("SMALL")).addOption(new Option("--type <type>", "Network type").choices(["DEDICATED", "SHARED"]).argParser((value4) => value4).default("SHARED"));
|
|
282260
|
-
}
|
|
282261
|
-
|
|
282262
282150
|
// src/commands/platform/utils/wait-for-completion.ts
|
|
282263
282151
|
class TimeoutError extends Error {
|
|
282264
282152
|
}
|
|
@@ -282271,7 +282159,7 @@ async function waitForCompletion({
|
|
|
282271
282159
|
restartIfTimeout = false
|
|
282272
282160
|
}) {
|
|
282273
282161
|
const serviceType = SETTLEMINT_CLIENT_MAP[type4];
|
|
282274
|
-
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken" || serviceType === "platform"
|
|
282162
|
+
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken" || serviceType === "platform") {
|
|
282275
282163
|
return true;
|
|
282276
282164
|
}
|
|
282277
282165
|
const service = settlemint[serviceType];
|
|
@@ -282888,6 +282776,16 @@ async function blockchainNetworkPrompt({
|
|
|
282888
282776
|
});
|
|
282889
282777
|
}
|
|
282890
282778
|
|
|
282779
|
+
// src/spinners/service.spinner.ts
|
|
282780
|
+
async function serviceSpinner(type4, task) {
|
|
282781
|
+
const { plural } = LABELS_MAP[type4];
|
|
282782
|
+
return spinner({
|
|
282783
|
+
startMessage: `Loading ${plural} services`,
|
|
282784
|
+
stopMessage: `Loaded ${plural} services`,
|
|
282785
|
+
task
|
|
282786
|
+
});
|
|
282787
|
+
}
|
|
282788
|
+
|
|
282891
282789
|
// src/commands/platform/blockchain-node/besu/create.ts
|
|
282892
282790
|
function blockchainNodeBesuCreateCommand() {
|
|
282893
282791
|
return getCreateCommand({
|
|
@@ -284164,7 +284062,7 @@ function applicationsListCommand() {
|
|
|
284164
284062
|
});
|
|
284165
284063
|
if (printToTerminal) {
|
|
284166
284064
|
const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
|
|
284167
|
-
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace
|
|
284065
|
+
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
|
284168
284066
|
} else if (output === "json") {
|
|
284169
284067
|
jsonOutput(applicationsData);
|
|
284170
284068
|
} else if (output === "yaml") {
|
|
@@ -285464,7 +285362,6 @@ function registerCommands() {
|
|
|
285464
285362
|
sdkcli.addCommand(createCommand2());
|
|
285465
285363
|
sdkcli.addCommand(loginCommand());
|
|
285466
285364
|
sdkcli.addCommand(logoutCommand());
|
|
285467
|
-
sdkcli.addCommand(pincodeVerificationResponseCommand());
|
|
285468
285365
|
return sdkcli;
|
|
285469
285366
|
}
|
|
285470
285367
|
async function sdkCliCommand(argv = process.argv) {
|
|
@@ -285484,4 +285381,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
|
285484
285381
|
// src/cli.ts
|
|
285485
285382
|
sdkCliCommand();
|
|
285486
285383
|
|
|
285487
|
-
//# debugId=
|
|
285384
|
+
//# debugId=A83BC3504AFEF7F464756E2164756E21
|