@getpara/core-sdk 1.4.4 → 1.5.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/index.js +1 -24
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js +1 -24
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/types/ParaCore.d.ts +0 -6
- package/dist/types/constants.d.ts +0 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1016,7 +1016,7 @@ var TransactionReviewTimeout = class extends Error {
|
|
|
1016
1016
|
};
|
|
1017
1017
|
|
|
1018
1018
|
// src/constants.ts
|
|
1019
|
-
var PARA_CORE_VERSION = '1.
|
|
1019
|
+
var PARA_CORE_VERSION = '1.5.0';
|
|
1020
1020
|
var PREFIX = "@CAPSULE/";
|
|
1021
1021
|
var LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
1022
1022
|
var LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -1028,7 +1028,6 @@ var LOCAL_STORAGE_ED25519_WALLETS = `${PREFIX}ed25519Wallets`;
|
|
|
1028
1028
|
var LOCAL_STORAGE_WALLETS = `${PREFIX}wallets`;
|
|
1029
1029
|
var LOCAL_STORAGE_EXTERNAL_WALLETS = `${PREFIX}externalWallets`;
|
|
1030
1030
|
var LOCAL_STORAGE_CURRENT_WALLET_IDS = `${PREFIX}currentWalletIds`;
|
|
1031
|
-
var LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES = `${PREFIX}currentExternalWalletAddresses`;
|
|
1032
1031
|
var LOCAL_STORAGE_SESSION_COOKIE = `${PREFIX}sessionCookie`;
|
|
1033
1032
|
var SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = `${PREFIX}loginEncryptionKeyPair`;
|
|
1034
1033
|
var POLLING_INTERVAL_MS = 2e3;
|
|
@@ -1039,9 +1038,6 @@ function storageListener(e) {
|
|
|
1039
1038
|
if (!e.url.includes(window.location.origin)) {
|
|
1040
1039
|
return;
|
|
1041
1040
|
}
|
|
1042
|
-
if (e.key === LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES) {
|
|
1043
|
-
this.updateCurrentExternalWalletAddressesFromStorage();
|
|
1044
|
-
}
|
|
1045
1041
|
if (e.key === LOCAL_STORAGE_EXTERNAL_WALLETS) {
|
|
1046
1042
|
this.updateExternalWalletsFromStorage();
|
|
1047
1043
|
}
|
|
@@ -1151,7 +1147,6 @@ var ParaCore = class _ParaCore {
|
|
|
1151
1147
|
this.updateSessionCookieFromStorage();
|
|
1152
1148
|
this.updateLoginEncryptionKeyPairFromStorage();
|
|
1153
1149
|
this.updateExternalWalletsFromStorage();
|
|
1154
|
-
this.updateCurrentExternalWalletAddressesFromStorage();
|
|
1155
1150
|
};
|
|
1156
1151
|
this.updateTelegramUserIdFromStorage = () => {
|
|
1157
1152
|
this.telegramUserId = this.localStorageGetItem(LOCAL_STORAGE_TELEGRAM_USER_ID) || void 0;
|
|
@@ -1236,10 +1231,6 @@ var ParaCore = class _ParaCore {
|
|
|
1236
1231
|
const _externalWallets = JSON.parse(stringExternalWallets || "{}");
|
|
1237
1232
|
this.setExternalWallets(_externalWallets);
|
|
1238
1233
|
};
|
|
1239
|
-
this.updateCurrentExternalWalletAddressesFromStorage = () => {
|
|
1240
|
-
const _currentExternalWalletAddresses = this.localStorageGetItem(LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES) || void 0;
|
|
1241
|
-
this.currentExternalWalletAddresses = _currentExternalWalletAddresses ? JSON.parse(_currentExternalWalletAddresses) : void 0;
|
|
1242
|
-
};
|
|
1243
1234
|
/**
|
|
1244
1235
|
* Creates several new wallets with the desired types. If no types are provided, this method
|
|
1245
1236
|
* will create one for each of the non-optional types specified in the instance's `supportedWalletTypes`
|
|
@@ -1696,8 +1687,6 @@ var ParaCore = class _ParaCore {
|
|
|
1696
1687
|
const stringExternalWallets = await this.localStorageGetItem(LOCAL_STORAGE_EXTERNAL_WALLETS);
|
|
1697
1688
|
const _externalWallets = JSON.parse(stringExternalWallets || "{}");
|
|
1698
1689
|
await this.setExternalWallets(_externalWallets);
|
|
1699
|
-
const _currentExternalWalletAddresses = await this.localStorageGetItem(LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES) || void 0;
|
|
1700
|
-
this.currentExternalWalletAddresses = _currentExternalWalletAddresses ? JSON.parse(_currentExternalWalletAddresses) : void 0;
|
|
1701
1690
|
setupListeners.bind(this)();
|
|
1702
1691
|
await this.touchSession();
|
|
1703
1692
|
}
|
|
@@ -1752,8 +1741,6 @@ var ParaCore = class _ParaCore {
|
|
|
1752
1741
|
signer: ""
|
|
1753
1742
|
}
|
|
1754
1743
|
};
|
|
1755
|
-
this.currentExternalWalletAddresses = [address];
|
|
1756
|
-
this.setCurrentExternalWalletAddresses(this.currentExternalWalletAddresses);
|
|
1757
1744
|
this.setExternalWallets(this.externalWallets);
|
|
1758
1745
|
dispatchEvent(ParaEvent.EXTERNAL_WALLET_CHANGE_EVENT, null);
|
|
1759
1746
|
}
|
|
@@ -1785,13 +1772,6 @@ var ParaCore = class _ParaCore {
|
|
|
1785
1772
|
this.externalWallets = externalWallets;
|
|
1786
1773
|
await this.localStorageSetItem(LOCAL_STORAGE_EXTERNAL_WALLETS, JSON.stringify(externalWallets));
|
|
1787
1774
|
}
|
|
1788
|
-
async setCurrentExternalWalletAddresses(currentExternalWalletAddresses) {
|
|
1789
|
-
this.currentExternalWalletAddresses = currentExternalWalletAddresses;
|
|
1790
|
-
await this.localStorageSetItem(
|
|
1791
|
-
LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES,
|
|
1792
|
-
JSON.stringify(currentExternalWalletAddresses)
|
|
1793
|
-
);
|
|
1794
|
-
}
|
|
1795
1775
|
/**
|
|
1796
1776
|
* Sets the login encryption key pair associated with the `ParaCore` instance.
|
|
1797
1777
|
* @param keyPair - Encryption key pair generated from loginEncryptionKey.
|
|
@@ -2534,7 +2514,6 @@ var ParaCore = class _ParaCore {
|
|
|
2534
2514
|
**/
|
|
2535
2515
|
async waitForAccountCreation({ popupWindow } = {}) {
|
|
2536
2516
|
await this.touchSession();
|
|
2537
|
-
this.currentExternalWalletAddresses = void 0;
|
|
2538
2517
|
this.externalWallets = {};
|
|
2539
2518
|
this.isAwaitingAccountCreation = true;
|
|
2540
2519
|
while (this.isAwaitingAccountCreation) {
|
|
@@ -2690,7 +2669,6 @@ var ParaCore = class _ParaCore {
|
|
|
2690
2669
|
popupWindow,
|
|
2691
2670
|
skipSessionRefresh = false
|
|
2692
2671
|
} = {}) {
|
|
2693
|
-
this.currentExternalWalletAddresses = void 0;
|
|
2694
2672
|
this.externalWallets = {};
|
|
2695
2673
|
this.isAwaitingLogin = true;
|
|
2696
2674
|
while (this.isAwaitingLogin) {
|
|
@@ -3654,7 +3632,6 @@ var ParaCore = class _ParaCore {
|
|
|
3654
3632
|
this.wallets = {};
|
|
3655
3633
|
}
|
|
3656
3634
|
this.currentWalletIds = {};
|
|
3657
|
-
this.currentExternalWalletAddresses = void 0;
|
|
3658
3635
|
this.externalWallets = {};
|
|
3659
3636
|
this.loginEncryptionKeyPair = void 0;
|
|
3660
3637
|
this.email = void 0;
|
package/dist/cjs/index.js.br
CHANGED
|
Binary file
|
package/dist/cjs/index.js.gz
CHANGED
|
Binary file
|
package/dist/esm/index.js
CHANGED
|
@@ -932,7 +932,7 @@ var TransactionReviewTimeout = class extends Error {
|
|
|
932
932
|
};
|
|
933
933
|
|
|
934
934
|
// src/constants.ts
|
|
935
|
-
var PARA_CORE_VERSION = '1.
|
|
935
|
+
var PARA_CORE_VERSION = '1.5.0';
|
|
936
936
|
var PREFIX = "@CAPSULE/";
|
|
937
937
|
var LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
|
938
938
|
var LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
|
|
@@ -944,7 +944,6 @@ var LOCAL_STORAGE_ED25519_WALLETS = `${PREFIX}ed25519Wallets`;
|
|
|
944
944
|
var LOCAL_STORAGE_WALLETS = `${PREFIX}wallets`;
|
|
945
945
|
var LOCAL_STORAGE_EXTERNAL_WALLETS = `${PREFIX}externalWallets`;
|
|
946
946
|
var LOCAL_STORAGE_CURRENT_WALLET_IDS = `${PREFIX}currentWalletIds`;
|
|
947
|
-
var LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES = `${PREFIX}currentExternalWalletAddresses`;
|
|
948
947
|
var LOCAL_STORAGE_SESSION_COOKIE = `${PREFIX}sessionCookie`;
|
|
949
948
|
var SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = `${PREFIX}loginEncryptionKeyPair`;
|
|
950
949
|
var POLLING_INTERVAL_MS = 2e3;
|
|
@@ -955,9 +954,6 @@ function storageListener(e) {
|
|
|
955
954
|
if (!e.url.includes(window.location.origin)) {
|
|
956
955
|
return;
|
|
957
956
|
}
|
|
958
|
-
if (e.key === LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES) {
|
|
959
|
-
this.updateCurrentExternalWalletAddressesFromStorage();
|
|
960
|
-
}
|
|
961
957
|
if (e.key === LOCAL_STORAGE_EXTERNAL_WALLETS) {
|
|
962
958
|
this.updateExternalWalletsFromStorage();
|
|
963
959
|
}
|
|
@@ -1067,7 +1063,6 @@ var ParaCore = class _ParaCore {
|
|
|
1067
1063
|
this.updateSessionCookieFromStorage();
|
|
1068
1064
|
this.updateLoginEncryptionKeyPairFromStorage();
|
|
1069
1065
|
this.updateExternalWalletsFromStorage();
|
|
1070
|
-
this.updateCurrentExternalWalletAddressesFromStorage();
|
|
1071
1066
|
};
|
|
1072
1067
|
this.updateTelegramUserIdFromStorage = () => {
|
|
1073
1068
|
this.telegramUserId = this.localStorageGetItem(LOCAL_STORAGE_TELEGRAM_USER_ID) || void 0;
|
|
@@ -1152,10 +1147,6 @@ var ParaCore = class _ParaCore {
|
|
|
1152
1147
|
const _externalWallets = JSON.parse(stringExternalWallets || "{}");
|
|
1153
1148
|
this.setExternalWallets(_externalWallets);
|
|
1154
1149
|
};
|
|
1155
|
-
this.updateCurrentExternalWalletAddressesFromStorage = () => {
|
|
1156
|
-
const _currentExternalWalletAddresses = this.localStorageGetItem(LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES) || void 0;
|
|
1157
|
-
this.currentExternalWalletAddresses = _currentExternalWalletAddresses ? JSON.parse(_currentExternalWalletAddresses) : void 0;
|
|
1158
|
-
};
|
|
1159
1150
|
/**
|
|
1160
1151
|
* Creates several new wallets with the desired types. If no types are provided, this method
|
|
1161
1152
|
* will create one for each of the non-optional types specified in the instance's `supportedWalletTypes`
|
|
@@ -1612,8 +1603,6 @@ var ParaCore = class _ParaCore {
|
|
|
1612
1603
|
const stringExternalWallets = await this.localStorageGetItem(LOCAL_STORAGE_EXTERNAL_WALLETS);
|
|
1613
1604
|
const _externalWallets = JSON.parse(stringExternalWallets || "{}");
|
|
1614
1605
|
await this.setExternalWallets(_externalWallets);
|
|
1615
|
-
const _currentExternalWalletAddresses = await this.localStorageGetItem(LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES) || void 0;
|
|
1616
|
-
this.currentExternalWalletAddresses = _currentExternalWalletAddresses ? JSON.parse(_currentExternalWalletAddresses) : void 0;
|
|
1617
1606
|
setupListeners.bind(this)();
|
|
1618
1607
|
await this.touchSession();
|
|
1619
1608
|
}
|
|
@@ -1668,8 +1657,6 @@ var ParaCore = class _ParaCore {
|
|
|
1668
1657
|
signer: ""
|
|
1669
1658
|
}
|
|
1670
1659
|
};
|
|
1671
|
-
this.currentExternalWalletAddresses = [address];
|
|
1672
|
-
this.setCurrentExternalWalletAddresses(this.currentExternalWalletAddresses);
|
|
1673
1660
|
this.setExternalWallets(this.externalWallets);
|
|
1674
1661
|
dispatchEvent(ParaEvent.EXTERNAL_WALLET_CHANGE_EVENT, null);
|
|
1675
1662
|
}
|
|
@@ -1701,13 +1688,6 @@ var ParaCore = class _ParaCore {
|
|
|
1701
1688
|
this.externalWallets = externalWallets;
|
|
1702
1689
|
await this.localStorageSetItem(LOCAL_STORAGE_EXTERNAL_WALLETS, JSON.stringify(externalWallets));
|
|
1703
1690
|
}
|
|
1704
|
-
async setCurrentExternalWalletAddresses(currentExternalWalletAddresses) {
|
|
1705
|
-
this.currentExternalWalletAddresses = currentExternalWalletAddresses;
|
|
1706
|
-
await this.localStorageSetItem(
|
|
1707
|
-
LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES,
|
|
1708
|
-
JSON.stringify(currentExternalWalletAddresses)
|
|
1709
|
-
);
|
|
1710
|
-
}
|
|
1711
1691
|
/**
|
|
1712
1692
|
* Sets the login encryption key pair associated with the `ParaCore` instance.
|
|
1713
1693
|
* @param keyPair - Encryption key pair generated from loginEncryptionKey.
|
|
@@ -2450,7 +2430,6 @@ var ParaCore = class _ParaCore {
|
|
|
2450
2430
|
**/
|
|
2451
2431
|
async waitForAccountCreation({ popupWindow } = {}) {
|
|
2452
2432
|
await this.touchSession();
|
|
2453
|
-
this.currentExternalWalletAddresses = void 0;
|
|
2454
2433
|
this.externalWallets = {};
|
|
2455
2434
|
this.isAwaitingAccountCreation = true;
|
|
2456
2435
|
while (this.isAwaitingAccountCreation) {
|
|
@@ -2606,7 +2585,6 @@ var ParaCore = class _ParaCore {
|
|
|
2606
2585
|
popupWindow,
|
|
2607
2586
|
skipSessionRefresh = false
|
|
2608
2587
|
} = {}) {
|
|
2609
|
-
this.currentExternalWalletAddresses = void 0;
|
|
2610
2588
|
this.externalWallets = {};
|
|
2611
2589
|
this.isAwaitingLogin = true;
|
|
2612
2590
|
while (this.isAwaitingLogin) {
|
|
@@ -3570,7 +3548,6 @@ var ParaCore = class _ParaCore {
|
|
|
3570
3548
|
this.wallets = {};
|
|
3571
3549
|
}
|
|
3572
3550
|
this.currentWalletIds = {};
|
|
3573
|
-
this.currentExternalWalletAddresses = void 0;
|
|
3574
3551
|
this.externalWallets = {};
|
|
3575
3552
|
this.loginEncryptionKeyPair = void 0;
|
|
3576
3553
|
this.email = void 0;
|
package/dist/esm/index.js.br
CHANGED
|
Binary file
|
package/dist/esm/index.js.gz
CHANGED
|
Binary file
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -32,10 +32,6 @@ export declare abstract class ParaCore {
|
|
|
32
32
|
* Wallets associated with the `ParaCore` instance. Retrieve a particular wallet using `para.wallets[walletId]`.
|
|
33
33
|
*/
|
|
34
34
|
wallets: Record<string, Wallet>;
|
|
35
|
-
/**
|
|
36
|
-
* The addresses of the currently active external wallets.
|
|
37
|
-
*/
|
|
38
|
-
currentExternalWalletAddresses?: string[];
|
|
39
35
|
/**
|
|
40
36
|
* Wallets associated with the `ParaCore` instance.
|
|
41
37
|
*/
|
|
@@ -182,7 +178,6 @@ export declare abstract class ParaCore {
|
|
|
182
178
|
private updateSessionCookieFromStorage;
|
|
183
179
|
private updateLoginEncryptionKeyPairFromStorage;
|
|
184
180
|
private updateExternalWalletsFromStorage;
|
|
185
|
-
private updateCurrentExternalWalletAddressesFromStorage;
|
|
186
181
|
touchSession(regenerate?: boolean): Promise<Awaited<ReturnType<Client['touchSession']>>>;
|
|
187
182
|
private setSupportedWalletTypes;
|
|
188
183
|
private getVerificationEmailProps;
|
|
@@ -235,7 +230,6 @@ export declare abstract class ParaCore {
|
|
|
235
230
|
* @param externalWallets - External wallets to set.
|
|
236
231
|
*/
|
|
237
232
|
setExternalWallets(externalWallets: Record<string, Wallet>): Promise<void>;
|
|
238
|
-
setCurrentExternalWalletAddresses(currentExternalWalletAddresses: string[]): Promise<void>;
|
|
239
233
|
/**
|
|
240
234
|
* Sets the login encryption key pair associated with the `ParaCore` instance.
|
|
241
235
|
* @param keyPair - Encryption key pair generated from loginEncryptionKey.
|
|
@@ -10,7 +10,6 @@ export declare const LOCAL_STORAGE_ED25519_WALLETS: string;
|
|
|
10
10
|
export declare const LOCAL_STORAGE_WALLETS: string;
|
|
11
11
|
export declare const LOCAL_STORAGE_EXTERNAL_WALLETS: string;
|
|
12
12
|
export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS: string;
|
|
13
|
-
export declare const LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES: string;
|
|
14
13
|
export declare const LOCAL_STORAGE_SESSION_COOKIE: string;
|
|
15
14
|
export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR: string;
|
|
16
15
|
export declare const POLLING_INTERVAL_MS = 2000;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
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.
|
|
12
|
+
"@getpara/user-management-client": "1.5.0",
|
|
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": "
|
|
43
|
+
"gitHead": "0e3c1401b4f1da60b288cdde7695077c9bcbc48f"
|
|
44
44
|
}
|