@pollar/react 0.10.1-rc.8 → 0.10.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.js CHANGED
@@ -1035,7 +1035,7 @@ var PollarModalFooter = () => {
1035
1035
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
1036
1036
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
1037
1037
  "v",
1038
- "0.10.1-rc.8"
1038
+ "0.10.1"
1039
1039
  ] })
1040
1040
  ] })
1041
1041
  ] });
@@ -1160,7 +1160,10 @@ function RuleCard({
1160
1160
  validity
1161
1161
  ] })
1162
1162
  ] }),
1163
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-dist-item-action", children: isClaimed ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-dist-item-status", "data-kind": "claimed", children: "Claimed" }) : effectivelyClaimable ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary pollar-dist-claim-btn", onClick: onClaim, disabled: isClaiming, children: isClaiming ? "Claiming\u2026" : "Claim" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-dist-item-status", "data-kind": "unavailable", children: reasonLabel(rule.reason) }) }),
1163
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-dist-item-action", children: isClaimed ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-dist-item-status", "data-kind": "claimed", children: "Claimed" }) : effectivelyClaimable ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary pollar-dist-claim-btn", onClick: onClaim, disabled: isClaiming, children: isClaiming ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1164
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
1165
+ "Claiming\u2026"
1166
+ ] }) : "Claim" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-dist-item-status", "data-kind": "unavailable", children: reasonLabel(rule.reason) }) }),
1164
1167
  errorMessage && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-dist-item-error", children: errorMessage })
1165
1168
  ] });
1166
1169
  }
@@ -1206,29 +1209,46 @@ function DistributionRulesModalTemplate({
1206
1209
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1207
1210
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Distribution Rules" }),
1208
1211
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1209
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
1210
- /* @__PURE__ */ jsxRuntime.jsxs(
1211
- "svg",
1212
- {
1213
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1214
- width: "13",
1215
- height: "13",
1216
- viewBox: "0 0 13 13",
1217
- fill: "none",
1218
- "aria-hidden": true,
1219
- children: [
1220
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
1221
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1222
- ]
1223
- }
1224
- ),
1225
- "Refresh"
1226
- ] }),
1212
+ /* @__PURE__ */ jsxRuntime.jsx(
1213
+ "button",
1214
+ {
1215
+ type: "button",
1216
+ className: "pollar-modal-close",
1217
+ onClick: onRefresh,
1218
+ disabled: isLoading,
1219
+ "aria-label": "Refresh",
1220
+ title: "Refresh",
1221
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1222
+ "svg",
1223
+ {
1224
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
1225
+ width: "16",
1226
+ height: "16",
1227
+ viewBox: "0 0 16 16",
1228
+ fill: "none",
1229
+ "aria-hidden": true,
1230
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1231
+ "path",
1232
+ {
1233
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
1234
+ stroke: "currentColor",
1235
+ strokeWidth: "1.6",
1236
+ strokeLinecap: "round",
1237
+ strokeLinejoin: "round"
1238
+ }
1239
+ )
1240
+ }
1241
+ )
1242
+ }
1243
+ ),
1227
1244
  /* @__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" }) }) })
1228
1245
  ] })
1229
1246
  ] }),
1230
1247
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-dist-list", children: [
1231
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1248
+ isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
1249
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
1250
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
1251
+ ] }),
1232
1252
  state.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: state.message }),
1233
1253
  state.step === "loaded" && rules.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No distribution rules available." }),
1234
1254
  rules.map((rule) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -1353,14 +1373,14 @@ function AssetItem({
1353
1373
  !isNative && record.enabledInApp && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-asset-sponsor", children: record.sponsored ? "Reserve sponsored by the app" : "You pay the reserve (~0.5 XLM)" })
1354
1374
  ] }),
1355
1375
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-asset-actions", children: [
1356
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: `pollar-asset-trustline${established ? " established" : ""}`, children: established ? "Trustline active" : "Needs trustline" }),
1376
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `pollar-asset-trustline${established ? " pollar-established" : ""}`, children: established ? "Trustline active" : "Needs trustline" }),
1357
1377
  !isNative && /* @__PURE__ */ jsxRuntime.jsx(
1358
1378
  "button",
1359
1379
  {
1360
- className: `pollar-asset-btn${established ? " danger" : ""}`,
1380
+ className: `pollar-asset-btn${established ? " pollar-danger" : ""}`,
1361
1381
  onClick: () => onToggle(record),
1362
1382
  disabled: busy || disabled,
1363
- children: busy ? "\u2026" : established ? "Disable" : "Enable"
1383
+ children: busy ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }) : established ? "Disable" : "Enable"
1364
1384
  }
1365
1385
  )
1366
1386
  ] })
@@ -1393,29 +1413,46 @@ function EnabledAssetsModalTemplate({
1393
1413
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1394
1414
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Trustlines" }),
1395
1415
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1396
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading || busy, children: [
1397
- /* @__PURE__ */ jsxRuntime.jsxs(
1398
- "svg",
1399
- {
1400
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1401
- width: "13",
1402
- height: "13",
1403
- viewBox: "0 0 13 13",
1404
- fill: "none",
1405
- "aria-hidden": true,
1406
- children: [
1407
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
1408
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1409
- ]
1410
- }
1411
- ),
1412
- "Refresh"
1413
- ] }),
1416
+ /* @__PURE__ */ jsxRuntime.jsx(
1417
+ "button",
1418
+ {
1419
+ type: "button",
1420
+ className: "pollar-modal-close",
1421
+ onClick: onRefresh,
1422
+ disabled: isLoading || busy,
1423
+ "aria-label": "Refresh",
1424
+ title: "Refresh",
1425
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1426
+ "svg",
1427
+ {
1428
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
1429
+ width: "16",
1430
+ height: "16",
1431
+ viewBox: "0 0 16 16",
1432
+ fill: "none",
1433
+ "aria-hidden": true,
1434
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1435
+ "path",
1436
+ {
1437
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
1438
+ stroke: "currentColor",
1439
+ strokeWidth: "1.6",
1440
+ strokeLinecap: "round",
1441
+ strokeLinejoin: "round"
1442
+ }
1443
+ )
1444
+ }
1445
+ )
1446
+ }
1447
+ ),
1414
1448
  /* @__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" }) }) })
1415
1449
  ] })
1416
1450
  ] }),
1417
1451
  walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-asset-address", children: cropAddress(walletAddress) }),
1418
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1452
+ isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
1453
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
1454
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
1455
+ ] }),
1419
1456
  enabledAssets.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: enabledAssets.message }),
1420
1457
  actionError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-action-error", children: actionError }),
1421
1458
  data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
@@ -1474,7 +1511,7 @@ function CustomTrustlineModalTemplate({
1474
1511
  children: [
1475
1512
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1476
1513
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1477
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-back", onClick: onBack, disabled: busy, "aria-label": "Back", 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: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1514
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onBack, disabled: busy, "aria-label": "Back", 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: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1478
1515
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Add custom trustline" })
1479
1516
  ] }),
1480
1517
  /* @__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" }) }) })
@@ -1535,7 +1572,10 @@ function CustomTrustlineModalTemplate({
1535
1572
  )
1536
1573
  ] }),
1537
1574
  actionError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-action-error", children: actionError }),
1538
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-asset-submit", onClick: submit, disabled: !canSubmit, children: busy ? "Enabling\u2026" : "Enable trustline" }),
1575
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: submit, disabled: !canSubmit, children: busy ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1576
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
1577
+ "Enabling\u2026"
1578
+ ] }) : "Enable trustline" }) }),
1539
1579
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
1540
1580
  ]
1541
1581
  }
@@ -1656,6 +1696,7 @@ function KycModalTemplate({
1656
1696
  isLoading,
1657
1697
  onSelectProvider,
1658
1698
  onDoneVerifying,
1699
+ onRefresh,
1659
1700
  onClose
1660
1701
  }) {
1661
1702
  const isDark = theme === "dark";
@@ -1680,16 +1721,56 @@ function KycModalTemplate({
1680
1721
  "--pollar-modal-subtitle-size": "0.9rem"
1681
1722
  };
1682
1723
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1683
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-header", children: [
1684
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-kyc-title", children: "Identity verification" }),
1685
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-kyc-subtitle", children: [
1686
- step === "select_provider" && "Choose your verification provider",
1687
- step === "verifying" && `Verifying with ${selectedProvider?.name}`,
1688
- step === "polling" && "Waiting for verification result",
1689
- step === "done" && "Verification complete"
1724
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1725
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-header-text", children: [
1726
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Identity verification" }),
1727
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-kyc-subtitle", children: [
1728
+ step === "select_provider" && "Choose your verification provider",
1729
+ step === "verifying" && `Verifying with ${selectedProvider?.name}`,
1730
+ step === "polling" && "Waiting for verification result",
1731
+ step === "done" && "Verification complete"
1732
+ ] })
1733
+ ] }),
1734
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1735
+ step === "select_provider" && /* @__PURE__ */ jsxRuntime.jsx(
1736
+ "button",
1737
+ {
1738
+ type: "button",
1739
+ className: "pollar-modal-close",
1740
+ onClick: onRefresh,
1741
+ disabled: isLoading,
1742
+ "aria-label": "Refresh",
1743
+ title: "Refresh providers",
1744
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1745
+ "svg",
1746
+ {
1747
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
1748
+ width: "16",
1749
+ height: "16",
1750
+ viewBox: "0 0 16 16",
1751
+ fill: "none",
1752
+ "aria-hidden": true,
1753
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1754
+ "path",
1755
+ {
1756
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
1757
+ stroke: "currentColor",
1758
+ strokeWidth: "1.6",
1759
+ strokeLinecap: "round",
1760
+ strokeLinejoin: "round"
1761
+ }
1762
+ )
1763
+ }
1764
+ )
1765
+ }
1766
+ ),
1767
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "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" }) }) })
1690
1768
  ] })
