Skip to content

Commit

Permalink
Revert "fix: rollback print with feed name"
Browse files Browse the repository at this point in the history
This reverts commit 0e679b7.
  • Loading branch information
nick-bisonai committed Feb 7, 2024
1 parent 7e8fae2 commit a27fac7
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
42 changes: 21 additions & 21 deletions cli/src/delegator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,28 +298,28 @@ export function reporterListHandler() {
try {
const endpoint = buildUrl(ORAKL_NETWORK_DELEGATOR_URL, `reporter`)
const result = (await axios.get(endpoint)).data
// const printResult: any[] = []

// const aggregatorUrl = new URL(AGGREGATOR_ENDPOINT)
// const aggregatorResult = (await axios.get(aggregatorUrl.toString())).data

// for (const reporter of result) {
// if (!reporter.contract) {
// printResult.push({ ...reporter })
// continue
// }

// const aggregator = aggregatorResult.find(
// (aggregator) => aggregator.address === reporter.contract[0]
// )
// if (aggregator) {
// printResult.push({ ...reporter, name: aggregator.name })
// } else {
// printResult.push({ ...reporter })
// }
// }

const printResult: any[] = []
const aggregatorUrl = new URL(AGGREGATOR_ENDPOINT)
const aggregatorResult = (await axios.get(aggregatorUrl.toString())).data

for (const reporter of result) {
if (!reporter.contract) {
printResult.push({ ...reporter })
continue
}

const aggregator = aggregatorResult.find(
(aggregator) => aggregator.address === reporter.contract[0]
)
if (aggregator) {
printResult.push({ ...reporter, name: aggregator.name })
} else {
printResult.push({ ...reporter })
}
}

console.log(printResult)
console.log(result)
return result
} catch (e) {
console.error('Delegator Reporter was not listed. Reason:')
Expand Down
36 changes: 18 additions & 18 deletions cli/src/listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,28 @@ export function listHandler(print?: boolean) {

try {
const result = (await axios.get(LISTENER_ENDPOINT, { data: { chain, service } }))?.data
// const printResult: any[] = []

const printResult: any[] = []
const aggregatorUrl = new URL(AGGREGATOR_ENDPOINT)
const aggregatorResult = (await axios.get(aggregatorUrl.toString())).data
// const aggregatorUrl = new URL(AGGREGATOR_ENDPOINT)
// const aggregatorResult = (await axios.get(aggregatorUrl.toString())).data
if (print) {
for (const listener of result) {
if (listener.service != 'DATA_FEED') {
printResult.push({ ...listener })
continue
}
// for (const listener of result) {
// if (listener.service != 'DATA_FEED') {
// printResult.push({ ...listener })
// continue
// }

const aggregator = aggregatorResult.find(
(aggregator) => aggregator.address === listener.address
)
if (aggregator) {
printResult.push({ ...listener, name: aggregator.name })
} else {
printResult.push({ ...listener })
}
}
// const aggregator = aggregatorResult.find(
// (aggregator) => aggregator.address === listener.address
// )
// if (aggregator) {
// printResult.push({ ...listener, name: aggregator.name })
// } else {
// printResult.push({ ...listener })
// }
// }

console.dir(printResult, { depth: null })
console.dir(result, { depth: null })
}
return result
} catch (e) {
Expand Down
40 changes: 20 additions & 20 deletions cli/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,28 @@ export function listHandler(print?: boolean) {

try {
const result = (await axios.get(REPORTER_ENDPOINT, { data: { chain, service } }))?.data
// const printResult: any[] = []

const printResult: any[] = []
const aggregatorUrl = new URL(AGGREGATOR_ENDPOINT)
const aggregatorResult = (await axios.get(aggregatorUrl.toString())).data
// const aggregatorUrl = new URL(AGGREGATOR_ENDPOINT)
// const aggregatorResult = (await axios.get(aggregatorUrl.toString())).data
if (print) {
for (const reporter of result) {
if (reporter.service != 'DATA_FEED') {
printResult.push({ ...reporter })
continue
}

const aggregator = aggregatorResult.find(
(aggregator) => aggregator.address === reporter.oracleAddress
)
if (aggregator) {
printResult.push({ ...reporter, name: aggregator.name })
} else {
printResult.push({ ...reporter })
}
}

console.dir(printResult, { depth: null })
// for (const reporter of result) {
// if (reporter.service != 'DATA_FEED') {
// printResult.push({ ...reporter })
// continue
// }

// const aggregator = aggregatorResult.find(
// (aggregator) => aggregator.address === reporter.oracleAddress
// )
// if (aggregator) {
// printResult.push({ ...reporter, name: aggregator.name })
// } else {
// printResult.push({ ...reporter })
// }
// }

console.dir(result, { depth: null })
}
return result
} catch (e) {
Expand Down

0 comments on commit a27fac7

Please sign in to comment.