@getpara/core-sdk 2.0.0-alpha.3 → 2.0.0-alpha.6
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/cjs/ParaCore.js +3028 -0
- package/dist/cjs/PlatformUtils.js +15 -0
- package/dist/cjs/StorageUtils.js +15 -0
- package/dist/cjs/constants.js +84 -0
- package/dist/cjs/cryptography/utils.js +350 -0
- package/dist/cjs/errors.js +51 -0
- package/dist/cjs/external/mpcComputationClient.js +62 -0
- package/dist/cjs/external/userManagementClient.js +106 -0
- package/dist/cjs/index.js +85 -4001
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/shares/KeyContainer.js +89 -0
- package/dist/cjs/shares/recovery.js +127 -0
- package/dist/cjs/shares/shareDistribution.js +104 -0
- package/dist/cjs/transmission/transmissionUtils.js +93 -0
- package/dist/cjs/types/config.js +43 -0
- package/dist/cjs/types/coreApi.js +74 -0
- package/dist/cjs/types/events.js +41 -0
- package/dist/cjs/types/index.js +52 -0
- package/dist/cjs/types/methods.js +15 -0
- package/dist/cjs/types/onRamps.js +33 -0
- package/dist/cjs/types/popup.js +35 -0
- package/dist/cjs/types/recovery.js +34 -0
- package/dist/cjs/types/theme.js +15 -0
- package/dist/cjs/types/wallet.js +31 -0
- package/dist/cjs/utils/autobind.js +41 -0
- package/dist/cjs/utils/events.js +45 -0
- package/dist/cjs/utils/formatting.js +112 -0
- package/dist/cjs/utils/index.js +41 -0
- package/dist/cjs/utils/json.js +37 -0
- package/dist/cjs/utils/listeners.js +71 -0
- package/dist/cjs/utils/onRamps.js +92 -0
- package/dist/cjs/utils/phone.js +73 -0
- package/dist/cjs/utils/polling.js +58 -0
- package/dist/cjs/utils/types.js +29 -0
- package/dist/cjs/utils/url.js +135 -0
- package/dist/cjs/utils/wallet.js +159 -0
- package/dist/esm/ParaCore.js +2990 -0
- package/dist/esm/PlatformUtils.js +0 -0
- package/dist/esm/StorageUtils.js +0 -0
- package/dist/esm/chunk-7B52C2XE.js +70 -0
- package/dist/esm/constants.js +43 -0
- package/dist/esm/cryptography/utils.js +282 -0
- package/dist/esm/errors.js +27 -0
- package/dist/esm/external/mpcComputationClient.js +30 -0
- package/dist/esm/external/userManagementClient.js +71 -0
- package/dist/esm/index.js +58 -3965
- package/dist/esm/package.json +4 -0
- package/dist/esm/shares/KeyContainer.js +57 -0
- package/dist/esm/shares/recovery.js +74 -0
- package/dist/esm/shares/shareDistribution.js +64 -0
- package/dist/esm/transmission/transmissionUtils.js +42 -0
- package/dist/esm/types/config.js +20 -0
- package/dist/esm/types/coreApi.js +52 -0
- package/dist/esm/types/events.js +19 -0
- package/dist/esm/types/index.js +22 -0
- package/dist/esm/types/methods.js +0 -0
- package/dist/esm/types/onRamps.js +11 -0
- package/dist/esm/types/popup.js +13 -0
- package/dist/esm/types/recovery.js +12 -0
- package/dist/esm/types/theme.js +0 -0
- package/dist/esm/types/wallet.js +9 -0
- package/dist/esm/utils/autobind.js +19 -0
- package/dist/esm/utils/events.js +11 -0
- package/dist/esm/utils/formatting.js +74 -0
- package/dist/esm/utils/index.js +11 -0
- package/dist/esm/utils/json.js +15 -0
- package/dist/esm/utils/listeners.js +38 -0
- package/dist/esm/utils/onRamps.js +66 -0
- package/dist/esm/utils/phone.js +39 -0
- package/dist/esm/utils/polling.js +18 -0
- package/dist/esm/utils/types.js +7 -0
- package/dist/esm/utils/url.js +90 -0
- package/dist/esm/utils/wallet.js +103 -0
- package/dist/types/ParaCore.d.ts +157 -126
- package/dist/types/PlatformUtils.d.ts +4 -3
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/types/config.d.ts +4 -5
- package/dist/types/types/coreApi.d.ts +47 -9
- package/dist/types/types/events.d.ts +4 -1
- package/dist/types/types/methods.d.ts +9 -4
- package/dist/types/types/onRamps.d.ts +3 -3
- package/dist/types/types/wallet.d.ts +4 -2
- package/dist/types/utils/formatting.d.ts +3 -2
- package/dist/types/utils/onRamps.d.ts +12 -5
- package/dist/types/utils/phone.d.ts +4 -0
- package/dist/types/utils/wallet.d.ts +8 -7
- package/package.json +7 -7
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
|
@@ -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
|
+
});
|