@settlemint/sdk-cli 1.1.3-prb2a0e155 → 1.1.3-prdba810bd
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 +125 -22
- package/dist/cli.js.map +10 -9
- 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-prdba810bd",
|
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-prdba810bd",
|
274514
|
+
"@settlemint/sdk-utils": "1.1.3-prdba810bd",
|
274515
|
+
"@types/node": "22.13.1",
|
274516
274516
|
"@types/semver": "7.5.8",
|
274517
274517
|
"@types/which": "3.0.4",
|
274518
274518
|
"get-tsconfig": "4.10.0",
|
@@ -276551,6 +276551,7 @@ function initGraphQLTada() {
|
|
276551
276551
|
var t2 = initGraphQLTada();
|
276552
276552
|
|
276553
276553
|
// ../js/dist/settlemint.mjs
|
276554
|
+
import { createHash } from "node:crypto";
|
276554
276555
|
var graphql = initGraphQLTada();
|
276555
276556
|
var WorkspaceFragment = graphql(`
|
276556
276557
|
fragment Workspace on Workspace {
|
@@ -277851,6 +277852,50 @@ var ClientOptionsSchema = z.object({
|
|
277851
277852
|
accessToken: AccessTokenSchema2,
|
277852
277853
|
instance: UrlSchema2
|
277853
277854
|
});
|
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
|
+
}
|
277854
277899
|
function createSettleMintClient(options) {
|
277855
277900
|
ensureServer();
|
277856
277901
|
const validatedOptions = options.anonymous ? validate2(z.object({
|
@@ -277948,6 +277993,13 @@ function createSettleMintClient(options) {
|
|
277948
277993
|
},
|
277949
277994
|
platform: {
|
277950
277995
|
config: getPlatformConfig(gqlClient)
|
277996
|
+
},
|
277997
|
+
wallet: {
|
277998
|
+
pincodeVerificationResponse: (args) => getPincodeVerificationResponse({
|
277999
|
+
...args,
|
278000
|
+
instance: validatedOptions.instance,
|
278001
|
+
accessToken: validatedOptions.accessToken
|
278002
|
+
})
|
277951
278003
|
}
|
277952
278004
|
};
|
277953
278005
|
}
|
@@ -282106,11 +282158,6 @@ function logoutCommand() {
|
|
282106
282158
|
});
|
282107
282159
|
}
|
282108
282160
|
|
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
|
-
|
282114
282161
|
// src/constants/resource-type.ts
|
282115
282162
|
var SETTLEMINT_CLIENT_MAP = {
|
282116
282163
|
application: "application",
|
@@ -282147,6 +282194,71 @@ var LABELS_MAP = {
|
|
282147
282194
|
}
|
282148
282195
|
};
|
282149
282196
|
|
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
|
+
|
282150
282262
|
// src/commands/platform/utils/wait-for-completion.ts
|
282151
282263
|
class TimeoutError extends Error {
|
282152
282264
|
}
|
@@ -282159,7 +282271,7 @@ async function waitForCompletion({
|
|
282159
282271
|
restartIfTimeout = false
|
282160
282272
|
}) {
|
282161
282273
|
const serviceType = SETTLEMINT_CLIENT_MAP[type4];
|
282162
|
-
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken" || serviceType === "platform") {
|
282274
|
+
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken" || serviceType === "platform" || serviceType === "wallet") {
|
282163
282275
|
return true;
|
282164
282276
|
}
|
282165
282277
|
const service = settlemint[serviceType];
|
@@ -282776,16 +282888,6 @@ async function blockchainNetworkPrompt({
|
|
282776
282888
|
});
|
282777
282889
|
}
|
282778
282890
|
|
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
|
-
|
282789
282891
|
// src/commands/platform/blockchain-node/besu/create.ts
|
282790
282892
|
function blockchainNodeBesuCreateCommand() {
|
282791
282893
|
return getCreateCommand({
|
@@ -284062,7 +284164,7 @@ function applicationsListCommand() {
|
|
284062
284164
|
});
|
284063
284165
|
if (printToTerminal) {
|
284064
284166
|
const selectedWorkspace = await settlemint.workspace.read(workspaceUniqueName);
|
284065
|
-
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
284167
|
+
table(`Applications for workspace ${selectedWorkspace.name} (${selectedWorkspace.uniqueName}) - ${getWorkspaceUrl(selectedInstance, selectedWorkspace)}`, applicationsData);
|
284066
284168
|
} else if (output === "json") {
|
284067
284169
|
jsonOutput(applicationsData);
|
284068
284170
|
} else if (output === "yaml") {
|
@@ -285362,6 +285464,7 @@ function registerCommands() {
|
|
285362
285464
|
sdkcli.addCommand(createCommand2());
|
285363
285465
|
sdkcli.addCommand(loginCommand());
|
285364
285466
|
sdkcli.addCommand(logoutCommand());
|
285467
|
+
sdkcli.addCommand(pincodeVerificationResponseCommand());
|
285365
285468
|
return sdkcli;
|
285366
285469
|
}
|
285367
285470
|
async function sdkCliCommand(argv = process.argv) {
|
@@ -285381,4 +285484,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
285381
285484
|
// src/cli.ts
|
285382
285485
|
sdkCliCommand();
|
285383
285486
|
|
285384
|
-
//# debugId=
|
285487
|
+
//# debugId=565E7171A9162CE164756E2164756E21
|