@getpara/core-sdk 2.0.0-alpha.65 → 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.
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -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
|
|
1469
|
-
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
|
/**
|
|
@@ -1846,7 +1861,28 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1846
1861
|
if (this.isSwitchingWallets) {
|
|
1847
1862
|
return isSessionActive;
|
|
1848
1863
|
}
|
|
1849
|
-
|
|
1864
|
+
if (!isSessionActive) {
|
|
1865
|
+
return false;
|
|
1866
|
+
}
|
|
1867
|
+
if (this.isNoWalletConfig) {
|
|
1868
|
+
return true;
|
|
1869
|
+
}
|
|
1870
|
+
const { supportedWalletTypes } = yield __privateMethod(this, _ParaCore_instances, assertPartner_fn).call(this);
|
|
1871
|
+
const requiredWalletTypes = supportedWalletTypes.filter(({ optional }) => !optional);
|
|
1872
|
+
for (const { type } of requiredWalletTypes) {
|
|
1873
|
+
const hasWalletForType = this.currentWalletIdsArray.some(([walletId, walletType]) => {
|
|
1874
|
+
try {
|
|
1875
|
+
const wallet = this.wallets[walletId];
|
|
1876
|
+
return wallet && walletType === type && typeof wallet.address === "string";
|
|
1877
|
+
} catch (e) {
|
|
1878
|
+
return false;
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
if (!hasWalletForType) {
|
|
1882
|
+
return false;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
return true;
|
|
1850
1886
|
});
|
|
1851
1887
|
}
|
|
1852
1888
|
get isGuestMode() {
|
|
@@ -3270,7 +3306,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
3270
3306
|
return { credentialId };
|
|
3271
3307
|
}
|
|
3272
3308
|
const { sessionId } = yield this.touchSession();
|
|
3273
|
-
const url = yield this.constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
|
|
3309
|
+
const url = (isForNewDevice || urlType) && (yield this.constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
|
|
3274
3310
|
isForNewDevice,
|
|
3275
3311
|
pathId: credentialId,
|
|
3276
3312
|
portalTheme,
|
|
@@ -3279,7 +3315,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
3279
3315
|
addNewCredentialType: optsAuthMethod,
|
|
3280
3316
|
addNewCredentialPasskeyId: passkeyId,
|
|
3281
3317
|
addNewCredentialPasswordId: passwordId
|
|
3282
|
-
});
|
|
3318
|
+
}));
|
|
3283
3319
|
return __spreadValues({ credentialId }, url ? { url } : {});
|
|
3284
3320
|
});
|
|
3285
3321
|
}
|
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.67";
|
|
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
|
@@ -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
|
|
1435
|
-
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
|
/**
|
|
@@ -1812,7 +1827,28 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
1812
1827
|
if (this.isSwitchingWallets) {
|
|
1813
1828
|
return isSessionActive;
|
|
1814
1829
|
}
|
|
1815
|
-
|
|
1830
|
+
if (!isSessionActive) {
|
|
1831
|
+
return false;
|
|
1832
|
+
}
|
|
1833
|
+
if (this.isNoWalletConfig) {
|
|
1834
|
+
return true;
|
|
1835
|
+
}
|
|
1836
|
+
const { supportedWalletTypes } = yield __privateMethod(this, _ParaCore_instances, assertPartner_fn).call(this);
|
|
1837
|
+
const requiredWalletTypes = supportedWalletTypes.filter(({ optional }) => !optional);
|
|
1838
|
+
for (const { type } of requiredWalletTypes) {
|
|
1839
|
+
const hasWalletForType = this.currentWalletIdsArray.some(([walletId, walletType]) => {
|
|
1840
|
+
try {
|
|
1841
|
+
const wallet = this.wallets[walletId];
|
|
1842
|
+
return wallet && walletType === type && typeof wallet.address === "string";
|
|
1843
|
+
} catch (e) {
|
|
1844
|
+
return false;
|
|
1845
|
+
}
|
|
1846
|
+
});
|
|
1847
|
+
if (!hasWalletForType) {
|
|
1848
|
+
return false;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
return true;
|
|
1816
1852
|
});
|
|
1817
1853
|
}
|
|
1818
1854
|
get isGuestMode() {
|
|
@@ -3236,7 +3272,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
3236
3272
|
return { credentialId };
|
|
3237
3273
|
}
|
|
3238
3274
|
const { sessionId } = yield this.touchSession();
|
|
3239
|
-
const url = yield this.constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
|
|
3275
|
+
const url = (isForNewDevice || urlType) && (yield this.constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
|
|
3240
3276
|
isForNewDevice,
|
|
3241
3277
|
pathId: credentialId,
|
|
3242
3278
|
portalTheme,
|
|
@@ -3245,7 +3281,7 @@ Need help? Visit: https://docs.getpara.com or contact support
|
|
|
3245
3281
|
addNewCredentialType: optsAuthMethod,
|
|
3246
3282
|
addNewCredentialPasskeyId: passkeyId,
|
|
3247
3283
|
addNewCredentialPasswordId: passwordId
|
|
3248
|
-
});
|
|
3284
|
+
}));
|
|
3249
3285
|
return __spreadValues({ credentialId }, url ? { url } : {});
|
|
3250
3286
|
});
|
|
3251
3287
|
}
|
package/dist/esm/constants.js
CHANGED
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
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": "
|
|
30
|
+
"gitHead": "0266cc49e978575fed0b12c9bb0c832651e140eb",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|