Skip to content

Conversation

KartikSoneji
Copy link

@KartikSoneji KartikSoneji commented Sep 22, 2025

Description

Fallback to try to fetch a program's IDL via RPC if the /api/anchor endpoint fails.

Type of change

  • Bug fix
  • New feature
  • Protocol integration
  • Documentation update
  • Other (please describe):

Testing

Simulated /api/anchor failing by mocking responses.

Related Issues

Checklist

  • My code follows the project's style guidelines
  • I have added tests that prove my fix/feature works
  • All tests pass locally and in CI
  • I have updated documentation as needed
  • CI/CD checks pass
  • I have included screenshots for protocol screens (if applicable)
  • For security-related features, I have included links to related information

Additional Notes


Important

Adds fallback to fetch IDL via RPC if API endpoint fails in anchor.tsx.

  • Behavior:
    • Adds fetchIdlFromApi() and fetchIdlFromRpc() functions in anchor.tsx to fetch IDL from API and RPC respectively.
    • Modifies useIdlFromAnchorProgramSeed() to use fetchIdlFromApi() and fallback to fetchIdlFromRpc() if API call fails.
  • Error Handling:
    • Throws errors with specific messages if IDL fetching fails from both API and RPC.
  • Caching:
    • Updates cachedAnchorProgramPromises to store promises and results for IDL fetching.

This description was created by Ellipsis for 5befcc5. You can customize this summary. It will automatically update as commits are pushed.

Copy link

vercel bot commented Sep 22, 2025

@KartikSoneji is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 5befcc5 in 2 minutes and 39 seconds. Click for details.
  • Reviewed 110 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. app/providers/anchor.tsx:57
  • Draft comment:
    Caching key does not include the cluster. If the same program/address and URL are used with different clusters, they may collide. Consider including the cluster (e.g. ${programAddress}-${url}-${cluster}) in the key.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. app/providers/anchor.tsx:67
  • Draft comment:
    The 'async' keyword in the .then callback is unnecessary since no 'await' is used. Removing it could simplify the code.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The async keyword is indeed unnecessary here since no await is used in the function body. While technically correct, this is a very minor code style issue that doesn't affect functionality. The code works perfectly fine either way. This feels like nitpicking that doesn't meaningfully improve code quality. The comment is technically correct - the async is unnecessary. But am I being too harsh in dismissing minor code style improvements? While technically correct, we should focus on more impactful code quality issues. This change is too minor to warrant a PR comment. Delete this comment as it suggests an extremely minor code style change that doesn't meaningfully improve the codebase.
3. app/providers/anchor.tsx:66
  • Draft comment:
    The catch block used as a fallback discards the error details by using an underscore (_). Capturing and logging the error (e.g. using .catch(error => ...)) would aid in debugging.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None

Workflow ID: wflow_aU3WloGqszVNiOGq

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

vercel bot commented Sep 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
explorer Ready Ready Preview Comment Sep 23, 2025 3:36am

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