Skip to content

Commit

Permalink
Merge pull request #399 from ergolabs/dev
Browse files Browse the repository at this point in the history
v1.2.8
  • Loading branch information
yasha-black authored Feb 16, 2022
2 parents 058f06a + 243dae3 commit dded0ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const ChooseWalletModal: React.FC<ChooseWalletModalProps> = ({

const handleWalletClick = (wallet: Wallet) => {
connectWallet(wallet).subscribe(
() => close(true),
(isConnected) => isConnected && close(true),
() => window.open(wallet.extensionLink),
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/network/ergo/wallets/NautilusWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const connectWallet = (): Observable<any> => {
}
return from(ergoConnector.nautilus.connect()).pipe(
tap(() => (window.nautilus = Object.freeze(new NautilusErgoApi()))),
catchError(() => of(true)),
catchError(() => of(false)),
);
};

Expand Down
14 changes: 10 additions & 4 deletions src/network/ergo/wallets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ export const connectWallet = (wallet: Wallet): Observable<any> => {

if (connectedWalletName) {
return combineLatest([wallet.connectWallet(), selectedWallet$]).pipe(
tap(([, selectedWallet]) => {
tap(([isConnected, selectedWallet]) => {
if (!isConnected) {
return;
}

if (selectedWallet?.onDisconnect) {
selectedWallet.onDisconnect();
}
Expand All @@ -52,9 +56,11 @@ export const connectWallet = (wallet: Wallet): Observable<any> => {

updateSelectedWallet$.next(undefined);
return wallet.connectWallet().pipe(
tap(() => {
walletSettings.setConnected(wallet.name);
updateSelectedWallet$.next(wallet.name);
tap((isConnected) => {
if (isConnected) {
walletSettings.setConnected(wallet.name);
updateSelectedWallet$.next(wallet.name);
}
}),
);
};
Expand Down

0 comments on commit dded0ed

Please sign in to comment.