@getpara/core-sdk 2.0.0-alpha.3 → 2.0.0-alpha.5
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 +3023 -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 +61 -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 +2984 -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 +28 -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/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,35 @@
|
|
|
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 popup_exports = {};
|
|
19
|
+
__export(popup_exports, {
|
|
20
|
+
PopupType: () => PopupType
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(popup_exports);
|
|
23
|
+
var PopupType = /* @__PURE__ */ ((PopupType2) => {
|
|
24
|
+
PopupType2["SIGN_TRANSACTION_REVIEW"] = "SIGN_TRANSACTION_REVIEW";
|
|
25
|
+
PopupType2["SIGN_MESSAGE_REVIEW"] = "SIGN_MESSAGE_REVIEW";
|
|
26
|
+
PopupType2["LOGIN_PASSKEY"] = "LOGIN_PASSKEY";
|
|
27
|
+
PopupType2["CREATE_PASSKEY"] = "CREATE_PASSKEY";
|
|
28
|
+
PopupType2["OAUTH"] = "OAUTH";
|
|
29
|
+
PopupType2["ON_RAMP_TRANSACTION"] = "ON_RAMP_TRANSACTION";
|
|
30
|
+
return PopupType2;
|
|
31
|
+
})(PopupType || {});
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
PopupType
|
|
35
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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 recovery_exports = {};
|
|
19
|
+
__export(recovery_exports, {
|
|
20
|
+
RecoveryStatus: () => RecoveryStatus
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(recovery_exports);
|
|
23
|
+
var RecoveryStatus = /* @__PURE__ */ ((RecoveryStatus2) => {
|
|
24
|
+
RecoveryStatus2["INITIATED"] = "INITIATED";
|
|
25
|
+
RecoveryStatus2["READY"] = "READY";
|
|
26
|
+
RecoveryStatus2["EXPIRED"] = "EXPIRED";
|
|
27
|
+
RecoveryStatus2["FINISHED"] = "FINISHED";
|
|
28
|
+
RecoveryStatus2["CANCELLED"] = "CANCELLED";
|
|
29
|
+
return RecoveryStatus2;
|
|
30
|
+
})(RecoveryStatus || {});
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
RecoveryStatus
|
|
34
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var theme_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(theme_exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
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 wallet_exports = {};
|
|
19
|
+
__export(wallet_exports, {
|
|
20
|
+
PregenIdentifierType: () => PregenIdentifierType
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(wallet_exports);
|
|
23
|
+
var PregenIdentifierType = /* @__PURE__ */ ((PregenIdentifierType2) => {
|
|
24
|
+
PregenIdentifierType2["EMAIL"] = "EMAIL";
|
|
25
|
+
PregenIdentifierType2["PHONE"] = "PHONE";
|
|
26
|
+
return PregenIdentifierType2;
|
|
27
|
+
})(PregenIdentifierType || {});
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
PregenIdentifierType
|
|
31
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
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 autobind_exports = {};
|
|
19
|
+
__export(autobind_exports, {
|
|
20
|
+
autoBind: () => autoBind
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(autobind_exports);
|
|
23
|
+
function autoBind(instance) {
|
|
24
|
+
let proto = instance;
|
|
25
|
+
while (proto && proto !== Object.prototype) {
|
|
26
|
+
for (const key of Object.getOwnPropertyNames(proto)) {
|
|
27
|
+
const value = instance[key];
|
|
28
|
+
if (typeof value === "function" && key !== "constructor") {
|
|
29
|
+
try {
|
|
30
|
+
instance[key] = value.bind(instance);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
proto = Object.getPrototypeOf(proto);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
autoBind
|
|
41
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
var events_exports = {};
|
|
33
|
+
__export(events_exports, {
|
|
34
|
+
dispatchEvent: () => dispatchEvent
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(events_exports);
|
|
37
|
+
function dispatchEvent(type, data, error) {
|
|
38
|
+
typeof window !== "undefined" && !!window.dispatchEvent && window.dispatchEvent(
|
|
39
|
+
new CustomEvent(type, { detail: __spreadValues({ data }, error && { error: new Error(error) }) })
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
dispatchEvent
|
|
45
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
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 formatting_exports = {};
|
|
29
|
+
__export(formatting_exports, {
|
|
30
|
+
decimalToHex: () => decimalToHex,
|
|
31
|
+
getCosmosAddress: () => getCosmosAddress,
|
|
32
|
+
hexStringToBase64: () => hexStringToBase64,
|
|
33
|
+
hexToDecimal: () => hexToDecimal,
|
|
34
|
+
hexToSignature: () => hexToSignature,
|
|
35
|
+
hexToUint8Array: () => hexToUint8Array,
|
|
36
|
+
truncateAddress: () => truncateAddress
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(formatting_exports);
|
|
39
|
+
var import_encoding = require("@cosmjs/encoding");
|
|
40
|
+
var import_sha256 = require("@noble/hashes/sha256");
|
|
41
|
+
var import_ripemd160 = require("@noble/hashes/ripemd160");
|
|
42
|
+
var import_elliptic = __toESM(require("elliptic"));
|
|
43
|
+
const secp256k1 = new import_elliptic.default.ec("secp256k1");
|
|
44
|
+
function hexStringToBase64(hexString) {
|
|
45
|
+
if (hexString.substring(0, 2) === "0x") {
|
|
46
|
+
hexString = hexString.substring(2);
|
|
47
|
+
}
|
|
48
|
+
return Buffer.from(hexString, "hex").toString("base64");
|
|
49
|
+
}
|
|
50
|
+
function hexToSignature(hexSig) {
|
|
51
|
+
return {
|
|
52
|
+
r: `0x${hexSig.slice(2, 66)}`,
|
|
53
|
+
s: `0x${hexSig.slice(66, 130)}`,
|
|
54
|
+
v: BigInt(hexSig.slice(130, 132))
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function hexToUint8Array(hex) {
|
|
58
|
+
if (hex.startsWith("0x")) {
|
|
59
|
+
hex = hex.slice(2);
|
|
60
|
+
}
|
|
61
|
+
return new Uint8Array(Buffer.from(hex, "hex"));
|
|
62
|
+
}
|
|
63
|
+
function hexToDecimal(hex) {
|
|
64
|
+
if (hex.startsWith("0x")) {
|
|
65
|
+
hex = hex.slice(2);
|
|
66
|
+
}
|
|
67
|
+
return `${parseInt(hex, 16)}`;
|
|
68
|
+
}
|
|
69
|
+
function decimalToHex(decimal) {
|
|
70
|
+
return `0x${parseInt(decimal).toString(16)}`;
|
|
71
|
+
}
|
|
72
|
+
function compressPubkey(pubkey) {
|
|
73
|
+
switch (pubkey.length) {
|
|
74
|
+
case 33:
|
|
75
|
+
return pubkey;
|
|
76
|
+
case 65:
|
|
77
|
+
return Uint8Array.from(secp256k1.keyFromPublic(pubkey).getPublic(true, "array"));
|
|
78
|
+
default:
|
|
79
|
+
throw new Error("Invalid pubkey length");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function rawSecp256k1PubkeyToRawAddress(pubkeyData) {
|
|
83
|
+
if (pubkeyData.length !== 33) {
|
|
84
|
+
throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${pubkeyData.length}`);
|
|
85
|
+
}
|
|
86
|
+
return (0, import_ripemd160.ripemd160)((0, import_sha256.sha256)(pubkeyData));
|
|
87
|
+
}
|
|
88
|
+
function getCosmosAddress(publicKey, prefix) {
|
|
89
|
+
const uncompressedPublicKey = new Uint8Array(
|
|
90
|
+
Buffer.from(publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey, "hex")
|
|
91
|
+
);
|
|
92
|
+
const compressedPublicKey = compressPubkey(uncompressedPublicKey);
|
|
93
|
+
return (0, import_encoding.toBech32)(prefix, rawSecp256k1PubkeyToRawAddress(compressedPublicKey));
|
|
94
|
+
}
|
|
95
|
+
function truncateAddress(str, addressType, {
|
|
96
|
+
prefix = addressType === "COSMOS" ? "cosmos" : void 0,
|
|
97
|
+
targetLength
|
|
98
|
+
} = {}) {
|
|
99
|
+
const minimum = addressType === "COSMOS" ? prefix.length : addressType === "EVM" ? 2 : 0;
|
|
100
|
+
const margin = targetLength !== void 0 ? (targetLength - minimum) / 2 : 4;
|
|
101
|
+
return `${str.slice(0, minimum + margin)}...${str.slice(-1 * margin)}`;
|
|
102
|
+
}
|
|
103
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
+
0 && (module.exports = {
|
|
105
|
+
decimalToHex,
|
|
106
|
+
getCosmosAddress,
|
|
107
|
+
hexStringToBase64,
|
|
108
|
+
hexToDecimal,
|
|
109
|
+
hexToSignature,
|
|
110
|
+
hexToUint8Array,
|
|
111
|
+
truncateAddress
|
|
112
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var utils_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(utils_exports);
|
|
17
|
+
__reExport(utils_exports, require("./autobind.js"), module.exports);
|
|
18
|
+
__reExport(utils_exports, require("./events.js"), module.exports);
|
|
19
|
+
__reExport(utils_exports, require("./formatting.js"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./json.js"), module.exports);
|
|
21
|
+
__reExport(utils_exports, require("./listeners.js"), module.exports);
|
|
22
|
+
__reExport(utils_exports, require("./onRamps.js"), module.exports);
|
|
23
|
+
__reExport(utils_exports, require("./phone.js"), module.exports);
|
|
24
|
+
__reExport(utils_exports, require("./polling.js"), module.exports);
|
|
25
|
+
__reExport(utils_exports, require("./types.js"), module.exports);
|
|
26
|
+
__reExport(utils_exports, require("./url.js"), module.exports);
|
|
27
|
+
__reExport(utils_exports, require("./wallet.js"), module.exports);
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
...require("./autobind.js"),
|
|
31
|
+
...require("./events.js"),
|
|
32
|
+
...require("./formatting.js"),
|
|
33
|
+
...require("./json.js"),
|
|
34
|
+
...require("./listeners.js"),
|
|
35
|
+
...require("./onRamps.js"),
|
|
36
|
+
...require("./phone.js"),
|
|
37
|
+
...require("./polling.js"),
|
|
38
|
+
...require("./types.js"),
|
|
39
|
+
...require("./url.js"),
|
|
40
|
+
...require("./wallet.js")
|
|
41
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
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 json_exports = {};
|
|
19
|
+
__export(json_exports, {
|
|
20
|
+
jsonParse: () => jsonParse
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(json_exports);
|
|
23
|
+
function jsonParse(data, validate) {
|
|
24
|
+
try {
|
|
25
|
+
const res = JSON.parse(data);
|
|
26
|
+
if (validate && !validate(res)) {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
return res;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
jsonParse
|
|
37
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
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 listeners_exports = {};
|
|
29
|
+
__export(listeners_exports, {
|
|
30
|
+
setupListeners: () => setupListeners,
|
|
31
|
+
storageListener: () => storageListener
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(listeners_exports);
|
|
34
|
+
var constants = __toESM(require("../constants.js"));
|
|
35
|
+
function storageListener(e) {
|
|
36
|
+
if (!e.url.includes(window.location.origin)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (e.key === constants.LOCAL_STORAGE_EXTERNAL_WALLETS) {
|
|
40
|
+
this.updateExternalWalletsFromStorage();
|
|
41
|
+
}
|
|
42
|
+
if (e.key === constants.SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR) {
|
|
43
|
+
this.updateLoginEncryptionKeyPairFromStorage();
|
|
44
|
+
}
|
|
45
|
+
if (e.key === constants.LOCAL_STORAGE_SESSION_COOKIE) {
|
|
46
|
+
this.updateSessionCookieFromStorage();
|
|
47
|
+
}
|
|
48
|
+
if (e.key === constants.LOCAL_STORAGE_CURRENT_WALLET_IDS) {
|
|
49
|
+
this.updateWalletIdsFromStorage();
|
|
50
|
+
}
|
|
51
|
+
if (e.key === constants.LOCAL_STORAGE_WALLETS || e.key === constants.LOCAL_STORAGE_ED25519_WALLETS) {
|
|
52
|
+
this.updateWalletsFromStorage();
|
|
53
|
+
}
|
|
54
|
+
if (e.key === constants.LOCAL_STORAGE_AUTH_INFO) {
|
|
55
|
+
this.updateAuthInfoFromStorage();
|
|
56
|
+
}
|
|
57
|
+
if (e.key === constants.LOCAL_STORAGE_USER_ID) {
|
|
58
|
+
this.updateUserIdFromStorage();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function setupListeners() {
|
|
62
|
+
if (typeof window !== "undefined" && window.addEventListener && window.location) {
|
|
63
|
+
window.removeEventListener("storage", storageListener.bind(this));
|
|
64
|
+
window.addEventListener("storage", storageListener.bind(this));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
setupListeners,
|
|
70
|
+
storageListener
|
|
71
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
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 onRamps_exports = {};
|
|
19
|
+
__export(onRamps_exports, {
|
|
20
|
+
NETWORK_PREFIXES: () => NETWORK_PREFIXES,
|
|
21
|
+
getNetworkPrefix: () => getNetworkPrefix,
|
|
22
|
+
getOnRampAssets: () => getOnRampAssets,
|
|
23
|
+
getOnRampNetworks: () => getOnRampNetworks,
|
|
24
|
+
toAssetInfoArray: () => toAssetInfoArray
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(onRamps_exports);
|
|
27
|
+
var import_user_management_client = require("@getpara/user-management-client");
|
|
28
|
+
function toAssetInfoArray(data) {
|
|
29
|
+
const result = [];
|
|
30
|
+
Object.keys(data).forEach((walletType) => {
|
|
31
|
+
const networks = data[walletType];
|
|
32
|
+
Object.keys(networks).forEach((network) => {
|
|
33
|
+
const assets = networks[network];
|
|
34
|
+
Object.keys(assets).forEach((asset) => {
|
|
35
|
+
const providerInfo = assets[asset];
|
|
36
|
+
result.push([walletType, network, asset, providerInfo]);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
function getOnRampNetworks(data, {
|
|
43
|
+
walletType,
|
|
44
|
+
allowed,
|
|
45
|
+
assets,
|
|
46
|
+
providers,
|
|
47
|
+
action
|
|
48
|
+
} = {}) {
|
|
49
|
+
return [
|
|
50
|
+
...new Set(
|
|
51
|
+
toAssetInfoArray(data).filter(
|
|
52
|
+
([type, network, asset, providerInfo]) => (!walletType || type === walletType) && (!allowed || allowed.includes(network)) && (!assets || assets.includes(asset)) && (!providers || providers.some((provider) => {
|
|
53
|
+
var _a;
|
|
54
|
+
return ((_a = providerInfo[provider]) == null ? void 0 : _a[1]) && (!action || providerInfo[provider][1][action]);
|
|
55
|
+
}))
|
|
56
|
+
).map(([_, network]) => network)
|
|
57
|
+
)
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
function getOnRampAssets(data, {
|
|
61
|
+
walletType,
|
|
62
|
+
network,
|
|
63
|
+
allowed,
|
|
64
|
+
providers,
|
|
65
|
+
action
|
|
66
|
+
} = {}) {
|
|
67
|
+
return [
|
|
68
|
+
...new Set(
|
|
69
|
+
toAssetInfoArray(data).filter(
|
|
70
|
+
([t, n, a, p]) => (!walletType || t === walletType) && (!network || n === network) && (!Array.isArray(allowed) || allowed.includes(a)) && (!providers || providers.some((provider) => {
|
|
71
|
+
var _a;
|
|
72
|
+
return ((_a = p[provider]) == null ? void 0 : _a[1]) && (!action || p[provider][1][action]);
|
|
73
|
+
}))
|
|
74
|
+
).map(([, , asset]) => asset)
|
|
75
|
+
)
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
const NETWORK_PREFIXES = {
|
|
79
|
+
[import_user_management_client.Network.COSMOS]: "cosmos",
|
|
80
|
+
[import_user_management_client.Network.NOBLE]: "noble"
|
|
81
|
+
};
|
|
82
|
+
function getNetworkPrefix(network) {
|
|
83
|
+
return NETWORK_PREFIXES[network];
|
|
84
|
+
}
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
NETWORK_PREFIXES,
|
|
88
|
+
getNetworkPrefix,
|
|
89
|
+
getOnRampAssets,
|
|
90
|
+
getOnRampNetworks,
|
|
91
|
+
toAssetInfoArray
|
|
92
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(phone_exports);
|
|
34
|
+
var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
|
|
35
|
+
function formatPhoneNumber(phone, countryCode, { forDisplay = false } = {}) {
|
|
36
|
+
phone = phone.toString();
|
|
37
|
+
countryCode = countryCode == null ? void 0 : countryCode.toString();
|
|
38
|
+
let sanitizedNumber, parsedNumber;
|
|
39
|
+
if (!!countryCode) {
|
|
40
|
+
sanitizedNumber = phone.replace(/\D/g, "");
|
|
41
|
+
if (/^\+\d+$/.test(countryCode)) {
|
|
42
|
+
countryCode = countryCode.slice(1);
|
|
43
|
+
}
|
|
44
|
+
parsedNumber = (0, import_libphonenumber_js.default)(sanitizedNumber, { defaultCallingCode: countryCode });
|
|
45
|
+
} else {
|
|
46
|
+
sanitizedNumber = `+${phone.replace(/\D/g, "")}`;
|
|
47
|
+
parsedNumber = (0, import_libphonenumber_js.default)(sanitizedNumber);
|
|
48
|
+
}
|
|
49
|
+
if (parsedNumber == null ? void 0 : parsedNumber.isValid()) {
|
|
50
|
+
return forDisplay ? parsedNumber.formatInternational() : parsedNumber.formatInternational().replace(/[^\d+]/g, "");
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function displayPhoneNumber(phone, countryCode) {
|
|
55
|
+
return formatPhoneNumber(phone, countryCode, { forDisplay: true });
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
displayPhoneNumber,
|
|
60
|
+
formatPhoneNumber
|
|
61
|
+
});
|