-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix DeFi Positions fetching and transforming #2718
Conversation
- Update Moralis API to support non-paginated endpoints - Enhance DefiResponse transformer to map Moralis response to a more structured format - Add fetchMoralisDefi helper function for DeFi-specific API calls - Improve type definitions for DeFi-related responses
Deploying decent-interface with
|
Latest commit: |
90f91f9
|
Status: | ✅ Deploy successful! |
Preview URL: | https://c31ffba8.decent-interface.pages.dev |
Branch Preview URL: | https://eng-196-defi-positions-fix.decent-interface.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Thanks!
functions/shared/moralisApi.ts
Outdated
// Handle paginated vs non-paginated responses | ||
if (isPaginated) { | ||
const paginatedData = data as MoralisResponse<T>; | ||
if (!paginatedData || !paginatedData.result) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case something weird happens like Moralis changing their API for whatever reason, an error log here before the break
would be helpful for faster bug ID'ing. Cz this shouldn't ever happen ideally right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct. updated.
…efi function - Remove redundant fetchMoralisDefi helper function - Update balances endpoint to use fetchMoralis directly with isPaginated flag - Streamline Moralis API calls for DeFi positions
- Add robust error logging for Moralis API requests - Implement page count limit to prevent infinite pagination - Enhance error handling for unexpected API response structures - Add console warnings and errors for better debugging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIck. honestly didn't realize that section existed there. Tested and reviewed
Closes https://linear.app/decent-labs/issue/ENG-196/moralis-defi-positions-api-is-currently-broken