feat(amm): let LPs choose the LP-token destination account

Add-liquidity minted a fresh LP account every time, fragmenting a position
across holdings. The New position form now has an LP-destination selector (the
same Input-mode component as the token funding rows): add-liquidity preselects
the wallet's existing LP holding so deposits consolidate, while create-pool has
none and mints a fresh one.

- addLiquidityQuote returns lpDefinitionId (base58) so the form matches holdings
- createPool/addLiquidity submit into the chosen holding, else create-fresh
- e2e: add-liquidity waits for the preselect; create-pool asserts fresh-account
This commit is contained in:
r4bbit
2026-08-21 15:35:27 +02:00
parent 4cb7c7e51c
commit 62d133e909
7 changed files with 106 additions and 10 deletions
+2 -1
View File
@@ -1036,7 +1036,8 @@ LogosMap AmmModuleImpl::addLiquidityQuote(const LogosMap& request) {
if (!quoteResult.ok)
return error(quoteResult.error.empty() ? "backend_error" : quoteResult.error);
// Success: wrap { amountA, amountB, expectedLp, minimumLp, price }.
// Success: wrap { amountA, amountB, expectedLp, minimumLp, price, lpDefinitionId }.
// (lpDefinitionId is the pool's LP token so the UI can offer existing LP holdings.)
LogosMap out = quoteResult.value;
out["status"] = "ok";
out["error"] = "";