@getpara/core-sdk 1.4.4-dev.0 → 1.4.4-dev.1
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/index.js +2 -3793
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js +17 -17
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/package.json +1 -1
package/dist/cjs/index.js.br
CHANGED
|
Binary file
|
package/dist/cjs/index.js.gz
CHANGED
|
Binary file
|
package/dist/esm/index.js
CHANGED
|
@@ -318,7 +318,7 @@ function isPregenIdentifierMatch(a, b, type) {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
function isWalletSupported(types, wallet) {
|
|
321
|
-
return types.some((walletType) => !!WalletSchemeTypeMap[wallet
|
|
321
|
+
return types.some((walletType) => !!WalletSchemeTypeMap[wallet?.scheme]?.[walletType]);
|
|
322
322
|
}
|
|
323
323
|
function getSchemes(types) {
|
|
324
324
|
return Object.keys(WalletSchemeTypeMap).filter((scheme) => {
|
|
@@ -932,7 +932,7 @@ var TransactionReviewTimeout = class extends Error {
|
|
|
932
932
|
};
|
|
933
933
|
|
|
934
934
|
// src/constants.ts
|
|
935
|
-
var PARA_CORE_VERSION = '1.4.4-dev.
|
|
935
|
+
var PARA_CORE_VERSION = '1.4.4-dev.1';
|
|
936
936
|
var PREFIX = "@CAPSULE/";
|
|
937
937
|
var LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
938
938
|
var LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -1356,19 +1356,19 @@ var ParaCore = class _ParaCore {
|
|
|
1356
1356
|
}
|
|
1357
1357
|
}
|
|
1358
1358
|
isWalletSupported(wallet) {
|
|
1359
|
-
return !this.#supportedWalletTypes || isWalletSupported(this.supportedWalletTypes
|
|
1359
|
+
return !this.#supportedWalletTypes || isWalletSupported(this.supportedWalletTypes?.map(({ type }) => type) ?? [], wallet);
|
|
1360
1360
|
}
|
|
1361
1361
|
isWalletOwned(wallet) {
|
|
1362
|
-
return this.isWalletSupported(wallet) && !wallet
|
|
1362
|
+
return this.isWalletSupported(wallet) && !wallet?.pregenIdentifier && !wallet?.pregenIdentifierType && !!this.userId && wallet?.userId === this.userId;
|
|
1363
1363
|
}
|
|
1364
1364
|
isPregenWalletUnclaimed(wallet) {
|
|
1365
|
-
return this.isWalletSupported(wallet) && (!wallet
|
|
1365
|
+
return this.isWalletSupported(wallet) && (!wallet?.userId || wallet?.isPregen && !!wallet?.pregenIdentifier && !!wallet?.pregenIdentifierType);
|
|
1366
1366
|
}
|
|
1367
1367
|
isPregenWalletClaimable(wallet) {
|
|
1368
|
-
return this.isWalletSupported(wallet) && this.isPregenWalletUnclaimed(wallet) && (!["EMAIL", "PHONE", "TELEGRAM"].includes(wallet
|
|
1369
|
-
wallet
|
|
1370
|
-
wallet
|
|
1371
|
-
wallet
|
|
1368
|
+
return this.isWalletSupported(wallet) && this.isPregenWalletUnclaimed(wallet) && (!["EMAIL", "PHONE", "TELEGRAM"].includes(wallet?.pregenIdentifierType) || isPregenIdentifierMatch(
|
|
1369
|
+
wallet?.pregenIdentifierType === "EMAIL" ? this.email : wallet?.pregenIdentifierType === "TELEGRAM" ? this.telegramUserId : this.getPhoneNumber(),
|
|
1370
|
+
wallet?.pregenIdentifier,
|
|
1371
|
+
wallet?.pregenIdentifierType
|
|
1372
1372
|
));
|
|
1373
1373
|
}
|
|
1374
1374
|
isWalletUsable(walletId, { type: types, scheme: schemes, forbidPregen = false } = {}, throwError = false) {
|
|
@@ -1379,15 +1379,15 @@ var ParaCore = class _ParaCore {
|
|
|
1379
1379
|
const wallet = this.wallets[walletId];
|
|
1380
1380
|
const [isUnclaimed, isOwned] = [this.isPregenWalletUnclaimed(wallet), this.isWalletOwned(wallet)];
|
|
1381
1381
|
if (forbidPregen && isUnclaimed) {
|
|
1382
|
-
error = `pre-generated wallet with id ${wallet
|
|
1382
|
+
error = `pre-generated wallet with id ${wallet?.id} cannot be selected`;
|
|
1383
1383
|
} else if (!isOwned && !isUnclaimed) {
|
|
1384
|
-
error = `wallet with id ${wallet
|
|
1384
|
+
error = `wallet with id ${wallet?.id} is not owned by the current user`;
|
|
1385
1385
|
} else if (!this.isWalletSupported(wallet)) {
|
|
1386
|
-
error = `wallet with id ${wallet
|
|
1387
|
-
} else if (types && (!getEquivalentTypes(types).includes(wallet
|
|
1388
|
-
error = `wallet with id ${wallet
|
|
1389
|
-
} else if (schemes && !schemes.includes(wallet
|
|
1390
|
-
error = `wallet with id ${wallet
|
|
1386
|
+
error = `wallet with id ${wallet?.id} and type ${wallet?.type} is not supported, supported types are: ${this.supportedWalletTypes.map(({ type }) => type).join(", ")}`;
|
|
1387
|
+
} else if (types && (!getEquivalentTypes(types).includes(wallet?.type) || isOwned && !types.some((type) => this.currentWalletIds?.[type]?.includes(walletId)))) {
|
|
1388
|
+
error = `wallet with id ${wallet?.id} and type ${wallet?.type} cannot be selected`;
|
|
1389
|
+
} else if (schemes && !schemes.includes(wallet?.scheme)) {
|
|
1390
|
+
error = `wallet with id ${wallet?.id} and scheme ${wallet?.scheme} cannot be selected`;
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
1393
|
if (error) {
|
|
@@ -1444,7 +1444,7 @@ var ParaCore = class _ParaCore {
|
|
|
1444
1444
|
return this.wallets;
|
|
1445
1445
|
}
|
|
1446
1446
|
getAddress(walletId) {
|
|
1447
|
-
return walletId ? this.wallets[walletId]
|
|
1447
|
+
return walletId ? this.wallets[walletId]?.address : Object.values(this.wallets)?.[0]?.address;
|
|
1448
1448
|
}
|
|
1449
1449
|
async constructPortalUrl(type, opts = {}) {
|
|
1450
1450
|
const base = type === "onRamp" ? getPortalBaseURL(this.ctx) : await this.getPortalURL(opts.partnerId);
|
package/dist/esm/index.js.br
CHANGED
|
Binary file
|
package/dist/esm/index.js.gz
CHANGED
|
Binary file
|