Skip to content

Commit

Permalink
fix: separate print variable with return variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Feb 7, 2024
1 parent 85f0d5f commit b2a2bcc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cli/src/delegator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,20 +298,23 @@ export function reporterListHandler() {
try {
const endpoint = buildUrl(ORAKL_NETWORK_DELEGATOR_URL, `reporter`)
const result = (await axios.get(endpoint)).data
const printResult: any[] = []

Check warning on line 301 in cli/src/delegator.ts

View workflow job for this annotation

GitHub Actions / build-publish

Unexpected any. Specify a different type

for (const reporter of result) {
if (!reporter.contract) {
printResult.push(reporter)
continue
}
const url = new URL(AGGREGATOR_ENDPOINT)
url.searchParams.append('address', reporter.contract[0])
const aggregatorResult = (await axios.get(url.toString())).data
if (aggregatorResult && aggregatorResult[0].name) {
reporter.name = aggregatorResult[0].name
printResult.push(reporter)
}
}

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

try {
const result = (await axios.get(LISTENER_ENDPOINT, { data: { chain, service } }))?.data

const printResult: any[] = []

Check warning on line 130 in cli/src/listener.ts

View workflow job for this annotation

GitHub Actions / build-publish

Unexpected any. Specify a different type
if (print) {
for (const listener of result) {
if (listener.service != 'DATA_FEED') {
printResult.push(listener)
continue
}

const url = new URL(AGGREGATOR_ENDPOINT)
url.searchParams.append('address', listener.address)
const aggregatorResult = (await axios.get(url.toString())).data
if (aggregatorResult && aggregatorResult[0].name) {
listener.name = aggregatorResult[0].name
printResult.push(listener)
}
}

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

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

Check warning on line 152 in cli/src/reporter.ts

View workflow job for this annotation

GitHub Actions / build-publish

Unexpected any. Specify a different type
if (print) {
for (const reporter of result) {
if (reporter.service != 'DATA_FEED') {
printResult.push(reporter)
continue
}
const url = new URL(AGGREGATOR_ENDPOINT)
url.searchParams.append('address', reporter.oracleAddress)
const aggregatorResult = (await axios.get(url.toString())).data
if (aggregatorResult && aggregatorResult[0].name) {
reporter.name = aggregatorResult[0].name
printResult.push(reporter)
}
}

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

0 comments on commit b2a2bcc

Please sign in to comment.