@getpara/core-sdk 2.0.0-dev.1 → 2.0.0-dev.3

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.
Files changed (97) hide show
  1. package/dist/cjs/ParaCore.js +3378 -0
  2. package/dist/cjs/PlatformUtils.js +15 -0
  3. package/dist/cjs/StorageUtils.js +15 -0
  4. package/dist/cjs/constants.js +87 -0
  5. package/dist/cjs/cryptography/utils.js +350 -0
  6. package/dist/cjs/errors.js +51 -0
  7. package/dist/cjs/external/mpcComputationClient.js +62 -0
  8. package/dist/cjs/external/userManagementClient.js +106 -0
  9. package/dist/cjs/index.js +100 -5043
  10. package/dist/cjs/package.json +3 -0
  11. package/dist/cjs/shares/KeyContainer.js +89 -0
  12. package/dist/cjs/shares/recovery.js +127 -0
  13. package/dist/cjs/shares/shareDistribution.js +104 -0
  14. package/dist/cjs/transmission/transmissionUtils.js +93 -0
  15. package/dist/cjs/types/auth.js +33 -0
  16. package/dist/cjs/types/config.js +43 -0
  17. package/dist/cjs/types/coreApi.js +89 -0
  18. package/dist/cjs/types/events.js +41 -0
  19. package/dist/cjs/types/index.js +54 -0
  20. package/dist/cjs/types/methods.js +15 -0
  21. package/dist/cjs/types/onRamps.js +33 -0
  22. package/dist/cjs/types/popup.js +35 -0
  23. package/dist/cjs/types/recovery.js +34 -0
  24. package/dist/cjs/types/theme.js +15 -0
  25. package/dist/cjs/types/wallet.js +31 -0
  26. package/dist/cjs/utils/autobind.js +41 -0
  27. package/dist/cjs/utils/events.js +45 -0
  28. package/dist/cjs/utils/formatting.js +116 -0
  29. package/dist/cjs/utils/index.js +41 -0
  30. package/dist/cjs/utils/json.js +37 -0
  31. package/dist/cjs/utils/listeners.js +71 -0
  32. package/dist/cjs/utils/onRamps.js +92 -0
  33. package/dist/cjs/utils/phone.js +73 -0
  34. package/dist/cjs/utils/polling.js +58 -0
  35. package/dist/cjs/utils/types.js +29 -0
  36. package/dist/cjs/utils/url.js +135 -0
  37. package/dist/cjs/utils/wallet.js +159 -0
  38. package/dist/esm/ParaCore.js +3343 -0
  39. package/dist/esm/PlatformUtils.js +0 -0
  40. package/dist/esm/StorageUtils.js +0 -0
  41. package/dist/esm/chunk-7B52C2XE.js +70 -0
  42. package/dist/esm/constants.js +45 -0
  43. package/dist/esm/cryptography/utils.js +282 -0
  44. package/dist/esm/errors.js +27 -0
  45. package/dist/esm/external/mpcComputationClient.js +30 -0
  46. package/dist/esm/external/userManagementClient.js +71 -0
  47. package/dist/esm/index.js +76 -5011
  48. package/dist/esm/package.json +4 -0
  49. package/dist/esm/shares/KeyContainer.js +57 -0
  50. package/dist/esm/shares/recovery.js +74 -0
  51. package/dist/esm/shares/shareDistribution.js +64 -0
  52. package/dist/esm/transmission/transmissionUtils.js +42 -0
  53. package/dist/esm/types/auth.js +11 -0
  54. package/dist/esm/types/config.js +20 -0
  55. package/dist/esm/types/coreApi.js +66 -0
  56. package/dist/esm/types/events.js +19 -0
  57. package/dist/esm/types/index.js +23 -0
  58. package/dist/esm/types/methods.js +0 -0
  59. package/dist/esm/types/onRamps.js +11 -0
  60. package/dist/esm/types/popup.js +13 -0
  61. package/dist/esm/types/recovery.js +12 -0
  62. package/dist/esm/types/theme.js +0 -0
  63. package/dist/esm/types/wallet.js +9 -0
  64. package/dist/esm/utils/autobind.js +19 -0
  65. package/dist/esm/utils/events.js +11 -0
  66. package/dist/esm/utils/formatting.js +76 -0
  67. package/dist/esm/utils/index.js +11 -0
  68. package/dist/esm/utils/json.js +15 -0
  69. package/dist/esm/utils/listeners.js +38 -0
  70. package/dist/esm/utils/onRamps.js +66 -0
  71. package/dist/esm/utils/phone.js +39 -0
  72. package/dist/esm/utils/polling.js +18 -0
  73. package/dist/esm/utils/types.js +7 -0
  74. package/dist/esm/utils/url.js +90 -0
  75. package/dist/esm/utils/wallet.js +103 -0
  76. package/dist/types/ParaCore.d.ts +115 -449
  77. package/dist/types/PlatformUtils.d.ts +4 -5
  78. package/dist/types/constants.d.ts +16 -13
  79. package/dist/types/index.d.ts +3 -3
  80. package/dist/types/shares/KeyContainer.d.ts +0 -2
  81. package/dist/types/types/auth.d.ts +16 -0
  82. package/dist/types/types/config.d.ts +12 -5
  83. package/dist/types/types/coreApi.d.ts +152 -58
  84. package/dist/types/types/events.d.ts +4 -1
  85. package/dist/types/types/index.d.ts +1 -0
  86. package/dist/types/types/methods.d.ts +49 -57
  87. package/dist/types/types/onRamps.d.ts +3 -3
  88. package/dist/types/types/wallet.d.ts +8 -3
  89. package/dist/types/utils/formatting.d.ts +5 -2
  90. package/dist/types/utils/onRamps.d.ts +12 -5
  91. package/dist/types/utils/phone.d.ts +4 -0
  92. package/dist/types/utils/wallet.d.ts +8 -7
  93. package/package.json +27 -26
  94. package/dist/cjs/index.js.br +0 -0
  95. package/dist/cjs/index.js.gz +0 -0
  96. package/dist/esm/index.js.br +0 -0
  97. package/dist/esm/index.js.gz +0 -0
