fix(connect): read the version floor out of a refused handshake - #21
Merged
Conversation
The connect screen's red banner rendered err.message verbatim. A wallet on an older SDK sends "SDK version below the required minimum" -- which names neither the version this app has nor the one the wallet wants, even though both are sitting in error.data. The banner is the only place a developer learns their app was turned away, so it has to say what to upgrade to. describeConnectFailure reads the floor out of data and says it, for the SDK floor, the protocol floor and the network mismatch. When the gate sent no versions the wallet's own message is already the best text available, so it is passed through rather than replaced with worse copy.
This was referenced Jul 28, 2026
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.
Problem
The connect screen's red banner rendered
err.messageverbatim. A wallet on an older SDK sends "SDK version below the required minimum" — which names neither the version this app has nor the one the wallet wants, even though both are sitting inerror.data. That banner is the only place a developer learns their app was turned away, so it has to say what to upgrade to.Change
describeConnectFailureinlib/connectErrors.tsreads the floor out ofdatafor the SDK floor, the protocol floor and the network mismatch, anduseWalletConnectuses it for all three connect paths (popup, extension, auto-connect).When the gate sent no versions, the wallet's own message is already the best text available — it is passed through rather than replaced with worse copy. Fields are read defensively:
datacrosses postMessage from a peer on an SDK version this app does not control.As the reference dApp, this also demonstrates the pattern — the gate publishes structured
dataprecisely so a dApp can write its own copy instead of echoing a wallet-side string.Tests
6 unit cases on the formatter, 2 on the hook wiring (a 4007 with
datareaches the banner with the numbers; an ordinary failure passes through untouched). 70/70,tsc --noEmitclean.Related