mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Show account name when qr scan in send screen (#16204)
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
This commit is contained in:
parent
b1fd7f7796
commit
08ddd4fb0c
@ -3114,7 +3114,14 @@ describe('Send Slice', () => {
|
||||
expect(
|
||||
getSendTo({
|
||||
send: INITIAL_SEND_STATE_FOR_EXISTING_DRAFT,
|
||||
metamask: { ensResolutionsByAddress: {} },
|
||||
metamask: {
|
||||
ensResolutionsByAddress: {},
|
||||
identities: {},
|
||||
addressBook: {},
|
||||
provider: {
|
||||
chainId: '0x5',
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toBe('');
|
||||
expect(
|
||||
@ -3122,7 +3129,14 @@ describe('Send Slice', () => {
|
||||
send: getInitialSendStateWithExistingTxState({
|
||||
recipient: { address: '0xb' },
|
||||
}),
|
||||
metamask: { ensResolutionsByAddress: {} },
|
||||
metamask: {
|
||||
ensResolutionsByAddress: {},
|
||||
addressBook: {},
|
||||
identities: {},
|
||||
provider: {
|
||||
chainId: '0x5',
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toBe('0xb');
|
||||
});
|
||||
@ -3163,7 +3177,14 @@ describe('Send Slice', () => {
|
||||
expect(
|
||||
getRecipient({
|
||||
send: INITIAL_SEND_STATE_FOR_EXISTING_DRAFT,
|
||||
metamask: { ensResolutionsByAddress: {} },
|
||||
metamask: {
|
||||
ensResolutionsByAddress: {},
|
||||
identities: {},
|
||||
addressBook: {},
|
||||
provider: {
|
||||
chainId: '0x5',
|
||||
},
|
||||
},
|
||||
}),
|
||||
).toMatchObject(
|
||||
getTestUUIDTx(INITIAL_SEND_STATE_FOR_EXISTING_DRAFT).recipient,
|
||||
|
@ -392,7 +392,17 @@ export function getAddressBook(state) {
|
||||
}
|
||||
|
||||
export function getEnsResolutionByAddress(state, address) {
|
||||
return state.metamask.ensResolutionsByAddress[address] || '';
|
||||
if (state.metamask.ensResolutionsByAddress[address]) {
|
||||
return state.metamask.ensResolutionsByAddress[address];
|
||||
}
|
||||
|
||||
const entry =
|
||||
getAddressBookEntry(state, address) ||
|
||||
Object.values(state.metamask.identities).find((identity) =>
|
||||
isEqualCaseInsensitive(identity.address, toChecksumHexAddress(address)),
|
||||
);
|
||||
|
||||
return entry?.name || '';
|
||||
}
|
||||
|
||||
export function getAddressBookEntry(state, address) {
|
||||
|
Loading…
Reference in New Issue
Block a user