1
0
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:
amerkadicE 2022-11-30 16:24:28 +01:00 committed by GitHub
parent b1fd7f7796
commit 08ddd4fb0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 4 deletions

View File

@ -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,

View File

@ -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) {