1691
1769
  ] }),
1692
- step === "select_provider" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-providers", children: [
1770
+ step === "select_provider" && (isLoading && providers.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
1771
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
1772
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading providers\u2026" })
1773
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-providers", children: [
1693
1774
  providers.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "var(--pollar-muted)", textAlign: "center" }, children: "No providers available for your country." }),
1694
1775
  providers.map((p) => /* @__PURE__ */ jsxRuntime.jsxs(
1695
1776
  "button",
@@ -1705,7 +1786,7 @@ function KycModalTemplate({
1705
1786
  },
1706
1787
  p.id
1707
1788
  ))
1708
- ] }),
1789
+ ] })),
1709
1790
  step === "verifying" && selectedProvider && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1710
1791
  /* @__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: [
1711
1792
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u{1F512}" }),
@@ -1738,10 +1819,13 @@ function KycModal({ onClose, country = "MX", level = "basic", onApproved }) {
1738
1819
  const [isLoading, setIsLoading] = react.useState(false);
1739
1820
  const client = getClient();
1740
1821
  const { theme = "light", accentColor = "#005DB4" } = styles;
1741
- react.useEffect(() => {
1822
+ const loadProviders = react.useCallback(() => {
1742
1823
  setIsLoading(true);
1743
- getClient().getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
1824
+ return getClient().getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
1744
1825
  }, [getClient, country]);
1826
+ react.useEffect(() => {
1827
+ void loadProviders();
1828
+ }, [loadProviders]);
1745
1829
  async function handleSelectProvider(provider) {
1746
1830
  setSelectedProvider(provider);
1747
1831
  setIsLoading(true);
@@ -1787,6 +1871,7 @@ function KycModal({ onClose, country = "MX", level = "basic", onApproved }) {
1787
1871
  isLoading,
1788
1872
  onSelectProvider: handleSelectProvider,
1789
1873
  onDoneVerifying: handleDoneVerifying,
1874
+ onRefresh: () => void loadProviders(),
1790
1875
  onClose
1791
1876
  }
1792
1877
  ) });
@@ -1842,8 +1927,8 @@ function EmailCodeInput({ email, onSubmit }) {
1842
1927
  ] });
1843
1928
  }
1844
1929
  var GithubButton = ({ disabled, onClick }) => {
1845
- return /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "github-button", disabled, onClick, children: [
1846
- /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "github-button-icon", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(
1930
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-github-button", disabled, onClick, children: [
1931
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "pollar-github-button-icon", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(
1847
1932
  "path",
1848
1933
  {
1849
1934
  fillRule: "evenodd",
@@ -1851,14 +1936,14 @@ var GithubButton = ({ disabled, onClick }) => {
1851
1936
  clipRule: "evenodd"
1852
1937
  }
1853
1938
  ) }),
1854
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "github-button-contents", children: "GitHub" })
1939
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-github-button-contents", children: "GitHub" })
1855
1940
  ] });
1856
1941
  };
1857
1942
  var GoogleButton = ({ disabled, onClick }) => {
1858
- return /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "gsi-material-button", disabled, onClick, children: [
1859
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "gsi-material-button-state" }),
1860
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gsi-material-button-content-wrapper", children: [
1861
- /* @__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: [
1943
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-gsi-material-button", disabled, onClick, children: [
1944
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-gsi-material-button-state" }),
1945
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-gsi-material-button-content-wrapper", children: [
1946
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-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: [
1862
1947
  /* @__PURE__ */ jsxRuntime.jsx(
1863
1948
  "path",
1864
1949
  {
@@ -1889,7 +1974,7 @@ var GoogleButton = ({ disabled, onClick }) => {
1889
1974
  ),
1890
1975
  /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", d: "M0 0h48v48H0z" })
1891
1976
  ] }) }),
1892
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gsi-material-button-contents", children: "Google" }),
1977
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-gsi-material-button-contents", children: "Google" }),
1893
1978
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: "Google" })
1894
1979
  ] })
1895
1980
  ] });
@@ -2095,7 +2180,7 @@ function LoginModalTemplate({
2095
2180
  placeholder: "you@email.com",
2096
2181
  value: email,
2097
2182
  disabled: isLoading,
2098
- className: "pollar-email-input",
2183
+ className: "pollar-input",
2099
2184
  onChange: (e) => onEmailChange?.(e.target.value),
2100
2185
  onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
2101
2186
  }
@@ -2324,7 +2409,7 @@ function PrivyLoginSubmodal({
2324
2409
  placeholder: "you@email.com",
2325
2410
  value: email,
2326
2411
  disabled: isLoading,
2327
- className: "pollar-email-input",
2412
+ className: "pollar-input",
2328
2413
  onChange: (e) => setEmail(e.target.value),
2329
2414
  onKeyDown: (e) => e.key === "Enter" && handleEmailSubmit()
2330
2415
  }
@@ -2526,6 +2611,13 @@ function RouteDisplay({ quote, onSelect }) {
2526
2611
  }
2527
2612
  );
2528
2613
  }
2614
+ var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
2615
+ function isFieldValid(spec, raw) {
2616
+ const value = (raw ?? "").trim();
2617
+ if (!value) return false;
2618
+ if (spec.type === "email") return EMAIL_RE.test(value);
2619
+ return true;
2620
+ }
2529
2621
  var LOADING_STEPS = ["Detecting your country\u2026", "Consulting providers\u2026", "Route found!"];
2530
2622
  function flagEmoji(code) {
2531
2623
  const cc = code.trim().toUpperCase();
@@ -2567,7 +2659,7 @@ function flattenInstructions(instr) {
2567
2659
  }
2568
2660
  continue;
2569
2661
  }
2570
- let value = "";
2662
+ let value;
2571
2663
  if (typeof v === "string" || typeof v === "number") value = String(v);
2572
2664
  else if (Array.isArray(v)) value = v.filter((x) => typeof x === "string" || typeof x === "number").join(", ");
2573
2665
  else continue;
@@ -2662,7 +2754,7 @@ function RampWidgetTemplate({
2662
2754
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: onRefresh, disabled: refreshing, "aria-label": "Refresh", children: /* @__PURE__ */ jsxRuntime.jsx(
2663
2755
  "svg",
2664
2756
  {
2665
- className: refreshing ? "pollar-modal-refresh-icon spinning" : "pollar-modal-refresh-icon",
2757
+ className: refreshing ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
2666
2758
  width: "16",
2667
2759
  height: "16",
2668
2760
  viewBox: "0 0 16 16",
@@ -2684,12 +2776,12 @@ function RampWidgetTemplate({
2684
2776
  ] })
2685
2777
  ] }),
