Conversation
Add compute unit estimation and apply it to Orca swaps. Introduces estimateComputeUnitLimit (uses MessageV0 + simulateTransaction) in tx_builder.ts and a small timedPromise debug helper. Update OrcaWhirlpoolProvider to fetch referral instruction concurrently, set initial compute budget with a default limit, replace the compute unit instruction with an estimated limit when available, and expose gasLimit in the returned swap payload. Also add necessary imports and wiring for compute unit limit creation.
Replace reliance on OKX getGasLimit with local Solana transaction simulation to estimate compute unit limits. OkxProvider now accepts a Solana RPC endpoint, creates a Connection, and decodes bs58 tx data into a VersionedTransaction to call the tx_builder simulation helper. Updated tx_builder to accept either Transaction or VersionedTransaction when estimating compute units. Adjusted imports/constructors across the app (apps/api passes the Solana RPC), updated OKX tests to provide the RPC and reflect the new simulation-based flow, and added a small debug eslint directive. This centralizes gas estimation locally and removes the SDK getGasLimit dependency.
Changed Files
|
Summary of ChangesHello @0xh3rman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the handling of Solana transaction compute limits by introducing a simulation-based estimation mechanism. This change allows both the Orca and OKX swap providers to dynamically determine and set more accurate compute unit limits for their transactions, moving away from static or external API-dependent methods. The overall impact is improved transaction reliability and efficiency on the Solana blockchain for these integrated services. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces compute unit estimation for Orca and OKX providers. The implementation is a good step forward. My review focuses on a few areas for improvement: handling of silent failures in error-catching blocks, the use of console.log in a new debug utility which is not ideal for a library, and a minor inconsistency in the returned gasLimit for the Orca provider. The provided suggestions aim to make the code more robust and maintainable.
No description provided.