mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #2075 from MetaMask/mixed-case
Specific error for send screen: address checksum fails
This commit is contained in:
commit
fa50bf9587
@ -5,6 +5,7 @@
|
|||||||
- Add ability to export private keys as a file.
|
- Add ability to export private keys as a file.
|
||||||
- Add ability to export seed words as a file.
|
- Add ability to export seed words as a file.
|
||||||
- Changed state logs to a file download than a clipboard copy.
|
- Changed state logs to a file download than a clipboard copy.
|
||||||
|
- Add specific error for failed recipient address checksum.
|
||||||
- Fixed a long standing memory leak associated with filters installed by dapps
|
- Fixed a long standing memory leak associated with filters installed by dapps
|
||||||
- Fix link to support center.
|
- Fix link to support center.
|
||||||
- Fixed tooltip icon locations to avoid overflow.
|
- Fixed tooltip icon locations to avoid overflow.
|
||||||
|
@ -262,6 +262,11 @@ SendTransactionScreen.prototype.onSubmit = function () {
|
|||||||
return this.props.dispatch(actions.displayWarning(message))
|
return this.props.dispatch(actions.displayWarning(message))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((util.isInvalidChecksumAddress(recipient))) {
|
||||||
|
message = 'Recipient address checksum is invalid.'
|
||||||
|
return this.props.dispatch(actions.displayWarning(message))
|
||||||
|
}
|
||||||
|
|
||||||
if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) {
|
if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) {
|
||||||
message = 'Recipient address is invalid.'
|
message = 'Recipient address is invalid.'
|
||||||
return this.props.dispatch(actions.displayWarning(message))
|
return this.props.dispatch(actions.displayWarning(message))
|
||||||
|
@ -37,6 +37,7 @@ module.exports = {
|
|||||||
bnTable: bnTable,
|
bnTable: bnTable,
|
||||||
isHex: isHex,
|
isHex: isHex,
|
||||||
exportAsFile: exportAsFile,
|
exportAsFile: exportAsFile,
|
||||||
|
isInvalidChecksumAddress,
|
||||||
}
|
}
|
||||||
|
|
||||||
function valuesFor (obj) {
|
function valuesFor (obj) {
|
||||||
@ -66,6 +67,12 @@ function isValidAddress (address) {
|
|||||||
return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
|
return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isInvalidChecksumAddress (address) {
|
||||||
|
var prefixed = ethUtil.addHexPrefix(address)
|
||||||
|
if (address === '0x0000000000000000000000000000000000000000') return false
|
||||||
|
return !isAllOneCase(prefixed) && !ethUtil.isValidChecksumAddress(prefixed) && ethUtil.isValidAddress(prefixed)
|
||||||
|
}
|
||||||
|
|
||||||
function isAllOneCase (address) {
|
function isAllOneCase (address) {
|
||||||
if (!address) return true
|
if (!address) return true
|
||||||
var lower = address.toLowerCase()
|
var lower = address.toLowerCase()
|
||||||
|
Loading…
Reference in New Issue
Block a user