Skip to content

feat(widget): add limit order mode#793

Draft
effie-ms wants to merge 10 commits into
feat/advanced-mode-settingsfrom
feat/emb-322-limit-order-mode
Draft

feat(widget): add limit order mode#793
effie-ms wants to merge 10 commits into
feat/advanced-mode-settingsfrom
feat/emb-322-limit-order-mode

Conversation

@effie-ms

Copy link
Copy Markdown
Contributor

Which Linear task is linked to this PR?

https://linear.app/lifi-linear/issue/EMB-322

Why was it implemented this way?

Adds a limit order mode as a dedicated header tab. The core challenge is keeping three interdependent values — send amount, receive amount, and limit price — coherent without circular updates:

  • Linked fields (useLinkedLimitFields) implement one-directional derivation per edit: editing send recomputes receive (from price), editing receive recomputes price, editing price recomputes receive. Send never changes without an explicit user edit.
  • Canonical price storage — the limit price is stored as receive-per-send and only flipped at the display layer (LimitPriceCard), so the inversion toggle, market-proximity indicator, and +N% presets all reason about a single source of truth regardless of which direction is shown.
  • State reset on pair change — switching tokens or re-entering limit mode clears the stale price/receive so a price from a previous pair can't drive a wrong amount or a false off-market warning.
  • Route fetching is wired but gated — the installed @lifi/sdk@4.0.0 can carry neither the extra limit fields (toAmount/validUntil/partiallyFillable) nor a per-call base URL, so a dedicated client (services/limitOrder) mirrors advanced/routes. It is intentionally inactive pending the limit-order API reaching a stable environment — see TODO(EMB-323) in useRoutes. Those stub files are added to knip.json's ignore list until they're activated.

Visual showcase (Screenshots or Videos)

TODO: attach a screen recording of the limit price card, presets, invert toggle, and expiry/partial-fill settings.

Checklist before requesting a review

  • I have performed a self-review and testing of my code.
  • This pull request is focused and addresses a single problem.
  • If this PR modifies the Widget API or adds new features that require documentation, I have updated the documentation in the public-docs repository.

@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 58c0a26

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@effie-ms effie-ms marked this pull request as draft June 16, 2026 10:53
@effie-ms effie-ms self-assigned this Jun 16, 2026
@effie-ms effie-ms force-pushed the feat/advanced-mode-settings branch 2 times, most recently from 6f66b1a to 14cf8cf Compare June 22, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant