Merge pull request #258 from poanetwork/ens-fix
(Fix) ENS validation fix for Send transaction screen
This commit is contained in:
commit
aa2b533df0
|
@ -117,7 +117,7 @@ EnsInput.prototype.lookupEnsName = function () {
|
||||||
toError: null,
|
toError: null,
|
||||||
}
|
}
|
||||||
if (isValidENSAddress(recipient) && reason.message === 'ENS name not defined.') {
|
if (isValidENSAddress(recipient) && reason.message === 'ENS name not defined.') {
|
||||||
setStateObj.hoverText = this.context.t('ensNameNotFound')
|
setStateObj.hoverText = 'ENS name not found'
|
||||||
setStateObj.toError = 'ensNameNotFound'
|
setStateObj.toError = 'ensNameNotFound'
|
||||||
setStateObj.ensFailure = false
|
setStateObj.ensFailure = false
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,7 +147,8 @@ EnsInput.prototype.ensIcon = function (recipient) {
|
||||||
title: hoverText,
|
title: hoverText,
|
||||||
style: {
|
style: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
padding: '9px',
|
padding: '6px 0px',
|
||||||
|
right: '0px',
|
||||||
transform: 'translatex(-40px)',
|
transform: 'translatex(-40px)',
|
||||||
},
|
},
|
||||||
}, this.ensIconContents(recipient))
|
}, this.ensIconContents(recipient))
|
||||||
|
@ -165,17 +166,26 @@ EnsInput.prototype.ensIconContents = function (recipient) {
|
||||||
width: '30px',
|
width: '30px',
|
||||||
height: '30px',
|
height: '30px',
|
||||||
transform: 'translateY(-6px)',
|
transform: 'translateY(-6px)',
|
||||||
|
marginRight: '-5px',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ensFailure) {
|
if (ensFailure) {
|
||||||
return h('i.fa.fa-warning.fa-lg.warning')
|
return h('i.fa.fa-warning.fa-lg.warning', {
|
||||||
|
style: {
|
||||||
|
color: '#df2265',
|
||||||
|
background: 'white',
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ensResolution && (ensResolution !== ZERO_ADDRESS)) {
|
if (ensResolution && (ensResolution !== ZERO_ADDRESS)) {
|
||||||
return h('i.fa.fa-check-circle.fa-lg.cursor-pointer', {
|
return h('i.fa.fa-check-circle.fa-lg.cursor-pointer', {
|
||||||
style: { color: 'green' },
|
style: {
|
||||||
|
color: '#60db97',
|
||||||
|
background: 'white',
|
||||||
|
},
|
||||||
onClick: (event) => {
|
onClick: (event) => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
|
@ -184,8 +184,16 @@ class SendTransactionScreen extends PersistentForm {
|
||||||
async onSubmit () {
|
async onSubmit () {
|
||||||
const state = this.state || {}
|
const state = this.state || {}
|
||||||
const { token, amount } = state
|
const { token, amount } = state
|
||||||
const recipient = state.recipient || document.querySelector('input[name="address"]').value.replace(/^[.\s]+|[.\s]+$/g, '')
|
let recipient = state.recipient || document.querySelector('input[name="address"]').value.replace(/^[.\s]+|[.\s]+$/g, '')
|
||||||
const nickname = state.nickname || ' '
|
let nickname = state.nickname || ' '
|
||||||
|
if (typeof recipient === 'object') {
|
||||||
|
if (recipient.toAddress) {
|
||||||
|
recipient = recipient.toAddress
|
||||||
|
}
|
||||||
|
if (recipient.nickname) {
|
||||||
|
nickname = recipient.nickname
|
||||||
|
}
|
||||||
|
}
|
||||||
const parts = amount.split('.')
|
const parts = amount.split('.')
|
||||||
|
|
||||||
let message
|
let message
|
||||||
|
|
|
@ -163,8 +163,16 @@ SendTransactionScreen.prototype.recipientDidChange = function (recipient, nickna
|
||||||
|
|
||||||
SendTransactionScreen.prototype.onSubmit = function () {
|
SendTransactionScreen.prototype.onSubmit = function () {
|
||||||
const state = this.state || {}
|
const state = this.state || {}
|
||||||
const recipient = state.recipient || document.querySelector('input[name="address"]').value.replace(/^[.\s]+|[.\s]+$/g, '')
|
let recipient = state.recipient || document.querySelector('input[name="address"]').value.replace(/^[.\s]+|[.\s]+$/g, '')
|
||||||
const nickname = state.nickname || ' '
|
let nickname = state.nickname || ' '
|
||||||
|
if (typeof recipient === 'object') {
|
||||||
|
if (recipient.toAddress) {
|
||||||
|
recipient = recipient.toAddress
|
||||||
|
}
|
||||||
|
if (recipient.nickname) {
|
||||||
|
nickname = recipient.nickname
|
||||||
|
}
|
||||||
|
}
|
||||||
const input = document.querySelector('input[name="amount"]').value
|
const input = document.querySelector('input[name="amount"]').value
|
||||||
const parts = input.split('.')
|
const parts = input.split('.')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue