Skip to content

Commit ecef838

Browse files
committed
feat: update hardware wallet restoration
1 parent e480e84 commit ecef838

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

apps/browser-extension-wallet/src/features/unlock-wallet/components/UnlockWalletContainer.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ export interface UnlockWalletContainerProps {
1919
export const UnlockWalletContainer = ({ validateMnemonic }: UnlockWalletContainerProps): React.ReactElement => {
2020
const analytics = useAnalyticsContext();
2121
const { unlockWallet, lockWallet, deleteWallet } = useWalletManager();
22-
const { environmentName, setKeyAgentData, setDeletingWallet, inMemoryWallet, setAddressesDiscoveryCompleted } =
23-
useWalletStore();
22+
const { environmentName, setKeyAgentData, setDeletingWallet, setAddressesDiscoveryCompleted } = useWalletStore();
2423
const backgroundService = useBackgroundServiceAPIContext();
2524

2625
const [isVerifyingPassword, setIsVerifyingPassword] = useState(false);
@@ -67,10 +66,7 @@ export const UnlockWalletContainer = ({ validateMnemonic }: UnlockWalletContaine
6766
setIsValidPassword(true);
6867
analytics.sendEventToPostHog(PostHogAction.UnlockWalletWelcomeBackUnlockClick);
6968
if (decrypted) setUnlocked(decrypted);
70-
inMemoryWallet
71-
.discoverAddresses()
72-
.then(() => setAddressesDiscoveryCompleted(true))
73-
.catch(() => setAddressesDiscoveryCompleted(false));
69+
setAddressesDiscoveryCompleted(true);
7470
} catch {
7571
setIsValidPassword(false);
7672
}

packages/cardano/src/wallet/lib/hardware-wallet.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,8 @@ export const createHardwareWalletsByChain = async (
107107
.filter(([chainName]) => chainName !== activeChainName)
108108
.map(async ([chainName, chainId]) => {
109109
// Create a key agent for each chain id to save in storage
110-
const { keyAgent } = await setup({ chainId, connectedDevice });
111-
112110
// Build object with key agents for all chains to be able to switch to eventually
113-
keyAgentsByChain[chainName as ChainName] = { keyAgentData: keyAgent.serializableData };
111+
keyAgentsByChain[chainName as ChainName] = { keyAgentData: { ...activeKeyAgent.serializableData, chainId } };
114112
})
115113
);
116114

0 commit comments

Comments
 (0)