@getpara/core-sdk 2.11.0 → 2.12.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 +30 -14
- package/dist/cjs/constants.js +1 -1
- package/dist/esm/ParaCore.js +30 -14
- package/dist/esm/constants.js +1 -1
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -182,16 +182,16 @@ const _ParaCore = class _ParaCore {
|
|
|
182
182
|
this.clearStorage = (type = "all") => __async(this, null, function* () {
|
|
183
183
|
const isAll = type === "all";
|
|
184
184
|
if (isAll || type === "local") {
|
|
185
|
-
this.platformUtils.localStorage.clear(constants.PREFIX);
|
|
186
|
-
this.platformUtils.localStorage.clear(constants.PARA_PREFIX);
|
|
185
|
+
yield this.platformUtils.localStorage.clear(constants.PREFIX);
|
|
186
|
+
yield this.platformUtils.localStorage.clear(constants.PARA_PREFIX);
|
|
187
187
|
}
|
|
188
188
|
if (isAll || type === "session") {
|
|
189
|
-
this.platformUtils.sessionStorage.clear(constants.PREFIX);
|
|
190
|
-
this.platformUtils.sessionStorage.clear(constants.PARA_PREFIX);
|
|
189
|
+
yield this.platformUtils.sessionStorage.clear(constants.PREFIX);
|
|
190
|
+
yield this.platformUtils.sessionStorage.clear(constants.PARA_PREFIX);
|
|
191
191
|
}
|
|
192
192
|
if ((isAll || type === "secure") && this.platformUtils.secureStorage) {
|
|
193
|
-
this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
194
|
-
this.platformUtils.secureStorage.clear(constants.PARA_PREFIX);
|
|
193
|
+
yield this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
194
|
+
yield this.platformUtils.secureStorage.clear(constants.PARA_PREFIX);
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
this.trackError = (methodName, err) => __async(this, null, function* () {
|
|
@@ -814,7 +814,10 @@ const _ParaCore = class _ParaCore {
|
|
|
814
814
|
}
|
|
815
815
|
let sessionId = opts.sessionId;
|
|
816
816
|
if ((isLogin || isOnRamp || isTelegramLogin || isFarcasterLogin || isExportPrivateKey || isTxReview) && !sessionId) {
|
|
817
|
-
|
|
817
|
+
let session = yield this.touchSession(false);
|
|
818
|
+
if (!session.sessionId) {
|
|
819
|
+
session = yield this.touchSession(true);
|
|
820
|
+
}
|
|
818
821
|
sessionId = session.sessionId;
|
|
819
822
|
}
|
|
820
823
|
if (!this.loginEncryptionKeyPair) {
|
|
@@ -933,7 +936,7 @@ const _ParaCore = class _ParaCore {
|
|
|
933
936
|
portalTextColor: this.portalTextColor,
|
|
934
937
|
portalPrimaryButtonTextColor: this.portalPrimaryButtonTextColor,
|
|
935
938
|
isForNewDevice: opts.isForNewDevice ? opts.isForNewDevice.toString() : void 0
|
|
936
|
-
}), this.authInfo && (isCreate || isLogin || isAddNewCredential || isOAuthCallback || isSwitchWallets || isExportPrivateKey) ? __spreadProps(__spreadValues({
|
|
939
|
+
}), this.authInfo && (isCreate || isLogin || isAddNewCredential || isOAuthCallback || isSwitchWallets || isExportPrivateKey || isTxReview) ? __spreadProps(__spreadValues({
|
|
937
940
|
authInfo: JSON.stringify(this.authInfo)
|
|
938
941
|
}, (0, import_user_management_client.isPhone)(this.authInfo.auth) ? (0, import_utils2.splitPhoneNumber)(this.authInfo.auth.phone) : this.authInfo.auth), {
|
|
939
942
|
pfpUrl: this.authInfo.pfpUrl,
|
|
@@ -1736,7 +1739,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1736
1739
|
}
|
|
1737
1740
|
verifyExternalWalletLink(opts) {
|
|
1738
1741
|
return __async(this, null, function* () {
|
|
1739
|
-
const accountLinkInProgress =
|
|
1742
|
+
const accountLinkInProgress = __privateMethod(this, _ParaCore_instances, assertIsLinkingAccount_fn).call(this, ["EXTERNAL_WALLET"]);
|
|
1740
1743
|
if (!accountLinkInProgress.externalWallet) {
|
|
1741
1744
|
throw new Error("no external wallet account link in progress");
|
|
1742
1745
|
}
|
|
@@ -1941,6 +1944,13 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1941
1944
|
return false;
|
|
1942
1945
|
}
|
|
1943
1946
|
}
|
|
1947
|
+
const allWalletsLoaded = this.currentWalletIdsArray.every(([walletId]) => {
|
|
1948
|
+
const wallet = this.wallets[walletId];
|
|
1949
|
+
return wallet && typeof wallet.address === "string";
|
|
1950
|
+
});
|
|
1951
|
+
if (!allWalletsLoaded) {
|
|
1952
|
+
return false;
|
|
1953
|
+
}
|
|
1944
1954
|
return true;
|
|
1945
1955
|
});
|
|
1946
1956
|
}
|
|
@@ -1978,7 +1988,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1978
1988
|
*/
|
|
1979
1989
|
supportedUserAuthMethods() {
|
|
1980
1990
|
return __async(this, null, function* () {
|
|
1981
|
-
|
|
1991
|
+
this.assertIsAuthSet();
|
|
1982
1992
|
const { supportedAuthMethods, hasPasswordWithoutPIN } = yield this.ctx.client.getSupportedAuthMethodsV2(
|
|
1983
1993
|
this.authInfo.auth
|
|
1984
1994
|
);
|
|
@@ -2344,7 +2354,10 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2344
2354
|
*/
|
|
2345
2355
|
getSwitchWalletsUrl() {
|
|
2346
2356
|
return __async(this, null, function* () {
|
|
2347
|
-
const
|
|
2357
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
2358
|
+
const url = yield this.constructPortalUrl("switchWallets", {
|
|
2359
|
+
useLegacyUrl: authMethods.has(import_user_management_client.AuthMethod.PASSKEY)
|
|
2360
|
+
});
|
|
2348
2361
|
return url;
|
|
2349
2362
|
});
|
|
2350
2363
|
}
|
|
@@ -2912,10 +2925,11 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2912
2925
|
}
|
|
2913
2926
|
getTransactionReviewUrl(transactionId, timeoutMs) {
|
|
2914
2927
|
return __async(this, null, function* () {
|
|
2928
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
2915
2929
|
return this.constructPortalUrl("txReview", {
|
|
2916
2930
|
pathId: transactionId,
|
|
2931
|
+
useLegacyUrl: authMethods.has(import_user_management_client.AuthMethod.PASSKEY),
|
|
2917
2932
|
params: {
|
|
2918
|
-
email: this.email,
|
|
2919
2933
|
timeoutMs: timeoutMs == null ? void 0 : timeoutMs.toString()
|
|
2920
2934
|
}
|
|
2921
2935
|
});
|
|
@@ -3673,8 +3687,10 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
3673
3687
|
if (args.shouldOpenPopup) {
|
|
3674
3688
|
this.popupWindow = yield this.platformUtils.openPopup("about:blank", { type: import_types.PopupType.EXPORT_PRIVATE_KEY });
|
|
3675
3689
|
}
|
|
3690
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
3676
3691
|
const exportPrivateKeyUrl = yield this.constructPortalUrl("exportPrivateKey", {
|
|
3677
|
-
pathId: walletId
|
|
3692
|
+
pathId: walletId,
|
|
3693
|
+
useLegacyUrl: authMethods.has(import_user_management_client.AuthMethod.PASSKEY)
|
|
3678
3694
|
});
|
|
3679
3695
|
if (args.shouldOpenPopup) {
|
|
3680
3696
|
this.popupWindow.location.href = exportPrivateKeyUrl;
|
|
@@ -4063,7 +4079,7 @@ prepareAuthState_fn = function(_0) {
|
|
|
4063
4079
|
}).filter(([_, v]) => !!v)
|
|
4064
4080
|
));
|
|
4065
4081
|
yield __privateMethod(this, _ParaCore_instances, setAuthInfo_fn).call(this, authInfo);
|
|
4066
|
-
|
|
4082
|
+
this.assertIsAuthSet();
|
|
4067
4083
|
if (!!externalWallet) {
|
|
4068
4084
|
yield this.setExternalWallet([externalWallet]);
|
|
4069
4085
|
}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -44,7 +44,7 @@ __export(constants_exports, {
|
|
|
44
44
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(constants_exports);
|
|
47
|
-
const PARA_CORE_VERSION = "2.
|
|
47
|
+
const PARA_CORE_VERSION = "2.12.0";
|
|
48
48
|
const PREFIX = "@CAPSULE/";
|
|
49
49
|
const PARA_PREFIX = "@PARA/";
|
|
50
50
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -148,16 +148,16 @@ const _ParaCore = class _ParaCore {
|
|
|
148
148
|
this.clearStorage = (type = "all") => __async(this, null, function* () {
|
|
149
149
|
const isAll = type === "all";
|
|
150
150
|
if (isAll || type === "local") {
|
|
151
|
-
this.platformUtils.localStorage.clear(constants.PREFIX);
|
|
152
|
-
this.platformUtils.localStorage.clear(constants.PARA_PREFIX);
|
|
151
|
+
yield this.platformUtils.localStorage.clear(constants.PREFIX);
|
|
152
|
+
yield this.platformUtils.localStorage.clear(constants.PARA_PREFIX);
|
|
153
153
|
}
|
|
154
154
|
if (isAll || type === "session") {
|
|
155
|
-
this.platformUtils.sessionStorage.clear(constants.PREFIX);
|
|
156
|
-
this.platformUtils.sessionStorage.clear(constants.PARA_PREFIX);
|
|
155
|
+
yield this.platformUtils.sessionStorage.clear(constants.PREFIX);
|
|
156
|
+
yield this.platformUtils.sessionStorage.clear(constants.PARA_PREFIX);
|
|
157
157
|
}
|
|
158
158
|
if ((isAll || type === "secure") && this.platformUtils.secureStorage) {
|
|
159
|
-
this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
160
|
-
this.platformUtils.secureStorage.clear(constants.PARA_PREFIX);
|
|
159
|
+
yield this.platformUtils.secureStorage.clear(constants.PREFIX);
|
|
160
|
+
yield this.platformUtils.secureStorage.clear(constants.PARA_PREFIX);
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
this.trackError = (methodName, err) => __async(this, null, function* () {
|
|
@@ -780,7 +780,10 @@ const _ParaCore = class _ParaCore {
|
|
|
780
780
|
}
|
|
781
781
|
let sessionId = opts.sessionId;
|
|
782
782
|
if ((isLogin || isOnRamp || isTelegramLogin || isFarcasterLogin || isExportPrivateKey || isTxReview) && !sessionId) {
|
|
783
|
-
|
|
783
|
+
let session = yield this.touchSession(false);
|
|
784
|
+
if (!session.sessionId) {
|
|
785
|
+
session = yield this.touchSession(true);
|
|
786
|
+
}
|
|
784
787
|
sessionId = session.sessionId;
|
|
785
788
|
}
|
|
786
789
|
if (!this.loginEncryptionKeyPair) {
|
|
@@ -899,7 +902,7 @@ const _ParaCore = class _ParaCore {
|
|
|
899
902
|
portalTextColor: this.portalTextColor,
|
|
900
903
|
portalPrimaryButtonTextColor: this.portalPrimaryButtonTextColor,
|
|
901
904
|
isForNewDevice: opts.isForNewDevice ? opts.isForNewDevice.toString() : void 0
|
|
902
|
-
}), this.authInfo && (isCreate || isLogin || isAddNewCredential || isOAuthCallback || isSwitchWallets || isExportPrivateKey) ? __spreadProps(__spreadValues({
|
|
905
|
+
}), this.authInfo && (isCreate || isLogin || isAddNewCredential || isOAuthCallback || isSwitchWallets || isExportPrivateKey || isTxReview) ? __spreadProps(__spreadValues({
|
|
903
906
|
authInfo: JSON.stringify(this.authInfo)
|
|
904
907
|
}, isPhone(this.authInfo.auth) ? splitPhoneNumber(this.authInfo.auth.phone) : this.authInfo.auth), {
|
|
905
908
|
pfpUrl: this.authInfo.pfpUrl,
|
|
@@ -1702,7 +1705,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1702
1705
|
}
|
|
1703
1706
|
verifyExternalWalletLink(opts) {
|
|
1704
1707
|
return __async(this, null, function* () {
|
|
1705
|
-
const accountLinkInProgress =
|
|
1708
|
+
const accountLinkInProgress = __privateMethod(this, _ParaCore_instances, assertIsLinkingAccount_fn).call(this, ["EXTERNAL_WALLET"]);
|
|
1706
1709
|
if (!accountLinkInProgress.externalWallet) {
|
|
1707
1710
|
throw new Error("no external wallet account link in progress");
|
|
1708
1711
|
}
|
|
@@ -1907,6 +1910,13 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1907
1910
|
return false;
|
|
1908
1911
|
}
|
|
1909
1912
|
}
|
|
1913
|
+
const allWalletsLoaded = this.currentWalletIdsArray.every(([walletId]) => {
|
|
1914
|
+
const wallet = this.wallets[walletId];
|
|
1915
|
+
return wallet && typeof wallet.address === "string";
|
|
1916
|
+
});
|
|
1917
|
+
if (!allWalletsLoaded) {
|
|
1918
|
+
return false;
|
|
1919
|
+
}
|
|
1910
1920
|
return true;
|
|
1911
1921
|
});
|
|
1912
1922
|
}
|
|
@@ -1944,7 +1954,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1944
1954
|
*/
|
|
1945
1955
|
supportedUserAuthMethods() {
|
|
1946
1956
|
return __async(this, null, function* () {
|
|
1947
|
-
|
|
1957
|
+
this.assertIsAuthSet();
|
|
1948
1958
|
const { supportedAuthMethods, hasPasswordWithoutPIN } = yield this.ctx.client.getSupportedAuthMethodsV2(
|
|
1949
1959
|
this.authInfo.auth
|
|
1950
1960
|
);
|
|
@@ -2310,7 +2320,10 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2310
2320
|
*/
|
|
2311
2321
|
getSwitchWalletsUrl() {
|
|
2312
2322
|
return __async(this, null, function* () {
|
|
2313
|
-
const
|
|
2323
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
2324
|
+
const url = yield this.constructPortalUrl("switchWallets", {
|
|
2325
|
+
useLegacyUrl: authMethods.has(AuthMethod.PASSKEY)
|
|
2326
|
+
});
|
|
2314
2327
|
return url;
|
|
2315
2328
|
});
|
|
2316
2329
|
}
|
|
@@ -2878,10 +2891,11 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2878
2891
|
}
|
|
2879
2892
|
getTransactionReviewUrl(transactionId, timeoutMs) {
|
|
2880
2893
|
return __async(this, null, function* () {
|
|
2894
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
2881
2895
|
return this.constructPortalUrl("txReview", {
|
|
2882
2896
|
pathId: transactionId,
|
|
2897
|
+
useLegacyUrl: authMethods.has(AuthMethod.PASSKEY),
|
|
2883
2898
|
params: {
|
|
2884
|
-
email: this.email,
|
|
2885
2899
|
timeoutMs: timeoutMs == null ? void 0 : timeoutMs.toString()
|
|
2886
2900
|
}
|
|
2887
2901
|
});
|
|
@@ -3639,8 +3653,10 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
3639
3653
|
if (args.shouldOpenPopup) {
|
|
3640
3654
|
this.popupWindow = yield this.platformUtils.openPopup("about:blank", { type: PopupType.EXPORT_PRIVATE_KEY });
|
|
3641
3655
|
}
|
|
3656
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
3642
3657
|
const exportPrivateKeyUrl = yield this.constructPortalUrl("exportPrivateKey", {
|
|
3643
|
-
pathId: walletId
|
|
3658
|
+
pathId: walletId,
|
|
3659
|
+
useLegacyUrl: authMethods.has(AuthMethod.PASSKEY)
|
|
3644
3660
|
});
|
|
3645
3661
|
if (args.shouldOpenPopup) {
|
|
3646
3662
|
this.popupWindow.location.href = exportPrivateKeyUrl;
|
|
@@ -4029,7 +4045,7 @@ prepareAuthState_fn = function(_0) {
|
|
|
4029
4045
|
}).filter(([_, v]) => !!v)
|
|
4030
4046
|
));
|
|
4031
4047
|
yield __privateMethod(this, _ParaCore_instances, setAuthInfo_fn).call(this, authInfo);
|
|
4032
|
-
|
|
4048
|
+
this.assertIsAuthSet();
|
|
4033
4049
|
if (!!externalWallet) {
|
|
4034
4050
|
yield this.setExternalWallet([externalWallet]);
|
|
4035
4051
|
}
|
package/dist/esm/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
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.
|
|
8
|
+
"@getpara/user-management-client": "2.12.0",
|
|
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": "09c114d148f7a0c2ad250d6346a76aa3b332b2d4",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|