feat(wallets): reject unsupported xBull extension versions before connecting - #838
Open
woahwhattheheck wants to merge 2 commits into
Open
feat(wallets): reject unsupported xBull extension versions before connecting#838woahwhattheheck wants to merge 2 commits into
woahwhattheheck wants to merge 2 commits into
Conversation
…necting The adapter connected without checking the extension version, so an older build failed later with errors that did not name the cause. The version is now read before connect() is called and compared against MIN_XBULL_VERSION, rejecting with ExtensionVersionError naming the extension, the version found and the version required. The version is read from window.xbull.version, falling back to window.xBullSDK.version, since builds differ in which handle carries it.
This was referenced Sep 6, 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.
Closes #771.
XBullAdaptercalledconnect()on the extension without checking itsversion, so an older build failed later with errors that did not name the real
cause.
Changes
src/wallets/adapters/XBullAdapter.ts:MIN_XBULL_VERSION— exported,"1.4.0": the first version exposingthe object-shaped
connect()/sign()surface this adapter uses. Bump theconstant if that is not where you would draw the line.
ExtensionVersionError— carriesextension,foundVersionandrequiredVersion, and names all three in the message.window.xbull.connect()is called, so anunsupported extension is rejected up front rather than part-way through.
compareExtensionVersions— exported, so callers can gate their own UIon the same comparison.
skipVersionCheckconstructor option as an escape hatch.new XBullAdapter()still works: the constructor takes an optional optionsobject, so no existing call site changes.
Where the version is read
The issue names
window.xBullSDK.version, while this file declareswindow.xbull. Builds differ in which handle carries the version, so theadapter reads
window.xbull.versionand falls back towindow.xBullSDK.version. Both are covered by tests.Both connection paths are gated
getAddress()also callsconnect()when there is no cached key, so thecheck runs there too. It does not re-run once a key is cached — there is a
test pinning that, since re-checking on every address read would turn an
extension update mid-session into a spurious failure.
Two details
"1.10.0"is newer than"1.9.0",which a string comparison gets backwards. Missing trailing components count
as zero, so
"1.4"and"1.4.0"compare equal.too old to expose a version is almost certainly too old to provide the API
surface used here, and connecting anyway produces exactly the cryptic
failure this check exists to replace. The error says "version not reported"
rather than inventing one, and
skipVersionCheckcovers a build that isknown-good but silent. Happy to make absence permissive instead if you would
rather only an explicit low version fail.
Validation
npx vitest run test/xbullAdapter.version.test.ts— 27/27 passing. Coversnewer/equal/older versions, the extension's
connect()not being calledwhen the gate rejects, all three fields named on the error, the
xBullSDKfallback, absent and unparseable versions,skipVersionCheck,"not installed" still taking precedence, both gated entry points, no
re-check once connected, and the comparator itself.
windowis stubbed, so no browser or extension is needed.npx tsc --noEmitreports 210 errors on this branch and 210 on unmodifiedmain— identical, with none insrc/wallets/adapters/XBullAdapter.ts. That baseline is pre-existing andunrelated to this change.
Note on overlap
The version comparison here is deliberately local to this module. #775
(PR #837) introduces an equivalent helper for the Ledger adapter; if both
land, the two are worth consolidating into a shared util in a follow-up. I
kept them separate so neither PR depends on the other.
Note on pre-release versions
parseVersionrequires every dot-separated component to be digits, so apre-release like
"1.4.0-beta"returnsnulland the extension is treated asunsupported. That is deliberate — the gate exists to refuse a build whose
compatibility cannot be established — but it does mean a legitimate RC build is
refused, and
skipVersionCheckis the intended escape hatch. Worth a decisionif xBull ships pre-release builds to real users.
(The duplication with #837's comparison logic is noted at the end of this
description; same offer applies — a shared helper once the second lands.)