From 582fc9ab70575c0c9571f60c5f7dc051d8c5c8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20V=C3=A1clav=C3=ADk?= Date: Fri, 17 May 2024 14:05:59 +0200 Subject: [PATCH] feat(suite): Distinguish between standard/passphrase wallet --- .../suite/SwitchDevice/DeviceItem/AddWalletButton.tsx | 10 +++++----- .../views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/AddWalletButton.tsx b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/AddWalletButton.tsx index 168ec5ff1d1..bab400ec6f4 100644 --- a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/AddWalletButton.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/AddWalletButton.tsx @@ -21,7 +21,7 @@ const StyledTooltip = styled(Tooltip)` interface AddWalletButtonProps { device: TrezorDevice; instances: AcquiredDevice[]; - addDeviceInstance: (instance: TrezorDevice) => Promise; + addDeviceInstance: (instance: TrezorDevice, useEmptyPassphrase?: boolean) => Promise; selectDeviceInstance: (instance: TrezorDevice) => void; } @@ -45,9 +45,9 @@ export const AddWalletButton = ({ locks.includes(SUITE.LOCK_TYPE.DEVICE) || locks.includes(SUITE.LOCK_TYPE.UI); - const onAddWallet = () => { + const onAddWallet = ({ useEmptyPassphrase }: { useEmptyPassphrase: boolean }) => { if (hasAtLeastOneWallet) { - addDeviceInstance(device); + addDeviceInstance(device, useEmptyPassphrase); } else { selectDeviceInstance(instances[0]); } @@ -68,7 +68,7 @@ export const AddWalletButton = ({ isFullWidth icon="PLUS" isDisabled={isLocked} - onClick={onAddWallet} + onClick={() => onAddWallet({ useEmptyPassphrase: true })} > @@ -80,7 +80,7 @@ export const AddWalletButton = ({ isFullWidth icon="PLUS" isDisabled={isLocked} - onClick={onAddWallet} + onClick={() => onAddWallet({ useEmptyPassphrase: false })} > diff --git a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx index 8d7ae6044f4..e13826978ee 100644 --- a/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx +++ b/packages/suite/src/views/suite/SwitchDevice/DeviceItem/DeviceItem.tsx @@ -70,8 +70,11 @@ export const DeviceItem = ({ device, instances, onCancel, backgroundRoute }: Dev handleRedirection(); }; - const addDeviceInstance = async (instance: DeviceItemProps['device']) => { - await dispatch(createDeviceInstance({ device: instance })); + const addDeviceInstance = async ( + instance: DeviceItemProps['device'], + useEmptyPassphrase?: boolean, + ) => { + await dispatch(createDeviceInstance({ device: instance, useEmptyPassphrase })); handleRedirection(); };