@@ -0,0 +1,73 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var phone_exports = {};
29
+ __export(phone_exports, {
30
+ displayPhoneNumber: () => displayPhoneNumber,
31
+ formatPhoneNumber: () => formatPhoneNumber,
32
+ splitPhoneNumber: () => splitPhoneNumber
33
+ });
34
+ module.exports = __toCommonJS(phone_exports);
35
+ var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
36
+ function formatPhoneNumber(phone, countryCode, { forDisplay = false } = {}) {
37
+ phone = phone.toString();
38
+ countryCode = countryCode == null ? void 0 : countryCode.toString();
39
+ let sanitizedNumber, parsedNumber;
40
+ if (!!countryCode) {
41
+ sanitizedNumber = phone.replace(/\D/g, "");
42
+ if (/^\+\d+$/.test(countryCode)) {
43
+ countryCode = countryCode.slice(1);
44
+ }
45
+ parsedNumber = (0, import_libphonenumber_js.default)(sanitizedNumber, { defaultCallingCode: countryCode });
46
+ } else {
47
+ sanitizedNumber = `+${phone.replace(/\D/g, "")}`;
48
+ parsedNumber = (0, import_libphonenumber_js.default)(sanitizedNumber);
49
+ }
50
+ if (parsedNumber == null ? void 0 : parsedNumber.isValid()) {
51
+ return forDisplay ? parsedNumber.formatInternational() : parsedNumber.formatInternational().replace(/[^\d+]/g, "");
52
+ }
53
+ return null;
54
+ }
55
+ function displayPhoneNumber(phone, countryCode) {
56
+ return formatPhoneNumber(phone, countryCode, { forDisplay: true });
57
+ }
58
+ function splitPhoneNumber(phone) {
59
+ const parsedNumber = (0, import_libphonenumber_js.default)(phone);
60
+ if (parsedNumber == null ? void 0 : parsedNumber.isValid()) {
61
+ return {
62
+ phone: parsedNumber.nationalNumber.replace(/\D/g, ""),
63
+ countryCode: `+${parsedNumber.countryCallingCode}`
64
+ };
65
+ }
66
+ throw new Error("Invalid phone number");
67
+ }
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ displayPhoneNumber,
71
+ formatPhoneNumber,
72
+ splitPhoneNumber
73
+ });
@@ -0,0 +1,58 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var __async = (__this, __arguments, generator) => {
19
+ return new Promise((resolve, reject) => {
20
+ var fulfilled = (value) => {
21
+ try {
22
+ step(generator.next(value));
23
+ } catch (e) {
24
+ reject(e);
25
+ }
26
+ };
27
+ var rejected = (value) => {
28
+ try {
29
+ step(generator.throw(value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ };
34
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
+ step((generator = generator.apply(__this, __arguments)).next());
36
+ });
37
+ };
38
+ var polling_exports = {};
39
+ __export(polling_exports, {
40
+ waitUntilTrue: () => waitUntilTrue
41
+ });
42
+ module.exports = __toCommonJS(polling_exports);
43
+ function waitUntilTrue(condition, timeoutMs, intervalMs) {
44
+ return __async(this, null, function* () {
45
+ const start = Date.now();
46
+ while (Date.now() - start < timeoutMs) {
47
+ if (yield condition()) {
48
+ return true;
49
+ }
50
+ yield new Promise((resolve) => setTimeout(resolve, intervalMs));
51
+ }
52
+ return false;
53
+ });
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ waitUntilTrue
58
+ });
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var types_exports = {};
19
+ __export(types_exports, {
20
+ isServerAuthState: () => isServerAuthState
21
+ });
22
+ module.exports = __toCommonJS(types_exports);
23
+ function isServerAuthState(obj) {
24
+ return "stage" in obj;
25
+ }
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ isServerAuthState
29
+ });
@@ -0,0 +1,135 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var __async = (__this, __arguments, generator) => {
19
+ return new Promise((resolve, reject) => {
20
+ var fulfilled = (value) => {
21
+ try {
22
+ step(generator.next(value));
23
+ } catch (e) {
24
+ reject(e);
25
+ }
26
+ };
27
+ var rejected = (value) => {
28
+ try {
29
+ step(generator.throw(value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ };
34
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
35
+ step((generator = generator.apply(__this, __arguments)).next());
36
+ });
37
+ };
38
+ var url_exports = {};
39
+ __export(url_exports, {
40
+ constructUrl: () => constructUrl,
41
+ getParaConnectBaseUrl: () => getParaConnectBaseUrl,
42
+ getParaConnectDomain: () => getParaConnectDomain,
43
+ getPortalBaseURL: () => getPortalBaseURL,
44
+ getPortalDomain: () => getPortalDomain,
45
+ shortenUrl: () => shortenUrl
46
+ });
47
+ module.exports = __toCommonJS(url_exports);
48
+ var import_transmissionUtils = require("../transmission/transmissionUtils.js");
49
+ var import_types = require("../types/index.js");
50
+ function getPortalDomain(env, isE2E) {
51
+ if (isE2E) {
52
+ return `localhost`;
53
+ }
54
+ switch (env) {
55
+ case import_types.Environment.DEV:
56
+ return "localhost";
57
+ case import_types.Environment.SANDBOX:
58
+ return "app.sandbox.usecapsule.com";
59
+ case import_types.Environment.BETA:
60
+ return "app.beta.usecapsule.com";
61
+ case import_types.Environment.PROD:
62
+ return "app.usecapsule.com";
63
+ default:
64
+ throw new Error(`env: ${env} not supported`);
65
+ }
66
+ }
67
+ function getPortalBaseURL({ env, isE2E }, useLocalIp, isForWasm) {
68
+ if (isE2E) {
69
+ if (isForWasm) {
70
+ return `https://app.sandbox.usecapsule.com`;
71
+ }
72
+ return `http://localhost:3003`;
73
+ }
74
+ const domain = getPortalDomain(env);
75
+ if (env === import_types.Environment.DEV) {
76
+ if (useLocalIp) {
77
+ return `http://127.0.0.1:3003`;
78
+ }
79
+ return `http://${domain}:3003`;
80
+ }
81
+ return `https://${domain}`;
82
+ }
83
+ function getParaConnectDomain(env) {
84
+ switch (env) {
85
+ case import_types.Environment.DEV:
86
+ return "localhost";
87
+ case import_types.Environment.SANDBOX:
88
+ return "connect.sandbox.getpara.com";
89
+ case import_types.Environment.BETA:
90
+ return "connect.beta.getpara.com";
91
+ case import_types.Environment.PROD:
92
+ return "connect.getpara.com";
93
+ default:
94
+ throw new Error(`env: ${env} not supported`);
95
+ }
96
+ }
97
+ function getParaConnectBaseUrl({ env }, useLocalIp) {
98
+ const domain = getParaConnectDomain(env);
99
+ if (env === import_types.Environment.DEV) {
100
+ if (useLocalIp) {
101
+ return `http://127.0.0.1:3008`;
102
+ }
103
+ return `http://${domain}:3008`;
104
+ }
105
+ return `https://${domain}`;
106
+ }
107
+ function constructUrl({
108
+ base,
109
+ path,
110
+ params = {}
111
+ }) {
112
+ const url = new URL(path, base);
113
+ Object.entries(params).forEach(([key, value]) => {
114
+ if (!!value && value !== "undefined" && value !== "null") url.searchParams.set(key, value.toString());
115
+ });
116
+ return url.toString();
117
+ }
118
+ function shortenUrl(ctx, url) {
119
+ return __async(this, null, function* () {
120
+ const compressedUrl = yield (0, import_transmissionUtils.upload)(url, ctx.client);
121
+ return constructUrl({
122
+ base: getPortalBaseURL(ctx),
123
+ path: `/short/${compressedUrl}`
124
+ });
125
+ });
126
+ }
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ constructUrl,
130
+ getParaConnectBaseUrl,
131
+ getParaConnectDomain,
132
+ getPortalBaseURL,
133
+ getPortalDomain,
134
+ shortenUrl
135
+ });
@@ -0,0 +1,159 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ // If the importer is in node compatibility mode or this is not an ESM
38
+ // file that has been converted to a CommonJS file using a Babel-
39
+ // compatible transform (i.e. "__esModule" has not been set), then set
40
+ // "default" to the CommonJS "module.exports" for node compatibility.
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
+ var wallet_exports = {};
46
+ __export(wallet_exports, {
47
+ WalletSchemeTypeMap: () => WalletSchemeTypeMap,
48
+ entityToWallet: () => entityToWallet,
49
+ getEquivalentTypes: () => getEquivalentTypes,
50
+ getSchemes: () => getSchemes,
51
+ getWalletTypes: () => getWalletTypes,
52
+ isPregenIdentifierMatch: () => isPregenIdentifierMatch,
53
+ isWalletSupported: () => isWalletSupported,
54
+ mergeCurrentWalletIds: () => mergeCurrentWalletIds,
55
+ migrateWallet: () => migrateWallet,
56
+ newUuid: () => newUuid,
57
+ supportedWalletTypesEq: () => supportedWalletTypesEq
58
+ });
59
+ module.exports = __toCommonJS(wallet_exports);
60
+ var uuid = __toESM(require("uuid"));
61
+ var import_phone = require("./phone.js");
62
+ const WalletSchemeTypeMap = {
63
+ DKLS: {
64
+ EVM: true,
65
+ COSMOS: true
66
+ },
67
+ CGGMP: {
68
+ EVM: true,
69
+ COSMOS: true
70
+ },
71
+ ED25519: {
72
+ SOLANA: true
73
+ }
74
+ };
75
+ function isPregenIdentifierMatch(a, b, type) {
76
+ if (!a || !b) {
77
+ return false;
78
+ }
79
+ switch (type) {
80
+ case "EMAIL":
81
+ return a.toLowerCase() === b.toLowerCase();
82
+ case "PHONE":
83
+ return (0, import_phone.formatPhoneNumber)(a) === (0, import_phone.formatPhoneNumber)(b);
84
+ case "CUSTOM_ID":
85
+ return a === b;
86
+ default:
87
+ return a.replace(/^@/g, "").toLowerCase() === b.replace(/^@/g, "").toLowerCase();
88
+ }
89
+ }
90
+ function isWalletSupported(types, wallet) {
91
+ return types.some((walletType) => {
92
+ var _a;
93
+ return !!((_a = WalletSchemeTypeMap[wallet == null ? void 0 : wallet.scheme]) == null ? void 0 : _a[walletType]);
94
+ });
95
+ }
96
+ function getSchemes(types) {
97
+ return Object.keys(WalletSchemeTypeMap).filter((scheme) => {
98
+ if (scheme === "CGGMP") {
99
+ return false;
100
+ }
101
+ return (Array.isArray(types) ? types : Object.keys(types)).some((type) => WalletSchemeTypeMap[scheme][type]);
102
+ });
103
+ }
104
+ function getWalletTypes(schemes) {
105
+ return [
106
+ ...new Set(
107
+ schemes.reduce((acc, scheme) => {
108
+ return [...acc, ...Object.keys(WalletSchemeTypeMap[scheme]).filter((type) => WalletSchemeTypeMap[scheme][type])];
109
+ }, [])
110
+ )
111
+ ];
112
+ }
113
+ function getEquivalentTypes(types) {
114
+ return getWalletTypes(getSchemes(Array.isArray(types) ? types : [types]));
115
+ }
116
+ function entityToWallet(w) {
117
+ return __spreadProps(__spreadValues({}, w), {
118
+ scheme: w.scheme,
119
+ type: w.type,
120
+ pregenIdentifierType: w.pregenIdentifierType
121
+ });
122
+ }
123
+ function migrateWallet(obj) {
124
+ if (["USER", "PREGEN"].includes(obj.type)) {
125
+ obj.isPregen = obj.type === "PREGEN";
126
+ obj.type = obj.scheme === "ED25519" ? "SOLANA" : "EVM";
127
+ }
128
+ if (!!obj.scheme && !obj.type) {
129
+ obj.type = obj.scheme === "ED25519" ? "SOLANA" : "EVM";
130
+ }
131
+ return obj;
132
+ }
133
+ function supportedWalletTypesEq(a, b) {
134
+ return a.length === b.length && a.every(({ type, optional }, index) => b[index].type === type && b[index].optional === optional);
135
+ }
136
+ function mergeCurrentWalletIds(original, additional) {
137
+ return [.../* @__PURE__ */ new Set([...Object.keys(original), ...Object.keys(additional)])].reduce((acc, key) => {
138
+ return __spreadProps(__spreadValues({}, acc), {
139
+ [key]: [.../* @__PURE__ */ new Set([...original[key] || [], ...additional[key] || []])]
140
+ });
141
+ }, {});
142
+ }
143
+ function newUuid() {
144
+ return uuid.v4();
145
+ }
146
+ // Annotate the CommonJS export names for ESM import in node:
147
+ 0 && (module.exports = {
148
+ WalletSchemeTypeMap,
149
+ entityToWallet,
150
+ getEquivalentTypes,
151
+ getSchemes,
152
+ getWalletTypes,
153
+ isPregenIdentifierMatch,
154
+ isWalletSupported,
155
+ mergeCurrentWalletIds,
156
+ migrateWallet,
157
+ newUuid,
158
+ supportedWalletTypesEq
159
+ });