@cookill/wallet-adapter 3.1.6 → 3.1.8

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/react.cjs CHANGED
@@ -742,10 +742,7 @@ function WalletProvider({
742
742
  }
743
743
  if (!wallet.isInstalled) {
744
744
  dispatch({ type: "OPEN_MODAL" });
745
- const err = new Error("Sheep Wallet not installed");
746
- dispatch({ type: "ERROR", error: err });
747
- onError?.(err);
748
- throw err;
745
+ return [];
749
746
  }
750
747
  connectingRef.current = true;
751
748
  dispatch({ type: "CONNECTING" });
@@ -1046,6 +1043,12 @@ function WalletModal({ scanConnectRelay, dispatch }) {
1046
1043
  const { state, wallets, connect, closeModal, isInstalled: installed } = useWallet();
1047
1044
  const [activeTab, setActiveTab] = React.useState("extension");
1048
1045
  const [scanMode, setScanMode] = React.useState("show-qr");
1046
+ const [webWalletMode, setWebWalletMode] = React.useState("menu");
1047
+ const [webWalletPassword, setWebWalletPassword] = React.useState("");
1048
+ const [webWalletMnemonic, setWebWalletMnemonic] = React.useState("");
1049
+ const [webWalletGeneratedMnemonic, setWebWalletGeneratedMnemonic] = React.useState("");
1050
+ const [webWalletError, setWebWalletError] = React.useState("");
1051
+ const [webWalletLoading, setWebWalletLoading] = React.useState(false);
1049
1052
  const [generatedURI, setGeneratedURI] = React.useState(null);
1050
1053
  const [qrReady, setQRReady] = React.useState(false);
1051
1054
  const canvasRef = React.useRef(null);
@@ -1075,6 +1078,53 @@ function WalletModal({ scanConnectRelay, dispatch }) {
1075
1078
  } catch {
1076
1079
  }
1077
1080
  };
1081
+ const handleWebWalletConnect = async (action) => {
1082
+ setWebWalletError("");
1083
+ setWebWalletLoading(true);
1084
+ try {
1085
+ const provider = window.rialo;
1086
+ if (!provider?.isWebWallet) {
1087
+ throw new Error("Web wallet provider not available. Make sure registerWebWallet() is called.");
1088
+ }
1089
+ if (action === "create") {
1090
+ if (!webWalletPassword || webWalletPassword.length < 6) {
1091
+ throw new Error("Password must be at least 6 characters");
1092
+ }
1093
+ const result = await provider.createWallet(webWalletPassword);
1094
+ setWebWalletGeneratedMnemonic(result.mnemonic);
1095
+ try {
1096
+ await connect();
1097
+ } catch {
1098
+ }
1099
+ } else if (action === "import") {
1100
+ if (!webWalletMnemonic.trim()) {
1101
+ throw new Error("Please enter your recovery phrase");
1102
+ }
1103
+ if (!webWalletPassword || webWalletPassword.length < 6) {
1104
+ throw new Error("Password must be at least 6 characters");
1105
+ }
1106
+ await provider.importWallet(webWalletMnemonic.trim(), webWalletPassword);
1107
+ try {
1108
+ await connect();
1109
+ } catch {
1110
+ }
1111
+ } else if (action === "unlock") {
1112
+ if (!webWalletPassword) {
1113
+ throw new Error("Please enter your password");
1114
+ }
1115
+ const unlocked = await provider.unlock(webWalletPassword);
1116
+ if (!unlocked) throw new Error("Incorrect password");
1117
+ try {
1118
+ await connect();
1119
+ } catch {
1120
+ }
1121
+ }
1122
+ } catch (err) {
1123
+ setWebWalletError(err?.message || "Web wallet operation failed");
1124
+ } finally {
1125
+ setWebWalletLoading(false);
1126
+ }
1127
+ };
1078
1128
  const generateScanSession = async () => {
1079
1129
  dispatch({ type: "SET_SCAN_STATUS", status: "generating" });
1080
1130
  const sessionId = crypto.randomUUID();
@@ -1237,7 +1287,32 @@ function WalletModal({ scanConnectRelay, dispatch }) {
1237
1287
  },
1238
1288
  children: [
1239
1289
  /* @__PURE__ */ jsxRuntime.jsx(QrIcon, {}),
1240
- " Scan to Connect"
1290
+ " Scan"
1291
+ ]
1292
+ }
1293
+ ),
1294
+ /* @__PURE__ */ jsxRuntime.jsxs(
1295
+ "button",
1296
+ {
1297
+ type: "button",
1298
+ onClick: (e) => {
1299
+ stop(e);
1300
+ setActiveTab("webwallet");
1301
+ },
1302
+ style: {
1303
+ ...tabBaseStyle,
1304
+ backgroundColor: activeTab === "webwallet" ? "rgba(255,255,255,0.08)" : "transparent",
1305
+ color: activeTab === "webwallet" ? "#6EB9A8" : "rgba(255,255,255,0.4)",
1306
+ fontWeight: activeTab === "webwallet" ? 600 : 400
1307
+ },
1308
+ children: [
1309
+ /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
1310
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1311
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 10h20" }),
1312
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 17v4" }),
1313
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 21h8" })
1314
+ ] }),
1315
+ "Web Wallet"
1241
1316
  ]
