mirror of
https://github.com/stronk-dev/LivepeerEvents.git
synced 2025-07-05 10:45:10 +02:00
Small cleanup
This commit is contained in:
parent
a36125a842
commit
50dea0e3e8
@ -249,8 +249,6 @@ const parseOrchestrator = async function (reqAddr) {
|
|||||||
// First get cached object
|
// First get cached object
|
||||||
for (var orch of orchestratorCache) {
|
for (var orch of orchestratorCache) {
|
||||||
if (orch.addr == reqAddr) {
|
if (orch.addr == reqAddr) {
|
||||||
console.log("found cached obj");
|
|
||||||
console.log(orch);
|
|
||||||
wasCached = true;
|
wasCached = true;
|
||||||
orchestratorObj = orch;
|
orchestratorObj = orch;
|
||||||
break;
|
break;
|
||||||
@ -259,9 +257,6 @@ const parseOrchestrator = async function (reqAddr) {
|
|||||||
if (wasCached) {
|
if (wasCached) {
|
||||||
if (now - orch.lastGet < timeoutTheGraph) {
|
if (now - orch.lastGet < timeoutTheGraph) {
|
||||||
needsUpdate = false;
|
needsUpdate = false;
|
||||||
console.log("cached obj is up to date");
|
|
||||||
}else{
|
|
||||||
console.log("cached obj needs update");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!wasCached || needsUpdate) {
|
if (!wasCached || needsUpdate) {
|
||||||
@ -306,23 +301,17 @@ const parseOrchestrator = async function (reqAddr) {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
orchestratorObj = JSON.stringify(await request("https://api.thegraph.com/subgraphs/name/livepeer/arbitrum-one", orchQuery));
|
orchestratorObj = JSON.stringify(await request("https://api.thegraph.com/subgraphs/name/livepeer/arbitrum-one", orchQuery));
|
||||||
console.log("downloaded new obj");
|
|
||||||
console.log(orchestratorObj);
|
|
||||||
if (wasCached) {
|
if (wasCached) {
|
||||||
for (var orch of orchestratorCache) {
|
for (var orch of orchestratorCache) {
|
||||||
if (orch.addr == requestedOrchestrator) {
|
if (orch.addr == requestedOrchestrator) {
|
||||||
console.log("modifying existing obj in cache");
|
|
||||||
orch = orchestratorObj;
|
orch = orchestratorObj;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("pushing this obj to cache");
|
|
||||||
orchestratorCache.push(orchestratorObj);
|
orchestratorCache.push(orchestratorObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("returning obj");
|
|
||||||
console.log(orchestratorObj);
|
|
||||||
return orchestratorObj;
|
return orchestratorObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +324,6 @@ apiRouter.get("/getOrchestrator", async (req, res) => {
|
|||||||
const reqObj = await parseOrchestrator(reqOrch);
|
const reqObj = await parseOrchestrator(reqOrch);
|
||||||
res.send(reqObj);
|
res.send(reqObj);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
|
||||||
res.status(400).send(err);
|
res.status(400).send(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -345,7 +333,6 @@ apiRouter.get("/getOrchestrator/:orch", async (req, res) => {
|
|||||||
const reqObj = await parseOrchestrator(req.params.orch);
|
const reqObj = await parseOrchestrator(req.params.orch);
|
||||||
res.send(reqObj);
|
res.send(reqObj);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
|
||||||
res.status(400).send(err);
|
res.status(400).send(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
{/* Ability to receive and clear errors as dispatch actions
|
|
||||||
Requires this in files where errors can be received:
|
|
||||||
const mapStateToProps = ({ errors }) => ({
|
|
||||||
errors
|
|
||||||
});
|
|
||||||
*/}
|
|
||||||
export const RECEIVE_ERRORS = "RECEIVE_ERRORS";
|
export const RECEIVE_ERRORS = "RECEIVE_ERRORS";
|
||||||
export const RECEIVE_NOTIFICATIONS = "RECEIVE_NOTIFICATIONS";
|
export const RECEIVE_NOTIFICATIONS = "RECEIVE_NOTIFICATIONS";
|
||||||
export const CLEAR_ERRORS = "CLEAR_ERRORS";
|
export const CLEAR_ERRORS = "CLEAR_ERRORS";
|
||||||
|
@ -62,7 +62,6 @@ export const getCurrentOrchestratorInfo = () => async dispatch => {
|
|||||||
export const getOrchestratorInfo = (orchAddr) => async dispatch => {
|
export const getOrchestratorInfo = (orchAddr) => async dispatch => {
|
||||||
const response = await apiUtil.getOrchestratorInfo(orchAddr);
|
const response = await apiUtil.getOrchestratorInfo(orchAddr);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
console.log(data);
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
return dispatch(setOrchestratorInfo(data));
|
return dispatch(setOrchestratorInfo(data));
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@ const stakeColour = "rgba(71, 23, 122, 0.3)";
|
|||||||
const EventButton = (obj) => {
|
const EventButton = (obj) => {
|
||||||
// Data shared among all events in this transaction
|
// Data shared among all events in this transaction
|
||||||
const thisURL = obj.transactionUrl;
|
const thisURL = obj.transactionUrl;
|
||||||
const thisTransaction = obj.transactionHash;
|
//const thisTransaction = obj.transactionHash;
|
||||||
const thisData = obj.events;
|
const thisData = obj.events;
|
||||||
const thisIndex = obj.idx;
|
//const thisIndex = obj.idx;
|
||||||
// Abstraction of all events in this transaction
|
// Abstraction of all events in this transaction
|
||||||
let transactionName = "";
|
let transactionName = "";
|
||||||
let transactionCaller = "";
|
let transactionCaller = "";
|
||||||
@ -28,7 +28,7 @@ const EventButton = (obj) => {
|
|||||||
// Which we will fill in by going over all of the events once
|
// Which we will fill in by going over all of the events once
|
||||||
thisData.map(eventObj => {
|
thisData.map(eventObj => {
|
||||||
// Bond: contains amount the transaction is about and who is participating
|
// Bond: contains amount the transaction is about and who is participating
|
||||||
if (eventObj.name == "Bond") {
|
if (eventObj.name === "Bond") {
|
||||||
transactionCaller = eventObj.data.delegator.toLowerCase();
|
transactionCaller = eventObj.data.delegator.toLowerCase();
|
||||||
transactionFrom = eventObj.data.oldDelegate.toLowerCase();
|
transactionFrom = eventObj.data.oldDelegate.toLowerCase();
|
||||||
transactionTo = eventObj.data.newDelegate.toLowerCase();
|
transactionTo = eventObj.data.newDelegate.toLowerCase();
|
||||||
@ -37,7 +37,7 @@ const EventButton = (obj) => {
|
|||||||
hasBondTransaction = true;
|
hasBondTransaction = true;
|
||||||
}
|
}
|
||||||
// TranscoderActivated: defines transactionName. Defines transactionAmount as X * 7e-18 LPT
|
// TranscoderActivated: defines transactionName. Defines transactionAmount as X * 7e-18 LPT
|
||||||
if (eventObj.name == "TranscoderActivated") {
|
if (eventObj.name === "TranscoderActivated") {
|
||||||
transactionName = "Activated";
|
transactionName = "Activated";
|
||||||
transactionWhen = eventObj.data.activationRound;
|
transactionWhen = eventObj.data.activationRound;
|
||||||
if (!hasBondTransaction) {
|
if (!hasBondTransaction) {
|
||||||
@ -47,7 +47,7 @@ const EventButton = (obj) => {
|
|||||||
isOnlyBond = false;
|
isOnlyBond = false;
|
||||||
}
|
}
|
||||||
// TranscoderActivated: defines transactionName. Defines transactionAmount as X / 1000000000000000000 LPT
|
// TranscoderActivated: defines transactionName. Defines transactionAmount as X / 1000000000000000000 LPT
|
||||||
if (eventObj.name == "Reward") {
|
if (eventObj.name === "Reward") {
|
||||||
transactionName = "Reward";
|
transactionName = "Reward";
|
||||||
transactionCaller = eventObj.data.transcoder.toLowerCase();
|
transactionCaller = eventObj.data.transcoder.toLowerCase();
|
||||||
transactionAmount = eventObj.data.amount / 1000000000000000000;
|
transactionAmount = eventObj.data.amount / 1000000000000000000;
|
||||||
@ -55,7 +55,7 @@ const EventButton = (obj) => {
|
|||||||
isOnlyBond = false;
|
isOnlyBond = false;
|
||||||
}
|
}
|
||||||
// TranscoderUpdate: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut
|
// TranscoderUpdate: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut
|
||||||
if (eventObj.name == "TranscoderUpdate") {
|
if (eventObj.name === "TranscoderUpdate") {
|
||||||
transactionName = "Update";
|
transactionName = "Update";
|
||||||
transactionCaller = eventObj.data.transcoder.toLowerCase();
|
transactionCaller = eventObj.data.transcoder.toLowerCase();
|
||||||
transactionAmount = eventObj.data.rewardCut / 10000;
|
transactionAmount = eventObj.data.rewardCut / 10000;
|
||||||
@ -64,7 +64,7 @@ const EventButton = (obj) => {
|
|||||||
isOnlyBond = false;
|
isOnlyBond = false;
|
||||||
}
|
}
|
||||||
// WithdrawStake: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut
|
// WithdrawStake: defines transactionName. Defines transactionAmount as rewardCut and transactionAdditionalAmount as feeCut
|
||||||
if (eventObj.name == "WithdrawStake") {
|
if (eventObj.name === "WithdrawStake") {
|
||||||
transactionName = "Withdraw";
|
transactionName = "Withdraw";
|
||||||
transactionCaller = eventObj.data.delegator.toLowerCase();
|
transactionCaller = eventObj.data.delegator.toLowerCase();
|
||||||
transactionAmount = eventObj.data.amount / 1000000000000000000;
|
transactionAmount = eventObj.data.amount / 1000000000000000000;
|
||||||
@ -81,7 +81,7 @@ const EventButton = (obj) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let eventSpecificInfo;
|
let eventSpecificInfo;
|
||||||
if (transactionName == "Reward") {
|
if (transactionName === "Reward") {
|
||||||
if (transactionAmount - 69 < 1 && transactionAmount - 69 > 0) {
|
if (transactionAmount - 69 < 1 && transactionAmount - 69 > 0) {
|
||||||
eventSpecificInfo =
|
eventSpecificInfo =
|
||||||
<div className="rowAlignLeft">
|
<div className="rowAlignLeft">
|
||||||
@ -93,12 +93,12 @@ const EventButton = (obj) => {
|
|||||||
<p>called reward worth {transactionAmount.toFixed(2)} LPT</p>
|
<p>called reward worth {transactionAmount.toFixed(2)} LPT</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
} else if (transactionName == "Update") {
|
} else if (transactionName === "Update") {
|
||||||
eventSpecificInfo =
|
eventSpecificInfo =
|
||||||
<div className="rowAlignLeft">
|
<div className="rowAlignLeft">
|
||||||
<p>changed their reward commission to {transactionAmount.toFixed(2)}% and their fee commission to {transactionAdditionalAmount.toFixed(2)}%</p>
|
<p>changed their reward commission to {transactionAmount.toFixed(2)}% and their fee commission to {transactionAdditionalAmount.toFixed(2)}%</p>
|
||||||
</div>
|
</div>
|
||||||
} else if (transactionName == "Stake") {
|
} else if (transactionName === "Stake") {
|
||||||
if (transactionFrom == "0x0000000000000000000000000000000000000000") {
|
if (transactionFrom == "0x0000000000000000000000000000000000000000") {
|
||||||
eventSpecificInfo =
|
eventSpecificInfo =
|
||||||
<div className="rowAlignLeft">
|
<div className="rowAlignLeft">
|
||||||
@ -114,12 +114,12 @@ const EventButton = (obj) => {
|
|||||||
<button className="selectOrch" onClick={() => {obj.setOrchFunction(transactionTo)}} >{transactionTo}</button>
|
<button className="selectOrch" onClick={() => {obj.setOrchFunction(transactionTo)}} >{transactionTo}</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
} else if (transactionName == "Withdraw") {
|
} else if (transactionName === "Withdraw") {
|
||||||
eventSpecificInfo =
|
eventSpecificInfo =
|
||||||
<div className="rowAlignLeft">
|
<div className="rowAlignLeft">
|
||||||
<p> withdrew {(transactionAmount / 1000000000000000000).toFixed(2)} LPT in round {transactionWhen}</p>
|
<p> withdrew {(transactionAmount / 1000000000000000000).toFixed(2)} LPT in round {transactionWhen}</p>
|
||||||
</div>
|
</div>
|
||||||
} else if (transactionName == "Activated") {
|
} else if (transactionName === "Activated") {
|
||||||
if (hasBondTransaction) {
|
if (hasBondTransaction) {
|
||||||
eventSpecificInfo =
|
eventSpecificInfo =
|
||||||
<div className="rowAlignLeft">
|
<div className="rowAlignLeft">
|
||||||
|
@ -20,8 +20,8 @@ const EventViewer = (obj) => {
|
|||||||
<div className="overflow-content" style={{ cursor: 'grab' }}>
|
<div className="overflow-content" style={{ cursor: 'grab' }}>
|
||||||
{obj.events.slice(0).reverse().map((eventObj, idx) => {
|
{obj.events.slice(0).reverse().map((eventObj, idx) => {
|
||||||
// Filter
|
// Filter
|
||||||
if (eventObj.name == "WithdrawFees" || eventObj.name == "TransferBond"
|
if (eventObj.name === "WithdrawFees" || eventObj.name === "TransferBond"
|
||||||
|| eventObj.name == "Rebond" || eventObj.name == "Unbond" || eventObj.name == "EarningsClaimed"){
|
|| eventObj.name === "Rebond" || eventObj.name === "Unbond" || eventObj.name === "EarningsClaimed"){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// New transaction found
|
// New transaction found
|
||||||
|
@ -47,26 +47,20 @@ const Orchestrator = (obj) => {
|
|||||||
{thisID}
|
{thisID}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="rowAlignLeft">
|
<p>Earned fees {totalVolumeETH} Eth (${totalVolumeUSD})</p>
|
||||||
<p>Earned fees {totalVolumeETH} Eth (${totalVolumeUSD})</p>
|
<p>Reward Cut {rewardCut}%</p>
|
||||||
</div>
|
<p>Fee Cut {feeCut}%</p>
|
||||||
<div className="rowAlignLeft">
|
<p>Total Stake {totalStake} LPT</p>
|
||||||
<p>Reward Cut {rewardCut}%</p>
|
<p>Self stake {selfStake} LPT ({selfStakeRatio}%)</p>
|
||||||
<p>Fee Cut {feeCut}%</p>
|
|
||||||
</div>
|
|
||||||
<div className="rowAlignLeft">
|
|
||||||
<p>Total Stake {totalStake} LPT</p>
|
|
||||||
<p>Self stake {selfStake} LPT ({selfStakeRatio}%)</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="rowAlignLeft">
|
<div className="strokeSmollLeft">
|
||||||
<div className="content-wrapper">
|
<div className="content-wrapper">
|
||||||
<ScrollContainer className="overflow-container" hideScrollbars={false}>
|
<ScrollContainer className="overflow-container" hideScrollbars={false}>
|
||||||
<div className="overflow-content" style={{ cursor: 'grab', height: '300px' }}>
|
<div className="overflow-content" style={{ cursor: 'grab', height: '300px' }}>
|
||||||
{
|
{
|
||||||
delegators.map((delObj, idx) => {
|
delegators.map((delObj, idx) => {
|
||||||
return (
|
return (
|
||||||
<div className="rowAlignLeft">
|
<div className="rowAlignLeft" key={"delegator"+idx}>
|
||||||
<a href={"https://explorer.livepeer.org/accounts/" + delObj.id}>
|
<a href={"https://explorer.livepeer.org/accounts/" + delObj.id}>
|
||||||
<img alt="" src="livepeer.png" width="30" height="30" />{delObj.id.substr(0, 6) + ".."}</a>
|
<img alt="" src="livepeer.png" width="30" height="30" />{delObj.id.substr(0, 6) + ".."}</a>
|
||||||
<div className="strokeSmollLeft">
|
<div className="strokeSmollLeft">
|
||||||
@ -85,14 +79,12 @@ const Orchestrator = (obj) => {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="hostInfo" style={{ height: '100%', width: '100%', display: 'flex' }}>
|
<div className="hostInfo" style={{ height: '100%', width: '100%', display: 'flex' }}>
|
||||||
<div style={{ flexDirection: 'strokeSmollLeft', display: "flex", height: '100%', width: '100%' }}>
|
<div className="rowAlignLeft">
|
||||||
<div className="rowAlignLeft">
|
<img alt="" src="livepeer.png" width="30" height="30" />
|
||||||
<img alt="" src="livepeer.png" width="30" height="30" />
|
<h3>Orchestrator Info</h3>
|
||||||
<h3>Orchestrator Info</h3>
|
</div>
|
||||||
</div>
|
<div className="rowAlignLeft">
|
||||||
<div className="rowAlignLeft">
|
<p>Click on an orchestrator in the list below!</p>
|
||||||
<p>Click on an orchestrator in the list below!</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -59,7 +59,6 @@ p {
|
|||||||
/* width */
|
/* width */
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
box-shadow: 0px 0px 8px 4px rgba(8, 7, 56, 0.692);
|
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user