Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paul/lifi reporter #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Paul/lifi reporter #194

wants to merge 1 commit into from

Conversation

paullinator
Copy link
Member

@paullinator paullinator commented Nov 9, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Copy link
Collaborator

@samholmes samholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can pass, but I'd rather have stricter IO by use of cleaners

const response = await fetch(`${url}/v1/integrators/edgeapp`)
if (!response.ok) {
const text = await response.text()
throw new Error(text)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error should include text for lookup

throw new Error(text)
}

const minAmount = Number(process.argv[2] ?? 100)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a cleaner to avoid NaN numbers

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asStringNumber?

Comment on lines +40 to +41
const result = await response.json()
const integrators = asIntegrators(result)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we don't use asJSON more often?

const integrators = asIntegrators(result)
let balUsd = 0
const tokenAddresses: { [chainId: string]: string[] } = {}
console.log(JSON.stringify(integrators, null, 2))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this console log for debugging?

console.log(JSON.stringify(integrators, null, 2))
integrators.feeBalances.forEach(fb => {
fb.tokenBalances.forEach(tb => {
const amount = Number(tb.amountUsd)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why not use an asStringNumber?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants