Skip to content

Commit 548ce78

Browse files
VanessaPCpczeglik-iohk
authored andcommitted
fix: lw-9273 handle successful confirmation window (#779)
1 parent 8d78ac1 commit 548ce78

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

apps/browser-extension-wallet/src/features/dapp/components/DappTransactionSuccess.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import Success from '../../../assets/icons/success-staking.svg';
66
import styles from './Layout.module.scss';
77
import { useAnalyticsContext } from '@providers';
88
import { TX_CREATION_TYPE_KEY, TxCreationType } from '@providers/AnalyticsProvider/analyticsTracker';
9+
import { useWalletManager } from '@hooks';
910

1011
export const DappTransactionSuccess = (): React.ReactElement => {
1112
const analytics = useAnalyticsContext();
1213
const { t } = useTranslation();
14+
const { clearPassword } = useWalletManager();
1315

1416
const onClose = async () => {
1517
await analytics?.sendEventToPostHog(PostHogAction.SendAllDoneCloseClick, {
@@ -18,6 +20,10 @@ export const DappTransactionSuccess = (): React.ReactElement => {
1820
window.close();
1921
};
2022

23+
useEffect(() => {
24+
clearPassword();
25+
}, [clearPassword]);
26+
2127
useEffect(() => {
2228
analytics?.sendEventToPostHog(PostHogAction.SendAllDoneView, {
2329
[TX_CREATION_TYPE_KEY]: TxCreationType.External

apps/browser-extension-wallet/src/hooks/useWalletManager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export interface UseWalletManager {
6060
saveHardwareWallet: (wallet: Wallet.CardanoWalletByChain, chainName?: Wallet.ChainName) => Promise<void>;
6161
deleteWallet: (isForgotPasswordFlow?: boolean) => Promise<void>;
6262
executeWithPassword: <T>(password: string, promiseFn: () => Promise<T>, cleanPassword?: boolean) => Promise<T>;
63+
clearPassword: () => void;
6364
switchNetwork: (chainName: Wallet.ChainName) => Promise<void>;
6465
updateAddresses: (args: {
6566
addresses: Wallet.KeyManagement.GroupedAddress[];
@@ -144,6 +145,13 @@ export const useWalletManager = (): UseWalletManager => {
144145
[backgroundService]
145146
);
146147

148+
/**
149+
* Clears the wallet password
150+
*/
151+
const clearPassword = useCallback(() => {
152+
backgroundService.setWalletPassword();
153+
}, [backgroundService]);
154+
147155
/**
148156
* Deletes wallet info in storage, which should be stored encrypted with the wallet password as lock
149157
*/
@@ -481,6 +489,7 @@ export const useWalletManager = (): UseWalletManager => {
481489
saveHardwareWallet,
482490
deleteWallet,
483491
executeWithPassword,
492+
clearPassword,
484493
switchNetwork,
485494
updateAddresses
486495
};

0 commit comments

Comments
 (0)