@settlemint/sdk-cli 2.1.1-prb6399af5 → 2.1.1-prb9a89216
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 +46 -25
 - package/dist/cli.js.map +6 -5
 - package/package.json +3 -3
 
    
        package/dist/cli.js
    CHANGED
    
    | 
         @@ -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.1- 
     | 
| 
      
 245281 
     | 
    
         
            +
              version: "2.1.1-prb9a89216",
         
     | 
| 
       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.1- 
     | 
| 
       245331 
     | 
    
         
            -
                "@settlemint/sdk-utils": "2.1.1- 
     | 
| 
      
 245330 
     | 
    
         
            +
                "@settlemint/sdk-js": "2.1.1-prb9a89216",
         
     | 
| 
      
 245331 
     | 
    
         
            +
                "@settlemint/sdk-utils": "2.1.1-prb9a89216",
         
     | 
| 
       245332 
245332 
     | 
    
         
             
                "@types/node": "22.14.1",
         
     | 
| 
       245333 
245333 
     | 
    
         
             
                "@types/semver": "7.7.0",
         
     | 
| 
       245334 
245334 
     | 
    
         
             
                "@types/which": "3.0.4",
         
     | 
| 
         @@ -248684,24 +248684,18 @@ function generateResponse(pincode, salt, challenge) { 
     | 
|
| 
       248684 
248684 
     | 
    
         
             
              const hashedPincode = hashPincode(pincode, salt);
         
     | 
| 
       248685 
248685 
     | 
    
         
             
              return createHash("sha256").update(`${hashedPincode}_${challenge}`).digest("hex");
         
     | 
| 
       248686 
248686 
     | 
    
         
             
            }
         
     | 
| 
       248687 
     | 
    
         
            -
            async function  
     | 
