fix(sell,swap): surface the real wallet error instead of a generic message - #1448
Closed
Blume1977 wants to merge 1 commit into
Closed
fix(sell,swap): surface the real wallet error instead of a generic message#1448Blume1977 wants to merge 1 commit into
Blume1977 wants to merge 1 commit into
Conversation
…ssage
When a sell or swap transaction fails in the wallet, both screens caught every
error (except a 4001 user rejection) and showed the same generic "Something went
wrong / Transaction failed" hint, throwing away the actual, actionable cause.
The most common case for a stuck sell is a request that is still pending in the
wallet: the chain switch throws MetaMask -32002, which the wallet hooks already
turn into a curated, localized TranslatedError ("There is already a request
pending. Please confirm it in your MetaMask and retry."). That message was
swallowed, so the customer only saw "Something went wrong" and kept retrying.
A shared helper (resolveWalletTxError) now classifies the error the same way for
both screens: a user cancellation (code 4001 or AbortError) stays silent, a
TranslatedError is surfaced to the user, and anything else keeps the generic
hint that points to the manual deposit address. The wallet error messages that
can reach the sell/swap send path get DE/FR/IT translations under screens/home,
the namespace the connect flow already uses for wallet errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was
Wenn ein Verkauf oder Swap in der Wallet fehlschlägt, zeigten beide Screens bisher für jeden Fehler (ausser der 4001-Ablehnung) denselben Text «Irgendwas hat nicht funktioniert / Transaktion fehlgeschlagen» und warfen die eigentliche, umsetzbare Ursache weg.
Neu: ein gemeinsamer Helfer
resolveWalletTxErrorklassifiziert den Fehler für beide Screens gleich. Eine Nutzer-Ablehnung (Code 4001 /AbortError) bleibt still, eine kuratierteTranslatedErrorwird dem Kunden angezeigt, alles andere behält den bisherigen generischen Hinweis auf die manuelle Einzahlungsadresse.Warum
Häufigste Ursache eines hängenden Verkaufs ist eine noch offene Anfrage in der Wallet: Der Netzwerkwechsel wirft MetaMask
-32002, was die Wallet-Hooks bereits in eine kuratierte, lokalisierteTranslatedError(«Es ist bereits eine Anfrage offen. Bitte bestätige sie in deiner MetaMask und versuche es erneut.») umwandeln. Diese Meldung wurde verschluckt, der Kunde sah nur «Irgendwas hat nicht funktioniert» und versuchte es endlos erneut (realer Supportfall vom 02.09.2026: ETH als Gas vorhanden, Order gültig, trotzdem Abbruch ohne On-Chain-Transaktion).Wie
src/util/wallet-tx-error.ts: reiner, testbarer Klassifizierer.sell.screen.tsx/swap.screen.tsx: nutzen den Helfer im catch; kuratierte Meldung viatranslate('screens/home', key)(derselbe Namespace, den der Connect-Flow für Wallet-Fehler nutzt), sonst der bisherige Fallback.Tests
wallet-tx-error.test.ts(6 Fälle: 4001, AbortError, TranslatedError, unbekannter Fehler, leere Meldung, null/undefined).sell-screen-cleared-amount+swap-screen-cleared-amountweiterhin grün (169 Tests gesamt).--max-warnings 0); i18n-Keys in DE/FR/IT konsistent.Hinweis
Kein Konflikt mit dem offenen Viem-Port #1330 (fasst
metamask.hook.tsan, nicht die Screens).