added web3 wrapper, needs connection to user_settings db

pull/1439/head
Peer Richelsen 2021-12-30 14:36:27 +01:00
parent 59720b8ca7
commit f670cc23f2
1 changed files with 24 additions and 16 deletions

View File

@ -60,6 +60,10 @@ import * as RadioArea from "@components/ui/form/radio-area";
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
// TODO @danfesi we need to get this boolean from user_settings
// we should also disable the other API calls for web3 if it's disabled
const web3App = true;
interface Token { interface Token {
name?: string; name?: string;
address: string; address: string;
@ -163,6 +167,8 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
useEffect(() => { useEffect(() => {
const fetchTokens = async () => { const fetchTokens = async () => {
// Get a list of most popular ERC20s and ERC777s, combine them into a single list, set as tokensList // Get a list of most popular ERC20s and ERC777s, combine them into a single list, set as tokensList
// TODO @danfesi we should also disable the API calls for web3 if it's disabled
try { try {
const erc20sList: Array<Token> = ( const erc20sList: Array<Token> = (
await axios.get(`https://api.bloxy.info/token/list?key=${process.env.BLOXY_API_KEY}`) await axios.get(`https://api.bloxy.info/token/list?key=${process.env.BLOXY_API_KEY}`)
@ -773,6 +779,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</div> </div>
</div> </div>
</div> </div>
{web3App && (
<div className="items-center block sm:flex"> <div className="items-center block sm:flex">
<div className="mb-4 min-w-48 sm:mb-0"> <div className="mb-4 min-w-48 sm:mb-0">
<label htmlFor="scAddress" className="flex text-sm font-medium text-neutral-700"> <label htmlFor="scAddress" className="flex text-sm font-medium text-neutral-700">
@ -791,6 +798,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</div> </div>
</div> </div>
</div> </div>
)}
<div className="items-center block sm:flex"> <div className="items-center block sm:flex">
<div className="mb-4 min-w-48 sm:mb-0"> <div className="mb-4 min-w-48 sm:mb-0">
<label <label