Skip to content

Add limit order form with Intent pallet integration#3752

Draft
DuriSK wants to merge 3 commits intomasterfrom
limit_v2
Draft

Add limit order form with Intent pallet integration#3752
DuriSK wants to merge 3 commits intomasterfrom
limit_v2

Conversation

@DuriSK
Copy link
Copy Markdown
Collaborator

@DuriSK DuriSK commented Apr 17, 2026

  • New Limit tab in swap with price, expiry, partial-fill controls
  • Intent submission via Intent.submit_intent extrinsic
  • Active intents displayed in Open Orders with cancel (Intent.remove_intent)
  • Spot price sourced from spotPriceQuery for parity with market view
  • formatCalcValue applied to all auto-calculated values for consistent decimals

- New Limit tab in swap with price, expiry, partial-fill controls
- Intent submission via Intent.submit_intent extrinsic
- Active intents displayed in Open Orders with cancel (Intent.remove_intent)
- Spot price sourced from spotPriceQuery for parity with market view
- formatCalcValue applied to all auto-calculated values for consistent decimals

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 17, 2026

Deploy Preview for testnet-hydra-app ready!

Name Link
🔨 Latest commit cdd1bba
🔍 Latest deploy log https://app.netlify.com/projects/testnet-hydra-app/deploys/69e7de380f2007000817a065
😎 Deploy Preview https://deploy-preview-3752--testnet-hydra-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 17, 2026

Deploy Preview for hydration-storybook ready!

Name Link
🔨 Latest commit cdd1bba
🔍 Latest deploy log https://app.netlify.com/projects/hydration-storybook/deploys/69e7de38c076120008db3156
😎 Deploy Preview https://deploy-preview-3752--hydration-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 17, 2026

Deploy Preview for edge-hydra-app ready!

Name Link
🔨 Latest commit cdd1bba
🔍 Latest deploy log https://app.netlify.com/projects/edge-hydra-app/deploys/69e7de38c8d8a80008029038
😎 Deploy Preview https://deploy-preview-3752--edge-hydra-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 0 (no change from production)
Accessibility: 66 (no change from production)
Best Practices: 92 (no change from production)
SEO: 91 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Juraj and others added 2 commits April 20, 2026 22:56
- Flip pill with explicit "1 SYMBOL =" label replaces the tiny direction arrow
- Whole deviation % pill is clickable (no need to target the pencil icon)
- Asset-direction flip preserves and swaps amounts (was clearing sell)
- Last-touched amount is the anchor; price change recalcs the other side
- Pill input ≤-100% silently rejected (was leaving form in inconsistent state)
- Display value cached per direction so typed input isn't mangled by round-trips
- formatCalcValue strips trailing zeros (80000.00 → 80000)
- Summary section: human-readable sentence below the form

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DCA submission:
- useSubmitDcaOrder now builds Intent.submit_intent with Dca variant
  (matches runtime DcaParams: per-trade amount_in/amount_out, Permill
  slippage, Option<Balance> budget, u32 period in blocks). ERC20 A-tokens
  unwrapped to their underlying assetId.
- useIntentOrdersData surfaces Dca intents alongside Swap (limit) intents
  in Open Orders, with OrderKind.Dca / DcaRolling based on budget.
- OpenOrders cancel generalized: any row with intentId cancels via
  Intent.remove_intent; legacy DCA schedules still use DCA.terminate.
- IntentDcaData type added in api/intents.ts (replaces the any-typed
  Dca variant).

Limit order:
- Price mirrors spot live (priceAnchor = "spot") until the user types a
  custom price or percentage, which flips it to "user". Clicking Spot
  resumes mirroring. Fixes the stale spot price bug where limit price
  froze at page-load spot.
- userPct state preserves the exact percentage the user typed (avoids
  15% redisplaying as 15.01% from round-trip rounding).
- Pill edit lives inline in the pill container: numeric input next to a
  static "%" and the pencil icon. Remembers last-typed value; placeholder
  hides on focus; empty commit resets to spot.
- Live recalc on every keystroke in the pill (no blur/Enter needed).
- Flip button becomes icon-only (no "1 SYMBOL =" text).
- Spot reset moved under the price row, right-aligned.
- Lock pill gets blue accent styling when locked (matches active expiry
  pill) so the on/off state reads at a glance.
- Expiry windows changed to 15min/30min/1h/1d/open — older 3d/10d
  exceeded runtime MaxAllowedIntentDuration and caused InvalidDeadline.
- Summary section replaced by an always-visible warning banner: "Your
  order might not execute precisely at your specified limit price when
  the market reaches it" — sets expectations for intent-based orders.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant