dethcrypto / dethcrypto/TypeChain

call() not being generated on view fns

Open
#683 2 comments 0 reactions 0 assignees View on GitHub
good first issue
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.