-
Notifications
You must be signed in to change notification settings - Fork 2
Fix: Etherscan API V1 deprecated; add V2 API support #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
👋 miro-cl, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where error messages from the Etherscan API were being swallowed when the API returned an error that was not related to an unsupported action.
Changes:
- Modified error handling in
GetContractCreationTxto properly format and return error messages from the API instead of returning a nil error variable
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // If API call failed due to reasons other than action unsupported, there is no fallback. | ||
| if !strings.Contains(errMsg, "invalid Action name") { | ||
| return "", err | ||
| return "", fmt.Errorf("failed to get contract creation tx: %s", errMsg) |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable err is being replaced with a newly formatted error, but the original err variable may contain valuable context (such as stack traces or wrapped errors). Consider wrapping the original error using fmt.Errorf(\"failed to get contract creation tx: %s: %w\", errMsg, err) to preserve the error chain, or verify that err is truly nil at this point in the code path.
|





Fixes issue where an unset err is returned, which swallows the error message returned from the API.
E.g.,
You are using a deprecated V1 endpoint, switch to Etherscan API V2 using https://docs.etherscan.io/v2-migration.