2686
2778
  step === "input" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2687
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-tabs", children: [
2779
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tabs", children: [
2688
2780
  /* @__PURE__ */ jsxRuntime.jsx(
2689
2781
  "button",
2690
2782
  {
2691
2783
  type: "button",
2692
- className: "pollar-ramp-tab",
2784
+ className: "pollar-tab",
2693
2785
  "data-active": direction === "onramp",
2694
2786
  onClick: () => onDirectionChange("onramp"),
2695
2787
  children: "Buy"
@@ -2699,7 +2791,7 @@ function RampWidgetTemplate({
2699
2791
  "button",
2700
2792
  {
2701
2793
  type: "button",
2702
- className: "pollar-ramp-tab",
2794
+ className: "pollar-tab",
2703
2795
  "data-active": direction === "offramp",
2704
2796
  onClick: () => onDirectionChange("offramp"),
2705
2797
  children: "Sell"
@@ -2708,7 +2800,10 @@ function RampWidgetTemplate({
2708
2800
  ] }),
2709
2801
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
2710
2802
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Country" }),
2711
- countriesLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-input pollar-ramp-input-loading", children: "Loading countries\u2026" }) : countries.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "No ramp providers available on this network yet." }) : /* @__PURE__ */ jsxRuntime.jsx("select", { className: "pollar-ramp-input", value: country, onChange: (e) => onCountryChange(e.target.value), children: countries.map((c) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: c.code, children: [
2803
+ countriesLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-input pollar-select-loading", children: [
2804
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
2805
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading countries\u2026" })
2806
+ ] }) : countries.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "No ramp providers available on this network yet." }) : /* @__PURE__ */ jsxRuntime.jsx("select", { className: "pollar-ramp-input", value: country, onChange: (e) => onCountryChange(e.target.value), children: countries.map((c) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: c.code, children: [
2712
2807
  flagEmoji(c.code),
2713
2808
  " ",
2714
2809
  c.code,
@@ -2746,10 +2841,13 @@ function RampWidgetTemplate({
2746
2841
  )
2747
2842
  ] })
2748
2843
  ] }),
2749
- step === "loading_quote" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-loading", children: LOADING_STEPS.map((text, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-loading-row", children: [
2750
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-loading-dot" }),
2751
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: text })
2752
- ] }, i)) }),
2844
+ step === "loading_quote" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-loading", children: [
2845
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner pollar-ramp-loading-spinner" }),
2846
+ LOADING_STEPS.map((text, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-loading-row", children: [
2847
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-loading-dot" }),
2848
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: text })
2849
+ ] }, i))
2850
+ ] }),
2753
2851
  step === "select_route" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2754
2852
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-list", children: quotes.map((q, i) => /* @__PURE__ */ jsxRuntime.jsx(RouteDisplay, { quote: q, onSelect: onSelectQuote }, i)) }),
2755
2853
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" })
@@ -2777,7 +2875,8 @@ function RampWidgetTemplate({
2777
2875
  autoComplete: f.type === "email" ? "email" : "off",
2778
2876
  onChange: (e) => onFieldChange(f.key, e.target.value)
2779
2877
  }
2780
- )
2878
+ ),
2879
+ f.type === "email" && (fieldValues[f.key] ?? "").trim() !== "" && !isFieldValid(f, fieldValues[f.key]) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-field-error", children: "Enter a valid email address." })
2781
2880
  ] }, f.key)),
2782
2881
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
2783
2882
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onRetry, children: "Back" }),
@@ -2786,9 +2885,12 @@ function RampWidgetTemplate({
2786
2885
  {
2787
2886
  type: "button",
2788
2887
  className: "pollar-btn-primary",
2789
- disabled: requiredFields.some((f) => !(fieldValues[f.key] ?? "").trim()) || isLoading,
2888
+ disabled: requiredFields.some((f) => !isFieldValid(f, fieldValues[f.key])) || isLoading,
2790
2889
  onClick: onContactContinue,
2791
- children: isLoading ? "Starting\u2026" : "Continue"
2890
+ children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2891
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
2892
+ "Starting\u2026"
2893
+ ] }) : "Continue"
2792
2894
  }
2793
2895
  )
2794
2896
  ] })
@@ -2800,7 +2902,10 @@ function RampWidgetTemplate({
2800
2902
  ] }),
2801
2903
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
2802
2904
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Status" }),
2803
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxRuntime.jsx("code", { style: { color: txStatus === "completed" ? "var(--pollar-success-text)" : void 0 }, children: txStatus ? STATUS_LABEL[txStatus] : "Processing" }) })
2905
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
2906
+ /* @__PURE__ */ jsxRuntime.jsx("code", { style: { color: txStatus === "completed" ? "var(--pollar-success-text)" : void 0 }, children: txStatus ? STATUS_LABEL[txStatus] : "Processing" }),
2907
+ txStatus !== "completed" && txStatus !== "failed" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-label": "Checking status" })
2908
+ ] })
2804
2909
  ] }),
2805
2910
  stellarTxHash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
2806
2911
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Stellar tx" }),
@@ -2821,8 +2926,26 @@ function RampWidgetTemplate({
2821
2926
  "aria-label": "View on Stellar Expert",
2822
2927
  title: "View on Stellar Expert",
2823
2928
  children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
2824
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 3H3v8h8V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
2825
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 2.5h3v3M11 3L6.5 7.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2929
+ /* @__PURE__ */ jsxRuntime.jsx(
2930
+ "path",
2931
+ {
2932
+ d: "M6 3H3v8h8V8",
2933
+ stroke: "currentColor",
2934
+ strokeWidth: "1.5",
2935
+ strokeLinecap: "round",
2936
+ strokeLinejoin: "round"
2937
+ }
2938
+ ),
2939
+ /* @__PURE__ */ jsxRuntime.jsx(
2940
+ "path",
2941
+ {
2942
+ d: "M8.5 2.5h3v3M11 3L6.5 7.5",
2943
+ stroke: "currentColor",
2944
+ strokeWidth: "1.5",
2945
+ strokeLinecap: "round",
2946
+ strokeLinejoin: "round"
2947
+ }
2948
+ )
2826
2949
  ] })
2827
2950
  }
2828
2951
  )
@@ -2837,7 +2960,10 @@ function RampWidgetTemplate({
2837
2960
  alt: label,
2838
2961
  style: { width: "100%", maxWidth: 220, height: "auto", display: "block", margin: "0 auto" }
2839
2962
  }
2840
- ) : kind === "datetime" ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: value }) : /* @__PURE__ */ jsxRuntime.jsx("code", { style: { wordBreak: "break-all" }, children: value }) })
2963
+ ) : kind === "datetime" ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: value }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2964
+ /* @__PURE__ */ jsxRuntime.jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children: value }),
2965
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value, label: `Copy ${label}` })
2966
+ ] }) })
2841
2967
  ] }, key)),
2842
2968
  tosUrl && !depositInstructions && txStatus !== "completed" && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-btn-primary", onClick: onOpenTos, children: [
2843
2969
  "Accept terms at ",
@@ -2847,7 +2973,10 @@ function RampWidgetTemplate({
2847
2973
  "Continue at ",
2848
2974
  provider
2849
2975
  ] }),
2850
- canComplete && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", disabled: completing, onClick: onCompleteWithdraw, children: completing ? "Submitting\u2026" : "I've completed KYC \u2014 withdraw" }),
2976
+ canComplete && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", disabled: completing, onClick: onCompleteWithdraw, children: completing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2977
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
2978
+ "Submitting\u2026"
2979
+ ] }) : "I've completed KYC \u2014 withdraw" }),
2851
2980
  errorMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", style: { color: "var(--pollar-error-text)" }, children: errorMsg }),
2852
2981
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: txStatus === "completed" ? "Done" : "Close" })
2853
2982
  ] }),
