Skip to content

Commit fffd5e5

Browse files
committed
fix(tokens): ensure valid token selection when updating a single token as well as all of them
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent daaf1d2 commit fffd5e5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

services/opencode/src/main/kotlin/com/getcode/opencode/controllers/TokenController.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ class TokenController @Inject constructor(
483483

484484
if (tokenWithBalance != null) {
485485
applyTokenUpdates(listOf(tokenWithBalance))
486+
ensureValidTokenSelection()
486487
}
487488
} catch (e: Exception) {
488489
trace(
@@ -578,10 +579,10 @@ class TokenController @Inject constructor(
578579
type = TraceType.Process
579580
)
580581
_state.update { it.copy(balances = it.balances + (token.address to newBalance)) }
581-
}
582582

583-
scope.launch(Dispatchers.IO) {
584-
updateTokenAccount(token.address)
583+
scope.launch(Dispatchers.IO) {
584+
updateTokenAccount(token.address)
585+
}
585586
}
586587
}
587588

0 commit comments

Comments
 (0)