mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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(
|
expect(
|
||||||
getSendTo({
|
getSendTo({
|
||||||
send: INITIAL_SEND_STATE_FOR_EXISTING_DRAFT,
|
send: INITIAL_SEND_STATE_FOR_EXISTING_DRAFT,
|
||||||
metamask: { ensResolutionsByAddress: {} },
|
metamask: {
|
||||||
|
ensResolutionsByAddress: {},
|
||||||
|
identities: {},
|
||||||
|
addressBook: {},
|
||||||
|
provider: {
|
||||||
|
chainId: '0x5',
|
||||||
|
},
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
).toBe('');
|
).toBe('');
|
||||||
expect(
|
expect(
|
||||||
@ -3122,7 +3129,14 @@ describe('Send Slice', () => {
|
|||||||
send: getInitialSendStateWithExistingTxState({
|
send: getInitialSendStateWithExistingTxState({
|
||||||
recipient: { address: '0xb' },
|
recipient: { address: '0xb' },
|
||||||
}),
|
}),
|
||||||
metamask: { ensResolutionsByAddress: {} },
|
metamask: {
|
||||||
|
ensResolutionsByAddress: {},
|
||||||
|
addressBook: {},
|
||||||
|
identities: {},
|
||||||
|
provider: {
|
||||||
|
chainId: '0x5',
|
||||||
|
},
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
).toBe('0xb');
|
).toBe('0xb');
|
||||||
});
|
});
|
||||||
@ -3163,7 +3177,14 @@ describe('Send Slice', () => {
|
|||||||
expect(
|
expect(
|
||||||
getRecipient({
|
getRecipient({
|
||||||
send: INITIAL_SEND_STATE_FOR_EXISTING_DRAFT,
|
send: INITIAL_SEND_STATE_FOR_EXISTING_DRAFT,
|
||||||
metamask: { ensResolutionsByAddress: {} },
|
metamask: {
|
||||||
|
ensResolutionsByAddress: {},
|
||||||
|
identities: {},
|
||||||
|
addressBook: {},
|
||||||
|
provider: {
|
||||||
|
chainId: '0x5',
|
||||||
|
},
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
).toMatchObject(
|
).toMatchObject(
|
||||||
getTestUUIDTx(INITIAL_SEND_STATE_FOR_EXISTING_DRAFT).recipient,
|
getTestUUIDTx(INITIAL_SEND_STATE_FOR_EXISTING_DRAFT).recipient,
|
||||||
|
@ -392,7 +392,17 @@ export function getAddressBook(state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getEnsResolutionByAddress(state, address) {
|
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) {
|
export function getAddressBookEntry(state, address) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user