(Fix) Recipient address used as name as well (#1387)
* fix address being used as name * Restore ENS name when sending transaction * use `addressName` as default value if it happens that the name in the addressBook is not defined * use resolvedAddress to filter by address in the address book Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm> Co-authored-by: Mati Dastugue <matias.dastugue@altoros.com>
This commit is contained in:
parent
eebe972bac
commit
e9468790b5
|
@ -103,13 +103,23 @@ const AddressBookInput = ({
|
||||||
const { address, name } = adbkEntry
|
const { address, name } = adbkEntry
|
||||||
return (
|
return (
|
||||||
name.toLowerCase().includes(normalizedAddress.toLowerCase()) ||
|
name.toLowerCase().includes(normalizedAddress.toLowerCase()) ||
|
||||||
address.toLowerCase().includes(normalizedAddress.toLowerCase())
|
address.toLowerCase().includes(resolvedAddress.toLowerCase())
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
setADBKList(filteredADBK)
|
setADBKList(filteredADBK)
|
||||||
if (!addressErrorMessage) {
|
if (!addressErrorMessage) {
|
||||||
|
// base case if isENSDomain we set the domain as the name
|
||||||
|
// if address does not exist in address book we use blank name
|
||||||
|
let addressName = isENSDomain ? normalizedAddress : ''
|
||||||
|
|
||||||
|
// if address is valid, and is in the address book, then we use the stored values
|
||||||
|
if (filteredADBK.length === 1) {
|
||||||
|
const addressBookContact = filteredADBK[0]
|
||||||
|
addressName = addressBookContact.name ?? addressName
|
||||||
|
}
|
||||||
|
|
||||||
setSelectedEntry({
|
setSelectedEntry({
|
||||||
name: normalizedAddress,
|
name: addressName,
|
||||||
address: resolvedAddress,
|
address: resolvedAddress,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue