|
|
@ -29,6 +29,11 @@ export interface ISearchItem { |
|
|
|
item: any; |
|
|
|
item: any; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const oneCountryPostfix = { |
|
|
|
|
|
|
|
dotOne: '.1', |
|
|
|
|
|
|
|
dotCountry: '.country' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const SearchInput = () => { |
|
|
|
export const SearchInput = () => { |
|
|
|
const [value, setValue] = useState(""); |
|
|
|
const [value, setValue] = useState(""); |
|
|
|
const [readySubmit, setReadySubmit] = useState(false); |
|
|
|
const [readySubmit, setReadySubmit] = useState(false); |
|
|
@ -96,11 +101,14 @@ export const SearchInput = () => { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(config.oneCountryContractAddress && v.endsWith('.1')) { |
|
|
|
if(config.oneCountryContractAddress) { |
|
|
|
const [prefix] = v.split('.1') |
|
|
|
const onePostfix = v.endsWith(oneCountryPostfix.dotOne) |
|
|
|
|
|
|
|
const countryPostfix = v.endsWith(oneCountryPostfix.dotCountry) |
|
|
|
|
|
|
|
if(onePostfix || countryPostfix) { |
|
|
|
|
|
|
|
const [prefix] = v.split(onePostfix ? oneCountryPostfix.dotOne : oneCountryPostfix.dotCountry); |
|
|
|
if(prefix) { |
|
|
|
if(prefix) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const address = await getAddressByName(prefix) |
|
|
|
const address = await getAddressByName(prefix); |
|
|
|
if(address) { |
|
|
|
if(address) { |
|
|
|
history.push(`/address/${address}`); |
|
|
|
history.push(`/address/${address}`); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -118,6 +126,7 @@ export const SearchInput = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (v.length !== 66 && v.length !== 42) { |
|
|
|
if (v.length !== 66 && v.length !== 42) { |
|
|
|
return; |
|
|
|
return; |
|
|
|