diff --git a/backend/src/routes/livepeer.js b/backend/src/routes/livepeer.js index 476949a..b39d0dc 100644 --- a/backend/src/routes/livepeer.js +++ b/backend/src/routes/livepeer.js @@ -2489,71 +2489,6 @@ apiRouter.get("/getEnsInfo", async (req, res) => { }); -/* - -3BOX DATA -Only stored in local cache - -*/ - -let threeboxCache = []; - -const getThreeBoxInfo = async function (addr) { - console.log("Getting 3box data for " + addr); - const now = new Date().getTime(); - // See if it is cached - for (const thisAddr of threeboxCache) { - if (thisAddr.address === addr) { - return thisAddr; - } - } - // Else get it and cache it - const url = "https://explorer.livepeer.org/api/3box?account=" + addr; - await https.get(url, (res) => { - let body = ""; - res.on("data", (chunk) => { - body += chunk; - }); - res.on("end", () => { - try { - const data = JSON.parse(body); - const threeBoxObj = { - address: data.id, - name: data.name, - website: data.website, - description: data.description, - image: data.image, - timestamp: now - } - console.log("Caching new 3box info " + threeBoxObj.address + " @ " + threeBoxObj.timestamp); - threeboxCache.push(threeBoxObj); - } catch (error) { - console.error(error.message); - }; - }); - }).on("error", (error) => { - console.error(error.message); - }); -} -// Gets and caches info for a single address -apiRouter.get("/getThreeBox/:orch", async (req, res) => { - try { - // First resolve addr => domain name - const threeBoxInfo = await getThreeBoxInfo(req.params.orch); - res.send(threeBoxInfo); - } catch (err) { - res.status(400).send(err); - } -}); -// Returns entire 3box info mapping cache -apiRouter.get("/getAllThreeBox", async (req, res) => { - try { - res.send(threeboxCache); - } catch (err) { - res.status(400).send(err); - } -}); - /* LEADERBOARD TEST SCORES diff --git a/src/actions/livepeer.js b/src/actions/livepeer.js index b5c0311..156ecdc 100644 --- a/src/actions/livepeer.js +++ b/src/actions/livepeer.js @@ -12,7 +12,6 @@ export const RECEIVE_TICKETS = "RECEIVE_TICKETS"; export const RECEIVE_WINNING_TICKETS = "RECEIVE_WINNING_TICKETS"; export const SET_ALL_ENS_INFO = "SET_ALL_ENS_INFO"; export const SET_ALL_ENS_DOMAINS = "SET_ALL_ENS_DOMAINS"; -export const SET_ALL_THREEBOX_INFO = "SET_ALL_THREEBOX_INFO"; export const SET_ALL_ORCH_SCORES = "SET_ALL_ORCH_SCORES"; export const SET_ALL_ORCH_INFO = "SET_ALL_ORCH_INFO"; export const SET_ALL_DEL_INFO = "SET_ALL_DEL_INFO"; @@ -63,9 +62,6 @@ const setAllEnsInfo = message => ({ const setAllEnsDomains = message => ({ type: SET_ALL_ENS_DOMAINS, message }); -const setAllThreeBoxInfo = message => ({ - type: SET_ALL_THREEBOX_INFO, message -}); const setAllOrchScores = message => ({ type: SET_ALL_ORCH_SCORES, message }); @@ -209,20 +205,6 @@ export const getEnsInfo = async (addr) => { const response = apiUtil.getEnsInfo(addr); }; - -export const getAllThreeBoxInfo = () => async dispatch => { - const response = await apiUtil.getAllThreeBox(); - const data = await response.json(); - if (response.ok) { - return dispatch(setAllThreeBoxInfo(data)); - } - return dispatch(receiveErrors(data)); -}; - -export const getThreeBoxInfo = async (addr) => { - const response = apiUtil.getThreeBox(addr); -}; - export const getOrchestratorScores = async (year, month) => { const response = await apiUtil.getOrchestratorScores(year, month); const data = await response.json(); diff --git a/src/components/MonthlyGraphs.js b/src/components/MonthlyGraphs.js index 161ec47..a0940d3 100644 --- a/src/components/MonthlyGraphs.js +++ b/src/components/MonthlyGraphs.js @@ -32,22 +32,6 @@ const MonthlyGraphs = (obj) => { } } - if (livepeer.threeBoxInfo) { - for (const thisAddr of livepeer.threeBoxInfo) { - if (thisAddr.address === address) { - if (thisAddr.name) { - if (thisAddr.name.length > 18) { - return (thisAddr.name.substring(0, 16) + ".."); - } - return thisAddr.name; - } else { - return (address.substring(0, 16) + ".."); - } - break; - } - } - } - return (address.substring(0, 16) + ".."); } diff --git a/src/components/OrchAddressViewer.js b/src/components/OrchAddressViewer.js index 0fc9341..0178b5a 100644 --- a/src/components/OrchAddressViewer.js +++ b/src/components/OrchAddressViewer.js @@ -6,7 +6,6 @@ const Address = (obj) => { const livepeer = useSelector((state) => state.livepeerstate); const [hasRefreshed, setRefresh] = useState(false); let hasENS = false; - let hasThreeBox = false; let thisDomain = null; let thisInfo = null; const now = new Date().getTime(); @@ -58,19 +57,6 @@ const Address = (obj) => { } } - // Ugly shit, but temporary for now to quickly enable threebox. Sorry! - if (!hasENS) { - if (livepeer.threeBoxInfo) { - for (const thisAddr of livepeer.threeBoxInfo) { - if (thisAddr.address === obj.address) { - thisInfo = thisAddr; - hasThreeBox = true; - break; - } - } - } - } - let thisName; let thisIcon; if (hasENS) { @@ -86,20 +72,6 @@ const Address = (obj) => { } - } else if (hasThreeBox) { - if (thisInfo.name) { - thisName =

{thisInfo.name}

; - } else { - thisName = {obj.address}; - } - if (thisInfo.image) { - thisIcon = - - - - } else { - thisIcon = null; - } } else { thisName = obj.address; thisIcon = null; diff --git a/src/components/OrchInfoViewer.js b/src/components/OrchInfoViewer.js index 023f720..0dc3dd0 100644 --- a/src/components/OrchInfoViewer.js +++ b/src/components/OrchInfoViewer.js @@ -31,7 +31,6 @@ const OrchInfoViewer = (obj) => { const [opened, setOpened] = useState(false); const livepeer = useSelector((state) => state.livepeerstate); let hasENS = false; - let hasThreeBox = false; let rewardCut = 0; let feeCut = 0; let totalStake = 0; @@ -98,19 +97,6 @@ const OrchInfoViewer = (obj) => { } } - // Ugly shit, but temporary for now to quickly enable threebox. Sorry! - if (!hasENS) { - if (livepeer.threeBoxInfo) { - for (const thisAddr of livepeer.threeBoxInfo) { - if (thisAddr.address === thisID) { - thisInfo = thisAddr; - hasThreeBox = true; - break; - } - } - } - } - let ensDescription; let ensUrl; if (hasENS) { @@ -130,23 +116,6 @@ const OrchInfoViewer = (obj) => { } - } else if (hasThreeBox) { - if (thisInfo.description) { - ensDescription = thisInfo.description; - } - if (thisInfo.website) { - if (!thisInfo.website.startsWith('http')) { - thisInfo.website = "https://" + thisInfo.website; - } - ensUrl = -
- -
- {thisInfo.website} -
-
-
- } } let descriptionObj; diff --git a/src/components/TotalStakeGraph.js b/src/components/TotalStakeGraph.js index 474a773..d5e9b84 100644 --- a/src/components/TotalStakeGraph.js +++ b/src/components/TotalStakeGraph.js @@ -28,22 +28,6 @@ const TotalStakeGraph = (obj) => { } } - if (livepeer.threeBoxInfo) { - for (const thisAddr of livepeer.threeBoxInfo) { - if (thisAddr.address === address) { - if (thisAddr.name) { - if (thisAddr.name.length > 18) { - return (thisAddr.name.substring(0, 16) + ".."); - } - return thisAddr.name; - } else { - return (address.substring(0, 16) + ".."); - } - break; - } - } - } - return (address.substring(0, 16) + ".."); } diff --git a/src/components/eventButtonAddress.js b/src/components/eventButtonAddress.js index 2989c3a..6610c17 100644 --- a/src/components/eventButtonAddress.js +++ b/src/components/eventButtonAddress.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { - getOrchestratorInfo, getEnsInfo, getThreeBoxInfo, setCachedOrch, getOrchestratorInfoSilent + getOrchestratorInfo, getEnsInfo, setCachedOrch, getOrchestratorInfoSilent } from "../actions/livepeer"; import { useDispatch, useSelector } from 'react-redux'; import { Text } from '@mantine/core'; @@ -9,7 +9,6 @@ const EventButtonAddress = (obj) => { const dispatch = useDispatch(); const livepeer = useSelector((state) => state.livepeerstate); const [hasRefreshed, setRefresh] = useState(false); - const [hasThreeBoxRefreshed, setThreeBoxRefresh] = useState(false); const [orchInfo, setOrchInfo] = useState(null); const now = new Date().getTime(); @@ -17,7 +16,6 @@ const EventButtonAddress = (obj) => { let thisInfo = null; let thisDomain = null; let hasENS = null; - let hasThreeBox = null // Lookup domain in cache if (livepeer.ensDomainMapping && !hasRefreshed) { for (const thisAddr of livepeer.ensDomainMapping) { @@ -69,30 +67,7 @@ const EventButtonAddress = (obj) => { setRefresh(true); } } - - // Ugly shit, but temporary for now to quickly enable threebox. Sorry! - if (!hasENS && !hasThreeBoxRefreshed) { - if (livepeer.threeBoxInfo) { - for (const thisAddr of livepeer.threeBoxInfo) { - if (thisAddr.address === obj.address) { - thisInfo = thisAddr; - hasThreeBox = true; - break; - } - } - // If it was not cached at all - if (!hasThreeBox && !hasThreeBoxRefreshed) { - console.log("Refresh due to non-existing 3BOX info"); - setThreeBoxRefresh(true); - getThreeBoxInfo(obj.address); - } - } - } - if (thisInfo && thisInfo != orchInfo) { - console.log("Setting INFO obj"); - setOrchInfo(thisInfo); - } - }, [livepeer.ensDomainMapping, livepeer.threeBoxInfo]); + }, [livepeer.ensDomainMapping]); useEffect(() => { // Check if cached as an orchestrator @@ -130,20 +105,6 @@ const EventButtonAddress = (obj) => { } - } else if (orchInfo && (orchInfo.name || orchInfo.image)) { - if (orchInfo.name) { - thisName = {orchInfo.name}; - } else { - thisName = {obj.address}; - } - if (orchInfo.image) { - thisIcon = - - - - } else { - thisIcon = null; - } } else { thisName = {obj.address}; thisIcon = null; diff --git a/src/pages/loadingScreen.js b/src/pages/loadingScreen.js index c9dfec9..8004f4b 100644 --- a/src/pages/loadingScreen.js +++ b/src/pages/loadingScreen.js @@ -5,7 +5,7 @@ import { } from "../actions/user"; import { getQuotes, getBlockchainData, getCurrentOrchestratorInfo, - getAllEnsDomains, getAllEnsInfo, getAllThreeBoxInfo, getAllOrchScores, getAllOrchInfo, + getAllEnsDomains, getAllEnsInfo, getAllOrchScores, getAllOrchInfo, getAllDelInfo, getAllMonthlyStats, getAllUpdateEvents, getAllRewardEvents, getAllClaimEvents, getAllWithdrawStakeEvents, getAllWithdrawFeesEvents, getAllTransferTicketEvents, getAllRedeemTicketEvents, getAllActivateEvents, @@ -42,7 +42,6 @@ const Startup = (obj) => { const refreshENS = () => { console.log("Refreshing ENS data..."); batch(() => { - dispatch(getAllThreeBoxInfo()); dispatch(getAllEnsDomains()); dispatch(getAllEnsInfo()); }); diff --git a/src/pages/stats.js b/src/pages/stats.js index 4a7ef5b..ddba959 100644 --- a/src/pages/stats.js +++ b/src/pages/stats.js @@ -54,22 +54,6 @@ const Stats = (obj) => { } } - if (livepeer.threeBoxInfo) { - for (const thisAddr of livepeer.threeBoxInfo) { - if (thisAddr.address === address) { - if (thisAddr.name) { - if (thisAddr.name.length > 18) { - return thisAddr.name; - } - return thisAddr.name; - } else { - return address; - } - break; - } - } - } - return address; } diff --git a/src/reducers/livepeer/livepeerstate.js b/src/reducers/livepeer/livepeerstate.js index bc42e08..883e2ac 100644 --- a/src/reducers/livepeer/livepeerstate.js +++ b/src/reducers/livepeer/livepeerstate.js @@ -9,7 +9,6 @@ import { RECEIVE_WINNING_TICKETS, SET_ALL_ENS_INFO, SET_ALL_ENS_DOMAINS, - SET_ALL_THREEBOX_INFO, SET_ALL_ORCH_SCORES, SET_ALL_ORCH_INFO, SET_ALL_DEL_INFO, @@ -70,8 +69,6 @@ export default (state = { return { ...state, ensInfoMapping: message }; case SET_ALL_ENS_DOMAINS: return { ...state, ensDomainMapping: message }; - case SET_ALL_THREEBOX_INFO: - return { ...state, threeBoxInfo: message }; case SET_ALL_ORCH_SCORES: return { ...state, orchScores: message }; case SET_ALL_ORCH_INFO: