diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 09da8ee7e1b7..514d6d164d8d 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -1589,8 +1589,6 @@ export const getMemoizedUnapprovedTypedMessages = createDeepEqualSelector( (unapprovedTypedMessages) => unapprovedTypedMessages, ); -export const selectAddress = (_, address) => address; - /** * Get the display name for an address. * This selector will look into the internal accounts and address book to find a display name for the address. diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index b9c8846efd46..5bae5d22c432 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -2195,6 +2195,57 @@ describe('#getConnectedSitesList', () => { }); }); + describe('getAddressBookByNetwork', () => { + it('returns the address book for the given network', () => { + expect(selectors.getAddressBookByNetwork(mockState, '0x5')).toStrictEqual( + [ + { + address: '0xc42edfcc21ed14dda456aa0756c153f7985d8813', + chainId: '0x5', + isEns: false, + memo: '', + name: 'Address Book Account 1', + }, + ], + ); + }); + + it('returns an empty object if no address book is found for the given network', () => { + expect(selectors.getAddressBookByNetwork(mockState, '0x1')).toStrictEqual( + [], + ); + }); + }); + + describe('getAddressBookEntryByNetwork', () => { + it('returns the address book entry for the given network and address', () => { + expect( + selectors.getAddressBookEntryByNetwork( + mockState, + + '0xc42edfcc21ed14dda456aa0756c153f7985d8813', + '0x5', + ), + ).toStrictEqual({ + address: '0xc42edfcc21ed14dda456aa0756c153f7985d8813', + chainId: '0x5', + isEns: false, + memo: '', + name: 'Address Book Account 1', + }); + }); + + it('returns `undefined` if no entry is found for the given network and address', () => { + expect( + selectors.getAddressBookEntryByNetwork( + mockState, + '0xc42edfcc21ed14dda456aa0756c153f7985d8813', + '0x1', + ), + ).toBe(undefined); + }); + }); + describe('getAddressDisplayName', () => { it('returns the account name for a hex address', () => { expect(