@settlemint/sdk-cli 2.1.1-mainb520d1f5 → 2.1.1-mainc0c9792e

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 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.0",
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.4.7",
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
- _log("Loading env from encrypted .env.vault");
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-mainb520d1f5",
245281
+ version: "2.1.1-mainc0c9792e",
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-mainb520d1f5",
245330
- "@settlemint/sdk-utils": "2.1.1-mainb520d1f5",
245330
+ "@settlemint/sdk-js": "2.1.1-mainc0c9792e",
245331
+ "@settlemint/sdk-utils": "2.1.1-mainc0c9792e",
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 getPincodeVerificationResponse({
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
- if (!verificationChallenges.length) {
248713
- throw new Error("No verification challenges received");
248714
- }
248715
- const firstChallenge = verificationChallenges[0];
248716
- const challenge = firstChallenge?.challenge;
248717
- if (!challenge?.secret || !challenge?.salt) {
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
- pincodeVerificationResponse: (args) => getPincodeVerificationResponse({
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
  });`
@@ -256498,6 +256496,27 @@ function logoutCommand() {
256498
256496
  });
256499
256497
  }
256500
256498
 
256499
+ // src/prompts/pincode-verification.prompt.ts
256500
+ async function pincodeVerificationPrompt(verificationChallenges) {
256501
+ if (verificationChallenges.length === 0) {
256502
+ cancel2("No pincode is configured");
256503
+ }
256504
+ if (verificationChallenges.length === 1) {
256505
+ return verificationChallenges[0];
256506
+ }
256507
+ const verificationChallenge = await esm_default3({
256508
+ message: "Which pincode verification do you want to use?",
256509
+ choices: verificationChallenges.map((verificationChallenge2) => ({
256510
+ name: verificationChallenge2.name,
256511
+ value: verificationChallenge2
256512
+ }))
256513
+ });
256514
+ if (!verificationChallenge) {
256515
+ cancel2("No pincode verification challenge selected");
256516
+ }
256517
+ return verificationChallenge;
256518
+ }
256519
+
256501
256520
  // src/commands/pincode-verification-response.ts
256502
256521
  function pincodeVerificationResponseCommand() {
256503
256522
  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 +256548,11 @@ function pincodeVerificationResponseCommand() {
256529
256548
  return nothingSelectedError("blockchain node");
256530
256549
  }
256531
256550
  }
256551
+ const pincodeVerificationChallenges = await settlemint.wallet.pincodeVerificationChallenges({
256552
+ userWalletAddress: walletAddress,
256553
+ nodeId: selectedBlockchainNode.id
256554
+ });
256555
+ const verificationChallenge = await pincodeVerificationPrompt(pincodeVerificationChallenges);
256532
256556
  const pincode = await esm_default5({
256533
256557
  message: "Enter your pincode",
256534
256558
  validate(value4) {
@@ -256538,10 +256562,9 @@ function pincodeVerificationResponseCommand() {
256538
256562
  return true;
256539
256563
  }
256540
256564
  });
256541
- const pincodeVerificationResponse = await settlemint.wallet.pincodeVerificationResponse({
256542
- userWalletAddress: walletAddress,
256543
- pincode,
256544
- nodeId: selectedBlockchainNode.id
256565
+ const pincodeVerificationResponse = settlemint.wallet.pincodeVerificationChallengeResponse({
256566
+ verificationChallenge,
256567
+ pincode
256545
256568
  });
256546
256569
  note(`Pincode verification response: ${pincodeVerificationResponse}`);
256547
256570
  outro("Pincode verification response generated");
@@ -256595,7 +256618,7 @@ async function waitForCompletion({
256595
256618
  } else {
256596
256619
  note(`${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`);
256597
256620
  }
256598
- return true;
256621
+ return false;
256599
256622
  }
256600
256623
  if (spinner2) {
256601
256624
  spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`;
@@ -259871,4 +259894,4 @@ async function sdkCliCommand(argv = process.argv) {
259871
259894
  // src/cli.ts
259872
259895
  sdkCliCommand();
259873
259896
 
259874
- //# debugId=341E4708C1138A4264756E2164756E21
259897
+ //# debugId=C98DC8CB0861243564756E2164756E21