mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 06:01:11 +00:00
The module already had removeLiquidityQuote and removeLiquidity, but AmmUiBackend never forwarded them, so QML had no way to reach them. Expose both, mirroring the add pair: the quote is read-only and unguarded, the submit is wallet-guarded and refreshes balances once the withdrawal lands. Unlike createPool/addLiquidity nothing fresh is created -- the request names the existing LP holding to burn and the two holdings that receive. The pool detail view's secondary action reads "Add liquidity" until the wallet holds LP for that pool, then becomes "Manage position" with a dropdown offering both directions, opening on hover with the same deferred close the nav bar's tab menu uses. Remove is disabled until the LP account and both receiving holdings resolve. RemoveLiquidityDialog is a modal sheet: 25/50/75/Max presets over a slider, a debounced quote of both withdrawals, the post-slippage floors, submit. The quote is generation-tagged because dragging the slider fires quotes faster than they return and a late reply must not paint over a newer percentage. The submit passes the quote's own minimumAmount*Raw as its floors, so it enforces what the preview promised. 100% burns the balance exactly; every other percentage floors, so rounding can't push the request past it.