@getpara/core-sdk 2.0.0-alpha.43 → 2.0.0-alpha.45
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 +74 -14
- package/dist/cjs/constants.js +4 -1
- package/dist/cjs/index.js +2 -0
- package/dist/esm/ParaCore.js +74 -14
- package/dist/esm/constants.js +3 -1
- package/dist/esm/index.js +2 -1
- package/dist/types/ParaCore.d.ts +4 -2
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -111,14 +111,7 @@ if (typeof global !== "undefined") {
|
|
|
111
111
|
}
|
|
112
112
|
const { pki, jsbn } = import_node_forge.default;
|
|
113
113
|
const _ParaCore = class _ParaCore {
|
|
114
|
-
|
|
115
|
-
* Constructs a new `ParaCore` instance.
|
|
116
|
-
* @param env - `Environment` to use.
|
|
117
|
-
* @param apiKey - API key to use.
|
|
118
|
-
* @param opts - Additional constructor options; see `ConstructorOpts`.
|
|
119
|
-
* @returns - A new ParaCore instance.
|
|
120
|
-
*/
|
|
121
|
-
constructor(env, apiKey, opts) {
|
|
114
|
+
constructor(envOrApiKey, apiKeyOrOpts, opts) {
|
|
122
115
|
__privateAdd(this, _ParaCore_instances);
|
|
123
116
|
__privateAdd(this, _authInfo);
|
|
124
117
|
this.isNativePasskey = false;
|
|
@@ -165,10 +158,17 @@ const _ParaCore = class _ParaCore {
|
|
|
165
158
|
*/
|
|
166
159
|
this.clearStorage = (type = "all") => __async(this, null, function* () {
|
|
167
160
|
const isAll = type === "all";
|
|
168
|
-
(isAll || type === "local")
|
|
169
|
-
|
|
161
|
+
if (isAll || type === "local") {
|
|
162
|
+
this.platformUtils.localStorage.clear(constants.PREFIX);
|
|
163
|
+
this.platformUtils.localStorage.clear(constants.PARA_PREFIX);
|
|
164
|
+
}
|
|
165
|
+
if (isAll || type === "session") {
|
|
166
|
+
this.platformUtils.sessionStorage.clear(constants.PREFIX);
|
|
167
|
+
this.platformUtils.sessionStorage.clear(constants.PARA_PREFIX);
|
|
168
|
+
}
|
|
170
169
|
if ((isAll || type === "secure") && this.platformUtils.secureStorage) {
|
|
171
170
|
this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
171
|
+
this.platformUtils.secureStorage.clear(constants.PARA_PREFIX);
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
this.trackError = (methodName, err) => __async(this, null, function* () {
|
|
@@ -315,8 +315,24 @@ const _ParaCore = class _ParaCore {
|
|
|
315
315
|
}) {
|
|
316
316
|
return (yield this.ctx.client.getWalletBalance({ walletId, rpcUrl })).balance;
|
|
317
317
|
});
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
let env, apiKey;
|
|
319
|
+
if (arguments.length === 1) {
|
|
320
|
+
env = _ParaCore.resolveEnvironment(void 0, envOrApiKey);
|
|
321
|
+
apiKey = envOrApiKey;
|
|
322
|
+
opts = void 0;
|
|
323
|
+
} else if (arguments.length === 2) {
|
|
324
|
+
if (typeof apiKeyOrOpts === "object" && apiKeyOrOpts !== null) {
|
|
325
|
+
env = _ParaCore.resolveEnvironment(void 0, envOrApiKey);
|
|
326
|
+
apiKey = envOrApiKey;
|
|
327
|
+
opts = apiKeyOrOpts;
|
|
328
|
+
} else {
|
|
329
|
+
env = _ParaCore.resolveEnvironment(envOrApiKey, apiKeyOrOpts);
|
|
330
|
+
apiKey = apiKeyOrOpts;
|
|
331
|
+
opts = void 0;
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
env = _ParaCore.resolveEnvironment(envOrApiKey, apiKeyOrOpts);
|
|
335
|
+
apiKey = apiKeyOrOpts;
|
|
320
336
|
}
|
|
321
337
|
if (!opts) opts = {};
|
|
322
338
|
let isE2E = false;
|
|
@@ -796,9 +812,28 @@ const _ParaCore = class _ParaCore {
|
|
|
796
812
|
return url;
|
|
797
813
|
});
|
|
798
814
|
}
|
|
815
|
+
static resolveEnvironment(env, apiKey) {
|
|
816
|
+
var _a;
|
|
817
|
+
if (!apiKey) {
|
|
818
|
+
throw new Error("A Para API key is required.");
|
|
819
|
+
}
|
|
820
|
+
if (apiKey.includes("_")) {
|
|
821
|
+
const validEnvironmentPrefixes = Object.values(import_types.Environment);
|
|
822
|
+
const envPrefix = (_a = apiKey.split("_")[0]) == null ? void 0 : _a.toUpperCase();
|
|
823
|
+
const hasValidPrefix = validEnvironmentPrefixes.some((envValue) => envValue === envPrefix);
|
|
824
|
+
if (!hasValidPrefix) {
|
|
825
|
+
throw new Error(`Invalid API key environment prefix.`);
|
|
826
|
+
}
|
|
827
|
+
return envPrefix;
|
|
828
|
+
}
|
|
829
|
+
if (!env) {
|
|
830
|
+
throw new Error("Environment parameter is required.");
|
|
831
|
+
}
|
|
832
|
+
return env;
|
|
833
|
+
}
|
|
799
834
|
touchSession(regenerate = false) {
|
|
800
835
|
return __async(this, null, function* () {
|
|
801
|
-
var _a, _b, _c;
|
|
836
|
+
var _a, _b, _c, _d;
|
|
802
837
|
if (!this.isWorkerInitialized) {
|
|
803
838
|
this.initializeWorker();
|
|
804
839
|
}
|
|
@@ -807,7 +842,32 @@ const _ParaCore = class _ParaCore {
|
|
|
807
842
|
}
|
|
808
843
|
const session = yield this.ctx.client.touchSession(regenerate);
|
|
809
844
|
if (!this.partner || ((_a = this.partner) == null ? void 0 : _a.id) !== session.partnerId || !(0, import_utils2.supportedWalletTypesEq)(((_b = this.partner) == null ? void 0 : _b.supportedWalletTypes) || [], session.supportedWalletTypes) || (((_c = this.partner) == null ? void 0 : _c.cosmosPrefix) || "cosmos") !== session.cosmosPrefix) {
|
|
810
|
-
|
|
845
|
+
if (!session.partnerId) {
|
|
846
|
+
console.error(`
|
|
847
|
+
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
848
|
+
\u{1F6A8} PARA SDK CONFIGURATION ERROR \u{1F6A8}
|
|
849
|
+
|
|
850
|
+
INVALID API KEY FOR CONFIGURED ENVIRONMENT
|
|
851
|
+
|
|
852
|
+
Your API key does not match the configured environment. This usually means:
|
|
853
|
+
|
|
854
|
+
1. You're using a production API key with a development environment
|
|
855
|
+
2. You're using a development API key with a production environment
|
|
856
|
+
3. Your API key is invalid or has been regenerated
|
|
857
|
+
|
|
858
|
+
SOLUTION:
|
|
859
|
+
\u2022 Verify your API key at: https://developer.getpara.com
|
|
860
|
+
\u2022 If your API key doesn't contain an environment prefix, ensure your API key is the correct key for your target environment
|
|
861
|
+
|
|
862
|
+
Current Environment: ${this.ctx.env}
|
|
863
|
+
API Key Prefix: ${((_d = this.ctx.apiKey) == null ? void 0 : _d.split("_")[0].toUpperCase()) || "None"}
|
|
864
|
+
|
|
865
|
+
Need help? Visit: https://docs.getpara.com or contact support
|
|
866
|
+
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
867
|
+
`);
|
|
868
|
+
} else {
|
|
869
|
+
yield __privateMethod(this, _ParaCore_instances, getPartner_fn).call(this, session.partnerId);
|
|
870
|
+
}
|
|
811
871
|
}
|
|
812
872
|
return session;
|
|
813
873
|
});
|
package/dist/cjs/constants.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(constants_exports, {
|
|
|
33
33
|
LOCAL_STORAGE_USER_ID: () => LOCAL_STORAGE_USER_ID,
|
|
34
34
|
LOCAL_STORAGE_WALLETS: () => LOCAL_STORAGE_WALLETS,
|
|
35
35
|
PARA_CORE_VERSION: () => PARA_CORE_VERSION,
|
|
36
|
+
PARA_PREFIX: () => PARA_PREFIX,
|
|
36
37
|
POLLING_INTERVAL_MS: () => POLLING_INTERVAL_MS,
|
|
37
38
|
POLLING_TIMEOUT_MS: () => POLLING_TIMEOUT_MS,
|
|
38
39
|
PREFIX: () => PREFIX,
|
|
@@ -40,8 +41,9 @@ __export(constants_exports, {
|
|
|
40
41
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
41
42
|
});
|
|
42
43
|
module.exports = __toCommonJS(constants_exports);
|
|
43
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
44
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.45";
|
|
44
45
|
const PREFIX = "@CAPSULE/";
|
|
46
|
+
const PARA_PREFIX = "@PARA/";
|
|
45
47
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
46
48
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
47
49
|
const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -79,6 +81,7 @@ const ACCOUNT_LINK_CONFLICT = "Account already linked";
|
|
|
79
81
|
LOCAL_STORAGE_USER_ID,
|
|
80
82
|
LOCAL_STORAGE_WALLETS,
|
|
81
83
|
PARA_CORE_VERSION,
|
|
84
|
+
PARA_PREFIX,
|
|
82
85
|
POLLING_INTERVAL_MS,
|
|
83
86
|
POLLING_TIMEOUT_MS,
|
|
84
87
|
PREFIX,
|
package/dist/cjs/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __export(src_exports, {
|
|
|
45
45
|
OnRampProvider: () => import_user_management_client.OnRampProvider,
|
|
46
46
|
OnRampPurchaseStatus: () => import_user_management_client.OnRampPurchaseStatus,
|
|
47
47
|
OnRampPurchaseType: () => import_user_management_client.OnRampPurchaseType,
|
|
48
|
+
PARA_STORAGE_PREFIX: () => import_constants.PARA_PREFIX,
|
|
48
49
|
PREGEN_IDENTIFIER_TYPES: () => import_user_management_client.PREGEN_IDENTIFIER_TYPES,
|
|
49
50
|
PopupType: () => import_types.PopupType,
|
|
50
51
|
PregenIdentifierType: () => import_types.PregenIdentifierType,
|
|
@@ -133,6 +134,7 @@ var src_default = import_ParaCore.ParaCore;
|
|
|
133
134
|
OnRampProvider,
|
|
134
135
|
OnRampPurchaseStatus,
|
|
135
136
|
OnRampPurchaseType,
|
|
137
|
+
PARA_STORAGE_PREFIX,
|
|
136
138
|
PREGEN_IDENTIFIER_TYPES,
|
|
137
139
|
PopupType,
|
|
138
140
|
PregenIdentifierType,
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -76,14 +76,7 @@ import {
|
|
|
76
76
|
import { TransactionReviewDenied, TransactionReviewTimeout } from "./errors.js";
|
|
77
77
|
import * as constants from "./constants.js";
|
|
78
78
|
const _ParaCore = class _ParaCore {
|
|
79
|
-
|
|
80
|
-
* Constructs a new `ParaCore` instance.
|
|
81
|
-
* @param env - `Environment` to use.
|
|
82
|
-
* @param apiKey - API key to use.
|
|
83
|
-
* @param opts - Additional constructor options; see `ConstructorOpts`.
|
|
84
|
-
* @returns - A new ParaCore instance.
|
|
85
|
-
*/
|
|
86
|
-
constructor(env, apiKey, opts) {
|
|
79
|
+
constructor(envOrApiKey, apiKeyOrOpts, opts) {
|
|
87
80
|
__privateAdd(this, _ParaCore_instances);
|
|
88
81
|
__privateAdd(this, _authInfo);
|
|
89
82
|
this.isNativePasskey = false;
|
|
@@ -130,10 +123,17 @@ const _ParaCore = class _ParaCore {
|
|
|
130
123
|
*/
|
|
131
124
|
this.clearStorage = (type = "all") => __async(this, null, function* () {
|
|
132
125
|
const isAll = type === "all";
|
|
133
|
-
(isAll || type === "local")
|
|
134
|
-
|
|
126
|
+
if (isAll || type === "local") {
|
|
127
|
+
this.platformUtils.localStorage.clear(constants.PREFIX);
|
|
128
|
+
this.platformUtils.localStorage.clear(constants.PARA_PREFIX);
|
|
129
|
+
}
|
|
130
|
+
if (isAll || type === "session") {
|
|
131
|
+
this.platformUtils.sessionStorage.clear(constants.PREFIX);
|
|
132
|
+
this.platformUtils.sessionStorage.clear(constants.PARA_PREFIX);
|
|
133
|
+
}
|
|
135
134
|
if ((isAll || type === "secure") && this.platformUtils.secureStorage) {
|
|
136
135
|
this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
136
|
+
this.platformUtils.secureStorage.clear(constants.PARA_PREFIX);
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
139
|
this.trackError = (methodName, err) => __async(this, null, function* () {
|
|
@@ -280,8 +280,24 @@ const _ParaCore = class _ParaCore {
|
|
|
280
280
|
}) {
|
|
281
281
|
return (yield this.ctx.client.getWalletBalance({ walletId, rpcUrl })).balance;
|
|
282
282
|
});
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
let env, apiKey;
|
|
284
|
+
if (arguments.length === 1) {
|
|
285
|
+
env = _ParaCore.resolveEnvironment(void 0, envOrApiKey);
|
|
286
|
+
apiKey = envOrApiKey;
|
|
287
|
+
opts = void 0;
|
|
288
|
+
} else if (arguments.length === 2) {
|
|
289
|
+
if (typeof apiKeyOrOpts === "object" && apiKeyOrOpts !== null) {
|
|
290
|
+
env = _ParaCore.resolveEnvironment(void 0, envOrApiKey);
|
|
291
|
+
apiKey = envOrApiKey;
|
|
292
|
+
opts = apiKeyOrOpts;
|
|
293
|
+
} else {
|
|
294
|
+
env = _ParaCore.resolveEnvironment(envOrApiKey, apiKeyOrOpts);
|
|
295
|
+
apiKey = apiKeyOrOpts;
|
|
296
|
+
opts = void 0;
|
|
297
|
+
}
|
|
298
|
+
} else {
|
|
299
|
+
env = _ParaCore.resolveEnvironment(envOrApiKey, apiKeyOrOpts);
|
|
300
|
+
apiKey = apiKeyOrOpts;
|
|
285
301
|
}
|
|
286
302
|
if (!opts) opts = {};
|
|
287
303
|
let isE2E = false;
|
|
@@ -761,9 +777,28 @@ const _ParaCore = class _ParaCore {
|
|
|
761
777
|
return url;
|
|
762
778
|
});
|
|
763
779
|
}
|
|
780
|
+
static resolveEnvironment(env, apiKey) {
|
|
781
|
+
var _a;
|
|
782
|
+
if (!apiKey) {
|
|
783
|
+
throw new Error("A Para API key is required.");
|
|
784
|
+
}
|
|
785
|
+
if (apiKey.includes("_")) {
|
|
786
|
+
const validEnvironmentPrefixes = Object.values(Environment);
|
|
787
|
+
const envPrefix = (_a = apiKey.split("_")[0]) == null ? void 0 : _a.toUpperCase();
|
|
788
|
+
const hasValidPrefix = validEnvironmentPrefixes.some((envValue) => envValue === envPrefix);
|
|
789
|
+
if (!hasValidPrefix) {
|
|
790
|
+
throw new Error(`Invalid API key environment prefix.`);
|
|
791
|
+
}
|
|
792
|
+
return envPrefix;
|
|
793
|
+
}
|
|
794
|
+
if (!env) {
|
|
795
|
+
throw new Error("Environment parameter is required.");
|
|
796
|
+
}
|
|
797
|
+
return env;
|
|
798
|
+
}
|
|
764
799
|
touchSession(regenerate = false) {
|
|
765
800
|
return __async(this, null, function* () {
|
|
766
|
-
var _a, _b, _c;
|
|
801
|
+
var _a, _b, _c, _d;
|
|
767
802
|
if (!this.isWorkerInitialized) {
|
|
768
803
|
this.initializeWorker();
|
|
769
804
|
}
|
|
@@ -772,7 +807,32 @@ const _ParaCore = class _ParaCore {
|
|
|
772
807
|
}
|
|
773
808
|
const session = yield this.ctx.client.touchSession(regenerate);
|
|
774
809
|
if (!this.partner || ((_a = this.partner) == null ? void 0 : _a.id) !== session.partnerId || !supportedWalletTypesEq(((_b = this.partner) == null ? void 0 : _b.supportedWalletTypes) || [], session.supportedWalletTypes) || (((_c = this.partner) == null ? void 0 : _c.cosmosPrefix) || "cosmos") !== session.cosmosPrefix) {
|
|
775
|
-
|
|
810
|
+
if (!session.partnerId) {
|
|
811
|
+
console.error(`
|
|
812
|
+
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
813
|
+
\u{1F6A8} PARA SDK CONFIGURATION ERROR \u{1F6A8}
|
|
814
|
+
|
|
815
|
+
INVALID API KEY FOR CONFIGURED ENVIRONMENT
|
|
816
|
+
|
|
817
|
+
Your API key does not match the configured environment. This usually means:
|
|
818
|
+
|
|
819
|
+
1. You're using a production API key with a development environment
|
|
820
|
+
2. You're using a development API key with a production environment
|
|
821
|
+
3. Your API key is invalid or has been regenerated
|
|
822
|
+
|
|
823
|
+
SOLUTION:
|
|
824
|
+
\u2022 Verify your API key at: https://developer.getpara.com
|
|
825
|
+
\u2022 If your API key doesn't contain an environment prefix, ensure your API key is the correct key for your target environment
|
|
826
|
+
|
|
827
|
+
Current Environment: ${this.ctx.env}
|
|
828
|
+
API Key Prefix: ${((_d = this.ctx.apiKey) == null ? void 0 : _d.split("_")[0].toUpperCase()) || "None"}
|
|
829
|
+
|
|
830
|
+
Need help? Visit: https://docs.getpara.com or contact support
|
|
831
|
+
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
832
|
+
`);
|
|
833
|
+
} else {
|
|
834
|
+
yield __privateMethod(this, _ParaCore_instances, getPartner_fn).call(this, session.partnerId);
|
|
835
|
+
}
|
|
776
836
|
}
|
|
777
837
|
return session;
|
|
778
838
|
});
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./chunk-7B52C2XE.js";
|
|
2
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
2
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.45";
|
|
3
3
|
const PREFIX = "@CAPSULE/";
|
|
4
|
+
const PARA_PREFIX = "@PARA/";
|
|
4
5
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
5
6
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
6
7
|
const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -37,6 +38,7 @@ export {
|
|
|
37
38
|
LOCAL_STORAGE_USER_ID,
|
|
38
39
|
LOCAL_STORAGE_WALLETS,
|
|
39
40
|
PARA_CORE_VERSION,
|
|
41
|
+
PARA_PREFIX,
|
|
40
42
|
POLLING_INTERVAL_MS,
|
|
41
43
|
POLLING_TIMEOUT_MS,
|
|
42
44
|
PREFIX,
|
package/dist/esm/index.js
CHANGED
|
@@ -33,7 +33,7 @@ export * from "./types/coreApi.js";
|
|
|
33
33
|
export * from "./types/events.js";
|
|
34
34
|
export * from "./types/config.js";
|
|
35
35
|
import { getPortalDomain, entityToWallet, constructUrl, shortenUrl } from "./utils/index.js";
|
|
36
|
-
import { PREFIX } from "./constants.js";
|
|
36
|
+
import { PREFIX, PARA_PREFIX } from "./constants.js";
|
|
37
37
|
import { distributeNewShare } from "./shares/shareDistribution.js";
|
|
38
38
|
import { KeyContainer } from "./shares/KeyContainer.js";
|
|
39
39
|
import { getBaseUrl, initClient } from "./external/userManagementClient.js";
|
|
@@ -85,6 +85,7 @@ export {
|
|
|
85
85
|
OnRampProvider,
|
|
86
86
|
OnRampPurchaseStatus,
|
|
87
87
|
OnRampPurchaseType,
|
|
88
|
+
PARA_PREFIX as PARA_STORAGE_PREFIX,
|
|
88
89
|
PREGEN_IDENTIFIER_TYPES,
|
|
89
90
|
PopupType,
|
|
90
91
|
PregenIdentifierType,
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -187,14 +187,16 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
187
187
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
188
188
|
abstract isPasskeySupported(): Promise<boolean>;
|
|
189
189
|
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<string>;
|
|
190
|
+
static resolveEnvironment(env: Environment | undefined, apiKey: string | undefined): Environment;
|
|
190
191
|
/**
|
|
191
192
|
* Constructs a new `ParaCore` instance.
|
|
192
|
-
* @param env - `Environment` to use.
|
|
193
|
+
* @param env - `Environment` to use. Optional if the apiKey contains an environment prefix (e.g., "prod_your_api_key"). Updated API keys can be found at https://developer.getpara.com.
|
|
193
194
|
* @param apiKey - API key to use.
|
|
194
195
|
* @param opts - Additional constructor options; see `ConstructorOpts`.
|
|
195
196
|
* @returns - A new ParaCore instance.
|
|
196
197
|
*/
|
|
197
|
-
constructor(env: Environment, apiKey: string, opts?: ConstructorOpts);
|
|
198
|
+
constructor(env: Environment | undefined, apiKey: string, opts?: ConstructorOpts);
|
|
199
|
+
constructor(apiKey: string, opts?: ConstructorOpts);
|
|
198
200
|
private trackError;
|
|
199
201
|
private wrapMethodsWithErrorTracking;
|
|
200
202
|
private initializeFromStorage;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const PARA_CORE_VERSION: string;
|
|
2
2
|
export declare const PREFIX = "@CAPSULE/";
|
|
3
|
+
export declare const PARA_PREFIX = "@PARA/";
|
|
3
4
|
export declare const LOCAL_STORAGE_AUTH_INFO = "@CAPSULE/authInfo";
|
|
4
5
|
export declare const LOCAL_STORAGE_EMAIL = "@CAPSULE/e-mail";
|
|
5
6
|
export declare const LOCAL_STORAGE_PHONE = "@CAPSULE/phone";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './types/coreApi.js';
|
|
|
5
5
|
export * from './types/events.js';
|
|
6
6
|
export * from './types/config.js';
|
|
7
7
|
export { getPortalDomain, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
|
|
8
|
-
export { PREFIX as STORAGE_PREFIX } from './constants.js';
|
|
8
|
+
export { PREFIX as STORAGE_PREFIX, PARA_PREFIX as PARA_STORAGE_PREFIX } from './constants.js';
|
|
9
9
|
export { distributeNewShare } from './shares/shareDistribution.js';
|
|
10
10
|
export { KeyContainer } from './shares/KeyContainer.js';
|
|
11
11
|
export type { PlatformUtils } from './PlatformUtils.js';
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.45",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@celo/utils": "^8.0.2",
|
|
6
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
7
7
|
"@ethereumjs/util": "^9.1.0",
|
|
8
|
-
"@getpara/user-management-client": "2.0.0-alpha.
|
|
8
|
+
"@getpara/user-management-client": "2.0.0-alpha.45",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"base64url": "^3.0.1",
|
|
11
11
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist",
|
|
28
28
|
"package.json"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "0a049e7d4e48caae1347619fd8c0518793fbc53c",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|