Skip to content

Commit

Permalink
Merge pull request #46 from perawallet/next-release
Browse files Browse the repository at this point in the history
  • Loading branch information
mucahit authored Sep 16, 2022
2 parents 8f8d8a1 + dc4bf7c commit 46724ab
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@perawallet/connect",
"version": "0.2.2",
"version": "0.2.3",
"description": "JavaScript SDK for integrating Pera Wallet to web applications.",
"main": "dist/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/PeraWalletConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ class PeraWalletConnect {
}
}

disconnect() {
async disconnect() {
const killPromise = this.connector?.killSession();

killPromise?.then(() => {
this.connector = null;
});

resetWalletDetailsFromStorage();
await resetWalletDetailsFromStorage();

return killPromise;
}
Expand Down
13 changes: 10 additions & 3 deletions src/util/storage/storageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ function saveWalletDetailsToStorage(accounts: string[]) {
}

function resetWalletDetailsFromStorage() {
getLocalStorage()?.removeItem(PERA_WALLET_LOCAL_STORAGE_KEYS.WALLETCONNECT);
getLocalStorage()?.removeItem(PERA_WALLET_LOCAL_STORAGE_KEYS.WALLET);
getLocalStorage()?.removeItem(PERA_WALLET_LOCAL_STORAGE_KEYS.BRIDGE_URL);
return new Promise<undefined>((resolve, reject) => {
try {
getLocalStorage()?.removeItem(PERA_WALLET_LOCAL_STORAGE_KEYS.WALLETCONNECT);
getLocalStorage()?.removeItem(PERA_WALLET_LOCAL_STORAGE_KEYS.WALLET);
getLocalStorage()?.removeItem(PERA_WALLET_LOCAL_STORAGE_KEYS.BRIDGE_URL);
resolve(undefined);
} catch (error) {
reject(error);
}
});
}

export {getLocalStorage, saveWalletDetailsToStorage, resetWalletDetailsFromStorage};

0 comments on commit 46724ab

Please sign in to comment.