refactor merkl to use api key#2707
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdds a shared Merkl API client (merklGet) that injects MERKL_API_KEY from env and migrates multiple adapters to use it for fetching /v4/opportunities; the deploy workflow exposes MERKL_API_KEY from secrets to the deploy step. ChangesMerkl Client Refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: one or more packages not found in the registry. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The altura adapter exports pools: Test Suites: 1 passed, 1 total |
|
The altura adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/adaptors/lendle-earn/index.js (1)
24-24: ⚡ Quick winPrefer a relative Merkl path to keep this adapter aligned with the shared client contract.
Passing a full URL still works, but using a relative path keeps base-URL management centralized in
merkl-clientand consistent with the rest of this PR.Suggested diff
-const vaultsCampaignApi = 'https://api.merkl.xyz/v4/opportunities?name=lendle'; +const vaultsCampaignApi = '/v4/opportunities?name=lendle';Also applies to: 54-54
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/adaptors/lendle-earn/index.js` at line 24, Replace the hardcoded full Merkl URL with a relative path so base-URL resolution stays in merkl-client: change the constant vaultsCampaignApi (and the other similar constant at the second occurrence) from 'https://api.merkl.xyz/v4/opportunities?name=lendle' to the relative '/v4/opportunities?name=lendle' (preserve the variable names vaultsCampaignApi and the other identifier) so the shared client can prepend the base URL consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/adaptors/gearbox/index.js`:
- Line 583: The call to merklGet uses a trailing slash in the endpoint
(`/v4/opportunities/`) which may behave differently than `/v4/opportunities`;
update the merklGet invocation in the code that constructs `data` so it uses a
normalized path (e.g., `/v4/opportunities` without the trailing slash) or build
the URL using a join that strips duplicate slashes; change the line with `const
data = await
merklGet(`/v4/opportunities/?chainId=${config.chainId}&identifier=${poolId}`);`
to use the normalized endpoint (`/v4/opportunities`) while keeping the same
query parameters.
In `@src/adaptors/merkl/merkl-client.js`:
- Around line 16-23: The merklGet function lacks an axios timeout which can
cause indefinite hangs; update merklGet to accept/merge a timeout from options
(e.g., options.timeout) and pass a sensible default (e.g., 5000 ms) into the
axios.get config along with the existing headers (used via getMerklHeaders) and
other rest options; ensure you still call buildUrl(pathOrUrl) and do not remove
existing merging of ...rest so callers can override the default timeout if
desired.
---
Nitpick comments:
In `@src/adaptors/lendle-earn/index.js`:
- Line 24: Replace the hardcoded full Merkl URL with a relative path so base-URL
resolution stays in merkl-client: change the constant vaultsCampaignApi (and the
other similar constant at the second occurrence) from
'https://api.merkl.xyz/v4/opportunities?name=lendle' to the relative
'/v4/opportunities?name=lendle' (preserve the variable names vaultsCampaignApi
and the other identifier) so the shared client can prepend the base URL
consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 47ff7956-1e49-459f-992d-a21691610ecb
📒 Files selected for processing (13)
.github/workflows/master.ymlsrc/adaptors/altura/index.jssrc/adaptors/betswirl/index.jssrc/adaptors/crosscurve/index.jssrc/adaptors/extra-finance-xlend/index.jssrc/adaptors/gearbox/index.jssrc/adaptors/lendle-earn/index.jssrc/adaptors/merkl/merkl-additional-reward.jssrc/adaptors/merkl/merkl-by-identifier.jssrc/adaptors/merkl/merkl-client.jssrc/adaptors/ploutos-money/index.jssrc/adaptors/superlend/index.jssrc/adaptors/termmax/index.js
|
The altura adapter exports pools: Test Suites: 1 passed, 1 total |
|
The altura adapter exports pools: Test Suites: 1 passed, 1 total |
Summary by CodeRabbit