mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Make all addresses EIP-55 compliant (#5379)
* Make all addresses EIP-55 compliant * Checksum autocompleted address but not during input
This commit is contained in:
parent
999a599a78
commit
63c61c52eb
@ -94,7 +94,7 @@ async function runSendFlowTest (assert, done) {
|
|||||||
sendToDropdownList.children()[2].click()
|
sendToDropdownList.children()[2].click()
|
||||||
|
|
||||||
const sendToAccountAddress = sendToFieldInput.val()
|
const sendToAccountAddress = sendToFieldInput.val()
|
||||||
assert.equal(sendToAccountAddress, '0x2f8d4a878cfa04a6e60d46362f5644deab66572d', 'send to dropdown selects the correct address')
|
assert.equal(sendToAccountAddress, '0x2f8D4a878cFA04A6E60D46362f5644DeAb66572D', 'send to dropdown selects the correct address')
|
||||||
|
|
||||||
const sendAmountField = await queryAsync($, '.send-v2__form-row:eq(2)')
|
const sendAmountField = await queryAsync($, '.send-v2__form-row:eq(2)')
|
||||||
sendAmountField.find('.currency-display')[0].click()
|
sendAmountField.find('.currency-display')[0].click()
|
||||||
|
@ -26,7 +26,7 @@ function QrCodeView () {
|
|||||||
QrCodeView.prototype.render = function () {
|
QrCodeView.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
const { message, data } = props.Qr
|
const { message, data } = props.Qr
|
||||||
const address = `${isHexPrefixed(data) ? 'ethereum:' : ''}${data}`
|
const address = `${isHexPrefixed(data) ? 'ethereum:' : ''}${checksumAddress(data)}`
|
||||||
const qrImage = qrCode(4, 'M')
|
const qrImage = qrCode(4, 'M')
|
||||||
qrImage.addData(address)
|
qrImage.addData(address)
|
||||||
qrImage.make()
|
qrImage.make()
|
||||||
|
@ -5,6 +5,7 @@ const inherits = require('util').inherits
|
|||||||
const AccountListItem = require('../account-list-item/account-list-item.component').default
|
const AccountListItem = require('../account-list-item/account-list-item.component').default
|
||||||
const connect = require('react-redux').connect
|
const connect = require('react-redux').connect
|
||||||
const Tooltip = require('../../tooltip')
|
const Tooltip = require('../../tooltip')
|
||||||
|
const checksumAddress = require('../../../util').checksumAddress
|
||||||
|
|
||||||
ToAutoComplete.contextTypes = {
|
ToAutoComplete.contextTypes = {
|
||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
@ -48,7 +49,7 @@ ToAutoComplete.prototype.renderDropdown = function () {
|
|||||||
account,
|
account,
|
||||||
className: 'account-list-item__dropdown',
|
className: 'account-list-item__dropdown',
|
||||||
handleClick: () => {
|
handleClick: () => {
|
||||||
onChange(account.address)
|
onChange(checksumAddress(account.address))
|
||||||
closeDropdown()
|
closeDropdown()
|
||||||
},
|
},
|
||||||
icon: this.getListItemIcon(account.address, to),
|
icon: this.getListItemIcon(account.address, to),
|
||||||
|
@ -5,6 +5,7 @@ import Identicon from '../identicon'
|
|||||||
import Tooltip from '../tooltip-v2'
|
import Tooltip from '../tooltip-v2'
|
||||||
import copyToClipboard from 'copy-to-clipboard'
|
import copyToClipboard from 'copy-to-clipboard'
|
||||||
import { DEFAULT_VARIANT, CARDS_VARIANT } from './sender-to-recipient.constants'
|
import { DEFAULT_VARIANT, CARDS_VARIANT } from './sender-to-recipient.constants'
|
||||||
|
import { checksumAddress } from '../../util'
|
||||||
|
|
||||||
const variantHash = {
|
const variantHash = {
|
||||||
[DEFAULT_VARIANT]: 'sender-to-recipient--default',
|
[DEFAULT_VARIANT]: 'sender-to-recipient--default',
|
||||||
@ -40,7 +41,7 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
return !this.props.addressOnly && (
|
return !this.props.addressOnly && (
|
||||||
<div className="sender-to-recipient__sender-icon">
|
<div className="sender-to-recipient__sender-icon">
|
||||||
<Identicon
|
<Identicon
|
||||||
address={this.props.senderAddress}
|
address={checksumAddress(this.props.senderAddress)}
|
||||||
diameter={24}
|
diameter={24}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -50,6 +51,7 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
renderSenderAddress () {
|
renderSenderAddress () {
|
||||||
const { t } = this.context
|
const { t } = this.context
|
||||||
const { senderName, senderAddress, addressOnly } = this.props
|
const { senderName, senderAddress, addressOnly } = this.props
|
||||||
|
const checksummedSenderAddress = checksumAddress(senderAddress)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@ -60,7 +62,7 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
onHidden={() => this.setState({ senderAddressCopied: false })}
|
onHidden={() => this.setState({ senderAddressCopied: false })}
|
||||||
>
|
>
|
||||||
<div className="sender-to-recipient__name">
|
<div className="sender-to-recipient__name">
|
||||||
{ addressOnly ? `${t('from')}: ${senderAddress}` : senderName }
|
{ addressOnly ? `${t('from')}: ${checksummedSenderAddress}` : senderName }
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
@ -68,11 +70,12 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
|
|
||||||
renderRecipientIdenticon () {
|
renderRecipientIdenticon () {
|
||||||
const { recipientAddress, assetImage } = this.props
|
const { recipientAddress, assetImage } = this.props
|
||||||
|
const checksummedRecipientAddress = checksumAddress(recipientAddress)
|
||||||
|
|
||||||
return !this.props.addressOnly && (
|
return !this.props.addressOnly && (
|
||||||
<div className="sender-to-recipient__sender-icon">
|
<div className="sender-to-recipient__sender-icon">
|
||||||
<Identicon
|
<Identicon
|
||||||
address={recipientAddress}
|
address={checksummedRecipientAddress}
|
||||||
diameter={24}
|
diameter={24}
|
||||||
image={assetImage}
|
image={assetImage}
|
||||||
/>
|
/>
|
||||||
@ -83,13 +86,14 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
renderRecipientWithAddress () {
|
renderRecipientWithAddress () {
|
||||||
const { t } = this.context
|
const { t } = this.context
|
||||||
const { recipientName, recipientAddress, addressOnly } = this.props
|
const { recipientName, recipientAddress, addressOnly } = this.props
|
||||||
|
const checksummedRecipientAddress = checksumAddress(recipientAddress)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="sender-to-recipient__party sender-to-recipient__party--recipient sender-to-recipient__party--recipient-with-address"
|
className="sender-to-recipient__party sender-to-recipient__party--recipient sender-to-recipient__party--recipient-with-address"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.setState({ recipientAddressCopied: true })
|
this.setState({ recipientAddressCopied: true })
|
||||||
copyToClipboard(recipientAddress)
|
copyToClipboard(checksummedRecipientAddress)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{ this.renderRecipientIdenticon() }
|
{ this.renderRecipientIdenticon() }
|
||||||
@ -103,7 +107,7 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
<div className="sender-to-recipient__name">
|
<div className="sender-to-recipient__name">
|
||||||
{
|
{
|
||||||
addressOnly
|
addressOnly
|
||||||
? `${t('to')}: ${recipientAddress}`
|
? `${t('to')}: ${checksummedRecipientAddress}`
|
||||||
: (recipientName || this.context.t('newContract'))
|
: (recipientName || this.context.t('newContract'))
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@ -147,6 +151,7 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { senderAddress, recipientAddress, variant } = this.props
|
const { senderAddress, recipientAddress, variant } = this.props
|
||||||
|
const checksummedSenderAddress = checksumAddress(senderAddress)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classnames(variantHash[variant])}>
|
<div className={classnames(variantHash[variant])}>
|
||||||
@ -154,7 +159,7 @@ export default class SenderToRecipient extends PureComponent {
|
|||||||
className={classnames('sender-to-recipient__party sender-to-recipient__party--sender')}
|
className={classnames('sender-to-recipient__party sender-to-recipient__party--sender')}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.setState({ senderAddressCopied: true })
|
this.setState({ senderAddressCopied: true })
|
||||||
copyToClipboard(senderAddress)
|
copyToClipboard(checksummedSenderAddress)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{ this.renderSenderIdenticon() }
|
{ this.renderSenderIdenticon() }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user