From bb855707efbcb754f5e4ee4e124f69308bca037d Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 14 Jun 2018 11:25:55 -0230 Subject: ENS input in send form shows distinct errors for invalid addresses and non-existent addresses. --- ui/app/util.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ui/app/util.js') diff --git a/ui/app/util.js b/ui/app/util.js index 1ccd17ba7..8c85c5926 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -36,6 +36,7 @@ module.exports = { miniAddressSummary: miniAddressSummary, isAllOneCase: isAllOneCase, isValidAddress: isValidAddress, + isValidENSAddress, numericBalance: numericBalance, parseBalance: parseBalance, formatBalance: formatBalance, @@ -87,6 +88,10 @@ function isValidAddress (address) { return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed) } +function isValidENSAddress (address) { + return address.match(/^.{7,}\.(eth|test)$/) +} + function isInvalidChecksumAddress (address) { var prefixed = ethUtil.addHexPrefix(address) if (address === '0x0000000000000000000000000000000000000000') return false -- cgit v1.2.3 From 469a79f97ff887eae5ec99cf6be7b19c20972d02 Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Fri, 20 Jul 2018 14:18:50 -0700 Subject: Add fallback options for displaying recipient name in the Confirm screen --- ui/app/util.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ui/app/util.js') diff --git a/ui/app/util.js b/ui/app/util.js index 8c85c5926..8b194e0c7 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -59,6 +59,7 @@ module.exports = { allNull, getTokenAddressFromTokenObject, checksumAddress, + addressSlicer, } function valuesFor (obj) { @@ -303,3 +304,11 @@ function getTokenAddressFromTokenObject (token) { function checksumAddress (address) { return address ? ethUtil.toChecksumAddress(address) : '' } + +function addressSlicer (address = '') { + if (address.length < 11) { + return address + } + + return `${address.slice(0, 6)}...${address.slice(-4)}` +} -- cgit v1.2.3