aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/app/helpers/utils/util.js8
-rw-r--r--ui/app/pages/send/send-content/add-recipient/ens-input.component.js10
-rw-r--r--ui/app/pages/send/send-footer/send-footer.utils.js2
-rw-r--r--ui/app/pages/send/send.component.js1
4 files changed, 17 insertions, 4 deletions
diff --git a/ui/app/helpers/utils/util.js b/ui/app/helpers/utils/util.js
index 94fa9ad42..b9e8e83c5 100644
--- a/ui/app/helpers/utils/util.js
+++ b/ui/app/helpers/utils/util.js
@@ -61,6 +61,7 @@ module.exports = {
checksumAddress,
addressSlicer,
isEthNetwork,
+ isValidAddressHead,
}
function isEthNetwork (netId) {
@@ -323,3 +324,10 @@ function addressSlicer (address = '') {
return `${address.slice(0, 6)}...${address.slice(-4)}`
}
+
+function isValidAddressHead (address) {
+ const addressLengthIsLessThanFull = address.length < 42
+ const addressIsHex = isHex(address)
+
+ return addressLengthIsLessThanFull && addressIsHex
+}
diff --git a/ui/app/pages/send/send-content/add-recipient/ens-input.component.js b/ui/app/pages/send/send-content/add-recipient/ens-input.component.js
index c8d022079..498d72605 100644
--- a/ui/app/pages/send/send-content/add-recipient/ens-input.component.js
+++ b/ui/app/pages/send/send-content/add-recipient/ens-input.component.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import c from 'classnames'
-import { isValidENSAddress, isValidAddress } from '../../../../helpers/utils/util'
+import { isValidENSAddress, isValidAddress, isValidAddressHead } from '../../../../helpers/utils/util'
import {ellipsify} from '../../send.utils'
import debounce from 'debounce'
@@ -33,6 +33,7 @@ export default class EnsInput extends Component {
addressBook: PropTypes.array,
onPaste: PropTypes.func,
onReset: PropTypes.func,
+ onValidAddressTyped: PropTypes.func,
}
state = {
@@ -108,7 +109,7 @@ export default class EnsInput extends Component {
}
onChange = e => {
- const { network, onChange, updateEnsResolution, updateEnsResolutionError } = this.props
+ const { network, onChange, updateEnsResolution, updateEnsResolutionError, onValidAddressTyped } = this.props
const input = e.target.value
const networkHasEnsSupport = getNetworkEnsSupport(network)
@@ -116,7 +117,8 @@ export default class EnsInput extends Component {
// Empty ENS state if input is empty
// maybe scan ENS
- if (!input || isValidAddress(input) || !networkHasEnsSupport) {
+
+ if (!networkHasEnsSupport && !isValidAddress(input) && !isValidAddressHead(input)) {
updateEnsResolution('')
updateEnsResolutionError(!networkHasEnsSupport ? 'Network does not support ENS' : '')
return
@@ -124,6 +126,8 @@ export default class EnsInput extends Component {
if (isValidENSAddress(input)) {
this.lookupEnsName(input)
+ } else if (onValidAddressTyped && isValidAddress(input)) {
+ onValidAddressTyped(input)
} else {
updateEnsResolution('')
updateEnsResolutionError('')
diff --git a/ui/app/pages/send/send-footer/send-footer.utils.js b/ui/app/pages/send/send-footer/send-footer.utils.js
index 91ac29014..ce65535a6 100644
--- a/ui/app/pages/send/send-footer/send-footer.utils.js
+++ b/ui/app/pages/send/send-footer/send-footer.utils.js
@@ -76,7 +76,7 @@ function constructUpdatedTx ({
function addressIsNew (toAccounts, newAddress) {
const newAddressNormalized = newAddress.toLowerCase()
- const foundMatching = toAccounts.some(({ address }) => address === newAddressNormalized)
+ const foundMatching = toAccounts.some(({ address }) => address.toLowerCase() === newAddressNormalized)
return !foundMatching
}
diff --git a/ui/app/pages/send/send.component.js b/ui/app/pages/send/send.component.js
index 9cdf75536..cb07dcb59 100644
--- a/ui/app/pages/send/send.component.js
+++ b/ui/app/pages/send/send.component.js
@@ -303,6 +303,7 @@ export default class SendTransactionScreen extends PersistentForm {
this.props.scanQrCode()
}}
onChange={this.onRecipientInputChange}
+ onValidAddressTyped={(address) => this.props.updateSendTo(address, '')}
onPaste={text => this.props.updateSendTo(text)}
onReset={() => this.props.updateSendTo('', '')}
updateEnsResolution={this.props.updateSendEnsResolution}