Skip to content

Commit

Permalink
Ensure hex-prefixed addresses in send input
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding authored and danjm committed Jun 28, 2022
1 parent f7e466c commit 8d0c269
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';

import { addHexPrefix } from '../../../../../app/scripts/lib/util';
import { isValidDomainName } from '../../../../helpers/utils/util';
import {
isBurnAddress,
Expand Down Expand Up @@ -36,14 +37,15 @@ export default class EnsInput extends Component {

onPaste = (event) => {
if (event.clipboardData.items?.length) {
event.preventDefault();
const clipboardItem = event.clipboardData.items[0];
clipboardItem?.getAsString((text) => {
const input = text.trim();
if (
!isBurnAddress(input) &&
isValidHexAddress(input, { mixedCaseUseChecksum: true })
) {
this.props.onPaste(input);
this.props.onPaste(addHexPrefix(input));
}
});
}
Expand Down Expand Up @@ -74,7 +76,7 @@ export default class EnsInput extends Component {
!isBurnAddress(input) &&
isValidHexAddress(input, { mixedCaseUseChecksum: true })
) {
onValidAddressTyped(input);
onValidAddressTyped(addHexPrefix(input));
}
}

Expand Down

0 comments on commit 8d0c269

Please sign in to comment.