@pollar/react 0.10.1-rc.9 → 0.11.0

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.mjs CHANGED
@@ -1033,7 +1033,7 @@ var PollarModalFooter = () => {
1033
1033
  /* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
1034
1034
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1035
1035
  "v",
1036
- "0.10.1-rc.9"
1036
+ "0.11.0"
1037
1037
  ] })
1038
1038
  ] })
1039
1039
  ] });
@@ -1158,7 +1158,10 @@ function RuleCard({
1158
1158
  validity
1159
1159
  ] })
1160
1160
  ] }),
1161
- /* @__PURE__ */ jsx("div", { className: "pollar-dist-item-action", children: isClaimed ? /* @__PURE__ */ jsx("span", { className: "pollar-dist-item-status", "data-kind": "claimed", children: "Claimed" }) : effectivelyClaimable ? /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary pollar-dist-claim-btn", onClick: onClaim, disabled: isClaiming, children: isClaiming ? "Claiming\u2026" : "Claim" }) : /* @__PURE__ */ jsx("span", { className: "pollar-dist-item-status", "data-kind": "unavailable", children: reasonLabel(rule.reason) }) }),
1161
+ /* @__PURE__ */ jsx("div", { className: "pollar-dist-item-action", children: isClaimed ? /* @__PURE__ */ jsx("span", { className: "pollar-dist-item-status", "data-kind": "claimed", children: "Claimed" }) : effectivelyClaimable ? /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary pollar-dist-claim-btn", onClick: onClaim, disabled: isClaiming, children: isClaiming ? /* @__PURE__ */ jsxs(Fragment, { children: [
1162
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
1163
+ "Claiming\u2026"
1164
+ ] }) : "Claim" }) : /* @__PURE__ */ jsx("span", { className: "pollar-dist-item-status", "data-kind": "unavailable", children: reasonLabel(rule.reason) }) }),
1162
1165
  errorMessage && /* @__PURE__ */ jsx("div", { className: "pollar-dist-item-error", children: errorMessage })
1163
1166
  ] });
1164
1167
  }
@@ -1204,29 +1207,46 @@ function DistributionRulesModalTemplate({
1204
1207
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
1205
1208
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Distribution Rules" }),
1206
1209
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
1207
- /* @__PURE__ */ jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
1208
- /* @__PURE__ */ jsxs(
1209
- "svg",
1210
- {
1211
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1212
- width: "13",
1213
- height: "13",
1214
- viewBox: "0 0 13 13",
1215
- fill: "none",
1216
- "aria-hidden": true,
1217
- children: [
1218
- /* @__PURE__ */ jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
1219
- /* @__PURE__ */ jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1220
- ]
1221
- }
1222
- ),
1223
- "Refresh"
1224
- ] }),
1210
+ /* @__PURE__ */ jsx(
1211
+ "button",
1212
+ {
1213
+ type: "button",
1214
+ className: "pollar-modal-close",
1215
+ onClick: onRefresh,
1216
+ disabled: isLoading,
1217
+ "aria-label": "Refresh",
1218
+ title: "Refresh",
1219
+ children: /* @__PURE__ */ jsx(
1220
+ "svg",
1221
+ {
1222
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
1223
+ width: "16",
1224
+ height: "16",
1225
+ viewBox: "0 0 16 16",
1226
+ fill: "none",
1227
+ "aria-hidden": true,
1228
+ children: /* @__PURE__ */ jsx(
1229
+ "path",
1230
+ {
1231
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
1232
+ stroke: "currentColor",
1233
+ strokeWidth: "1.6",
1234
+ strokeLinecap: "round",
1235
+ strokeLinejoin: "round"
1236
+ }
1237
+ )
1238
+ }
1239
+ )
1240
+ }
1241
+ ),
1225
1242
  /* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
1226
1243
  ] })
1227
1244
  ] }),
1228
1245
  /* @__PURE__ */ jsxs("div", { className: "pollar-dist-list", children: [
1229
- isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1246
+ isLoading && /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
1247
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
1248
+ /* @__PURE__ */ jsx("span", { children: "Loading\u2026" })
1249
+ ] }),
1230
1250
  state.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: state.message }),
1231
1251
  state.step === "loaded" && rules.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No distribution rules available." }),
1232
1252
  rules.map((rule) => /* @__PURE__ */ jsx(
@@ -1351,14 +1371,14 @@ function AssetItem({
1351
1371
  !isNative && record.enabledInApp && /* @__PURE__ */ jsx("span", { className: "pollar-asset-sponsor", children: record.sponsored ? "Reserve sponsored by the app" : "You pay the reserve (~0.5 XLM)" })
1352
1372
  ] }),
1353
1373
  /* @__PURE__ */ jsxs("div", { className: "pollar-asset-actions", children: [
1354
- /* @__PURE__ */ jsx("span", { className: `pollar-asset-trustline${established ? " established" : ""}`, children: established ? "Trustline active" : "Needs trustline" }),
1374
+ /* @__PURE__ */ jsx("span", { className: `pollar-asset-trustline${established ? " pollar-established" : ""}`, children: established ? "Trustline active" : "Needs trustline" }),
1355
1375
  !isNative && /* @__PURE__ */ jsx(
1356
1376
  "button",
1357
1377
  {
1358
- className: `pollar-asset-btn${established ? " danger" : ""}`,
1378
+ className: `pollar-asset-btn${established ? " pollar-danger" : ""}`,
1359
1379
  onClick: () => onToggle(record),
1360
1380
  disabled: busy || disabled,
1361
- children: busy ? "\u2026" : established ? "Disable" : "Enable"
1381
+ children: busy ? /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }) : established ? "Disable" : "Enable"
1362
1382
  }
1363
1383
  )
1364
1384
  ] })
@@ -1391,29 +1411,46 @@ function EnabledAssetsModalTemplate({
1391
1411
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
1392
1412
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Trustlines" }),
1393
1413
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
1394
- /* @__PURE__ */ jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading || busy, children: [
1395
- /* @__PURE__ */ jsxs(
1396
- "svg",
1397
- {
1398
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1399
- width: "13",
1400
- height: "13",
1401
- viewBox: "0 0 13 13",
1402
- fill: "none",
1403
- "aria-hidden": true,
1404
- children: [
1405
- /* @__PURE__ */ jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
1406
- /* @__PURE__ */ jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1407
- ]
1408
- }
1409
- ),
1410
- "Refresh"
1411
- ] }),
1414
+ /* @__PURE__ */ jsx(
1415
+ "button",
1416
+ {
1417
+ type: "button",
1418
+ className: "pollar-modal-close",
1419
+ onClick: onRefresh,
1420
+ disabled: isLoading || busy,
1421
+ "aria-label": "Refresh",
1422
+ title: "Refresh",
1423
+ children: /* @__PURE__ */ jsx(
1424
+ "svg",
1425
+ {
1426
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
1427
+ width: "16",
1428
+ height: "16",
1429
+ viewBox: "0 0 16 16",
1430
+ fill: "none",
1431
+ "aria-hidden": true,
1432
+ children: /* @__PURE__ */ jsx(
1433
+ "path",
1434
+ {
1435
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
1436
+ stroke: "currentColor",
1437
+ strokeWidth: "1.6",
1438
+ strokeLinecap: "round",
1439
+ strokeLinejoin: "round"
1440
+ }
1441
+ )
1442
+ }
1443
+ )
1444
+ }
1445
+ ),
1412
1446
  /* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
1413
1447
  ] })
1414
1448
  ] }),
1415
1449
  walletAddress && /* @__PURE__ */ jsx("div", { className: "pollar-asset-address", children: cropAddress(walletAddress) }),
1416
- isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1450
+ isLoading && /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
1451
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
1452
+ /* @__PURE__ */ jsx("span", { children: "Loading\u2026" })
1453
+ ] }),
1417
1454
  enabledAssets.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: enabledAssets.message }),
1418
1455
  actionError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-action-error", children: actionError }),
1419
1456
  data && !data.exists && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-empty", children: [
@@ -1472,7 +1509,7 @@ function CustomTrustlineModalTemplate({
1472
1509
  children: [
1473
1510
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
1474
1511
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
1475
- /* @__PURE__ */ jsx("button", { className: "pollar-modal-back", onClick: onBack, disabled: busy, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1512
+ /* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onBack, disabled: busy, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1476
1513
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Add custom trustline" })
1477
1514
  ] }),
1478
1515
  /* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
@@ -1533,7 +1570,10 @@ function CustomTrustlineModalTemplate({
1533
1570
  )
1534
1571
  ] }),
1535
1572
  actionError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-action-error", children: actionError }),
1536
- /* @__PURE__ */ jsx("button", { className: "pollar-asset-submit", onClick: submit, disabled: !canSubmit, children: busy ? "Enabling\u2026" : "Enable trustline" }),
1573
+ /* @__PURE__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: submit, disabled: !canSubmit, children: busy ? /* @__PURE__ */ jsxs(Fragment, { children: [
1574
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
1575
+ "Enabling\u2026"
1576
+ ] }) : "Enable trustline" }) }),
1537
1577
  /* @__PURE__ */ jsx(PollarModalFooter, {})
1538
1578
  ]
