q9f / eth.rb

a straightforward library to build, sign, and broadcast ethereum transactions anywhere you can run ruby.
https://q9f.github.io/eth.rb
Apache License 2.0
196 stars 85 forks source link

Problem with fetching archive data #264

Closed wafcio closed 1 month ago

wafcio commented 4 months ago

I want to use eth_call with a custom block number, which should return archive data. Unfortunately, I have found that in line https://github.com/q9f/eth.rb/blob/main/lib/eth/client.rb#L472 "latest" value is added.

Is it possible to put there block number instead of "latest" value?

q9f commented 3 months ago

yes, this is possible. you can try it out by changing latest to a number of your choice and locally run bin/console and test it out with get_balance.

to make it applicable in general for the library, it requires some metaprogramming though.

maybe we can create a configuration that is set by default to latest but can be overridden by some block number for the entire environment.

open for ideas.

wafcio commented 3 months ago

@q9f please provide snippet, how to use it

q9f commented 1 month ago

Fixed in #268