Skip to content

feat_: introduce ethclient #6

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

feat_: introduce ethclient #6

wants to merge 3 commits into from

Conversation

dlipicar
Copy link
Collaborator

@dlipicar dlipicar commented Jul 21, 2025

Introduce types and a convenience client to interact with the standard Ethereum JSON-RPC interface.

go-ethereum's types contain some additional logic (calculate hash based on the contents of a Block/Transaction, for example) which makes them inconvenient to use across different L1s and L2s. This implementation consumes all (and only) information provided in the JSON-RPC responses with no extra assumptions.

@dlipicar dlipicar force-pushed the feat/balance-fetcher-erc20 branch from 46062d7 to 85ceaad Compare July 21, 2025 18:13
@dlipicar dlipicar changed the base branch from feat/balance-fetcher-erc20 to master July 21, 2025 22:38
@dlipicar dlipicar marked this pull request as ready for review July 21, 2025 22:39
@codecov-commenter
Copy link

codecov-commenter commented Jul 21, 2025

Codecov Report

Attention: Patch coverage is 41.61980% with 519 lines in your changes missing coverage. Please review.

Project coverage is 51.20%. Comparing base (dfd87e0) to head (c21c8e6).

Files with missing lines Patch % Lines
pkg/ethclient/types.go 32.09% 303 Missing and 8 partials ⚠️
pkg/ethclient/geth.go 0.00% 98 Missing ⚠️
pkg/ethclient/geth_utils.go 29.23% 38 Missing and 8 partials ⚠️
pkg/ethclient/filter.go 0.00% 24 Missing ⚠️
pkg/ethclient/eth.go 87.36% 23 Missing ⚠️
pkg/ethclient/types_linea.go 37.50% 9 Missing and 1 partial ⚠️
pkg/ethclient/client.go 0.00% 4 Missing ⚠️
pkg/ethclient/linea.go 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master       #6       +/-   ##
===========================================
- Coverage   87.28%   51.20%   -36.09%     
===========================================
  Files           5       16       +11     
  Lines         236     1125      +889     
===========================================
+ Hits          206      576      +370     
- Misses         26      527      +501     
- Partials        4       22       +18     
Files with missing lines Coverage Δ
pkg/ethclient/mock/client.go 100.00% <100.00%> (ø)
pkg/ethclient/net.go 100.00% <100.00%> (ø)
pkg/ethclient/web3.go 100.00% <100.00%> (ø)
pkg/ethclient/linea.go 57.14% <57.14%> (ø)
pkg/ethclient/client.go 0.00% <0.00%> (ø)
pkg/ethclient/types_linea.go 37.50% <37.50%> (ø)
pkg/ethclient/eth.go 87.36% <87.36%> (ø)
pkg/ethclient/filter.go 0.00% <0.00%> (ø)
pkg/ethclient/geth_utils.go 29.23% <29.23%> (ø)
pkg/ethclient/geth.go 0.00% <0.00%> (ø)
... and 1 more
🚀 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/ethclient branch 3 times, most recently from e83cde8 to a7ee8ac Compare July 22, 2025 12:33
}

// Real block JSON data
blockJSON := `{
Copy link

Choose a reason for hiding this comment

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

What do you think about putting this in a separate json file and loading it dynamically?

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rpc"
)

Copy link

Choose a reason for hiding this comment

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

It would be nice to have explanatory comments on these methods as we have in all other files

@vkjr
Copy link

vkjr commented Jul 28, 2025

Looks great! 🎉

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.

3 participants