diff --git a/packages/react-app/src/components/AddressInput.js b/packages/react-app/src/components/AddressInput.js
index b9f90e0..783a58f 100644
--- a/packages/react-app/src/components/AddressInput.js
+++ b/packages/react-app/src/components/AddressInput.js
@@ -6,41 +6,11 @@ import { Input, Badge } from 'antd';
export default function AddressInput(props) {
- const [ ens, setEns ] = useState(0)
const [ value, setValue ] = useState()
+ const [isAddressFound, setIsAddressFound] = useState(false);
const currentValue = typeof props.value != "undefined"?props.value:value
- useEffect(()=>{
- setEns("")
- if(currentValue && props.ensProvider){
- async function getEns(){
- let newEns
- try{
- console.log("trying reverse ens",newEns)
-
- newEns = await props.ensProvider.lookupAddress(currentValue)
- console.log("setting ens",newEns)
- setEns(newEns)
- }catch(e){}
- console.log("checking resolve")
- if( currentValue.indexOf(".eth")>0 || currentValue.indexOf(".xyz")>0 ){
- try{
- console.log("resolving")
- let possibleAddress = await props.ensProvider.resolveName(currentValue);
- console.log("GOT:L",possibleAddress)
- if(possibleAddress){
- setEns(currentValue)
- props.onChange(possibleAddress)
- }
- }catch(e){}
- }
- }
- getEns()
- }
- },[props.value])
-
-
const [ scan, setScan ] = useState(false)
let scannerButton = (
@@ -62,8 +32,11 @@ export default function AddressInput(props) {
let possibleAddress = await props.ensProvider.resolveName(address);
if(possibleAddress){
address = possibleAddress
+ setIsAddressFound(true);
}
}catch(e){}
+ } else {
+ setIsAddressFound(true);
}
setValue(address)
if(typeof props.onChange == "function") { props.onChange(address) }
@@ -105,10 +78,10 @@ export default function AddressInput(props) {
{scanner}
}
- value={ens?ens:currentValue}
+ value={currentValue}
addonAfter={scannerButton}
onChange={(e)=>{
updateAddress(e.target.value)