Skip to content

Commit

Permalink
refactor: return null on ens lookup error
Browse files Browse the repository at this point in the history
  • Loading branch information
rndquu committed Oct 9, 2024
1 parent 098a81a commit 043252c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions static/scripts/rewards/cirip/query-reverse-ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export async function queryReverseEns(address: string, networkId: number) {
const mainnetProvider = await useHandler(1).getFirstAvailableRpcProvider();
if (mainnetProvider === null) {
console.error("ENS lookup failed: no available mainnet RPC providers");
return "";
return null;
}
const web3Provider = new ethers.providers.JsonRpcProvider(mainnetProvider.connection.url);
const ensName = await web3Provider.lookupAddress(address);

if (ensName === null) {
console.error("ENS lookup failed: API request failed");
return "";
return null;
}

// Store the ENS name in localStorage for future use
Expand Down

0 comments on commit 043252c

Please sign in to comment.