Skip to content

Commit

Permalink
Use allSettled
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkeating authored and mds1 committed Feb 21, 2023
1 parent 235e5d6 commit 330c401
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frontend/src/utils/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export const isAddressSafe = async (name: string, userAddress: string, stealthAd
// Check if address owns any POAPs
const hasPOAPsCheck = async () => {
const has = await hasPOAPs(destinationAddress);
console.log(has);
if (has) reasons.push(`${isDomain ? tc('Utils.Address.address-it-resolves-to') : tc('Utils.Address.it')} ${tc('Utils.Address.has-poap-tokens')}`); // prettier-ignore
};
promises.push(hasPOAPsCheck());
Expand All @@ -146,11 +145,12 @@ export const isAddressSafe = async (name: string, userAddress: string, stealthAd
};
promises.push(contractENSCheck());

try {
await Promise.all(promises);
} catch (err) {
console.error(err);
}
const results = await Promise.allSettled(promises);
results.forEach((res) => {
if (res.status === 'rejected') {
console.error(res?.reason);
}
});

return { safe: reasons.length === 0, reasons };
};
Expand Down
1 change: 1 addition & 0 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"module": "es2020",
"target": "es2020",
"moduleResolution": "node",
"paths": {
"src/*": ["src/*"],
Expand Down

0 comments on commit 330c401

Please sign in to comment.