-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Call with blockTag
property fails
#329
Comments
Heya! Can you provide a code snippet? If you are using the I think you likely just want: Anyways, just my first thought, please feel free to include a code snippet and I'll look at it further. :) |
Hi @ricmoo !
The original source I test with and well as code snippet below
|
Some additional troubleshooting shows this happens when the method called has input parameters, e.g. |
Oh, so the Call vs. Transaction behaviour is based on the ABI, so there is no way to “call” a state-changing method (there is a tricky way; in the ABI set You can not override the block number of a transaction though. It is useful to do this for call, since you might be curious, for example, of the balance of an ERC-20 contract at a specific block height. But a transaction MUST occur at the height it is mined in. It cannot be overridden. Also note, even in the call case, the node can only satisfy correct results if it is non-pruning, which is often not the case. Make sense? Also, keep in mind in your last example, the |
For more information on the Function.prototype.call method: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call |
I am simply interacting with a
|
Oh! Ok, so you are calling a That should work then. What version are you using of ethers? |
|
That is super strange... I'm at a McDonald's in Prague post DevCon, but have switched to a laptop (from my iPhone) so I can respond with more meaningful responses and include code as needed... I'm looking into this more now. Feel free to jump onto gitter too, if you want more real-time interactivity. :) |
Can you also try blowing away the build directory and re-building? Sometimes Truffle and company use old binary code, or don't update the address properly. |
It is definitely https://github.com/ethers-io/ethers.js/blob/master/src.ts/contract.ts#L159 It makes a copy of the overrides, and if blockTag exists, copies it out and deletes it from the overrides, then checks the overrides for bad keys, which is where your error comes from... It shouldn't be able to get there with that key... |
After more testing |
Excellent point! I have added a fix for when using an explicit Thanks! :) |
Using the
blockTag
option as specified in #226 (comment) (sorry I didn't find any other reference documentation)contract.method.call(param1, param2, { blockTag: blockNumber });
Where
blockNumber
is either"latest"
or a specific block number value.The above call fails with
Error: invalid input argument (arg="_id", reason="invalid number value", value={"blockTag":"latest"}, version=4.0.7)
The text was updated successfully, but these errors were encountered: