fix: persist WalletConnect session, negative-weight detection, Freighter/XBull error handling (#771–774) - #897
Merged
Merged
Conversation
…#773 Stellar-split#774 Stellar-split#774 – Persist WalletConnect session across page reloads - WalletConnectAdapter now writes session (topic, relayUrl, chainId, address, expiry) to localStorage on construction. - New static WalletConnectAdapter.restore(client) factory reads the stored session, validates its expiry, and returns a ready adapter without requiring a new QR scan. - disconnect() clears the stored session. - Accepts optional relayUrl and expiry constructor options. Stellar-split#773 – Detect negative-weight edges in PaymentGraphChecker - New checkGraph(graph: PaymentGraph): GraphValidationResult method. - Returns { valid: false, reason } on the first negative-weight edge, naming the offending source → target and the weight value. - Zero-weight (pass-through) edges are allowed. - Exports PaymentGraph, PaymentGraphEdge, GraphValidationResult types. Stellar-split#772 – Handle Freighter not-installed error - New FreighterNotInstalledError class with Freighter install URL (https://www.freighter.app) in the message. - All public FreighterAdapter methods (connect, sign, getAddress, signTransaction) call assertInstalled() before any Freighter API use. Stellar-split#771 – Check XBull extension version before connection - Exports MIN_XBULL_VERSION = '2.0.0'. - New ExtensionVersionError with installedVersion/requiredVersion fields. - connect() reads window.xBullSDK.version and throws ExtensionVersionError when the version is below the minimum. - Static XBullAdapter.compareVersions() utility for semver comparison. - If window.xBullSDK is absent the check is skipped gracefully. Tests: 158 tests pass across 6 test files.
|
@ushpraise Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
What & Why
This PR resolves four Wave issues in a single change-set. Each fix is scoped to the file named in the issue brief.
#774 — Persist WalletConnect session across page reloads
Problem:
WalletConnectAdaptercreated a session but never saved it, so every page reload forced users to re-scan a QR code.Fix:
{ topic, relayUrl, chainId, address, expiry }tolocalStorageunder the keystellarsplit:wc:session.WalletConnectAdapter.restore(client)reads the stored session, validates the WalletConnect expiry timestamp, and returns a ready adapter — no new QR scan needed.disconnect()removes the persisted entry.relayUrlandexpiryconstructor options.#773 — Detect negative-weight edges in PaymentGraphChecker
Problem: Negative-weight edges could cause unbounded fund extraction when the graph is traversed greedily; the checker did not detect them.
Fix:
checkGraph(graph: PaymentGraph): GraphValidationResultmethod onPaymentGraphChecker.{ valid: false, reason }on the first offending edge, namingsource → targetand the weight in the message.PaymentGraph,PaymentGraphEdge, andGraphValidationResulttypes.#772 — Handle Freighter not-installed error
Problem:
FreighterAdapterpropagated rawTypeErrorwhen the Freighter browser extension was absent.Fix:
FreighterNotInstalledError(extendsError, properinstanceof) with the install URL (https://www.freighter.app) in its message.assertInstalled()helper called at the top of every public method (connect,sign,getAddress,signTransaction).#771 — Check XBull extension version before connection
Problem:
XBullAdapterconnected without verifying the extension version, causing cryptic errors with older builds.Fix:
MIN_XBULL_VERSION = '2.0.0'— the first version supporting the current API surface.ExtensionVersionErrorwithinstalledVersion/requiredVersionproperties.connect()readswindow.xBullSDK.versionand throwsExtensionVersionErrorwhen below the minimum.window.xBullSDKis absent (older extension that doesn't expose the namespace) the check is skipped gracefully.XBullAdapter.compareVersions(a, b)utility for semver-style comparison.How it was tested
test/walletconnect.test.tsandtest/paymentGraphChecker.test.tstest/freighterAdapter.test.ts,test/xbullAdapter.test.tsvitest run).closes #771
closes #772
closes #773
closes #774