@getpara/core-sdk 2.0.0-alpha.5 → 2.0.0-alpha.51
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 +764 -204
- package/dist/cjs/constants.js +7 -1
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/types/auth.js +33 -0
- package/dist/cjs/types/coreApi.js +20 -3
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/utils/formatting.js +4 -0
- package/dist/cjs/utils/phone.js +14 -2
- package/dist/esm/ParaCore.js +771 -208
- package/dist/esm/constants.js +5 -1
- package/dist/esm/index.js +22 -3
- package/dist/esm/types/auth.js +11 -0
- package/dist/esm/types/coreApi.js +18 -2
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/utils/formatting.js +2 -0
- package/dist/esm/utils/phone.js +12 -1
- package/dist/types/ParaCore.d.ts +87 -49
- package/dist/types/PlatformUtils.d.ts +2 -3
- package/dist/types/constants.d.ts +16 -14
- package/dist/types/index.d.ts +3 -3
- package/dist/types/shares/KeyContainer.d.ts +0 -2
- package/dist/types/types/auth.d.ts +16 -0
- package/dist/types/types/config.d.ts +9 -1
- package/dist/types/types/coreApi.d.ts +100 -36
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/methods.d.ts +63 -7
- package/dist/types/types/wallet.d.ts +4 -1
- package/dist/types/utils/formatting.d.ts +2 -0
- package/dist/types/utils/phone.d.ts +4 -0
- package/package.json +23 -23
package/dist/cjs/constants.js
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var constants_exports = {};
|
|
19
19
|
__export(constants_exports, {
|
|
20
|
+
ACCOUNT_LINK_CONFLICT: () => ACCOUNT_LINK_CONFLICT,
|
|
20
21
|
EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID: () => EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID,
|
|
21
22
|
LOCAL_STORAGE_AUTH_INFO: () => LOCAL_STORAGE_AUTH_INFO,
|
|
22
23
|
LOCAL_STORAGE_COUNTRY_CODE: () => LOCAL_STORAGE_COUNTRY_CODE,
|
|
@@ -32,6 +33,7 @@ __export(constants_exports, {
|
|
|
32
33
|
LOCAL_STORAGE_USER_ID: () => LOCAL_STORAGE_USER_ID,
|
|
33
34
|
LOCAL_STORAGE_WALLETS: () => LOCAL_STORAGE_WALLETS,
|
|
34
35
|
PARA_CORE_VERSION: () => PARA_CORE_VERSION,
|
|
36
|
+
PARA_PREFIX: () => PARA_PREFIX,
|
|
35
37
|
POLLING_INTERVAL_MS: () => POLLING_INTERVAL_MS,
|
|
36
38
|
POLLING_TIMEOUT_MS: () => POLLING_TIMEOUT_MS,
|
|
37
39
|
PREFIX: () => PREFIX,
|
|
@@ -39,8 +41,9 @@ __export(constants_exports, {
|
|
|
39
41
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
40
42
|
});
|
|
41
43
|
module.exports = __toCommonJS(constants_exports);
|
|
42
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
44
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.51";
|
|
43
45
|
const PREFIX = "@CAPSULE/";
|
|
46
|
+
const PARA_PREFIX = "@PARA/";
|
|
44
47
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
45
48
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
46
49
|
const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -59,8 +62,10 @@ const POLLING_INTERVAL_MS = 2e3;
|
|
|
59
62
|
const SHORT_POLLING_INTERVAL_MS = 1e3;
|
|
60
63
|
const POLLING_TIMEOUT_MS = 3e5;
|
|
61
64
|
const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
|
|
65
|
+
const ACCOUNT_LINK_CONFLICT = "Account already linked";
|
|
62
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
67
|
0 && (module.exports = {
|
|
68
|
+
ACCOUNT_LINK_CONFLICT,
|
|
64
69
|
EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID,
|
|
65
70
|
LOCAL_STORAGE_AUTH_INFO,
|
|
66
71
|
LOCAL_STORAGE_COUNTRY_CODE,
|
|
@@ -76,6 +81,7 @@ const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY
|
|
|
76
81
|
LOCAL_STORAGE_USER_ID,
|
|
77
82
|
LOCAL_STORAGE_WALLETS,
|
|
78
83
|
PARA_CORE_VERSION,
|
|
84
|
+
PARA_PREFIX,
|
|
79
85
|
POLLING_INTERVAL_MS,
|
|
80
86
|
POLLING_TIMEOUT_MS,
|
|
81
87
|
PREFIX,
|
package/dist/cjs/index.js
CHANGED
|
@@ -28,24 +28,34 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var src_exports = {};
|
|
30
30
|
__export(src_exports, {
|
|
31
|
+
AccountLinkError: () => import_types.AccountLinkError,
|
|
31
32
|
AuthMethod: () => import_user_management_client.AuthMethod,
|
|
33
|
+
COSMOS_WALLETS: () => import_user_management_client.COSMOS_WALLETS,
|
|
34
|
+
EVM_WALLETS: () => import_user_management_client.EVM_WALLETS,
|
|
35
|
+
EXTERNAL_WALLET_TYPES: () => import_user_management_client.EXTERNAL_WALLET_TYPES,
|
|
32
36
|
EmailTheme: () => import_user_management_client.EmailTheme,
|
|
33
37
|
KeyContainer: () => import_KeyContainer.KeyContainer,
|
|
38
|
+
LINKED_ACCOUNT_TYPES: () => import_user_management_client.LINKED_ACCOUNT_TYPES,
|
|
34
39
|
NON_ED25519: () => import_user_management_client.NON_ED25519,
|
|
35
40
|
Network: () => import_user_management_client.Network,
|
|
36
41
|
OAUTH_METHODS: () => import_user_management_client.OAUTH_METHODS,
|
|
42
|
+
OAuthMethod: () => import_user_management_client.OAuthMethod,
|
|
37
43
|
OnRampAsset: () => import_user_management_client.OnRampAsset,
|
|
38
44
|
OnRampMethod: () => import_types.OnRampMethod,
|
|
39
45
|
OnRampProvider: () => import_user_management_client.OnRampProvider,
|
|
40
46
|
OnRampPurchaseStatus: () => import_user_management_client.OnRampPurchaseStatus,
|
|
41
47
|
OnRampPurchaseType: () => import_user_management_client.OnRampPurchaseType,
|
|
48
|
+
PARA_STORAGE_PREFIX: () => import_constants.PARA_PREFIX,
|
|
42
49
|
PREGEN_IDENTIFIER_TYPES: () => import_user_management_client.PREGEN_IDENTIFIER_TYPES,
|
|
43
50
|
PopupType: () => import_types.PopupType,
|
|
44
51
|
PregenIdentifierType: () => import_types.PregenIdentifierType,
|
|
45
52
|
RecoveryStatus: () => import_types.RecoveryStatus,
|
|
53
|
+
SOLANA_WALLETS: () => import_user_management_client.SOLANA_WALLETS,
|
|
46
54
|
STORAGE_PREFIX: () => import_constants.PREFIX,
|
|
47
55
|
WALLET_SCHEMES: () => import_user_management_client.WALLET_SCHEMES,
|
|
48
56
|
WALLET_TYPES: () => import_user_management_client.WALLET_TYPES,
|
|
57
|
+
WalletScheme: () => import_user_management_client.WalletScheme,
|
|
58
|
+
WalletType: () => import_user_management_client.WalletType,
|
|
49
59
|
constructUrl: () => import_utils.constructUrl,
|
|
50
60
|
decryptPrivateKey: () => import_utils2.decryptPrivateKey,
|
|
51
61
|
decryptPrivateKeyAndDecryptShare: () => import_utils2.decryptPrivateKeyAndDecryptShare,
|
|
@@ -107,24 +117,34 @@ const paraVersion = import_ParaCore.ParaCore.version;
|
|
|
107
117
|
var src_default = import_ParaCore.ParaCore;
|
|
108
118
|
// Annotate the CommonJS export names for ESM import in node:
|
|
109
119
|
0 && (module.exports = {
|
|
120
|
+
AccountLinkError,
|
|
110
121
|
AuthMethod,
|
|
122
|
+
COSMOS_WALLETS,
|
|
123
|
+
EVM_WALLETS,
|
|
124
|
+
EXTERNAL_WALLET_TYPES,
|
|
111
125
|
EmailTheme,
|
|
112
126
|
KeyContainer,
|
|
127
|
+
LINKED_ACCOUNT_TYPES,
|
|
113
128
|
NON_ED25519,
|
|
114
129
|
Network,
|
|
115
130
|
OAUTH_METHODS,
|
|
131
|
+
OAuthMethod,
|
|
116
132
|
OnRampAsset,
|
|
117
133
|
OnRampMethod,
|
|
118
134
|
OnRampProvider,
|
|
119
135
|
OnRampPurchaseStatus,
|
|
120
136
|
OnRampPurchaseType,
|
|
137
|
+
PARA_STORAGE_PREFIX,
|
|
121
138
|
PREGEN_IDENTIFIER_TYPES,
|
|
122
139
|
PopupType,
|
|
123
140
|
PregenIdentifierType,
|
|
124
141
|
RecoveryStatus,
|
|
142
|
+
SOLANA_WALLETS,
|
|
125
143
|
STORAGE_PREFIX,
|
|
126
144
|
WALLET_SCHEMES,
|
|
127
145
|
WALLET_TYPES,
|
|
146
|
+
WalletScheme,
|
|
147
|
+
WalletType,
|
|
128
148
|
constructUrl,
|
|
129
149
|
decryptPrivateKey,
|
|
130
150
|
decryptPrivateKeyAndDecryptShare,
|
|
@@ -0,0 +1,33 @@
|
|
|
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 auth_exports = {};
|
|
19
|
+
__export(auth_exports, {
|
|
20
|
+
AccountLinkError: () => AccountLinkError
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(auth_exports);
|
|
23
|
+
var AccountLinkError = /* @__PURE__ */ ((AccountLinkError2) => {
|
|
24
|
+
AccountLinkError2["NotAuthenticated"] = "No user is currently authenticated";
|
|
25
|
+
AccountLinkError2["Conflict"] = "Account already linked";
|
|
26
|
+
AccountLinkError2["Canceled"] = "Account linking was canceled";
|
|
27
|
+
AccountLinkError2["Unknown"] = "An unknown error occurred";
|
|
28
|
+
return AccountLinkError2;
|
|
29
|
+
})(AccountLinkError || {});
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
AccountLinkError
|
|
33
|
+
});
|
|
@@ -17,7 +17,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var coreApi_exports = {};
|
|
19
19
|
__export(coreApi_exports, {
|
|
20
|
-
PARA_CORE_METHODS: () => PARA_CORE_METHODS
|
|
20
|
+
PARA_CORE_METHODS: () => PARA_CORE_METHODS,
|
|
21
|
+
PARA_INTERNAL_METHODS: () => PARA_INTERNAL_METHODS
|
|
21
22
|
});
|
|
22
23
|
module.exports = __toCommonJS(coreApi_exports);
|
|
23
24
|
const PARA_CORE_METHODS = [
|
|
@@ -66,9 +67,25 @@ const PARA_CORE_METHODS = [
|
|
|
66
67
|
"signMessage",
|
|
67
68
|
"signTransaction",
|
|
68
69
|
"initiateOnRampTransaction",
|
|
69
|
-
"getWalletBalance"
|
|
70
|
+
"getWalletBalance",
|
|
71
|
+
"issueJwt",
|
|
72
|
+
"getLinkedAccounts",
|
|
73
|
+
"accountLinkInProgress"
|
|
74
|
+
];
|
|
75
|
+
const PARA_INTERNAL_METHODS = [
|
|
76
|
+
"linkAccount",
|
|
77
|
+
"unlinkAccount",
|
|
78
|
+
"verifyEmailOrPhoneLink",
|
|
79
|
+
"verifyOAuthLink",
|
|
80
|
+
"verifyFarcasterLink",
|
|
81
|
+
"verifyTelegramLink",
|
|
82
|
+
"verifyExternalWalletLink",
|
|
83
|
+
"accountLinkInProgress",
|
|
84
|
+
"prepareLogin",
|
|
85
|
+
"sendLoginCode"
|
|
70
86
|
];
|
|
71
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
72
88
|
0 && (module.exports = {
|
|
73
|
-
PARA_CORE_METHODS
|
|
89
|
+
PARA_CORE_METHODS,
|
|
90
|
+
PARA_INTERNAL_METHODS
|
|
74
91
|
});
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(types_exports, {
|
|
|
24
24
|
OnRampPurchaseStatus: () => import_user_management_client.OnRampPurchaseStatus
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(types_exports);
|
|
27
|
+
__reExport(types_exports, require("./auth.js"), module.exports);
|
|
27
28
|
__reExport(types_exports, require("./config.js"), module.exports);
|
|
28
29
|
__reExport(types_exports, require("./coreApi.js"), module.exports);
|
|
29
30
|
__reExport(types_exports, require("./wallet.js"), module.exports);
|
|
@@ -40,6 +41,7 @@ var import_user_management_client = require("@getpara/user-management-client");
|
|
|
40
41
|
OnRampAsset,
|
|
41
42
|
OnRampProvider,
|
|
42
43
|
OnRampPurchaseStatus,
|
|
44
|
+
...require("./auth.js"),
|
|
43
45
|
...require("./config.js"),
|
|
44
46
|
...require("./coreApi.js"),
|
|
45
47
|
...require("./wallet.js"),
|
|
@@ -27,12 +27,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var formatting_exports = {};
|
|
29
29
|
__export(formatting_exports, {
|
|
30
|
+
compressPubkey: () => compressPubkey,
|
|
30
31
|
decimalToHex: () => decimalToHex,
|
|
31
32
|
getCosmosAddress: () => getCosmosAddress,
|
|
32
33
|
hexStringToBase64: () => hexStringToBase64,
|
|
33
34
|
hexToDecimal: () => hexToDecimal,
|
|
34
35
|
hexToSignature: () => hexToSignature,
|
|
35
36
|
hexToUint8Array: () => hexToUint8Array,
|
|
37
|
+
rawSecp256k1PubkeyToRawAddress: () => rawSecp256k1PubkeyToRawAddress,
|
|
36
38
|
truncateAddress: () => truncateAddress
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(formatting_exports);
|
|
@@ -102,11 +104,13 @@ function truncateAddress(str, addressType, {
|
|
|
102
104
|
}
|
|
103
105
|
// Annotate the CommonJS export names for ESM import in node:
|
|
104
106
|
0 && (module.exports = {
|
|
107
|
+
compressPubkey,
|
|
105
108
|
decimalToHex,
|
|
106
109
|
getCosmosAddress,
|
|
107
110
|
hexStringToBase64,
|
|
108
111
|
hexToDecimal,
|
|
109
112
|
hexToSignature,
|
|
110
113
|
hexToUint8Array,
|
|
114
|
+
rawSecp256k1PubkeyToRawAddress,
|
|
111
115
|
truncateAddress
|
|
112
116
|
});
|
package/dist/cjs/utils/phone.js
CHANGED
|
@@ -28,7 +28,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var phone_exports = {};
|
|
29
29
|
__export(phone_exports, {
|
|
30
30
|
displayPhoneNumber: () => displayPhoneNumber,
|
|
31
|
-
formatPhoneNumber: () => formatPhoneNumber
|
|
31
|
+
formatPhoneNumber: () => formatPhoneNumber,
|
|
32
|
+
splitPhoneNumber: () => splitPhoneNumber
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(phone_exports);
|
|
34
35
|
var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
|
|
@@ -54,8 +55,19 @@ function formatPhoneNumber(phone, countryCode, { forDisplay = false } = {}) {
|
|
|
54
55
|
function displayPhoneNumber(phone, countryCode) {
|
|
55
56
|
return formatPhoneNumber(phone, countryCode, { forDisplay: true });
|
|
56
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
|
+
}
|
|
57
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
69
|
0 && (module.exports = {
|
|
59
70
|
displayPhoneNumber,
|
|
60
|
-
formatPhoneNumber
|
|
71
|
+
formatPhoneNumber,
|
|
72
|
+
splitPhoneNumber
|
|
61
73
|
});
|