Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions ui/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2888,16 +2888,22 @@ export function getShouldShowSeedPhraseReminder(state) {
const { tokens, seedPhraseBackedUp, dismissSeedBackUpReminder } =
state.metamask;

const currentKeyring = getCurrentKeyring(state);
const isNativeAccount =
currentKeyring?.type && currentKeyring.type === KeyringType.hdKeyTree;

// if there is no account, we don't need to show the seed phrase reminder
const accountBalance = getSelectedInternalAccount(state)
? getCurrentEthBalance(state)
: 0;

return (
const showMessage =
seedPhraseBackedUp === false &&
(parseInt(accountBalance, 16) > 0 || tokens.length > 0) &&
dismissSeedBackUpReminder === false
);
dismissSeedBackUpReminder === false &&
isNativeAccount;

return showMessage;
}

export function getUnconnectedAccounts(state, activeTab) {
Expand Down
40 changes: 40 additions & 0 deletions ui/selectors/selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,46 @@ describe('Selectors', () => {
});
});

describe('#getShouldShowSeedPhraseReminder', () => {
it('returns true if the account is a native account', () => {
const state = {
...mockState,
metamask: {
...mockState.metamask,
seedPhraseBackedUp: false,
},
};
expect(selectors.getShouldShowSeedPhraseReminder(state)).toBe(true);
});

it('returns false if the account is not native', () => {
const state = {
...mockState,
metamask: {
...mockState.metamask,
seedPhraseBackedUp: false,
internalAccounts: {
...mockState.metamask.internalAccounts,
accounts: {
...mockState.metamask.internalAccounts.accounts,
'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3': {
...mockState.metamask.internalAccounts.accounts[
'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3'
],
metadata: {
keyring: {
type: KeyringType.imported,
},
},
},
},
},
},
};
expect(selectors.getShouldShowSeedPhraseReminder(state)).toBe(false);
});
});

describe('#getNetworkToAutomaticallySwitchTo', () => {
const SELECTED_ORIGIN = 'https://portfolio.metamask.io';
const SELECTED_ORIGIN_NETWORK_ID = NETWORK_TYPES.LINEA_SEPOLIA;
Expand Down
Loading