Fix typechecking after ethers 5.5.1 fix/improvement

This commit is contained in:
Willian Mitsuda 2021-10-22 16:52:28 -03:00
parent 6cc7804da8
commit 5533e7786e
1 changed files with 4 additions and 3 deletions

View File

@ -25,7 +25,7 @@ export const useENSCache = (
const addresses = Array.from(addrSet); const addresses = Array.from(addrSet);
const reverseResolve = async () => { const reverseResolve = async () => {
const solvers: Promise<string>[] = []; const solvers: Promise<string | null>[] = [];
for (const a of addresses) { for (const a of addresses) {
solvers.push(provider.lookupAddress(a)); solvers.push(provider.lookupAddress(a));
} }
@ -33,10 +33,11 @@ export const useENSCache = (
const results = await Promise.all(solvers); const results = await Promise.all(solvers);
const cache: ENSReverseCache = {}; const cache: ENSReverseCache = {};
for (let i = 0; i < results.length; i++) { for (let i = 0; i < results.length; i++) {
if (results[i] === null) { const r = results[i];
if (r === null) {
continue; continue;
} }
cache[addresses[i]] = results[i]; cache[addresses[i]] = r;
} }
setReverseCache(cache); setReverseCache(cache);
}; };