@getpara/core-sdk 1.4.4-dev.0 → 1.4.4

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 CHANGED
@@ -402,7 +402,7 @@ function isPregenIdentifierMatch(a, b, type) {
402
402
  }
403
403
  }
404
404
  function isWalletSupported(types, wallet) {
405
- return types.some((walletType) => !!WalletSchemeTypeMap[wallet.scheme][walletType]);
405
+ return types.some((walletType) => !!WalletSchemeTypeMap[wallet?.scheme]?.[walletType]);
406
406
  }
407
407
  function getSchemes(types) {
408
408
  return Object.keys(WalletSchemeTypeMap).filter((scheme) => {
@@ -1016,7 +1016,7 @@ var TransactionReviewTimeout = class extends Error {
1016
1016
  };
1017
1017
 
1018
1018
  // src/constants.ts
1019
- var PARA_CORE_VERSION = '1.4.4-dev.0';
1019
+ var PARA_CORE_VERSION = '1.4.4';
1020
1020
  var PREFIX = "@CAPSULE/";
1021
1021
  var LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
1022
1022
  var LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
@@ -1440,19 +1440,19 @@ var ParaCore = class _ParaCore {
1440
1440
  }
1441
1441
  }
1442
1442
  isWalletSupported(wallet) {
1443
- return !this.#supportedWalletTypes || isWalletSupported(this.supportedWalletTypes.map(({ type }) => type) ?? [], wallet);
1443
+ return !this.#supportedWalletTypes || isWalletSupported(this.supportedWalletTypes?.map(({ type }) => type) ?? [], wallet);
1444
1444
  }
1445
1445
  isWalletOwned(wallet) {
1446
- return this.isWalletSupported(wallet) && !wallet.pregenIdentifier && !wallet.pregenIdentifierType && !!this.userId && wallet.userId === this.userId;
1446
+ return this.isWalletSupported(wallet) && !wallet?.pregenIdentifier && !wallet?.pregenIdentifierType && !!this.userId && wallet?.userId === this.userId;
1447
1447
  }
1448
1448
  isPregenWalletUnclaimed(wallet) {
1449
- return this.isWalletSupported(wallet) && (!wallet.userId || wallet.isPregen && !!wallet.pregenIdentifier && !!wallet.pregenIdentifierType);
1449
+ return this.isWalletSupported(wallet) && (!wallet?.userId || wallet?.isPregen && !!wallet?.pregenIdentifier && !!wallet?.pregenIdentifierType);
1450
1450
  }
1451
1451
  isPregenWalletClaimable(wallet) {
1452
- return this.isWalletSupported(wallet) && this.isPregenWalletUnclaimed(wallet) && (!["EMAIL", "PHONE", "TELEGRAM"].includes(wallet.pregenIdentifierType) || isPregenIdentifierMatch(
1453
- wallet.pregenIdentifierType === "EMAIL" ? this.email : wallet.pregenIdentifierType === "TELEGRAM" ? this.telegramUserId : this.getPhoneNumber(),
1454
- wallet.pregenIdentifier,
1455
- wallet.pregenIdentifierType
1452
+ return this.isWalletSupported(wallet) && this.isPregenWalletUnclaimed(wallet) && (!["EMAIL", "PHONE", "TELEGRAM"].includes(wallet?.pregenIdentifierType) || isPregenIdentifierMatch(
1453
+ wallet?.pregenIdentifierType === "EMAIL" ? this.email : wallet?.pregenIdentifierType === "TELEGRAM" ? this.telegramUserId : this.getPhoneNumber(),
1454
+ wallet?.pregenIdentifier,
1455
+ wallet?.pregenIdentifierType
1456
1456
  ));
1457
1457
  }
1458
1458
  isWalletUsable(walletId, { type: types, scheme: schemes, forbidPregen = false } = {}, throwError = false) {
@@ -1463,15 +1463,15 @@ var ParaCore = class _ParaCore {
1463
1463
  const wallet = this.wallets[walletId];
1464
1464
  const [isUnclaimed, isOwned] = [this.isPregenWalletUnclaimed(wallet), this.isWalletOwned(wallet)];
1465
1465
  if (forbidPregen && isUnclaimed) {
1466
- error = `pre-generated wallet with id ${wallet.id} cannot be selected`;
1466
+ error = `pre-generated wallet with id ${wallet?.id} cannot be selected`;
1467
1467
  } else if (!isOwned && !isUnclaimed) {
1468
- error = `wallet with id ${wallet.id} is not owned by the current user`;
1468
+ error = `wallet with id ${wallet?.id} is not owned by the current user`;
1469
1469
  } else if (!this.isWalletSupported(wallet)) {
1470
- error = `wallet with id ${wallet.id} and type ${wallet.type} is not supported, supported types are: ${this.supportedWalletTypes.map(({ type }) => type).join(", ")}`;
1471
- } else if (types && (!getEquivalentTypes(types).includes(wallet.type) || isOwned && !types.some((type) => this.currentWalletIds?.[type]?.includes(walletId)))) {
1472
- error = `wallet with id ${wallet.id} and type ${wallet.type} cannot be selected`;
1473
- } else if (schemes && !schemes.includes(wallet.scheme)) {
1474
- error = `wallet with id ${wallet.id} and scheme ${wallet.scheme} cannot be selected`;
1470
+ error = `wallet with id ${wallet?.id} and type ${wallet?.type} is not supported, supported types are: ${this.supportedWalletTypes.map(({ type }) => type).join(", ")}`;
1471
+ } else if (types && (!getEquivalentTypes(types).includes(wallet?.type) || isOwned && !types.some((type) => this.currentWalletIds?.[type]?.includes(walletId)))) {
1472
+ error = `wallet with id ${wallet?.id} and type ${wallet?.type} cannot be selected`;
1473
+ } else if (schemes && !schemes.includes(wallet?.scheme)) {
1474
+ error = `wallet with id ${wallet?.id} and scheme ${wallet?.scheme} cannot be selected`;
1475
1475
  }
1476
1476
  }
1477
1477
  if (error) {
@@ -1528,7 +1528,7 @@ var ParaCore = class _ParaCore {
1528
1528
  return this.wallets;
1529
1529
  }
1530
1530
  getAddress(walletId) {
1531
- return walletId ? this.wallets[walletId].address : Object.values(this.wallets)?.[0]?.address;
1531
+ return walletId ? this.wallets[walletId]?.address : Object.values(this.wallets)?.[0]?.address;
1532
1532
  }
1533
1533
  async constructPortalUrl(type, opts = {}) {
1534
1534
  const base = type === "onRamp" ? getPortalBaseURL(this.ctx) : await this.getPortalURL(opts.partnerId);
Binary file
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.scheme][walletType]);
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.0';
935
+ var PARA_CORE_VERSION = '1.4.4';
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.map(({ type }) => type) ?? [], wallet);
1359
+ return !this.#supportedWalletTypes || isWalletSupported(this.supportedWalletTypes?.map(({ type }) => type) ?? [], wallet);
1360
1360
  }
1361
1361
  isWalletOwned(wallet) {
1362
- return this.isWalletSupported(wallet) && !wallet.pregenIdentifier && !wallet.pregenIdentifierType && !!this.userId && wallet.userId === this.userId;
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.userId || wallet.isPregen && !!wallet.pregenIdentifier && !!wallet.pregenIdentifierType);
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.pregenIdentifierType) || isPregenIdentifierMatch(
1369
- wallet.pregenIdentifierType === "EMAIL" ? this.email : wallet.pregenIdentifierType === "TELEGRAM" ? this.telegramUserId : this.getPhoneNumber(),
1370
- wallet.pregenIdentifier,
1371
- wallet.pregenIdentifierType
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.id} cannot be selected`;
1382
+ error = `pre-generated wallet with id ${wallet?.id} cannot be selected`;
1383
1383
  } else if (!isOwned && !isUnclaimed) {
1384
- error = `wallet with id ${wallet.id} is not owned by the current user`;
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.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`;
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].address : Object.values(this.wallets)?.[0]?.address;
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);
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "1.4.4-dev.0",
3
+ "version": "1.4.4",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@celo/utils": "^8.0.0",
11
11
  "@cosmjs/encoding": "^0.32.4",
12
- "@getpara/user-management-client": "1.4.3",
12
+ "@getpara/user-management-client": "1.4.4",
13
13
  "@noble/hashes": "^1.5.0",
14
14
  "base64url": "^3.0.1",
15
15
  "ethereumjs-util": "7.1.5",
@@ -40,5 +40,5 @@
40
40
  "require": "./dist/cjs/index.js"
41
41
  }
42
42
  },
43
- "gitHead": "e6e791d4e4f9afd94f2093d6045d686b85e5a682"
43
+ "gitHead": "9a4086c4b352fff2143d3b931d288c5ebaf127fb"
44
44
  }