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,24 +779,26 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
</div> </div>
</div> </div>
</div> </div>
<div className="items-center block sm:flex"> {web3App && (
<div className="mb-4 min-w-48 sm:mb-0"> <div className="items-center block sm:flex">
<label htmlFor="scAddress" className="flex text-sm font-medium text-neutral-700"> <div className="mb-4 min-w-48 sm:mb-0">
{t("Smart Contract Address")} <label htmlFor="scAddress" className="flex text-sm font-medium text-neutral-700">
</label> {t("Smart Contract Address")}
</div> </label>
<div className="w-full"> </div>
<div className="relative mt-1 rounded-sm shadow-sm"> <div className="w-full">
<input <div className="relative mt-1 rounded-sm shadow-sm">
type="text" <input
className="block w-full border-gray-300 rounded-sm shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm" type="text"
placeholder={t("Example: 0x71c7656ec7ab88b098defb751b7401b5f6d8976f")} className="block w-full border-gray-300 rounded-sm shadow-sm focus:ring-primary-500 focus:border-primary-500 sm:text-sm"
defaultValue={eventType.scAddress || ""} placeholder={t("Example: 0x71c7656ec7ab88b098defb751b7401b5f6d8976f")}
{...formMethods.register("scAddress")} defaultValue={eventType.scAddress || ""}
/> {...formMethods.register("scAddress")}
/>
</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