@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.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
var core = require('@pollar/core');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var browser = require('@simplewebauthn/browser');
|
|
7
8
|
|
|
8
9
|
var __create = Object.create;
|
|
9
10
|
var __defProp = Object.defineProperty;
|
|
@@ -1003,6 +1004,10 @@ var require_QRCode = __commonJS({
|
|
|
1003
1004
|
var LOGO_POLLAR = "https://pollar.xyz/assets/logo_pollar.png";
|
|
1004
1005
|
var LOGO_FREIGHTER = "https://pollar.xyz/assets/logo_freighter.png";
|
|
1005
1006
|
var LOGO_ALBEDO = "https://pollar.xyz/assets/logo_albedo.svg";
|
|
1007
|
+
var _modalLog = console;
|
|
1008
|
+
function setModalErrorLogger(logger) {
|
|
1009
|
+
_modalLog = logger;
|
|
1010
|
+
}
|
|
1006
1011
|
var ModalErrorBoundary = class extends react.Component {
|
|
1007
1012
|
constructor() {
|
|
1008
1013
|
super(...arguments);
|
|
@@ -1012,7 +1017,7 @@ var ModalErrorBoundary = class extends react.Component {
|
|
|
1012
1017
|
return { crashed: true };
|
|
1013
1018
|
}
|
|
1014
1019
|
componentDidCatch(error) {
|
|
1015
|
-
|
|
1020
|
+
_modalLog.error("[PollarProvider] Modal crashed:", error);
|
|
1016
1021
|
}
|
|
1017
1022
|
render() {
|
|
1018
1023
|
if (this.state.crashed) {
|
|
@@ -1030,7 +1035,7 @@ var PollarModalFooter = () => {
|
|
|
1030
1035
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
1031
1036
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1032
1037
|
"v",
|
|
1033
|
-
"0.
|
|
1038
|
+
"0.9.0-rc.1"
|
|
1034
1039
|
] })
|
|
1035
1040
|
] })
|
|
1036
1041
|
] });
|
|
@@ -1067,7 +1072,8 @@ var REASON_LABEL = {
|
|
|
1067
1072
|
DISTRIBUTION_RULE_NOT_STARTED: "Not started yet",
|
|
1068
1073
|
DISTRIBUTION_RULE_EXPIRED: "Expired",
|
|
1069
1074
|
DISTRIBUTION_RULE_EXHAUSTED: "Fully claimed",
|
|
1070
|
-
|
|
1075
|
+
// Per-user, per-window claim limit (resets next period) — not permanent.
|
|
1076
|
+
DISTRIBUTION_RATE_LIMIT_EXCEEDED: "Claimed for this period"
|
|
1071
1077
|
};
|
|
1072
1078
|
function reasonLabel(reason) {
|
|
1073
1079
|
if (!reason) return "Not available";
|
|
@@ -1260,6 +1266,104 @@ function DistributionRulesModal({ onClose }) {
|
|
|
1260
1266
|
}
|
|
1261
1267
|
) });
|
|
1262
1268
|
}
|
|
1269
|
+
function cropAddress(address) {
|
|
1270
|
+
if (address.length <= 16) return address;
|
|
1271
|
+
return `${address.slice(0, 8)}...${address.slice(-8)}`;
|
|
1272
|
+
}
|
|
1273
|
+
function AssetItem({ record }) {
|
|
1274
|
+
const established = record.trustlineEstablished;
|
|
1275
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-asset-item", children: [
|
|
1276
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-asset-info", children: [
|
|
1277
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-asset-code", children: record.code }),
|
|
1278
|
+
record.name && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-asset-name", children: record.name })
|
|
1279
|
+
] }),
|
|
1280
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `pollar-asset-trustline${established ? " established" : ""}`, children: established ? "Trustline active" : "Needs trustline" })
|
|
1281
|
+
] });
|
|
1282
|
+
}
|
|
1283
|
+
function EnabledAssetsModalTemplate({
|
|
1284
|
+
theme,
|
|
1285
|
+
accentColor,
|
|
1286
|
+
enabledAssets,
|
|
1287
|
+
walletAddress,
|
|
1288
|
+
onRefresh,
|
|
1289
|
+
onClose
|
|
1290
|
+
}) {
|
|
1291
|
+
const isDark = theme === "dark";
|
|
1292
|
+
const cssVars = {
|
|
1293
|
+
"--pollar-accent": accentColor,
|
|
1294
|
+
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
1295
|
+
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
1296
|
+
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
1297
|
+
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
1298
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
1299
|
+
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
1300
|
+
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
1301
|
+
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
1302
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
1303
|
+
"--pollar-buttons-border-radius": "6px",
|
|
1304
|
+
"--pollar-buttons-height": "44px",
|
|
1305
|
+
"--pollar-input-height": "44px",
|
|
1306
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
1307
|
+
"--pollar-card-border-radius": "10px"
|
|
1308
|
+
};
|
|
1309
|
+
const isLoading = enabledAssets.step === "loading";
|
|
1310
|
+
const data = enabledAssets.step === "loaded" ? enabledAssets.data : null;
|
|
1311
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-asset-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
1312
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
|
|
1313
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Enabled Assets" }),
|
|
1314
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
1315
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
|
|
1316
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1317
|
+
"svg",
|
|
1318
|
+
{
|
|
1319
|
+
className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
|
|
1320
|
+
width: "13",
|
|
1321
|
+
height: "13",
|
|
1322
|
+
viewBox: "0 0 13 13",
|
|
1323
|
+
fill: "none",
|
|
1324
|
+
"aria-hidden": true,
|
|
1325
|
+
children: [
|
|
1326
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
1327
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
),
|
|
1331
|
+
"Refresh"
|
|
1332
|
+
] }),
|
|
1333
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
1334
|
+
] })
|
|
1335
|
+
] }),
|
|
1336
|
+
walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-asset-address", children: cropAddress(walletAddress) }),
|
|
1337
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
|
|
1338
|
+
enabledAssets.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: enabledAssets.message }),
|
|
1339
|
+
data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
|
|
1340
|
+
"Account not found on ",
|
|
1341
|
+
data.network,
|
|
1342
|
+
"."
|
|
1343
|
+
] }),
|
|
1344
|
+
data && data.assets.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No assets enabled for this application." }),
|
|
1345
|
+
data && data.assets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-asset-list", children: data.assets.map((a) => /* @__PURE__ */ jsxRuntime.jsx(AssetItem, { record: a }, a.code + (a.issuer ?? ""))) }),
|
|
1346
|
+
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
1347
|
+
] });
|
|
1348
|
+
}
|
|
1349
|
+
function EnabledAssetsModal({ onClose }) {
|
|
1350
|
+
const { enabledAssets, refreshAssets, walletAddress, styles } = usePollar();
|
|
1351
|
+
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
1352
|
+
react.useEffect(() => {
|
|
1353
|
+
void refreshAssets();
|
|
1354
|
+
}, [refreshAssets]);
|
|
1355
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1356
|
+
EnabledAssetsModalTemplate,
|
|
1357
|
+
{
|
|
1358
|
+
theme,
|
|
1359
|
+
accentColor,
|
|
1360
|
+
enabledAssets,
|
|
1361
|
+
walletAddress,
|
|
1362
|
+
onRefresh: () => refreshAssets(),
|
|
1363
|
+
onClose
|
|
1364
|
+
}
|
|
1365
|
+
) });
|
|
1366
|
+
}
|
|
1263
1367
|
var STATUS_CONFIG = {
|
|
1264
1368
|
none: { label: "Not started", color: "#6b7280", dot: false },
|
|
1265
1369
|
pending: { label: "Pending review", color: "#f59e0b", dot: true },
|
|
@@ -1344,11 +1448,7 @@ function KycModalTemplate({
|
|
|
1344
1448
|
step === "verifying" && selectedProvider && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1345
1449
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-kyc-iframe-wrap", children: session?.kycUrl ? /* @__PURE__ */ jsxRuntime.jsx("iframe", { className: "pollar-kyc-iframe", src: session.kycUrl, title: "KYC verification", allow: "camera; microphone" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-iframe-mock", children: [
|
|
1346
1450
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u{1F512}" }),
|
|
1347
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedProvider.flow === "form" ? "
|
|
1348
|
-
/* @__PURE__ */ jsxRuntime.jsxs("code", { style: { fontSize: "0.7rem", opacity: 0.6 }, children: [
|
|
1349
|
-
"provider: ",
|
|
1350
|
-
selectedProvider.id
|
|
1351
|
-
] })
|
|
1451
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedProvider.flow === "form" ? "The identity verification form will appear here." : "Identity verification will open here." })
|
|
1352
1452
|
] }) }),
|
|
1353
1453
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
|
|
1354
1454
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" }),
|
|
@@ -1497,46 +1597,37 @@ var GoogleButton = ({ disabled, onClick }) => {
|
|
|
1497
1597
|
return /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "gsi-material-button", disabled, onClick, children: [
|
|
1498
1598
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gsi-material-button-state" }),
|
|
1499
1599
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gsi-material-button-content-wrapper", children: [
|
|
1500
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gsi-material-button-icon", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
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
|
-
|
|
1531
|
-
{
|
|
1532
|
-
fill: "#34A853",
|
|
1533
|
-
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"
|
|
1534
|
-
}
|
|
1535
|
-
),
|
|
1536
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", d: "M0 0h48v48H0z" })
|
|
1537
|
-
]
|
|
1538
|
-
}
|
|
1539
|
-
) }),
|
|
1600
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "gsi-material-button-icon", children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", style: { display: "block" }, children: [
|
|
1601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1602
|
+
"path",
|
|
1603
|
+
{
|
|
1604
|
+
fill: "#EA4335",
|
|
1605
|
+
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"
|
|
1606
|
+
}
|
|
1607
|
+
),
|
|
1608
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1609
|
+
"path",
|
|
1610
|
+
{
|
|
1611
|
+
fill: "#4285F4",
|
|
1612
|
+
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"
|
|
1613
|
+
}
|
|
1614
|
+
),
|
|
1615
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1616
|
+
"path",
|
|
1617
|
+
{
|
|
1618
|
+
fill: "#FBBC05",
|
|
1619
|
+
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"
|
|
1620
|
+
}
|
|
1621
|
+
),
|
|
1622
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1623
|
+
"path",
|
|
1624
|
+
{
|
|
1625
|
+
fill: "#34A853",
|
|
1626
|
+
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"
|
|
1627
|
+
}
|
|
1628
|
+
),
|
|
1629
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", d: "M0 0h48v48H0z" })
|
|
1630
|
+
] }) }),
|
|
1540
1631
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "gsi-material-button-contents", children: "Google" }),
|
|
1541
1632
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: "Google" })
|
|
1542
1633
|
] })
|
|
@@ -1583,6 +1674,8 @@ var AUTH_STATE_MESSAGES = {
|
|
|
1583
1674
|
connecting_wallet: "Connecting wallet\u2026",
|
|
1584
1675
|
wallet_not_installed: "Wallet not installed",
|
|
1585
1676
|
authenticating_wallet: "Signing in with wallet\u2026",
|
|
1677
|
+
creating_passkey: "Waiting for passkey\u2026",
|
|
1678
|
+
deploying_smart_account: "Creating your wallet\u2026",
|
|
1586
1679
|
authenticating: "Authenticating\u2026",
|
|
1587
1680
|
authenticated: "Welcome!",
|
|
1588
1681
|
error: ""
|
|
@@ -1595,6 +1688,8 @@ function authStateToStatus(step) {
|
|
|
1595
1688
|
"opening_oauth",
|
|
1596
1689
|
"connecting_wallet",
|
|
1597
1690
|
"authenticating_wallet",
|
|
1691
|
+
"creating_passkey",
|
|
1692
|
+
"deploying_smart_account",
|
|
1598
1693
|
"authenticating"
|
|
1599
1694
|
];
|
|
1600
1695
|
const success = ["authenticated", "entering_code"];
|
|
@@ -1610,6 +1705,7 @@ function LoginModalTemplate({
|
|
|
1610
1705
|
logoUrl,
|
|
1611
1706
|
emailEnabled,
|
|
1612
1707
|
embeddedWallets,
|
|
1708
|
+
smartWallet = false,
|
|
1613
1709
|
providers,
|
|
1614
1710
|
appName,
|
|
1615
1711
|
email = "",
|
|
@@ -1617,6 +1713,7 @@ function LoginModalTemplate({
|
|
|
1617
1713
|
onEmailSubmit,
|
|
1618
1714
|
onSocialLogin,
|
|
1619
1715
|
onWalletConnect,
|
|
1716
|
+
onSmartWallet,
|
|
1620
1717
|
renderWallets,
|
|
1621
1718
|
authState,
|
|
1622
1719
|
codeInputKey,
|
|
@@ -1730,32 +1827,60 @@ function LoginModalTemplate({
|
|
|
1730
1827
|
enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
|
|
1731
1828
|
enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
|
|
1732
1829
|
] }),
|
|
1733
|
-
embeddedWallets && /* @__PURE__ */ jsxRuntime.
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1830
|
+
(embeddedWallets || smartWallet) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
1831
|
+
embeddedWallets && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1832
|
+
"button",
|
|
1833
|
+
{
|
|
1834
|
+
type: "button",
|
|
1835
|
+
disabled: isLoading,
|
|
1836
|
+
className: "pollar-wallet-entry-btn",
|
|
1837
|
+
onClick: () => setShowWalletPicker(true),
|
|
1838
|
+
children: [
|
|
1839
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1840
|
+
"svg",
|
|
1841
|
+
{
|
|
1842
|
+
width: "18",
|
|
1843
|
+
height: "20",
|
|
1844
|
+
viewBox: "0 0 24 24",
|
|
1845
|
+
fill: "none",
|
|
1846
|
+
stroke: "currentColor",
|
|
1847
|
+
strokeWidth: "2",
|
|
1848
|
+
strokeLinecap: "round",
|
|
1849
|
+
strokeLinejoin: "round",
|
|
1850
|
+
children: /* @__PURE__ */ jsxRuntime.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" })
|
|
1851
|
+
}
|
|
1852
|
+
),
|
|
1853
|
+
"Wallet"
|
|
1854
|
+
]
|
|
1855
|
+
}
|
|
1856
|
+
),
|
|
1857
|
+
smartWallet && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1858
|
+
"button",
|
|
1859
|
+
{
|
|
1860
|
+
type: "button",
|
|
1861
|
+
disabled: isLoading,
|
|
1862
|
+
className: "pollar-wallet-entry-btn",
|
|
1863
|
+
onClick: onSmartWallet,
|
|
1864
|
+
children: [
|
|
1865
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1866
|
+
"svg",
|
|
1867
|
+
{
|
|
1868
|
+
width: "18",
|
|
1869
|
+
height: "20",
|
|
1870
|
+
viewBox: "0 0 24 24",
|
|
1871
|
+
fill: "none",
|
|
1872
|
+
stroke: "currentColor",
|
|
1873
|
+
strokeWidth: "2",
|
|
1874
|
+
strokeLinecap: "round",
|
|
1875
|
+
strokeLinejoin: "round",
|
|
1876
|
+
children: /* @__PURE__ */ jsxRuntime.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" })
|
|
1877
|
+
}
|
|
1878
|
+
),
|
|
1879
|
+
"Smart Wallet"
|
|
1880
|
+
]
|
|
1881
|
+
}
|
|
1882
|
+
)
|
|
1883
|
+
] })
|
|
1759
1884
|
] }),
|
|
1760
1885
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1761
1886
|
ModalStatusBanner,
|
|
@@ -1804,6 +1929,7 @@ function LoginModal({ onClose }) {
|
|
|
1804
1929
|
};
|
|
1805
1930
|
}, [getClient]);
|
|
1806
1931
|
const { theme = "light", accentColor = "#005DB4", logoUrl, emailEnabled, embeddedWallets, providers } = styles;
|
|
1932
|
+
const smartWallet = styles.smartWallet ?? true;
|
|
1807
1933
|
function handleClose() {
|
|
1808
1934
|
setEmail("");
|
|
1809
1935
|
getClient().cancelLogin();
|
|
@@ -1820,6 +1946,9 @@ function LoginModal({ onClose }) {
|
|
|
1820
1946
|
function handleWalletConnect(type) {
|
|
1821
1947
|
getClient().loginWallet(type);
|
|
1822
1948
|
}
|
|
1949
|
+
function handleSmartWallet() {
|
|
1950
|
+
getClient().loginSmartWallet();
|
|
1951
|
+
}
|
|
1823
1952
|
function handleVerifyCode(code) {
|
|
1824
1953
|
getClient().verifyEmailCode(code);
|
|
1825
1954
|
}
|
|
@@ -1841,6 +1970,7 @@ function LoginModal({ onClose }) {
|
|
|
1841
1970
|
logoUrl: logoUrl ?? null,
|
|
1842
1971
|
emailEnabled: !!emailEnabled,
|
|
1843
1972
|
embeddedWallets: !!embeddedWallets,
|
|
1973
|
+
smartWallet,
|
|
1844
1974
|
providers: {
|
|
1845
1975
|
google: !!providers?.google,
|
|
1846
1976
|
discord: !!providers?.discord,
|
|
@@ -1854,6 +1984,7 @@ function LoginModal({ onClose }) {
|
|
|
1854
1984
|
onEmailSubmit: handleEmailSubmit,
|
|
1855
1985
|
onSocialLogin: handleSocialLogin,
|
|
1856
1986
|
onWalletConnect: handleWalletConnect,
|
|
1987
|
+
onSmartWallet: handleSmartWallet,
|
|
1857
1988
|
...renderWallets !== void 0 && { renderWallets },
|
|
1858
1989
|
authState,
|
|
1859
1990
|
codeInputKey,
|
|
@@ -3080,18 +3211,16 @@ function SessionsModalTemplate({
|
|
|
3080
3211
|
);
|
|
3081
3212
|
}
|
|
3082
3213
|
function SessionsModal({ onClose }) {
|
|
3083
|
-
const { getClient, styles } = usePollar();
|
|
3214
|
+
const { getClient, styles, sessions } = usePollar();
|
|
3084
3215
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3085
|
-
const [state, setState] = react.useState({ step: "idle" });
|
|
3086
3216
|
const [revokingFamilyId, setRevokingFamilyId] = react.useState(null);
|
|
3087
3217
|
const [signingOutEverywhere, setSigningOutEverywhere] = react.useState(false);
|
|
3088
|
-
const
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
);
|
|
3218
|
+
const load = react.useCallback(() => {
|
|
3219
|
+
void getClient().fetchSessions();
|
|
3220
|
+
}, [getClient]);
|
|
3221
|
+
react.useEffect(() => {
|
|
3222
|
+
load();
|
|
3223
|
+
}, [load]);
|
|
3095
3224
|
const onCloseRef = react.useRef(onClose);
|
|
3096
3225
|
onCloseRef.current = onClose;
|
|
3097
3226
|
react.useEffect(() => {
|
|
@@ -3099,33 +3228,15 @@ function SessionsModal({ onClose }) {
|
|
|
3099
3228
|
if (authState.step === "idle") onCloseRef.current();
|
|
3100
3229
|
});
|
|
3101
3230
|
}, [getClient]);
|
|
3102
|
-
const load = react.useCallback(async () => {
|
|
3103
|
-
setState({ step: "loading" });
|
|
3104
|
-
try {
|
|
3105
|
-
const sessions = await getClient().listSessions();
|
|
3106
|
-
if (!mountedRef.current) return;
|
|
3107
|
-
setState({ step: "loaded", sessions });
|
|
3108
|
-
} catch (err) {
|
|
3109
|
-
if (!mountedRef.current) return;
|
|
3110
|
-
const message = err instanceof Error ? err.message : "Failed to load sessions";
|
|
3111
|
-
setState({ step: "error", message });
|
|
3112
|
-
}
|
|
3113
|
-
}, [getClient]);
|
|
3114
|
-
react.useEffect(() => {
|
|
3115
|
-
void load();
|
|
3116
|
-
}, [load]);
|
|
3117
3231
|
const handleRevoke = react.useCallback(
|
|
3118
3232
|
async (familyId) => {
|
|
3119
3233
|
setRevokingFamilyId(familyId);
|
|
3120
3234
|
try {
|
|
3121
3235
|
await getClient().revokeSession(familyId);
|
|
3122
|
-
if (!mountedRef.current) return;
|
|
3123
|
-
await load();
|
|
3124
3236
|
} catch {
|
|
3125
|
-
if (!mountedRef.current) return;
|
|
3126
|
-
setState((prev) => prev.step === "loaded" ? { step: "error", message: "Failed to revoke session" } : prev);
|
|
3127
3237
|
} finally {
|
|
3128
|
-
|
|
3238
|
+
setRevokingFamilyId(null);
|
|
3239
|
+
load();
|
|
3129
3240
|
}
|
|
3130
3241
|
},
|
|
3131
3242
|
[getClient, load]
|
|
@@ -3136,7 +3247,6 @@ function SessionsModal({ onClose }) {
|
|
|
3136
3247
|
await getClient().logoutEverywhere();
|
|
3137
3248
|
onClose();
|
|
3138
3249
|
} catch {
|
|
3139
|
-
if (!mountedRef.current) return;
|
|
3140
3250
|
setSigningOutEverywhere(false);
|
|
3141
3251
|
}
|
|
3142
3252
|
}, [getClient, onClose]);
|
|
@@ -3145,10 +3255,10 @@ function SessionsModal({ onClose }) {
|
|
|
3145
3255
|
{
|
|
3146
3256
|
theme,
|
|
3147
3257
|
accentColor,
|
|
3148
|
-
state,
|
|
3258
|
+
state: sessions,
|
|
3149
3259
|
revokingFamilyId,
|
|
3150
3260
|
signingOutEverywhere,
|
|
3151
|
-
onRefresh: () =>
|
|
3261
|
+
onRefresh: () => load(),
|
|
3152
3262
|
onRevoke: (familyId) => void handleRevoke(familyId),
|
|
3153
3263
|
onLogoutEverywhere: () => void handleLogoutEverywhere(),
|
|
3154
3264
|
onClose
|
|
@@ -3461,7 +3571,7 @@ function formatBalance2(balance) {
|
|
|
3461
3571
|
const n = parseFloat(balance);
|
|
3462
3572
|
return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
|
|
3463
3573
|
}
|
|
3464
|
-
function
|
|
3574
|
+
function cropAddress2(address) {
|
|
3465
3575
|
if (address.length <= 16) return address;
|
|
3466
3576
|
return `${address.slice(0, 8)}...${address.slice(-8)}`;
|
|
3467
3577
|
}
|
|
@@ -3531,7 +3641,7 @@ function WalletBalanceModalTemplate({
|
|
|
3531
3641
|
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
3532
3642
|
] })
|
|
3533
3643
|
] }),
|
|
3534
|
-
walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-address", children:
|
|
3644
|
+
walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
|
|
3535
3645
|
isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
|
|
3536
3646
|
walletBalance.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
|
|
3537
3647
|
data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
|
|
@@ -3562,6 +3672,60 @@ function WalletBalanceModal({ onClose }) {
|
|
|
3562
3672
|
}
|
|
3563
3673
|
) });
|
|
3564
3674
|
}
|
|
3675
|
+
function hexToBase64url(hex) {
|
|
3676
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
3677
|
+
for (let i = 0; i < bytes.length; i++) bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
3678
|
+
let bin = "";
|
|
3679
|
+
for (const b of bytes) bin += String.fromCharCode(b);
|
|
3680
|
+
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
3681
|
+
}
|
|
3682
|
+
function randomUserId() {
|
|
3683
|
+
const bytes = new Uint8Array(16);
|
|
3684
|
+
crypto.getRandomValues(bytes);
|
|
3685
|
+
let bin = "";
|
|
3686
|
+
for (const b of bytes) bin += String.fromCharCode(b);
|
|
3687
|
+
return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
3688
|
+
}
|
|
3689
|
+
var browserPasskeyCeremony = async ({ challenge }) => {
|
|
3690
|
+
const rpId = window.location.hostname;
|
|
3691
|
+
try {
|
|
3692
|
+
const response2 = await browser.startAuthentication({
|
|
3693
|
+
optionsJSON: { challenge, rpId, userVerification: "required" }
|
|
3694
|
+
});
|
|
3695
|
+
return { kind: "login", response: response2 };
|
|
3696
|
+
} catch {
|
|
3697
|
+
}
|
|
3698
|
+
const userId = randomUserId();
|
|
3699
|
+
const response = await browser.startRegistration({
|
|
3700
|
+
optionsJSON: {
|
|
3701
|
+
challenge,
|
|
3702
|
+
rp: { id: rpId, name: rpId },
|
|
3703
|
+
user: { id: userId, name: "Smart Wallet", displayName: "Smart Wallet" },
|
|
3704
|
+
// ES256 (secp256r1) — the curve the on-chain WebAuthn verifier expects.
|
|
3705
|
+
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
|
|
3706
|
+
authenticatorSelection: { residentKey: "required", userVerification: "required" },
|
|
3707
|
+
attestation: "none",
|
|
3708
|
+
timeout: 6e4
|
|
3709
|
+
}
|
|
3710
|
+
});
|
|
3711
|
+
return { kind: "register", response };
|
|
3712
|
+
};
|
|
3713
|
+
var browserPasskeySigner = async ({ credentialId, challenge }) => {
|
|
3714
|
+
const rpId = window.location.hostname;
|
|
3715
|
+
const { response } = await browser.startAuthentication({
|
|
3716
|
+
optionsJSON: {
|
|
3717
|
+
challenge: hexToBase64url(challenge),
|
|
3718
|
+
rpId,
|
|
3719
|
+
allowCredentials: [{ id: credentialId, type: "public-key" }],
|
|
3720
|
+
userVerification: "required"
|
|
3721
|
+
}
|
|
3722
|
+
});
|
|
3723
|
+
return {
|
|
3724
|
+
authenticatorData: response.authenticatorData,
|
|
3725
|
+
clientDataJSON: response.clientDataJSON,
|
|
3726
|
+
signature: response.signature
|
|
3727
|
+
};
|
|
3728
|
+
};
|
|
3565
3729
|
var DEFAULT_APP_CONFIG = {
|
|
3566
3730
|
application: { name: "" },
|
|
3567
3731
|
styles: {}
|
|
@@ -3569,7 +3733,7 @@ var DEFAULT_APP_CONFIG = {
|
|
|
3569
3733
|
function sessionsEqual(a, b) {
|
|
3570
3734
|
if (a === b) return true;
|
|
3571
3735
|
if (!a || !b) return false;
|
|
3572
|
-
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?.
|
|
3736
|
+
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;
|
|
3573
3737
|
}
|
|
3574
3738
|
var PollarContext = react.createContext(null);
|
|
3575
3739
|
function PollarProvider({
|
|
@@ -3580,12 +3744,17 @@ function PollarProvider({
|
|
|
3580
3744
|
onStorageDegrade,
|
|
3581
3745
|
children
|
|
3582
3746
|
}) {
|
|
3583
|
-
const [pollarClient] = react.useState(
|
|
3747
|
+
const [pollarClient] = react.useState(
|
|
3748
|
+
() => client instanceof core.PollarClient ? client : new core.PollarClient({ passkey: browserPasskeyCeremony, passkeySign: browserPasskeySigner, ...client })
|
|
3749
|
+
);
|
|
3584
3750
|
const [networkState, setNetworkState] = react.useState(() => pollarClient.getNetworkState());
|
|
3585
3751
|
const [sessionState, setSessionState] = react.useState(null);
|
|
3752
|
+
const [verified, setVerified] = react.useState(false);
|
|
3586
3753
|
const [transaction, setTransaction] = react.useState({ step: "idle" });
|
|
3587
3754
|
const [txHistory, setTxHistory] = react.useState({ step: "idle" });
|
|
3755
|
+
const [sessions, setSessions] = react.useState({ step: "idle" });
|
|
3588
3756
|
const [walletBalance, setWalletBalance] = react.useState({ step: "idle" });
|
|
3757
|
+
const [enabledAssets, setEnabledAssets] = react.useState({ step: "idle" });
|
|
3589
3758
|
const [resolvedConfig, setResolvedConfig] = react.useState(() => appConfigProp ?? DEFAULT_APP_CONFIG);
|
|
3590
3759
|
react.useEffect(() => {
|
|
3591
3760
|
return pollarClient.onTransactionStateChange(setTransaction);
|
|
@@ -3593,9 +3762,15 @@ function PollarProvider({
|
|
|
3593
3762
|
react.useEffect(() => {
|
|
3594
3763
|
return pollarClient.onTxHistoryStateChange(setTxHistory);
|
|
3595
3764
|
}, [pollarClient]);
|
|
3765
|
+
react.useEffect(() => {
|
|
3766
|
+
return pollarClient.onSessionsStateChange(setSessions);
|
|
3767
|
+
}, [pollarClient]);
|
|
3596
3768
|
react.useEffect(() => {
|
|
3597
3769
|
return pollarClient.onWalletBalanceStateChange(setWalletBalance);
|
|
3598
3770
|
}, [pollarClient]);
|
|
3771
|
+
react.useEffect(() => {
|
|
3772
|
+
return pollarClient.onEnabledAssetsStateChange(setEnabledAssets);
|
|
3773
|
+
}, [pollarClient]);
|
|
3599
3774
|
react.useEffect(() => {
|
|
3600
3775
|
return pollarClient.onNetworkStateChange((state) => {
|
|
3601
3776
|
setNetworkState(state);
|
|
@@ -3609,11 +3784,16 @@ function PollarProvider({
|
|
|
3609
3784
|
return pollarClient.onAuthStateChange((authState) => {
|
|
3610
3785
|
if (authState.step === "authenticated") {
|
|
3611
3786
|
setSessionState((prev) => sessionsEqual(prev, authState.session) ? prev : authState.session);
|
|
3787
|
+
setVerified(authState.verified);
|
|
3612
3788
|
} else if (authState.step === "idle") {
|
|
3613
3789
|
setSessionState(null);
|
|
3790
|
+
setVerified(false);
|
|
3614
3791
|
}
|
|
3615
3792
|
});
|
|
3616
3793
|
}, [pollarClient]);
|
|
3794
|
+
react.useEffect(() => {
|
|
3795
|
+
setModalErrorLogger(pollarClient.getLogger());
|
|
3796
|
+
}, [pollarClient]);
|
|
3617
3797
|
react.useEffect(() => {
|
|
3618
3798
|
if (appConfigProp !== void 0) return;
|
|
3619
3799
|
let cancelled = false;
|
|
@@ -3621,7 +3801,7 @@ function PollarProvider({
|
|
|
3621
3801
|
if (cancelled || !fetched) return;
|
|
3622
3802
|
setResolvedConfig(fetched);
|
|
3623
3803
|
}).catch((err) => {
|
|
3624
|
-
|
|
3804
|
+
pollarClient.getLogger().error("[PollarProvider] getAppConfig failed", err);
|
|
3625
3805
|
});
|
|
3626
3806
|
return () => {
|
|
3627
3807
|
cancelled = true;
|
|
@@ -3634,13 +3814,15 @@ function PollarProvider({
|
|
|
3634
3814
|
const [rampModalOpen, setRampModalOpen] = react.useState(false);
|
|
3635
3815
|
const [txHistoryModalOpen, setTxHistoryModalOpen] = react.useState(false);
|
|
3636
3816
|
const [walletBalanceModalOpen, setWalletBalanceModalOpen] = react.useState(false);
|
|
3817
|
+
const [enabledAssetsModalOpen, setEnabledAssetsModalOpen] = react.useState(false);
|
|
3637
3818
|
const [sendModalOpen, setSendModalOpen] = react.useState(false);
|
|
3638
3819
|
const [receiveModalOpen, setReceiveModalOpen] = react.useState(false);
|
|
3639
3820
|
const [sessionsModalOpen, setSessionsModalOpen] = react.useState(false);
|
|
3640
3821
|
const [distributionRulesModalOpen, setDistributionRulesModalOpen] = react.useState(false);
|
|
3641
|
-
const walletAddress = sessionState?.wallet?.
|
|
3822
|
+
const walletAddress = sessionState?.wallet?.address || "";
|
|
3642
3823
|
const getClient = react.useCallback(() => pollarClient, [pollarClient]);
|
|
3643
|
-
const refreshWalletBalance = react.useCallback(() => pollarClient.refreshBalance(
|
|
3824
|
+
const refreshWalletBalance = react.useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
|
|
3825
|
+
const refreshAssets = react.useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
|
|
3644
3826
|
const renderWallets = ui?.renderWallets;
|
|
3645
3827
|
const contextValue = react.useMemo(() => {
|
|
3646
3828
|
const styles = resolvedConfig.styles ?? {};
|
|
@@ -3648,6 +3830,7 @@ function PollarProvider({
|
|
|
3648
3830
|
// session
|
|
3649
3831
|
walletAddress,
|
|
3650
3832
|
isAuthenticated: !!walletAddress,
|
|
3833
|
+
verified,
|
|
3651
3834
|
walletType: pollarClient.getWalletType(),
|
|
3652
3835
|
// client
|
|
3653
3836
|
getClient,
|
|
@@ -3671,10 +3854,15 @@ function PollarProvider({
|
|
|
3671
3854
|
walletBalance,
|
|
3672
3855
|
refreshWalletBalance,
|
|
3673
3856
|
openWalletBalanceModal: () => setWalletBalanceModalOpen(true),
|
|
3857
|
+
// enabled assets
|
|
3858
|
+
enabledAssets,
|
|
3859
|
+
refreshAssets,
|
|
3860
|
+
openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
|
|
3674
3861
|
// send / receive
|
|
3675
3862
|
openSendModal: () => setSendModalOpen(true),
|
|
3676
3863
|
openReceiveModal: () => setReceiveModalOpen(true),
|
|
3677
3864
|
// sessions
|
|
3865
|
+
sessions,
|
|
3678
3866
|
openSessionsModal: () => setSessionsModalOpen(true),
|
|
3679
3867
|
// distribution
|
|
3680
3868
|
openDistributionRulesModal: () => setDistributionRulesModalOpen(true),
|
|
@@ -3696,12 +3884,16 @@ function PollarProvider({
|
|
|
3696
3884
|
};
|
|
3697
3885
|
}, [
|
|
3698
3886
|
walletAddress,
|
|
3887
|
+
verified,
|
|
3699
3888
|
pollarClient,
|
|
3700
3889
|
getClient,
|
|
3701
3890
|
transaction,
|
|
3702
3891
|
txHistory,
|
|
3892
|
+
sessions,
|
|
3703
3893
|
walletBalance,
|
|
3704
3894
|
refreshWalletBalance,
|
|
3895
|
+
enabledAssets,
|
|
3896
|
+
refreshAssets,
|
|
3705
3897
|
networkState,
|
|
3706
3898
|
resolvedConfig,
|
|
3707
3899
|
adapters,
|
|
@@ -3723,6 +3915,7 @@ function PollarProvider({
|
|
|
3723
3915
|
rampModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setRampModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(RampWidget, { onClose: () => setRampModalOpen(false) }) }),
|
|
3724
3916
|
txHistoryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
|
|
3725
3917
|
walletBalanceModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
|
|
3918
|
+
enabledAssetsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEnabledAssetsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EnabledAssetsModal, { onClose: () => setEnabledAssetsModalOpen(false) }) }),
|
|
3726
3919
|
sendModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }),
|
|
3727
3920
|
receiveModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
|
|
3728
3921
|
sessionsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
|
|
@@ -3779,6 +3972,10 @@ function WalletButtonTemplate({
|
|
|
3779
3972
|
onTxHistory,
|
|
3780
3973
|
onSend,
|
|
3781
3974
|
onReceive,
|
|
3975
|
+
onSessions,
|
|
3976
|
+
onKyc,
|
|
3977
|
+
onRamp,
|
|
3978
|
+
onDistributionRules,
|
|
3782
3979
|
onLogout,
|
|
3783
3980
|
onLogin
|
|
3784
3981
|
}) {
|
|
@@ -3938,6 +4135,94 @@ function WalletButtonTemplate({
|
|
|
3938
4135
|
"Transaction history"
|
|
3939
4136
|
] }),
|
|
3940
4137
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
|
|
4138
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
|
|
4139
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4140
|
+
"svg",
|
|
4141
|
+
{
|
|
4142
|
+
width: "14",
|
|
4143
|
+
height: "14",
|
|
4144
|
+
viewBox: "0 0 24 24",
|
|
4145
|
+
fill: "none",
|
|
4146
|
+
stroke: "currentColor",
|
|
4147
|
+
strokeWidth: "2",
|
|
4148
|
+
strokeLinecap: "round",
|
|
4149
|
+
strokeLinejoin: "round",
|
|
4150
|
+
children: [
|
|
4151
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "17 1 21 5 17 9" }),
|
|
4152
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 11V9a4 4 0 0 1 4-4h14" }),
|
|
4153
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "7 23 3 19 7 15" }),
|
|
4154
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 13v2a4 4 0 0 1-4 4H3" })
|
|
4155
|
+
]
|
|
4156
|
+
}
|
|
4157
|
+
),
|
|
4158
|
+
"Buy / Sell"
|
|
4159
|
+
] }),
|
|
4160
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
|
|
4161
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4162
|
+
"svg",
|
|
4163
|
+
{
|
|
4164
|
+
width: "14",
|
|
4165
|
+
height: "14",
|
|
4166
|
+
viewBox: "0 0 24 24",
|
|
4167
|
+
fill: "none",
|
|
4168
|
+
stroke: "currentColor",
|
|
4169
|
+
strokeWidth: "2",
|
|
4170
|
+
strokeLinecap: "round",
|
|
4171
|
+
strokeLinejoin: "round",
|
|
4172
|
+
children: [
|
|
4173
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z" }),
|
|
4174
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 21v-1a6 6 0 0 1 6-6h2" }),
|
|
4175
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "16 11 18 13 22 9" })
|
|
4176
|
+
]
|
|
4177
|
+
}
|
|
4178
|
+
),
|
|
4179
|
+
"Identity verification"
|
|
4180
|
+
] }),
|
|
4181
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
|
|
4182
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4183
|
+
"svg",
|
|
4184
|
+
{
|
|
4185
|
+
width: "14",
|
|
4186
|
+
height: "14",
|
|
4187
|
+
viewBox: "0 0 24 24",
|
|
4188
|
+
fill: "none",
|
|
4189
|
+
stroke: "currentColor",
|
|
4190
|
+
strokeWidth: "2",
|
|
4191
|
+
strokeLinecap: "round",
|
|
4192
|
+
strokeLinejoin: "round",
|
|
4193
|
+
children: [
|
|
4194
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "5", r: "3" }),
|
|
4195
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "12", r: "3" }),
|
|
4196
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "19", r: "3" }),
|
|
4197
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "8.59", y1: "13.51", x2: "15.42", y2: "17.49" }),
|
|
4198
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "15.41", y1: "6.51", x2: "8.59", y2: "10.49" })
|
|
4199
|
+
]
|
|
4200
|
+
}
|
|
4201
|
+
),
|
|
4202
|
+
"Distribution rules"
|
|
4203
|
+
] }),
|
|
4204
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
|
|
4205
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4206
|
+
"svg",
|
|
4207
|
+
{
|
|
4208
|
+
width: "14",
|
|
4209
|
+
height: "14",
|
|
4210
|
+
viewBox: "0 0 24 24",
|
|
4211
|
+
fill: "none",
|
|
4212
|
+
stroke: "currentColor",
|
|
4213
|
+
strokeWidth: "2",
|
|
4214
|
+
strokeLinecap: "round",
|
|
4215
|
+
strokeLinejoin: "round",
|
|
4216
|
+
children: [
|
|
4217
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2", ry: "2" }),
|
|
4218
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
4219
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
4220
|
+
]
|
|
4221
|
+
}
|
|
4222
|
+
),
|
|
4223
|
+
"Active sessions"
|
|
4224
|
+
] }),
|
|
4225
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
|
|
3941
4226
|
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item danger", onClick: onLogout, children: [
|
|
3942
4227
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3943
4228
|
"svg",
|
|
@@ -3972,6 +4257,10 @@ function WalletButton() {
|
|
|
3972
4257
|
openWalletBalanceModal,
|
|
3973
4258
|
openSendModal,
|
|
3974
4259
|
openReceiveModal,
|
|
4260
|
+
openSessionsModal,
|
|
4261
|
+
openKycModal,
|
|
4262
|
+
openRampModal,
|
|
4263
|
+
openDistributionRulesModal,
|
|
3975
4264
|
tx: transaction,
|
|
3976
4265
|
walletType
|
|
3977
4266
|
} = usePollar();
|
|
@@ -4030,6 +4319,22 @@ function WalletButton() {
|
|
|
4030
4319
|
setOpen(false);
|
|
4031
4320
|
openReceiveModal();
|
|
4032
4321
|
}
|
|
4322
|
+
function handleSessions() {
|
|
4323
|
+
setOpen(false);
|
|
4324
|
+
openSessionsModal();
|
|
4325
|
+
}
|
|
4326
|
+
function handleKyc() {
|
|
4327
|
+
setOpen(false);
|
|
4328
|
+
openKycModal();
|
|
4329
|
+
}
|
|
4330
|
+
function handleRamp() {
|
|
4331
|
+
setOpen(false);
|
|
4332
|
+
openRampModal();
|
|
4333
|
+
}
|
|
4334
|
+
function handleDistributionRules() {
|
|
4335
|
+
setOpen(false);
|
|
4336
|
+
openDistributionRulesModal();
|
|
4337
|
+
}
|
|
4033
4338
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4034
4339
|
WalletButtonTemplate,
|
|
4035
4340
|
{
|
|
@@ -4049,6 +4354,10 @@ function WalletButton() {
|
|
|
4049
4354
|
onTxHistory: handleTxHistory,
|
|
4050
4355
|
onSend: handleSend,
|
|
4051
4356
|
onReceive: handleReceive,
|
|
4357
|
+
onSessions: handleSessions,
|
|
4358
|
+
onKyc: handleKyc,
|
|
4359
|
+
onRamp: handleRamp,
|
|
4360
|
+
onDistributionRules: handleDistributionRules,
|
|
4052
4361
|
onLogout: handleLogout,
|
|
4053
4362
|
onLogin: openLoginModal
|
|
4054
4363
|
}
|
|
@@ -4057,6 +4366,8 @@ function WalletButton() {
|
|
|
4057
4366
|
|
|
4058
4367
|
exports.DistributionRulesModal = DistributionRulesModal;
|
|
4059
4368
|
exports.DistributionRulesModalTemplate = DistributionRulesModalTemplate;
|
|
4369
|
+
exports.EnabledAssetsModal = EnabledAssetsModal;
|
|
4370
|
+
exports.EnabledAssetsModalTemplate = EnabledAssetsModalTemplate;
|
|
4060
4371
|
exports.KycModal = KycModal;
|
|
4061
4372
|
exports.KycModalTemplate = KycModalTemplate;
|
|
4062
4373
|
exports.KycStatus = KycStatus;
|
|
@@ -4077,6 +4388,7 @@ exports.TxStatusView = TxStatusView;
|
|
|
4077
4388
|
exports.WalletBalanceModal = WalletBalanceModal;
|
|
4078
4389
|
exports.WalletBalanceModalTemplate = WalletBalanceModalTemplate;
|
|
4079
4390
|
exports.WalletButton = WalletButton;
|
|
4391
|
+
exports.WalletButtonTemplate = WalletButtonTemplate;
|
|
4080
4392
|
exports.createPollarAdapterHook = createPollarAdapterHook;
|
|
4081
4393
|
exports.usePollar = usePollar;
|
|
4082
4394
|
//# sourceMappingURL=index.js.map
|