Added slower getOrchestratorENS endpoint which also converts delegators addresses to ENS domain names

This commit is contained in:
Marco van Dijk 2022-07-19 00:29:02 +02:00
parent 6efa0c4e1c
commit 1533e84fe5
2 changed files with 249771 additions and 0 deletions

View File

@ -2653,6 +2653,33 @@ apiRouter.get("/getOrchestrator", async (req, res) => {
res.status(400).send(err);
}
});
apiRouter.get("/getOrchestratorENS", async (req, res) => {
try {
let reqOrch = req.query.orch;
if (!reqOrch || reqOrch == "") {
reqOrch = CONF_DEFAULT_ORCH;
}
const reqObj = await parseOrchestrator(reqOrch);
let orchestratorObj = JSON.parse(JSON.stringify(reqObj));
// Replace delegators with ENS domain names
for (var idx = 0; idx < orchestratorObj.delegators.length; idx++) {
console.log(orchestratorObj.delegators[idx]);
for (var idx2 = 0; idx2 < ensDomainCache.length; idx2++) {
console.log(ensDomainCache[idx2]);
if (ensDomainCache[idx2].address == orchestratorObj.delegators[idx].id) {
if (ensDomainCache[idx2].domain){
orchestratorObj.delegators[idx].id = ensDomainCache[idx2].domain;
}
break;
}
}
}
res.send(orchestratorObj);
} catch (err) {
console.log(err);
res.status(400).send(err);
}
});
apiRouter.get("/getOrchestrator/:orch", async (req, res) => {
try {
const reqObj = await parseOrchestrator(req.params.orch);

File diff suppressed because it is too large Load Diff