From 4742e90f1a0aa913c2f00125155ebf91d3a60111 Mon Sep 17 00:00:00 2001 From: Gazzy-Lee Date: Sun, 16 Aug 2026 13:56:37 +0100 Subject: [PATCH 1/2] docs(architecture): document WalletAdapter, drop connectFreighter ref --- apps/docs/architecture/frontend.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/docs/architecture/frontend.md b/apps/docs/architecture/frontend.md index 460ad44f..f07ace23 100644 --- a/apps/docs/architecture/frontend.md +++ b/apps/docs/architecture/frontend.md @@ -61,7 +61,22 @@ useVaultActions.deposit(amount, vaultId) } ``` -Connection is triggered by `useWalletConnect`, which calls `connectFreighter()` and persists the public key. The store is not persisted to `localStorage`; users re-connect on page load. +### WalletAdapter abstraction + +Frontend code never talks to a wallet SDK directly. It depends on the `WalletAdapter` interface in `apps/web/src/lib/wallet.ts`, which every supported wallet implements: + +```typescript +interface WalletAdapter { + isInstalled(): Promise; + isAuthorized(): Promise; + connect(): Promise; + sign(xdr: string, networkPassphrase: string): Promise; +} +``` + +`useWalletConnect` drives the connection flow through this interface: it calls `wallet.isInstalled()` to detect the extension and `wallet.connect()` to request access, then persists the returned public key in the store. On page load the store revalidates a restored key via `wallet.isAuthorized()`. + +The only implementation today is `FreighterWallet`, exported as `wallet`. Adding a wallet (e.g. xBull, LOBSTR) means adding a new `WalletAdapter` implementation and selecting it in `wallet.ts` — no callers change. ## API client From ba7446a51a6817e97a7a68a6ce4d03f664109c85 Mon Sep 17 00:00:00 2001 From: Ezedike-egwom Collins Date: Wed, 19 Aug 2026 07:05:28 +0100 Subject: [PATCH 2/2] docs: remove em dash from frontend.md --- apps/docs/architecture/frontend.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/docs/architecture/frontend.md b/apps/docs/architecture/frontend.md index f07ace23..c5151c13 100644 --- a/apps/docs/architecture/frontend.md +++ b/apps/docs/architecture/frontend.md @@ -76,7 +76,7 @@ interface WalletAdapter { `useWalletConnect` drives the connection flow through this interface: it calls `wallet.isInstalled()` to detect the extension and `wallet.connect()` to request access, then persists the returned public key in the store. On page load the store revalidates a restored key via `wallet.isAuthorized()`. -The only implementation today is `FreighterWallet`, exported as `wallet`. Adding a wallet (e.g. xBull, LOBSTR) means adding a new `WalletAdapter` implementation and selecting it in `wallet.ts` — no callers change. +The only implementation today is `FreighterWallet`, exported as `wallet`. Adding a wallet (e.g. xBull, LOBSTR) means adding a new `WalletAdapter` implementation and selecting it in `wallet.ts`. No callers change. ## API client