TypeChain
TypeChain copied to clipboard
call() not being generated on view fns
In the description of @truffle/contract under "Calling getters" the documentation makes clear you can do something like
instance.getValue.call().then(function(val) {
// val represents the `value` storage object in the solidity contract
// since the contract returns that value.
});
It notes that .call() is optional, but I believe making this explicit is often a good idea. Unfortunately, with the types generated by this library, the .call() is not a valid syntax, because invoking the generic .call() on the CallableFunction being assumed here requires passing a this argument as a first parameter, and .call() doesn't have that.
I would propose adding a call() similar to what is found on non-view functions.
Hi guys, as correctly described by @wbt according with Truffle doc:
Target:
With Truffle For getter function that aren't "view" or "pure" add an optional method .call() to chain to getter function.
I will report further relevant information about "Truffle" and the "call ()" method in this Thread before approaching the code change and make PR
Thanks for your inquiry @StefanoGagliardi! Were you able to make any progress on this?