Skip to content

fix(flutter): show 'wallet connector could not load' instead of 'install Freighter' when the Freighter bridge fails to load - #148

Merged
TOMOKI977 merged 2 commits into
mainfrom
fix/116-freighter-bridge-unavailable
Oct 11, 2026
Merged

TOMOKI977 merged 2 commits into
mainfrom
fix/116-freighter-bridge-unavailable

Conversation

@XxHugheadxX

Copy link
Copy Markdown
Contributor

Refs #116

Summary

The Freighter bridge (web/freighter_bridge.js) imports @stellar/freighter-api from a CDN (esm.sh). When that import fails, web/index.html swallowed the error, and connecting showed "Freighter not found, install the extension", even to a user who has Freighter installed. The import fails when the user is offline, the CDN is blocked or down, or an ad blocker or network filter stops it. The user was then sent to reinstall a wallet they already have.

This PR tells the two cases apart. The root fix, bundling the Freighter API locally behind a CSP, stays in #116.

  • web/index.html sets window.puls3FreighterBridgeFailed = true when the bridge import fails. It still logs the error as before.

  • The web bridge (freighter_bridge_web.dart) reads that flag when the bridge functions are missing:

    • the load failed → the new WalletConnectorUnavailable;
    • no flag → WalletNotInstalled, as before.

    The decision is the pure function bridgeMissingError, so it can be unit tested without a browser.

  • Messages:

    Where Shows
    Wallet panel (S09) "Could not load the wallet connector", the reason (check your connection or ad blocker, then reload) and Try again. There is no Install button
    Hire flow The same reason, ending in "No funds moved"
    Deploy flow Maps it to its "wallet unavailable" error

Acceptance criteria

This PR does not close #116. Its criteria (bundle the API, add a CSP) are untouched.

  • A bridge that failed to load never tells the user to install Freighter.
  • A missing wallet with a loaded bridge still shows "not found" and the Install button.
  • Every switch over WalletException handles the new case. It is a sealed class, so the analyzer enforces this.

Verification evidence

$ cd puls3_flutter && flutter analyze --fatal-infos
No issues found!
$ flutter test
00:29 +236: All tests passed!

New tests:

  • test/wallet/bridge_missing_error_test.dart:
    • a failed load maps to WalletConnectorUnavailable;
    • no flag still maps to WalletNotInstalled;
    • the hire message never says "Install" and says "No funds moved".
  • test/wallet/wallet_connection_test.dart: the panel shows the connector state with Try again and no Install Freighter button.

To check it by hand in Chrome with Freighter installed:

  1. Block esm.sh in DevTools → Network request blocking.
  2. Reload and click Connect Freighter.
  3. Before: "Freighter not found". After: "Could not load the wallet connector", with no Install button.

Notes for reviewers

…a missing Freighter

The Freighter bridge imports @stellar/freighter-api from a CDN (esm.sh). When
that import fails (offline, blocked CDN, ad blocker, network filter),
index.html swallowed the error and connecting reported "Freighter not
found, install the extension", even with Freighter installed.

- index.html sets window.puls3FreighterBridgeFailed when the bridge import
  fails.
- The web bridge reads it: a missing bridge after a failed load is the new
  WalletConnectorUnavailable; with no flag it stays WalletNotInstalled.
- Wallet panel: "Could not load the wallet connector" with the reason
  (connection or ad blocker, then reload) and Try again, no Install button.
  Hire flow and deploy flow map it too.

The root fix, bundling the Freighter API locally behind a CSP, stays in #116.

Refs #116
@XxHugheadxX XxHugheadxX added this to the Serverpod (Oct 14) milestone Oct 10, 2026
@XxHugheadxX XxHugheadxX added area: frontend Flutter implementation type: feat New functionality P1 Important, next in line labels Oct 10, 2026
@XxHugheadxX XxHugheadxX self-assigned this Oct 10, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Deploying puls3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 298648a
Status: ✅  Deploy successful!
Preview URL: https://aae4060f.puls3-4lw.pages.dev
Branch Preview URL: https://fix-116-freighter-bridge-una.puls3-4lw.pages.dev

View logs

@TOMOKI977 TOMOKI977 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The bridge-load failure is now distinguished from a missing Freighter installation, and the regression coverage matches that behavior.

@TOMOKI977
TOMOKI977 merged commit 328e5d4 into main Oct 11, 2026
10 checks passed
@TOMOKI977
TOMOKI977 deleted the fix/116-freighter-bridge-unavailable branch October 11, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: frontend Flutter implementation P1 Important, next in line type: feat New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(flutter): bundle the Freighter API locally and add a CSP before the public demo

2 participants