feat(frontend): pool provide auto-fill and withdraw receive preview (#480) #1017

Merged
PlasticDigits merged 1 commit from feat/480-pool-autofill-withdraw-preview into main 2026-07-12 09:23:29 +00:00
PlasticDigits commented 2026-07-12 09:22:13 +00:00 (Migrated from gitlab.com)

Summary

  • Provide liquidity: auto-fill the counterpart amount from the current pool ratio when one side is edited (and on Max/50% with force-sync); empty pools stay independently editable; manual override still surfaces the donation warning.
  • Withdraw liquidity: show expected underlying tokens (0% slippage) and minimum after selected slippage; extend the pre-sign summary with underlying token lines (not LP-only).
  • Pure client-side BigInt helpers only — no contract/indexer API changes. Docs + agent skill playbook crosslinked for #480.

Closes #480

Test plan

  • Unit: computeProportionalCounterpartRaw / computeProvideCounterpartHuman / estimateWithdrawAssetAmounts / grossUlunaForTargetNet
  • PoolPage.test.tsx: type A → B fills; Max fills counterpart; override shows ratio warning; withdraw estimated/minimum receive + pre-submit token lines
  • cd frontend-dapp && npm run test:run -- src/utils/__tests__/provideLiquidityEstimate.test.ts src/utils/__tests__/poolProvideCounterpart.test.ts src/utils/__tests__/rawAmountMath.test.ts src/utils/__tests__/nativeTransferTax.test.ts src/pages/PoolPage.test.tsx
  • Manual /pool: non-empty pair — enter one provide amount → counterpart matches floor(amount × reserve_other / reserve_self); Estimated LP without donation warning
  • Manual: deliberately break ratio → warning; submit still allowed
  • Manual withdraw: LP amount shows expected + min receive; pre-sign includes tokens; wrapped vs unwrap label when native option exists
  • Empty pool: no auto-fill on first deposit
## Summary - **Provide liquidity:** auto-fill the counterpart amount from the current pool ratio when one side is edited (and on Max/50% with force-sync); empty pools stay independently editable; manual override still surfaces the donation warning. - **Withdraw liquidity:** show expected underlying tokens (0% slippage) and minimum after selected slippage; extend the pre-sign summary with underlying token lines (not LP-only). - Pure client-side BigInt helpers only — no contract/indexer API changes. Docs + agent skill playbook crosslinked for #480. Closes #480 ## Test plan - [ ] Unit: `computeProportionalCounterpartRaw` / `computeProvideCounterpartHuman` / `estimateWithdrawAssetAmounts` / `grossUlunaForTargetNet` - [ ] `PoolPage.test.tsx`: type A → B fills; Max fills counterpart; override shows ratio warning; withdraw estimated/minimum receive + pre-submit token lines - [ ] `cd frontend-dapp && npm run test:run -- src/utils/__tests__/provideLiquidityEstimate.test.ts src/utils/__tests__/poolProvideCounterpart.test.ts src/utils/__tests__/rawAmountMath.test.ts src/utils/__tests__/nativeTransferTax.test.ts src/pages/PoolPage.test.tsx` - [ ] Manual `/pool`: non-empty pair — enter one provide amount → counterpart matches `floor(amount × reserve_other / reserve_self)`; Estimated LP without donation warning - [ ] Manual: deliberately break ratio → warning; submit still allowed - [ ] Manual withdraw: LP amount shows expected + min receive; pre-sign includes tokens; wrapped vs unwrap label when native option exists - [ ] Empty pool: no auto-fill on first deposit
PlasticDigits commented 2026-07-12 09:23:30 +00:00 (Migrated from gitlab.com)

mentioned in commit 21d3df31c6

mentioned in commit 21d3df31c6cc4c6856ff0b1ad11e336452b742fb
PlasticDigits (Migrated from gitlab.com) merged commit 21d3df31c6 into main 2026-07-12 09:23:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1017
No description provided.