@settlemint/sdk-cli 2.1.2 → 2.1.3-mainf98c431a

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/README.md CHANGED
@@ -249,7 +249,7 @@ settlemint scs subgraph deploy --accept-defaults <subgraph-name>
249
249
 
250
250
  ## API Reference
251
251
 
252
- See the [documentation](https://github.com/settlemint/sdk/tree/v2.1.2/sdk/cli/docs/settlemint.md) for available commands.
252
+ See the [documentation](https://github.com/settlemint/sdk/tree/v2.1.3/sdk/cli/docs/settlemint.md) for available commands.
253
253
 
254
254
  ## Contributing
255
255
 
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.2",
245281
+ version: "2.1.3-mainf98c431a",
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.2",
245331
- "@settlemint/sdk-utils": "2.1.2",
245330
+ "@settlemint/sdk-js": "2.1.3-mainf98c431a",
245331
+ "@settlemint/sdk-utils": "2.1.3-mainf98c431a",
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 getPincodeVerificationResponse({
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
- if (!verificationChallenges.length) {
248714
- throw new Error("No verification challenges received");
248715
- }
248716
- const firstChallenge = verificationChallenges[0];
248717
- const challenge = firstChallenge?.challenge;
248718
- 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) {
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
- pincodeVerificationResponse: (args) => getPincodeVerificationResponse({
248818
+ pincodeVerificationChallengeResponse: getPincodeVerificationChallengeResponse,
248819
+ pincodeVerificationChallenges: (args) => getPincodeVerificationChallenges({
248824
248820
  ...args,
248825
248821
  instance: validatedOptions.instance,
248826
248822
  accessToken: validatedOptions.accessToken
@@ -251894,7 +251890,6 @@ async function codegenMinio(env2) {
251894
251890
 
251895
251891
  export const { client } = createServerMinioClient({
251896
251892
  instance: process.env.SETTLEMINT_MINIO_ENDPOINT!,
251897
- accessToken: process.env.SETTLEMINT_ACCESS_TOKEN!,
251898
251893
  accessKey: process.env.SETTLEMINT_MINIO_ACCESS_KEY!,
251899
251894
  secretKey: process.env.SETTLEMINT_MINIO_SECRET_KEY!
251900
251895
  });`;
@@ -256500,6 +256495,27 @@ function logoutCommand() {
256500
256495
  });
256501
256496
  }
256502
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
+
256503
256519
  // src/commands/pincode-verification-response.ts
256504
256520
  function pincodeVerificationResponseCommand() {
256505
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 }) => {
@@ -256531,6 +256547,11 @@ function pincodeVerificationResponseCommand() {
256531
256547
  return nothingSelectedError("blockchain node");
256532
256548
  }
256533
256549
  }
256550
+ const pincodeVerificationChallenges = await settlemint.wallet.pincodeVerificationChallenges({
256551
+ userWalletAddress: walletAddress,
256552
+ nodeId: selectedBlockchainNode.id
256553
+ });
256554
+ const verificationChallenge = await pincodeVerificationPrompt(pincodeVerificationChallenges);
256534
256555
  const pincode = await esm_default5({
256535
256556
  message: "Enter your pincode",
256536
256557
  validate(value4) {
@@ -256540,10 +256561,9 @@ function pincodeVerificationResponseCommand() {
256540
256561
  return true;
256541
256562
  }
256542
256563
  });
256543
- const pincodeVerificationResponse = await settlemint.wallet.pincodeVerificationResponse({
256544
- userWalletAddress: walletAddress,
256545
- pincode,
256546
- nodeId: selectedBlockchainNode.id
256564
+ const pincodeVerificationResponse = settlemint.wallet.pincodeVerificationChallengeResponse({
256565
+ verificationChallenge,
256566
+ pincode
256547
256567
  });
256548
256568
  note(`Pincode verification response: ${pincodeVerificationResponse}`);
256549
256569
  outro("Pincode verification response generated");
@@ -256597,7 +256617,7 @@ async function waitForCompletion({
256597
256617
  } else {
256598
256618
  note(`${capitalizeFirstLetter2(type4)} failed to ${getActionLabel(action)}`);
256599
256619
  }
256600
- return true;
256620
+ return false;
256601
256621
  }
256602
256622
  if (spinner2) {
256603
256623
  spinner2.text = `${capitalizeFirstLetter2(type4)} is not ready yet (status: ${resource.status})`;
@@ -256732,12 +256752,14 @@ function getCreateCommand({
256732
256752
  instance
256733
256753
  });
256734
256754
  const platformConfig = await settlemint.platform.config();
256755
+ let selectedProvider = undefined;
256756
+ let selectedRegion = undefined;
256735
256757
  if (cmd2.options.some((option) => option.long === "--provider")) {
256736
- const selectedProvider = await providerPrompt(platformConfig, provider);
256758
+ selectedProvider = await providerPrompt(platformConfig, provider);
256737
256759
  if (!selectedProvider) {
256738
256760
  return nothingSelectedError("provider");
256739
256761
  }
256740
- const selectedRegion = await regionPrompt(selectedProvider, region);
256762
+ selectedRegion = await regionPrompt(selectedProvider, region);
256741
256763
  if (!selectedRegion) {
256742
256764
  return nothingSelectedError("region");
256743
256765
  }
@@ -256747,7 +256769,13 @@ function getCreateCommand({
256747
256769
  task,
256748
256770
  stopMessage: `${capitalizeFirstLetter2(type4)} created`
256749
256771
  });
256750
- const { result, waitFor, mapDefaultEnv } = await createFunction(settlemint, env2, showSpinner);
256772
+ const { result, waitFor, mapDefaultEnv } = await createFunction({
256773
+ settlemint,
256774
+ env: env2,
256775
+ showSpinner,
256776
+ provider: selectedProvider?.id ?? "",
256777
+ region: selectedRegion?.id ?? ""
256778
+ });
256751
256779
  if (wait) {
256752
256780
  await waitForCompletion({
256753
256781
  settlemint,
@@ -256816,7 +256844,7 @@ function blockchainNetworkBesuCreateCommand() {
256816
256844
  ...defaultArgs,
256817
256845
  provider,
256818
256846
  region
256819
- }, async (settlemint, env2, showSpinner) => {
256847
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
256820
256848
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
256821
256849
  if (!applicationUniqueName) {
256822
256850
  return missingApplication();
@@ -256831,8 +256859,8 @@ function blockchainNetworkBesuCreateCommand() {
256831
256859
  evmStackSize,
256832
256860
  gasLimit,
256833
256861
  gasPrice,
256834
- provider,
256835
- region,
256862
+ provider: provider2,
256863
+ region: region2,
256836
256864
  secondsPerBlock,
256837
256865
  size,
256838
256866
  type: type4
@@ -256975,7 +257003,7 @@ function workspaceCreateCommand() {
256975
257003
  addressLine1,
256976
257004
  ...defaultArgs
256977
257005
  }) => {
256978
- return baseAction(defaultArgs, async (settlemint, _env, showSpinner) => {
257006
+ return baseAction(defaultArgs, async ({ settlemint, showSpinner }) => {
256979
257007
  const result = await showSpinner(() => settlemint.workspace.create({
256980
257008
  name: name3,
256981
257009
  taxIdValue,
@@ -257026,7 +257054,7 @@ function applicationAccessTokenCreateCommand() {
257026
257054
  alias: "aat",
257027
257055
  execute: (cmd2, baseAction) => {
257028
257056
  cmd2.option("--app, --application <application>", "The application unique name to create the application access token for (defaults to application from env)").addOption(new Option("-v, --validity-period <period>", "The validity period for the token").choices(["DAYS_7", "DAYS_30", "DAYS_60", "DAYS_90", "NONE"]).default("DAYS_7")).action(async (name3, { application, validityPeriod, ...defaultArgs }) => {
257029
- return baseAction(defaultArgs, async (settlemint, env2, showSpinner) => {
257057
+ return baseAction(defaultArgs, async ({ settlemint, env: env2, showSpinner }) => {
257030
257058
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257031
257059
  if (!applicationUniqueName) {
257032
257060
  return missingApplication();
@@ -257119,7 +257147,7 @@ function applicationCreateCommand() {
257119
257147
  return baseAction({
257120
257148
  ...defaultArgs,
257121
257149
  acceptDefaults
257122
- }, async (settlemint, env2, showSpinner) => {
257150
+ }, async ({ settlemint, env: env2, showSpinner }) => {
257123
257151
  let workspaceUniqueName = workspace;
257124
257152
  if (!workspaceUniqueName) {
257125
257153
  const workspaces = await workspaceSpinner(settlemint);
@@ -257210,7 +257238,7 @@ function blockchainNodeBesuCreateCommand() {
257210
257238
  acceptDefaults,
257211
257239
  provider,
257212
257240
  region
257213
- }, async (settlemint, env2, showSpinner) => {
257241
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257214
257242
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257215
257243
  if (!applicationUniqueName) {
257216
257244
  return missingApplication();
@@ -257235,8 +257263,8 @@ function blockchainNodeBesuCreateCommand() {
257235
257263
  blockchainNetworkUniqueName: networkUniqueName,
257236
257264
  nodeType,
257237
257265
  keyMaterial: nodeIdentity,
257238
- provider,
257239
- region,
257266
+ provider: provider2,
257267
+ region: region2,
257240
257268
  size,
257241
257269
  type: type4
257242
257270
  }));
@@ -257288,7 +257316,7 @@ function blockscoutInsightsCreateCommand() {
257288
257316
  acceptDefaults,
257289
257317
  provider,
257290
257318
  region
257291
- }, async (settlemint, env2, showSpinner) => {
257319
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257292
257320
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257293
257321
  if (!applicationUniqueName) {
257294
257322
  return missingApplication();
@@ -257312,8 +257340,8 @@ function blockscoutInsightsCreateCommand() {
257312
257340
  name: name3,
257313
257341
  applicationUniqueName,
257314
257342
  insightsCategory: "BLOCKCHAIN_EXPLORER",
257315
- provider,
257316
- region,
257343
+ provider: provider2,
257344
+ region: region2,
257317
257345
  size,
257318
257346
  type: type4,
257319
257347
  blockchainNodeUniqueName,
@@ -257365,7 +257393,7 @@ function hasuraIntegrationCreateCommand() {
257365
257393
  ...defaultArgs,
257366
257394
  provider,
257367
257395
  region
257368
- }, async (settlemint, env2, showSpinner) => {
257396
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257369
257397
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257370
257398
  if (!applicationUniqueName) {
257371
257399
  return missingApplication();
@@ -257374,8 +257402,8 @@ function hasuraIntegrationCreateCommand() {
257374
257402
  name: name3,
257375
257403
  applicationUniqueName,
257376
257404
  integrationType: "HASURA",
257377
- provider,
257378
- region,
257405
+ provider: provider2,
257406
+ region: region2,
257379
257407
  size,
257380
257408
  type: type4
257381
257409
  }));
@@ -257426,7 +257454,7 @@ function graphMiddlewareCreateCommand() {
257426
257454
  acceptDefaults,
257427
257455
  provider,
257428
257456
  region
257429
- }, async (settlemint, env2, showSpinner) => {
257457
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257430
257458
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257431
257459
  if (!applicationUniqueName) {
257432
257460
  return missingApplication();
@@ -257450,8 +257478,8 @@ function graphMiddlewareCreateCommand() {
257450
257478
  applicationUniqueName,
257451
257479
  interface: "HA_GRAPH",
257452
257480
  blockchainNodeUniqueName,
257453
- provider,
257454
- region,
257481
+ provider: provider2,
257482
+ region: region2,
257455
257483
  size,
257456
257484
  type: type4
257457
257485
  }));
@@ -257509,7 +257537,7 @@ function smartContractPortalMiddlewareCreateCommand() {
257509
257537
  acceptDefaults,
257510
257538
  provider,
257511
257539
  region
257512
- }, async (settlemint, env2, showSpinner) => {
257540
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257513
257541
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257514
257542
  if (!applicationUniqueName) {
257515
257543
  return missingApplication();
@@ -257558,8 +257586,8 @@ function smartContractPortalMiddlewareCreateCommand() {
257558
257586
  loadBalancerUniqueName,
257559
257587
  abis: parsedAbis,
257560
257588
  includePredeployedAbis,
257561
- provider,
257562
- region,
257589
+ provider: provider2,
257590
+ region: region2,
257563
257591
  size,
257564
257592
  type: type4
257565
257593
  }));
@@ -257606,7 +257634,7 @@ function privateKeyAccessibleCreateCommand() {
257606
257634
  return baseAction({
257607
257635
  ...defaultArgs,
257608
257636
  acceptDefaults
257609
- }, async (settlemint, env2, showSpinner) => {
257637
+ }, async ({ settlemint, env: env2, showSpinner, provider, region }) => {
257610
257638
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257611
257639
  if (!applicationUniqueName) {
257612
257640
  return missingApplication();
@@ -257666,7 +257694,7 @@ function privateKeyHdCreateCommand() {
257666
257694
  return baseAction({
257667
257695
  ...defaultArgs,
257668
257696
  acceptDefaults
257669
- }, async (settlemint, env2, showSpinner) => {
257697
+ }, async ({ settlemint, env: env2, showSpinner, provider, region }) => {
257670
257698
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257671
257699
  if (!applicationUniqueName) {
257672
257700
  return missingApplication();
@@ -257732,7 +257760,7 @@ function privateKeyHsmCreateCommand() {
257732
257760
  return baseAction({
257733
257761
  ...defaultArgs,
257734
257762
  acceptDefaults
257735
- }, async (settlemint, env2, showSpinner) => {
257763
+ }, async ({ settlemint, env: env2, showSpinner, provider, region }) => {
257736
257764
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257737
257765
  if (!applicationUniqueName) {
257738
257766
  return missingApplication();
@@ -257798,7 +257826,7 @@ function ipfsStorageCreateCommand() {
257798
257826
  ...defaultArgs,
257799
257827
  provider,
257800
257828
  region
257801
- }, async (settlemint, env2, showSpinner) => {
257829
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257802
257830
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257803
257831
  if (!applicationUniqueName) {
257804
257832
  return missingApplication();
@@ -257807,8 +257835,8 @@ function ipfsStorageCreateCommand() {
257807
257835
  name: name3,
257808
257836
  applicationUniqueName,
257809
257837
  storageProtocol: "IPFS",
257810
- provider,
257811
- region,
257838
+ provider: provider2,
257839
+ region: region2,
257812
257840
  size,
257813
257841
  type: type4
257814
257842
  }));
@@ -257851,7 +257879,7 @@ function minioStorageCreateCommand() {
257851
257879
  ...defaultArgs,
257852
257880
  provider,
257853
257881
  region
257854
- }, async (settlemint, env2, showSpinner) => {
257882
+ }, async ({ settlemint, env: env2, showSpinner, provider: provider2, region: region2 }) => {
257855
257883
  const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
257856
257884
  if (!applicationUniqueName) {
257857
257885
  return missingApplication();
@@ -257860,8 +257888,8 @@ function minioStorageCreateCommand() {
257860
257888
  name: name3,
257861
257889
  applicationUniqueName,
257862
257890
  storageProtocol: "MINIO",
257863
- provider,
257864
- region,
257891
+ provider: provider2,
257892
+ region: region2,
257865
257893
  size,
257866
257894
  type: type4
257867
257895
  }));
@@ -259873,4 +259901,4 @@ async function sdkCliCommand(argv = process.argv) {
259873
259901
  // src/cli.ts
259874
259902
  sdkCliCommand();
259875
259903
 
259876
- //# debugId=EB1DE9134FC7A3FB64756E2164756E21
259904
+ //# debugId=2332C1477FB785B664756E2164756E21