fix: handle API inconsistency and update URL#2875
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates the Merkl points incentives hook to better align with Merkl API behavior by tightening the opportunities query and making opportunity matching resilient to inconsistent explorerAddress data.
Changes:
- Updated the tyDro Merkl API URL to request more items and only LIVE opportunities.
- Adjusted opportunity matching to prefer
explorerAddressbut fall back to thetokenslist to handle API inconsistencies. - Filtered/select the points campaign breakdown based on a hardcoded INK point token address.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const pointsOpportunities = opportunities.filter((opp) => | ||
| opp.rewardsRecord.breakdowns.some((breakdown) => | ||
| INK_POINT_TOKEN_ADDRESSES.includes(breakdown.token.address) | ||
| ) | ||
| ); |
There was a problem hiding this comment.
INK_POINT_TOKEN_ADDRESSES.includes(breakdown.token.address) is case-sensitive. Merkl API addresses may come back lowercased while the hardcoded address is checksummed, causing point opportunities to be filtered out unexpectedly. Normalize both sides (e.g., compare .toLowerCase() or precompute a lowercased Set).
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| const rewardsBreakdown = opportunity.rewardsRecord.breakdowns.find((breakdown) => | ||
| INK_POINT_TOKEN_ADDRESSES.includes(breakdown.token.address) | ||
| ); |
There was a problem hiding this comment.
Same case-sensitivity issue here: INK_POINT_TOKEN_ADDRESSES.includes(breakdown.token.address) may fail if the API returns a different address casing. Consider normalizing addresses (lowercasing or checksumming) before doing the lookup so the correct rewards breakdown is found reliably.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
…Merkl incentives (#2877) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: AGMASO <95312462+AGMASO@users.noreply.github.com>
|
📦 Next.js Bundle Analysis for aave-uiThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
General Changes
Developer Notes
Add any notes here that may be helpful for reviewers.
Reviewer Checklist
Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.
.env.examplefile as well as the pertinant.github/actions/*files