@@ -2963,6 +3092,7 @@ function RampWidget({ onClose }) {
2963
3092
  setStep("input");
2964
3093
  setQuotes([]);
2965
3094
  setSelectedQuote(null);
3095
+ setFieldValues({});
2966
3096
  setTxId(null);
2967
3097
  setProvider("");
2968
3098
  setKycUrl(null);
@@ -3299,6 +3429,7 @@ function AssetSelect({
3299
3429
  options,
3300
3430
  onChange,
3301
3431
  loading = false,
3432
+ loadingLabel,
3302
3433
  disabled = false,
3303
3434
  appGroupLabel = "App assets",
3304
3435
  otherGroupLabel = "Other assets",
@@ -3308,7 +3439,10 @@ function AssetSelect({
3308
3439
  const otherAssets = options.filter((o) => !o.enabledInApp);
3309
3440
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
3310
3441
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: label }),
3311
- loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxRuntime.jsxs(
3442
+ loading ? loadingLabel ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-input pollar-select-loading", children: [
3443
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
3444
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: loadingLabel })
3445
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxRuntime.jsxs(
3312
3446
  "select",
3313
3447
  {
3314
3448
  className: "pollar-input pollar-send-select",
@@ -3549,6 +3683,7 @@ function SendModalTemplate({
3549
3683
  isInProgress,
3550
3684
  onClose,
3551
3685
  onBack,
3686
+ onRefresh,
3552
3687
  onSelectAsset,
3553
3688
  onAmountChange,
3554
3689
  onDestinationChange,
@@ -3593,7 +3728,41 @@ function SendModalTemplate({
3593
3728
  showBack && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: onBack, "aria-label": "Back", 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: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
3594
3729
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: title })
3595
3730
  ] }),
3596
- !isInProgress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-header-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "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" }) }) }) })
3731
+ !isInProgress && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
3732
+ step === "form" && /* @__PURE__ */ jsxRuntime.jsx(
3733
+ "button",
3734
+ {
3735
+ type: "button",
3736
+ className: "pollar-modal-close",
3737
+ onClick: onRefresh,
3738
+ disabled: isLoadingBalance,
3739
+ "aria-label": "Refresh",
3740
+ title: "Refresh balances",
3741
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3742
+ "svg",
3743
+ {
3744
+ className: isLoadingBalance ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
3745
+ width: "16",
3746
+ height: "16",
3747
+ viewBox: "0 0 16 16",
3748
+ fill: "none",
3749
+ "aria-hidden": true,
3750
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3751
+ "path",
3752
+ {
3753
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
3754
+ stroke: "currentColor",
3755
+ strokeWidth: "1.6",
3756
+ strokeLinecap: "round",
3757
+ strokeLinejoin: "round"
3758
+ }
3759
+ )
3760
+ }
3761
+ )
3762
+ }
3763
+ ),
3764
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "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" }) }) })
3765
+ ] })
3597
3766
  ] }),
3598
3767
  step === "form" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3599
3768
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3602,6 +3771,7 @@ function SendModalTemplate({
3602
3771
  label: "Asset",
3603
3772
  value: selectedKey,
3604
3773
  loading: isLoadingBalance,
3774
+ loadingLabel: "Loading assets\u2026",
3605
3775
  options: assets.map((a) => ({
3606
3776
  key: assetKey3(a),
3607
3777
  code: a.code,
@@ -3803,6 +3973,7 @@ function SendModal({ onClose }) {
3803
3973
  isInProgress,
3804
3974
  onClose,
3805
3975
  onBack: handleBack,
3976
+ onRefresh: () => void refreshWalletBalance(),
3806
3977
  onSelectAsset: setSelectedAsset,
3807
3978
  onAmountChange: setAmount,
3808
3979
  onDestinationChange: setDestination,
@@ -3945,7 +4116,6 @@ function SwapModalTemplate({
3945
4116
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "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" }) }) })
3946
4117
  ] })
3947
4118
  ] }),
3948
- step === "form" && configLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: "Loading swap options\u2026" }),
3949
4119
  step === "form" && !configLoading && swapUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Swap is not available for this app." }),
3950
4120
  step === "form" && !swapUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3951
4121
  smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Swaps are not yet available for smart (passkey) wallets." }),
@@ -3954,7 +4124,8 @@ function SwapModalTemplate({
3954
4124
  {
3955
4125
  label: "You pay",
3956
4126
  value: sellKey,
3957
- loading: isLoadingData,
4127
+ loading: isLoadingData || configLoading,
4128
+ loadingLabel: "Loading assets\u2026",
3958
4129
  disabled: configLoading,
3959
4130
  options: sellOptions.map((o) => ({
3960
4131
  key: assetOptionKey(o),
@@ -3996,7 +4167,8 @@ function SwapModalTemplate({
3996
4167
  {
3997
4168
  label: "You receive",
3998
4169
  value: buyKey,
3999
- loading: isLoadingData,
4170
+ loading: isLoadingData || configLoading,
4171
+ loadingLabel: "Loading assets\u2026",
4000
4172
  disabled: configLoading,
4001
4173
  options: buyOptions.map((o) => ({
4002
4174
  key: assetOptionKey(o),
@@ -4058,18 +4230,24 @@ function SwapModalTemplate({
4058
4230
  ),
4059
4231
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4060
4232
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Route" }),
4061
- /* @__PURE__ */ jsxRuntime.jsx(
4233
+ configLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-input pollar-select-loading", children: [
4234
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
4235
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading routes\u2026" })
4236
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
4062
4237
  "select",
4063
4238
  {
4064
4239
  className: "pollar-input pollar-send-select",
4065
4240
  value: provider,
4066
- disabled: configLoading || providers.length === 0,
4241
+ disabled: providers.length === 0,
4067
4242
  onChange: (e) => onProviderChange(e.target.value),
4068
- children: providers.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: provider, children: configLoading ? "Loading\u2026" : PROVIDER_LABELS[provider] }) : providers.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p, children: PROVIDER_LABELS[p] }, p))
4243
+ children: providers.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: provider, children: PROVIDER_LABELS[provider] }) : providers.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p, children: PROVIDER_LABELS[p] }, p))
4069
4244
  }
4070
4245
  )
4071
4246
  ] }),
4072
- quoteLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: "Fetching best price\u2026" }),
4247
+ quoteLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-hint pollar-inline-loading", children: [
4248
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
4249
+ "Fetching best price\u2026"
4250
+ ] }),
4073
4251
  !quoteLoading && quoteError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: quoteError }),
4074
4252
  !quoteLoading && !quoteError && quote && selectedBuy && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote", children: [
4075
4253
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
@@ -4403,7 +4581,14 @@ var PROVIDER_LABELS2 = {
4403
4581
  blend: "Blend",
4404
4582
  defindex: "DeFindex"
4405
4583
  };
