Skip to content

Conversation

@d4mr
Copy link
Contributor

@d4mr d4mr commented Nov 1, 2024

The readContract function in the src/server/routes/contract/read/read.ts file has been refactored to improve the parsing of arguments. Previously, the function split the arguments string by comma and mapped each argument. Now, the function first tries to parse the arguments as a JSON array. If successful, it uses the parsed arguments. If parsing fails, it falls back to the previous method of splitting the string.

This change improves the flexibility and reliability of argument parsing in the readContract function.


PR-Codex overview

This PR focuses on enhancing the argument parsing logic in the read function and improving the handling of BigNumber values in the bigNumberReplacer function. Additionally, it introduces new tests for reading contract methods with structured parameters.

Detailed summary

  • Updated argument parsing in src/server/routes/contract/read/read.ts to use JSON parsing as the primary method, with a fallback to string splitting.
  • Changed the return type of bigNumberReplacer in src/server/utils/convertor.ts from string to any.
  • Added support for arrays in bigNumberReplacer.
  • Introduced new tests in test/e2e/tests/read.test.ts for reading contract methods with structured parameters.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

The readContract function in the src/server/routes/contract/read/read.ts file has been refactored to improve the parsing of arguments. Previously, the function split the arguments string by comma and mapped each argument. Now, the function first tries to parse the arguments as a JSON array. If successful, it uses the parsed arguments. If parsing fails, it falls back to the previous method of splitting the string.

This change improves the flexibility and reliability of argument parsing in the readContract function.
@d4mr d4mr merged commit 62f8bad into main Nov 1, 2024
3 checks passed
@d4mr d4mr deleted the pb/struct-fix-read branch November 1, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants