Add log for handling muliple returned values (#359)

Co-authored-by: Dhruv Srivastava <dhruvdhs.ds@gmail.com>
This commit is contained in:
Nabarun Gogoi 2023-04-12 14:46:43 +05:30 committed by GitHub
parent 7dada71fa3
commit 25df38ace2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 25 deletions

View File

@ -62,6 +62,8 @@ Steps:
# NOTE: When passed an *URL* as contract path, it is assumed that it points to an already flattened contract file. # NOTE: When passed an *URL* as contract path, it is assumed that it points to an already flattened contract file.
``` ```
* Ensure dependencies are installed in the contracts repository before generating the watcher
* Run the following command to generate a watcher from contract(s): * Run the following command to generate a watcher from contract(s):
```bash ```bash

View File

@ -61,6 +61,8 @@
"devDependencies": { "devDependencies": {
"@ethersproject/abi": "^5.3.0", "@ethersproject/abi": "^5.3.0",
"@types/yargs": "^17.0.0", "@types/yargs": "^17.0.0",
"@types/debug": "^4.1.5",
"@types/json-bigint": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^5.47.1", "@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1", "@typescript-eslint/parser": "^5.47.1",
"eslint": "^8.35.0", "eslint": "^8.35.0",

View File

@ -60,6 +60,9 @@ export class Visitor {
let errorMessage = ''; let errorMessage = '';
if (node.returnParameters.length > 1) {
errorMessage = `No support in codegen for multiple returned values from method ${node.name}`;
} else {
const typeName = node.returnParameters[0].typeName; const typeName = node.returnParameters[0].typeName;
switch (typeName.type) { switch (typeName.type) {
case 'ElementaryTypeName': { case 'ElementaryTypeName': {
@ -76,6 +79,7 @@ export class Visitor {
break; break;
} }
case 'UserDefinedTypeName': case 'UserDefinedTypeName':
errorMessage = `No support in codegen for user defined return type from method "${node.name}"`; errorMessage = `No support in codegen for user defined return type from method "${node.name}"`;
break; break;
@ -87,6 +91,7 @@ export class Visitor {
default: default:
errorMessage = `No support in codegen for return type "${typeName.type}" from method "${node.name}"`; errorMessage = `No support in codegen for return type "${typeName.type}" from method "${node.name}"`;
} }
}
if (errorMessage !== '') { if (errorMessage !== '') {
if (this._continueOnError) { if (this._continueOnError) {

View File

@ -3756,7 +3756,7 @@
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138" resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138"
integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA== integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==
"@types/json-bigint@^1.0.0": "@types/json-bigint@^1.0.0", "@types/json-bigint@^1.0.1":
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/json-bigint/-/json-bigint-1.0.1.tgz#201062a6990119a8cc18023cfe1fed12fc2fc8a7" resolved "https://registry.yarnpkg.com/@types/json-bigint/-/json-bigint-1.0.1.tgz#201062a6990119a8cc18023cfe1fed12fc2fc8a7"
integrity sha512-zpchZLNsNuzJHi6v64UBoFWAvQlPhch7XAi36FkH6tL1bbbmimIF+cS7vwkzY4u5RaSWMoflQfu+TshMPPw8uw== integrity sha512-zpchZLNsNuzJHi6v64UBoFWAvQlPhch7XAi36FkH6tL1bbbmimIF+cS7vwkzY4u5RaSWMoflQfu+TshMPPw8uw==
@ -6241,7 +6241,7 @@ commander@^2.15.1, commander@^2.20.3:
commander@^8.1.0: commander@^8.1.0:
version "8.3.0" version "8.3.0"
resolved "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
compare-func@^2.0.0: compare-func@^2.0.0:
@ -14685,7 +14685,7 @@ solc@0.7.3:
solc@0.8.13: solc@0.8.13:
version "0.8.13" version "0.8.13"
resolved "https://registry.npmjs.org/solc/-/solc-0.8.13.tgz" resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.13.tgz#bafc7fcc11a627e2281e489076b80497123bb704"
integrity sha512-C0yTN+rjEOGO6uVOXI8+EKa75SFMuZpQ2tryex4QxWIg0HRWZvCHKfVPuLZ5wx06Sb6GBp6uQA5yqQyXZnXOJw== integrity sha512-C0yTN+rjEOGO6uVOXI8+EKa75SFMuZpQ2tryex4QxWIg0HRWZvCHKfVPuLZ5wx06Sb6GBp6uQA5yqQyXZnXOJw==
dependencies: dependencies:
command-exists "^1.2.8" command-exists "^1.2.8"