dethcrypto / dethcrypto/TypeChain
call() not being generated on view fns
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 376
- PR merge metrics
- No merged PRs in 30d
Description
In the [description of @truffle/contract](https://www.npmjs.com/package/@truffle/contract) under "Calling getters" the documentation makes clear you can do something like
```js
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.
Contributor guide
Assessment
This issue has not been assessed yet.