Support basic array return types of contract methods in codegen (#363)

* Fix ValueTransformers to check for undefined value

* Create Result types if needed

* Update codegen to include array return type queries in schema

* Update codegen to include array return type queries in resolvers

* Update codegen to include array return type queries in indexers

* Codegen skip db caching methods for queries returning unhandled types

* Codegen handle bigint array in indexer

* Update codegen to handle basic array types

* Remove redundant code and refactor

* Codegen map Solidity types directly to GraphQL types

* Codegen get TS from GQL types

* Codegen handle ethers BigNumber array in indexer template

* Fix GQL type returned in client queries

* Codegen unused method isElementaryType should not be exported

* Codegen update README with solc version in config

* Codegen update README with continue-on-error flag

* Codegen add continue-on-error flag for storage mode

* Codegen generate gitignore and license for watchers

* Codegen refactor gitignore and license generation utils

---------

Co-authored-by: Dhruv Srivastava <dhruvdhs.ds@gmail.com>
This commit is contained in:
2023-04-20 13:31:41 +05:30
committed by GitHub
co-authored by Dhruv Srivastava
parent aaa60430e4
commit 49d67899be
17 changed files with 998 additions and 231 deletions
+12
View File
@@ -52,6 +52,10 @@ Steps:
# Watcher server port (default: 3008).
port: 3008
# Solc version to use (optional)
# If not defined, uses solc version listed in dependencies
solc: v0.8.0+commit.c7dfd78e
# Flatten the input contract file(s) [true | false] (default: true).
flatten: true
@@ -72,6 +76,8 @@ Steps:
* `config-file`(alias: `c`): Watcher generation config file path (yaml) (required).
* `continue-on-error` (alias: `e`): To continue generation if any unhandled data type is encountered (optional).
Example:
* Generate code using a config file `config.yaml`:
@@ -80,6 +86,12 @@ Steps:
yarn codegen --config-file ./config.yaml
```
* Generate code ignoring any unhandled data types:
```bash
yarn codegen --config-file ./config.yaml --continue-on-error
```
This will create a folder containing the generated code at the path provided in config. Follow the steps in [Run Generated Watcher](#run-generated-watcher) to setup and run the generated watcher.
## Development