Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Reset Wallet Selection on Permission Failure (#222)
Browse files Browse the repository at this point in the history
* Reset Wallet Selection on Permission Failure

* Remove console log
  • Loading branch information
ricklove authored Mar 8, 2021
1 parent 62a7591 commit d7174e5
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions client/src/lib/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,21 @@ async function initWallet(

if (!activeAccount) {
if (forceConnect) {
await wallet.requestPermissions({
network: {
type:
system.config.network === 'edo2net'
? (system.config.network as NetworkType)
: network,
rpcUrl: system.config.rpc
}
});
try {
await wallet.requestPermissions({
network: {
type:
system.config.network === 'edo2net'
? (system.config.network as NetworkType)
: network,
rpcUrl: system.config.rpc
}
});
} catch (error) {
// requestPermissions failed - reset wallet selection
wallet.clearActiveAccount();
throw error;
}
} else {
return false;
}
Expand Down

0 comments on commit d7174e5

Please sign in to comment.