@getpara/core-sdk 2.0.0-alpha.66 → 2.0.0-alpha.67

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.
@@ -708,6 +708,9 @@ const _ParaCore = class _ParaCore {
708
708
  }
709
709
  return true;
710
710
  }
711
+ truncateAddress(...args) {
712
+ return (0, import_utils2.truncateAddress)(args[0], args[1], __spreadValues({ prefix: this.cosmosPrefix }, args[2] || {}));
713
+ }
711
714
  /**
712
715
  * Returns the formatted address for the desired wallet ID, depending on your app settings.
713
716
  * @param {string} walletId the ID of the wallet address to display.
@@ -1461,15 +1464,27 @@ Need help? Visit: https://docs.getpara.com or contact support
1461
1464
  ...[...this.currentWalletIdsArray, ...__privateGet(this, _ParaCore_instances, guestWalletIdsArray_get)].map(([address, type]) => [address, type, false]).map(([id, type]) => {
1462
1465
  const wallet = this.findWallet(id, type);
1463
1466
  if (!wallet) return null;
1467
+ const name = wallet.name;
1468
+ const address = this.getDisplayAddress(id, { addressType: type });
1469
+ const addressShort = this.getDisplayAddress(id, { addressType: type, truncate: true });
1464
1470
  return {
1465
1471
  id: wallet.id,
1466
1472
  partner: wallet.partner,
1467
1473
  type,
1468
- address: this.getDisplayAddress(id, { addressType: type }),
1469
- name: wallet.name
1474
+ address,
1475
+ name,
1476
+ addressShort,
1477
+ displayName: name != null ? name : addressShort,
1478
+ ensName: wallet.ensName,
1479
+ ensAvatar: wallet.ensAvatar
1470
1480
  };
1471
1481
  }).filter((obj) => obj !== null),
1472
- ...Object.values((_a = this.externalWallets) != null ? _a : {})
1482
+ ...Object.values((_a = this.externalWallets) != null ? _a : {}).map((wallet) => {
1483
+ return __spreadProps(__spreadValues({}, wallet), {
1484
+ addressShort: (0, import_utils2.truncateAddress)(wallet.address, wallet.type, { prefix: this.cosmosPrefix }),
1485
+ displayName: wallet.externalProviderId
1486
+ });
1487
+ })
1473
1488
  ];
1474
1489
  }
1475
1490
  /**
@@ -1856,8 +1871,12 @@ Need help? Visit: https://docs.getpara.com or contact support
1856
1871
  const requiredWalletTypes = supportedWalletTypes.filter(({ optional }) => !optional);
1857
1872
  for (const { type } of requiredWalletTypes) {
1858
1873
  const hasWalletForType = this.currentWalletIdsArray.some(([walletId, walletType]) => {
1859
- const wallet = this.wallets[walletId];
1860
- return wallet && walletType === type;
1874
+ try {
1875
+ const wallet = this.wallets[walletId];
1876
+ return wallet && walletType === type && typeof wallet.address === "string";
1877
+ } catch (e) {
1878
+ return false;
1879
+ }
1861
1880
  });
1862
1881
  if (!hasWalletForType) {
1863
1882
  return false;
@@ -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.66";
46
+ const PARA_CORE_VERSION = "2.0.0-alpha.67";
47
47
  const PREFIX = "@CAPSULE/";
48
48
  const PARA_PREFIX = "@PARA/";
49
49
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -674,6 +674,9 @@ const _ParaCore = class _ParaCore {
674
674
  }
675
675
  return true;
676
676
  }
677
+ truncateAddress(...args) {
678
+ return truncateAddress(args[0], args[1], __spreadValues({ prefix: this.cosmosPrefix }, args[2] || {}));
679
+ }
677
680
  /**
678
681
  * Returns the formatted address for the desired wallet ID, depending on your app settings.
679
682
  * @param {string} walletId the ID of the wallet address to display.
@@ -1427,15 +1430,27 @@ Need help? Visit: https://docs.getpara.com or contact support
1427
1430
  ...[...this.currentWalletIdsArray, ...__privateGet(this, _ParaCore_instances, guestWalletIdsArray_get)].map(([address, type]) => [address, type, false]).map(([id, type]) => {
1428
1431
  const wallet = this.findWallet(id, type);
1429
1432
  if (!wallet) return null;
1433
+ const name = wallet.name;
1434
+ const address = this.getDisplayAddress(id, { addressType: type });
1435
+ const addressShort = this.getDisplayAddress(id, { addressType: type, truncate: true });
1430
1436
  return {
1431
1437
  id: wallet.id,
1432
1438
  partner: wallet.partner,
1433
1439
  type,
1434
- address: this.getDisplayAddress(id, { addressType: type }),
1435
- name: wallet.name
1440
+ address,
1441
+ name,
1442
+ addressShort,
1443
+ displayName: name != null ? name : addressShort,
1444
+ ensName: wallet.ensName,
1445
+ ensAvatar: wallet.ensAvatar
1436
1446
  };
1437
1447
  }).filter((obj) => obj !== null),
1438
- ...Object.values((_a = this.externalWallets) != null ? _a : {})
1448
+ ...Object.values((_a = this.externalWallets) != null ? _a : {}).map((wallet) => {
1449
+ return __spreadProps(__spreadValues({}, wallet), {
1450
+ addressShort: truncateAddress(wallet.address, wallet.type, { prefix: this.cosmosPrefix }),
1451
+ displayName: wallet.externalProviderId
1452
+ });
1453
+ })
1439
1454
  ];
1440
1455
  }
1441
1456
  /**
@@ -1822,8 +1837,12 @@ Need help? Visit: https://docs.getpara.com or contact support
1822
1837
  const requiredWalletTypes = supportedWalletTypes.filter(({ optional }) => !optional);
1823
1838
  for (const { type } of requiredWalletTypes) {
1824
1839
  const hasWalletForType = this.currentWalletIdsArray.some(([walletId, walletType]) => {
1825
- const wallet = this.wallets[walletId];
1826
- return wallet && walletType === type;
1840
+ try {
1841
+ const wallet = this.wallets[walletId];
1842
+ return wallet && walletType === type && typeof wallet.address === "string";
1843
+ } catch (e) {
1844
+ return false;
1845
+ }
1827
1846
  });
1828
1847
  if (!hasWalletForType) {
1829
1848
  return false;
@@ -1,5 +1,5 @@
1
1
  import "./chunk-W5CT3TVS.js";
2
- const PARA_CORE_VERSION = "2.0.0-alpha.66";
2
+ const PARA_CORE_VERSION = "2.0.0-alpha.67";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -172,6 +172,7 @@ export declare abstract class ParaCore implements CoreInterface {
172
172
  private isPregenWalletUnclaimed;
173
173
  private isPregenWalletClaimable;
174
174
  private isWalletUsable;
175
+ private truncateAddress;
175
176
  /**
176
177
  * Returns the formatted address for the desired wallet ID, depending on your app settings.
177
178
  * @param {string} walletId the ID of the wallet address to display.
@@ -26,7 +26,10 @@ export interface Wallet extends Omit<IWalletEntity, 'createdAt' | 'updatedAt' |
26
26
  ensName?: string | null;
27
27
  ensAvatar?: string | null;
28
28
  }
29
- export type AvailableWallet = Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'partner' | 'isExternal' | 'externalProviderId' | 'isExternalConnectionOnly'>;
29
+ export type AvailableWallet = Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'partner' | 'ensName' | 'ensAvatar' | 'isExternal' | 'externalProviderId' | 'isExternalConnectionOnly'> & {
30
+ addressShort?: string;
31
+ displayName?: string;
32
+ };
30
33
  /** @deprecated */
31
34
  export declare enum PregenIdentifierType {
32
35
  EMAIL = "EMAIL",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.0.0-alpha.66",
3
+ "version": "2.0.0-alpha.67",
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.66",
8
+ "@getpara/user-management-client": "2.0.0-alpha.67",
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": "07c8b7b68aa36dec6071e3b3b3a66de2870312c8",
30
+ "gitHead": "0266cc49e978575fed0b12c9bb0c832651e140eb",
31
31
  "main": "dist/cjs/index.js",
32
32
  "module": "dist/esm/index.js",
33
33
  "scripts": {