diff --git a/src/hooks/useAddressInput.ts b/src/hooks/useAddressInput.ts index b0eb3082..120f85c0 100644 --- a/src/hooks/useAddressInput.ts +++ b/src/hooks/useAddressInput.ts @@ -39,33 +39,45 @@ export const useAddressInput = () => { const fetchAddressIdentity = async () => { // must have a valid recipient address if (recipientAddress) { - // no name - if (!recipientName) { - setRecipientState("loading"); - // check for name - const name = await throttledFetchEnsName({ - address: recipientAddress, - }); - setRecipientName(name); + try { + // no name + if (!recipientName) { + setRecipientState("loading"); + // check for name + const name = await throttledFetchEnsName({ + address: recipientAddress, + }); + setRecipientName(name); + } + } catch (e) { + console.error(e); } - // no avatar - if (!recipientAvatar && recipientName) { - setRecipientState("loading"); - // check for avatar - const avatar = await throttledFetchEnsAvatar({ - name: recipientName, - }); - setRecipientAvatar(avatar); + try { + // no avatar + if (!recipientAvatar && recipientName) { + setRecipientState("loading"); + // check for avatar + const avatar = await throttledFetchEnsAvatar({ + name: recipientName, + }); + setRecipientAvatar(avatar); + } + } catch (e) { + console.error(e); } - // make sure we can message the recipient - if (!recipientOnNetwork) { - setRecipientState("loading"); - const validRecipient = await canMessage(recipientAddress); - if (validRecipient) { - setRecipientOnNetwork(true); - } else { - setRecipientOnNetwork(false); + try { + // make sure we can message the recipient + if (!recipientOnNetwork) { + setRecipientState("loading"); + const validRecipient = await canMessage(recipientAddress); + if (validRecipient) { + setRecipientOnNetwork(true); + } else { + setRecipientOnNetwork(false); + } } + } catch (e) { + console.error(e); } setRecipientState("valid"); }