4406
- var IN_FLIGHT_STEPS2 = ["building", "signing", "submitting", "submitted", "signing-submitting", "building-signing-submitting"];
4584
+ var IN_FLIGHT_STEPS2 = [
4585
+ "building",
4586
+ "signing",
4587
+ "submitting",
4588
+ "submitted",
4589
+ "signing-submitting",
4590
+ "building-signing-submitting"
4591
+ ];
4407
4592
  function formatAmount4(value) {
4408
4593
  const n = parseFloat(value);
4409
4594
  return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
@@ -4417,6 +4602,11 @@ function EarnModal({ onClose }) {
4417
4602
  earnWithdraw,
4418
4603
  tx: transaction,
4419
4604
  wallet,
4605
+ walletBalance,
4606
+ refreshWalletBalance,
4607
+ enabledAssets,
4608
+ refreshAssets,
4609
+ setTrustline,
4420
4610
  network,
4421
4611
  styles
4422
4612
  } = usePollar();
@@ -4434,6 +4624,7 @@ function EarnModal({ onClose }) {
4434
4624
  const [amount, setAmount] = react.useState("");
4435
4625
  const [loadingOpps, setLoadingOpps] = react.useState(false);
4436
4626
  const [formError, setFormError] = react.useState("");
4627
+ const [refreshing, setRefreshing] = react.useState(false);
4437
4628
  const [showXdr, setShowXdr] = react.useState(false);
4438
4629
  const [copied, setCopied] = react.useState(false);
4439
4630
  const copyTimerRef = react.useRef(null);
@@ -4447,6 +4638,10 @@ function EarnModal({ onClose }) {
4447
4638
  react.useEffect(() => {
4448
4639
  void loadProviders();
4449
4640
  }, [loadProviders]);
4641
+ react.useEffect(() => {
4642
+ void refreshWalletBalance();
4643
+ void refreshAssets();
4644
+ }, [refreshWalletBalance, refreshAssets]);
4450
4645
  react.useEffect(() => {
4451
4646
  if (!provider) return;
4452
4647
  let cancelled = false;
@@ -4490,6 +4685,22 @@ function EarnModal({ onClose }) {
4490
4685
  const withdrawUnit = position?.withdrawUnit ?? "asset";
4491
4686
  const assetCode = selectedOpportunity?.asset.code ?? "";
4492
4687
  const amountUnitLabel = tab === "deposit" ? assetCode : withdrawUnit === "shares" ? "shares" : assetCode;
4688
+ const walletAvailable = (() => {
4689
+ if (!selectedOpportunity) return null;
4690
+ const balances = walletBalance.step === "loaded" ? walletBalance.data.balances : [];
4691
+ const issuer = selectedOpportunity.asset.issuer;
4692
+ const rec = balances.find(
4693
+ (b) => issuer === null ? b.type === "native" : b.code === assetCode && b.issuer === issuer
4694
+ );
4695
+ return rec ? rec.available : null;
4696
+ })();
4697
+ const depositAssetRecord = (() => {
4698
+ if (!selectedOpportunity?.asset.issuer || enabledAssets.step !== "loaded") return void 0;
4699
+ return enabledAssets.data.assets.find(
4700
+ (a) => a.code === assetCode && a.issuer === selectedOpportunity.asset.issuer
4701
+ );
4702
+ })();
4703
+ const depositNeedsTrustline = tab === "deposit" && !smartUnsupported && !!selectedOpportunity?.asset.issuer && !depositAssetRecord?.trustlineEstablished;
4493
4704
  const hash = transaction.step === "success" ? transaction.hash : null;
4494
4705
  const buildData = "buildData" in transaction ? transaction.buildData : null;
4495
4706
  const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
@@ -4497,7 +4708,9 @@ function EarnModal({ onClose }) {
4497
4708
  const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
4498
4709
  const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
4499
4710
  const txTitle = isInProgress ? tab === "deposit" ? "Depositing\u2026" : "Withdrawing\u2026" : transaction.step === "success" ? "Done!" : transaction.step === "error" ? tab === "deposit" ? "Deposit failed" : "Withdraw failed" : "Confirm";
4500
- const canSubmit = !smartUnsupported && !!provider && !!opportunityId && !!amount && parseFloat(amount) > 0 && !providersLoading && !loadingOpps;
4711
+ const parsedAmount = parseFloat(amount);
4712
+ const exceedsAvailable = tab === "deposit" ? walletAvailable != null && parsedAmount > parseFloat(walletAvailable) : position != null && parsedAmount > parseFloat(position.withdrawable);
4713
+ const canSubmit = !smartUnsupported && !!provider && !!opportunityId && !!amount && parsedAmount > 0 && !exceedsAvailable && !providersLoading && !loadingOpps;
4501
4714
  const cssVars = {
4502
4715
  "--pollar-accent": accentColor,
4503
4716
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
@@ -4530,11 +4743,27 @@ function EarnModal({ onClose }) {
4530
4743
  setFormError("Enter a valid amount");
4531
4744
  return;
4532
4745
  }
4746
+ if (tab === "deposit" && walletAvailable != null && parsed > parseFloat(walletAvailable)) {
4747
+ setFormError("Amount exceeds your wallet balance");
4748
+ return;
4749
+ }
4533
4750
  if (tab === "withdraw" && position && parsed > parseFloat(position.withdrawable)) {
4534
4751
  setFormError("Amount exceeds your position");
4535
4752
  return;
4536
4753
  }
4537
4754
  setStep("tx");
4755
+ if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
4756
+ const tl = await setTrustline(
4757
+ { code: assetCode, issuer: selectedOpportunity.asset.issuer },
4758
+ depositAssetRecord?.sponsored ? { sponsored: true } : void 0
4759
+ );
4760
+ if (tl.status === "error") {
4761
+ setFormError(`Trustline for ${assetCode} failed: ${tl.details ?? "unknown error"}`);
4762
+ setStep("form");
4763
+ return;
4764
+ }
4765
+ await refreshAssets();
4766
+ }
4538
4767
  const params = { provider, opportunity: opportunityId, amount };
4539
4768
  const outcome = tab === "deposit" ? await earnDeposit(params) : await earnWithdraw(params);
4540
4769
  if (outcome.status === "success" || outcome.status === "pending") {
@@ -4565,146 +4794,217 @@ function EarnModal({ onClose }) {
4565
4794
  setCopied(false);
4566
4795
  refreshPosition();
4567
4796
  }
4797
+ async function handleRefresh() {
4798
+ if (refreshing || !provider) return;
4799
+ setRefreshing(true);
4800
+ try {
4801
+ void refreshWalletBalance();
4802
+ const opps = await getEarnOpportunities(provider);
4803
+ setOpportunities(opps);
4804
+ setOpportunityId((cur) => opps.some((o) => o.id === cur) ? cur : opps[0]?.id ?? "");
4805
+ refreshPosition();
4806
+ } catch {
4807
+ } finally {
4808
+ setRefreshing(false);
4809
+ }
4810
+ }
4568
4811
  const title = step === "form" ? "Earn" : txTitle;
4569
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-send-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
4570
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
4571
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-header-left", children: [
4572
- showBack && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleBack, "aria-label": "Back", 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: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
4573
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: title })
4574
- ] }),
4575
- !isInProgress && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "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" }) }) })
4576
- ] }),
4577
- step === "form" && providersLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: "Loading Earn options\u2026" }),
4578
- step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
4579
- step === "form" && !earnUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4580
- smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
4581
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-tabs", children: [
4582
- /* @__PURE__ */ jsxRuntime.jsx(
4583
- "button",
4584
- {
4585
- type: "button",
4586
- className: `pollar-earn-tab${tab === "deposit" ? " pollar-earn-tab-active" : ""}`,
4587
- onClick: () => {
4588
- setTab("deposit");
4589
- setFormError("");
4590
- },
4591
- children: "Deposit"
4592
- }
4593
- ),
4594
- /* @__PURE__ */ jsxRuntime.jsx(
4595
- "button",
4596
- {
4597
- type: "button",
4598
- className: `pollar-earn-tab${tab === "withdraw" ? " pollar-earn-tab-active" : ""}`,
4599
- onClick: () => {
4600
- setTab("withdraw");
4601
- setFormError("");
4602
- },
4603
- children: "Withdraw"
4604
- }
4605
- )
4606
- ] }),
4607
- providers && providers.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4608
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Provider" }),
4609
- /* @__PURE__ */ jsxRuntime.jsx(
4610
- "select",
4611
- {
4612
- className: "pollar-input pollar-send-select",
4613
- value: provider ?? "",
4614
- onChange: (e) => setProvider(e.target.value),
4615
- children: providers.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p, children: PROVIDER_LABELS2[p] }, p))
4616
- }
4617
- )
4618
- ] }),
4619
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4620
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
4621
- /* @__PURE__ */ jsxRuntime.jsx(
4622
- "select",
4623
- {
4624
- className: "pollar-input pollar-send-select",
4625
- value: opportunityId,
4626
- disabled: loadingOpps || opportunities.length === 0,
4627
- onChange: (e) => setOpportunityId(e.target.value),
4628
- children: opportunities.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: loadingOpps ? "Loading\u2026" : "None available" }) : opportunities.map((o) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: o.id, children: [
4629
- o.name,
4630
- " \xB7 ",
4631
- o.apy.toFixed(2),
4632
- "% APY"
4633
- ] }, o.id))
4634
- }
4635
- )
4636
- ] }),
4637
- selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote", children: [
4638
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4639
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "Your position" }),
4640
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4641
- position ? formatAmount4(position.balance) : "\u2026",
4642
- " ",
4643
- assetCode
4812
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
4813
+ "div",
4814
+ {
4815
+ className: "pollar-modal-card pollar-send-modal",
4816
+ "data-theme": theme,
4817
+ style: cssVars,
4818
+ onClick: (e) => e.stopPropagation(),
4819
+ children: [
4820
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
4821
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-header-left", children: [
4822
+ showBack && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleBack, "aria-label": "Back", 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: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
4823
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: title })
4824
+ ] }),
4825
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
4826
+ step === "form" && !earnUnavailable && !smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx(
4827
+ "button",
4828
+ {
4829
+ type: "button",
4830
+ className: "pollar-modal-close",
4831
+ onClick: () => void handleRefresh(),
4832
+ disabled: refreshing || providersLoading,
4833
+ "aria-label": "Refresh",
4834
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4835
+ "svg",
4836
+ {
4837
+ className: refreshing ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
4838
+ width: "16",
4839
+ height: "16",
4840
+ viewBox: "0 0 16 16",
4841
+ fill: "none",
4842
+ "aria-hidden": true,
4843
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4844
+ "path",
4845
+ {
4846
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
4847
+ stroke: "currentColor",
4848
+ strokeWidth: "1.6",
4849
+ strokeLinecap: "round",
4850
+ strokeLinejoin: "round"
4851
+ }
4852
+ )
4853
+ }
4854
+ )
4855
+ }
4856
+ ),
4857
+ !isInProgress && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "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" }) }) })
4644
4858
  ] })
4645
4859
  ] }),
