I'm trying to query a contract state 6 block ago. Unlike web3.js api in Contract.call I can't specify block identifier to run this call against.
What is a correct way of doing this in web3py?
Am I correct in my understanding that as a workaround I can temporarily set Eth.defaultBlock to desired number and I won't run into any internal web3py thread/green thread concurrency issues?
I'm feature-requesting addition of block identifier parameter in Contract.call in accord with web3.js api.
Yes, this should be added (and should be relatively easy to implement)
Interesting that this API is not defined in the web3js v1 docs yet: https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#methods-mymethod-call
Should it be an extra parameter to call? It doesn't really fit inside the transaction dict, semantically.
contract.method(...).call({'from': ..., 'gasPrice': ..., 'gas': ...}, at_block=123456)
I'd say extra optional parameter.
Hey guys...would love to go ahead on this one now...couple things.
1) Should this just be done for the upcoming v4 call interface or should I also build it out for the v3 interface as well (shouldn't require much additional work)?
2) Do you think it's worthwhile to throw an error if block number is outside valid range (0, length of chain]?
Cool sounds good, I'll get to work!
hello锛孖 get the web3 of vision4.2.1锛宐ut i cannot call my contract method at a block number,such as "detail = info.functions.getInfo().call(block_identifier=3)",I always get the "latest" block's info.Could tell me what's the reason of my problem?
Hi @mtcz91 that looks right. There's not enough info to help you debug.
This issue was left open by mistake, it is only tracking the main feature being added. I'm closing it now.
Can you open a new issue with a minimal, complete, and verifiable example: https://stackoverflow.com/help/mcve ? Specifically, the contract source, the contract deployment, any transactions, and the call.
Most helpful comment
Yes, this should be added (and should be relatively easy to implement)