fix(liquidity): block submit after token resolution failure

This commit is contained in:
Ricardo Guilherme Schmidt
2026-07-18 19:56:38 -03:00
parent 95a066960c
commit 41460d8b09
2 changed files with 33 additions and 0 deletions
@@ -114,6 +114,8 @@ AmmActionCard {
&& !root.quoteStale
&& !root.submitting
&& !root.poolCreationPending
&& !root.resolvingToken
&& root.tokenResolutionError.length === 0
&& root.walletCanSubmit
&& (!root.activePool || root.hasActivePoolDepositInput)
@@ -393,6 +393,37 @@ TestCase {
compare(amountBInput.tokenInvalid, true)
}
function test_tokenResolutionBlocksStaleQuoteSubmission() {
var form = createForm()
form.flowState = flowState({
"schema": "new-position.v2",
"status": "ok",
"canSubmit": true,
"tokenAId": tokenLow,
"tokenBId": tokenHigh,
"poolStatus": "active_pool",
"quoteHash": "sha256:stale-quote",
"reserveARaw": "3",
"reserveBRaw": "2000000",
"actualAmountARaw": "3",
"actualAmountBRaw": "2000000"
})
form.amountA = "1"
form.amountB = "1"
wait(0)
verify(form.canConfirm)
form.resolveToken("A", tokenThird)
compare(form.resolvingTokenId, tokenThird)
verify(!form.canConfirm)
form.failTokenResolution("token_definition_unreadable")
compare(form.selectedTokenAId, tokenLow)
verify(form.tokenResolutionError.length > 0)
verify(!form.canConfirm)
}
function test_staleMissingPoolQuoteDoesNotReplaceDraft() {
var quote = {
"status": "ok",