@getpara/user-management-client 1.9.0 → 1.11.0

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.
@@ -82,7 +82,6 @@ __export(client_exports, {
82
82
  });
83
83
  module.exports = __toCommonJS(client_exports);
84
84
  var import_axios = __toESM(require("axios"));
85
- var import_qs = __toESM(require("qs"));
86
85
  var import_utils = require("./utils.js");
87
86
  var import_consts = require("./consts.js");
88
87
  var import_error = require("./error.js");
@@ -636,38 +635,14 @@ class Client {
636
635
  return __async(this, null, function* () {
637
636
  var _f = _e, {
638
637
  userId,
639
- params: {
640
- type,
641
- walletType,
642
- address,
643
- provider,
644
- networks,
645
- assets,
646
- defaultNetwork,
647
- defaultAsset,
648
- fiat,
649
- fiatQuantity,
650
- testMode = false
651
- }
652
- } = _f, params = __objRest(_f, [
638
+ params
639
+ } = _f, walletParams = __objRest(_f, [
653
640
  "userId",
654
641
  "params"
655
642
  ]);
656
- const [key, identifier] = (0, import_utils.extractWalletRef)(params);
643
+ const [key, identifier] = (0, import_utils.extractWalletRef)(walletParams);
657
644
  const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
658
- const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, {
659
- type,
660
- provider,
661
- walletType,
662
- address,
663
- networks,
664
- assets,
665
- defaultAsset,
666
- defaultNetwork,
667
- fiat,
668
- fiatQuantity,
669
- testMode
670
- });
645
+ const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, params);
671
646
  return res.data;
672
647
  });
673
648
  }
