@pollar/react 0.8.1 → 0.9.0-rc.1
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.css +61 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +66 -26
- package/dist/index.d.ts +66 -26
- package/dist/index.js +425 -113
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +423 -114
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AUTH_ERROR_CODES, WalletType, PollarClient } from '@pollar/core';
|
|
3
3
|
import { forwardRef, createContext, useState, useCallback, useEffect, useRef, useMemo, useContext, Component } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import { startAuthentication, startRegistration } from '@simplewebauthn/browser';
|
|
5
6
|
|
|
6
7
|
var __create = Object.create;
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
@@ -1001,6 +1002,10 @@ var require_QRCode = __commonJS({
|
|
|
1001
1002
|
var LOGO_POLLAR = "https://pollar.xyz/assets/logo_pollar.png";
|
|
1002
1003
|
var LOGO_FREIGHTER = "https://pollar.xyz/assets/logo_freighter.png";
|
|
1003
1004
|
var LOGO_ALBEDO = "https://pollar.xyz/assets/logo_albedo.svg";
|
|
1005
|
+
var _modalLog = console;
|
|
1006
|
+
function setModalErrorLogger(logger) {
|
|
1007
|
+
_modalLog = logger;
|
|
1008
|
+
}
|
|
1004
1009
|
var ModalErrorBoundary = class extends Component {
|
|
1005
1010
|
constructor() {
|
|
1006
1011
|
super(...arguments);
|
|
@@ -1010,7 +1015,7 @@ var ModalErrorBoundary = class extends Component {
|
|
|
1010
1015
|
return { crashed: true };
|
|
1011
1016
|
}
|
|
1012
1017
|
componentDidCatch(error) {
|
|
1013
|
-
|
|
1018
|
+
_modalLog.error("[PollarProvider] Modal crashed:", error);
|
|
1014
1019
|
}
|
|
1015
1020
|
render() {
|
|
1016
1021
|
if (this.state.crashed) {
|
|
@@ -1028,7 +1033,7 @@ var PollarModalFooter = () => {
|
|
|
1028
1033
|
/* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
1029
1034
|
/* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
|
|
1030
1035
|
"v",
|
|
1031
|
-
"0.
|
|
1036
|
+
"0.9.0-rc.1"
|
|
1032
1037
|
] })
|
|
1033
1038
|
] })
|
|
1034
1039
|
] });
|
|
@@ -1065,7 +1070,8 @@ var REASON_LABEL = {
|
|
|
1065
1070
|
DISTRIBUTION_RULE_NOT_STARTED: "Not started yet",
|
|
1066
1071
|
DISTRIBUTION_RULE_EXPIRED: "Expired",
|
|
1067
1072
|
DISTRIBUTION_RULE_EXHAUSTED: "Fully claimed",
|
|
1068
|
-
|
|
1073
|
+
// Per-user, per-window claim limit (resets next period) — not permanent.
|
|
1074
|
+
DISTRIBUTION_RATE_LIMIT_EXCEEDED: "Claimed for this period"
|
|
1069
1075
|
};
|
|
1070
1076
|
function reasonLabel(reason) {
|
|
1071
1077
|
if (!reason) return "Not available";
|
|
@@ -1258,6 +1264,104 @@ function DistributionRulesModal({ onClose }) {
|
|
|
1258
1264
|
}
|
|
1259
1265
|
) });
|
|
1260
1266
|
}
|
|
1267
|
+
function cropAddress(address) {
|
|
1268
|
+
if (address.length <= 16) return address;
|
|
1269
|
+
return `${address.slice(0, 8)}...${address.slice(-8)}`;
|
|
1270
|
+
}
|
|
1271
|
+
function AssetItem({ record }) {
|
|
1272
|
+
const established = record.trustlineEstablished;
|
|
1273
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-asset-item", children: [
|
|
1274
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-asset-info", children: [
|
|
1275
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-asset-code", children: record.code }),
|
|
1276
|
+
record.name && /* @__PURE__ */ jsx("span", { className: "pollar-asset-name", children: record.name })
|
|
1277
|
+
] }),
|
|
1278
|
+
/* @__PURE__ */ jsx("span", { className: `pollar-asset-trustline${established ? " established" : ""}`, children: established ? "Trustline active" : "Needs trustline" })
|
|
1279
|
+
] });
|
|
1280
|
+
}
|
|
1281
|
+
function EnabledAssetsModalTemplate({
|
|
1282
|
+
theme,
|
|
1283
|
+
accentColor,
|
|
1284
|
+
enabledAssets,
|
|
1285
|
+
walletAddress,
|
|
1286
|
+
onRefresh,
|
|
1287
|
+
onClose
|
|
1288
|
+
}) {
|
|
1289
|
+
const isDark = theme === "dark";
|
|
1290
|
+
const cssVars = {
|
|
1291
|
+
"--pollar-accent": accentColor,
|
|
1292
|
+
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
1293
|
+
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
1294
|
+
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
1295
|
+
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
1296
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
1297
|
+
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
1298
|
+
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
1299
|
+
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
1300
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
1301
|
+
"--pollar-buttons-border-radius": "6px",
|
|
1302
|
+
"--pollar-buttons-height": "44px",
|
|
1303
|
+
"--pollar-input-height": "44px",
|
|
1304
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
1305
|
+
"--pollar-card-border-radius": "10px"
|
|
1306
|
+
};
|
|
1307
|
+
const isLoading = enabledAssets.step === "loading";
|
|
1308
|
+
const data = enabledAssets.step === "loaded" ? enabledAssets.data : null;
|
|
1309
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-asset-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
1310
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
|
|
1311
|
+
/* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Enabled Assets" }),
|
|
1312
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
1313
|
+
/* @__PURE__ */ jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
|
|
1314
|
+
/* @__PURE__ */ jsxs(
|
|
1315
|
+
"svg",
|
|
1316
|
+
{
|
|
1317
|
+
className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
|
|
1318
|
+
width: "13",
|
|
1319
|
+
height: "13",
|
|
1320
|
+
viewBox: "0 0 13 13",
|
|
1321
|
+
fill: "none",
|
|
1322
|
+
"aria-hidden": true,
|
|
1323
|
+
children: [
|
|
1324
|
+
/* @__PURE__ */ jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
1325
|
+
/* @__PURE__ */ jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1326
|
+
]
|
|
1327
|
+
}
|
|
1328
|
+
),
|
|
1329
|
+
"Refresh"
|
|
1330
|
+
] }),
|
|
1331
|
+
/* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
1332
|
+
] })
|
|
1333
|
+
] }),
|
|
1334
|
+
walletAddress && /* @__PURE__ */ jsx("div", { className: "pollar-asset-address", children: cropAddress(walletAddress) }),
|
|
1335
|
+
isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
|
|
1336
|
+
enabledAssets.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: enabledAssets.message }),
|
|
1337
|
+
data && !data.exists && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-empty", children: [
|
|
1338
|
+
"Account not found on ",
|
|
1339
|
+
data.network,
|
|
1340
|
+
"."
|
|
1341
|
+
] }),
|
|
1342
|
+
data && data.assets.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No assets enabled for this application." }),
|
|
1343
|
+
data && data.assets.length > 0 && /* @__PURE__ */ jsx("div", { className: "pollar-asset-list", children: data.assets.map((a) => /* @__PURE__ */ jsx(AssetItem, { record: a }, a.code + (a.issuer ?? ""))) }),
|
|
1344
|
+
/* @__PURE__ */ jsx(PollarModalFooter, {})
|
|
1345
|
+
] });
|
|
1346
|
+
}
|
|
1347
|
+
function EnabledAssetsModal({ onClose }) {
|
|
1348
|
+
const { enabledAssets, refreshAssets, walletAddress, styles } = usePollar();
|
|
1349
|
+
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
1350
|
+
useEffect(() => {
|
|
1351
|
+
void refreshAssets();
|
|
1352
|
+
}, [refreshAssets]);
|
|
1353
|
+
return /* @__PURE__ */ jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsx(
|
|
1354
|
+
EnabledAssetsModalTemplate,
|
|
1355
|
+
{
|
|
1356
|
+
theme,
|
|
1357
|
+
accentColor,
|
|
1358
|
+
enabledAssets,
|
|
1359
|
+
walletAddress,
|
|
1360
|
+
onRefresh: () => refreshAssets(),
|
|
1361
|
+
onClose
|
|
1362
|
+
}
|
|
1363
|
+
) });
|
|
1364
|
+
}
|
|
1261
1365
|
var STATUS_CONFIG = {
|
|
1262
1366
|
none: { label: "Not started", color: "#6b7280", dot: false },
|
|
1263
1367
|
pending: { label: "Pending review", color: "#f59e0b", dot: true },
|
|
@@ -1342,11 +1446,7 @@ function KycModalTemplate({
|
|
|
1342
1446
|
step === "verifying" && selectedProvider && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1343
1447
|
/* @__PURE__ */ jsx("div", { className: "pollar-kyc-iframe-wrap", children: session?.kycUrl ? /* @__PURE__ */ jsx("iframe", { className: "pollar-kyc-iframe", src: session.kycUrl, title: "KYC verification", allow: "camera; microphone" }) : /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-iframe-mock", children: [
|
|
1344
1448
|
/* @__PURE__ */ jsx("span", { children: "\u{1F512}" }),
|
|
1345
|
-
/* @__PURE__ */ jsx("span", { children: selectedProvider.flow === "form" ? "
|
|
1346
|
-
/* @__PURE__ */ jsxs("code", { style: { fontSize: "0.7rem", opacity: 0.6 }, children: [
|
|
1347
|
-
"provider: ",
|
|
1348
|
-
selectedProvider.id
|
|
1349
|
-
] })
|
|
1449
|
+
/* @__PURE__ */ jsx("span", { children: selectedProvider.flow === "form" ? "The identity verification form will appear here." : "Identity verification will open here." })
|
|
1350
1450
|
] }) }),
|
|
1351
1451
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
|
|
1352
1452
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" }),
|
|
@@ -1495,46 +1595,37 @@ var GoogleButton = ({ disabled, onClick }) => {
|
|
|
1495
1595
|
return /* @__PURE__ */ jsxs("button", { className: "gsi-material-button", disabled, onClick, children: [
|
|
1496
1596
|
/* @__PURE__ */ jsx("div", { className: "gsi-material-button-state" }),
|
|
1497
1597
|
/* @__PURE__ */ jsxs("div", { className: "gsi-material-button-content-wrapper", children: [
|
|
1498
|
-
/* @__PURE__ */ jsx("div", { className: "gsi-material-button-icon", children: /* @__PURE__ */ jsxs(
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
{
|
|
1530
|
-
fill: "#34A853",
|
|
1531
|
-
d: "M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"
|
|
1532
|
-
}
|
|
1533
|
-
),
|
|
1534
|
-
/* @__PURE__ */ jsx("path", { fill: "none", d: "M0 0h48v48H0z" })
|
|
1535
|
-
]
|
|
1536
|
-
}
|
|
1537
|
-
) }),
|
|
1598
|
+
/* @__PURE__ */ jsx("div", { className: "gsi-material-button-icon", children: /* @__PURE__ */ jsxs("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", style: { display: "block" }, children: [
|
|
1599
|
+
/* @__PURE__ */ jsx(
|
|
1600
|
+
"path",
|
|
1601
|
+
{
|
|
1602
|
+
fill: "#EA4335",
|
|
1603
|
+
d: "M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"
|
|
1604
|
+
}
|
|
1605
|
+
),
|
|
1606
|
+
/* @__PURE__ */ jsx(
|
|
1607
|
+
"path",
|
|
1608
|
+
{
|
|
1609
|
+
fill: "#4285F4",
|
|
1610
|
+
d: "M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"
|
|
1611
|
+
}
|
|
1612
|
+
),
|
|
1613
|
+
/* @__PURE__ */ jsx(
|
|
1614
|
+
"path",
|
|
1615
|
+
{
|
|
1616
|
+
fill: "#FBBC05",
|
|
1617
|
+
d: "M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"
|
|
1618
|
+
}
|
|
1619
|
+
),
|
|
1620
|
+
/* @__PURE__ */ jsx(
|
|
1621
|
+
"path",
|
|
1622
|
+
{
|
|
1623
|
+
fill: "#34A853",
|
|
1624
|
+
d: "M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"
|
|
1625
|
+
}
|
|
1626
|
+
),
|
|
1627
|
+
/* @__PURE__ */ jsx("path", { fill: "none", d: "M0 0h48v48H0z" })
|
|
1628
|
+
] }) }),
|
|
1538
1629
|
/* @__PURE__ */ jsx("span", { className: "gsi-material-button-contents", children: "Google" }),
|
|
1539
1630
|
/* @__PURE__ */ jsx("span", { style: { display: "none" }, children: "Google" })
|
|
1540
1631
|
] })
|
|
@@ -1581,6 +1672,8 @@ var AUTH_STATE_MESSAGES = {
|
|
|
1581
1672
|
connecting_wallet: "Connecting wallet\u2026",
|
|
1582
1673
|
wallet_not_installed: "Wallet not installed",
|
|
1583
1674
|
authenticating_wallet: "Signing in with wallet\u2026",
|
|
1675
|
+
creating_passkey: "Waiting for passkey\u2026",
|
|
1676
|
+
deploying_smart_account: "Creating your wallet\u2026",
|
|
1584
1677
|
authenticating: "Authenticating\u2026",
|
|
1585
1678
|
authenticated: "Welcome!",
|
|
1586
1679
|
error: ""
|
|
@@ -1593,6 +1686,8 @@ function authStateToStatus(step) {
|
|
|
1593
1686
|
"opening_oauth",
|
|
1594
1687
|
"connecting_wallet",
|
|
1595
1688
|
"authenticating_wallet",
|
|
1689
|
+
"creating_passkey",
|
|
1690
|
+
"deploying_smart_account",
|
|
1596
1691
|
"authenticating"
|
|
1597
1692
|
];
|
|
1598
1693
|
const success = ["authenticated", "entering_code"];
|
|
@@ -1608,6 +1703,7 @@ function LoginModalTemplate({
|
|
|
1608
1703
|
logoUrl,
|
|
1609
1704
|
emailEnabled,
|
|
1610
1705
|
embeddedWallets,
|
|
1706
|
+
smartWallet = false,
|
|
1611
1707
|
providers,
|
|
1612
1708
|
appName,
|
|
1613
1709
|
email = "",
|
|
@@ -1615,6 +1711,7 @@ function LoginModalTemplate({
|
|
|
1615
1711
|
onEmailSubmit,
|
|
1616
1712
|
onSocialLogin,
|
|
1617
1713
|
onWalletConnect,
|
|
1714
|
+
onSmartWallet,
|
|
1618
1715
|
renderWallets,
|
|
1619
1716
|
authState,
|
|
1620
1717
|
codeInputKey,
|
|
@@ -1728,32 +1825,60 @@ function LoginModalTemplate({
|
|
|
1728
1825
|
enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
|
|
1729
1826
|
enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
|
|
1730
1827
|
] }),
|
|
1731
|
-
embeddedWallets && /* @__PURE__ */
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1828
|
+
(embeddedWallets || smartWallet) && /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
|
|
1829
|
+
embeddedWallets && /* @__PURE__ */ jsxs(
|
|
1830
|
+
"button",
|
|
1831
|
+
{
|
|
1832
|
+
type: "button",
|
|
1833
|
+
disabled: isLoading,
|
|
1834
|
+
className: "pollar-wallet-entry-btn",
|
|
1835
|
+
onClick: () => setShowWalletPicker(true),
|
|
1836
|
+
children: [
|
|
1837
|
+
/* @__PURE__ */ jsx(
|
|
1838
|
+
"svg",
|
|
1839
|
+
{
|
|
1840
|
+
width: "18",
|
|
1841
|
+
height: "20",
|
|
1842
|
+
viewBox: "0 0 24 24",
|
|
1843
|
+
fill: "none",
|
|
1844
|
+
stroke: "currentColor",
|
|
1845
|
+
strokeWidth: "2",
|
|
1846
|
+
strokeLinecap: "round",
|
|
1847
|
+
strokeLinejoin: "round",
|
|
1848
|
+
children: /* @__PURE__ */ jsx("path", { d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" })
|
|
1849
|
+
}
|
|
1850
|
+
),
|
|
1851
|
+
"Wallet"
|
|
1852
|
+
]
|
|
1853
|
+
}
|
|
1854
|
+
),
|
|
1855
|
+
smartWallet && /* @__PURE__ */ jsxs(
|
|
1856
|
+
"button",
|
|
1857
|
+
{
|
|
1858
|
+
type: "button",
|
|
1859
|
+
disabled: isLoading,
|
|
1860
|
+
className: "pollar-wallet-entry-btn",
|
|
1861
|
+
onClick: onSmartWallet,
|
|
1862
|
+
children: [
|
|
1863
|
+
/* @__PURE__ */ jsx(
|
|
1864
|
+
"svg",
|
|
1865
|
+
{
|
|
1866
|
+
width: "18",
|
|
1867
|
+
height: "20",
|
|
1868
|
+
viewBox: "0 0 24 24",
|
|
1869
|
+
fill: "none",
|
|
1870
|
+
stroke: "currentColor",
|
|
1871
|
+
strokeWidth: "2",
|
|
1872
|
+
strokeLinecap: "round",
|
|
1873
|
+
strokeLinejoin: "round",
|
|
1874
|
+
children: /* @__PURE__ */ jsx("path", { d: "M16 8V6a4 4 0 00-8 0v2M5 8h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V9a1 1 0 011-1zm7 5v2" })
|
|
1875
|
+
}
|
|
1876
|
+
),
|
|
1877
|
+
"Smart Wallet"
|
|
1878
|
+
]
|
|
1879
|
+
}
|
|
1880
|
+
)
|
|
1881
|
+
] })
|
|
1757
1882
|
] }),
|
|
1758
1883
|
/* @__PURE__ */ jsx(
|
|
1759
1884
|
ModalStatusBanner,
|
|
@@ -1802,6 +1927,7 @@ function LoginModal({ onClose }) {
|
|
|
1802
1927
|
};
|
|
1803
1928
|
}, [getClient]);
|
|
1804
1929
|
const { theme = "light", accentColor = "#005DB4", logoUrl, emailEnabled, embeddedWallets, providers } = styles;
|
|
1930
|
+
const smartWallet = styles.smartWallet ?? true;
|
|
1805
1931
|
function handleClose() {
|
|
1806
1932
|
setEmail("");
|
|
1807
1933
|
getClient().cancelLogin();
|
|
@@ -1818,6 +1944,9 @@ function LoginModal({ onClose }) {
|
|
|
1818
1944
|
function handleWalletConnect(type) {
|
|
1819
1945
|
getClient().loginWallet(type);
|
|
1820
1946
|
}
|
|
1947
|
+
function handleSmartWallet() {
|
|
1948
|
+
getClient().loginSmartWallet();
|
|
1949
|
+
}
|
|
1821
1950
|
function handleVerifyCode(code) {
|
|
1822
1951
|
getClient().verifyEmailCode(code);
|
|
1823
1952
|
}
|
|
@@ -1839,6 +1968,7 @@ function LoginModal({ onClose }) {
|
|
|
1839
1968
|
logoUrl: logoUrl ?? null,
|
|
1840
1969
|
emailEnabled: !!emailEnabled,
|
|
1841
1970
|
embeddedWallets: !!embeddedWallets,
|
|
1971
|
+
smartWallet,
|
|
1842
1972
|
providers: {
|
|
1843
1973
|
google: !!providers?.google,
|
|
1844
1974
|
discord: !!providers?.discord,
|
|
@@ -1852,6 +1982,7 @@ function LoginModal({ onClose }) {
|
|
|
1852
1982
|
onEmailSubmit: handleEmailSubmit,
|
|
1853
1983
|
onSocialLogin: handleSocialLogin,
|
|
1854
1984
|
onWalletConnect: handleWalletConnect,
|
|
1985
|
+
onSmartWallet: handleSmartWallet,
|
|
1855
1986
|
...renderWallets !== void 0 && { renderWallets },
|
|
1856
1987
|
authState,
|
|
1857
1988
|
codeInputKey,
|
|
@@ -3078,18 +3209,16 @@ function SessionsModalTemplate({
|
|
|
3078
3209
|
);
|
|
3079
3210
|
}
|
|
3080
3211
|
function SessionsModal({ onClose }) {
|
|
3081
|
-
const { getClient, styles } = usePollar();
|
|
3212
|
+
const { getClient, styles, sessions } = usePollar();
|
|
3082
3213
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3083
|
-
const [state, setState] = useState({ step: "idle" });
|
|
3084
3214
|
const [revokingFamilyId, setRevokingFamilyId] = useState(null);
|
|
3085
3215
|
const [signingOutEverywhere, setSigningOutEverywhere] = useState(false);
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
);
|
|
3216
|
+
const load = useCallback(() => {
|
|
3217
|
+
void getClient().fetchSessions();
|
|
3218
|
+
}, [getClient]);
|
|
3219
|
+
useEffect(() => {
|
|
3220
|
+
load();
|
|
3221
|
+
}, [load]);
|
|
3093
3222
|
const onCloseRef = useRef(onClose);
|
|
3094
3223
|
onCloseRef.current = onClose;
|
|
3095
3224
|
useEffect(() => {
|
|
@@ -3097,33 +3226,15 @@ function SessionsModal({ onClose }) {
|
|
|
3097
3226
|
if (authState.step === "idle") onCloseRef.current();
|
|
3098
3227
|
});
|
|
3099
3228
|
}, [getClient]);
|
|
3100
|
-
const load = useCallback(async () => {
|
|
3101
|
-
setState({ step: "loading" });
|
|
3102
|
-
try {
|
|
3103
|
-
const sessions = await getClient().listSessions();
|
|
3104
|
-
if (!mountedRef.current) return;
|
|
3105
|
-
setState({ step: "loaded", sessions });
|
|
3106
|
-
} catch (err) {
|
|
3107
|
-
if (!mountedRef.current) return;
|
|
3108
|
-
const message = err instanceof Error ? err.message : "Failed to load sessions";
|
|
3109
|
-
setState({ step: "error", message });
|
|
3110
|
-
}
|
|
3111
|
-
}, [getClient]);
|
|
3112
|
-
useEffect(() => {
|
|
3113
|
-
void load();
|
|
3114
|
-
}, [load]);
|
|
3115
3229
|
const handleRevoke = useCallback(
|
|
3116
3230
|
async (familyId) => {
|
|
3117
3231
|
setRevokingFamilyId(familyId);
|
|
3118
3232
|
try {
|
|
3119
3233
|
await getClient().revokeSession(familyId);
|
|
3120
|
-
if (!mountedRef.current) return;
|
|
3121
|
-
await load();
|
|
3122
3234
|
} catch {
|
|
3123
|
-
if (!mountedRef.current) return;
|
|
3124
|
-
setState((prev) => prev.step === "loaded" ? { step: "error", message: "Failed to revoke session" } : prev);
|
|
3125
3235
|
} finally {
|
|
3126
|
-
|
|
3236
|
+
setRevokingFamilyId(null);
|
|
3237
|
+
load();
|
|
3127
3238
|
}
|
|
3128
3239
|
},
|
|
3129
3240
|
[getClient, load]
|
|
@@ -3134,7 +3245,6 @@ function SessionsModal({ onClose }) {
|
|
|
3134
3245
|
await getClient().logoutEverywhere();
|
|
3135
3246
|
onClose();
|
|
3136
3247
|
} catch {
|
|
3137
|
-
if (!mountedRef.current) return;
|
|
3138
3248
|
setSigningOutEverywhere(false);
|
|
3139
3249
|
}
|
|
3140
3250
|
}, [getClient, onClose]);
|
|
@@ -3143,10 +3253,10 @@ function SessionsModal({ onClose }) {
|
|
|
3143
3253
|
{
|
|
3144
3254
|
theme,
|
|
3145
3255
|
accentColor,
|
|
3146
|
-
state,
|
|
3256
|
+
state: sessions,
|
|
3147
3257
|
revokingFamilyId,
|
|
3148
3258
|
signingOutEverywhere,
|
|
3149
|
-
onRefresh: () =>
|
|
3259
|
+
onRefresh: () => load(),
|
|
3150
3260
|
onRevoke: (familyId) => void handleRevoke(familyId),
|
|
3151
3261
|
onLogoutEverywhere: () => void handleLogoutEverywhere(),
|
|
3152
3262
|
onClose
|
|
@@ -3459,7 +3569,7 @@ function formatBalance2(balance) {
|
|
|
3459
3569
|
const n = parseFloat(balance);
|
|
3460
3570
|
return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
|
|
3461
3571
|
}
|
|
3462
|
-
function
|
|
3572
|
+
function cropAddress2(address) {
|
|
3463
3573
|
if (address.length <= 16) return address;
|
|
3464
3574
|
return `${address.slice(0, 8)}...${address.slice(-8)}`;
|
|
3465
3575
|
}
|
|
@@ -3529,7 +3639,7 @@ function WalletBalanceModalTemplate({
|
|
|
3529
3639
|
/* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
3530
3640
|
] })
|
|
3531
3641
|
] }),
|
|
3532
|
-
walletAddress && /* @__PURE__ */ jsx("div", { className: "pollar-bal-address", children:
|
|
3642
|
+
walletAddress && /* @__PURE__ */ jsx("div", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
|
|
3533
3643
|
isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
|
|
3534
3644
|
walletBalance.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
|
|
3535
3645
|
data && !data.exists && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-empty", children: [
|
|
@@ -3560,6 +3670,60 @@ function WalletBalanceModal({ onClose }) {
|
|
|
3560
3670
|
}
|
|
3561
3671
|
) });
|
|
3562
3672
|
}
|
|
3673
|
+
function hexToBase64url(hex) {
|
|
3674
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
3675
|
+
for (let i = 0; i < bytes.length; i++) bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
3676
|
+
let bin = "";
|
|
3677
|
+
for (const b of bytes) bin += String.fromCharCode(b);
|
|
3678
|
+
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
3679
|
+
}
|
|
3680
|
+
function randomUserId() {
|
|
3681
|
+
const bytes = new Uint8Array(16);
|
|
3682
|
+
crypto.getRandomValues(bytes);
|
|
3683
|
+
let bin = "";
|
|
3684
|
+
for (const b of bytes) bin += String.fromCharCode(b);
|
|
3685
|
+
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
3686
|
+
}
|
|
3687
|
+
var browserPasskeyCeremony = async ({ challenge }) => {
|
|
3688
|
+
const rpId = window.location.hostname;
|
|
3689
|
+
try {
|
|
3690
|
+
const response2 = await startAuthentication({
|
|
3691
|
+
optionsJSON: { challenge, rpId, userVerification: "required" }
|
|
3692
|
+
});
|
|
3693
|
+
return { kind: "login", response: response2 };
|
|
3694
|
+
} catch {
|
|
3695
|
+
}
|
|
3696
|
+
const userId = randomUserId();
|
|
3697
|
+
const response = await startRegistration({
|
|
3698
|
+
optionsJSON: {
|
|
3699
|
+
challenge,
|
|
3700
|
+
rp: { id: rpId, name: rpId },
|
|
3701
|
+
user: { id: userId, name: "Smart Wallet", displayName: "Smart Wallet" },
|
|
3702
|
+
// ES256 (secp256r1) — the curve the on-chain WebAuthn verifier expects.
|
|
3703
|
+
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
|
|
3704
|
+
authenticatorSelection: { residentKey: "required", userVerification: "required" },
|
|
3705
|
+
attestation: "none",
|
|
3706
|
+
timeout: 6e4
|
|
3707
|
+
}
|
|
3708
|
+
});
|
|
3709
|
+
return { kind: "register", response };
|
|
3710
|
+
};
|
|
3711
|
+
var browserPasskeySigner = async ({ credentialId, challenge }) => {
|
|
3712
|
+
const rpId = window.location.hostname;
|
|
3713
|
+
const { response } = await startAuthentication({
|
|
3714
|
+
optionsJSON: {
|
|
3715
|
+
challenge: hexToBase64url(challenge),
|
|
3716
|
+
rpId,
|
|
3717
|
+
allowCredentials: [{ id: credentialId, type: "public-key" }],
|
|
3718
|
+
userVerification: "required"
|
|
3719
|
+
}
|
|
3720
|
+
});
|
|
3721
|
+
return {
|
|
3722
|
+
authenticatorData: response.authenticatorData,
|
|
3723
|
+
clientDataJSON: response.clientDataJSON,
|
|
3724
|
+
signature: response.signature
|
|
3725
|
+
};
|
|
3726
|
+
};
|
|
3563
3727
|
var DEFAULT_APP_CONFIG = {
|
|
3564
3728
|
application: { name: "" },
|
|
3565
3729
|
styles: {}
|
|
@@ -3567,7 +3731,7 @@ var DEFAULT_APP_CONFIG = {
|
|
|
3567
3731
|
function sessionsEqual(a, b) {
|
|
3568
3732
|
if (a === b) return true;
|
|
3569
3733
|
if (!a || !b) return false;
|
|
3570
|
-
return a.clientSessionId === b.clientSessionId && a.userId === b.userId && a.status === b.status && a.token?.accessToken === b.token?.accessToken && a.token?.refreshToken === b.token?.refreshToken && a.token?.expiresAt === b.token?.expiresAt && a.wallet?.
|
|
3734
|
+
return a.clientSessionId === b.clientSessionId && a.userId === b.userId && a.status === b.status && a.token?.accessToken === b.token?.accessToken && a.token?.refreshToken === b.token?.refreshToken && a.token?.expiresAt === b.token?.expiresAt && a.wallet?.address === b.wallet?.address;
|
|
3571
3735
|
}
|
|
3572
3736
|
var PollarContext = createContext(null);
|
|
3573
3737
|
function PollarProvider({
|
|
@@ -3578,12 +3742,17 @@ function PollarProvider({
|
|
|
3578
3742
|
onStorageDegrade,
|
|
3579
3743
|
children
|
|
3580
3744
|
}) {
|
|
3581
|
-
const [pollarClient] = useState(
|
|
3745
|
+
const [pollarClient] = useState(
|
|
3746
|
+
() => client instanceof PollarClient ? client : new PollarClient({ passkey: browserPasskeyCeremony, passkeySign: browserPasskeySigner, ...client })
|
|
3747
|
+
);
|
|
3582
3748
|
const [networkState, setNetworkState] = useState(() => pollarClient.getNetworkState());
|
|
3583
3749
|
const [sessionState, setSessionState] = useState(null);
|
|
3750
|
+
const [verified, setVerified] = useState(false);
|
|
3584
3751
|
const [transaction, setTransaction] = useState({ step: "idle" });
|
|
3585
3752
|
const [txHistory, setTxHistory] = useState({ step: "idle" });
|
|
3753
|
+
const [sessions, setSessions] = useState({ step: "idle" });
|
|
3586
3754
|
const [walletBalance, setWalletBalance] = useState({ step: "idle" });
|
|
3755
|
+
const [enabledAssets, setEnabledAssets] = useState({ step: "idle" });
|
|
3587
3756
|
const [resolvedConfig, setResolvedConfig] = useState(() => appConfigProp ?? DEFAULT_APP_CONFIG);
|
|
3588
3757
|
useEffect(() => {
|
|
3589
3758
|
return pollarClient.onTransactionStateChange(setTransaction);
|
|
@@ -3591,9 +3760,15 @@ function PollarProvider({
|
|
|
3591
3760
|
useEffect(() => {
|
|
3592
3761
|
return pollarClient.onTxHistoryStateChange(setTxHistory);
|
|
3593
3762
|
}, [pollarClient]);
|
|
3763
|
+
useEffect(() => {
|
|
3764
|
+
return pollarClient.onSessionsStateChange(setSessions);
|
|
3765
|
+
}, [pollarClient]);
|
|
3594
3766
|
useEffect(() => {
|
|
3595
3767
|
return pollarClient.onWalletBalanceStateChange(setWalletBalance);
|
|
3596
3768
|
}, [pollarClient]);
|
|
3769
|
+
useEffect(() => {
|
|
3770
|
+
return pollarClient.onEnabledAssetsStateChange(setEnabledAssets);
|
|
3771
|
+
}, [pollarClient]);
|
|
3597
3772
|
useEffect(() => {
|
|
3598
3773
|
return pollarClient.onNetworkStateChange((state) => {
|
|
3599
3774
|
setNetworkState(state);
|
|
@@ -3607,11 +3782,16 @@ function PollarProvider({
|
|
|
3607
3782
|
return pollarClient.onAuthStateChange((authState) => {
|
|
3608
3783
|
if (authState.step === "authenticated") {
|
|
3609
3784
|
setSessionState((prev) => sessionsEqual(prev, authState.session) ? prev : authState.session);
|
|
3785
|
+
setVerified(authState.verified);
|
|
3610
3786
|
} else if (authState.step === "idle") {
|
|
3611
3787
|
setSessionState(null);
|
|
3788
|
+
setVerified(false);
|
|
3612
3789
|
}
|
|
3613
3790
|
});
|
|
3614
3791
|
}, [pollarClient]);
|
|
3792
|
+
useEffect(() => {
|
|
3793
|
+
setModalErrorLogger(pollarClient.getLogger());
|
|
3794
|
+
}, [pollarClient]);
|
|
3615
3795
|
useEffect(() => {
|
|
3616
3796
|
if (appConfigProp !== void 0) return;
|
|
3617
3797
|
let cancelled = false;
|
|
@@ -3619,7 +3799,7 @@ function PollarProvider({
|
|
|
3619
3799
|
if (cancelled || !fetched) return;
|
|
3620
3800
|
setResolvedConfig(fetched);
|
|
3621
3801
|
}).catch((err) => {
|
|
3622
|
-
|
|
3802
|
+
pollarClient.getLogger().error("[PollarProvider] getAppConfig failed", err);
|
|
3623
3803
|
});
|
|
3624
3804
|
return () => {
|
|
3625
3805
|
cancelled = true;
|
|
@@ -3632,13 +3812,15 @@ function PollarProvider({
|
|
|
3632
3812
|
const [rampModalOpen, setRampModalOpen] = useState(false);
|
|
3633
3813
|
const [txHistoryModalOpen, setTxHistoryModalOpen] = useState(false);
|
|
3634
3814
|
const [walletBalanceModalOpen, setWalletBalanceModalOpen] = useState(false);
|
|
3815
|
+
const [enabledAssetsModalOpen, setEnabledAssetsModalOpen] = useState(false);
|
|
3635
3816
|
const [sendModalOpen, setSendModalOpen] = useState(false);
|
|
3636
3817
|
const [receiveModalOpen, setReceiveModalOpen] = useState(false);
|
|
3637
3818
|
const [sessionsModalOpen, setSessionsModalOpen] = useState(false);
|
|
3638
3819
|
const [distributionRulesModalOpen, setDistributionRulesModalOpen] = useState(false);
|
|
3639
|
-
const walletAddress = sessionState?.wallet?.
|
|
3820
|
+
const walletAddress = sessionState?.wallet?.address || "";
|
|
3640
3821
|
const getClient = useCallback(() => pollarClient, [pollarClient]);
|
|
3641
|
-
const refreshWalletBalance = useCallback(() => pollarClient.refreshBalance(
|
|
3822
|
+
const refreshWalletBalance = useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
|
|
3823
|
+
const refreshAssets = useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
|
|
3642
3824
|
const renderWallets = ui?.renderWallets;
|
|
3643
3825
|
const contextValue = useMemo(() => {
|
|
3644
3826
|
const styles = resolvedConfig.styles ?? {};
|
|
@@ -3646,6 +3828,7 @@ function PollarProvider({
|
|
|
3646
3828
|
// session
|
|
3647
3829
|
walletAddress,
|
|
3648
3830
|
isAuthenticated: !!walletAddress,
|
|
3831
|
+
verified,
|
|
3649
3832
|
walletType: pollarClient.getWalletType(),
|
|
3650
3833
|
// client
|
|
3651
3834
|
getClient,
|
|
@@ -3669,10 +3852,15 @@ function PollarProvider({
|
|
|
3669
3852
|
walletBalance,
|
|
3670
3853
|
refreshWalletBalance,
|
|
3671
3854
|
openWalletBalanceModal: () => setWalletBalanceModalOpen(true),
|
|
3855
|
+
// enabled assets
|
|
3856
|
+
enabledAssets,
|
|
3857
|
+
refreshAssets,
|
|
3858
|
+
openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
|
|
3672
3859
|
// send / receive
|
|
3673
3860
|
openSendModal: () => setSendModalOpen(true),
|
|
3674
3861
|
openReceiveModal: () => setReceiveModalOpen(true),
|
|
3675
3862
|
// sessions
|
|
3863
|
+
sessions,
|
|
3676
3864
|
openSessionsModal: () => setSessionsModalOpen(true),
|
|
3677
3865
|
// distribution
|
|
3678
3866
|
openDistributionRulesModal: () => setDistributionRulesModalOpen(true),
|
|
@@ -3694,12 +3882,16 @@ function PollarProvider({
|
|
|
3694
3882
|
};
|
|
3695
3883
|
}, [
|
|
3696
3884
|
walletAddress,
|
|
3885
|
+
verified,
|
|
3697
3886
|
pollarClient,
|
|
3698
3887
|
getClient,
|
|
3699
3888
|
transaction,
|
|
3700
3889
|
txHistory,
|
|
3890
|
+
sessions,
|
|
3701
3891
|
walletBalance,
|
|
3702
3892
|
refreshWalletBalance,
|
|
3893
|
+
enabledAssets,
|
|
3894
|
+
refreshAssets,
|
|
3703
3895
|
networkState,
|
|
3704
3896
|
resolvedConfig,
|
|
3705
3897
|
adapters,
|
|
@@ -3721,6 +3913,7 @@ function PollarProvider({
|
|
|
3721
3913
|
rampModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setRampModalOpen(false), children: /* @__PURE__ */ jsx(RampWidget, { onClose: () => setRampModalOpen(false) }) }),
|
|
3722
3914
|
txHistoryModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
|
|
3723
3915
|
walletBalanceModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
|
|
3916
|
+
enabledAssetsModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setEnabledAssetsModalOpen(false), children: /* @__PURE__ */ jsx(EnabledAssetsModal, { onClose: () => setEnabledAssetsModalOpen(false) }) }),
|
|
3724
3917
|
sendModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }),
|
|
3725
3918
|
receiveModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
|
|
3726
3919
|
sessionsModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
|
|
@@ -3777,6 +3970,10 @@ function WalletButtonTemplate({
|
|
|
3777
3970
|
onTxHistory,
|
|
3778
3971
|
onSend,
|
|
3779
3972
|
onReceive,
|
|
3973
|
+
onSessions,
|
|
3974
|
+
onKyc,
|
|
3975
|
+
onRamp,
|
|
3976
|
+
onDistributionRules,
|
|
3780
3977
|
onLogout,
|
|
3781
3978
|
onLogin
|
|
3782
3979
|
}) {
|
|
@@ -3936,6 +4133,94 @@ function WalletButtonTemplate({
|
|
|
3936
4133
|
"Transaction history"
|
|
3937
4134
|
] }),
|
|
3938
4135
|
/* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" }),
|
|
4136
|
+
/* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
|
|
4137
|
+
/* @__PURE__ */ jsxs(
|
|
4138
|
+
"svg",
|
|
4139
|
+
{
|
|
4140
|
+
width: "14",
|
|
4141
|
+
height: "14",
|
|
4142
|
+
viewBox: "0 0 24 24",
|
|
4143
|
+
fill: "none",
|
|
4144
|
+
stroke: "currentColor",
|
|
4145
|
+
strokeWidth: "2",
|
|
4146
|
+
strokeLinecap: "round",
|
|
4147
|
+
strokeLinejoin: "round",
|
|
4148
|
+
children: [
|
|
4149
|
+
/* @__PURE__ */ jsx("polyline", { points: "17 1 21 5 17 9" }),
|
|
4150
|
+
/* @__PURE__ */ jsx("path", { d: "M3 11V9a4 4 0 0 1 4-4h14" }),
|
|
4151
|
+
/* @__PURE__ */ jsx("polyline", { points: "7 23 3 19 7 15" }),
|
|
4152
|
+
/* @__PURE__ */ jsx("path", { d: "M21 13v2a4 4 0 0 1-4 4H3" })
|
|
4153
|
+
]
|
|
4154
|
+
}
|
|
4155
|
+
),
|
|
4156
|
+
"Buy / Sell"
|
|
4157
|
+
] }),
|
|
4158
|
+
/* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
|
|
4159
|
+
/* @__PURE__ */ jsxs(
|
|
4160
|
+
"svg",
|
|
4161
|
+
{
|
|
4162
|
+
width: "14",
|
|
4163
|
+
height: "14",
|
|
4164
|
+
viewBox: "0 0 24 24",
|
|
4165
|
+
fill: "none",
|
|
4166
|
+
stroke: "currentColor",
|
|
4167
|
+
strokeWidth: "2",
|
|
4168
|
+
strokeLinecap: "round",
|
|
4169
|
+
strokeLinejoin: "round",
|
|
4170
|
+
children: [
|
|
4171
|
+
/* @__PURE__ */ jsx("path", { d: "M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z" }),
|
|
4172
|
+
/* @__PURE__ */ jsx("path", { d: "M2 21v-1a6 6 0 0 1 6-6h2" }),
|
|
4173
|
+
/* @__PURE__ */ jsx("polyline", { points: "16 11 18 13 22 9" })
|
|
4174
|
+
]
|
|
4175
|
+
}
|
|
4176
|
+
),
|
|
4177
|
+
"Identity verification"
|
|
4178
|
+
] }),
|
|
4179
|
+
/* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
|
|
4180
|
+
/* @__PURE__ */ jsxs(
|
|
4181
|
+
"svg",
|
|
4182
|
+
{
|
|
4183
|
+
width: "14",
|
|
4184
|
+
height: "14",
|
|
4185
|
+
viewBox: "0 0 24 24",
|
|
4186
|
+
fill: "none",
|
|
4187
|
+
stroke: "currentColor",
|
|
4188
|
+
strokeWidth: "2",
|
|
4189
|
+
strokeLinecap: "round",
|
|
4190
|
+
strokeLinejoin: "round",
|
|
4191
|
+
children: [
|
|
4192
|
+
/* @__PURE__ */ jsx("circle", { cx: "18", cy: "5", r: "3" }),
|
|
4193
|
+
/* @__PURE__ */ jsx("circle", { cx: "6", cy: "12", r: "3" }),
|
|
4194
|
+
/* @__PURE__ */ jsx("circle", { cx: "18", cy: "19", r: "3" }),
|
|
4195
|
+
/* @__PURE__ */ jsx("line", { x1: "8.59", y1: "13.51", x2: "15.42", y2: "17.49" }),
|
|
4196
|
+
/* @__PURE__ */ jsx("line", { x1: "15.41", y1: "6.51", x2: "8.59", y2: "10.49" })
|
|
4197
|
+
]
|
|
4198
|
+
}
|
|
4199
|
+
),
|
|
4200
|
+
"Distribution rules"
|
|
4201
|
+
] }),
|
|
4202
|
+
/* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
|
|
4203
|
+
/* @__PURE__ */ jsxs(
|
|
4204
|
+
"svg",
|
|
4205
|
+
{
|
|
4206
|
+
width: "14",
|
|
4207
|
+
height: "14",
|
|
4208
|
+
viewBox: "0 0 24 24",
|
|
4209
|
+
fill: "none",
|
|
4210
|
+
stroke: "currentColor",
|
|
4211
|
+
strokeWidth: "2",
|
|
4212
|
+
strokeLinecap: "round",
|
|
4213
|
+
strokeLinejoin: "round",
|
|
4214
|
+
children: [
|
|
4215
|
+
/* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2", ry: "2" }),
|
|
4216
|
+
/* @__PURE__ */ jsx("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
4217
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
4218
|
+
]
|
|
4219
|
+
}
|
|
4220
|
+
),
|
|
4221
|
+
"Active sessions"
|
|
4222
|
+
] }),
|
|
4223
|
+
/* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" }),
|
|
3939
4224
|
/* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item danger", onClick: onLogout, children: [
|
|
3940
4225
|
/* @__PURE__ */ jsxs(
|
|
3941
4226
|
"svg",
|
|
@@ -3970,6 +4255,10 @@ function WalletButton() {
|
|
|
3970
4255
|
openWalletBalanceModal,
|
|
3971
4256
|
openSendModal,
|
|
3972
4257
|
openReceiveModal,
|
|
4258
|
+
openSessionsModal,
|
|
4259
|
+
openKycModal,
|
|
4260
|
+
openRampModal,
|
|
4261
|
+
openDistributionRulesModal,
|
|
3973
4262
|
tx: transaction,
|
|
3974
4263
|
walletType
|
|
3975
4264
|
} = usePollar();
|
|
@@ -4028,6 +4317,22 @@ function WalletButton() {
|
|
|
4028
4317
|
setOpen(false);
|
|
4029
4318
|
openReceiveModal();
|
|
4030
4319
|
}
|
|
4320
|
+
function handleSessions() {
|
|
4321
|
+
setOpen(false);
|
|
4322
|
+
openSessionsModal();
|
|
4323
|
+
}
|
|
4324
|
+
function handleKyc() {
|
|
4325
|
+
setOpen(false);
|
|
4326
|
+
openKycModal();
|
|
4327
|
+
}
|
|
4328
|
+
function handleRamp() {
|
|
4329
|
+
setOpen(false);
|
|
4330
|
+
openRampModal();
|
|
4331
|
+
}
|
|
4332
|
+
function handleDistributionRules() {
|
|
4333
|
+
setOpen(false);
|
|
4334
|
+
openDistributionRulesModal();
|
|
4335
|
+
}
|
|
4031
4336
|
return /* @__PURE__ */ jsx(
|
|
4032
4337
|
WalletButtonTemplate,
|
|
4033
4338
|
{
|
|
@@ -4047,12 +4352,16 @@ function WalletButton() {
|
|
|
4047
4352
|
onTxHistory: handleTxHistory,
|
|
4048
4353
|
onSend: handleSend,
|
|
4049
4354
|
onReceive: handleReceive,
|
|
4355
|
+
onSessions: handleSessions,
|
|
4356
|
+
onKyc: handleKyc,
|
|
4357
|
+
onRamp: handleRamp,
|
|
4358
|
+
onDistributionRules: handleDistributionRules,
|
|
4050
4359
|
onLogout: handleLogout,
|
|
4051
4360
|
onLogin: openLoginModal
|
|
4052
4361
|
}
|
|
4053
4362
|
);
|
|
4054
4363
|
}
|
|
4055
4364
|
|
|
4056
|
-
export { DistributionRulesModal, DistributionRulesModalTemplate, KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, RouteDisplay, SendModal, SendModalTemplate, SessionsModal, SessionsModalTemplate, TransactionModalTemplate, TxHistoryModalTemplate, TxStatusView, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, createPollarAdapterHook, usePollar };
|
|
4365
|
+
export { DistributionRulesModal, DistributionRulesModalTemplate, EnabledAssetsModal, EnabledAssetsModalTemplate, KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, RouteDisplay, SendModal, SendModalTemplate, SessionsModal, SessionsModalTemplate, TransactionModalTemplate, TxHistoryModalTemplate, TxStatusView, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, WalletButtonTemplate, createPollarAdapterHook, usePollar };
|
|
4057
4366
|
//# sourceMappingURL=index.mjs.map
|
|
4058
4367
|
//# sourceMappingURL=index.mjs.map
|