4646
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4647
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "APY" }),
4648
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
4649
- selectedOpportunity.apy.toFixed(2),
4650
- "%"
4651
- ] })
4652
- ] })
4653
- ] }),
4654
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4655
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-label-row", children: [
4656
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: tab === "deposit" ? "Amount" : "Withdraw amount" }),
4657
- tab === "withdraw" && position && /* @__PURE__ */ jsxRuntime.jsxs(
4658
- "button",
4659
- {
4660
- type: "button",
4661
- className: "pollar-swap-custom-toggle",
4662
- onClick: () => setAmount(position.withdrawable),
4663
- children: [
4860
+ step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
4861
+ step === "form" && !earnUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4862
+ smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
4863
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tabs", children: [
4864
+ /* @__PURE__ */ jsxRuntime.jsx(
4865
+ "button",
4866
+ {
4867
+ type: "button",
4868
+ className: "pollar-tab",
4869
+ "data-active": tab === "deposit",
4870
+ onClick: () => {
4871
+ setTab("deposit");
4872
+ setFormError("");
4873
+ },
4874
+ children: "Deposit"
4875
+ }
4876
+ ),
4877
+ /* @__PURE__ */ jsxRuntime.jsx(
4878
+ "button",
4879
+ {
4880
+ type: "button",
4881
+ className: "pollar-tab",
4882
+ "data-active": tab === "withdraw",
4883
+ onClick: () => {
4884
+ setTab("withdraw");
4885
+ setFormError("");
4886
+ },
4887
+ children: "Withdraw"
4888
+ }
4889
+ )
4890
+ ] }),
4891
+ providers && providers.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4892
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Provider" }),
4893
+ /* @__PURE__ */ jsxRuntime.jsx(
4894
+ "select",
4895
+ {
4896
+ className: "pollar-input pollar-send-select",
4897
+ value: provider ?? "",
4898
+ onChange: (e) => setProvider(e.target.value),
4899
+ children: providers.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p, children: PROVIDER_LABELS2[p] }, p))
4900
+ }
4901
+ )
4902
+ ] }),
4903
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4904
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
4905
+ loadingOpps || providersLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-input pollar-select-loading", children: [
4906
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
4907
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading options\u2026" })
4908
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
4909
+ "select",
4910
+ {
4911
+ className: "pollar-input pollar-send-select",
4912
+ value: opportunityId,
4913
+ disabled: opportunities.length === 0,
4914
+ onChange: (e) => setOpportunityId(e.target.value),
4915
+ children: opportunities.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "None available" }) : opportunities.map((o) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: o.id, children: [
4916
+ o.name,
4917
+ " \xB7 ",
4918
+ o.apy.toFixed(2),
4919
+ "% APY"
4920
+ ] }, o.id))
4921
+ }
4922
+ )
4923
+ ] }),
4924
+ selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote", children: [
4925
+ tab === "deposit" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4926
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "In your wallet" }),
4927
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4928
+ walletAvailable != null ? formatAmount4(walletAvailable) : "\u2026",
4929
+ " ",
4930
+ assetCode
4931
+ ] })
4932
+ ] }),
4933
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4934
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "Your position" }),
4935
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4936
+ position ? formatAmount4(position.balance) : "\u2026",
4937
+ " ",
4938
+ assetCode
4939
+ ] })
4940
+ ] }),
4941
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4942
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "APY" }),
4943
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
4944
+ selectedOpportunity.apy.toFixed(2),
4945
+ "%"
4946
+ ] })
4947
+ ] })
4948
+ ] }),
4949
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4950
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-label-row", children: [
4951
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: tab === "deposit" ? "Amount" : "Withdraw amount" }),
4952
+ tab === "deposit" && walletAvailable != null && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-swap-custom-toggle", onClick: () => setAmount(walletAvailable), children: [
4953
+ "Max: ",
4954
+ formatAmount4(walletAvailable),
4955
+ " ",
4956
+ amountUnitLabel
4957
+ ] }),
4958
+ tab === "withdraw" && position && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-swap-custom-toggle", onClick: () => setAmount(position.withdrawable), children: [
4664
4959
  "Max: ",
4665
4960
  formatAmount4(position.withdrawable),
4666
4961
  " ",
4667
4962
  amountUnitLabel
4668
- ]
4669
- }
4670
- )
4963
+ ] })
4964
+ ] }),
4965
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-amount", children: [
4966
+ /* @__PURE__ */ jsxRuntime.jsx(
4967
+ "input",
4968
+ {
4969
+ className: "pollar-input",
4970
+ type: "text",
4971
+ inputMode: "decimal",
4972
+ placeholder: "0.00",
4973
+ value: amount,
4974
+ onChange: (e) => setAmount(e.target.value)
4975
+ }
4976
+ ),
4977
+ amountUnitLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-earn-amount-unit", children: amountUnitLabel })
4978
+ ] })
4979
+ ] }),
4980
+ formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
4981
+ depositNeedsTrustline && selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-trustline-notice", children: [
4982
+ "To deposit ",
4983
+ assetCode,
4984
+ " your wallet needs a trustline. This will create it first (~0.5 XLM reserve, refundable if you later remove it), then deposit \u2014 two signatures."
4985
+ ] }),
4986
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary", onClick: () => void handleSubmit(), disabled: !canSubmit, children: tab === "deposit" ? depositNeedsTrustline ? "Enable trustline & deposit" : "Deposit" : "Withdraw" }) })
4671
4987
  ] }),
4672
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-amount", children: [
4673
- /* @__PURE__ */ jsxRuntime.jsx(
4674
- "input",
4675
- {
4676
- className: "pollar-input",
4677
- type: "text",
4678
- inputMode: "decimal",
4679
- placeholder: "0.00",
4680
- value: amount,
4681
- onChange: (e) => setAmount(e.target.value)
4682
- }
4683
- ),
4684
- amountUnitLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-earn-amount-unit", children: amountUnitLabel })
4685
- ] })
4686
- ] }),
4687
- formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
4688
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary", onClick: () => void handleSubmit(), disabled: !canSubmit, children: tab === "deposit" ? "Deposit" : "Withdraw" }) })
4689
- ] }),
4690
- step === "tx" && /* @__PURE__ */ jsxRuntime.jsx(
4691
- TxStatusView,
4692
- {
4693
- transaction,
4694
- showXdr,
4695
- copied,
4696
- explorerUrl,
4697
- walletType,
4698
- onSignAndSend: () => {
4699
- },
4700
- onToggleXdr: () => setShowXdr((v) => !v),
4701
- onCopyHash: handleCopyHash,
4702
- onRetry: () => void handleRetry(),
4703
- onDone: onClose
4704
- }
4705
- ),
4706
- /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
4707
- ] }) });
4988
+ step === "tx" && /* @__PURE__ */ jsxRuntime.jsx(
4989
+ TxStatusView,
4990
+ {
4991
+ transaction,
4992
+ showXdr,
4993
+ copied,
4994
+ explorerUrl,
4995
+ walletType,
4996
+ onSignAndSend: () => {
4997
+ },
4998
+ onToggleXdr: () => setShowXdr((v) => !v),
4999
+ onCopyHash: handleCopyHash,
5000
+ onRetry: () => void handleRetry(),
5001
+ onDone: onClose
5002
+ }
5003
+ ),
5004
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5005
+ ]
5006
+ }
5007
+ ) });
4708
5008
  }