1539
1579
  }
@@ -1654,6 +1694,7 @@ function KycModalTemplate({
1654
1694
  isLoading,
1655
1695
  onSelectProvider,
1656
1696
  onDoneVerifying,
1697
+ onRefresh,
1657
1698
  onClose
1658
1699
  }) {
1659
1700
  const isDark = theme === "dark";
@@ -1678,16 +1719,56 @@ function KycModalTemplate({
1678
1719
  "--pollar-modal-subtitle-size": "0.9rem"
1679
1720
  };
1680
1721
  return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1681
- /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-header", children: [
1682
- /* @__PURE__ */ jsx("h2", { className: "pollar-kyc-title", children: "Identity verification" }),
1683
- /* @__PURE__ */ jsxs("p", { className: "pollar-kyc-subtitle", children: [
1684
- step === "select_provider" && "Choose your verification provider",
1685
- step === "verifying" && `Verifying with ${selectedProvider?.name}`,
1686
- step === "polling" && "Waiting for verification result",
1687
- step === "done" && "Verification complete"
1722
+ /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
1723
+ /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-header-text", children: [
1724
+ /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Identity verification" }),
1725
+ /* @__PURE__ */ jsxs("p", { className: "pollar-kyc-subtitle", children: [
1726
+ step === "select_provider" && "Choose your verification provider",
1727
+ step === "verifying" && `Verifying with ${selectedProvider?.name}`,
1728
+ step === "polling" && "Waiting for verification result",
1729
+ step === "done" && "Verification complete"
1730
+ ] })
1731
+ ] }),
1732
+ /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
1733
+ step === "select_provider" && /* @__PURE__ */ jsx(
1734
+ "button",
1735
+ {
1736
+ type: "button",
1737
+ className: "pollar-modal-close",
1738
+ onClick: onRefresh,
1739
+ disabled: isLoading,
1740
+ "aria-label": "Refresh",
1741
+ title: "Refresh providers",
1742
+ children: /* @__PURE__ */ jsx(
1743
+ "svg",
1744
+ {
1745
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
1746
+ width: "16",
1747
+ height: "16",
1748
+ viewBox: "0 0 16 16",
1749
+ fill: "none",
1750
+ "aria-hidden": true,
1751
+ children: /* @__PURE__ */ jsx(
1752
+ "path",
1753
+ {
1754
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
1755
+ stroke: "currentColor",
1756
+ strokeWidth: "1.6",
1757
+ strokeLinecap: "round",
1758
+ strokeLinejoin: "round"
1759
+ }
1760
+ )
1761
+ }
1762
+ )
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
1688
1766
  ] })
1689
1767
  ] }),
1690
- step === "select_provider" && /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-providers", children: [
1768
+ step === "select_provider" && (isLoading && providers.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
1769
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
1770
+ /* @__PURE__ */ jsx("span", { children: "Loading providers\u2026" })
1771
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-providers", children: [
1691
1772
  providers.length === 0 && /* @__PURE__ */ jsx("p", { style: { color: "var(--pollar-muted)", textAlign: "center" }, children: "No providers available for your country." }),
1692
1773
  providers.map((p) => /* @__PURE__ */ jsxs(
1693
1774
  "button",
@@ -1703,7 +1784,7 @@ function KycModalTemplate({
1703
1784
  },
1704
1785
  p.id
1705
1786
  ))
1706
- ] }),
1787
+ ] })),
1707
1788
  step === "verifying" && selectedProvider && /* @__PURE__ */ jsxs(Fragment, { children: [
1708
1789
  /* @__PURE__ */ jsx("div", { className: "pollar-kyc-iframe-wrap", children: session?.kycUrl ? /* @__PURE__ */ jsx("iframe", { className: "pollar-kyc-iframe", src: session.kycUrl, title: "KYC verification", allow: "camera; microphone" }) : /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-iframe-mock", children: [
1709
1790
  /* @__PURE__ */ jsx("span", { children: "\u{1F512}" }),
@@ -1736,10 +1817,13 @@ function KycModal({ onClose, country = "MX", level = "basic", onApproved }) {
1736
1817
  const [isLoading, setIsLoading] = useState(false);
1737
1818
  const client = getClient();
1738
1819
  const { theme = "light", accentColor = "#005DB4" } = styles;
1739
- useEffect(() => {
1820
+ const loadProviders = useCallback(() => {
1740
1821
  setIsLoading(true);
1741
- getClient().getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
1822
+ return getClient().getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
1742
1823
  }, [getClient, country]);
1824
+ useEffect(() => {
1825
+ void loadProviders();
1826
+ }, [loadProviders]);
1743
1827
  async function handleSelectProvider(provider) {
1744
1828
  setSelectedProvider(provider);
1745
1829
  setIsLoading(true);
@@ -1785,6 +1869,7 @@ function KycModal({ onClose, country = "MX", level = "basic", onApproved }) {
1785
1869
  isLoading,
1786
1870
  onSelectProvider: handleSelectProvider,
1787
1871
  onDoneVerifying: handleDoneVerifying,
1872
+ onRefresh: () => void loadProviders(),
1788
1873
  onClose
1789
1874
  }
1790
1875
  ) });
@@ -1840,8 +1925,8 @@ function EmailCodeInput({ email, onSubmit }) {
1840
1925
  ] });
1841
1926
  }
1842
1927
  var GithubButton = ({ disabled, onClick }) => {
1843
- return /* @__PURE__ */ jsxs("button", { className: "github-button", disabled, onClick, children: [
1844
- /* @__PURE__ */ jsx("svg", { className: "github-button-icon", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx(
1928
+ return /* @__PURE__ */ jsxs("button", { className: "pollar-github-button", disabled, onClick, children: [
1929
+ /* @__PURE__ */ jsx("svg", { className: "pollar-github-button-icon", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx(
1845
1930
  "path",
1846
1931
  {
1847
1932
  fillRule: "evenodd",
@@ -1849,14 +1934,14 @@ var GithubButton = ({ disabled, onClick }) => {
1849
1934
  clipRule: "evenodd"
1850
1935
  }
1851
1936
  ) }),
1852
- /* @__PURE__ */ jsx("span", { className: "github-button-contents", children: "GitHub" })
1937
+ /* @__PURE__ */ jsx("span", { className: "pollar-github-button-contents", children: "GitHub" })
1853
1938
  ] });
1854
1939
  };
1855
1940
  var GoogleButton = ({ disabled, onClick }) => {
1856
- return /* @__PURE__ */ jsxs("button", { className: "gsi-material-button", disabled, onClick, children: [
1857
- /* @__PURE__ */ jsx("div", { className: "gsi-material-button-state" }),
1858
- /* @__PURE__ */ jsxs("div", { className: "gsi-material-button-content-wrapper", children: [
1859
- /* @__PURE__ */ jsx("div", { className: "gsi-material-button-icon", children: /* @__PURE__ */ jsxs("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", style: { display: "block" }, children: [
1941
+ return /* @__PURE__ */ jsxs("button", { className: "pollar-gsi-material-button", disabled, onClick, children: [
1942
+ /* @__PURE__ */ jsx("div", { className: "pollar-gsi-material-button-state" }),
1943
+ /* @__PURE__ */ jsxs("div", { className: "pollar-gsi-material-button-content-wrapper", children: [
1944
+ /* @__PURE__ */ jsx("div", { className: "pollar-gsi-material-button-icon", children: /* @__PURE__ */ jsxs("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", style: { display: "block" }, children: [
1860
1945
  /* @__PURE__ */ jsx(
1861
1946
  "path",
1862
1947
  {
@@ -1887,7 +1972,7 @@ var GoogleButton = ({ disabled, onClick }) => {
1887
1972
  ),
1888
1973
  /* @__PURE__ */ jsx("path", { fill: "none", d: "M0 0h48v48H0z" })
1889
1974
  ] }) }),
1890
- /* @__PURE__ */ jsx("span", { className: "gsi-material-button-contents", children: "Google" }),
1975
+ /* @__PURE__ */ jsx("span", { className: "pollar-gsi-material-button-contents", children: "Google" }),
1891
1976
  /* @__PURE__ */ jsx("span", { style: { display: "none" }, children: "Google" })
1892
1977
  ] })
1893
1978
  ] });
@@ -2093,7 +2178,7 @@ function LoginModalTemplate({
2093
2178
  placeholder: "you@email.com",
2094
2179
  value: email,
2095
2180
  disabled: isLoading,
2096
- className: "pollar-email-input",
2181
+ className: "pollar-input",
2097
2182
  onChange: (e) => onEmailChange?.(e.target.value),
2098
2183
  onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
2099
2184
  }
@@ -2322,7 +2407,7 @@ function PrivyLoginSubmodal({
2322
2407
  placeholder: "you@email.com",
2323
2408
  value: email,
2324
2409
  disabled: isLoading,
2325
- className: "pollar-email-input",
2410
+ className: "pollar-input",
2326
2411
  onChange: (e) => setEmail(e.target.value),
2327
2412
  onKeyDown: (e) => e.key === "Enter" && handleEmailSubmit()
2328
2413
  }
@@ -2572,7 +2657,7 @@ function flattenInstructions(instr) {
2572
2657
  }
2573
2658
  continue;
2574
2659
  }
2575
- let value = "";
2660
+ let value;
2576
2661
  if (typeof v === "string" || typeof v === "number") value = String(v);
2577
2662
  else if (Array.isArray(v)) value = v.filter((x) => typeof x === "string" || typeof x === "number").join(", ");
2578
2663
  else continue;
@@ -2667,7 +2752,7 @@ function RampWidgetTemplate({
2667
2752
  /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onRefresh, disabled: refreshing, "aria-label": "Refresh", children: /* @__PURE__ */ jsx(
2668
2753
  "svg",
2669
2754
  {
2670
- className: refreshing ? "pollar-modal-refresh-icon spinning" : "pollar-modal-refresh-icon",
2755
+ className: refreshing ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
2671
2756
  width: "16",
2672
2757
  height: "16",
2673
2758
  viewBox: "0 0 16 16",
@@ -2689,12 +2774,12 @@ function RampWidgetTemplate({
2689
2774
  ] })
2690
2775
  ] }),
2691
2776
  step === "input" && /* @__PURE__ */ jsxs(Fragment, { children: [
2692
- /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-tabs", children: [
2777
+ /* @__PURE__ */ jsxs("div", { className: "pollar-tabs", children: [
2693
2778
  /* @__PURE__ */ jsx(
2694
2779
  "button",
2695
2780
  {
2696
2781
  type: "button",
2697
- className: "pollar-ramp-tab",
2782
+ className: "pollar-tab",
2698
2783
  "data-active": direction === "onramp",
2699
2784
  onClick: () => onDirectionChange("onramp"),
2700
2785
  children: "Buy"
@@ -2704,7 +2789,7 @@ function RampWidgetTemplate({
2704
2789
  "button",
2705
2790
  {
2706
2791
  type: "button",
2707
- className: "pollar-ramp-tab",
2792
+ className: "pollar-tab",
2708
2793
  "data-active": direction === "offramp",
2709
2794
  onClick: () => onDirectionChange("offramp"),
2710
2795
  children: "Sell"
@@ -2713,7 +2798,10 @@ function RampWidgetTemplate({
2713
2798
  ] }),
2714
2799
  /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-field", children: [
2715
2800
  /* @__PURE__ */ jsx("label", { className: "pollar-ramp-label", children: "Country" }),
2716
- countriesLoading ? /* @__PURE__ */ jsx("div", { className: "pollar-ramp-input pollar-ramp-input-loading", children: "Loading countries\u2026" }) : countries.length === 0 ? /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "No ramp providers available on this network yet." }) : /* @__PURE__ */ jsx("select", { className: "pollar-ramp-input", value: country, onChange: (e) => onCountryChange(e.target.value), children: countries.map((c) => /* @__PURE__ */ jsxs("option", { value: c.code, children: [
2801
+ countriesLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-input pollar-select-loading", children: [
2802
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
2803
+ /* @__PURE__ */ jsx("span", { children: "Loading countries\u2026" })
2804
+ ] }) : countries.length === 0 ? /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "No ramp providers available on this network yet." }) : /* @__PURE__ */ jsx("select", { className: "pollar-ramp-input", value: country, onChange: (e) => onCountryChange(e.target.value), children: countries.map((c) => /* @__PURE__ */ jsxs("option", { value: c.code, children: [
2717
2805
  flagEmoji(c.code),
2718
2806
  " ",
2719
2807
  c.code,
@@ -2751,10 +2839,13 @@ function RampWidgetTemplate({
2751
2839
  )
2752
2840
  ] })
2753
2841
  ] }),
2754
- step === "loading_quote" && /* @__PURE__ */ jsx("div", { className: "pollar-ramp-loading", children: LOADING_STEPS.map((text, i) => /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-loading-row", children: [
2755
- /* @__PURE__ */ jsx("div", { className: "pollar-ramp-loading-dot" }),
2756
- /* @__PURE__ */ jsx("span", { children: text })
2757
- ] }, i)) }),
2842
+ step === "loading_quote" && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-loading", children: [
2843
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner pollar-ramp-loading-spinner" }),
2844
+ LOADING_STEPS.map((text, i) => /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-loading-row", children: [
2845
+ /* @__PURE__ */ jsx("div", { className: "pollar-ramp-loading-dot" }),
2846
+ /* @__PURE__ */ jsx("span", { children: text })
2847
+ ] }, i))
2848
+ ] }),
2758
2849
  step === "select_route" && /* @__PURE__ */ jsxs(Fragment, { children: [
2759
2850
  /* @__PURE__ */ jsx("div", { className: "pollar-ramp-route-list", children: quotes.map((q, i) => /* @__PURE__ */ jsx(RouteDisplay, { quote: q, onSelect: onSelectQuote }, i)) }),
2760
2851
  /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" })
@@ -2794,7 +2885,10 @@ function RampWidgetTemplate({
2794
2885
  className: "pollar-btn-primary",
2795
2886
  disabled: requiredFields.some((f) => !isFieldValid(f, fieldValues[f.key])) || isLoading,
2796
2887
  onClick: onContactContinue,
2797
- children: isLoading ? "Starting\u2026" : "Continue"
2888
+ children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
2889
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
2890
+ "Starting\u2026"
2891
+ ] }) : "Continue"
2798
2892
  }
2799
2893
  )
2800
2894
  ] })
@@ -2806,7 +2900,10 @@ function RampWidgetTemplate({
2806
2900
  ] }),
2807
2901
  /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
2808
2902
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: "Status" }),
2809
- /* @__PURE__ */ jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsx("code", { style: { color: txStatus === "completed" ? "var(--pollar-success-text)" : void 0 }, children: txStatus ? STATUS_LABEL[txStatus] : "Processing" }) })
2903
+ /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-value", children: [
2904
+ /* @__PURE__ */ jsx("code", { style: { color: txStatus === "completed" ? "var(--pollar-success-text)" : void 0 }, children: txStatus ? STATUS_LABEL[txStatus] : "Processing" }),
2905
+ txStatus !== "completed" && txStatus !== "failed" && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-label": "Checking status" })
2906
+ ] })
2810
2907
  ] }),
2811
2908
  stellarTxHash && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
2812
2909
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: "Stellar tx" }),
@@ -2827,8 +2924,26 @@ function RampWidgetTemplate({
2827
2924
  "aria-label": "View on Stellar Expert",
2828
2925
  title: "View on Stellar Expert",
2829
2926
  children: /* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
2830
- /* @__PURE__ */ jsx("path", { d: "M6 3H3v8h8V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
2831
- /* @__PURE__ */ jsx("path", { d: "M8.5 2.5h3v3M11 3L6.5 7.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2927
+ /* @__PURE__ */ jsx(
2928
+ "path",
2929
+ {
2930
+ d: "M6 3H3v8h8V8",
2931
+ stroke: "currentColor",
2932
+ strokeWidth: "1.5",
2933
+ strokeLinecap: "round",
2934
+ strokeLinejoin: "round"
2935
+ }
2936
+ ),
2937
+ /* @__PURE__ */ jsx(
2938
+ "path",
2939
+ {
2940
+ d: "M8.5 2.5h3v3M11 3L6.5 7.5",
2941
+ stroke: "currentColor",
2942
+ strokeWidth: "1.5",
2943
+ strokeLinecap: "round",
2944
+ strokeLinejoin: "round"
2945
+ }
2946
+ )
2832
2947
  ] })
2833
2948
  }
2834
2949
  )
@@ -2856,7 +2971,10 @@ function RampWidgetTemplate({
2856
2971
  "Continue at ",
2857
2972
  provider
2858
2973
  ] }),
2859
- canComplete && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", disabled: completing, onClick: onCompleteWithdraw, children: completing ? "Submitting\u2026" : "I've completed KYC \u2014 withdraw" }),
2974
+ canComplete && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", disabled: completing, onClick: onCompleteWithdraw, children: completing ? /* @__PURE__ */ jsxs(Fragment, { children: [
2975
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
2976
+ "Submitting\u2026"
2977
+ ] }) : "I've completed KYC \u2014 withdraw" }),
2860
2978
  errorMsg && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", style: { color: "var(--pollar-error-text)" }, children: errorMsg }),
2861
2979
  /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: txStatus === "completed" ? "Done" : "Close" })
2862
2980
  ] }),
