stellar-wallet-kit 2.0.0 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -6,6 +6,7 @@ import { isConnected, isAllowed, setAllowed, getUserInfo, getNetwork, signTransa
6
6
  // src/types/index.ts
7
7
  var WalletType = /* @__PURE__ */ ((WalletType2) => {
8
8
  WalletType2["FREIGHTER"] = "freighter";
9
+ WalletType2["ALBEDO"] = "albedo";
9
10
  return WalletType2;
10
11
  })(WalletType || {});
11
12
  var NetworkType = /* @__PURE__ */ ((NetworkType2) => {
@@ -171,7 +172,131 @@ function groupBalancesByType(balances) {
171
172
  }, {});
172
173
  }
173
174
 
175
+ // src/utils/albedoCallback.ts
176
+ function openAlbedoPopup(url) {
177
+ const popup = window.open(
178
+ url,
179
+ "albedo",
180
+ "width=420,height=720,resizable=yes,scrollbars=yes"
181
+ );
182
+ if (!popup) {
183
+ throw new Error("Failed to open Albedo popup (blocked by browser)");
184
+ }
185
+ return popup;
186
+ }
187
+ function waitForAlbedoResult() {
188
+ return new Promise((resolve, reject) => {
189
+ const timeout = setTimeout(() => {
190
+ reject(new Error("Albedo response timeout"));
191
+ }, 2 * 60 * 1e3);
192
+ const parseResult = () => {
193
+ const params = new URLSearchParams(window.location.search);
194
+ if (!params.has("pubkey") && !params.has("signed_envelope_xdr") && !params.has("signed_xdr")) {
195
+ return;
196
+ }
197
+ clearTimeout(timeout);
198
+ const result = {};
199
+ params.forEach((value, key) => {
200
+ result[key] = value;
201
+ });
202
+ window.history.replaceState({}, document.title, window.location.pathname);
203
+ resolve(result);
204
+ };
205
+ parseResult();
206
+ window.addEventListener("popstate", parseResult);
207
+ });
208
+ }
209
+ function waitForAlbedoPopup() {
210
+ return new Promise((resolve, reject) => {
211
+ const timeout = setTimeout(() => {
212
+ reject(new Error("Albedo response timeout"));
213
+ }, 2 * 60 * 1e3);
214
+ function handler(event) {
215
+ if (event.origin !== window.location.origin || event.data?.type !== "ALBEDO_RESULT") {
216
+ return;
217
+ }
218
+ clearTimeout(timeout);
219
+ window.removeEventListener("message", handler);
220
+ resolve(event.data.payload);
221
+ }
222
+ window.addEventListener("message", handler);
223
+ });
224
+ }
225
+
226
+ // src/adapters/AlbedoAdapter.ts
227
+ var AlbedoAdapter = class {
228
+ constructor() {
229
+ this.type = "albedo" /* ALBEDO */;
230
+ }
231
+ async isAvailable() {
232
+ return typeof window !== "undefined";
233
+ }
234
+ async connect() {
235
+ const url = new URL("https://albedo.link");
236
+ url.searchParams.set("intent", "public-key");
237
+ url.searchParams.set("app_name", "Stellar Wallet Kit");
238
+ url.searchParams.set("network", "testnet");
239
+ url.searchParams.set(
240
+ "callback",
241
+ `${window.location.origin}/albedo-callback`
242
+ );
243
+ url.searchParams.set("origin", window.location.origin);
244
+ openAlbedoPopup(url.toString());
245
+ const result = await waitForAlbedoPopup();
246
+ if (!result.pubkey) {
247
+ throw new Error("Albedo connection rejected");
248
+ }
249
+ return {
250
+ address: result.pubkey,
251
+ publicKey: result.pubkey
252
+ };
253
+ }
254
+ async disconnect() {
255
+ }
256
+ async getPublicKey() {
257
+ return null;
258
+ }
259
+ async getNetwork() {
260
+ throw new Error("Albedo does not expose network");
261
+ }
262
+ async signTransaction(xdr, _options) {
263
+ const url = new URL("https://albedo.link");
264
+ url.searchParams.set("intent", "tx");
265
+ url.searchParams.set("xdr", xdr);
266
+ url.searchParams.set("app_name", "Stellar Wallet Kit");
267
+ url.searchParams.set("network", "testnet");
268
+ url.searchParams.set("callback", window.location.href);
269
+ url.searchParams.set("origin", window.location.origin);
270
+ window.location.href = url.toString();
271
+ const result = await waitForAlbedoResult();
272
+ if (!result.signed_envelope_xdr) {
273
+ throw new Error("Albedo signing rejected");
274
+ }
275
+ return { signedTxXdr: result.signed_envelope_xdr };
276
+ }
277
+ async signAuthEntry(entryXdr, _options) {
278
+ const url = new URL("https://albedo.link");
279
+ url.searchParams.set("intent", "sign-auth-entry");
280
+ url.searchParams.set("xdr", entryXdr);
281
+ url.searchParams.set("app_name", "Stellar Wallet Kit");
282
+ url.searchParams.set("network", "testnet");
283
+ url.searchParams.set("callback", window.location.href);
284
+ url.searchParams.set("origin", window.location.origin);
285
+ window.location.href = url.toString();
286
+ const result = await waitForAlbedoResult();
287
+ if (!result.signed_xdr) {
288
+ throw new Error("Albedo auth entry rejected");
289
+ }
290
+ return { signedAuthEntry: result.signed_xdr };
291
+ }
292
+ };
293
+
174
294
  // src/context/WalletContext.tsx
295
+ var DEFAULT_SUPPORTS = {
296
+ silentReconnect: false,
297
+ networkDetection: false,
298
+ authEntrySigning: false
299
+ };
175
300
  var WalletContext = createContext(void 0);
176
301
  var STORAGE_KEY = "stellar_wallet_kit";
177
302
  var getStorageData = () => {
@@ -196,7 +321,8 @@ var setStorageData = (data) => {
196
321
  };
197
322
  var isBrowser = typeof window !== "undefined";
198
323
  var walletAdapters = {
199
- ["freighter" /* FREIGHTER */]: new FreighterAdapter()
324
+ ["freighter" /* FREIGHTER */]: new FreighterAdapter(),
325
+ ["albedo" /* ALBEDO */]: new AlbedoAdapter()
200
326
  };
201
327
  var walletMetadata = {
202
328
  ["freighter" /* FREIGHTER */]: {
@@ -204,14 +330,34 @@ var walletMetadata = {
204
330
  name: "Freighter",
205
331
  icon: "https://stellar.creit.tech/wallet-icons/freighter.svg",
206
332
  description: "Freighter browser extension wallet",
207
- downloadUrl: "https://chrome.google.com/webstore/detail/freighter/bcacfldlkkdogcmkkibnjlakofdplcbk"
333
+ downloadUrl: "https://chrome.google.com/webstore/detail/freighter/bcacfldlkkdogcmkkibnjlakofdplcbk",
334
+ kind: "extension",
335
+ capabilities: {
336
+ silentReconnect: true,
337
+ networkDetection: true,
338
+ authEntrySigning: true
339
+ }
340
+ },
341
+ ["albedo" /* ALBEDO */]: {
342
+ id: "albedo" /* ALBEDO */,
343
+ name: "Albedo",
344
+ icon: "https://stellar.creit.tech/wallet-icons/albedo.svg",
345
+ description: "Web-based Stellar wallet",
346
+ kind: "web",
347
+ capabilities: {
348
+ silentReconnect: false,
349
+ networkDetection: false,
350
+ authEntrySigning: true
351
+ }
208
352
  }
209
353
  };
210
354
  function WalletProvider({ config = {}, children }) {
211
355
  const [account, setAccount] = useState(null);
212
356
  const [isConnecting, setIsConnecting] = useState(false);
213
357
  const [error, setError] = useState(null);
214
- const [network, setNetwork] = useState(config.network || "TESTNET" /* TESTNET */);
358
+ const [network, setNetwork] = useState(
359
+ config.network || "TESTNET" /* TESTNET */
360
+ );
215
361
  const [selectedWallet, setSelectedWallet] = useState(null);
216
362
  const [availableWallets, setAvailableWallets] = useState([]);
217
363
  const [isLoadingBalances, setIsLoadingBalances] = useState(false);
@@ -221,9 +367,14 @@ function WalletProvider({ config = {}, children }) {
221
367
  const checkWallets = async () => {
222
368
  const wallets = [];
223
369
  for (const [type, adapter] of Object.entries(walletAdapters)) {
224
- const installed = await adapter.isAvailable();
370
+ const walletType = type;
371
+ const meta = walletMetadata[walletType];
372
+ let installed = true;
373
+ if (meta.kind === "extension") {
374
+ installed = await adapter.isAvailable();
375
+ }
225
376
  wallets.push({
226
- ...walletMetadata[type],
377
+ ...meta,
227
378
  installed
228
379
  });
229
380
  }
@@ -259,42 +410,54 @@ function WalletProvider({ config = {}, children }) {
259
410
  setIsLoadingBalances(false);
260
411
  }
261
412
  }, [account?.publicKey, network]);
262
- const connect = useCallback(async (walletType) => {
263
- setIsConnecting(true);
264
- setError(null);
265
- try {
266
- const typeToConnect = walletType || config.defaultWallet || "freighter" /* FREIGHTER */;
267
- const adapter = walletAdapters[typeToConnect];
268
- if (!adapter) {
269
- throw new Error(`Wallet adapter not found for ${typeToConnect}`);
270
- }
271
- const available = await adapter.isAvailable();
272
- if (!available) {
273
- throw new Error(`${walletMetadata[typeToConnect].name} is not installed`);
274
- }
275
- const response = await adapter.connect();
276
- const newAccount = {
277
- address: response.address,
278
- publicKey: response.publicKey,
279
- displayName: `${response.address.slice(0, 4)}...${response.address.slice(-4)}`
280
- };
281
- setAccount(newAccount);
282
- setSelectedWallet(typeToConnect);
283
- setStorageData({ selectedWallet: typeToConnect, autoConnect: true });
413
+ const connect = useCallback(
414
+ async (walletType) => {
415
+ setIsConnecting(true);
416
+ setError(null);
284
417
  try {
285
- const balances = await fetchAccountBalances(response.publicKey, network);
286
- setAccount((prev) => prev ? { ...prev, balances } : null);
287
- } catch (balanceError) {
288
- console.error("Failed to fetch initial balances:", balanceError);
418
+ const typeToConnect = walletType || config.defaultWallet || "freighter" /* FREIGHTER */;
419
+ const adapter = walletAdapters[typeToConnect];
420
+ if (!adapter) {
421
+ throw new Error(`Wallet adapter not found for ${typeToConnect}`);
422
+ }
423
+ const meta = walletMetadata[typeToConnect];
424
+ if (meta.kind === "extension") {
425
+ const available = await adapter.isAvailable();
426
+ if (!available) {
427
+ throw new Error(`${meta.name} is not installed`);
428
+ }
429
+ }
430
+ const response = await adapter.connect();
431
+ const newAccount = {
432
+ address: response.address,
433
+ publicKey: response.publicKey,
434
+ displayName: `${response.address.slice(
435
+ 0,
436
+ 4
437
+ )}...${response.address.slice(-4)}`
438
+ };
439
+ setAccount(newAccount);
440
+ setSelectedWallet(typeToConnect);
441
+ setStorageData({ selectedWallet: typeToConnect, autoConnect: true });
442
+ try {
443
+ const balances = await fetchAccountBalances(
444
+ response.publicKey,
445
+ network
446
+ );
447
+ setAccount((prev) => prev ? { ...prev, balances } : null);
448
+ } catch (balanceError) {
449
+ console.error("Failed to fetch initial balances:", balanceError);
450
+ }
451
+ } catch (err) {
452
+ const error2 = err instanceof Error ? err : new Error("Failed to connect wallet");
453
+ setError(error2);
454
+ throw error2;
455
+ } finally {
456
+ setIsConnecting(false);
289
457
  }
290
- } catch (err) {
291
- const error2 = err instanceof Error ? err : new Error("Failed to connect wallet");
292
- setError(error2);
293
- throw error2;
294
- } finally {
295
- setIsConnecting(false);
296
- }
297
- }, [config.defaultWallet]);
458
+ },
459
+ [config.defaultWallet]
460
+ );
298
461
  const disconnect = useCallback(async () => {
299
462
  try {
300
463
  if (selectedWallet) {
@@ -311,26 +474,35 @@ function WalletProvider({ config = {}, children }) {
311
474
  throw error2;
312
475
  }
313
476
  }, [selectedWallet]);
314
- const signTransaction2 = useCallback(async (xdr, options) => {
315
- if (!selectedWallet) {
316
- throw new Error("No wallet connected");
317
- }
318
- const adapter = walletAdapters[selectedWallet];
319
- return adapter.signTransaction(xdr, options);
320
- }, [selectedWallet]);
321
- const signAuthEntry2 = useCallback(async (entryXdr, options) => {
322
- if (!selectedWallet) {
323
- throw new Error("No wallet connected");
324
- }
325
- const adapter = walletAdapters[selectedWallet];
326
- return adapter.signAuthEntry(entryXdr, options);
327
- }, [selectedWallet]);
328
- const switchNetwork = useCallback(async (newNetwork) => {
329
- setNetwork(newNetwork);
330
- if (account?.publicKey) {
331
- await refreshBalances();
332
- }
333
- }, [account?.publicKey, refreshBalances]);
477
+ const signTransaction2 = useCallback(
478
+ async (xdr, options) => {
479
+ if (!selectedWallet) {
480
+ throw new Error("No wallet connected");
481
+ }
482
+ const adapter = walletAdapters[selectedWallet];
483
+ return adapter.signTransaction(xdr, options);
484
+ },
485
+ [selectedWallet]
486
+ );
487
+ const signAuthEntry2 = useCallback(
488
+ async (entryXdr, options) => {
489
+ if (!selectedWallet) {
490
+ throw new Error("No wallet connected");
491
+ }
492
+ const adapter = walletAdapters[selectedWallet];
493
+ return adapter.signAuthEntry(entryXdr, options);
494
+ },
495
+ [selectedWallet]
496
+ );
497
+ const switchNetwork = useCallback(
498
+ async (newNetwork) => {
499
+ setNetwork(newNetwork);
500
+ if (account?.publicKey) {
501
+ await refreshBalances();
502
+ }
503
+ },
504
+ [account?.publicKey, refreshBalances]
505
+ );
334
506
  useEffect(() => {
335
507
  if (!account?.publicKey || !isBrowser) return;
336
508
  refreshBalances();
@@ -339,6 +511,17 @@ function WalletProvider({ config = {}, children }) {
339
511
  }, 3e4);
340
512
  return () => clearInterval(interval);
341
513
  }, [account?.publicKey, refreshBalances]);
514
+ const supports = useMemo(() => {
515
+ if (!selectedWallet) {
516
+ return DEFAULT_SUPPORTS;
517
+ }
518
+ const meta = walletMetadata[selectedWallet];
519
+ return {
520
+ silentReconnect: !!meta.capabilities?.silentReconnect,
521
+ networkDetection: !!meta.capabilities?.networkDetection,
522
+ authEntrySigning: !!meta.capabilities?.authEntrySigning
523
+ };
524
+ }, [selectedWallet]);
342
525
  const value = useMemo(
343
526
  () => ({
344
527
  account,
@@ -354,7 +537,8 @@ function WalletProvider({ config = {}, children }) {
354
537
  switchNetwork,
355
538
  availableWallets,
356
539
  refreshBalances,
357
- isLoadingBalances
540
+ isLoadingBalances,
541
+ supports
358
542
  }),
359
543
  [
360
544
  account,
@@ -370,7 +554,8 @@ function WalletProvider({ config = {}, children }) {
370
554
  switchNetwork,
371
555
  availableWallets,
372
556
  refreshBalances,
373
- isLoadingBalances
557
+ isLoadingBalances,
558
+ supports
374
559
  ]
375
560
  );
376
561
  return /* @__PURE__ */ React3.createElement(WalletContext.Provider, { value }, children);
@@ -392,216 +577,149 @@ function WalletModal({
392
577
  appIcon
393
578
  }) {
394
579
  useEffect(() => {
395
- const handleEsc = (e) => {
580
+ const onEsc = (e) => {
396
581
  if (e.key === "Escape") onClose();
397
582
  };
398
583
  if (isOpen) {
399
- document.addEventListener("keydown", handleEsc);
584
+ document.addEventListener("keydown", onEsc);
400
585
  document.body.style.overflow = "hidden";
401
586
  }
402
587
  return () => {
403
- document.removeEventListener("keydown", handleEsc);
404
- document.body.style.overflow = "unset";
588
+ document.removeEventListener("keydown", onEsc);
589
+ document.body.style.overflow = "auto";
405
590
  };
406
591
  }, [isOpen, onClose]);
407
592
  if (!isOpen) return null;
408
- const themeMode = theme?.mode || "light";
409
- const isDark = themeMode === "dark" || themeMode === "auto" && window.matchMedia("(prefers-color-scheme: dark)").matches;
410
- const styles = {
411
- overlay: {
412
- position: "fixed",
413
- top: 0,
414
- left: 0,
415
- right: 0,
416
- bottom: 0,
417
- backgroundColor: theme?.overlayBackground || (isDark ? "rgba(0, 0, 0, 0.8)" : "rgba(0, 0, 0, 0.5)"),
418
- display: "flex",
419
- alignItems: "center",
420
- justifyContent: "center",
421
- zIndex: 9999,
422
- animation: "swk-fade-in 0.2s ease-out"
423
- },
424
- modal: {
425
- backgroundColor: theme?.modalBackground || (isDark ? "#1a1a1a" : "#ffffff"),
426
- borderRadius: theme?.borderRadius || "16px",
427
- padding: "24px",
428
- maxWidth: "420px",
429
- width: "90%",
430
- maxHeight: "80vh",
431
- overflowY: "auto",
432
- boxShadow: isDark ? "0 8px 32px rgba(0, 0, 0, 0.4)" : "0 8px 32px rgba(0, 0, 0, 0.1)",
433
- animation: "swk-slide-up 0.3s ease-out",
434
- fontFamily: theme?.fontFamily || '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
435
- },
436
- header: {
437
- display: "flex",
438
- alignItems: "center",
439
- justifyContent: "space-between",
440
- marginBottom: "24px"
441
- },
442
- title: {
443
- fontSize: "20px",
444
- fontWeight: 600,
445
- color: theme?.textColor || (isDark ? "#ffffff" : "#000000"),
446
- margin: 0,
447
- display: "flex",
448
- alignItems: "center",
449
- gap: "12px"
450
- },
451
- closeButton: {
452
- background: "none",
453
- border: "none",
454
- fontSize: "24px",
455
- cursor: "pointer",
456
- padding: "4px",
457
- color: theme?.textColor || (isDark ? "#888888" : "#666666"),
458
- transition: "color 0.2s",
459
- lineHeight: 1
460
- },
461
- walletList: {
462
- display: "flex",
463
- flexDirection: "column",
464
- gap: "12px"
465
- },
466
- walletButton: {
467
- display: "flex",
468
- alignItems: "center",
469
- gap: "16px",
470
- padding: "16px",
471
- border: `1px solid ${isDark ? "#333333" : "#e5e5e5"}`,
472
- borderRadius: theme?.borderRadius || "12px",
473
- background: "none",
474
- cursor: "pointer",
475
- transition: "all 0.2s",
476
- width: "100%",
477
- textAlign: "left",
478
- fontFamily: "inherit"
479
- },
480
- walletIcon: {
481
- width: "40px",
482
- height: "40px",
483
- borderRadius: "8px",
484
- flexShrink: 0
485
- },
486
- walletInfo: {
487
- flex: 1
488
- },
489
- walletName: {
490
- fontSize: "16px",
491
- fontWeight: 500,
492
- color: theme?.textColor || (isDark ? "#ffffff" : "#000000"),
493
- margin: 0,
494
- marginBottom: "4px"
495
- },
496
- walletDescription: {
497
- fontSize: "13px",
498
- color: theme?.textColor || (isDark ? "#888888" : "#666666"),
499
- margin: 0
500
- },
501
- badge: {
502
- padding: "4px 8px",
503
- borderRadius: "6px",
504
- fontSize: "12px",
505
- fontWeight: 500,
506
- flexShrink: 0
507
- },
508
- installedBadge: {
509
- backgroundColor: theme?.primaryColor || (isDark ? "#4CAF50" : "#4CAF50"),
510
- color: "#ffffff"
511
- },
512
- notInstalledBadge: {
513
- backgroundColor: isDark ? "#333333" : "#f0f0f0",
514
- color: isDark ? "#888888" : "#666666"
515
- },
516
- footer: {
517
- marginTop: "24px",
518
- paddingTop: "16px",
519
- borderTop: `1px solid ${isDark ? "#333333" : "#e5e5e5"}`,
520
- fontSize: "13px",
521
- color: isDark ? "#888888" : "#666666",
522
- textAlign: "center"
523
- },
524
- link: {
525
- color: theme?.primaryColor || "#8b5cf6",
526
- textDecoration: "none"
527
- }
528
- };
529
- const handleWalletClick = (wallet) => {
530
- if (wallet.installed) {
531
- onSelectWallet(wallet.id);
532
- } else if (wallet.downloadUrl) {
533
- window.open(wallet.downloadUrl, "_blank");
534
- }
535
- };
593
+ const isDark = theme?.mode === "dark" || theme?.mode === "auto" && window.matchMedia("(prefers-color-scheme: dark)").matches;
594
+ const bg = theme?.modalBackground || (isDark ? "#0f0f11" : "#ffffff");
595
+ const text = theme?.textColor || (isDark ? "#ffffff" : "#0a0a0a");
596
+ const muted = isDark ? "#8b8b8b" : "#6b6b6b";
597
+ const border = isDark ? "#1f1f23" : "#eaeaea";
598
+ const hover = theme?.buttonHoverColor || (isDark ? "#1a1a1f" : "#f6f6f6");
536
599
  return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("style", null, `
537
- @keyframes swk-fade-in {
538
- from { opacity: 0; }
539
- to { opacity: 1; }
600
+ .swk-overlay {
601
+ position: fixed;
602
+ inset: 0;
603
+ background: rgba(0,0,0,0.55);
604
+ display: flex;
605
+ align-items: center;
606
+ justify-content: center;
607
+ z-index: 9999;
540
608
  }
541
- @keyframes swk-slide-up {
542
- from {
543
- opacity: 0;
544
- transform: translateY(20px);
545
- }
546
- to {
547
- opacity: 1;
548
- transform: translateY(0);
549
- }
609
+
610
+ .swk-modal {
611
+ width: 420px;
612
+ max-width: 92vw;
613
+ background: ${bg};
614
+ border-radius: 20px;
615
+ padding: 28px;
616
+ box-shadow: 0 20px 60px rgba(0,0,0,0.4);
617
+ font-family: ${theme?.fontFamily || "Inter, system-ui, sans-serif"};
618
+ }
619
+
620
+ .swk-wallet {
621
+ display: flex;
622
+ align-items: center;
623
+ gap: 14px;
624
+ padding: 14px 16px;
625
+ border-radius: 14px;
626
+ cursor: pointer;
627
+ transition: background 0.15s ease;
550
628
  }
551
- .swk-wallet-button:hover {
552
- background-color: ${theme?.buttonHoverColor || (isDark ? "#252525" : "#f5f5f5")} !important;
553
- border-color: ${theme?.primaryColor || "#8b5cf6"} !important;
629
+
630
+ .swk-wallet:hover {
631
+ background: ${hover};
554
632
  }
555
- .swk-close-button:hover {
556
- color: ${theme?.primaryColor || "#8b5cf6"} !important;
633
+
634
+ .swk-pill {
635
+ font-size: 12px;
636
+ padding: 4px 10px;
637
+ border-radius: 999px;
638
+ background: ${theme?.primaryColor || "#6c5ce7"};
639
+ color: white;
640
+ font-weight: 500;
557
641
  }
558
- `), /* @__PURE__ */ React3.createElement("div", { style: styles.overlay, onClick: onClose }, /* @__PURE__ */ React3.createElement("div", { style: styles.modal, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React3.createElement("div", { style: styles.header }, /* @__PURE__ */ React3.createElement("h2", { style: styles.title }, appIcon && /* @__PURE__ */ React3.createElement("img", { src: appIcon, alt: "", style: { width: "32px", height: "32px", borderRadius: "8px" } }), "Connect Wallet"), /* @__PURE__ */ React3.createElement(
559
- "button",
642
+ `), /* @__PURE__ */ React3.createElement("div", { className: "swk-overlay", onClick: onClose }, /* @__PURE__ */ React3.createElement("div", { className: "swk-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React3.createElement("div", { style: { marginBottom: 24 } }, /* @__PURE__ */ React3.createElement(
643
+ "div",
560
644
  {
561
- className: "swk-close-button",
562
- style: styles.closeButton,
563
- onClick: onClose,
564
- "aria-label": "Close modal"
645
+ style: {
646
+ display: "flex",
647
+ alignItems: "center",
648
+ gap: 12,
649
+ marginBottom: 8
650
+ }
565
651
  },
566
- "\xD7"
567
- )), /* @__PURE__ */ React3.createElement("div", { style: styles.walletList }, wallets.map((wallet) => /* @__PURE__ */ React3.createElement(
568
- "button",
652
+ appIcon && /* @__PURE__ */ React3.createElement(
653
+ "img",
654
+ {
655
+ src: appIcon,
656
+ alt: "",
657
+ style: { width: 32, height: 32, borderRadius: 8 }
658
+ }
659
+ ),
660
+ /* @__PURE__ */ React3.createElement("span", { style: { color: muted, fontSize: 14 } }, "Log in or sign up")
661
+ ), /* @__PURE__ */ React3.createElement(
662
+ "h2",
663
+ {
664
+ style: {
665
+ margin: 0,
666
+ fontSize: 22,
667
+ fontWeight: 600,
668
+ color: text
669
+ }
670
+ },
671
+ appName
672
+ )), /* @__PURE__ */ React3.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 8 } }, wallets.map((wallet, i) => /* @__PURE__ */ React3.createElement(
673
+ "div",
569
674
  {
570
675
  key: wallet.id,
571
- className: "swk-wallet-button",
572
- style: styles.walletButton,
573
- onClick: () => handleWalletClick(wallet),
574
- disabled: !wallet.installed && !wallet.downloadUrl
676
+ className: "swk-wallet",
677
+ onClick: () => onSelectWallet(wallet.id)
575
678
  },
576
679
  /* @__PURE__ */ React3.createElement(
577
680
  "img",
578
681
  {
579
682
  src: wallet.icon,
580
- alt: `${wallet.name} icon`,
581
- style: styles.walletIcon
683
+ alt: wallet.name,
684
+ style: { width: 36, height: 36, borderRadius: 10 }
582
685
  }
583
686
  ),
584
- /* @__PURE__ */ React3.createElement("div", { style: styles.walletInfo }, /* @__PURE__ */ React3.createElement("p", { style: styles.walletName }, wallet.name), wallet.description && /* @__PURE__ */ React3.createElement("p", { style: styles.walletDescription }, wallet.description)),
585
- /* @__PURE__ */ React3.createElement(
687
+ /* @__PURE__ */ React3.createElement("div", { style: { flex: 1 } }, /* @__PURE__ */ React3.createElement(
586
688
  "div",
587
689
  {
588
690
  style: {
589
- ...styles.badge,
590
- ...wallet.installed ? styles.installedBadge : styles.notInstalledBadge
691
+ fontSize: 15,
692
+ fontWeight: 500,
693
+ color: text
591
694
  }
592
695
  },
593
- wallet.installed ? "Installed" : "Get"
594
- )
595
- ))), /* @__PURE__ */ React3.createElement("div", { style: styles.footer }, /* @__PURE__ */ React3.createElement("p", { style: { margin: 0 } }, "Don't have a wallet?", " ", /* @__PURE__ */ React3.createElement(
596
- "a",
696
+ wallet.name
697
+ ), wallet.description && /* @__PURE__ */ React3.createElement(
698
+ "div",
699
+ {
700
+ style: {
701
+ fontSize: 13,
702
+ color: muted,
703
+ marginTop: 2
704
+ }
705
+ },
706
+ wallet.description
707
+ )),
708
+ i === 0 && /* @__PURE__ */ React3.createElement("div", { className: "swk-pill" }, "Recent")
709
+ ))), /* @__PURE__ */ React3.createElement(
710
+ "div",
597
711
  {
598
- href: "https://www.stellar.org/ecosystem/projects#wallets",
599
- target: "_blank",
600
- rel: "noopener noreferrer",
601
- style: styles.link
712
+ style: {
713
+ marginTop: 24,
714
+ paddingTop: 16,
715
+ borderTop: `1px solid ${border}`,
716
+ textAlign: "center",
717
+ fontSize: 13,
718
+ color: muted
719
+ }
602
720
  },
603
- "Learn more"
604
- ))))));
721
+ "Powered by Stellar Wallet Kit"
722
+ ))));
605
723
  }
606
724
 
607
725
  // src/components/ConnectButton.tsx