refactor: earn flow + remove xstate/store - #551
Conversation
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Key validators by address and subnet so selection keeps distinct validator options. Scope balance and init token options to the selected dashboard category.
6cf3187 to
5dac944
Compare
There was a problem hiding this comment.
Stale comment
Risk: high. Not approving: this large earn/borrow refactor exceeds the low-risk approval threshold, Cursor Security Agent left an unresolved medium-severity finding, and required checks did not finish on the latest commit (Bugbot cancelled; Security Agent still running). Assigned jdomingos and dnehl for human review.
Sent by Cursor Approval Agent: Pull Request Router and Approver
There was a problem hiding this comment.
Stale comment
Risk: high. Not approving: this large earn/borrow refactor exceeds the low-risk approval threshold, and Cursor Security Agent has an unresolved medium-severity tabnabbing finding on
complete.tsx. jdomingos and dnehl are already assigned for human review.Sent by Cursor Approval Agent: Pull Request Router and Approver
Split earn intent and view atoms so route and wallet state changes update the resolved view. Keep dispatch separate from view reads and add wallet resolution handling. Cover dashboard tab selection and patch Effect parent tracking.
Use the native TypeScript 7 compiler across the widget and examples. Keep TypeScript 6 API compatibility for Next.js tooling.
There was a problem hiding this comment.
Stale comment
Risk: high. Not approving: this large earn/borrow refactor exceeds the low-risk approval threshold, and Cursor Security Agent has an unresolved medium-severity tabnabbing finding on
complete.tsx. jdomingos and dnehl are already assigned for human review.Sent by Cursor Approval Agent: Pull Request Router and Approver
Replace legacy context, query, and state-machine integrations with Effect services and atom-backed wallet, API, and workflow state. Split Vitest projects and add AST rules to validate the new architecture.
16d2bb4 to
67eb76f
Compare
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: this earn/borrow refactor exceeds the low-risk approval threshold, and Cursor Security Agent still has unresolved high and medium findings that need human review. No new reviewers assigned; two reviewers are already requested.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Identify GEO_LOCATION responses through Schema instead of a type predicate so extra payload fields stay valid. Drop the unused rich-error change stream and inline HTTP client setup in transport.
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: this earn/borrow refactor exceeds the low-risk approval threshold, and Cursor Security Agent still has unresolved high and medium findings that need human review. No new reviewers assigned; two reviewers are already requested.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Move token contracts into a host-facing Schema so Widget Configuration can strip unknown tokens and omit invalid values without rejecting an update. Recover cosmos connector load failures and keep @cosmos-kit in one package chunk so hosts do not see uninitialized live bindings. BREAKING CHANGE: SKTheme is a closed partial of the published token contract instead of an open string map.
HelpModal beside SKApp called useTranslation before WidgetTranslation existed, so titles stuck as raw keys. Render host chrome as SKApp children under the same registry, gate only the modal, and drop TrackingContextProvider. BREAKING CHANGE: TrackingContextProvider is removed. Place HelpModal as SKApp children. Bundled renderSKWidget takes SKHostConfiguration, not React children. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: this earn/borrow refactor exceeds the low-risk approval threshold, and Cursor Security Agent still has unresolved high and medium findings that need human review. No new reviewers assigned; two reviewers are already requested.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Source tests import src and miss crashes that only appear after a host rebundles dist. Add pnpm test:smoke to mount the built package and bundle in Vite and Next production hosts, and run it as a sibling CI job. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: Cursor Security Agent did not reach a terminal state within the polling window, and this earn/borrow refactor exceeds the low-risk approval threshold. Human review is needed; reviewers were already assigned.
Sent by Cursor Approval Agent: Pull Request Router and Approver
CodeQL flagged console.log of apiKey.source because resolveApiKey returned the secret and its origin on the same object. Log the source label separately and return only the key string. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: Cursor Security Agent did not reach a terminal state within the polling window, and this large earn-flow refactor exceeds the low-risk approval threshold. Reviewers were already assigned, so none were added.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Replace React-owned history fetch hooks with focused reward-rate and TVL chart views so range switches keep the drawn series and refresh chrome can delay without changing the published load facts.
Replace generated and historical documentation with a small living set. Keep code and tests authoritative for behavior and retain only current decisions. Remove completed scratch specifications after human review.
Vite already inlines VITE_* values from the Amplify process environment. Echoing them into packages/widget/.env is redundant and turns unset variables into empty strings that skip URL fallbacks.
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: Cursor Security Agent did not reach a terminal state within the polling window, and this earn/borrow refactor exceeds the low-risk approval threshold. Reviewers were already assigned, so none were added.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Derive canonical networks from the generated Legacy and Yield schema intersection. Move wallet-specific definitions into the wallet domain. Use Yield project networks as the enabled-wallet source. Keep empty projects bootstrappable without exposing fallback connectors.
Enable @vitejs/plugin-react's compiler option and drop the Babel Rolldown preset. This removes @rolldown/plugin-babel and babel-plugin-react-compiler from the widget toolchain.
Recognize Robinhood mainnet and testnet as enabled EVM wallet networks. Expose their public chain IDs and viem metadata for wallet connections.
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: Cursor Security Agent did not reach a terminal state within the polling window, and this earn-flow refactor exceeds the low-risk approval threshold. Reviewers were already assigned, so none were added.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Track the current npm rc tag for effect and the @effect packages we already consume. Exclude those packages from the three-day release-age gate so rc.112 can be installed the day it is published.
Keep the Effect source on-disk as searchable reference for agents. Editor excludes still hide .repos from human search and auto-import.
git-subtree-dir: .repos/effect git-subtree-split: 2600f62f4532026928454dcea8d1c48557b3f942
Replace React context and effect-based height/width sync with element slot Atoms and ResizeObserver measurements. Keep last height across route remounts so the shell does not jump, and drop the root-element portal used only for number-input sizing. Enable Biome's React Compiler lint and unblock compiler-incompatible render patterns in wallet scope, virtual list, and Ledger Live navigation.
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: this earn-flow refactor exceeds the low-risk approval threshold, and Cursor Security Agent still has unresolved high findings that need human review. Reviewers were already assigned, so none were added.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Stay on the snake_case 1.x line so cosmos-kit chain types remain compatible.
There was a problem hiding this comment.
Stale comment
Risk: high. Left a non-blocking comment: Cursor Security Agent did not reach a terminal state within the polling window, and this earn-flow refactor exceeds the low-risk approval threshold. Reviewers were already assigned, so none were added.
Sent by Cursor Approval Agent: Pull Request Router and Approver
The API `reason` is English prose with the actual amounts. Use it as the details line when the Widget Instance is English, and keep catalog copy for French so untranslated backend text never leaks.
There was a problem hiding this comment.
Risk: high. Left a non-blocking comment and did not approve: this large earn-flow refactor exceeds the low-risk threshold, and Cursor Security Agent did not finish within the wait window. Human review is needed; no additional reviewers were assigned because two are already requested.
Sent by Cursor Approval Agent: Pull Request Router and Approver


Note
High Risk
Large new DeFi borrow path with wallet signing, transaction submission, and LTV validation touches money-moving flows; earn routing/state refactor could regress staking if mis-wired.
Overview
Adds a feature-flagged borrow experience in the dashboard (form → review → steps → complete, plus borrow position management), backed by a new
borrowmodule: Effect Schema domain models, OpenAPI-generatedBorrowApiclient, and@effect/atom-reactatoms for markets/positions, form state, action execution (sign/submit/confirm), and post-tx cache refresh.Earn flow cleanup: drops
EarnPageStateUsageBoundaryProvider/@xstate/store, removescommon/get-token-balances.tsandgetInitialTokenfrom stake types, and tightens validator handling via a compositeValidator.key(address + optional subnet) used in select-validator and position balance keys.Tooling/config: OpenAPI generator gains
BorrowApi(fullhttpclient+ spec prep), optional CLI spec selection,VITE_BORROW_API_URL/VITE_FORCE_BORROW, and rootpnpm.patchedDependenciesremoved; adds skeleton line/circle loaders for borrow UI loading states.Reviewed by Cursor Bugbot for commit 6cf3187. Configure here.