@getpara/core-sdk 2.0.0-alpha.58 → 2.0.0-alpha.59
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 +26 -16
- package/dist/cjs/constants.js +1 -1
- package/dist/esm/ParaCore.js +26 -16
- package/dist/esm/constants.js +1 -1
- package/dist/types/ParaCore.d.ts +1 -0
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -627,6 +627,12 @@ const _ParaCore = class _ParaCore {
|
|
|
627
627
|
if (typeof window === "undefined") return false;
|
|
628
628
|
return !!((_a = window.location) == null ? void 0 : _a.host) && (0, import_utils2.getPortalBaseURL)(envOverride ? { env: envOverride } : this.ctx).includes(window.location.host);
|
|
629
629
|
}
|
|
630
|
+
isRecoveryPortal(envOverride) {
|
|
631
|
+
var _a, _b;
|
|
632
|
+
if (typeof window === "undefined") return false;
|
|
633
|
+
const normalizedUrl = (_b = (_a = window.location) == null ? void 0 : _a.host) == null ? void 0 : _b.replace("getpara", "usecapsule");
|
|
634
|
+
return !!normalizedUrl && (0, import_utils2.getPortalBaseURL)(envOverride ? { env: envOverride } : this.ctx).includes(normalizedUrl);
|
|
635
|
+
}
|
|
630
636
|
isParaConnect() {
|
|
631
637
|
var _a;
|
|
632
638
|
if (typeof window === "undefined") return false;
|
|
@@ -922,7 +928,7 @@ const _ParaCore = class _ParaCore {
|
|
|
922
928
|
throw error;
|
|
923
929
|
}
|
|
924
930
|
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) {
|
|
925
|
-
if (!session.partnerId && !this.
|
|
931
|
+
if (!session.partnerId && !this.isRecoveryPortal()) {
|
|
926
932
|
this.displayModalError(
|
|
927
933
|
`Invalid API Key. Please ensure you have a valid API key for the current environment: ${(_d = this.ctx.env) == null ? void 0 : _d.toUpperCase()}.`
|
|
928
934
|
);
|
|
@@ -2771,6 +2777,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2771
2777
|
onCancel,
|
|
2772
2778
|
onPoll
|
|
2773
2779
|
}) {
|
|
2780
|
+
var _a;
|
|
2774
2781
|
this.assertIsValidWalletId(walletId);
|
|
2775
2782
|
const wallet = this.wallets[walletId];
|
|
2776
2783
|
let signerId = this.userId;
|
|
@@ -2794,18 +2801,19 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2794
2801
|
break;
|
|
2795
2802
|
}
|
|
2796
2803
|
yield new Promise((resolve) => setTimeout(resolve, constants.POLLING_INTERVAL_MS));
|
|
2804
|
+
let pendingTransaction;
|
|
2797
2805
|
try {
|
|
2798
|
-
yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId);
|
|
2806
|
+
pendingTransaction = (_a = (yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId)).data) == null ? void 0 : _a.pendingTransaction;
|
|
2799
2807
|
} catch (err) {
|
|
2800
2808
|
const error = new import_errors.TransactionReviewDenied();
|
|
2801
2809
|
(0, import_utils2.dispatchEvent)(import_types.ParaEvent.SIGN_MESSAGE_EVENT, signRes, error.message);
|
|
2802
2810
|
throw error;
|
|
2803
2811
|
}
|
|
2804
|
-
|
|
2805
|
-
if (signRes.pendingTransactionId) {
|
|
2812
|
+
if (!(pendingTransaction == null ? void 0 : pendingTransaction.approvedAt)) {
|
|
2806
2813
|
onPoll == null ? void 0 : onPoll();
|
|
2807
2814
|
continue;
|
|
2808
2815
|
} else {
|
|
2816
|
+
signRes = yield this.signMessageInner({ wallet, signerId, messageBase64, cosmosSignDocBase64 });
|
|
2809
2817
|
break;
|
|
2810
2818
|
}
|
|
2811
2819
|
}
|
|
@@ -2874,6 +2882,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2874
2882
|
onCancel,
|
|
2875
2883
|
onPoll
|
|
2876
2884
|
}) {
|
|
2885
|
+
var _a;
|
|
2877
2886
|
this.assertIsValidWalletId(walletId);
|
|
2878
2887
|
const wallet = this.wallets[walletId];
|
|
2879
2888
|
let signerId = this.userId;
|
|
@@ -2906,27 +2915,28 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2906
2915
|
break;
|
|
2907
2916
|
}
|
|
2908
2917
|
yield new Promise((resolve) => setTimeout(resolve, constants.POLLING_INTERVAL_MS));
|
|
2918
|
+
let pendingTransaction;
|
|
2909
2919
|
try {
|
|
2910
|
-
yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId);
|
|
2920
|
+
pendingTransaction = (_a = (yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId)).data) == null ? void 0 : _a.pendingTransaction;
|
|
2911
2921
|
} catch (err) {
|
|
2912
2922
|
const error = new import_errors.TransactionReviewDenied();
|
|
2913
2923
|
(0, import_utils2.dispatchEvent)(import_types.ParaEvent.SIGN_TRANSACTION_EVENT, signRes, error.message);
|
|
2914
2924
|
throw error;
|
|
2915
2925
|
}
|
|
2916
|
-
|
|
2917
|
-
this.ctx,
|
|
2918
|
-
signerId,
|
|
2919
|
-
walletId,
|
|
2920
|
-
this.wallets[walletId].signer,
|
|
2921
|
-
rlpEncodedTxBase64,
|
|
2922
|
-
chainId,
|
|
2923
|
-
this.retrieveSessionCookie(),
|
|
2924
|
-
wallet.scheme === "DKLS"
|
|
2925
|
-
);
|
|
2926
|
-
if (signRes.pendingTransactionId) {
|
|
2926
|
+
if (!(pendingTransaction == null ? void 0 : pendingTransaction.approvedAt)) {
|
|
2927
2927
|
onPoll == null ? void 0 : onPoll();
|
|
2928
2928
|
continue;
|
|
2929
2929
|
} else {
|
|
2930
|
+
signRes = yield this.platformUtils.signTransaction(
|
|
2931
|
+
this.ctx,
|
|
2932
|
+
signerId,
|
|
2933
|
+
walletId,
|
|
2934
|
+
this.wallets[walletId].signer,
|
|
2935
|
+
rlpEncodedTxBase64,
|
|
2936
|
+
chainId,
|
|
2937
|
+
this.retrieveSessionCookie(),
|
|
2938
|
+
wallet.scheme === "DKLS"
|
|
2939
|
+
);
|
|
2930
2940
|
break;
|
|
2931
2941
|
}
|
|
2932
2942
|
}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -43,7 +43,7 @@ __export(constants_exports, {
|
|
|
43
43
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
44
44
|
});
|
|
45
45
|
module.exports = __toCommonJS(constants_exports);
|
|
46
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
46
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.59";
|
|
47
47
|
const PREFIX = "@CAPSULE/";
|
|
48
48
|
const PARA_PREFIX = "@PARA/";
|
|
49
49
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -591,6 +591,12 @@ const _ParaCore = class _ParaCore {
|
|
|
591
591
|
if (typeof window === "undefined") return false;
|
|
592
592
|
return !!((_a = window.location) == null ? void 0 : _a.host) && getPortalBaseURL(envOverride ? { env: envOverride } : this.ctx).includes(window.location.host);
|
|
593
593
|
}
|
|
594
|
+
isRecoveryPortal(envOverride) {
|
|
595
|
+
var _a, _b;
|
|
596
|
+
if (typeof window === "undefined") return false;
|
|
597
|
+
const normalizedUrl = (_b = (_a = window.location) == null ? void 0 : _a.host) == null ? void 0 : _b.replace("getpara", "usecapsule");
|
|
598
|
+
return !!normalizedUrl && getPortalBaseURL(envOverride ? { env: envOverride } : this.ctx).includes(normalizedUrl);
|
|
599
|
+
}
|
|
594
600
|
isParaConnect() {
|
|
595
601
|
var _a;
|
|
596
602
|
if (typeof window === "undefined") return false;
|
|
@@ -886,7 +892,7 @@ const _ParaCore = class _ParaCore {
|
|
|
886
892
|
throw error;
|
|
887
893
|
}
|
|
888
894
|
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) {
|
|
889
|
-
if (!session.partnerId && !this.
|
|
895
|
+
if (!session.partnerId && !this.isRecoveryPortal()) {
|
|
890
896
|
this.displayModalError(
|
|
891
897
|
`Invalid API Key. Please ensure you have a valid API key for the current environment: ${(_d = this.ctx.env) == null ? void 0 : _d.toUpperCase()}.`
|
|
892
898
|
);
|
|
@@ -2735,6 +2741,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2735
2741
|
onCancel,
|
|
2736
2742
|
onPoll
|
|
2737
2743
|
}) {
|
|
2744
|
+
var _a;
|
|
2738
2745
|
this.assertIsValidWalletId(walletId);
|
|
2739
2746
|
const wallet = this.wallets[walletId];
|
|
2740
2747
|
let signerId = this.userId;
|
|
@@ -2758,18 +2765,19 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2758
2765
|
break;
|
|
2759
2766
|
}
|
|
2760
2767
|
yield new Promise((resolve) => setTimeout(resolve, constants.POLLING_INTERVAL_MS));
|
|
2768
|
+
let pendingTransaction;
|
|
2761
2769
|
try {
|
|
2762
|
-
yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId);
|
|
2770
|
+
pendingTransaction = (_a = (yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId)).data) == null ? void 0 : _a.pendingTransaction;
|
|
2763
2771
|
} catch (err) {
|
|
2764
2772
|
const error = new TransactionReviewDenied();
|
|
2765
2773
|
dispatchEvent(ParaEvent.SIGN_MESSAGE_EVENT, signRes, error.message);
|
|
2766
2774
|
throw error;
|
|
2767
2775
|
}
|
|
2768
|
-
|
|
2769
|
-
if (signRes.pendingTransactionId) {
|
|
2776
|
+
if (!(pendingTransaction == null ? void 0 : pendingTransaction.approvedAt)) {
|
|
2770
2777
|
onPoll == null ? void 0 : onPoll();
|
|
2771
2778
|
continue;
|
|
2772
2779
|
} else {
|
|
2780
|
+
signRes = yield this.signMessageInner({ wallet, signerId, messageBase64, cosmosSignDocBase64 });
|
|
2773
2781
|
break;
|
|
2774
2782
|
}
|
|
2775
2783
|
}
|
|
@@ -2838,6 +2846,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2838
2846
|
onCancel,
|
|
2839
2847
|
onPoll
|
|
2840
2848
|
}) {
|
|
2849
|
+
var _a;
|
|
2841
2850
|
this.assertIsValidWalletId(walletId);
|
|
2842
2851
|
const wallet = this.wallets[walletId];
|
|
2843
2852
|
let signerId = this.userId;
|
|
@@ -2870,27 +2879,28 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2870
2879
|
break;
|
|
2871
2880
|
}
|
|
2872
2881
|
yield new Promise((resolve) => setTimeout(resolve, constants.POLLING_INTERVAL_MS));
|
|
2882
|
+
let pendingTransaction;
|
|
2873
2883
|
try {
|
|
2874
|
-
yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId);
|
|
2884
|
+
pendingTransaction = (_a = (yield this.ctx.client.getPendingTransaction(this.userId, signRes.pendingTransactionId)).data) == null ? void 0 : _a.pendingTransaction;
|
|
2875
2885
|
} catch (err) {
|
|
2876
2886
|
const error = new TransactionReviewDenied();
|
|
2877
2887
|
dispatchEvent(ParaEvent.SIGN_TRANSACTION_EVENT, signRes, error.message);
|
|
2878
2888
|
throw error;
|
|
2879
2889
|
}
|
|
2880
|
-
|
|
2881
|
-
this.ctx,
|
|
2882
|
-
signerId,
|
|
2883
|
-
walletId,
|
|
2884
|
-
this.wallets[walletId].signer,
|
|
2885
|
-
rlpEncodedTxBase64,
|
|
2886
|
-
chainId,
|
|
2887
|
-
this.retrieveSessionCookie(),
|
|
2888
|
-
wallet.scheme === "DKLS"
|
|
2889
|
-
);
|
|
2890
|
-
if (signRes.pendingTransactionId) {
|
|
2890
|
+
if (!(pendingTransaction == null ? void 0 : pendingTransaction.approvedAt)) {
|
|
2891
2891
|
onPoll == null ? void 0 : onPoll();
|
|
2892
2892
|
continue;
|
|
2893
2893
|
} else {
|
|
2894
|
+
signRes = yield this.platformUtils.signTransaction(
|
|
2895
|
+
this.ctx,
|
|
2896
|
+
signerId,
|
|
2897
|
+
walletId,
|
|
2898
|
+
this.wallets[walletId].signer,
|
|
2899
|
+
rlpEncodedTxBase64,
|
|
2900
|
+
chainId,
|
|
2901
|
+
this.retrieveSessionCookie(),
|
|
2902
|
+
wallet.scheme === "DKLS"
|
|
2903
|
+
);
|
|
2894
2904
|
break;
|
|
2895
2905
|
}
|
|
2896
2906
|
}
|
package/dist/esm/constants.js
CHANGED
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -163,6 +163,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
163
163
|
private convertBigInt;
|
|
164
164
|
private convertEncryptionKeyPair;
|
|
165
165
|
protected isPortal(envOverride?: Environment): boolean;
|
|
166
|
+
protected isRecoveryPortal(envOverride?: Environment): boolean;
|
|
166
167
|
private isParaConnect;
|
|
167
168
|
private requireApiKey;
|
|
168
169
|
private isWalletSupported;
|
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.59",
|
|
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.59",
|
|
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": "e15908ac8eafff6f3b264fffa43742870b14b275",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|