@settlemint/sdk-cli 2.1.1-main30a7dc7a → 2.1.1-main579e87d8
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 +55 -33
- package/dist/cli.js.map +10 -9
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -837,7 +837,7 @@ var require_dist2 = __commonJS((exports) => {
|
|
837
837
|
// ../../node_modules/@dotenvx/dotenvx/package.json
|
838
838
|
var require_package = __commonJS((exports, module) => {
|
839
839
|
module.exports = {
|
840
|
-
version: "1.39.
|
840
|
+
version: "1.39.1",
|
841
841
|
name: "@dotenvx/dotenvx",
|
842
842
|
description: "a better dotenv–from the creator of `dotenv`",
|
843
843
|
author: "@motdotla",
|
@@ -3329,7 +3329,7 @@ var require_fsx = __commonJS((exports, module) => {
|
|
3329
3329
|
var require_package2 = __commonJS((exports, module) => {
|
3330
3330
|
module.exports = {
|
3331
3331
|
name: "dotenv",
|
3332
|
-
version: "16.
|
3332
|
+
version: "16.5.0",
|
3333
3333
|
description: "Loads environment variables from .env file",
|
3334
3334
|
main: "lib/main.js",
|
3335
3335
|
types: "lib/main.d.ts",
|
@@ -3360,6 +3360,7 @@ var require_package2 = __commonJS((exports, module) => {
|
|
3360
3360
|
type: "git",
|
3361
3361
|
url: "git://github.com/motdotla/dotenv.git"
|
3362
3362
|
},
|
3363
|
+
homepage: "https://github.com/motdotla/dotenv#readme",
|
3363
3364
|
funding: "https://dotenvx.com",
|
3364
3365
|
keywords: [
|
3365
3366
|
"dotenv",
|
@@ -3445,9 +3446,6 @@ var require_main = __commonJS((exports, module) => {
|
|
3445
3446
|
}
|
3446
3447
|
return DotenvModule.parse(decrypted);
|
3447
3448
|
}
|
3448
|
-
function _log(message) {
|
3449
|
-
console.log(`[dotenv@${version}][INFO] ${message}`);
|
3450
|
-
}
|
3451
3449
|
function _warn(message) {
|
3452
3450
|
console.log(`[dotenv@${version}][WARN] ${message}`);
|
3453
3451
|
}
|
@@ -3520,7 +3518,10 @@ var require_main = __commonJS((exports, module) => {
|
|
3520
3518
|
return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
3521
3519
|
}
|
3522
3520
|
function _configVault(options) {
|
3523
|
-
|
3521
|
+
const debug = Boolean(options && options.debug);
|
3522
|
+
if (debug) {
|
3523
|
+
_debug("Loading env from encrypted .env.vault");
|
3524
|
+
}
|
3524
3525
|
const parsed = DotenvModule._parseVault(options);
|
3525
3526
|
let processEnv = process.env;
|
3526
3527
|
if (options && options.processEnv != null) {
|
@@ -245277,7 +245278,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
245277
245278
|
var package_default = {
|
245278
245279
|
name: "@settlemint/sdk-cli",
|
245279
245280
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
245280
|
-
version: "2.1.1-
|
245281
|
+
version: "2.1.1-main579e87d8",
|
245281
245282
|
type: "module",
|
245282
245283
|
private: false,
|
245283
245284
|
license: "FSL-1.1-MIT",
|
@@ -245326,8 +245327,8 @@ var package_default = {
|
|
245326
245327
|
"@inquirer/input": "4.1.9",
|
245327
245328
|
"@inquirer/password": "4.0.12",
|
245328
245329
|
"@inquirer/select": "4.1.1",
|
245329
|
-
"@settlemint/sdk-js": "2.1.1-
|
245330
|
-
"@settlemint/sdk-utils": "2.1.1-
|
245330
|
+
"@settlemint/sdk-js": "2.1.1-main579e87d8",
|
245331
|
+
"@settlemint/sdk-utils": "2.1.1-main579e87d8",
|
245331
245332
|
"@types/node": "22.14.1",
|
245332
245333
|
"@types/semver": "7.7.0",
|
245333
245334
|
"@types/which": "3.0.4",
|
@@ -248683,24 +248684,18 @@ function generateResponse(pincode, salt, challenge) {
|
|
248683
248684
|
const hashedPincode = hashPincode(pincode, salt);
|
248684
248685
|
return createHash("sha256").update(`${hashedPincode}_${challenge}`).digest("hex");
|
248685
248686
|
}
|
248686
|
-
async function
|
248687
|
+
async function getPincodeVerificationChallenges({
|
248687
248688
|
userWalletAddress,
|
248688
|
-
pincode,
|
248689
248689
|
accessToken,
|
248690
248690
|
instance,
|
248691
248691
|
nodeId
|
248692
248692
|
}) {
|
248693
|
-
const response = await fetch(`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges`, {
|
248693
|
+
const response = await fetch(`${instance}/cm/nodes/${encodeURIComponent(nodeId)}/user-wallets/${encodeURIComponent(userWalletAddress)}/verifications/challenges?type=PINCODE`, {
|
248694
248694
|
method: "POST",
|
248695
248695
|
headers: {
|
248696
248696
|
"Content-Type": "application/json",
|
248697
248697
|
"x-auth-token": accessToken
|
248698
|
-
}
|
248699
|
-
body: JSON.stringify({
|
248700
|
-
pincode,
|
248701
|
-
verificationType: "PINCODE",
|
248702
|
-
name: "pincode"
|
248703
|
-
})
|
248698
|
+
}
|
248704
248699
|
});
|
248705
248700
|
if (!response.ok) {
|
248706
248701
|
if (response.status === 404) {
|
@@ -248709,15 +248704,16 @@ async function getPincodeVerificationResponse({
|
|
248709
248704
|
throw new Error("Failed to get verification challenge");
|
248710
248705
|
}
|
248711
248706
|
const verificationChallenges = await response.json();
|
248712
|
-
|
248713
|
-
|
248714
|
-
|
248715
|
-
|
248716
|
-
|
248717
|
-
|
248707
|
+
return verificationChallenges;
|
248708
|
+
}
|
248709
|
+
function getPincodeVerificationChallengeResponse({
|
248710
|
+
verificationChallenge,
|
248711
|
+
pincode
|
248712
|
+
}) {
|
248713
|
+
if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) {
|
248718
248714
|
throw new Error("Could not authenticate pin code, invalid challenge format");
|
248719
248715
|
}
|
248720
|
-
const { secret, salt } = challenge;
|
248716
|
+
const { secret, salt } = verificationChallenge.challenge;
|
248721
248717
|
return generateResponse(pincode, salt, secret);
|
248722
248718
|
}
|
248723
248719
|
function createSettleMintClient(options) {
|
@@ -248819,7 +248815,8 @@ function createSettleMintClient(options) {
|
|
248819
248815
|
config: getPlatformConfig(gqlClient)
|
248820
248816
|
},
|
248821
248817
|
wallet: {
|
248822
|
-
|
248818
|
+
pincodeVerificationChallengeResponse: getPincodeVerificationChallengeResponse,
|
248819
|
+
pincodeVerificationChallenges: (args) => getPincodeVerificationChallenges({
|
248823
248820
|
...args,
|
248824
248821
|
instance: validatedOptions.instance,
|
248825
248822
|
accessToken: validatedOptions.accessToken
|
@@ -250267,6 +250264,7 @@ export const { client: ${graphqlClientVariable}, graphql: ${graphqlVariable} } =
|
|
250267
250264
|
instances: JSON.parse(process.env.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS || '[]'),
|
250268
250265
|
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN!,
|
250269
250266
|
subgraphName: "${name3}",
|
250267
|
+
cache: "force-cache",
|
250270
250268
|
}, {
|
250271
250269
|
fetch: requestLogger(logger, "the-graph-${name3}", fetch) as typeof fetch,
|
250272
250270
|
});`
|
@@ -251892,7 +251890,6 @@ async function codegenMinio(env2) {
|
|
251892
251890
|
|
251893
251891
|
export const { client } = createServerMinioClient({
|
251894
251892
|
instance: process.env.SETTLEMINT_MINIO_ENDPOINT!,
|
251895
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN!,
|
251896
251893
|
accessKey: process.env.SETTLEMINT_MINIO_ACCESS_KEY!,
|
251897
251894
|
secretKey: process.env.SETTLEMINT_MINIO_SECRET_KEY!
|
251898
251895
|
});`;
|
@@ -256498,6 +256495,27 @@ function logoutCommand() {
|
|
256498
256495
|
});
|
256499
256496
|
}
|
256500
256497
|
|
256498
|
+
// src/prompts/pincode-verification.prompt.ts
|
256499
|
+
async function pincodeVerificationPrompt(verificationChallenges) {
|
256500
|
+
if (verificationChallenges.length === 0) {
|
256501
|
+
cancel2("No pincode is configured");
|
256502
|
+
}
|
256503
|
+
if (verificationChallenges.length === 1) {
|
256504
|
+
return verificationChallenges[0];
|
256505
|
+
}
|
256506
|
+
const verificationChallenge = await esm_default3({
|
256507
|
+
message: "Which pincode verification do you want to use?",
|
256508
|
+
choices: verificationChallenges.map((verificationChallenge2) => ({
|
256509
|
+
name: verificationChallenge2.name,
|
256510
|
+
value: verificationChallenge2
|
256511
|
+
}))
|
256512
|
+
});
|
256513
|
+
if (!verificationChallenge) {
|
256514
|
+
cancel2("No pincode verification challenge selected");
|
256515
|
+
}
|
256516
|
+
return verificationChallenge;
|
256517
|
+
}
|
256518
|
+
|
256501
256519
|
// src/commands/pincode-verification-response.ts
|
256502
256520
|
function pincodeVerificationResponseCommand() {
|
256503
256521
|
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 }) => {
|
@@ -256529,6 +256547,11 @@ function pincodeVerificationResponseCommand() {
|
|
256529
256547
|
return nothingSelectedError("blockchain node");
|
256530
256548
|
}
|
256531
256549
|
}
|
256550
|
+
const pincodeVerificationChallenges = await settlemint.wallet.pincodeVerificationChallenges({
|
256551
|
+
userWalletAddress: walletAddress,
|
256552
|
+
nodeId: selectedBlockchainNode.id
|
256553
|
+
});
|
256554
|
+
const verificationChallenge = await pincodeVerificationPrompt(pincodeVerificationChallenges);
|
256532
256555
|
const pincode = await esm_default5({
|
256533
256556
|
message: "Enter your pincode",
|
256534
256557
|
validate(value4) {
|
@@ -256538,10 +256561,9 @@ function pincodeVerificationResponseCommand() {
|
|
256538
256561
|
return true;
|
256539
256562
|
}
|
256540
256563
|
});
|
256541
|
-
const pincodeVerificationResponse =
|
256542
|
-
|
256543
|
-
pincode
|
256544
|
-
nodeId: selectedBlockchainNode.id
|
256564
|
+
const pincodeVerificationResponse = settlemint.wallet.pincodeVerificationChallengeResponse({
|
256565
|
+
verificationChallenge,
|
256566
|
+
pincode
|
256545
256567
|
});
|
256546
256568
|
note(`Pincode verification response: ${pincodeVerificationResponse}`);
|
256547
256569
|
outro("Pincode verification response generated");
|
@@ -256595,7 +256617,7 @@ async function waitForCompletion({
|
|
256595
256617
|
} else {
|
256596
256618
|
note(`${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`);
|
256597
256619
|
}
|
256598
|
-
return
|
256620
|
+
return false;
|
256599
256621
|
}
|
256600
256622
|
if (spinner2) {
|
256601
256623
|
spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`;
|
@@ -259871,4 +259893,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
259871
259893
|
// src/cli.ts
|
259872
259894
|
sdkCliCommand();
|
259873
259895
|
|
259874
|
-
//# debugId=
|
259896
|
+
//# debugId=F027455EA1DE3D5E64756E2164756E21
|