Skip to content

feat_: introduce erc20 balance fetcher #5

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

Merged
merged 2 commits into from
Jul 21, 2025

Conversation

dlipicar
Copy link
Collaborator

@dlipicar dlipicar commented Jul 4, 2025

Add ERC20 balance fetching capabilities to the balance fetcher package.
Adjusted example app balance-fetcher-web to showcase new functionality.

image
image

@dlipicar dlipicar marked this pull request as draft July 4, 2025 22:15
@dlipicar dlipicar marked this pull request as ready for review July 14, 2025 12:52
@dlipicar dlipicar force-pushed the feat/balance-fetcher-native branch from a832825 to b974066 Compare July 14, 2025 19:20
Copy link

@friofry friofry left a comment

Choose a reason for hiding this comment

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

Looks great!

@dlipicar dlipicar force-pushed the feat/balance-fetcher-erc20 branch from f8628bd to 3cc4dfd Compare July 15, 2025 14:06
@dlipicar dlipicar changed the base branch from feat/balance-fetcher-native to master July 16, 2025 18:45
@dlipicar dlipicar force-pushed the feat/balance-fetcher-erc20 branch from 3cc4dfd to 179c2c3 Compare July 16, 2025 19:56
@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2025

Codecov Report

Attention: Patch coverage is 90.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 87.28%. Comparing base (5d8e347) to head (85ceaad).

Files with missing lines Patch % Lines
pkg/balance/fetcher/fetcher_standard.go 86.04% 4 Missing and 2 partials ⚠️
pkg/balance/fetcher/fetcher_balancescanner.go 92.10% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master       #5       +/-   ##
===========================================
+ Coverage   45.07%   87.28%   +42.21%     
===========================================
  Files           7        5        -2     
  Lines         264      236       -28     
===========================================
+ Hits          119      206       +87     
+ Misses        142       26      -116     
- Partials        3        4        +1     
Files with missing lines Coverage Δ
pkg/balance/fetcher/fetcher.go 100.00% <100.00%> (ø)
pkg/balance/fetcher/fetcher_balancescanner.go 94.54% <92.10%> (-5.46%) ⬇️
pkg/balance/fetcher/fetcher_standard.go 90.90% <86.04%> (-9.10%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dlipicar dlipicar force-pushed the feat/balance-fetcher-erc20 branch from 179c2c3 to bea2c6f Compare July 16, 2025 20:02
@@ -44,3 +44,57 @@ func FetchNativeBalancesWithBalanceScanner(

return balances, nil
}

func FetchErc20BalancesWithBalanceScanner(
Copy link

Choose a reason for hiding this comment

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

We have a separate package name for tests, which leads us to having functions like FetchErc20BalancesWithBalanceScanner exported. Is this a deliberate approach to not hide the internals of fetcher logic? Do we allow those functions to be called directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I saw no good reason not to export this function (some dev might have their own private deployment of BalanceScanner, or want to ensure that either the more efficient way is used or an error is returned), which allowed me to write the tests in a separate package (which I always find preferable to ensure we're testing behavior and not implementation).

@dlipicar dlipicar force-pushed the feat/balance-fetcher-erc20 branch from 46062d7 to 85ceaad Compare July 21, 2025 18:13
@dlipicar dlipicar merged commit dfd87e0 into master Jul 21, 2025
3 checks passed
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.

4 participants