Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
port #3065 over
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Nov 1, 2016
1 parent 6f0a933 commit b15f674
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions js/src/ui/Form/InputAddressSelect/inputAddressSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import MenuItem from 'material-ui/MenuItem';
import normalize from 'normalize-for-search';

import IdentityIcon from '../../IdentityIcon';
import util from '../../../api/util';

import styles from './inputAddressSelect.css';

Expand Down Expand Up @@ -58,8 +59,12 @@ class InputAddressSelect extends Component {
const { choices, address } = this.state;

// don't show IdentityIcon if user searches by name
const addressToRender = (address.slice(0, 2) === '0x')
? address : null;
const addressToRender = address.slice(0, 2) === '0x'
? address : (
util.isAddressValid('0x' + address)
? '0x' + address
: null
);

return (
<div className={ styles.wrapper }>
Expand Down Expand Up @@ -122,7 +127,11 @@ class InputAddressSelect extends Component {
query = query.trim();
this.setState({ address: query });

this.props.onChange(null, query);
if (query.slice(0, 2) !== '0x' && util.isAddressValid('0x' + query)) {
this.props.onChange(null, '0x' + query);
} else {
this.props.onChange(null, query);
}
};
}

Expand Down

0 comments on commit b15f674

Please sign in to comment.