@getpara/core-sdk 1.11.0 → 1.13.0
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 +52 -24
- package/dist/cjs/constants.js +4 -1
- package/dist/cjs/utils/wallet.js +2 -18
- package/dist/esm/ParaCore.js +52 -25
- package/dist/esm/constants.js +3 -1
- package/dist/esm/utils/wallet.js +1 -6
- package/dist/types/ParaCore.d.ts +9 -5
- package/dist/types/PlatformUtils.d.ts +2 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/config.d.ts +1 -0
- package/dist/types/types/params.d.ts +0 -3
- package/dist/types/utils/wallet.d.ts +0 -1
- package/package.json +5 -5
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -162,6 +162,37 @@ const _ParaCore = class _ParaCore {
|
|
|
162
162
|
this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
|
+
this.trackError = (methodName, err) => __async(this, null, function* () {
|
|
166
|
+
try {
|
|
167
|
+
yield this.ctx.client.trackError({
|
|
168
|
+
methodName,
|
|
169
|
+
sdkType: this.platformUtils.sdkType,
|
|
170
|
+
userId: this.userId,
|
|
171
|
+
error: {
|
|
172
|
+
name: err.name,
|
|
173
|
+
message: err.message
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
} catch (e) {
|
|
177
|
+
console.error("error tracking error:", e);
|
|
178
|
+
}
|
|
179
|
+
throw err;
|
|
180
|
+
});
|
|
181
|
+
this.wrapMethodsWithErrorTracking = (methodNames) => {
|
|
182
|
+
for (const methodName of methodNames) {
|
|
183
|
+
const original = this[methodName];
|
|
184
|
+
if (typeof original === "function") {
|
|
185
|
+
this[methodName] = (...args) => {
|
|
186
|
+
try {
|
|
187
|
+
const result = original.apply(this, args);
|
|
188
|
+
return result instanceof Promise ? result.catch((err) => this.trackError(methodName, err)) : result;
|
|
189
|
+
} catch (err) {
|
|
190
|
+
return this.trackError(methodName, err);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
165
196
|
this.initializeFromStorage = () => {
|
|
166
197
|
this.updateEmailFromStorage();
|
|
167
198
|
this.updateCountryCodeFromStorage();
|
|
@@ -267,6 +298,7 @@ const _ParaCore = class _ParaCore {
|
|
|
267
298
|
isE2E = true;
|
|
268
299
|
env = import_types.Environment.SANDBOX;
|
|
269
300
|
}
|
|
301
|
+
this.externalWalletConnectionOnly = opts.externalWalletConnectionOnly;
|
|
270
302
|
this.emailPrimaryColor = opts.emailPrimaryColor;
|
|
271
303
|
this.emailTheme = opts.emailTheme;
|
|
272
304
|
this.homepageUrl = opts.homepageUrl;
|
|
@@ -354,6 +386,19 @@ const _ParaCore = class _ParaCore {
|
|
|
354
386
|
}
|
|
355
387
|
this.initializeFromStorage();
|
|
356
388
|
import_listeners.setupListeners.bind(this)();
|
|
389
|
+
if (env !== import_types.Environment.PROD) {
|
|
390
|
+
this.wrapMethodsWithErrorTracking([
|
|
391
|
+
"createUser",
|
|
392
|
+
"initiateUserLoginV2",
|
|
393
|
+
"waitForPasskeyAndCreateWallet",
|
|
394
|
+
"waitForOAuth",
|
|
395
|
+
"waitForLoginAndSetup",
|
|
396
|
+
"createPregenWallet",
|
|
397
|
+
"claimPregenWallets",
|
|
398
|
+
"signMessage",
|
|
399
|
+
"signTransaction"
|
|
400
|
+
]);
|
|
401
|
+
}
|
|
357
402
|
}
|
|
358
403
|
get isEmail() {
|
|
359
404
|
return !!this.email && !this.phone && !this.countryCode && !this.farcasterUsername && !this.telegramUserId && !this.externalWalletWithParaAuth;
|
|
@@ -1266,6 +1311,13 @@ const _ParaCore = class _ParaCore {
|
|
|
1266
1311
|
*/
|
|
1267
1312
|
externalWalletLogin(wallet) {
|
|
1268
1313
|
return __async(this, null, function* () {
|
|
1314
|
+
if (this.externalWalletConnectionOnly) {
|
|
1315
|
+
wallet.withFullParaAuth = false;
|
|
1316
|
+
yield this.setExternalWallet(wallet);
|
|
1317
|
+
return Promise.resolve({
|
|
1318
|
+
userId: constants.EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1269
1321
|
this.requireApiKey();
|
|
1270
1322
|
const res = yield this.ctx.client.externalWalletLogin({
|
|
1271
1323
|
externalAddress: wallet.address,
|
|
@@ -1532,16 +1584,10 @@ const _ParaCore = class _ParaCore {
|
|
|
1532
1584
|
if (this.isUsingExternalWallet()) {
|
|
1533
1585
|
return true;
|
|
1534
1586
|
}
|
|
1535
|
-
if (this.isGuestMode) {
|
|
1536
|
-
return true;
|
|
1537
|
-
}
|
|
1538
1587
|
const isSessionActive = yield this.isSessionActive();
|
|
1539
1588
|
return isSessionActive && (this.isNoWalletConfig || this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.reduce((acc, [id]) => acc && !!this.wallets[id], true));
|
|
1540
1589
|
});
|
|
1541
1590
|
}
|
|
1542
|
-
get isGuestMode() {
|
|
1543
|
-
return !this.userId && this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.every(([id]) => !!this.wallets[id] && this.wallets[id].pregenIdentifierType === "GUEST_ID");
|
|
1544
|
-
}
|
|
1545
1591
|
supportedAuthMethods(auth) {
|
|
1546
1592
|
return __async(this, null, function* () {
|
|
1547
1593
|
const { supportedAuthMethods } = yield this.ctx.client.getSupportedAuthMethods(auth);
|
|
@@ -2416,24 +2462,6 @@ const _ParaCore = class _ParaCore {
|
|
|
2416
2462
|
return res.wallets.filter((w) => this.isWalletSupported((0, import_utils2.entityToWallet)(w)));
|
|
2417
2463
|
});
|
|
2418
2464
|
}
|
|
2419
|
-
createGuestWallets() {
|
|
2420
|
-
return __async(this, arguments, function* ({ types } = {}) {
|
|
2421
|
-
const wallets = [];
|
|
2422
|
-
const currentWalletIds = {};
|
|
2423
|
-
const guestId = (0, import_utils2.newUuid)();
|
|
2424
|
-
for (const type of yield this.getTypesToCreate(
|
|
2425
|
-
types != null ? types : this.supportedWalletTypes.filter(({ optional }) => !optional).map(({ type: type2 }) => type2)
|
|
2426
|
-
)) {
|
|
2427
|
-
const wallet = yield __privateMethod(this, _ParaCore_instances, createPregenWallet_fn).call(this, { type, pregenIdentifier: guestId, pregenIdentifierType: "GUEST_ID" });
|
|
2428
|
-
wallets.push(wallet);
|
|
2429
|
-
(0, import_utils2.getEquivalentTypes)(type).filter((t) => __privateGet(this, _supportedWalletTypes).some(({ type: type2, optional }) => t === type2 && !optional)).forEach((eqType) => {
|
|
2430
|
-
currentWalletIds[eqType] = [wallet.id];
|
|
2431
|
-
});
|
|
2432
|
-
}
|
|
2433
|
-
yield this.setCurrentWalletIds(currentWalletIds);
|
|
2434
|
-
return wallets;
|
|
2435
|
-
});
|
|
2436
|
-
}
|
|
2437
2465
|
encodeWalletBase64(wallet) {
|
|
2438
2466
|
const walletJson = JSON.stringify(wallet);
|
|
2439
2467
|
const base64Wallet = Buffer.from(walletJson).toString("base64");
|
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
|
+
EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID: () => EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID,
|
|
20
21
|
LOCAL_STORAGE_COUNTRY_CODE: () => LOCAL_STORAGE_COUNTRY_CODE,
|
|
21
22
|
LOCAL_STORAGE_CURRENT_WALLET_IDS: () => LOCAL_STORAGE_CURRENT_WALLET_IDS,
|
|
22
23
|
LOCAL_STORAGE_ED25519_WALLETS: () => LOCAL_STORAGE_ED25519_WALLETS,
|
|
@@ -36,7 +37,7 @@ __export(constants_exports, {
|
|
|
36
37
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(constants_exports);
|
|
39
|
-
const PARA_CORE_VERSION =
|
|
40
|
+
const PARA_CORE_VERSION = "1.13.0";
|
|
40
41
|
const PREFIX = "@CAPSULE/";
|
|
41
42
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
42
43
|
const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -53,8 +54,10 @@ const LOCAL_STORAGE_SESSION_COOKIE = `${PREFIX}sessionCookie`;
|
|
|
53
54
|
const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = `${PREFIX}loginEncryptionKeyPair`;
|
|
54
55
|
const POLLING_INTERVAL_MS = 2e3;
|
|
55
56
|
const SHORT_POLLING_INTERVAL_MS = 1e3;
|
|
57
|
+
const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
|
|
56
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
57
59
|
0 && (module.exports = {
|
|
60
|
+
EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID,
|
|
58
61
|
LOCAL_STORAGE_COUNTRY_CODE,
|
|
59
62
|
LOCAL_STORAGE_CURRENT_WALLET_IDS,
|
|
60
63
|
LOCAL_STORAGE_ED25519_WALLETS,
|
package/dist/cjs/utils/wallet.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
6
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
8
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -33,14 +31,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
31
|
}
|
|
34
32
|
return to;
|
|
35
33
|
};
|
|
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
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
35
|
var wallet_exports = {};
|
|
46
36
|
__export(wallet_exports, {
|
|
@@ -51,11 +41,9 @@ __export(wallet_exports, {
|
|
|
51
41
|
getWalletTypes: () => getWalletTypes,
|
|
52
42
|
isPregenIdentifierMatch: () => isPregenIdentifierMatch,
|
|
53
43
|
isWalletSupported: () => isWalletSupported,
|
|
54
|
-
migrateWallet: () => migrateWallet
|
|
55
|
-
newUuid: () => newUuid
|
|
44
|
+
migrateWallet: () => migrateWallet
|
|
56
45
|
});
|
|
57
46
|
module.exports = __toCommonJS(wallet_exports);
|
|
58
|
-
var uuid = __toESM(require("uuid"));
|
|
59
47
|
var import_user_management_client = require("@getpara/user-management-client");
|
|
60
48
|
var import_formatting = require("./formatting.js");
|
|
61
49
|
const WalletSchemeTypeMap = {
|
|
@@ -129,9 +117,6 @@ function migrateWallet(obj) {
|
|
|
129
117
|
}
|
|
130
118
|
return obj;
|
|
131
119
|
}
|
|
132
|
-
function newUuid() {
|
|
133
|
-
return uuid.v4();
|
|
134
|
-
}
|
|
135
120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
136
121
|
0 && (module.exports = {
|
|
137
122
|
WalletSchemeTypeMap,
|
|
@@ -141,6 +126,5 @@ function newUuid() {
|
|
|
141
126
|
getWalletTypes,
|
|
142
127
|
isPregenIdentifierMatch,
|
|
143
128
|
isWalletSupported,
|
|
144
|
-
migrateWallet
|
|
145
|
-
newUuid
|
|
129
|
+
migrateWallet
|
|
146
130
|
});
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -55,7 +55,6 @@ import {
|
|
|
55
55
|
isPregenIdentifierMatch,
|
|
56
56
|
isWalletSupported,
|
|
57
57
|
migrateWallet,
|
|
58
|
-
newUuid,
|
|
59
58
|
normalizePhoneNumber,
|
|
60
59
|
truncateAddress,
|
|
61
60
|
WalletSchemeTypeMap
|
|
@@ -113,6 +112,37 @@ const _ParaCore = class _ParaCore {
|
|
|
113
112
|
this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
114
113
|
}
|
|
115
114
|
});
|
|
115
|
+
this.trackError = (methodName, err) => __async(this, null, function* () {
|
|
116
|
+
try {
|
|
117
|
+
yield this.ctx.client.trackError({
|
|
118
|
+
methodName,
|
|
119
|
+
sdkType: this.platformUtils.sdkType,
|
|
120
|
+
userId: this.userId,
|
|
121
|
+
error: {
|
|
122
|
+
name: err.name,
|
|
123
|
+
message: err.message
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
} catch (e) {
|
|
127
|
+
console.error("error tracking error:", e);
|
|
128
|
+
}
|
|
129
|
+
throw err;
|
|
130
|
+
});
|
|
131
|
+
this.wrapMethodsWithErrorTracking = (methodNames) => {
|
|
132
|
+
for (const methodName of methodNames) {
|
|
133
|
+
const original = this[methodName];
|
|
134
|
+
if (typeof original === "function") {
|
|
135
|
+
this[methodName] = (...args) => {
|
|
136
|
+
try {
|
|
137
|
+
const result = original.apply(this, args);
|
|
138
|
+
return result instanceof Promise ? result.catch((err) => this.trackError(methodName, err)) : result;
|
|
139
|
+
} catch (err) {
|
|
140
|
+
return this.trackError(methodName, err);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
116
146
|
this.initializeFromStorage = () => {
|
|
117
147
|
this.updateEmailFromStorage();
|
|
118
148
|
this.updateCountryCodeFromStorage();
|
|
@@ -218,6 +248,7 @@ const _ParaCore = class _ParaCore {
|
|
|
218
248
|
isE2E = true;
|
|
219
249
|
env = Environment.SANDBOX;
|
|
220
250
|
}
|
|
251
|
+
this.externalWalletConnectionOnly = opts.externalWalletConnectionOnly;
|
|
221
252
|
this.emailPrimaryColor = opts.emailPrimaryColor;
|
|
222
253
|
this.emailTheme = opts.emailTheme;
|
|
223
254
|
this.homepageUrl = opts.homepageUrl;
|
|
@@ -305,6 +336,19 @@ const _ParaCore = class _ParaCore {
|
|
|
305
336
|
}
|
|
306
337
|
this.initializeFromStorage();
|
|
307
338
|
setupListeners.bind(this)();
|
|
339
|
+
if (env !== Environment.PROD) {
|
|
340
|
+
this.wrapMethodsWithErrorTracking([
|
|
341
|
+
"createUser",
|
|
342
|
+
"initiateUserLoginV2",
|
|
343
|
+
"waitForPasskeyAndCreateWallet",
|
|
344
|
+
"waitForOAuth",
|
|
345
|
+
"waitForLoginAndSetup",
|
|
346
|
+
"createPregenWallet",
|
|
347
|
+
"claimPregenWallets",
|
|
348
|
+
"signMessage",
|
|
349
|
+
"signTransaction"
|
|
350
|
+
]);
|
|
351
|
+
}
|
|
308
352
|
}
|
|
309
353
|
get isEmail() {
|
|
310
354
|
return !!this.email && !this.phone && !this.countryCode && !this.farcasterUsername && !this.telegramUserId && !this.externalWalletWithParaAuth;
|
|
@@ -1217,6 +1261,13 @@ const _ParaCore = class _ParaCore {
|
|
|
1217
1261
|
*/
|
|
1218
1262
|
externalWalletLogin(wallet) {
|
|
1219
1263
|
return __async(this, null, function* () {
|
|
1264
|
+
if (this.externalWalletConnectionOnly) {
|
|
1265
|
+
wallet.withFullParaAuth = false;
|
|
1266
|
+
yield this.setExternalWallet(wallet);
|
|
1267
|
+
return Promise.resolve({
|
|
1268
|
+
userId: constants.EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1220
1271
|
this.requireApiKey();
|
|
1221
1272
|
const res = yield this.ctx.client.externalWalletLogin({
|
|
1222
1273
|
externalAddress: wallet.address,
|
|
@@ -1483,16 +1534,10 @@ const _ParaCore = class _ParaCore {
|
|
|
1483
1534
|
if (this.isUsingExternalWallet()) {
|
|
1484
1535
|
return true;
|
|
1485
1536
|
}
|
|
1486
|
-
if (this.isGuestMode) {
|
|
1487
|
-
return true;
|
|
1488
|
-
}
|
|
1489
1537
|
const isSessionActive = yield this.isSessionActive();
|
|
1490
1538
|
return isSessionActive && (this.isNoWalletConfig || this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.reduce((acc, [id]) => acc && !!this.wallets[id], true));
|
|
1491
1539
|
});
|
|
1492
1540
|
}
|
|
1493
|
-
get isGuestMode() {
|
|
1494
|
-
return !this.userId && this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.every(([id]) => !!this.wallets[id] && this.wallets[id].pregenIdentifierType === "GUEST_ID");
|
|
1495
|
-
}
|
|
1496
1541
|
supportedAuthMethods(auth) {
|
|
1497
1542
|
return __async(this, null, function* () {
|
|
1498
1543
|
const { supportedAuthMethods } = yield this.ctx.client.getSupportedAuthMethods(auth);
|
|
@@ -2367,24 +2412,6 @@ const _ParaCore = class _ParaCore {
|
|
|
2367
2412
|
return res.wallets.filter((w) => this.isWalletSupported(entityToWallet(w)));
|
|
2368
2413
|
});
|
|
2369
2414
|
}
|
|
2370
|
-
createGuestWallets() {
|
|
2371
|
-
return __async(this, arguments, function* ({ types } = {}) {
|
|
2372
|
-
const wallets = [];
|
|
2373
|
-
const currentWalletIds = {};
|
|
2374
|
-
const guestId = newUuid();
|
|
2375
|
-
for (const type of yield this.getTypesToCreate(
|
|
2376
|
-
types != null ? types : this.supportedWalletTypes.filter(({ optional }) => !optional).map(({ type: type2 }) => type2)
|
|
2377
|
-
)) {
|
|
2378
|
-
const wallet = yield __privateMethod(this, _ParaCore_instances, createPregenWallet_fn).call(this, { type, pregenIdentifier: guestId, pregenIdentifierType: "GUEST_ID" });
|
|
2379
|
-
wallets.push(wallet);
|
|
2380
|
-
getEquivalentTypes(type).filter((t) => __privateGet(this, _supportedWalletTypes).some(({ type: type2, optional }) => t === type2 && !optional)).forEach((eqType) => {
|
|
2381
|
-
currentWalletIds[eqType] = [wallet.id];
|
|
2382
|
-
});
|
|
2383
|
-
}
|
|
2384
|
-
yield this.setCurrentWalletIds(currentWalletIds);
|
|
2385
|
-
return wallets;
|
|
2386
|
-
});
|
|
2387
|
-
}
|
|
2388
2415
|
encodeWalletBase64(wallet) {
|
|
2389
2416
|
const walletJson = JSON.stringify(wallet);
|
|
2390
2417
|
const base64Wallet = Buffer.from(walletJson).toString("base64");
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./chunk-7B52C2XE.js";
|
|
2
|
-
const PARA_CORE_VERSION =
|
|
2
|
+
const PARA_CORE_VERSION = "1.13.0";
|
|
3
3
|
const PREFIX = "@CAPSULE/";
|
|
4
4
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
5
5
|
const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -16,7 +16,9 @@ const LOCAL_STORAGE_SESSION_COOKIE = `${PREFIX}sessionCookie`;
|
|
|
16
16
|
const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = `${PREFIX}loginEncryptionKeyPair`;
|
|
17
17
|
const POLLING_INTERVAL_MS = 2e3;
|
|
18
18
|
const SHORT_POLLING_INTERVAL_MS = 1e3;
|
|
19
|
+
const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
|
|
19
20
|
export {
|
|
21
|
+
EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID,
|
|
20
22
|
LOCAL_STORAGE_COUNTRY_CODE,
|
|
21
23
|
LOCAL_STORAGE_CURRENT_WALLET_IDS,
|
|
22
24
|
LOCAL_STORAGE_ED25519_WALLETS,
|
package/dist/esm/utils/wallet.js
CHANGED
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
__spreadProps,
|
|
3
3
|
__spreadValues
|
|
4
4
|
} from "../chunk-7B52C2XE.js";
|
|
5
|
-
import * as uuid from "uuid";
|
|
6
5
|
import { WalletScheme, WalletType } from "@getpara/user-management-client";
|
|
7
6
|
import { stringToPhoneNumber } from "./formatting.js";
|
|
8
7
|
const WalletSchemeTypeMap = {
|
|
@@ -76,9 +75,6 @@ function migrateWallet(obj) {
|
|
|
76
75
|
}
|
|
77
76
|
return obj;
|
|
78
77
|
}
|
|
79
|
-
function newUuid() {
|
|
80
|
-
return uuid.v4();
|
|
81
|
-
}
|
|
82
78
|
export {
|
|
83
79
|
WalletSchemeTypeMap,
|
|
84
80
|
entityToWallet,
|
|
@@ -87,6 +83,5 @@ export {
|
|
|
87
83
|
getWalletTypes,
|
|
88
84
|
isPregenIdentifierMatch,
|
|
89
85
|
isWalletSupported,
|
|
90
|
-
migrateWallet
|
|
91
|
-
newUuid
|
|
86
|
+
migrateWallet
|
|
92
87
|
};
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Client, { AuthMethod, BackupKitEmailProps, CurrentWalletIds, EmailTheme, WalletEntity, WalletType, WalletParams, OAuthMethod, OnRampPurchaseCreateParams, OnRampPurchase, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth, ExternalWalletLoginRes, AccountMetadata } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus, GetWalletBalanceParams
|
|
3
|
+
import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus, GetWalletBalanceParams } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
import { CountryCallingCode } from 'libphonenumber-js';
|
|
6
6
|
export declare abstract class ParaCore {
|
|
@@ -112,6 +112,10 @@ export declare abstract class ParaCore {
|
|
|
112
112
|
* @deprecated configure theming through the developer portal
|
|
113
113
|
*/
|
|
114
114
|
portalTheme?: Theme;
|
|
115
|
+
/**
|
|
116
|
+
* Whether or not to treat external wallets as connections only, skipping all Para functionality.
|
|
117
|
+
*/
|
|
118
|
+
externalWalletConnectionOnly?: boolean;
|
|
115
119
|
private disableProviderModal?;
|
|
116
120
|
get isNoWalletConfig(): boolean;
|
|
117
121
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
@@ -172,6 +176,8 @@ export declare abstract class ParaCore {
|
|
|
172
176
|
* @returns - A new ParaCore instance.
|
|
173
177
|
*/
|
|
174
178
|
constructor(env: Environment, apiKey?: string, opts?: ConstructorOpts);
|
|
179
|
+
private trackError;
|
|
180
|
+
private wrapMethodsWithErrorTracking;
|
|
175
181
|
private initializeFromStorage;
|
|
176
182
|
private updateTelegramUserIdFromStorage;
|
|
177
183
|
private updateUserIdFromStorage;
|
|
@@ -528,7 +534,6 @@ export declare abstract class ParaCore {
|
|
|
528
534
|
* @returns `true` if active, `false` otherwise
|
|
529
535
|
**/
|
|
530
536
|
isFullyLoggedIn(): Promise<boolean>;
|
|
531
|
-
get isGuestMode(): boolean;
|
|
532
537
|
protected supportedAuthMethods(auth: Auth): Promise<Set<AuthMethod>>;
|
|
533
538
|
/**
|
|
534
539
|
* Get hints associated with the users stored biometrics.
|
|
@@ -776,7 +781,7 @@ export declare abstract class ParaCore {
|
|
|
776
781
|
createPregenWallet(opts: {
|
|
777
782
|
type: WalletType;
|
|
778
783
|
pregenIdentifier: string;
|
|
779
|
-
pregenIdentifierType:
|
|
784
|
+
pregenIdentifierType: TPregenIdentifierType;
|
|
780
785
|
}): Promise<Wallet>;
|
|
781
786
|
/**
|
|
782
787
|
* Creates new pregenerated wallets for each desired type.
|
|
@@ -790,7 +795,7 @@ export declare abstract class ParaCore {
|
|
|
790
795
|
**/
|
|
791
796
|
createPregenWalletPerType({ types, pregenIdentifier, pregenIdentifierType, }: {
|
|
792
797
|
pregenIdentifier: string;
|
|
793
|
-
pregenIdentifierType:
|
|
798
|
+
pregenIdentifierType: TPregenIdentifierType;
|
|
794
799
|
types?: WalletType[];
|
|
795
800
|
}): Promise<Wallet[]>;
|
|
796
801
|
/**
|
|
@@ -839,7 +844,6 @@ export declare abstract class ParaCore {
|
|
|
839
844
|
pregenIdentifier?: string;
|
|
840
845
|
pregenIdentifierType?: TPregenIdentifierType;
|
|
841
846
|
}): Promise<WalletEntity[]>;
|
|
842
|
-
createGuestWallets({ types }?: CreateGuestWalletsParams): Promise<Wallet[]>;
|
|
843
847
|
private encodeWalletBase64;
|
|
844
848
|
/**
|
|
845
849
|
* Encodes the current wallets encoded in Base 64.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { BackupKitEmailProps, TPregenIdentifierType, WalletType } from '@getpara/user-management-client';
|
|
3
|
+
import { BackupKitEmailProps, TPregenIdentifierType, WalletType, SDKType } from '@getpara/user-management-client';
|
|
4
4
|
import { Ctx, PopupType, SignatureRes } from './types/index.js';
|
|
5
5
|
import { StorageUtils } from './StorageUtils.js';
|
|
6
6
|
export interface PlatformUtils {
|
|
7
|
+
sdkType: SDKType;
|
|
7
8
|
getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
|
|
8
9
|
keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
|
|
9
10
|
sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
|
|
@@ -15,3 +15,4 @@ export declare const LOCAL_STORAGE_SESSION_COOKIE: string;
|
|
|
15
15
|
export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR: string;
|
|
16
16
|
export declare const POLLING_INTERVAL_MS = 2000;
|
|
17
17
|
export declare const SHORT_POLLING_INTERVAL_MS = 1000;
|
|
18
|
+
export declare const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
2
|
export { AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
|
|
3
|
-
export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams,
|
|
3
|
+
export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, } from './types/index.js';
|
|
4
4
|
export * from './types/events.js';
|
|
5
5
|
export * from './types/config.js';
|
|
6
6
|
export { getPortalDomain, stringToPhoneNumber, entityToWallet } from './utils/index.js';
|
|
@@ -8,4 +8,3 @@ export declare function getWalletTypes(schemes: WalletScheme[]): WalletType[];
|
|
|
8
8
|
export declare function getEquivalentTypes(types: WalletTypeProp[] | WalletTypeProp): WalletType[];
|
|
9
9
|
export declare function entityToWallet(w: WalletEntity): Omit<Wallet, 'signer'>;
|
|
10
10
|
export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
|
|
11
|
-
export declare function newUuid(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
"@celo/utils": "^8.0.2",
|
|
11
11
|
"@cosmjs/encoding": "^0.32.4",
|
|
12
12
|
"@ethereumjs/util": "^9.1.0",
|
|
13
|
-
"@getpara/user-management-client": "1.
|
|
13
|
+
"@getpara/user-management-client": "1.13.0",
|
|
14
14
|
"@noble/hashes": "^1.5.0",
|
|
15
15
|
"base64url": "^3.0.1",
|
|
16
16
|
"libphonenumber-js": "1.11.2",
|
|
17
17
|
"node-forge": "^1.3.1",
|
|
18
|
-
"
|
|
18
|
+
"uuid": "^11.1.0"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types
|
|
21
|
+
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
|
|
22
22
|
"old-build": "yarn build:cjs && yarn build:esm && yarn build:types; yarn post-build",
|
|
23
23
|
"post-build": "./scripts/set-version.sh",
|
|
24
24
|
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"require": "./dist/cjs/index.js"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "cfc12a88a622907b3fbde326c891060fa53a2d32"
|
|
44
44
|
}
|