address selector: complete reverses by name as well

This commit is contained in:
Jannis R 2017-01-09 14:13:11 +01:00
parent 38734c92c2
commit f05ffd2e09
No known key found for this signature in database
GPG Key ID: 0FE83946296A88A5

View File

@ -31,18 +31,26 @@ export default class AddressSelectStore {
initValues = []; initValues = [];
regLookups = [ regLookups = [
(address) => { (query) => {
address = address.toLowerCase().trim(); query = query.toLowerCase().trim();
if (address.length === 0 || address === '0x') { if (query.length === 0 || query === '0x') {
return null; return null;
} }
let name = this.reverse[address]; let address;
let name = this.reverse[query];
if (!name) { if (!name) {
const addr = Object const addr = Object
.keys(this.reverse) .keys(this.reverse)
.find((addr) => addr.toLowerCase().slice(0, address.length) === address); .find((addr) => {
if (addr.toLowerCase().slice(0, query.length) === query) {
return true;
}
const name = this.reverse[addr];
return name.toLowerCase().slice(0, query.length) === query;
});
if (addr) { if (addr) {
address = addr; address = addr;