@@ -3309,6 +3427,7 @@ function AssetSelect({
3309
3427
  options,
3310
3428
  onChange,
3311
3429
  loading = false,
3430
+ loadingLabel,
3312
3431
  disabled = false,
3313
3432
  appGroupLabel = "App assets",
3314
3433
  otherGroupLabel = "Other assets",
@@ -3318,7 +3437,10 @@ function AssetSelect({
3318
3437
  const otherAssets = options.filter((o) => !o.enabledInApp);
3319
3438
  return /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
3320
3439
  /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: label }),
3321
- loading ? /* @__PURE__ */ jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxs(
3440
+ loading ? loadingLabel ? /* @__PURE__ */ jsxs("div", { className: "pollar-input pollar-select-loading", children: [
3441
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
3442
+ /* @__PURE__ */ jsx("span", { children: loadingLabel })
3443
+ ] }) : /* @__PURE__ */ jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxs(
3322
3444
  "select",
3323
3445
  {
3324
3446
  className: "pollar-input pollar-send-select",
@@ -3559,6 +3681,7 @@ function SendModalTemplate({
3559
3681
  isInProgress,
3560
3682
  onClose,
3561
3683
  onBack,
3684
+ onRefresh,
3562
3685
  onSelectAsset,
3563
3686
  onAmountChange,
3564
3687
  onDestinationChange,
@@ -3603,7 +3726,41 @@ function SendModalTemplate({
3603
3726
  showBack && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onBack, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
3604
3727
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
3605
3728
  ] }),
3606
- !isInProgress && /* @__PURE__ */ jsx("div", { className: "pollar-modal-header-actions", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) }) })
3729
+ !isInProgress && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
3730
+ step === "form" && /* @__PURE__ */ jsx(
3731
+ "button",
3732
+ {
3733
+ type: "button",
3734
+ className: "pollar-modal-close",
3735
+ onClick: onRefresh,
3736
+ disabled: isLoadingBalance,
3737
+ "aria-label": "Refresh",
3738
+ title: "Refresh balances",
3739
+ children: /* @__PURE__ */ jsx(
3740
+ "svg",
3741
+ {
3742
+ className: isLoadingBalance ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
3743
+ width: "16",
3744
+ height: "16",
3745
+ viewBox: "0 0 16 16",
3746
+ fill: "none",
3747
+ "aria-hidden": true,
3748
+ children: /* @__PURE__ */ jsx(
3749
+ "path",
3750
+ {
3751
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
3752
+ stroke: "currentColor",
3753
+ strokeWidth: "1.6",
3754
+ strokeLinecap: "round",
3755
+ strokeLinejoin: "round"
3756
+ }
3757
+ )
3758
+ }
3759
+ )
3760
+ }
3761
+ ),
3762
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
3763
+ ] })
3607
3764
  ] }),
