Skip to content

Commit

Permalink
feat(suite): reword evm legacy discovery acc err
Browse files Browse the repository at this point in the history
  • Loading branch information
enjojoy committed Oct 1, 2024
1 parent 2109d00 commit 5f6f057
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/suite/src/support/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,11 @@ export default defineMessages({
defaultMessage: 'Connection lost',
id: 'TR_CONNECTION_LOST',
},

TR_UPGRADE_FIRMWARE_TO_DISCOVER_ACCOUNT_ERROR: {
defaultMessage: 'Upgrade firmware to discover this account. (See the blue banner above.)',
id: 'TR_UPGRADE_FIRMWARE_TO_DISCOVER_ACCOUNT_ERROR',
},
TR_DISCONNECT: {
defaultMessage: 'Disconnect',
id: 'TR_DISCONNECT',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
authorizeDeviceThunk,
restartDiscoveryThunk as restartDiscovery,
} from '@suite-common/wallet-core';
import { getNetwork } from '@suite-common/wallet-config';
import { getNetwork, NetworkType } from '@suite-common/wallet-config';
import { variables, Button, H3, Image, IconName } from '@trezor/components';
import { Discovery } from '@suite-common/wallet-types';

Expand Down Expand Up @@ -102,11 +102,15 @@ const Container = ({ title, description, cta, dataTestBase }: ContainerProps) =>
);
};

const getAccountError = (accountError: string) => {
const getAccountError = (accountError: string, networkType: NetworkType) => {
if (accountError === 'All backends are down') {
return <Translation id="TR_CONNECTION_LOST" />;
}

if (networkType === 'ethereum' && accountError === 'Forbidden key path') {
return <Translation id="TR_UPGRADE_FIRMWARE_TO_DISCOVER_ACCOUNT_ERROR" />;
}

return accountError;
};

Expand All @@ -121,9 +125,13 @@ const discoveryFailedMessage = (discovery?: Discovery) => {
if (networkError.includes(account.symbol)) return value;
networkError.push(account.symbol);

const accountTypeDisplay =
account.accountType !== 'normal' ? ` ${account.accountType}` : '';

return value.concat(
<div key={account.symbol}>
{network.name}: {getAccountError(account.error)}
{network.name}
{accountTypeDisplay}: {getAccountError(account.error, network.networkType)}
</div>,
);
}, [] as JSX.Element[]);
Expand Down

0 comments on commit 5f6f057

Please sign in to comment.