From f4f90acc22bdede1c4bb5e0c0c4a0a9f6b2309a7 Mon Sep 17 00:00:00 2001 From: Agustin Pane Date: Tue, 29 Sep 2020 16:07:36 -0300 Subject: [PATCH] Checksum the address on addressInput (#1410) --- src/components/forms/AddressInput/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/forms/AddressInput/index.tsx b/src/components/forms/AddressInput/index.tsx index 4d09843a..8655d259 100644 --- a/src/components/forms/AddressInput/index.tsx +++ b/src/components/forms/AddressInput/index.tsx @@ -7,6 +7,7 @@ import { Validator, composeValidators, mustBeEthereumAddress, required } from 's import { trimSpaces } from 'src/utils/strings' import { getAddressFromENS } from 'src/logic/wallets/getWeb3' import { isValidEnsName } from 'src/logic/wallets/ethAddresses' +import { checksumAddress } from 'src/utils/checksumAddress' // an idea for second field was taken from here // https://github.com/final-form/react-final-form-listeners/blob/master/src/OnBlur.js @@ -56,11 +57,15 @@ const AddressInput = ({ if (isValidEnsName(address)) { try { const resolverAddr = await getAddressFromENS(address) - fieldMutator(resolverAddr) + const formattedAddress = checksumAddress(resolverAddr) + fieldMutator(formattedAddress) } catch (err) { console.error('Failed to resolve address for ENS name: ', err) } - } else fieldMutator(address) + } else { + const formattedAddress = checksumAddress(address) + fieldMutator(formattedAddress) + } }}