refactor(amm): remove the dead newPosition quote path

Both liquidity branches now quote through the lean ops (liquidityQuote /
addLiquidityQuote), so quoteNewPosition and the heavy amm_quote machinery it
drove are unreachable. Remove them end to end.

FFI (modules/amm/ffi):
- Drop the amm_quote entry point and the whole quote-evaluation graph:
  api/{accounts,commitment,funding,position}.rs, the QuoteRequest /
  PositionRequest / PairSnapshot request types, quote_error::fatal_quote, and
  api/clock.rs (its decode_clock was quote-only). quote.rs keeps only the shared
  opening-deposit math (minimum_opening_pair + helpers) that liquidity_quote
  reuses.
- Trim the fields the quote path was the sole reader of: SelectedHolding.account
  and PairIds.{token_program,twap_program}.
- Drop the quote-path unit tests; keep the math / pair / context / holding /
  swap ones (37 pass, clippy clean).

Module (modules/amm/src):
- Remove AmmModuleImpl::quoteNewPosition and its buildQuoteInput snapshot helper.

App (apps/amm):
- Remove the AmmUiBackend quoteNewPosition slot (.rep/.h/.cpp) and the dead QML
  backend mock + obsolete fresh-quote test.
- finishSubmitFailure no longer keeps a submit-returned re-quote (the lean submit
  ops never return one); it always re-quotes on failure.
- submissionSnapshot drops the always-empty quoteHash and derives the confirm
  dialog's action from the resolved pool state instead of the dead
  quotePayload.instruction (restores the "Create pool" / "Add liquidity" label).
This commit is contained in:
r4bbit
2026-08-11 17:51:51 +02:00
parent eb98aac31f
commit 64e7614e74
24 changed files with 34 additions and 1737 deletions
-67
View File
@@ -1096,63 +1096,6 @@ LogosList AmmModuleImpl::tokenHoldings(bool wallet_open) {
return out;
}
nlohmann::json AmmModuleImpl::buildQuoteInput(const LogosMap& request,
const Network& net,
bool wallet_open,
bool fresh_wallet_accounts,
nlohmann::json* error) {
if (net.status != "ready") {
*error = publicError(net.status);
return json();
}
const FfiResult configResult =
call(amm_config_id, json{{"ammProgramId", net.amm_program_id}});
if (!configResult.ok) {
*error = publicError("backend_error");
return json();
}
const json config = readPublicAccount(jStr(configResult.value, "configId"));
const FfiResult pairResult = call(amm_pair_ids, json{
{"ammProgramId", net.amm_program_id},
{"config", config},
{"tokenAId", request.value("tokenAId", json())},
{"tokenBId", request.value("tokenBId", json())},
});
if (!pairResult.ok) {
*error = publicError("backend_error");
return json();
}
const json pairManifest = pairResult.value;
if (jStr(pairManifest, "status") != "ok") {
*error = publicError(jStr(pairManifest, "code"));
return json();
}
const json walletAccounts = walletAccountReads(wallet_open, fresh_wallet_accounts);
const json snapshot = {
{"config", config},
{"tokenA", readPublicAccount(jStr(pairManifest, "tokenAId"))},
{"tokenB", readPublicAccount(jStr(pairManifest, "tokenBId"))},
{"pool", readPublicAccount(jStr(pairManifest, "poolId"))},
{"vaultA", readPublicAccount(jStr(pairManifest, "vaultAId"))},
{"vaultB", readPublicAccount(jStr(pairManifest, "vaultBId"))},
{"lpDefinition", readPublicAccount(jStr(pairManifest, "lpDefinitionId"))},
{"lpLockHolding", readPublicAccount(jStr(pairManifest, "lpLockHoldingId"))},
{"currentTick", readPublicAccount(jStr(pairManifest, "currentTickId"))},
{"clock", readPublicAccount(jStr(pairManifest, "clockId"))},
{"walletAvailable", wallet_open},
{"walletAccounts", walletAccounts},
};
return {
{"networkId", net.id},
{"networkFingerprint", net.fingerprint},
{"ammProgramId", net.amm_program_id},
{"request", request},
{"snapshot", snapshot},
};
}
LogosMap AmmModuleImpl::newPositionContext(const LogosMap& request,
bool wallet_open,
bool refresh_wallet_accounts) {
@@ -1210,13 +1153,3 @@ LogosMap AmmModuleImpl::newPositionContext(const LogosMap& request,
: contextState("error", net.id, net.fingerprint, "backend_error");
}
LogosMap AmmModuleImpl::quoteNewPosition(const LogosMap& request, bool wallet_open) {
const Network net = network();
json error;
const json input = buildQuoteInput(request, net, wallet_open, /*fresh=*/false, &error);
if (!error.is_null()) return error;
const FfiResult result = call(amm_quote, input);
return result.ok ? result.value : publicError("backend_error");
}