fix(liquidity): reconcile holdings before quotes

This commit is contained in:
Ricardo Guilherme Schmidt
2026-07-18 19:56:38 -03:00
parent d01e241521
commit 3f4b9467e6
2 changed files with 22 additions and 1 deletions
@@ -128,11 +128,11 @@ AmmActionCard {
Component.onCompleted: Qt.callLater(root.reconcileSelection)
onNewPositionContextChanged: Qt.callLater(root.applyContextChange)
function applyContextChange() {
root.reconcileHoldings()
if (root.resolvingToken)
root.finishTokenResolution()
else
root.reconcileSelection()
root.reconcileHoldings()
}
onQuotePayloadChanged: {
if (root.quoteStale)
@@ -183,6 +183,27 @@ TestCase {
"44444444444444444444444444444444")
}
function test_contextRefreshSelectsSingleHoldingsBeforeQuote() {
var form = createForm()
form.selectedHoldingAId = ""
form.selectedHoldingBId = ""
quoteRequestedSpy.target = form
quoteRequestedSpy.clear()
form.newPositionContext = readyContext()
tryCompare(quoteRequestedSpy, "count", 1)
compare(form.selectedHoldingAId,
"44444444444444444444444444444444")
compare(form.selectedHoldingBId,
"55555555555555555555555555555555")
verify(quoteRequestedSpy.signalArguments[0][1].ok)
compare(quoteRequestedSpy.signalArguments[0][1].request.holdingAId,
"55555555555555555555555555555555")
compare(quoteRequestedSpy.signalArguments[0][1].request.holdingBId,
"44444444444444444444444444444444")
}
function test_displayOrderMapsToCanonicalRequestAfterSwap() {
var form = createForm()
var built = form.buildQuoteRequest()