fix(positions): pass wallet address to getEarnPositions - #297
Open
TuCopFi wants to merge 1 commit into
Open
Conversation
The wallet's getPositions call already scopes results to the caller by passing 'address' but getEarnPositions did not. Without the address the backend can only return a generic pool listing with balance=0 and earningItems=[] for every pool. Today the dedupe loop in fetchPositions hides the bug because getPositions returns Neeru entries with real per-user values, and those win the merge. The moment that contract changes (e.g. Neeru gets moved into a purely earn-hosted response, or partialFailure trims it from getPositions), the earn cards would silently show 0 balance and no rewards. Adds the address, keeps the dedupe order unchanged so behavior is identical today, and adds a URL assertion in the saga test so future edits catch a regression.
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
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.
Summary
src/positions/saga.ts:106builds the getEarnPositions URL withnetworkIdsbut never setsaddress, so the backend can only return a generic pool listing withbalance=0andearningItems=[].getPositions(which does pass address) also returns Neeru with real per-user values, and it wins the merge.getPositionsstops returning Neeru (e.g. it moves to a purely earn-hosted response, orpartialFailuretrims it), earn cards would silently drop to 0 balance and no rewards for every user.Verified
Live cross-check against production backend confirms
getEarnPositionsreturns zeroes withoutaddress:Related concern (out of scope for this PR)
A user reported "intereses de todos" appearing immediately after a new deposit. The wallet only renders what the backend returns for
/api/earn/neeru/positions?address=X, and that endpoint returns a per-positionaccruedInterestsourced from the contract. If a fresh deposit shows non-trivial accrued interest at t=0, that is a contract or indexer attribution bug on the backend side. Flagged for backend to investigate; wallet-side change here is defense-in-depth for the separategetEarnPositionsgap.Test plan
yarn build:ts(0 errors)yarn test --testPathPattern=positions/saga(18/18 pass, including the new URL assertion)