Only make web3 call if credential exists (#3323)

* Add has web3 credential

* Address feedback

* Address feedback

* Fix e2e test

* Remove unused code

* Remove unused import

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/3346/head
Joe Au-Yeung 2022-07-13 20:14:39 -04:00 committed by GitHub
parent 39199e515e
commit 33e36e5320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 7039 deletions

View File

@ -78,8 +78,6 @@ import WebhookListContainer from "@components/webhook/WebhookListContainer";
import { getTranslation } from "@server/lib/i18n";
import bloxyApi from "../../web3/dummyResps/bloxyApi";
interface Token {
name?: string;
address: string;
@ -346,40 +344,8 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
};
useEffect(() => {
const fetchTokens = async () => {
// Get a list of most popular ERC20s and ERC777s, combine them into a single list, set as tokensList
try {
const erc20sList: Array<Token> =
// await axios.get(`https://api.bloxy.info/token/list?key=${process.env.BLOXY_API_KEY}`)
// ).data
bloxyApi.slice(0, 100).map((erc20: Token) => {
const { name, address, symbol } = erc20;
return { name, address, symbol };
});
const exodiaList = await (await fetch(`https://exodia.io/api/trending?page=1`)).json();
const nftsList: Array<Token> = exodiaList.map((nft: NFT) => {
const { name, contracts } = nft;
if (nft.contracts[0]) {
const { address, symbol } = contracts[0];
return { name, address, symbol };
}
});
const unifiedList: Array<Token> = [...erc20sList, ...nftsList];
setTokensList(unifiedList);
} catch (err) {
showToast("Failed to load ERC20s & NFTs list. Please enter an address manually.", "error");
}
};
console.log(tokensList); // Just here to make sure it passes the gc hook. Can remove once actual use is made of tokensList.
fetchTokens();
!hashedUrl && setHashedUrl(generateHashedLink(eventType.users[0]?.id ?? team?.id));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

File diff suppressed because it is too large Load Diff