1242
1317
  }
1243
1318
  )
@@ -1492,6 +1567,238 @@ function WalletModal({ scanConnectRelay, dispatch }) {
1492
1567
  ] })
1493
1568
  ] })
1494
1569
  ] }),
1570
+ activeTab === "webwallet" && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1571
+ (() => {
1572
+ const webProvider = typeof window !== "undefined" ? window.rialo : null;
1573
+ const hasWebWallet = webProvider?.isWebWallet && webProvider?.hasWallet?.();
1574
+ const isUnlocked = webProvider?.isWebWallet && webProvider?.isUnlocked?.();
1575
+ if (webWalletGeneratedMnemonic) {
1576
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1577
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
1578
+ padding: "14px",
1579
+ backgroundColor: "rgba(110,185,168,0.08)",
1580
+ border: "1px solid rgba(110,185,168,0.2)",
1581
+ borderRadius: "12px",
1582
+ marginBottom: "16px"
1583
+ }, children: [
1584
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#6EB9A8", fontSize: "12px", fontWeight: 600, marginBottom: "8px" }, children: "Wallet Created & Connected!" }),
1585
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "rgba(255,255,255,0.6)", fontSize: "11px", marginBottom: "8px" }, children: "Save your recovery phrase securely:" }),
1586
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1587
+ padding: "10px",
1588
+ backgroundColor: "rgba(0,0,0,0.3)",
1589
+ borderRadius: "8px",
1590
+ color: "#fff",
1591
+ fontSize: "12px",
1592
+ fontFamily: "monospace",
1593
+ wordBreak: "break-word",
1594
+ lineHeight: 1.6
1595
+ }, children: webWalletGeneratedMnemonic })
1596
+ ] }),
1597
+ /* @__PURE__ */ jsxRuntime.jsx(
1598
+ "button",
1599
+ {
1600
+ type: "button",
1601
+ onClick: (e) => {
1602
+ stop(e);
1603
+ setWebWalletGeneratedMnemonic("");
1604
+ closeModal();
1605
+ },
1606
+ style: { width: "100%", padding: "12px", backgroundColor: "#6EB9A8", border: "none", borderRadius: "12px", color: "#011B29", fontSize: "14px", fontWeight: 600, cursor: "pointer" },
1607
+ children: "I've Saved It \u2014 Continue"
1608
+ }
1609
+ )
1610
+ ] });
1611
+ }
1612
+ if (hasWebWallet && !isUnlocked) {
1613
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1614
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "13px", marginBottom: "16px" }, children: "Web wallet locked. Enter password to connect." }),
1615
+ /* @__PURE__ */ jsxRuntime.jsx(
1616
+ "input",
1617
+ {
1618
+ type: "password",
1619
+ placeholder: "Password",
1620
+ value: webWalletPassword,
1621
+ onChange: (e) => setWebWalletPassword(e.target.value),
1622
+ onClick: stop,
1623
+ onKeyDown: (e) => {
1624
+ if (e.key === "Enter") handleWebWalletConnect("unlock");
1625
+ },
1626
+ style: { width: "100%", padding: "12px 14px", backgroundColor: "rgba(255,255,255,0.04)", border: "1px solid rgba(255,255,255,0.1)", borderRadius: "12px", color: "#fff", fontSize: "14px", marginBottom: "12px", outline: "none", boxSizing: "border-box" }
1627
+ }
1628
+ ),
1629
+ /* @__PURE__ */ jsxRuntime.jsx(
1630
+ "button",
1631
+ {
1632
+ type: "button",
1633
+ onClick: (e) => {
1634
+ stop(e);
1635
+ handleWebWalletConnect("unlock");
1636
+ },
1637
+ disabled: webWalletLoading,
1638
+ style: { width: "100%", padding: "12px", backgroundColor: "#6EB9A8", border: "none", borderRadius: "12px", color: "#011B29", fontSize: "14px", fontWeight: 600, cursor: webWalletLoading ? "wait" : "pointer", opacity: webWalletLoading ? 0.6 : 1 },
1639
+ children: webWalletLoading ? "Unlocking..." : "Unlock & Connect"
1640
+ }
1641
+ )
1642
+ ] });
1643
+ }
1644
+ if (hasWebWallet && isUnlocked) {
1645
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", onClick: async (e) => {
1646
+ stop(e);
1647
+ setWebWalletLoading(true);
1648
+ try {
1649
+ await connect();
1650
+ } catch (err) {
1651
+ setWebWalletError(err?.message || "Failed");
1652
+ } finally {
1653
+ setWebWalletLoading(false);
1654
+ }
1655
+ }, disabled: webWalletLoading, style: {
1656
+ width: "100%",
1657
+ display: "flex",
1658
+ alignItems: "center",
1659
+ gap: "14px",
1660
+ padding: "16px",
1661
+ backgroundColor: "rgba(255,255,255,0.04)",
1662
+ border: "1px solid rgba(255,255,255,0.08)",
1663
+ borderRadius: "14px",
1664
+ cursor: webWalletLoading ? "wait" : "pointer"
1665
+ }, children: [
1666
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "44px", height: "44px", borderRadius: "12px", background: "linear-gradient(135deg, #3B82F6, #6366F1)", display: "flex", alignItems: "center", justifyContent: "center", color: "#fff" }, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1667
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1668
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 10h20" })
1669
+ ] }) }),
1670
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1, textAlign: "left" }, children: [
1671
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#fff", fontWeight: 500, fontSize: "15px" }, children: "Web Wallet" }),
1672
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "12px", color: "#6EB9A8" }, children: webWalletLoading ? "Connecting..." : "Ready \u2014 Click to connect" })
1673
+ ] })
1674
+ ] });
1675
+ }
1676
+ if (webWalletMode === "create") {
1677
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1678
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: (e) => {
1679
+ stop(e);
1680
+ setWebWalletMode("menu");
1681
+ }, style: { background: "none", border: "none", color: "rgba(255,255,255,0.4)", cursor: "pointer", fontSize: "12px", marginBottom: "12px", padding: 0 }, children: "\u2190 Back" }),
1682
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "13px", marginBottom: "16px" }, children: "Create a new web wallet with a generated recovery phrase." }),
1683
+ /* @__PURE__ */ jsxRuntime.jsx(
1684
+ "input",
1685
+ {
1686
+ type: "password",
1687
+ placeholder: "Set password (min 6 chars)",
1688
+ value: webWalletPassword,
1689
+ onChange: (e) => setWebWalletPassword(e.target.value),
1690
+ onClick: stop,
1691
+ style: { width: "100%", padding: "12px 14px", backgroundColor: "rgba(255,255,255,0.04)", border: "1px solid rgba(255,255,255,0.1)", borderRadius: "12px", color: "#fff", fontSize: "14px", marginBottom: "12px", outline: "none", boxSizing: "border-box" }
1692
+ }
1693
+ ),
1694
+ /* @__PURE__ */ jsxRuntime.jsx(
1695
+ "button",
1696
+ {
1697
+ type: "button",
1698
+ onClick: (e) => {
1699
+ stop(e);
1700
+ handleWebWalletConnect("create");
1701
+ },
1702
+ disabled: webWalletLoading,
1703
+ style: { width: "100%", padding: "12px", backgroundColor: "#6EB9A8", border: "none", borderRadius: "12px", color: "#011B29", fontSize: "14px", fontWeight: 600, cursor: webWalletLoading ? "wait" : "pointer", opacity: webWalletLoading ? 0.6 : 1 },
1704
+ children: webWalletLoading ? "Creating..." : "Create Wallet"
1705
+ }
1706
+ )
1707
+ ] });
1708
+ }
1709
+ if (webWalletMode === "import") {
1710
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1711
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: (e) => {
1712
+ stop(e);
1713
+ setWebWalletMode("menu");
1714
+ }, style: { background: "none", border: "none", color: "rgba(255,255,255,0.4)", cursor: "pointer", fontSize: "12px", marginBottom: "12px", padding: 0 }, children: "\u2190 Back" }),
1715
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "13px", marginBottom: "16px" }, children: "Import wallet from recovery phrase." }),
1716
+ /* @__PURE__ */ jsxRuntime.jsx(
1717
+ "textarea",
1718
+ {
1719
+ placeholder: "Enter 12 or 24 word recovery phrase",
1720
+ value: webWalletMnemonic,
1721
+ onChange: (e) => setWebWalletMnemonic(e.target.value),
1722
+ onClick: stop,
1723
+ style: { width: "100%", padding: "12px 14px", backgroundColor: "rgba(255,255,255,0.04)", border: "1px solid rgba(255,255,255,0.1)", borderRadius: "12px", color: "#fff", fontSize: "13px", marginBottom: "12px", outline: "none", boxSizing: "border-box", minHeight: "80px", resize: "vertical", fontFamily: "monospace" }
1724
+ }
1725
+ ),
1726
+ /* @__PURE__ */ jsxRuntime.jsx(
1727
+ "input",
1728
+ {
1729
+ type: "password",
1730
+ placeholder: "Set password (min 6 chars)",
1731
+ value: webWalletPassword,
1732
+ onChange: (e) => setWebWalletPassword(e.target.value),
1733
+ onClick: stop,
1734
+ style: { width: "100%", padding: "12px 14px", backgroundColor: "rgba(255,255,255,0.04)", border: "1px solid rgba(255,255,255,0.1)", borderRadius: "12px", color: "#fff", fontSize: "14px", marginBottom: "12px", outline: "none", boxSizing: "border-box" }
1735
+ }
1736
+ ),
1737
+ /* @__PURE__ */ jsxRuntime.jsx(
1738
+ "button",
1739
+ {
1740
+ type: "button",
1741
+ onClick: (e) => {
1742
+ stop(e);
1743
+ handleWebWalletConnect("import");
1744
+ },
1745
+ disabled: webWalletLoading,
1746
+ style: { width: "100%", padding: "12px", backgroundColor: "#6EB9A8", border: "none", borderRadius: "12px", color: "#011B29", fontSize: "14px", fontWeight: 600, cursor: webWalletLoading ? "wait" : "pointer", opacity: webWalletLoading ? 0.6 : 1 },
1747
+ children: webWalletLoading ? "Importing..." : "Import & Connect"
1748
+ }
1749
+ )
1750
+ ] });
1751
+ }
1752
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1753
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "13px", marginBottom: "16px", lineHeight: 1.5 }, children: webProvider?.isWebWallet ? "Create or import a web wallet \u2014 no extension needed." : "Web wallet not available. Call registerWebWallet() at app startup." }),
1754
+ webProvider?.isWebWallet && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
1755
+ /* @__PURE__ */ jsxRuntime.jsxs(
1756
+ "button",
1757
+ {
1758
+ type: "button",
1759
+ onClick: (e) => {
1760
+ stop(e);
1761
+ setWebWalletMode("create");
1762
+ setWebWalletError("");
1763
+ },
1764
+ style: { width: "100%", display: "flex", alignItems: "center", gap: "14px", padding: "16px", backgroundColor: "rgba(255,255,255,0.04)", border: "1px solid rgba(255,255,255,0.08)", borderRadius: "14px", cursor: "pointer" },
1765
+ children: [
1766
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "40px", height: "40px", borderRadius: "10px", background: "linear-gradient(135deg, #3B82F6, #6366F1)", display: "flex", alignItems: "center", justifyContent: "center", color: "#fff", fontSize: "18px" }, children: "+" }),
1767
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "left" }, children: [
1768
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#fff", fontWeight: 500, fontSize: "14px" }, children: "Create New Wallet" }),
1769
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "rgba(255,255,255,0.4)", fontSize: "11px" }, children: "Generate a new recovery phrase" })
1770
+ ] })
1771
+ ]
1772
+ }
1773
+ ),
1774
+ /* @__PURE__ */ jsxRuntime.jsxs(
1775
+ "button",
1776
+ {
1777
+ type: "button",
1778
+ onClick: (e) => {
1779
+ stop(e);
1780
+ setWebWalletMode("import");
1781
+ setWebWalletError("");
1782
+ },
1783
+ style: { width: "100%", display: "flex", alignItems: "center", gap: "14px", padding: "16px", backgroundColor: "rgba(255,255,255,0.04)", border: "1px solid rgba(255,255,255,0.08)", borderRadius: "14px", cursor: "pointer" },
1784
+ children: [
1785
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "40px", height: "40px", borderRadius: "10px", background: "linear-gradient(135deg, #F59E0B, #EF4444)", display: "flex", alignItems: "center", justifyContent: "center", color: "#fff" }, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1786
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3v12" }),
1787
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8 11 4 4 4-4" }),
1788
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4" })
1789
+ ] }) }),
1790
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "left" }, children: [
1791
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#fff", fontWeight: 500, fontSize: "14px" }, children: "Import Wallet" }),
1792
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "rgba(255,255,255,0.4)", fontSize: "11px" }, children: "Use existing recovery phrase" })
1793
+ ] })
1794
+ ]
1795
+ }
1796
+ )
1797
+ ] })
1798
+ ] });
1799
+ })(),
1800
+ webWalletError && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "12px", padding: "10px 12px", backgroundColor: "rgba(239,68,68,0.08)", border: "1px solid rgba(239,68,68,0.15)", borderRadius: "10px", color: "#f87171", fontSize: "12px" }, children: webWalletError })
1801
+ ] }),
1495
1802
  state.error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1496