| 
      
 248687 
     | 
    
         
            +
            async function getPincodeVerificationChallenges({
         
     | 
| 
       248688 
248688 
     | 
    
         
             
              userWalletAddress,
         
     | 
| 
       248689 
     | 
    
         
            -
              pincode,
         
     | 
| 
       248690 
248689 
     | 
    
         
             
              accessToken,
         
     | 
| 
       248691 
248690 
     | 
    
         
             
              instance,
         
     | 
| 
       248692 
248691 
     | 
    
         
             
              nodeId
         
     | 
| 
       248693 
248692 
     | 
    
         
             
            }) {
         
     | 
| 
       248694 
     | 
    
         
            -
              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`, {
         
     | 
| 
       248695 
248694 
     | 
    
         
             
                method: "POST",
         
     | 
| 
       248696 
248695 
     | 
    
         
             
                headers: {
         
     | 
| 
       248697 
248696 
     | 
    
         
             
                  "Content-Type": "application/json",
         
     | 
| 
       248698 
248697 
     | 
    
         
             
                  "x-auth-token": accessToken
         
     | 
| 
       248699 
     | 
    
         
            -
                } 
     | 
| 
       248700 
     | 
    
         
            -
                body: JSON.stringify({
         
     | 
| 
       248701 
     | 
    
         
            -
                  pincode,
         
     | 
| 
       248702 
     | 
    
         
            -
                  verificationType: "PINCODE",
         
     | 
| 
       248703 
     | 
    
         
            -
                  name: "pincode"
         
     | 
| 
       248704 
     | 
    
         
            -
                })
         
     | 
| 
      
 248698 
     | 
    
         
            +
                }
         
     | 
| 
       248705 
248699 
     | 
    
         
             
              });
         
     | 
| 
       248706 
248700 
     | 
    
         
             
              if (!response.ok) {
         
     | 
| 
       248707 
248701 
     | 
    
         
             
                if (response.status === 404) {
         
     | 
| 
         @@ -248710,15 +248704,16 @@ async function getPincodeVerificationResponse({ 
     | 
|
| 
       248710 
248704 
     | 
    
         
             
                throw new Error("Failed to get verification challenge");
         
     | 
| 
       248711 
248705 
     | 
    
         
             
              }
         
     | 
| 
       248712 
248706 
     | 
    
         
             
              const verificationChallenges = await response.json();
         
     | 
| 
       248713 
     | 
    
         
            -
               
     | 
| 
       248714 
     | 
    
         
            -
             
     | 
| 
       248715 
     | 
    
         
            -
             
     | 
| 
       248716 
     | 
    
         
            -
               
     | 
| 
       248717 
     | 
    
         
            -
               
     | 
| 
       248718 
     | 
    
         
            -
             
     | 
| 
      
 248707 
     | 
    
         
            +
              return verificationChallenges;
         
     | 
| 
      
 248708 
     | 
    
         
            +
            }
         
     | 
| 
      
 248709 
     | 
    
         
            +
            function getPincodeVerificationChallengeResponse({
         
     | 
| 
      
 248710 
     | 
    
         
            +
              verificationChallenge,
         
     | 
| 
      
 248711 
     | 
    
         
            +
              pincode
         
     | 
| 
      
 248712 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 248713 
     | 
    
         
            +
              if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) {
         
     | 
| 
       248719 
248714 
     | 
    
         
             
                throw new Error("Could not authenticate pin code, invalid challenge format");
         
     | 
| 
       248720 
248715 
     | 
    
         
             
              }
         
     | 
| 
       248721 
     | 
    
         
            -
              const { secret, salt } = challenge;
         
     | 
| 
      
 248716 
     | 
    
         
            +
              const { secret, salt } = verificationChallenge.challenge;
         
     | 
| 
       248722 
248717 
     | 
    
         
             
              return generateResponse(pincode, salt, secret);
         
     | 
| 
       248723 
248718 
     | 
    
         
             
            }
         
     | 
| 
       248724 
248719 
     | 
    
         
             
            function createSettleMintClient(options) {
         
     | 
| 
         @@ -248820,7 +248815,8 @@ function createSettleMintClient(options) { 
     | 
|
| 
       248820 
248815 
     | 
    
         
             
                  config: getPlatformConfig(gqlClient)
         
     | 
| 
       248821 
248816 
     | 
    
         
             
                },
         
     | 
| 
       248822 
248817 
     | 
    
         
             
                wallet: {
         
     | 
| 
       248823 
     | 
    
         
            -
                   
     | 
| 
      
 248818 
     | 
    
         
            +
                  pincodeVerificationChallengeResponse: getPincodeVerificationChallengeResponse,
         
     | 
| 
      
 248819 
     | 
    
         
            +
                  pincodeVerificationChallenges: (args) => getPincodeVerificationChallenges({
         
     | 
| 
       248824 
248820 
     | 
    
         
             
                    ...args,
         
     | 
| 
       248825 
248821 
     | 
    
         
             
                    instance: validatedOptions.instance,
         
     | 
| 
       248826 
248822 
     | 
    
         
             
                    accessToken: validatedOptions.accessToken
         
     | 
| 
         @@ -256500,6 +256496,27 @@ function logoutCommand() { 
     | 
|
| 
       256500 
256496 
     | 
    
         
             
              });
         
     | 
| 
       256501 
256497 
     | 
    
         
             
            }
         
     | 
| 
       256502 
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 
     | 
    
         
            +
             
     | 
| 
       256503 
256520 
     | 
    
         
             
            // src/commands/pincode-verification-response.ts
         
     | 
| 
       256504 
256521 
     | 
    
         
             
            function pincodeVerificationResponseCommand() {
         
     | 
| 
       256505 
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 }) => {
         
     | 
| 
         @@ -256531,6 +256548,11 @@ function pincodeVerificationResponseCommand() { 
     | 
|
| 
       256531 
256548 
     | 
    
         
             
                    return nothingSelectedError("blockchain node");
         
     | 
| 
       256532 
256549 
     | 
    
         
             
                  }
         
     | 
| 
       256533 
256550 
     | 
    
         
             
                }
         
     | 
| 
      
 256551 
     | 
    
         
            +
                const pincodeVerificationChallenges = await settlemint.wallet.pincodeVerificationChallenges({
         
     | 
| 
      
 256552 
     | 
    
         
            +
                  userWalletAddress: walletAddress,
         
     | 
| 
      
 256553 
     | 
    
         
            +
                  nodeId: selectedBlockchainNode.id
         
     | 
| 
      
 256554 
     | 
    
         
            +
                });
         
     | 
| 
      
 256555 
     | 
    
         
            +
                const verificationChallenge = await pincodeVerificationPrompt(pincodeVerificationChallenges);
         
     | 
| 
       256534 
256556 
     | 
    
         
             
                const pincode = await esm_default5({
         
     | 
| 
       256535 
256557 
     | 
    
         
             
                  message: "Enter your pincode",
         
     | 
| 
       256536 
256558 
     | 
    
         
             
                  validate(value4) {
         
     | 
| 
         @@ -256540,10 +256562,9 @@ function pincodeVerificationResponseCommand() { 
     | 
|
| 
       256540 
256562 
     | 
    
         
             
                    return true;
         
     | 
| 
       256541 
256563 
     | 
    
         
             
                  }
         
     | 
| 
       256542 
256564 
     | 
    
         
             
                });
         
     | 
| 
       256543 
     | 
    
         
            -
                const pincodeVerificationResponse =  
     | 
| 
       256544 
     | 
    
         
            -
                   
     | 
| 
       256545 
     | 
    
         
            -
                  pincode 
     | 
| 
       256546 
     | 
    
         
            -
                  nodeId: selectedBlockchainNode.id
         
     | 
| 
      
 256565 
     | 
    
         
            +
                const pincodeVerificationResponse = settlemint.wallet.pincodeVerificationChallengeResponse({
         
     | 
| 
      
 256566 
     | 
    
         
            +
                  verificationChallenge,
         
     | 
| 
      
 256567 
     | 
    
         
            +
                  pincode
         
     | 
| 
       256547 
256568 
     | 
    
         
             
                });
         
     | 
| 
       256548 
256569 
     | 
    
         
             
                note(`Pincode verification response: ${pincodeVerificationResponse}`);
         
     | 
| 
       256549 
256570 
     | 
    
         
             
                outro("Pincode verification response generated");
         
     | 
| 
         @@ -259873,4 +259894,4 @@ async function sdkCliCommand(argv = process.argv) { 
     | 
|
| 
       259873 
259894 
     | 
    
         
             
            // src/cli.ts
         
     | 
| 
       259874 
259895 
     | 
    
         
             
            sdkCliCommand();
         
     | 
| 
       259875 
259896 
     | 
    
         | 
| 
       259876 
     | 
    
         
            -
            //# debugId= 
     | 
| 
      
 259897 
     | 
    
         
            +
            //# debugId=489D3A54324BCB2364756E2164756E21
         
     |