-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/zap in #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat/zap in #23
+12,931
−2,102
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Remove experimental balanceCache.enhanced.js and PriceCache.enhanced.js - Remove associated test files (109 tests removed) - Files were only used for test coverage experiments - Production uses standard versions without .enhanced suffix - No production code affected, all remaining tests pass
…d their auxiliary type from src/utils/tokenUtils.ts:31-147, leaving only the utilities that ship in production. - Pruned the corresponding Vitest coverage and imports in tests/unit/utils/tokenUtils.test.ts:6-35 and dropped the now-obsolete suites so the tests mirror the slimmer API.
…tryWithBackoff in test/balance.integration.test.js:13 so the integration suite still exercises the retry logic but loops synchronously without waiting between attempts, while keeping the rest of the helper exports intac
…s (you can see it used directly in lines 536, 564, 592) The chain string was just a lookup key that ultimately resolved to the same chainId Simpler caching with consistent keys Less cognitive overhead when reading the code
…der() Simplified the lookup logic - now it just searches by chainId directly Cleaned up the cache key - now just uses chainId (which was already the preferred key) Updated the call site in _getRpcProviderInstance() to only pass chainId The benefits: Less redundancy: No need to pass two parameters that represent the same thing Clearer intent: chainId is the canonical identifier (it's what Pendle API uses throughout) Simpler code: No fallback logic needed since we always have chainId Better caching: Cache key is now consistent (always chainId)
Feat/zap in
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
…iddleware:
- Rewrote the request guards in src/middleware/requestValidator.js:1-166 so both intent payloads and balance routes use local helpers, lowercase addresses, and return the same error payloads as before.
- Replaced the validator arrays in src/utils/validation.js:1-220 with bespoke middleware for swap quotes, provider-specific data, and bulk price queries; routes (src/routes/swap.js:1-215) now call these
functions directly and reuse the sanitized values.
- Rebuilt the balance validator module as a pure utility (src/validators/balanceValidator.js:1-186) and updated its test suite accordingly (test/validators/balanceValidator.test.js:1-194) to exercise the
new helpers and middleware integration.
Swagger is now served from the prebuilt spec:
- src/config/swaggerConfig.js:1-58 loads docs/swagger.json when present and falls back to the base definition without pulling in swagger-jsdoc.
- Added scripts/ensureSwaggerSpec.js:1-17, and npm run docs:generate now just makes sure the spec file exists. Generating OpenAPI definitions from comments is manual going forward—edit docs/swagger.json or
bolt in another generator if you need automation later.
Housekeeping and verifications:
- Dropped express-validator (and the validator override) from package.json:6-45, refreshed the lockfile, and tweaked the README to mention the custom middleware.
- npm run lint, npm run test:coverage, and npm audit --audit-level=moderate all pass locally.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.