@@ -838,10 +813,7 @@ class Client {
838
813
  // GET /users/:userId/wallets/:walletId/refresh-done
839
814
  isRefreshDone(userId, walletId, partnerId, protocolId) {
840
815
  return __async(this, null, function* () {
841
- const queryParams = {};
842
- if (partnerId) queryParams["partnerId"] = partnerId;
843
- if (protocolId) queryParams["protocolId"] = protocolId;
844
- const query = import_qs.default.stringify(queryParams);
816
+ const query = new URLSearchParams(__spreadValues(__spreadValues({}, partnerId ? { partnerId } : {}), protocolId ? { protocolId } : {})).toString();
845
817
  const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/refresh-done?${query}`);
846
818
  return res.data;
847
819
  });
@@ -888,9 +860,7 @@ class Client {
888
860
  }
889
861
  getEncryptedWalletPrivateKey(passwordId) {
890
862
  return __async(this, null, function* () {
891
- const queryParams = {};
892
- queryParams["passwordId"] = passwordId;
893
- const query = import_qs.default.stringify(queryParams);
863
+ const query = new URLSearchParams({ passwordId }).toString();
894
864
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
895
865
  return res;
896
866
  });
@@ -25,7 +25,6 @@ __export(wallet_exports, {
25
25
  WalletType: () => WalletType
26
26
  });
27
27
  module.exports = __toCommonJS(wallet_exports);
28
- var import_auth = require("./auth.js");
29
28
  var WalletScheme = /* @__PURE__ */ ((WalletScheme2) => {
30
29
  WalletScheme2["DKLS"] = "DKLS";
31
30
  WalletScheme2["CGGMP"] = "CGGMP";
@@ -62,9 +61,10 @@ const PREGEN_IDENTIFIER_TYPES = [
62
61
  "EMAIL",
63
62
  "PHONE",
64
63
  "CUSTOM_ID",
65
- import_auth.OAuthMethod.DISCORD,
66
- import_auth.OAuthMethod.TWITTER,
67
- import_auth.OAuthMethod.TELEGRAM
64
+ "GUEST_ID",
65
+ "DISCORD",
66
+ "TWITTER",
67
+ "TELEGRAM"
68
68
  ];
69
69
  const NON_ED25519 = ["DKLS" /* DKLS */, "CGGMP" /* CGGMP */];
70
70
  // Annotate the CommonJS export names for ESM import in node:
@@ -5,7 +5,6 @@ import {
5
5
  __spreadValues
6
6
  } from "./chunk-BBZEL7EG.js";
7
7
  import axios from "axios";
8
- import qs from "qs";
9
8
  import { extractWalletRef } from "./utils.js";
10
9
  import { SESSION_COOKIE_HEADER_NAME, VERSION_HEADER_NAME, PARTNER_ID_HEADER_NAME, API_KEY_HEADER_NAME } from "./consts.js";
11
10
  import { ParaApiError } from "./error.js";
@@ -559,38 +558,14 @@ class Client {
559
558
  return __async(this, null, function* () {
560
559
  var _f = _e, {
561
560
  userId,
562
- params: {
563
- type,
564
- walletType,
565
- address,
566
- provider,
567
- networks,
568
- assets,
569
- defaultNetwork,
570
- defaultAsset,
571
- fiat,
572
- fiatQuantity,
573
- testMode = false
574
- }
575
- } = _f, params = __objRest(_f, [
561
+ params
562
+ } = _f, walletParams = __objRest(_f, [
576
563
  "userId",
577
564
  "params"
578
565
  ]);
579
- const [key, identifier] = extractWalletRef(params);
566
+ const [key, identifier] = extractWalletRef(walletParams);
580
567
  const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
581
- const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, {
582
- type,
583
- provider,
584
- walletType,
585
- address,
586
- networks,
587
- assets,
588
- defaultAsset,
589
- defaultNetwork,
590
- fiat,
591
- fiatQuantity,
592
- testMode
593
- });
568
+ const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, params);
594
569
  return res.data;
595
570
  });
596
571
  }
@@ -761,10 +736,7 @@ class Client {
761
736
  // GET /users/:userId/wallets/:walletId/refresh-done
762
737
  isRefreshDone(userId, walletId, partnerId, protocolId) {
763
738
  return __async(this, null, function* () {
764
- const queryParams = {};
765
- if (partnerId) queryParams["partnerId"] = partnerId;
766
- if (protocolId) queryParams["protocolId"] = protocolId;
767
- const query = qs.stringify(queryParams);
739
+ const query = new URLSearchParams(__spreadValues(__spreadValues({}, partnerId ? { partnerId } : {}), protocolId ? { protocolId } : {})).toString();
768
740
  const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/refresh-done?${query}`);
769
741
  return res.data;
770
742
  });
@@ -811,9 +783,7 @@ class Client {
811
783
  }
812
784
  getEncryptedWalletPrivateKey(passwordId) {
813
785
  return __async(this, null, function* () {
814
- const queryParams = {};
815
- queryParams["passwordId"] = passwordId;
816
- const query = qs.stringify(queryParams);
786
+ const query = new URLSearchParams({ passwordId }).toString();
817
787
  const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
818
788
  return res;
819
789
  });
@@ -1,5 +1,4 @@
1
1
  import "../chunk-BBZEL7EG.js";
2
- import { OAuthMethod } from "./auth.js";
3
2
  var WalletScheme = /* @__PURE__ */ ((WalletScheme2) => {
4
3
  WalletScheme2["DKLS"] = "DKLS";
5
4
  WalletScheme2["CGGMP"] = "CGGMP";
@@ -36,9 +35,10 @@ const PREGEN_IDENTIFIER_TYPES = [
36
35
  "EMAIL",
37
36
  "PHONE",
38
37
  "CUSTOM_ID",
39
- OAuthMethod.DISCORD,
40
- OAuthMethod.TWITTER,
41
- OAuthMethod.TELEGRAM
38
+ "GUEST_ID",
39
+ "DISCORD",
40
+ "TWITTER",
41
+ "TELEGRAM"
42
42
  ];
43
43
  const NON_ED25519 = ["DKLS" /* DKLS */, "CGGMP" /* CGGMP */];
44
44
  export {
@@ -257,7 +257,7 @@ declare class Client {
257
257
  getPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
258
258
  acceptPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
259
259
  getOnRampConfig(): Promise<OnRampConfig>;
260
- createOnRampPurchase({ userId, params: { type, walletType, address, provider, networks, assets, defaultNetwork, defaultAsset, fiat, fiatQuantity, testMode, }, ...params }: {
260
+ createOnRampPurchase({ userId, params, ...walletParams }: {
261
261
  userId: string;
262
262
  params: OnRampPurchaseCreateParams;
263
263
  } & WalletParams): Promise<OnRampPurchase>;
@@ -1,4 +1,3 @@
1
- import { OAuthMethod } from './auth.js';
2
1
  import { PartnerEntity } from './partner.js';
3
2
  export declare enum WalletScheme {
4
3
  DKLS = "DKLS",
@@ -33,7 +32,7 @@ export type WalletParams = Partial<{
33
32
  walletId?: string;
34
33
  externalWalletAddress?: string;
35
34
  }>;
36
- export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", OAuthMethod.DISCORD, OAuthMethod.TWITTER, OAuthMethod.TELEGRAM];
35
+ export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", "GUEST_ID", "DISCORD", "TWITTER", "TELEGRAM"];
37
36
  export type TPregenIdentifierType = (typeof PREGEN_IDENTIFIER_TYPES)[number];
38
37
  export type PregenIds = Partial<Record<TPregenIdentifierType, string[]>>;
39
38
  export interface WalletEntity {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -16,8 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "axios": "^1.8.4",
19
- "libphonenumber-js": "1.11.2",
20
- "qs": "^6.12.0"
19
+ "libphonenumber-js": "1.11.2"
21
20
  },
22
21
  "devDependencies": {
23
22
  "typescript": "^5.0.4"
@@ -33,5 +32,5 @@
33
32
  "require": "./dist/cjs/index.js"
34
33
  }
35
34
  },
36
- "gitHead": "3d749844bf071e2c8de2769dd16e17c026951109"
35
+ "gitHead": "91b68e4ead22e2104307c934f2a582245b176619"
37
36
  }