4709
5009
  function describeDevice(s) {
4710
5010
  if (s.deviceLabel) return s.deviceLabel;
@@ -4797,30 +5097,46 @@ function SessionsModalTemplate({
4797
5097
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
4798
5098
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Active sessions" }),
4799
5099
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
4800
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
4801
- /* @__PURE__ */ jsxRuntime.jsxs(
4802
- "svg",
4803
- {
4804
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
4805
- width: "13",
4806
- height: "13",
4807
- viewBox: "0 0 13 13",
4808
- fill: "none",
4809
- "aria-hidden": true,
4810
- children: [
4811
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
4812
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
4813
- ]
4814
- }
4815
- ),
4816
- "Refresh"
4817
- ] }),
5100
+ /* @__PURE__ */ jsxRuntime.jsx(
5101
+ "button",
5102
+ {
5103
+ type: "button",
5104
+ className: "pollar-modal-close",
5105
+ onClick: onRefresh,
5106
+ disabled: isLoading,
5107
+ "aria-label": "Refresh",
5108
+ title: "Refresh",
5109
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5110
+ "svg",
5111
+ {
5112
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
5113
+ width: "16",
5114
+ height: "16",
5115
+ viewBox: "0 0 16 16",
5116
+ fill: "none",
5117
+ "aria-hidden": true,
5118
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5119
+ "path",
5120
+ {
5121
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
5122
+ stroke: "currentColor",
5123
+ strokeWidth: "1.6",
5124
+ strokeLinecap: "round",
5125
+ strokeLinejoin: "round"
5126
+ }
5127
+ )
5128
+ }
5129
+ )
5130
+ }
5131
+ ),
4818
5132
  /* @__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" }) }) })
4819
5133
  ] })
4820
5134
  ] }),
4821
5135
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-sessions-list", children: [
4822
- state.step === "idle" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
4823
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
5136
+ (state.step === "idle" || isLoading) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5137
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5138
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
5139
+ ] }),
4824
5140
  state.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: state.message }),
4825
5141
  state.step === "loaded" && sessions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No active sessions." }),
4826
5142
  sessions.map((s) => {
@@ -4849,7 +5165,10 @@ function SessionsModalTemplate({
4849
5165
  className: "pollar-sessions-item-revoke",
4850
5166
  onClick: () => onRevoke(s.familyId),
4851
5167
  disabled: isRevoking || signingOutEverywhere,
4852
- children: isRevoking ? "Revoking\u2026" : "Revoke"
5168
+ children: isRevoking ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5169
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }),
5170
+ "Revoking\u2026"
5171
+ ] }) : "Revoke"
4853
5172
  }
4854
5173
  )
4855
5174
  ] }, s.familyId);
@@ -4862,7 +5181,10 @@ function SessionsModalTemplate({
4862
5181
  onClick: onLogoutEverywhere,
4863
5182
  disabled: signingOutEverywhere || otherCount === 0,
4864
5183
  title: otherCount === 0 ? "No other devices to sign out" : void 0,
4865
- children: signingOutEverywhere ? "Signing out\u2026" : "Sign out everywhere"
5184
+ children: signingOutEverywhere ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5185
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }),
5186
+ "Signing out\u2026"
5187
+ ] }) : "Sign out everywhere"
4866
5188
  }
4867
5189
  ) }),
4868
5190
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
@@ -5079,7 +5401,7 @@ function renderSummary(summary) {
5079
5401
  last = m.index + address.length;
5080
5402
  }
5081
5403
  if (parts.length === 0) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-title", children: summary });
5082
- if (last < summary.length) parts.push(/* @__PURE__ */ jsxRuntime.jsx("span", { children: summary.slice(last) }, key++));
5404
+ if (last < summary.length) parts.push(/* @__PURE__ */ jsxRuntime.jsx("span", { children: summary.slice(last) }, key));
5083
5405
  return parts;
5084
5406
  }
5085
5407
  function TxHistoryModalTemplate({
@@ -5127,30 +5449,47 @@ function TxHistoryModalTemplate({
5127
5449
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
5128
5450
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
5129
5451
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
5130
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
5131
- /* @__PURE__ */ jsxRuntime.jsxs(
5132
- "svg",
5133
- {
5134
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
5135
- width: "13",
5136
- height: "13",
5137
- viewBox: "0 0 13 13",
5138
- fill: "none",
5139
- "aria-hidden": true,
5140
- children: [
5141
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
5142
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
5143
- ]
5144
- }
5145
- ),
5146
- "Refresh"
5147
- ] }),
5452
+ /* @__PURE__ */ jsxRuntime.jsx(
5453
+ "button",
5454
+ {
5455
+ type: "button",
5456
+ className: "pollar-modal-close",
5457
+ onClick: onRefresh,
5458
+ disabled: isLoading,
5459
+ "aria-label": "Refresh",
5460
+ title: "Refresh",
5461
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5462
+ "svg",
5463
+ {
5464
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
5465
+ width: "16",
5466
+ height: "16",
5467
+ viewBox: "0 0 16 16",
5468
+ fill: "none",
5469
+ "aria-hidden": true,
5470
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5471
+ "path",
5472
+ {
5473
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
5474
+ stroke: "currentColor",
5475
+ strokeWidth: "1.6",
5476
+ strokeLinecap: "round",
5477
+ strokeLinejoin: "round"
5478
+ }
5479
+ )
5480
+ }
5481
+ )
5482
+ }
5483
+ ),
5148
5484
  /* @__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" }) }) })
5149
5485
  ] })
5150
5486
  ] }),
5151
5487
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-list", children: [
5152
5488
  txHistory.step === "idle" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Click Refresh to load transactions." }),
5153
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
5489
+ isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5490
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5491
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
5492
+ ] }),
5154
5493
  txHistory.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
5155
5494
  txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
5156
5495
  records.map((record) => {
@@ -5343,24 +5682,38 @@ function WalletBalanceModalTemplate({
5343
5682
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
5344
5683
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
5345
5684
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
5346
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
5347
- /* @__PURE__ */ jsxRuntime.jsxs(
5348
- "svg",
5349
- {
5350
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
5351
- width: "13",
5352
- height: "13",
5353
- viewBox: "0 0 13 13",
5354
- fill: "none",
5355
- "aria-hidden": true,
5356
- children: [
5357
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
5358
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
5359
- ]
5360
- }
5361
- ),
5362
- "Refresh"
5363
- ] }),
5685
+ /* @__PURE__ */ jsxRuntime.jsx(
5686
+ "button",
5687
+ {
5688
+ type: "button",
5689
+ className: "pollar-modal-close",
5690
+ onClick: onRefresh,
5691
+ disabled: isLoading,
5692
+ "aria-label": "Refresh",
5693
+ title: "Refresh",
5694
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5695
+ "svg",
5696
+ {
5697
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
5698
+ width: "16",
5699
+ height: "16",
5700
+ viewBox: "0 0 16 16",
5701
+ fill: "none",
5702
+ "aria-hidden": true,
5703
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5704
+ "path",
5705
+ {
5706
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
5707
+ stroke: "currentColor",
5708
+ strokeWidth: "1.6",
5709
+ strokeLinecap: "round",
5710
+ strokeLinejoin: "round"
5711
+ }
5712
+ )
5713
+ }
5714
+ )
5715
+ }
5716
+ ),
5364
5717
  /* @__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" }) }) })
5365
5718
  ] })
5366
5719
  ] }),
@@ -5368,7 +5721,10 @@ function WalletBalanceModalTemplate({
5368
5721
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
5369
5722
  /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: walletAddress, label: "Copy wallet address" })
5370
5723
  ] }),
5371
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
5724
+ isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5725
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5726
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
5727
+ ] }),
5372
5728
  walletBalance.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
5373
5729
  data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
5374
5730
  "Account not found on ",
@@ -5579,6 +5935,9 @@ function PollarProvider({
5579
5935
  const [sendModalOpen, setSendModalOpen] = react.useState(false);
5580
5936
  const [swapModalOpen, setSwapModalOpen] = react.useState(false);
5581
5937
  const [earnModalOpen, setEarnModalOpen] = react.useState(false);
5938
+ const [sendModalKey, setSendModalKey] = react.useState(0);
5939
+ const [swapModalKey, setSwapModalKey] = react.useState(0);
5940
+ const [earnModalKey, setEarnModalKey] = react.useState(0);
5582
5941
  const [receiveModalOpen, setReceiveModalOpen] = react.useState(false);
5583
5942
  const [sessionsModalOpen, setSessionsModalOpen] = react.useState(false);
5584
5943
  const [distributionRulesModalOpen, setDistributionRulesModalOpen] = react.useState(false);
@@ -5621,21 +5980,33 @@ function PollarProvider({
5621
5980
  setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
5622
5981
  openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
5623
5982
  // send / receive
5624
- openSendModal: () => setSendModalOpen(true),
5983
+ openSendModal: () => {
5984
+ pollarClient.resetTransactionState();
5985
+ setSendModalKey((k) => k + 1);
5986
+ setSendModalOpen(true);
5987
+ },
5625
5988
  openReceiveModal: () => setReceiveModalOpen(true),
5626
5989
  // swap
5627
5990
  getSwapConfig: () => pollarClient.getSwapConfig(),
5628
5991
  getSwapTokens: () => pollarClient.getSwapTokens(),
5629
5992
  getSwapQuote: (params) => pollarClient.getSwapQuote(params),
5630
5993
  swap: (quote, opts) => pollarClient.swap(quote, opts),
5631
- openSwapModal: () => setSwapModalOpen(true),
5994
+ openSwapModal: () => {
5995
+ pollarClient.resetTransactionState();
5996
+ setSwapModalKey((k) => k + 1);
5997
+ setSwapModalOpen(true);
5998
+ },
5632
5999
  // earn
5633
6000
  getEarnProviders: () => pollarClient.getEarnProviders(),
5634
6001
  getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider),
5635
6002
  getEarnPosition: (params) => pollarClient.getEarnPosition(params),
5636
6003
  earnDeposit: (params) => pollarClient.earnDeposit(params),
5637
6004
  earnWithdraw: (params) => pollarClient.earnWithdraw(params),
5638
- openEarnModal: () => setEarnModalOpen(true),
6005
+ openEarnModal: () => {
6006
+ pollarClient.resetTransactionState();
6007
+ setEarnModalKey((k) => k + 1);
6008
+ setEarnModalOpen(true);
6009
+ },
5639
6010
  // sessions
5640
6011
  sessions,
5641
6012
  openSessionsModal: () => setSessionsModalOpen(true),
@@ -5689,9 +6060,9 @@ function PollarProvider({
5689
6060
  txHistoryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
5690
6061
  walletBalanceModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
5691
6062
  enabledAssetsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEnabledAssetsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EnabledAssetsModal, { onClose: () => setEnabledAssetsModalOpen(false) }) }),
5692
- sendModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }),
5693
- swapModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }),
5694
- earnModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEarnModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EarnModal, { onClose: () => setEarnModalOpen(false) }) }),
6063
+ sendModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }, sendModalKey),
6064
+ swapModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }, swapModalKey),
6065
+ earnModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEarnModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EarnModal, { onClose: () => setEarnModalOpen(false) }) }, earnModalKey),
5695
6066
  receiveModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
5696
6067
  sessionsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
5697
6068
  distributionRulesModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setDistributionRulesModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(DistributionRulesModal, { onClose: () => setDistributionRulesModalOpen(false) }) })
@@ -5725,7 +6096,7 @@ function createPollarAdapterHook(key) {
5725
6096
  };
5726
6097
  }
5727
6098
  function ButtonLogo() {
5728
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
6099
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "pollar-wallet-btn-logo" });
5729
6100
  }
5730
6101
  function cropWallet(address) {
5731
6102
  if (address.length <= 12) return address;
@@ -5758,23 +6129,23 @@ function WalletButtonTemplate({
5758
6129
  onLogin
5759
6130
  }) {
5760
6131
  if (!walletAddress) {
5761
- return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "wallet-login-btn", style: { backgroundColor: accentColor }, onClick: onLogin, children: [
6132
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-wallet-login-btn", style: { backgroundColor: accentColor }, onClick: onLogin, children: [
5762
6133
  /* @__PURE__ */ jsxRuntime.jsx(ButtonLogo, {}),
