@getpara/core-sdk 2.7.0 → 2.9.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 +38 -8
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/shares/enclave.js +29 -0
- package/dist/cjs/utils/config.js +4 -1
- package/dist/cjs/utils/url.js +1 -1
- package/dist/cjs/utils/window.js +1 -1
- package/dist/esm/ParaCore.js +38 -8
- package/dist/esm/constants.js +1 -1
- package/dist/esm/shares/enclave.js +29 -0
- package/dist/esm/utils/config.js +4 -1
- package/dist/esm/utils/url.js +1 -1
- package/dist/esm/utils/window.js +1 -1
- package/dist/types/shares/enclave.d.ts +10 -0
- package/dist/types/types/config.d.ts +2 -0
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -206,7 +206,7 @@ const _ParaCore = class _ParaCore {
|
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
208
|
} catch (e) {
|
|
209
|
-
|
|
209
|
+
this.devLog("error tracking error:", e);
|
|
210
210
|
}
|
|
211
211
|
throw err;
|
|
212
212
|
});
|
|
@@ -784,7 +784,8 @@ const _ParaCore = class _ParaCore {
|
|
|
784
784
|
isFarcasterLogin,
|
|
785
785
|
isAddNewCredential,
|
|
786
786
|
isSwitchWallets,
|
|
787
|
-
isExportPrivateKey
|
|
787
|
+
isExportPrivateKey,
|
|
788
|
+
isTxReview
|
|
788
789
|
] = [
|
|
789
790
|
["createAuth", "createPassword", "createPIN"].includes(type),
|
|
790
791
|
["loginAuth", "loginPassword", "loginPIN", "loginOTP", "switchWallets", "loginExternalWallet"].includes(type),
|
|
@@ -795,7 +796,8 @@ const _ParaCore = class _ParaCore {
|
|
|
795
796
|
type === "loginFarcaster",
|
|
796
797
|
type === "addNewCredential",
|
|
797
798
|
type === "switchWallets",
|
|
798
|
-
type === "exportPrivateKey"
|
|
799
|
+
type === "exportPrivateKey",
|
|
800
|
+
type === "txReview"
|
|
799
801
|
];
|
|
800
802
|
if (isOAuth && !opts.oAuthMethod) {
|
|
801
803
|
throw new Error("oAuthMethod is required for oAuth portal URLs");
|
|
@@ -804,7 +806,7 @@ const _ParaCore = class _ParaCore {
|
|
|
804
806
|
this.assertIsAuthSet();
|
|
805
807
|
}
|
|
806
808
|
let sessionId = opts.sessionId;
|
|
807
|
-
if ((isLogin || isOnRamp || isTelegramLogin || isFarcasterLogin || isExportPrivateKey) && !sessionId) {
|
|
809
|
+
if ((isLogin || isOnRamp || isTelegramLogin || isFarcasterLogin || isExportPrivateKey || isTxReview) && !sessionId) {
|
|
808
810
|
const session = yield this.touchSession(true);
|
|
809
811
|
sessionId = session.sessionId;
|
|
810
812
|
}
|
|
@@ -812,7 +814,7 @@ const _ParaCore = class _ParaCore {
|
|
|
812
814
|
yield this.setLoginEncryptionKeyPair();
|
|
813
815
|
}
|
|
814
816
|
const shouldUseLegacyPortalUrl = opts.useLegacyUrl || !!opts.addNewCredentialPasskeyId || type === "loginAuth";
|
|
815
|
-
const base = type === "onRamp" || isTelegramLogin ? (0, import_utils2.getPortalBaseURL)(this.ctx, isTelegramLogin, false, shouldUseLegacyPortalUrl) : yield this.getPortalURL(shouldUseLegacyPortalUrl);
|
|
817
|
+
const base = type === "onRamp" || isTelegramLogin ? this.ctx.portalUrlOverride || (0, import_utils2.getPortalBaseURL)(this.ctx, isTelegramLogin, false, shouldUseLegacyPortalUrl) : yield this.getPortalURL(shouldUseLegacyPortalUrl);
|
|
816
818
|
let path;
|
|
817
819
|
switch (type) {
|
|
818
820
|
case "createPassword": {
|
|
@@ -946,7 +948,7 @@ const _ParaCore = class _ParaCore {
|
|
|
946
948
|
}) : {}), isLogin && {
|
|
947
949
|
// Prior versions won't have this param which will skip the upgrade prompt
|
|
948
950
|
isBasicLoginUpgradeVersion: "true"
|
|
949
|
-
}), isExportPrivateKey ? {
|
|
951
|
+
}), isExportPrivateKey || isTxReview ? {
|
|
950
952
|
sessionId: thisDevice.sessionId
|
|
951
953
|
} : {});
|
|
952
954
|
const url = (0, import_utils2.constructUrl)({ base, path, params });
|
|
@@ -1140,7 +1142,9 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1140
1142
|
const errorStr = String(error);
|
|
1141
1143
|
const errorMessage = error instanceof Error ? error.message : "";
|
|
1142
1144
|
if (errorStr.includes("blocked by CORS policy") && errorStr.includes("Access-Control-Allow-Origin")) {
|
|
1143
|
-
|
|
1145
|
+
const message = "Request rate limit reached. Please wait a couple of minutes and try again.";
|
|
1146
|
+
console.error(`[Para] ${message}`);
|
|
1147
|
+
this.displayModalError(message);
|
|
1144
1148
|
return;
|
|
1145
1149
|
}
|
|
1146
1150
|
if (error.status === 403 && errorMessage.includes("origin not authorized")) {
|
|
@@ -1568,7 +1572,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1568
1572
|
*/
|
|
1569
1573
|
getPortalURL(isLegacy) {
|
|
1570
1574
|
return __async(this, null, function* () {
|
|
1571
|
-
return (yield this.getPartnerURL()) || (0, import_utils2.getPortalBaseURL)(this.ctx, false, false, isLegacy);
|
|
1575
|
+
return this.ctx.portalUrlOverride || (yield this.getPartnerURL()) || (0, import_utils2.getPortalBaseURL)(this.ctx, false, false, isLegacy);
|
|
1572
1576
|
});
|
|
1573
1577
|
}
|
|
1574
1578
|
/**
|
|
@@ -2048,6 +2052,32 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2048
2052
|
const pregenWallets = yield this.getPregenWallets();
|
|
2049
2053
|
let recoverySecret, walletIds = {};
|
|
2050
2054
|
if (pregenWallets.length > 0) {
|
|
2055
|
+
try {
|
|
2056
|
+
const shares = yield this.ctx.enclaveClient.getPregenShares({
|
|
2057
|
+
userId: this.userId,
|
|
2058
|
+
walletIds: pregenWallets.map((w) => w.id),
|
|
2059
|
+
partnerId: pregenWallets[0].partnerId
|
|
2060
|
+
});
|
|
2061
|
+
for (const share of shares) {
|
|
2062
|
+
const wallet = pregenWallets.find((w) => w.id === share.walletId);
|
|
2063
|
+
if (wallet) {
|
|
2064
|
+
this.wallets[wallet.id] = {
|
|
2065
|
+
id: wallet.id,
|
|
2066
|
+
address: wallet.address,
|
|
2067
|
+
scheme: wallet.scheme,
|
|
2068
|
+
type: wallet.type,
|
|
2069
|
+
partnerId: wallet.partnerId,
|
|
2070
|
+
isPregen: wallet.isPregen,
|
|
2071
|
+
pregenIdentifier: wallet.pregenIdentifier,
|
|
2072
|
+
pregenIdentifierType: wallet.pregenIdentifierType,
|
|
2073
|
+
signer: share.signer,
|
|
2074
|
+
createdAt: String(wallet.createdAt)
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
} catch (err) {
|
|
2079
|
+
console.warn("[waitForWalletCreation] Failed to fetch pregen shares:", err);
|
|
2080
|
+
}
|
|
2051
2081
|
recoverySecret = yield this.claimPregenWallets();
|
|
2052
2082
|
walletIds = supportedWalletTypes.reduce((acc, { type }) => {
|
|
2053
2083
|
var _a;
|
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.
|
|
46
|
+
const PARA_CORE_VERSION = "2.9.0";
|
|
47
47
|
const PREFIX = "@CAPSULE/";
|
|
48
48
|
const PARA_PREFIX = "@PARA/";
|
|
49
49
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
@@ -268,6 +268,35 @@ ${exportedAsBase64}
|
|
|
268
268
|
}));
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Retrieve pregen wallet shares from the enclave
|
|
273
|
+
* Used during login to claim REST API pregen wallets
|
|
274
|
+
* Client sends walletIds in encrypted payload; backend independently queries matching wallets for cross-validation
|
|
275
|
+
*/
|
|
276
|
+
getPregenShares(query) {
|
|
277
|
+
return __async(this, null, function* () {
|
|
278
|
+
try {
|
|
279
|
+
const frontendKeyPair = yield this.generateFrontendKeyPair();
|
|
280
|
+
const responsePublicKeyPEM = yield this.exportPublicKeyToPEM(frontendKeyPair.publicKey);
|
|
281
|
+
const payload = {
|
|
282
|
+
userId: query.userId,
|
|
283
|
+
walletIds: query.walletIds,
|
|
284
|
+
partnerId: query.partnerId,
|
|
285
|
+
responsePublicKey: responsePublicKeyPEM
|
|
286
|
+
};
|
|
287
|
+
const encryptedPayload = yield this.encryptForEnclave(JSON.stringify(payload));
|
|
288
|
+
const encryptedPayloadStr = JSON.stringify(encryptedPayload);
|
|
289
|
+
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr);
|
|
290
|
+
const encryptedResponse = JSON.parse(response.payload);
|
|
291
|
+
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
292
|
+
return decryptedData.shares;
|
|
293
|
+
} catch (error) {
|
|
294
|
+
throw new Error(
|
|
295
|
+
`Failed to retrieve pregen shares for user ${query.userId}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
271
300
|
persistSharesWithRetry(shares) {
|
|
272
301
|
return __async(this, null, function* () {
|
|
273
302
|
return yield this.persistShares(shares);
|
package/dist/cjs/utils/config.js
CHANGED
|
@@ -82,7 +82,10 @@ function validateCustomAsset(obj) {
|
|
|
82
82
|
return false;
|
|
83
83
|
}
|
|
84
84
|
} else if (typeof network.network === "object") {
|
|
85
|
-
|
|
85
|
+
const hasLegacyRpcUrl = typeof network.network.rpcUrl === "string" && network.network.rpcUrl.trim().length > 0;
|
|
86
|
+
const hasNewRpcFormat = network.network.rpc && typeof network.network.rpc === "object" && Array.isArray(network.network.rpc.httpUrls) && network.network.rpc.httpUrls.length > 0 && typeof network.network.rpc.httpUrls[0] === "string" && network.network.rpc.httpUrls[0].trim().length > 0;
|
|
87
|
+
if (typeof network.network.name !== "string" || !network.network.name.trim() || !hasLegacyRpcUrl && !hasNewRpcFormat || // Must have either rpcUrl or rpc.httpUrls
|
|
88
|
+
typeof network.network.evmChainId !== "string" || !network.network.evmChainId.trim()) {
|
|
86
89
|
return false;
|
|
87
90
|
}
|
|
88
91
|
if (network.contractAddress !== void 0 && (typeof network.contractAddress !== "string" || !network.contractAddress.trim())) {
|
package/dist/cjs/utils/url.js
CHANGED
|
@@ -120,7 +120,7 @@ function shortenUrl(ctx, url, isLegacy) {
|
|
|
120
120
|
return __async(this, null, function* () {
|
|
121
121
|
const compressedUrl = yield (0, import_transmissionUtils.upload)(url, ctx.client);
|
|
122
122
|
return constructUrl({
|
|
123
|
-
base: getPortalBaseURL(ctx, false, false, isLegacy),
|
|
123
|
+
base: ctx.portalUrlOverride || getPortalBaseURL(ctx, false, false, isLegacy),
|
|
124
124
|
path: `/short/${compressedUrl}`
|
|
125
125
|
});
|
|
126
126
|
});
|
package/dist/cjs/utils/window.js
CHANGED
|
@@ -25,7 +25,7 @@ function isPortal(ctx, env) {
|
|
|
25
25
|
var _a, _b;
|
|
26
26
|
if (typeof window === "undefined") return false;
|
|
27
27
|
const normalizedUrl = (_b = (_a = window.location) == null ? void 0 : _a.host) == null ? void 0 : _b.replace("usecapsule", "getpara");
|
|
28
|
-
const isOnPortalDomain = (0, import_url.getPortalBaseURL)(env ? { env } : ctx).includes(normalizedUrl);
|
|
28
|
+
const isOnPortalDomain = (0, import_url.getPortalBaseURL)(env ? { env } : ctx).includes(normalizedUrl) || ((ctx == null ? void 0 : ctx.portalUrlOverride) ? ctx.portalUrlOverride.includes(normalizedUrl) : false);
|
|
29
29
|
if (!isOnPortalDomain) return false;
|
|
30
30
|
const isInIframe = window.parent !== window && !window.opener;
|
|
31
31
|
const isInPopup = window.opener && window.parent === window;
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -172,7 +172,7 @@ const _ParaCore = class _ParaCore {
|
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
} catch (e) {
|
|
175
|
-
|
|
175
|
+
this.devLog("error tracking error:", e);
|
|
176
176
|
}
|
|
177
177
|
throw err;
|
|
178
178
|
});
|
|
@@ -750,7 +750,8 @@ const _ParaCore = class _ParaCore {
|
|
|
750
750
|
isFarcasterLogin,
|
|
751
751
|
isAddNewCredential,
|
|
752
752
|
isSwitchWallets,
|
|
753
|
-
isExportPrivateKey
|
|
753
|
+
isExportPrivateKey,
|
|
754
|
+
isTxReview
|
|
754
755
|
] = [
|
|
755
756
|
["createAuth", "createPassword", "createPIN"].includes(type),
|
|
756
757
|
["loginAuth", "loginPassword", "loginPIN", "loginOTP", "switchWallets", "loginExternalWallet"].includes(type),
|
|
@@ -761,7 +762,8 @@ const _ParaCore = class _ParaCore {
|
|
|
761
762
|
type === "loginFarcaster",
|
|
762
763
|
type === "addNewCredential",
|
|
763
764
|
type === "switchWallets",
|
|
764
|
-
type === "exportPrivateKey"
|
|
765
|
+
type === "exportPrivateKey",
|
|
766
|
+
type === "txReview"
|
|
765
767
|
];
|
|
766
768
|
if (isOAuth && !opts.oAuthMethod) {
|
|
767
769
|
throw new Error("oAuthMethod is required for oAuth portal URLs");
|
|
@@ -770,7 +772,7 @@ const _ParaCore = class _ParaCore {
|
|
|
770
772
|
this.assertIsAuthSet();
|
|
771
773
|
}
|
|
772
774
|
let sessionId = opts.sessionId;
|
|
773
|
-
if ((isLogin || isOnRamp || isTelegramLogin || isFarcasterLogin || isExportPrivateKey) && !sessionId) {
|
|
775
|
+
if ((isLogin || isOnRamp || isTelegramLogin || isFarcasterLogin || isExportPrivateKey || isTxReview) && !sessionId) {
|
|
774
776
|
const session = yield this.touchSession(true);
|
|
775
777
|
sessionId = session.sessionId;
|
|
776
778
|
}
|
|
@@ -778,7 +780,7 @@ const _ParaCore = class _ParaCore {
|
|
|
778
780
|
yield this.setLoginEncryptionKeyPair();
|
|
779
781
|
}
|
|
780
782
|
const shouldUseLegacyPortalUrl = opts.useLegacyUrl || !!opts.addNewCredentialPasskeyId || type === "loginAuth";
|
|
781
|
-
const base = type === "onRamp" || isTelegramLogin ? getPortalBaseURL(this.ctx, isTelegramLogin, false, shouldUseLegacyPortalUrl) : yield this.getPortalURL(shouldUseLegacyPortalUrl);
|
|
783
|
+
const base = type === "onRamp" || isTelegramLogin ? this.ctx.portalUrlOverride || getPortalBaseURL(this.ctx, isTelegramLogin, false, shouldUseLegacyPortalUrl) : yield this.getPortalURL(shouldUseLegacyPortalUrl);
|
|
782
784
|
let path;
|
|
783
785
|
switch (type) {
|
|
784
786
|
case "createPassword": {
|
|
@@ -912,7 +914,7 @@ const _ParaCore = class _ParaCore {
|
|
|
912
914
|
}) : {}), isLogin && {
|
|
913
915
|
// Prior versions won't have this param which will skip the upgrade prompt
|
|
914
916
|
isBasicLoginUpgradeVersion: "true"
|
|
915
|
-
}), isExportPrivateKey ? {
|
|
917
|
+
}), isExportPrivateKey || isTxReview ? {
|
|
916
918
|
sessionId: thisDevice.sessionId
|
|
917
919
|
} : {});
|
|
918
920
|
const url = constructUrl({ base, path, params });
|
|
@@ -1106,7 +1108,9 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1106
1108
|
const errorStr = String(error);
|
|
1107
1109
|
const errorMessage = error instanceof Error ? error.message : "";
|
|
1108
1110
|
if (errorStr.includes("blocked by CORS policy") && errorStr.includes("Access-Control-Allow-Origin")) {
|
|
1109
|
-
|
|
1111
|
+
const message = "Request rate limit reached. Please wait a couple of minutes and try again.";
|
|
1112
|
+
console.error(`[Para] ${message}`);
|
|
1113
|
+
this.displayModalError(message);
|
|
1110
1114
|
return;
|
|
1111
1115
|
}
|
|
1112
1116
|
if (error.status === 403 && errorMessage.includes("origin not authorized")) {
|
|
@@ -1534,7 +1538,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1534
1538
|
*/
|
|
1535
1539
|
getPortalURL(isLegacy) {
|
|
1536
1540
|
return __async(this, null, function* () {
|
|
1537
|
-
return (yield this.getPartnerURL()) || getPortalBaseURL(this.ctx, false, false, isLegacy);
|
|
1541
|
+
return this.ctx.portalUrlOverride || (yield this.getPartnerURL()) || getPortalBaseURL(this.ctx, false, false, isLegacy);
|
|
1538
1542
|
});
|
|
1539
1543
|
}
|
|
1540
1544
|
/**
|
|
@@ -2014,6 +2018,32 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
2014
2018
|
const pregenWallets = yield this.getPregenWallets();
|
|
2015
2019
|
let recoverySecret, walletIds = {};
|
|
2016
2020
|
if (pregenWallets.length > 0) {
|
|
2021
|
+
try {
|
|
2022
|
+
const shares = yield this.ctx.enclaveClient.getPregenShares({
|
|
2023
|
+
userId: this.userId,
|
|
2024
|
+
walletIds: pregenWallets.map((w) => w.id),
|
|
2025
|
+
partnerId: pregenWallets[0].partnerId
|
|
2026
|
+
});
|
|
2027
|
+
for (const share of shares) {
|
|
2028
|
+
const wallet = pregenWallets.find((w) => w.id === share.walletId);
|
|
2029
|
+
if (wallet) {
|
|
2030
|
+
this.wallets[wallet.id] = {
|
|
2031
|
+
id: wallet.id,
|
|
2032
|
+
address: wallet.address,
|
|
2033
|
+
scheme: wallet.scheme,
|
|
2034
|
+
type: wallet.type,
|
|
2035
|
+
partnerId: wallet.partnerId,
|
|
2036
|
+
isPregen: wallet.isPregen,
|
|
2037
|
+
pregenIdentifier: wallet.pregenIdentifier,
|
|
2038
|
+
pregenIdentifierType: wallet.pregenIdentifierType,
|
|
2039
|
+
signer: share.signer,
|
|
2040
|
+
createdAt: String(wallet.createdAt)
|
|
2041
|
+
};
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
} catch (err) {
|
|
2045
|
+
console.warn("[waitForWalletCreation] Failed to fetch pregen shares:", err);
|
|
2046
|
+
}
|
|
2017
2047
|
recoverySecret = yield this.claimPregenWallets();
|
|
2018
2048
|
walletIds = supportedWalletTypes.reduce((acc, { type }) => {
|
|
2019
2049
|
var _a;
|
package/dist/esm/constants.js
CHANGED
|
@@ -229,6 +229,35 @@ ${exportedAsBase64}
|
|
|
229
229
|
}));
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Retrieve pregen wallet shares from the enclave
|
|
234
|
+
* Used during login to claim REST API pregen wallets
|
|
235
|
+
* Client sends walletIds in encrypted payload; backend independently queries matching wallets for cross-validation
|
|
236
|
+
*/
|
|
237
|
+
getPregenShares(query) {
|
|
238
|
+
return __async(this, null, function* () {
|
|
239
|
+
try {
|
|
240
|
+
const frontendKeyPair = yield this.generateFrontendKeyPair();
|
|
241
|
+
const responsePublicKeyPEM = yield this.exportPublicKeyToPEM(frontendKeyPair.publicKey);
|
|
242
|
+
const payload = {
|
|
243
|
+
userId: query.userId,
|
|
244
|
+
walletIds: query.walletIds,
|
|
245
|
+
partnerId: query.partnerId,
|
|
246
|
+
responsePublicKey: responsePublicKeyPEM
|
|
247
|
+
};
|
|
248
|
+
const encryptedPayload = yield this.encryptForEnclave(JSON.stringify(payload));
|
|
249
|
+
const encryptedPayloadStr = JSON.stringify(encryptedPayload);
|
|
250
|
+
const response = yield this.userManagementClient.getPregenShares(encryptedPayloadStr);
|
|
251
|
+
const encryptedResponse = JSON.parse(response.payload);
|
|
252
|
+
const decryptedData = yield this.decryptForFrontend(encryptedResponse);
|
|
253
|
+
return decryptedData.shares;
|
|
254
|
+
} catch (error) {
|
|
255
|
+
throw new Error(
|
|
256
|
+
`Failed to retrieve pregen shares for user ${query.userId}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
232
261
|
persistSharesWithRetry(shares) {
|
|
233
262
|
return __async(this, null, function* () {
|
|
234
263
|
return yield this.persistShares(shares);
|
package/dist/esm/utils/config.js
CHANGED
|
@@ -61,7 +61,10 @@ function validateCustomAsset(obj) {
|
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
63
|
} else if (typeof network.network === "object") {
|
|
64
|
-
|
|
64
|
+
const hasLegacyRpcUrl = typeof network.network.rpcUrl === "string" && network.network.rpcUrl.trim().length > 0;
|
|
65
|
+
const hasNewRpcFormat = network.network.rpc && typeof network.network.rpc === "object" && Array.isArray(network.network.rpc.httpUrls) && network.network.rpc.httpUrls.length > 0 && typeof network.network.rpc.httpUrls[0] === "string" && network.network.rpc.httpUrls[0].trim().length > 0;
|
|
66
|
+
if (typeof network.network.name !== "string" || !network.network.name.trim() || !hasLegacyRpcUrl && !hasNewRpcFormat || // Must have either rpcUrl or rpc.httpUrls
|
|
67
|
+
typeof network.network.evmChainId !== "string" || !network.network.evmChainId.trim()) {
|
|
65
68
|
return false;
|
|
66
69
|
}
|
|
67
70
|
if (network.contractAddress !== void 0 && (typeof network.contractAddress !== "string" || !network.contractAddress.trim())) {
|
package/dist/esm/utils/url.js
CHANGED
|
@@ -76,7 +76,7 @@ function shortenUrl(ctx, url, isLegacy) {
|
|
|
76
76
|
return __async(this, null, function* () {
|
|
77
77
|
const compressedUrl = yield upload(url, ctx.client);
|
|
78
78
|
return constructUrl({
|
|
79
|
-
base: getPortalBaseURL(ctx, false, false, isLegacy),
|
|
79
|
+
base: ctx.portalUrlOverride || getPortalBaseURL(ctx, false, false, isLegacy),
|
|
80
80
|
path: `/short/${compressedUrl}`
|
|
81
81
|
});
|
|
82
82
|
});
|
package/dist/esm/utils/window.js
CHANGED
|
@@ -4,7 +4,7 @@ function isPortal(ctx, env) {
|
|
|
4
4
|
var _a, _b;
|
|
5
5
|
if (typeof window === "undefined") return false;
|
|
6
6
|
const normalizedUrl = (_b = (_a = window.location) == null ? void 0 : _a.host) == null ? void 0 : _b.replace("usecapsule", "getpara");
|
|
7
|
-
const isOnPortalDomain = getPortalBaseURL(env ? { env } : ctx).includes(normalizedUrl);
|
|
7
|
+
const isOnPortalDomain = getPortalBaseURL(env ? { env } : ctx).includes(normalizedUrl) || ((ctx == null ? void 0 : ctx.portalUrlOverride) ? ctx.portalUrlOverride.includes(normalizedUrl) : false);
|
|
8
8
|
if (!isOnPortalDomain) return false;
|
|
9
9
|
const isInIframe = window.parent !== window && !window.opener;
|
|
10
10
|
const isInPopup = window.opener && window.parent === window;
|
|
@@ -78,6 +78,16 @@ export declare class EnclaveClient {
|
|
|
78
78
|
private retrieveShares;
|
|
79
79
|
deleteShares(): Promise<void>;
|
|
80
80
|
retrieveSharesWithRetry(query: ShareQuery[]): Promise<ShareData[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Retrieve pregen wallet shares from the enclave
|
|
83
|
+
* Used during login to claim REST API pregen wallets
|
|
84
|
+
* Client sends walletIds in encrypted payload; backend independently queries matching wallets for cross-validation
|
|
85
|
+
*/
|
|
86
|
+
getPregenShares(query: {
|
|
87
|
+
userId: string;
|
|
88
|
+
walletIds: string[];
|
|
89
|
+
partnerId: string;
|
|
90
|
+
}): Promise<ShareData[]>;
|
|
81
91
|
persistSharesWithRetry(shares: ShareData[]): Promise<any>;
|
|
82
92
|
deleteSharesWithRetry(): Promise<void>;
|
|
83
93
|
}
|
|
@@ -23,6 +23,8 @@ export interface Ctx {
|
|
|
23
23
|
wasmOverride?: ArrayBuffer;
|
|
24
24
|
cosmosPrefix?: string;
|
|
25
25
|
isE2E?: boolean;
|
|
26
|
+
portalUrlOverride?: string;
|
|
27
|
+
passkeyRpIdOverride?: string;
|
|
26
28
|
}
|
|
27
29
|
export type deprecated__NetworkProp = keyof typeof Network | Network;
|
|
28
30
|
export type deprecated__OnRampProviderProp = keyof typeof OnRampProvider | OnRampProvider;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.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.9.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": "672cc943bc57cbeced8e79127c52a4fab0af4aed",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|