1803
  marginTop: "16px",
1497
1804
  padding: "12px 14px",
@@ -1528,124 +1835,111 @@ function WalletModal({ scanConnectRelay, dispatch }) {
1528
1835
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12" })
1529
1836
  ] });
1530
1837
  if (isMobile) {
1531
- return /* @__PURE__ */ jsxRuntime.jsxs(
1838
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "fixed", inset: 0, zIndex: 9999 }, children: [
1839
+ /* @__PURE__ */ jsxRuntime.jsx(
1840
+ "div",
1841
+ {
1842
+ style: {
1843
+ position: "absolute",
1844
+ inset: 0,
1845
+ backgroundColor: "rgba(0,0,0,0.6)",
1846
+ backdropFilter: "blur(8px)",
1847
+ WebkitBackdropFilter: "blur(8px)"
1848
+ },
1849
+ onClick: closeModal
1850
+ }
1851
+ ),
1852
+ /* @__PURE__ */ jsxRuntime.jsxs(
1853
+ "div",
1854
+ {
1855
+ onTouchStart: handleTouchStart,
1856
+ onTouchMove: handleTouchMove,
1857
+ onTouchEnd: handleTouchEnd,
1858
+ style: {
1859
+ position: "fixed",
1860
+ bottom: 0,
1861
+ left: 0,
1862
+ right: 0,
1863
+ backgroundColor: "#011B29",
1864
+ borderTopLeftRadius: "24px",
1865
+ borderTopRightRadius: "24px",
1866
+ padding: "0 20px 28px",
1867
+ maxHeight: "85vh",
1868
+ overflow: "auto",
1869
+ boxShadow: "0 -8px 40px rgba(0,0,0,0.5)",
1870
+ transform: `translateY(${dragY}px)`,
1871
+ transition: isDragging ? "none" : "transform 0.3s cubic-bezier(0.4,0,0.2,1)",
1872
+ animation: isDragging ? "none" : "walletModalSlideUp 0.35s cubic-bezier(0.4,0,0.2,1)"
1873
+ },
1874
+ children: [
1875
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "center", padding: "12px 0 16px", cursor: "grab", touchAction: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "36px", height: "4px", borderRadius: "2px", backgroundColor: "rgba(255,255,255,0.12)" } }) }),
1876
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
1877
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { color: "#fff", fontSize: "18px", fontWeight: 600, margin: 0, letterSpacing: "-0.01em" }, children: "Connect Wallet" }),
1878
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: closeModal, style: closeBtn, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) })
1879
+ ] }),
1880
+ renderContent()
1881
+ ]
1882
+ }
1883
+ ),
1884
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1885
+ @keyframes walletModalSlideUp {
1886
+ from { transform: translateY(100%); }
1887
+ to { transform: translateY(0); }
1888
+ }
1889
+ @keyframes walletModalPulse {
1890
+ 0%, 100% { opacity: 1; }
1891
+ 50% { opacity: 0.3; }
1892
+ }
1893
+ ` })
1894
+ ] });
1895
+ }
1896
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "fixed", inset: 0, zIndex: 9999 }, children: [
1897
+ /* @__PURE__ */ jsxRuntime.jsx(
1532
1898
  "div",
1533
1899
  {
1534
1900
  style: {
1535
- position: "fixed",
1901
+ position: "absolute",
1536
1902
  inset: 0,
1537
- zIndex: 9999,
1538
1903
  backgroundColor: "rgba(0,0,0,0.6)",
1539
1904
  backdropFilter: "blur(8px)",
1540
1905
  WebkitBackdropFilter: "blur(8px)"
1541
1906
  },
1542
- onClick: (e) => {
1543
- if (e.target === e.currentTarget) closeModal();
1544
- },
1545
- onPointerDown: (e) => {
1546
- if (e.target !== e.currentTarget) e.stopPropagation();
1907
+ onClick: closeModal
1908
+ }
1909
+ ),
1910
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1911
+ position: "fixed",
1912
+ inset: 0,
1913
+ display: "flex",
1914
+ alignItems: "center",
1915
+ justifyContent: "center",
1916
+ pointerEvents: "none"
1917
+ }, children: /* @__PURE__ */ jsxRuntime.jsxs(
1918
+ "div",
1919
+ {
1920
+ style: {
1921
+ pointerEvents: "auto",
1922
+ backgroundColor: "#011B29",
1923
+ borderRadius: "20px",
1924
+ padding: "24px",
1925
+ width: "100%",
1926
+ maxWidth: "400px",
1927
+ margin: "16px",
1928
+ boxShadow: "0 25px 60px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)",
1929
+ maxHeight: "90vh",
1930
+ overflow: "auto",
1931
+ animation: "walletModalFadeIn 0.25s cubic-bezier(0.4,0,0.2,1)"
1547
1932
  },
1548
1933
  children: [
1549
- /* @__PURE__ */ jsxRuntime.jsxs(
1550
- "div",
1551
- {
1552
- onTouchStart: handleTouchStart,
1553
- onTouchMove: handleTouchMove,
1554
- onTouchEnd: handleTouchEnd,
1555
- onClick: stop,
1556
- style: {
1557
- position: "fixed",
1558
- bottom: 0,
1559
- left: 0,
1560
- right: 0,
1561
- backgroundColor: "#011B29",
1562
- borderTopLeftRadius: "24px",
1563
- borderTopRightRadius: "24px",
1564
- padding: "0 20px 28px",
1565
- maxHeight: "85vh",
1566
- overflow: "auto",
1567
- boxShadow: "0 -8px 40px rgba(0,0,0,0.5)",
1568
- transform: `translateY(${dragY}px)`,
1569
- transition: isDragging ? "none" : "transform 0.3s cubic-bezier(0.4,0,0.2,1)",
1570
- animation: isDragging ? "none" : "walletModalSlideUp 0.35s cubic-bezier(0.4,0,0.2,1)"
1571
- },
1572
- children: [
1573
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "center", padding: "12px 0 16px", cursor: "grab", touchAction: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "36px", height: "4px", borderRadius: "2px", backgroundColor: "rgba(255,255,255,0.12)" } }) }),
1574
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
1575
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { color: "#fff", fontSize: "18px", fontWeight: 600, margin: 0, letterSpacing: "-0.01em" }, children: "Connect Wallet" }),
1576
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: (e) => {
1577
- stop(e);
1578
- closeModal();
1579
- }, style: closeBtn, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) })
1580
- ] }),
1581
- renderContent()
1582
- ]
1583
- }
1584
- ),
1585
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1586
- @keyframes walletModalSlideUp {
1587
- from { transform: translateY(100%); }
1588
- to { transform: translateY(0); }
1589
- }
1590
- @keyframes walletModalPulse {
1591
- 0%, 100% { opacity: 1; }
1592
- 50% { opacity: 0.3; }
1593
- }
1594
- ` })
1934
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
1935
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { color: "#fff", fontSize: "18px", fontWeight: 600, margin: 0, letterSpacing: "-0.01em" }, children: "Connect Wallet" }),
1936
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: closeModal, style: closeBtn, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) })
1937
+ ] }),
1938
+ renderContent()
1595
1939
  ]
