@@ -28,7 +28,7 @@ import {
2828 getNetworkDetails ,
2929} from "@stellar/freighter-api" ;
3030
31- export type WalletId = "freighter" ;
31+ export type WalletId = "freighter" | "albedo" | "xbull" ;
3232
3333export interface WalletDescriptor {
3434 id : WalletId ;
@@ -71,6 +71,18 @@ export const SUPPORTED_WALLETS: readonly WalletDescriptor[] = [
7171 badge : "Extension" ,
7272 description : "Direct browser wallet for Stellar accounts and Soroban apps." ,
7373 } ,
74+ {
75+ id : "albedo" ,
76+ name : "Albedo" ,
77+ badge : "Web" ,
78+ description : "Connect via web authentication popup. No extension required." ,
79+ } ,
80+ {
81+ id : "xbull" ,
82+ name : "xBull" ,
83+ badge : "Extension" ,
84+ description : "Browser extension and mobile wallet for Stellar ecosystem." ,
85+ } ,
7486] ;
7587
7688// ── Internal helpers ──────────────────────────────────────────────────────────
@@ -79,6 +91,7 @@ function buildSession(
7991 walletId : WalletId ,
8092 publicKey : string ,
8193 network : string ,
94+ mocked : boolean = false ,
8295) : WalletSession {
8396 const descriptor = SUPPORTED_WALLETS . find ( ( w ) => w . id === walletId ) ;
8497
@@ -92,7 +105,7 @@ function buildSession(
92105 publicKey,
93106 connectedAt : new Date ( ) . toISOString ( ) ,
94107 network,
95- mocked : false ,
108+ mocked,
96109 } ;
97110}
98111
@@ -133,6 +146,48 @@ async function connectFreighter(): Promise<WalletSession> {
133146 return buildSession ( "freighter" , address , networkId ) ;
134147}
135148
149+ // ── Albedo (Mock) ──────────────────────────────────────────────────────────────
150+
151+ /**
152+ * Mock connection for Albedo wallet.
153+ * Simulates a connection with a delay to show loading state.
154+ * In production, this would integrate with Albedo's web auth popup.
155+ */
156+ async function connectAlbedo ( ) : Promise < WalletSession > {
157+ // Simulate connection delay
158+ await new Promise ( ( resolve ) => setTimeout ( resolve , 1500 ) ) ;
159+
160+ // Generate a mock public key for demonstration
161+ // In production, this would come from Albedo's authentication flow
162+ // Stellar public keys are base32 encoded and 56 characters long, starting with G
163+ const mockPublicKey = "G" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" . substring ( 0 , 55 ) ;
164+
165+ const networkId = STELLAR_NETWORK === "MAINNET" ? "Mainnet" : "Testnet" ;
166+
167+ return buildSession ( "albedo" , mockPublicKey , networkId , true ) ;
168+ }
169+
170+ // ── xBull (Mock) ────────────────────────────────────────────────────────────────
171+
172+ /**
173+ * Mock connection for xBull wallet.
174+ * Simulates a connection with a delay to show loading state.
175+ * In production, this would integrate with xBull extension or mobile handoff.
176+ */
177+ async function connectXBull ( ) : Promise < WalletSession > {
178+ // Simulate connection delay
179+ await new Promise ( ( resolve ) => setTimeout ( resolve , 1500 ) ) ;
180+
181+ // Generate a mock public key for demonstration
182+ // In production, this would come from xBull's connection flow
183+ // Stellar public keys are base32 encoded and 56 characters long, starting with G
184+ const mockPublicKey = "G" + "ZYXWVUTSRQPONMLKJIHGFEDCBA234567" . substring ( 0 , 55 ) ;
185+
186+ const networkId = STELLAR_NETWORK === "MAINNET" ? "Mainnet" : "Testnet" ;
187+
188+ return buildSession ( "xbull" , mockPublicKey , networkId , true ) ;
189+ }
190+
136191// ── Public connect dispatch ───────────────────────────────────────────────────
137192
138193export async function connectWallet (
@@ -141,6 +196,10 @@ export async function connectWallet(
141196 switch ( walletId ) {
142197 case "freighter" :
143198 return connectFreighter ( ) ;
199+ case "albedo" :
200+ return connectAlbedo ( ) ;
201+ case "xbull" :
202+ return connectXBull ( ) ;
144203 default :
145204 throw new Error ( "Unsupported wallet selected." ) ;
146205 }
0 commit comments