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