3608
3765
  step === "form" && /* @__PURE__ */ jsxs(Fragment, { children: [
3609
3766
  /* @__PURE__ */ jsx(
@@ -3612,6 +3769,7 @@ function SendModalTemplate({
3612
3769
  label: "Asset",
3613
3770
  value: selectedKey,
3614
3771
  loading: isLoadingBalance,
3772
+ loadingLabel: "Loading assets\u2026",
3615
3773
  options: assets.map((a) => ({
3616
3774
  key: assetKey3(a),
3617
3775
  code: a.code,
@@ -3720,7 +3878,7 @@ function SendModal({ onClose }) {
3720
3878
  []
3721
3879
  );
3722
3880
  const balanceData = walletBalance.step === "loaded" ? walletBalance.data : null;
3723
- const allAssets = balanceData?.balances ?? [];
3881
+ const allAssets = (balanceData?.balances ?? []).filter((b) => b.chain === void 0 || b.chain === "STELLAR");
3724
3882
  const sortedAssets = [
3725
3883
  ...allAssets.filter((b) => b.enabledInApp),
3726
3884
  ...allAssets.filter((b) => !b.enabledInApp && (b.type === "native" || parseFloat(b.balance) > 0))
@@ -3813,6 +3971,7 @@ function SendModal({ onClose }) {
3813
3971
  isInProgress,
3814
3972
  onClose,
3815
3973
  onBack: handleBack,
3974
+ onRefresh: () => void refreshWalletBalance(),
3816
3975
  onSelectAsset: setSelectedAsset,
3817
3976
  onAmountChange: setAmount,
3818
3977
  onDestinationChange: setDestination,
@@ -3955,7 +4114,6 @@ function SwapModalTemplate({
3955
4114
  /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
3956
4115
  ] })
3957
4116
  ] }),
3958
- step === "form" && configLoading && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "Loading swap options\u2026" }),
3959
4117
  step === "form" && !configLoading && swapUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Swap is not available for this app." }),
3960
4118
  step === "form" && !swapUnavailable && /* @__PURE__ */ jsxs(Fragment, { children: [
3961
4119
  smartUnsupported && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Swaps are not yet available for smart (passkey) wallets." }),
@@ -3964,7 +4122,8 @@ function SwapModalTemplate({
3964
4122
  {
3965
4123
  label: "You pay",
3966
4124
  value: sellKey,
3967
- loading: isLoadingData,
4125
+ loading: isLoadingData || configLoading,
4126
+ loadingLabel: "Loading assets\u2026",
3968
4127
  disabled: configLoading,
3969
4128
  options: sellOptions.map((o) => ({
3970
4129
  key: assetOptionKey(o),
@@ -4006,7 +4165,8 @@ function SwapModalTemplate({
4006
4165
  {
4007
4166
  label: "You receive",
4008
4167
  value: buyKey,
4009
- loading: isLoadingData,
4168
+ loading: isLoadingData || configLoading,
4169
+ loadingLabel: "Loading assets\u2026",
4010
4170
  disabled: configLoading,
4011
4171
  options: buyOptions.map((o) => ({
4012
4172
  key: assetOptionKey(o),
@@ -4068,18 +4228,24 @@ function SwapModalTemplate({
4068
4228
  ),
4069
4229
  /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
4070
4230
  /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Route" }),
4071
- /* @__PURE__ */ jsx(
4231
+ configLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-input pollar-select-loading", children: [
4232
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
4233
+ /* @__PURE__ */ jsx("span", { children: "Loading routes\u2026" })
4234
+ ] }) : /* @__PURE__ */ jsx(
4072
4235
  "select",
4073
4236
  {
4074
4237
  className: "pollar-input pollar-send-select",
4075
4238
  value: provider,
4076
- disabled: configLoading || providers.length === 0,
4239
+ disabled: providers.length === 0,
4077
4240
  onChange: (e) => onProviderChange(e.target.value),
4078
- children: providers.length === 0 ? /* @__PURE__ */ jsx("option", { value: provider, children: configLoading ? "Loading\u2026" : PROVIDER_LABELS[provider] }) : providers.map((p) => /* @__PURE__ */ jsx("option", { value: p, children: PROVIDER_LABELS[p] }, p))
4241
+ children: providers.length === 0 ? /* @__PURE__ */ jsx("option", { value: provider, children: PROVIDER_LABELS[provider] }) : providers.map((p) => /* @__PURE__ */ jsx("option", { value: p, children: PROVIDER_LABELS[p] }, p))
4079
4242
  }
4080
4243
  )
4081
4244
  ] }),
4082
- quoteLoading && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "Fetching best price\u2026" }),
4245
+ quoteLoading && /* @__PURE__ */ jsxs("div", { className: "pollar-send-hint pollar-inline-loading", children: [
4246
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
4247
+ "Fetching best price\u2026"
4248
+ ] }),
4083
4249
  !quoteLoading && quoteError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: quoteError }),
4084
4250
  !quoteLoading && !quoteError && quote && selectedBuy && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote", children: [
4085
4251
  /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
@@ -4217,7 +4383,9 @@ function SwapModal({ onClose }) {
4217
4383
  const balances = walletBalance.step === "loaded" ? walletBalance.data.balances : [];
4218
4384
  const assetRecords = enabledAssets.step === "loaded" ? enabledAssets.data.assets : [];
4219
4385
  const isLoadingData = walletBalance.step === "loading" || enabledAssets.step === "loading";
4220
- const sellOptions = balances.filter((b) => b.type === "native" || !b.trustlineRemoved).map((b) => ({ ref: toRef(b), code: b.code, issuer: b.issuer, available: b.available, enabledInApp: b.enabledInApp }));
4386
+ const sellOptions = balances.filter(
4387
+ (b) => b.type != null && (b.type === "native" || !b.trustlineRemoved)
4388
+ ).map((b) => ({ ref: toRef(b), code: b.code, issuer: b.issuer, available: b.available, enabledInApp: b.enabledInApp }));
4221
4389
  const buyKeyOfSell = selectedSell ? `${selectedSell.code}:${selectedSell.issuer ?? "native"}` : "";
4222
4390
  const optKey = (o) => `${o.code}:${o.issuer ?? "native"}`;
4223
4391
  const enabledBuy = assetRecords.map((a) => ({
@@ -4413,7 +4581,14 @@ var PROVIDER_LABELS2 = {
4413
4581
  blend: "Blend",
4414
4582
  defindex: "DeFindex"
4415
4583
  };
4416
- 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
+ ];
4417
4592
  function formatAmount4(value) {
4418
4593
  const n = parseFloat(value);
4419
4594
  return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
@@ -4427,6 +4602,11 @@ function EarnModal({ onClose }) {
4427
4602
  earnWithdraw,
4428
4603
  tx: transaction,
4429
4604
  wallet,
4605
+ walletBalance,
4606
+ refreshWalletBalance,
4607
+ enabledAssets,
4608
+ refreshAssets,
4609
+ setTrustline,
4430
4610
  network,
4431
4611
  styles
4432
4612
  } = usePollar();
@@ -4444,6 +4624,7 @@ function EarnModal({ onClose }) {
4444
4624
  const [amount, setAmount] = useState("");
4445
4625
  const [loadingOpps, setLoadingOpps] = useState(false);
4446
4626
  const [formError, setFormError] = useState("");
4627
+ const [refreshing, setRefreshing] = useState(false);
4447
4628
  const [showXdr, setShowXdr] = useState(false);
4448
4629
  const [copied, setCopied] = useState(false);
4449
4630
  const copyTimerRef = useRef(null);
@@ -4457,6 +4638,10 @@ function EarnModal({ onClose }) {
4457
4638
  useEffect(() => {
4458
4639
  void loadProviders();
4459
4640
  }, [loadProviders]);
4641
+ useEffect(() => {
4642
+ void refreshWalletBalance();
4643
+ void refreshAssets();
4644
+ }, [refreshWalletBalance, refreshAssets]);
4460
4645
  useEffect(() => {
4461
4646
  if (!provider) return;
4462
4647
  let cancelled = false;
@@ -4500,6 +4685,22 @@ function EarnModal({ onClose }) {
4500
4685
  const withdrawUnit = position?.withdrawUnit ?? "asset";
4501
4686
  const assetCode = selectedOpportunity?.asset.code ?? "";
4502
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;
4503
4704
  const hash = transaction.step === "success" ? transaction.hash : null;
4504
4705
  const buildData = "buildData" in transaction ? transaction.buildData : null;
4505
4706
  const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
@@ -4507,7 +4708,9 @@ function EarnModal({ onClose }) {
4507
4708
  const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
4508
4709
  const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
4509
4710
  const txTitle = isInProgress ? tab === "deposit" ? "Depositing\u2026" : "Withdrawing\u2026" : transaction.step === "success" ? "Done!" : transaction.step === "error" ? tab === "deposit" ? "Deposit failed" : "Withdraw failed" : "Confirm";
4510
- 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;
4511
4714
  const cssVars = {
4512
4715
  "--pollar-accent": accentColor,
4513
4716
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
@@ -4540,11 +4743,27 @@ function EarnModal({ onClose }) {
4540
4743
  setFormError("Enter a valid amount");
4541
4744
  return;
4542
4745
  }
4746
+ if (tab === "deposit" && walletAvailable != null && parsed > parseFloat(walletAvailable)) {
4747
+ setFormError("Amount exceeds your wallet balance");
4748
+ return;
4749
+ }
4543
4750
  if (tab === "withdraw" && position && parsed > parseFloat(position.withdrawable)) {
4544
4751
  setFormError("Amount exceeds your position");
4545
4752
  return;
4546
4753
  }
4547
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
+ }
4548
4767
  const params = { provider, opportunity: opportunityId, amount };
4549
4768
  const outcome = tab === "deposit" ? await earnDeposit(params) : await earnWithdraw(params);
4550
4769
  if (outcome.status === "success" || outcome.status === "pending") {
@@ -4575,146 +4794,217 @@ function EarnModal({ onClose }) {
4575
4794
  setCopied(false);
4576
4795
  refreshPosition();
4577
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
+ }
4578
4811
  const title = step === "form" ? "Earn" : txTitle;
4579
- return /* @__PURE__ */ jsx("div", { className: "pollar-overlay", onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-send-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
4580
- /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
4581
- /* @__PURE__ */ jsxs("div", { className: "pollar-send-header-left", children: [
4582
- showBack && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleBack, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
4583
- /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
4584
- ] }),
4585
- !isInProgress && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
4586
- ] }),
4587
- step === "form" && providersLoading && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "Loading Earn options\u2026" }),
4588
- step === "form" && earnUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
4589
- step === "form" && !earnUnavailable && /* @__PURE__ */ jsxs(Fragment, { children: [
4590
- smartUnsupported && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
4591
- /* @__PURE__ */ jsxs("div", { className: "pollar-earn-tabs", children: [
4592
- /* @__PURE__ */ jsx(
4593
- "button",
4594
- {
4595
- type: "button",
4596
- className: `pollar-earn-tab${tab === "deposit" ? " pollar-earn-tab-active" : ""}`,
4597
- onClick: () => {
4598
- setTab("deposit");
4599
- setFormError("");
4600
- },
4601
- children: "Deposit"
4602
- }
4603
- ),
4604
- /* @__PURE__ */ jsx(
4605
- "button",
4606
- {
4607
- type: "button",
4608
- className: `pollar-earn-tab${tab === "withdraw" ? " pollar-earn-tab-active" : ""}`,
4609
- onClick: () => {
4610
- setTab("withdraw");
4611
- setFormError("");
4612
- },
4613
- children: "Withdraw"
4614
- }
4615
- )
4616
- ] }),
4617
- providers && providers.length > 1 && /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
4618
- /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Provider" }),
4619
- /* @__PURE__ */ jsx(
4620
- "select",
4621
- {
4622
- className: "pollar-input pollar-send-select",
4623
- value: provider ?? "",
4624
- onChange: (e) => setProvider(e.target.value),
4625
- children: providers.map((p) => /* @__PURE__ */ jsx("option", { value: p, children: PROVIDER_LABELS2[p] }, p))
4626
- }
4627
- )
4628
- ] }),
4629
- /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
4630
- /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
4631
- /* @__PURE__ */ jsx(
4632
- "select",
4633
- {
4634
- className: "pollar-input pollar-send-select",
4635
- value: opportunityId,
4636
- disabled: loadingOpps || opportunities.length === 0,
4637
- onChange: (e) => setOpportunityId(e.target.value),
4638
- children: opportunities.length === 0 ? /* @__PURE__ */ jsx("option", { value: "", children: loadingOpps ? "Loading\u2026" : "None available" }) : opportunities.map((o) => /* @__PURE__ */ jsxs("option", { value: o.id, children: [
4639
- o.name,
4640
- " \xB7 ",
4641
- o.apy.toFixed(2),
4642
- "% APY"
4643
- ] }, o.id))
4644
- }
4645
- )
4646
- ] }),
4647
- selectedOpportunity && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote", children: [
4648
- /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
4649
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Your position" }),
4650
- /* @__PURE__ */ jsxs("span", { children: [
4651
- position ? formatAmount4(position.balance) : "\u2026",
4652
- " ",
4653
- assetCode
4812
+ return /* @__PURE__ */ jsx("div", { className: "pollar-overlay", onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ 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__ */ jsxs("div", { className: "pollar-modal-header", children: [
4821
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-header-left", children: [
4822
+ showBack && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleBack, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
4823
+ /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
4824
+ ] }),
4825
+ /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
4826
+ step === "form" && !earnUnavailable && !smartUnsupported && /* @__PURE__ */ 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__ */ 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__ */ 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__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
4654
4858
  ] })
4655
4859
  ] }),
4656
- /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
4657
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "APY" }),
4658
- /* @__PURE__ */ jsxs("span", { className: "pollar-earn-live", children: [
4659
- selectedOpportunity.apy.toFixed(2),
4660
- "%"
4661
- ] })
4662
- ] })
4663
- ] }),
4664
- /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
4665
- /* @__PURE__ */ jsxs("div", { className: "pollar-send-label-row", children: [
4666
- /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: tab === "deposit" ? "Amount" : "Withdraw amount" }),
4667
- tab === "withdraw" && position && /* @__PURE__ */ jsxs(
4668
- "button",
4669
- {
4670
- type: "button",
4671
- className: "pollar-swap-custom-toggle",
4672
- onClick: () => setAmount(position.withdrawable),
4673
- children: [
4860
+ step === "form" && earnUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
4861
+ step === "form" && !earnUnavailable && /* @__PURE__ */ jsxs(Fragment, { children: [
4862
+ smartUnsupported && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
4863
+ /* @__PURE__ */ jsxs("div", { className: "pollar-tabs", children: [
4864
+ /* @__PURE__ */ 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__ */ 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__ */ jsxs("div", { className: "pollar-send-field", children: [
4892
+ /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Provider" }),
4893
+ /* @__PURE__ */ 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__ */ jsx("option", { value: p, children: PROVIDER_LABELS2[p] }, p))
4900
+ }
4901
+ )
4902
+ ] }),
4903
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
4904
+ /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
4905
+ loadingOpps || providersLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-input pollar-select-loading", children: [
4906
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
4907
+ /* @__PURE__ */ jsx("span", { children: "Loading options\u2026" })
4908
+ ] }) : /* @__PURE__ */ 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__ */ jsx("option", { value: "", children: "None available" }) : opportunities.map((o) => /* @__PURE__ */ 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__ */ jsxs("div", { className: "pollar-swap-quote", children: [
4925
+ tab === "deposit" && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
4926
+ /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "In your wallet" }),
4927
+ /* @__PURE__ */ jsxs("span", { children: [
4928
+ walletAvailable != null ? formatAmount4(walletAvailable) : "\u2026",
4929
+ " ",
4930
+ assetCode
4931
+ ] })
4932
+ ] }),
4933
+ /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
4934
+ /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Your position" }),
4935
+ /* @__PURE__ */ jsxs("span", { children: [
4936
+ position ? formatAmount4(position.balance) : "\u2026",
4937
+ " ",
4938
+ assetCode
4939
+ ] })
4940
+ ] }),
4941
+ /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
4942
+ /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "APY" }),
4943
+ /* @__PURE__ */ jsxs("span", { className: "pollar-earn-live", children: [
4944
+ selectedOpportunity.apy.toFixed(2),
4945
+ "%"
4946
+ ] })
4947
+ ] })
4948
+ ] }),
4949
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
4950
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-label-row", children: [
4951
+ /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: tab === "deposit" ? "Amount" : "Withdraw amount" }),
4952
+ tab === "deposit" && walletAvailable != null && /* @__PURE__ */ 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__ */ jsxs("button", { type: "button", className: "pollar-swap-custom-toggle", onClick: () => setAmount(position.withdrawable), children: [
4674
4959
  "Max: ",
4675
4960
  formatAmount4(position.withdrawable),
4676
4961
  " ",
4677
4962
  amountUnitLabel
4678
- ]
4679
- }
4680
- )
4963
+ ] })
4964
+ ] }),
4965
+ /* @__PURE__ */ jsxs("div", { className: "pollar-earn-amount", children: [
4966
+ /* @__PURE__ */ 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__ */ jsx("span", { className: "pollar-earn-amount-unit", children: amountUnitLabel })
4978
+ ] })
4979
+ ] }),
4980
+ formError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: formError }),
4981
+ depositNeedsTrustline && selectedOpportunity && /* @__PURE__ */ 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__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary", onClick: () => void handleSubmit(), disabled: !canSubmit, children: tab === "deposit" ? depositNeedsTrustline ? "Enable trustline & deposit" : "Deposit" : "Withdraw" }) })
4681
4987
  ] }),
4682
- /* @__PURE__ */ jsxs("div", { className: "pollar-earn-amount", children: [
4683
- /* @__PURE__ */ jsx(
4684
- "input",
4685
- {
4686
- className: "pollar-input",
4687
- type: "text",
4688
- inputMode: "decimal",
4689
- placeholder: "0.00",
4690
- value: amount,
4691
- onChange: (e) => setAmount(e.target.value)
4692
- }
4693
- ),
4694
- amountUnitLabel && /* @__PURE__ */ jsx("span", { className: "pollar-earn-amount-unit", children: amountUnitLabel })
4695
- ] })
4696
- ] }),
4697
- formError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: formError }),
4698
- /* @__PURE__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary", onClick: () => void handleSubmit(), disabled: !canSubmit, children: tab === "deposit" ? "Deposit" : "Withdraw" }) })
4699
- ] }),
4700
- step === "tx" && /* @__PURE__ */ jsx(
4701
- TxStatusView,
4702
- {
4703
- transaction,
4704
- showXdr,
4705
- copied,
4706
- explorerUrl,
4707
- walletType,
4708
- onSignAndSend: () => {
4709
- },
4710
- onToggleXdr: () => setShowXdr((v) => !v),
4711
- onCopyHash: handleCopyHash,
4712
- onRetry: () => void handleRetry(),
4713
- onDone: onClose
4714
- }
4715
- ),
4716
- /* @__PURE__ */ jsx(PollarModalFooter, {})
4717
- ] }) });
4988
+ step === "tx" && /* @__PURE__ */ 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__ */ jsx(PollarModalFooter, {})
5005
+ ]
5006
+ }
5007
+ ) });
4718
5008
  }
4719
5009
  function describeDevice(s) {
4720
5010
  if (s.deviceLabel) return s.deviceLabel;
@@ -4807,30 +5097,46 @@ function SessionsModalTemplate({
4807
5097
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
4808
5098
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Active sessions" }),
4809
5099
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
4810
- /* @__PURE__ */ jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
4811
- /* @__PURE__ */ jsxs(
4812
- "svg",
4813
- {
4814
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
4815
- width: "13",
4816
- height: "13",
4817
- viewBox: "0 0 13 13",
4818
- fill: "none",
4819
- "aria-hidden": true,
4820
- children: [
4821
- /* @__PURE__ */ jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
4822
- /* @__PURE__ */ jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
4823
- ]
4824
- }
4825
- ),
4826
- "Refresh"
4827
- ] }),
5100
+ /* @__PURE__ */ 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__ */ 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__ */ 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
+ ),
4828
5132
  /* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
4829
5133
  ] })
4830
5134
  ] }),
4831
5135
  /* @__PURE__ */ jsxs("div", { className: "pollar-sessions-list", children: [
4832
- state.step === "idle" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
4833
- isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
5136
+ (state.step === "idle" || isLoading) && /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
5137
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
5138
+ /* @__PURE__ */ jsx("span", { children: "Loading\u2026" })
5139
+ ] }),
4834
5140
  state.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: state.message }),
4835
5141
  state.step === "loaded" && sessions.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No active sessions." }),
4836
5142
  sessions.map((s) => {
@@ -4859,7 +5165,10 @@ function SessionsModalTemplate({
4859
5165
  className: "pollar-sessions-item-revoke",
4860
5166
  onClick: () => onRevoke(s.familyId),
4861
5167
  disabled: isRevoking || signingOutEverywhere,
4862
- children: isRevoking ? "Revoking\u2026" : "Revoke"
5168
+ children: isRevoking ? /* @__PURE__ */ jsxs(Fragment, { children: [
5169
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }),
5170
+ "Revoking\u2026"
5171
+ ] }) : "Revoke"
4863
5172
  }
4864
5173
  )
4865
5174
  ] }, s.familyId);
@@ -4872,7 +5181,10 @@ function SessionsModalTemplate({
4872
5181
  onClick: onLogoutEverywhere,
4873
5182
  disabled: signingOutEverywhere || otherCount === 0,
4874
5183
  title: otherCount === 0 ? "No other devices to sign out" : void 0,
4875
- children: signingOutEverywhere ? "Signing out\u2026" : "Sign out everywhere"
5184
+ children: signingOutEverywhere ? /* @__PURE__ */ jsxs(Fragment, { children: [
5185
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }),
5186
+ "Signing out\u2026"
5187
+ ] }) : "Sign out everywhere"
4876
5188
  }
4877
5189
  ) }),
4878
5190
  /* @__PURE__ */ jsx(PollarModalFooter, {})
@@ -5089,7 +5401,7 @@ function renderSummary(summary) {
5089
5401
  last = m.index + address.length;
5090
5402
  }
5091
5403
  if (parts.length === 0) return /* @__PURE__ */ jsx("span", { className: "pollar-hist-item-title", children: summary });
5092
- if (last < summary.length) parts.push(/* @__PURE__ */ jsx("span", { children: summary.slice(last) }, key++));
5404
+ if (last < summary.length) parts.push(/* @__PURE__ */ jsx("span", { children: summary.slice(last) }, key));
5093
5405
  return parts;
5094
5406
  }
5095
5407
  function TxHistoryModalTemplate({
@@ -5137,30 +5449,47 @@ function TxHistoryModalTemplate({
5137
5449
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
5138
5450
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
5139
5451
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
5140
- /* @__PURE__ */ jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
5141
- /* @__PURE__ */ jsxs(
5142
- "svg",
5143
- {
5144
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
5145
- width: "13",
5146
- height: "13",
5147
- viewBox: "0 0 13 13",
5148
- fill: "none",
5149
- "aria-hidden": true,
5150
- children: [
5151
- /* @__PURE__ */ jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
5152
- /* @__PURE__ */ jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
5153
- ]
5154
- }
5155
- ),
5156
- "Refresh"
5157
- ] }),
5452
+ /* @__PURE__ */ 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__ */ 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__ */ 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
+ ),
5158
5484
  /* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
5159
5485
  ] })
5160
5486
  ] }),
5161
5487
  /* @__PURE__ */ jsxs("div", { className: "pollar-hist-list", children: [
5162
5488
  txHistory.step === "idle" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Click Refresh to load transactions." }),
5163
- isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
5489
+ isLoading && /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
5490
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
5491
+ /* @__PURE__ */ jsx("span", { children: "Loading\u2026" })
5492
+ ] }),
5164
5493
  txHistory.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
5165
5494
  txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
5166
5495
  records.map((record) => {
@@ -5302,11 +5631,23 @@ function cropAddress2(address) {
5302
5631
  if (address.length <= 16) return address;
5303
5632
  return `${address.slice(0, 8)}...${address.slice(-8)}`;
5304
5633
  }
5305
- function BalanceItem({ record }) {
5634
+ var CHAIN_TAG = {
5635
+ STELLAR: { label: "Stellar", color: "#7d00ff" },
5636
+ POLYGON: { label: "Polygon", color: "#8247e5" },
5637
+ SOLANA: { label: "Solana", color: "#14f195" }
5638
+ };
5639
+ function ChainTag({ chain }) {
5640
+ const tag = CHAIN_TAG[chain] ?? { label: chain, color: "#6b7280" };
5641
+ return /* @__PURE__ */ jsx("span", { className: "pollar-bal-chain-tag", style: { "--pollar-chain-color": tag.color }, children: tag.label });
5642
+ }
5643
+ function BalanceItem({ record, showChain }) {
5306
5644
  const balanceDiffers = record.balance !== record.available;
5307
5645
  return /* @__PURE__ */ jsxs("div", { className: "pollar-bal-item", children: [
5308
5646
  /* @__PURE__ */ jsxs("div", { className: "pollar-bal-asset-info", children: [
5309
- /* @__PURE__ */ jsx("span", { className: "pollar-bal-asset", children: record.code }),
5647
+ /* @__PURE__ */ jsxs("span", { className: "pollar-bal-asset-code-row", children: [
5648
+ /* @__PURE__ */ jsx("span", { className: "pollar-bal-asset", children: record.code }),
5649
+ showChain && record.chain && /* @__PURE__ */ jsx(ChainTag, { chain: record.chain })
5650
+ ] }),
5310
5651
  record.issuer && /* @__PURE__ */ jsxs("span", { className: "pollar-bal-issuer", children: [
5311
5652
  /* @__PURE__ */ jsx("span", { className: "pollar-bal-issuer-addr", children: cropAddress2(record.issuer) }),
5312
5653
  /* @__PURE__ */ jsx(CopyButton, { value: record.issuer, label: "Copy issuer address", className: "pollar-copy-btn-sm" })
@@ -5353,24 +5694,38 @@ function WalletBalanceModalTemplate({
5353
5694
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
5354
5695
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
5355
5696
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
5356
- /* @__PURE__ */ jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
5357
- /* @__PURE__ */ jsxs(
5358
- "svg",
5359
- {
5360
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
5361
- width: "13",
5362
- height: "13",
5363
- viewBox: "0 0 13 13",
5364
- fill: "none",
5365
- "aria-hidden": true,
5366
- children: [
5367
- /* @__PURE__ */ jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
5368
- /* @__PURE__ */ jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
5369
- ]
5370
- }
5371
- ),
5372
- "Refresh"
5373
- ] }),
5697
+ /* @__PURE__ */ jsx(
5698
+ "button",
5699
+ {
5700
+ type: "button",
5701
+ className: "pollar-modal-close",
5702
+ onClick: onRefresh,
5703
+ disabled: isLoading,
5704
+ "aria-label": "Refresh",
5705
+ title: "Refresh",
5706
+ children: /* @__PURE__ */ jsx(
5707
+ "svg",
5708
+ {
5709
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
5710
+ width: "16",
5711
+ height: "16",
5712
+ viewBox: "0 0 16 16",
5713
+ fill: "none",
5714
+ "aria-hidden": true,
5715
+ children: /* @__PURE__ */ jsx(
5716
+ "path",
5717
+ {
5718
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
5719
+ stroke: "currentColor",
5720
+ strokeWidth: "1.6",
5721
+ strokeLinecap: "round",
5722
+ strokeLinejoin: "round"
5723
+ }
5724
+ )
5725
+ }
5726
+ )
5727
+ }
5728
+ ),
5374
5729
  /* @__PURE__ */ jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
5375
5730
  ] })
5376
5731
  ] }),
@@ -5378,7 +5733,10 @@ function WalletBalanceModalTemplate({
5378
5733
  /* @__PURE__ */ jsx("span", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
5379
5734
  /* @__PURE__ */ jsx(CopyButton, { value: walletAddress, label: "Copy wallet address" })
5380
5735
  ] }),
5381
- isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
5736
+ isLoading && /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
5737
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
5738
+ /* @__PURE__ */ jsx("span", { children: "Loading\u2026" })
5739
+ ] }),
5382
5740
  walletBalance.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
5383
5741
  data && !data.exists && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-empty", children: [
5384
5742
  "Account not found on ",
@@ -5386,7 +5744,7 @@ function WalletBalanceModalTemplate({
5386
5744
  "."
5387
5745
  ] }),
5388
5746
  data?.exists && data.balances.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No balances found." }),
5389
- data?.exists && data.balances.length > 0 && /* @__PURE__ */ jsx("div", { className: "pollar-bal-list", children: data.balances.map((b) => /* @__PURE__ */ jsx(BalanceItem, { record: b }, b.code + (b.issuer ?? ""))) }),
5747
+ data?.exists && data.balances.length > 0 && /* @__PURE__ */ jsx("div", { className: "pollar-bal-list", children: data.balances.map((b) => /* @__PURE__ */ jsx(BalanceItem, { record: b, showChain: data.multichain === true }, (b.chain ?? "") + b.code + (b.issuer ?? ""))) }),
5390
5748
  /* @__PURE__ */ jsx(PollarModalFooter, {})
5391
5749
  ] });
5392
5750
  }
@@ -5589,6 +5947,9 @@ function PollarProvider({
5589
5947
  const [sendModalOpen, setSendModalOpen] = useState(false);
5590
5948
  const [swapModalOpen, setSwapModalOpen] = useState(false);
5591
5949
  const [earnModalOpen, setEarnModalOpen] = useState(false);
5950
+ const [sendModalKey, setSendModalKey] = useState(0);
5951
+ const [swapModalKey, setSwapModalKey] = useState(0);
5952
+ const [earnModalKey, setEarnModalKey] = useState(0);
5592
5953
  const [receiveModalOpen, setReceiveModalOpen] = useState(false);
5593
5954
  const [sessionsModalOpen, setSessionsModalOpen] = useState(false);
5594
5955
  const [distributionRulesModalOpen, setDistributionRulesModalOpen] = useState(false);
@@ -5631,21 +5992,33 @@ function PollarProvider({
5631
5992
  setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
5632
5993
  openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
5633
5994
  // send / receive
5634
- openSendModal: () => setSendModalOpen(true),
5995
+ openSendModal: () => {
5996
+ pollarClient.resetTransactionState();
5997
+ setSendModalKey((k) => k + 1);
5998
+ setSendModalOpen(true);
5999
+ },
5635
6000
  openReceiveModal: () => setReceiveModalOpen(true),
5636
6001
  // swap
5637
6002
  getSwapConfig: () => pollarClient.getSwapConfig(),
5638
6003
  getSwapTokens: () => pollarClient.getSwapTokens(),
5639
6004
  getSwapQuote: (params) => pollarClient.getSwapQuote(params),
5640
6005
  swap: (quote, opts) => pollarClient.swap(quote, opts),
5641
- openSwapModal: () => setSwapModalOpen(true),
6006
+ openSwapModal: () => {
6007
+ pollarClient.resetTransactionState();
6008
+ setSwapModalKey((k) => k + 1);
6009
+ setSwapModalOpen(true);
6010
+ },
5642
6011
  // earn
5643
6012
  getEarnProviders: () => pollarClient.getEarnProviders(),
5644
6013
  getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider),
5645
6014
  getEarnPosition: (params) => pollarClient.getEarnPosition(params),
5646
6015
  earnDeposit: (params) => pollarClient.earnDeposit(params),
5647
6016
  earnWithdraw: (params) => pollarClient.earnWithdraw(params),
5648
- openEarnModal: () => setEarnModalOpen(true),
6017
+ openEarnModal: () => {
6018
+ pollarClient.resetTransactionState();
6019
+ setEarnModalKey((k) => k + 1);
6020
+ setEarnModalOpen(true);
6021
+ },
5649
6022
  // sessions
5650
6023
  sessions,
5651
6024
  openSessionsModal: () => setSessionsModalOpen(true),
@@ -5699,9 +6072,9 @@ function PollarProvider({
5699
6072
  txHistoryModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
5700
6073
  walletBalanceModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
5701
6074
  enabledAssetsModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setEnabledAssetsModalOpen(false), children: /* @__PURE__ */ jsx(EnabledAssetsModal, { onClose: () => setEnabledAssetsModalOpen(false) }) }),
5702
- sendModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }),
5703
- swapModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }),
5704
- earnModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setEarnModalOpen(false), children: /* @__PURE__ */ jsx(EarnModal, { onClose: () => setEarnModalOpen(false) }) }),
6075
+ sendModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }, sendModalKey),
6076
+ swapModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }, swapModalKey),
6077
+ earnModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setEarnModalOpen(false), children: /* @__PURE__ */ jsx(EarnModal, { onClose: () => setEarnModalOpen(false) }) }, earnModalKey),
5705
6078
  receiveModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
5706
6079
  sessionsModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
5707
6080
  distributionRulesModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setDistributionRulesModalOpen(false), children: /* @__PURE__ */ jsx(DistributionRulesModal, { onClose: () => setDistributionRulesModalOpen(false) }) })
@@ -5735,7 +6108,7 @@ function createPollarAdapterHook(key) {
5735
6108
  };
5736
6109
  }
5737
6110
  function ButtonLogo() {
5738
- return /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
6111
+ return /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "pollar-wallet-btn-logo" });
5739
6112
  }
5740
6113
  function cropWallet(address) {
5741
6114
  if (address.length <= 12) return address;
@@ -5768,23 +6141,23 @@ function WalletButtonTemplate({
5768
6141
  onLogin
5769
6142
  }) {
5770
6143
  if (!walletAddress) {
5771
- return /* @__PURE__ */ jsxs("button", { type: "button", className: "wallet-login-btn", style: { backgroundColor: accentColor }, onClick: onLogin, children: [
6144
+ return /* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-wallet-login-btn", style: { backgroundColor: accentColor }, onClick: onLogin, children: [
5772
6145
  /* @__PURE__ */ jsx(ButtonLogo, {}),
5773
6146
  "Login with Pollar"
5774
6147
  ] });
5775
6148
  }
5776
- return /* @__PURE__ */ jsxs("div", { className: "wallet-wrapper", ref: wrapperRef, children: [
6149
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, children: [
5777
6150
  /* @__PURE__ */ jsxs(
5778
6151
  "button",
5779
6152
  {
5780
- className: "wallet-btn",
6153
+ className: "pollar-wallet-btn",
5781
6154
  style: { backgroundColor: accentColor },
5782
6155
  onClick: isInProgress ? void 0 : onToggleOpen,
5783
6156
  disabled: isInProgress,
5784
6157
  "aria-busy": isInProgress,
5785
6158
  children: [
5786
- /* @__PURE__ */ jsx("span", { className: "wallet-btn-label", children: cropWallet(walletAddress) }),
5787
- isInProgress ? /* @__PURE__ */ jsxs("svg", { className: "wallet-btn-spinner", viewBox: "0 0 12 12", width: "12", height: "12", fill: "none", "aria-hidden": true, children: [
6159
+ /* @__PURE__ */ jsx("span", { className: "pollar-wallet-btn-label", children: cropWallet(walletAddress) }),
6160
+ isInProgress ? /* @__PURE__ */ jsxs("svg", { className: "pollar-wallet-btn-spinner", viewBox: "0 0 12 12", width: "12", height: "12", fill: "none", "aria-hidden": true, children: [
5788
6161
  /* @__PURE__ */ jsx("circle", { cx: "6", cy: "6", r: "4.5", stroke: "rgba(255,255,255,0.35)", strokeWidth: "1.5" }),
5789
6162
  /* @__PURE__ */ jsx(
5790
6163
  "circle",
@@ -5802,7 +6175,7 @@ function WalletButtonTemplate({
5802
6175
  ] }) : /* @__PURE__ */ jsx(
5803
6176
  "svg",
5804
6177
  {
5805
- className: `wallet-chevron${open ? " open" : ""}`,
6178
+ className: `pollar-wallet-chevron${open ? " pollar-open" : ""}`,
5806
6179
  viewBox: "0 0 12 12",
5807
6180
  fill: "none",
5808
6181
  stroke: "currentColor",
@@ -5815,12 +6188,12 @@ function WalletButtonTemplate({
5815
6188
  ]
5816
6189
  }
5817
6190
  ),
5818
- open && /* @__PURE__ */ jsxs("div", { className: "wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
6191
+ open && /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
5819
6192
  showCreateAccount && /* @__PURE__ */ jsxs(Fragment, { children: [
5820
6193
  /* @__PURE__ */ jsxs(
5821
6194
  "button",
5822
6195
  {
5823
- className: "wallet-dropdown-item",
6196
+ className: "pollar-wallet-dropdown-item",
5824
6197
  style: { color: itemColor },
5825
6198
  onClick: onCreateAccount,
5826
6199
  disabled: creatingAccount,
@@ -5848,9 +6221,9 @@ function WalletButtonTemplate({
5848
6221
  ]
5849
6222
  }
5850
6223
  ),
5851
- /* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" })
6224
+ /* @__PURE__ */ jsx("div", { className: "pollar-wallet-dropdown-divider" })
5852
6225
  ] }),
5853
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSend, children: [
6226
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onSend, children: [
5854
6227
  /* @__PURE__ */ jsxs(
5855
6228
  "svg",
5856
6229
  {
@@ -5870,7 +6243,7 @@ function WalletButtonTemplate({
5870
6243
  ),
5871
6244
  "Send"
5872
6245
  ] }),
5873
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onReceive, children: [
6246
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onReceive, children: [
5874
6247
  /* @__PURE__ */ jsxs(
5875
6248
  "svg",
5876
6249
  {
@@ -5891,8 +6264,8 @@ function WalletButtonTemplate({
5891
6264
  ),
5892
6265
  "Receive"
5893
6266
  ] }),
5894
- /* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" }),
5895
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
6267
+ /* @__PURE__ */ jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6268
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
5896
6269
  /* @__PURE__ */ jsxs(
5897
6270
  "svg",
5898
6271
  {
@@ -5912,7 +6285,7 @@ function WalletButtonTemplate({
5912
6285
  ),
5913
6286
  copied ? "Copied!" : "Copy address"
5914
6287
  ] }),
5915
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onWalletBalance, children: [
6288
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onWalletBalance, children: [
5916
6289
  /* @__PURE__ */ jsxs(
5917
6290
  "svg",
5918
6291
  {
@@ -5933,7 +6306,7 @@ function WalletButtonTemplate({
5933
6306
  ),
5934
6307
  "Wallet balance"
5935
6308
  ] }),
5936
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onTxHistory, children: [
6309
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onTxHistory, children: [
5937
6310
  /* @__PURE__ */ jsxs(
5938
6311
  "svg",
5939
6312
  {
@@ -5956,8 +6329,8 @@ function WalletButtonTemplate({
5956
6329
  ),
5957
6330
  "Transaction history"
5958
6331
  ] }),
5959
- /* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" }),
5960
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
6332
+ /* @__PURE__ */ jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6333
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
5961
6334
  /* @__PURE__ */ jsxs(
5962
6335
  "svg",
5963
6336
  {
@@ -5979,7 +6352,7 @@ function WalletButtonTemplate({
5979
6352
  ),
5980
6353
  "Buy / Sell"
5981
6354
  ] }),
5982
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
6355
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
5983
6356
  /* @__PURE__ */ jsxs(
5984
6357
  "svg",
5985
6358
  {
@@ -6000,7 +6373,7 @@ function WalletButtonTemplate({
6000
6373
  ),
6001
6374
  "Identity verification"
6002
6375
  ] }),
6003
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
6376
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
6004
6377
  /* @__PURE__ */ jsxs(
6005
6378
  "svg",
6006
6379
  {
@@ -6023,7 +6396,7 @@ function WalletButtonTemplate({
6023
6396
  ),
6024
6397
  "Distribution rules"
6025
6398
  ] }),
6026
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
6399
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
6027
6400
  /* @__PURE__ */ jsxs(
6028
6401
  "svg",
6029
6402
  {
@@ -6044,8 +6417,8 @@ function WalletButtonTemplate({
6044
6417
  ),
6045
6418
  "Active sessions"
6046
6419
  ] }),
6047
- /* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" }),
6048
- /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item danger", onClick: onLogout, children: [
6420
+ /* @__PURE__ */ jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6421
+ /* @__PURE__ */ jsxs("button", { className: "pollar-wallet-dropdown-item pollar-danger", onClick: onLogout, children: [
6049
6422
  /* @__PURE__ */ jsxs(
6050
6423
  "svg",
6051
6424
  {