Skip to content

Conversation

@miro-cl
Copy link

@miro-cl miro-cl commented Jan 27, 2026

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.

Copilot AI review requested due to automatic review settings January 27, 2026 20:08
@miro-cl miro-cl requested a review from a team as a code owner January 27, 2026 20:08
@changeset-bot
Copy link

changeset-bot bot commented Jan 27, 2026

⚠️ No Changeset found

Latest commit: 17a2e16

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link

👋 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!

Copy link
Contributor

Copilot AI left a 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 GetContractCreationTx to 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)
Copy link

Copilot AI Jan 27, 2026

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.

Copilot uses AI. Check for mistakes.
@miro-cl miro-cl changed the title Fix: nil err returned as err Fix: Etherscan API V1 deprecated; add V2 API support Jan 27, 2026
@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

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.

1 participant