1596
1940
  }
1597
- );
1598
- }
1599
- return /* @__PURE__ */ jsxRuntime.jsxs(
1600
- "div",
1601
- {
1602
- style: {
1603
- position: "fixed",
1604
- inset: 0,
1605
- zIndex: 9999,
1606
- display: "flex",
1607
- alignItems: "center",
1608
- justifyContent: "center",
1609
- backgroundColor: "rgba(0,0,0,0.6)",
1610
- backdropFilter: "blur(8px)",
1611
- WebkitBackdropFilter: "blur(8px)"
1612
- },
1613
- onClick: (e) => {
1614
- if (e.target === e.currentTarget) closeModal();
1615
- },
1616
- onPointerDown: (e) => {
1617
- if (e.target !== e.currentTarget) e.stopPropagation();
1618
- },
1619
- children: [
1620
- /* @__PURE__ */ jsxRuntime.jsxs(
1621
- "div",
1622
- {
1623
- onClick: stop,
1624
- style: {
1625
- backgroundColor: "#011B29",
1626
- borderRadius: "20px",
1627
- padding: "24px",
1628
- width: "100%",
1629
- maxWidth: "400px",
1630
- margin: "16px",
1631
- boxShadow: "0 25px 60px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)",
1632
- maxHeight: "90vh",
1633
- overflow: "auto",
1634
- animation: "walletModalFadeIn 0.25s cubic-bezier(0.4,0,0.2,1)"
1635
- },
1636
- children: [
1637
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "20px" }, children: [
1638
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { color: "#fff", fontSize: "18px", fontWeight: 600, margin: 0, letterSpacing: "-0.01em" }, children: "Connect Wallet" }),
1639
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: (e) => {
1640
- stop(e);
1641
- closeModal();
1642
- }, style: closeBtn, children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {}) })
1643
- ] }),
1644
- renderContent()
1645
- ]
1646
- }
1647
- ),
1648
- /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1941
+ ) }),
1942
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `
1649
1943
  @keyframes walletModalFadeIn {
1650
1944
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
1651
1945
  to { opacity: 1; transform: scale(1) translateY(0); }
@@ -1655,9 +1949,7 @@ function WalletModal({ scanConnectRelay, dispatch }) {
1655
1949
  50% { opacity: 0.3; }
1656
1950
  }
1657
1951
  ` })
1658
- ]
1659
- }
1660
- );
1952
+ ] });
1661
1953
  }
1662
1954
  function ConnectButton({
1663
1955
  connectLabel = "Connect Wallet",
@@ -1674,14 +1966,7 @@ function ConnectButton({
1674
1966
  if (connected) {
1675
1967
  setShowMenu(!showMenu);
1676
1968
  } else {
1677
- if (installed) {
1678
- try {
1679
- await connect();
1680
- } catch {
1681
- }
1682
- } else {
1683
- openModal();
1684
- }
1969
+ openModal();
1685
1970
  }
1686
1971
  };
1687
1972
  const displayText = connected && activeAccount && showAddress ? `${activeAccount.address.slice(0, 6)}...${activeAccount.address.slice(-4)}` : connecting ? "Connecting..." : connectLabel;