Skip to content

fix(connect): read the version floor out of a refused handshake - #21

Merged
KruGoL merged 1 commit into
mainfrom
feat/connect-version-mismatch-detail
Jul 28, 2026
Merged

fix(connect): read the version floor out of a refused handshake#21
KruGoL merged 1 commit into
mainfrom
feat/connect-version-mismatch-detail

Conversation

@KruGoL

@KruGoL KruGoL commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Problem

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. That banner is the only place a developer learns their app was turned away, so it has to say what to upgrade to.

SDK version below the required minimum

This app is built on sphere-sdk 0.11.9 — the wallet requires 0.12.0-0 or newer. Upgrade @unicitylabs/sphere-sdk and rebuild.

Change

describeConnectFailure in lib/connectErrors.ts reads the floor out of data for the SDK floor, the protocol floor and the network mismatch, and useWalletConnect uses 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: data crosses 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 data precisely 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 data reaches the banner with the numbers; an ordinary failure passes through untouched). 70/70, tsc --noEmit clean.

Related

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.
@KruGoL
KruGoL merged commit 38172b7 into main Jul 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant