Repository navigation
Description
Problem
src/lib/wallet.ts#connectWallet and signTransaction call directly into @stellar/freighter-api with no handling for the extension being absent, locked, on the wrong network, or the user rejecting the permission prompt mid-flow. isFreighterInstalled checks freighterIsConnected(), but nothing in WalletContext.tsx or the /connect flow re-verifies network match before a signing operation is attempted from IssueActions.tsx or MilestoneActions.tsx. Given STELLAR_NETWORK is an env-driven constant (TESTNET default) and Freighter itself has an independently user-selected network, there is a realistic scenario where a contributor has Freighter set to Stellar PUBLIC while the app is configured for TESTNET (or vice versa after an env misconfiguration), and signTransaction will happily sign a transaction with the wrong network passphrase, producing a transaction Soroban will reject — but only after the user has already approved it in the extension, burning their attention and creating a confusing "why did my claim fail" support case.
Why this is hard
- Freighter's API surface (
isConnected,isAllowed,setAllowed,getAddress,signTransaction) doesn't expose "what network is the extension currently on" in a stable way across Freighter versions — you'll need to research the current@stellar/freighter-apiversion pinned inpackage.json(^6.0.1) and determine what's actually available (e.g.getNetwork/getNetworkDetails) and handle it being undefined on older installed extension versions. - You must design a pre-flight check that runs before every
signTransactioncall site (currently there's only one wrapper, but callers inIssueActions.tsx/MilestoneActions.tsxneed to be identified and each guarded) without introducing a race between the check and the actual sign call (user could switch networks in the extension between the two). - Error surfaces must be humane: distinguish "extension not installed," "extension locked," "wrong network," "user rejected," and "unknown error" with different UI treatments — right now
connectWalletcollapses everything into generic thrownErrors. WalletContext'sWALLET_KEYlocalStorage persistence needs to be reconciled: what happens on next page load if the persisted address no longer matches the currently unlocked Freighter account?
Scope
- Add a network-mismatch pre-flight check used by every signing call site.
- Expand
WalletConnection/error types to a discriminated union covering the failure modes above. - Update
WalletContext.tsxto expose anetworkMismatchboolean and surface it in the connect UI. - Add graceful re-sync when the stored address diverges from the live extension address on mount.
Acceptance criteria
- Simulate (via mocking
@stellar/freighter-api) each failure mode and confirm distinct, correct UI messaging. - No transaction signing is attempted when a network mismatch is detected; the user is blocked with an actionable message instead.
Activity
devgodfreytem commentedon Aug 25, 2026
@devgodfreytem has applied to work on this issue as part of the Stellar Wave Program's 8th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @devgodfreytem to this issue.
drips-wave commentedon Aug 25, 2026
Congratulations, @devgodfreytem! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.
🧑💻 @devgodfreytem: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
fix: add Freighter network-mismatch guard and harden OAuth callback
drips-wave commentedon Aug 25, 2026
This issue has been completed by @devgodfreytem as part of the Stellar Wave Program's 8th Wave 🥳
😎 @devgodfreytem: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.