5763
6134
  "Login with Pollar"
5764
6135
  ] });
5765
6136
  }
5766
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wallet-wrapper", ref: wrapperRef, children: [
6137
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, children: [
5767
6138
  /* @__PURE__ */ jsxRuntime.jsxs(
5768
6139
  "button",
5769
6140
  {
5770
- className: "wallet-btn",
6141
+ className: "pollar-wallet-btn",
5771
6142
  style: { backgroundColor: accentColor },
5772
6143
  onClick: isInProgress ? void 0 : onToggleOpen,
5773
6144
  disabled: isInProgress,
5774
6145
  "aria-busy": isInProgress,
5775
6146
  children: [
5776
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wallet-btn-label", children: cropWallet(walletAddress) }),
5777
- isInProgress ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "wallet-btn-spinner", viewBox: "0 0 12 12", width: "12", height: "12", fill: "none", "aria-hidden": true, children: [
6147
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-btn-label", children: cropWallet(walletAddress) }),
6148
+ isInProgress ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "pollar-wallet-btn-spinner", viewBox: "0 0 12 12", width: "12", height: "12", fill: "none", "aria-hidden": true, children: [
5778
6149
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "6", r: "4.5", stroke: "rgba(255,255,255,0.35)", strokeWidth: "1.5" }),
5779
6150
  /* @__PURE__ */ jsxRuntime.jsx(
5780
6151
  "circle",
@@ -5792,7 +6163,7 @@ function WalletButtonTemplate({
5792
6163
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(
5793
6164
  "svg",
5794
6165
  {
5795
- className: `wallet-chevron${open ? " open" : ""}`,
6166
+ className: `pollar-wallet-chevron${open ? " pollar-open" : ""}`,
5796
6167
  viewBox: "0 0 12 12",
5797
6168
  fill: "none",
5798
6169
  stroke: "currentColor",
@@ -5805,12 +6176,12 @@ function WalletButtonTemplate({
5805
6176
  ]
5806
6177
  }
5807
6178
  ),
5808
- open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
6179
+ open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
5809
6180
  showCreateAccount && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5810
6181
  /* @__PURE__ */ jsxRuntime.jsxs(
5811
6182
  "button",
5812
6183
  {
5813
- className: "wallet-dropdown-item",
6184
+ className: "pollar-wallet-dropdown-item",
5814
6185
  style: { color: itemColor },
5815
6186
  onClick: onCreateAccount,
5816
6187
  disabled: creatingAccount,
@@ -5838,9 +6209,9 @@ function WalletButtonTemplate({
5838
6209
  ]
5839
6210
  }
5840
6211
  ),
5841
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" })
6212
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
5842
6213
  ] }),
5843
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSend, children: [
6214
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onSend, children: [
5844
6215
  /* @__PURE__ */ jsxRuntime.jsxs(
5845
6216
  "svg",
5846
6217
  {
@@ -5860,7 +6231,7 @@ function WalletButtonTemplate({
5860
6231
  ),
5861
6232
  "Send"
5862
6233
  ] }),
5863
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onReceive, children: [
6234
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onReceive, children: [
5864
6235
  /* @__PURE__ */ jsxRuntime.jsxs(
5865
6236
  "svg",
5866
6237
  {
@@ -5881,8 +6252,8 @@ function WalletButtonTemplate({
5881
6252
  ),
5882
6253
  "Receive"
5883
6254
  ] }),
5884
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
5885
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
6255
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6256
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
5886
6257
  /* @__PURE__ */ jsxRuntime.jsxs(
5887
6258
  "svg",
5888
6259
  {
@@ -5902,7 +6273,7 @@ function WalletButtonTemplate({
5902
6273
  ),
5903
6274
  copied ? "Copied!" : "Copy address"
5904
6275
  ] }),
5905
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onWalletBalance, children: [
6276
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onWalletBalance, children: [
5906
6277
  /* @__PURE__ */ jsxRuntime.jsxs(
5907
6278
  "svg",
5908
6279
  {
@@ -5923,7 +6294,7 @@ function WalletButtonTemplate({
5923
6294
  ),
5924
6295
  "Wallet balance"
5925
6296
  ] }),
5926
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onTxHistory, children: [
6297
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onTxHistory, children: [
5927
6298
  /* @__PURE__ */ jsxRuntime.jsxs(
5928
6299
  "svg",
5929
6300
  {
@@ -5946,8 +6317,8 @@ function WalletButtonTemplate({
5946
6317
  ),
5947
6318
  "Transaction history"
5948
6319
  ] }),
5949
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
5950
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
6320
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6321
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
5951
6322
  /* @__PURE__ */ jsxRuntime.jsxs(
5952
6323
  "svg",
5953
6324
  {
@@ -5969,7 +6340,7 @@ function WalletButtonTemplate({
5969
6340
  ),
5970
6341
  "Buy / Sell"
5971
6342
  ] }),
5972
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
6343
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
5973
6344
  /* @__PURE__ */ jsxRuntime.jsxs(
5974
6345
  "svg",
5975
6346
  {
@@ -5990,7 +6361,7 @@ function WalletButtonTemplate({
5990
6361
  ),
5991
6362
  "Identity verification"
5992
6363
  ] }),
5993
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
6364
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
5994
6365
  /* @__PURE__ */ jsxRuntime.jsxs(
5995
6366
  "svg",
5996
6367
  {
@@ -6013,7 +6384,7 @@ function WalletButtonTemplate({
6013
6384
  ),
6014
6385
  "Distribution rules"
6015
6386
  ] }),
6016
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
6387
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
6017
6388
  /* @__PURE__ */ jsxRuntime.jsxs(
6018
6389
  "svg",
6019
6390
  {
@@ -6034,8 +6405,8 @@ function WalletButtonTemplate({
6034
6405
  ),
6035
6406
  "Active sessions"
6036
6407
  ] }),
6037
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
6038
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item danger", onClick: onLogout, children: [
6408
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6409
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item pollar-danger", onClick: onLogout, children: [
6039
6410
  /* @__PURE__ */ jsxRuntime.jsxs(
6040
6411
  "svg",
6041
6412
  {