@pollar/react 0.10.1-rc.9 → 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.9"
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
  }
@@ -2574,7 +2659,7 @@ function flattenInstructions(instr) {
2574
2659
  }
2575
2660
  continue;
2576
2661
  }
2577
- let value = "";
2662
+ let value;
2578
2663
  if (typeof v === "string" || typeof v === "number") value = String(v);
2579
2664
  else if (Array.isArray(v)) value = v.filter((x) => typeof x === "string" || typeof x === "number").join(", ");
2580
2665
  else continue;
@@ -2669,7 +2754,7 @@ function RampWidgetTemplate({
2669
2754
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: onRefresh, disabled: refreshing, "aria-label": "Refresh", children: /* @__PURE__ */ jsxRuntime.jsx(
2670
2755
  "svg",
2671
2756
  {
2672
- className: refreshing ? "pollar-modal-refresh-icon spinning" : "pollar-modal-refresh-icon",
2757
+ className: refreshing ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
2673
2758
  width: "16",
2674
2759
  height: "16",
2675
2760
  viewBox: "0 0 16 16",
@@ -2691,12 +2776,12 @@ function RampWidgetTemplate({
2691
2776
  ] })
2692
2777
  ] }),
2693
2778
  step === "input" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2694
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-tabs", children: [
2779
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tabs", children: [
2695
2780
  /* @__PURE__ */ jsxRuntime.jsx(
2696
2781
  "button",
2697
2782
  {
2698
2783
  type: "button",
2699
- className: "pollar-ramp-tab",
2784
+ className: "pollar-tab",
2700
2785
  "data-active": direction === "onramp",
2701
2786
  onClick: () => onDirectionChange("onramp"),
2702
2787
  children: "Buy"
@@ -2706,7 +2791,7 @@ function RampWidgetTemplate({
2706
2791
  "button",
2707
2792
  {
2708
2793
  type: "button",
2709
- className: "pollar-ramp-tab",
2794
+ className: "pollar-tab",
2710
2795
  "data-active": direction === "offramp",
2711
2796
  onClick: () => onDirectionChange("offramp"),
2712
2797
  children: "Sell"
@@ -2715,7 +2800,10 @@ function RampWidgetTemplate({
2715
2800
  ] }),
2716
2801
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
2717
2802
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Country" }),
2718
- 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: [
2719
2807
  flagEmoji(c.code),
2720
2808
  " ",
2721
2809
  c.code,
@@ -2753,10 +2841,13 @@ function RampWidgetTemplate({
2753
2841
  )
2754
2842
  ] })
2755
2843
  ] }),
2756
- 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: [
2757
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-loading-dot" }),
2758
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: text })
2759
- ] }, 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
+ ] }),
2760
2851
  step === "select_route" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2761
2852
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-list", children: quotes.map((q, i) => /* @__PURE__ */ jsxRuntime.jsx(RouteDisplay, { quote: q, onSelect: onSelectQuote }, i)) }),
2762
2853
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" })
@@ -2796,7 +2887,10 @@ function RampWidgetTemplate({
2796
2887
  className: "pollar-btn-primary",
2797
2888
  disabled: requiredFields.some((f) => !isFieldValid(f, fieldValues[f.key])) || isLoading,
2798
2889
  onClick: onContactContinue,
2799
- 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"
2800
2894
  }
2801
2895
  )
2802
2896
  ] })
@@ -2808,7 +2902,10 @@ function RampWidgetTemplate({
2808
2902
  ] }),
2809
2903
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
2810
2904
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Status" }),
2811
- /* @__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
+ ] })
2812
2909
  ] }),
2813
2910
  stellarTxHash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
2814
2911
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Stellar tx" }),
@@ -2829,8 +2926,26 @@ function RampWidgetTemplate({
2829
2926
  "aria-label": "View on Stellar Expert",
2830
2927
  title: "View on Stellar Expert",
2831
2928
  children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
2832
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 3H3v8h8V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
2833
- /* @__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
+ )
2834
2949
  ] })
2835
2950
  }
2836
2951
  )
@@ -2858,7 +2973,10 @@ function RampWidgetTemplate({
2858
2973
  "Continue at ",
2859
2974
  provider
2860
2975
  ] }),
2861
- 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" }),
2862
2980
  errorMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", style: { color: "var(--pollar-error-text)" }, children: errorMsg }),
2863
2981
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: txStatus === "completed" ? "Done" : "Close" })
2864
2982
  ] }),
@@ -3311,6 +3429,7 @@ function AssetSelect({
3311
3429
  options,
3312
3430
  onChange,
3313
3431
  loading = false,
3432
+ loadingLabel,
3314
3433
  disabled = false,
3315
3434
  appGroupLabel = "App assets",
3316
3435
  otherGroupLabel = "Other assets",
@@ -3320,7 +3439,10 @@ function AssetSelect({
3320
3439
  const otherAssets = options.filter((o) => !o.enabledInApp);
3321
3440
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
3322
3441
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: label }),
3323
- 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(
3324
3446
  "select",
3325
3447
  {
3326
3448
  className: "pollar-input pollar-send-select",
@@ -3561,6 +3683,7 @@ function SendModalTemplate({
3561
3683
  isInProgress,
3562
3684
  onClose,
3563
3685
  onBack,
3686
+ onRefresh,
3564
3687
  onSelectAsset,
3565
3688
  onAmountChange,
3566
3689
  onDestinationChange,
@@ -3605,7 +3728,41 @@ function SendModalTemplate({
3605
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" }) }) }),
3606
3729
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: title })
3607
3730
  ] }),
3608
- !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
+ ] })
3609
3766
  ] }),
3610
3767
  step === "form" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3611
3768
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3614,6 +3771,7 @@ function SendModalTemplate({
3614
3771
  label: "Asset",
3615
3772
  value: selectedKey,
3616
3773
  loading: isLoadingBalance,
3774
+ loadingLabel: "Loading assets\u2026",
3617
3775
  options: assets.map((a) => ({
3618
3776
  key: assetKey3(a),
3619
3777
  code: a.code,
@@ -3815,6 +3973,7 @@ function SendModal({ onClose }) {
3815
3973
  isInProgress,
3816
3974
  onClose,
3817
3975
  onBack: handleBack,
3976
+ onRefresh: () => void refreshWalletBalance(),
3818
3977
  onSelectAsset: setSelectedAsset,
3819
3978
  onAmountChange: setAmount,
3820
3979
  onDestinationChange: setDestination,
@@ -3957,7 +4116,6 @@ function SwapModalTemplate({
3957
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" }) }) })
3958
4117
  ] })
3959
4118
  ] }),
3960
- step === "form" && configLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: "Loading swap options\u2026" }),
3961
4119
  step === "form" && !configLoading && swapUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Swap is not available for this app." }),
3962
4120
  step === "form" && !swapUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3963
4121
  smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Swaps are not yet available for smart (passkey) wallets." }),
@@ -3966,7 +4124,8 @@ function SwapModalTemplate({
3966
4124
  {
3967
4125
  label: "You pay",
3968
4126
  value: sellKey,
3969
- loading: isLoadingData,
4127
+ loading: isLoadingData || configLoading,
4128
+ loadingLabel: "Loading assets\u2026",
3970
4129
  disabled: configLoading,
3971
4130
  options: sellOptions.map((o) => ({
3972
4131
  key: assetOptionKey(o),
@@ -4008,7 +4167,8 @@ function SwapModalTemplate({
4008
4167
  {
4009
4168
  label: "You receive",
4010
4169
  value: buyKey,
4011
- loading: isLoadingData,
4170
+ loading: isLoadingData || configLoading,
4171
+ loadingLabel: "Loading assets\u2026",
4012
4172
  disabled: configLoading,
4013
4173
  options: buyOptions.map((o) => ({
4014
4174
  key: assetOptionKey(o),
@@ -4070,18 +4230,24 @@ function SwapModalTemplate({
4070
4230
  ),
4071
4231
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4072
4232
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Route" }),
4073
- /* @__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(
4074
4237
  "select",
4075
4238
  {
4076
4239
  className: "pollar-input pollar-send-select",
4077
4240
  value: provider,
4078
- disabled: configLoading || providers.length === 0,
4241
+ disabled: providers.length === 0,
4079
4242
  onChange: (e) => onProviderChange(e.target.value),
4080
- 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))
4081
4244
  }
4082
4245
  )
4083
4246
  ] }),
4084
- 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
+ ] }),
4085
4251
  !quoteLoading && quoteError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: quoteError }),
4086
4252
  !quoteLoading && !quoteError && quote && selectedBuy && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote", children: [
4087
4253
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
@@ -4415,7 +4581,14 @@ var PROVIDER_LABELS2 = {
4415
4581
  blend: "Blend",
4416
4582
  defindex: "DeFindex"
4417
4583
  };
4418
- 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
+ ];
4419
4592
  function formatAmount4(value) {
4420
4593
  const n = parseFloat(value);
4421
4594
  return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
@@ -4429,6 +4602,11 @@ function EarnModal({ onClose }) {
4429
4602
  earnWithdraw,
4430
4603
  tx: transaction,
4431
4604
  wallet,
4605
+ walletBalance,
4606
+ refreshWalletBalance,
4607
+ enabledAssets,
4608
+ refreshAssets,
4609
+ setTrustline,
4432
4610
  network,
4433
4611
  styles
4434
4612
  } = usePollar();
@@ -4446,6 +4624,7 @@ function EarnModal({ onClose }) {
4446
4624
  const [amount, setAmount] = react.useState("");
4447
4625
  const [loadingOpps, setLoadingOpps] = react.useState(false);
4448
4626
  const [formError, setFormError] = react.useState("");
4627
+ const [refreshing, setRefreshing] = react.useState(false);
4449
4628
  const [showXdr, setShowXdr] = react.useState(false);
4450
4629
  const [copied, setCopied] = react.useState(false);
4451
4630
  const copyTimerRef = react.useRef(null);
@@ -4459,6 +4638,10 @@ function EarnModal({ onClose }) {
4459
4638
  react.useEffect(() => {
4460
4639
  void loadProviders();
4461
4640
  }, [loadProviders]);
4641
+ react.useEffect(() => {
4642
+ void refreshWalletBalance();
4643
+ void refreshAssets();
4644
+ }, [refreshWalletBalance, refreshAssets]);
4462
4645
  react.useEffect(() => {
4463
4646
  if (!provider) return;
4464
4647
  let cancelled = false;
@@ -4502,6 +4685,22 @@ function EarnModal({ onClose }) {
4502
4685
  const withdrawUnit = position?.withdrawUnit ?? "asset";
4503
4686
  const assetCode = selectedOpportunity?.asset.code ?? "";
4504
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;
4505
4704
  const hash = transaction.step === "success" ? transaction.hash : null;
4506
4705
  const buildData = "buildData" in transaction ? transaction.buildData : null;
4507
4706
  const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
@@ -4509,7 +4708,9 @@ function EarnModal({ onClose }) {
4509
4708
  const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
4510
4709
  const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
4511
4710
  const txTitle = isInProgress ? tab === "deposit" ? "Depositing\u2026" : "Withdrawing\u2026" : transaction.step === "success" ? "Done!" : transaction.step === "error" ? tab === "deposit" ? "Deposit failed" : "Withdraw failed" : "Confirm";
4512
- 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;
4513
4714
  const cssVars = {
4514
4715
  "--pollar-accent": accentColor,
4515
4716
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
@@ -4542,11 +4743,27 @@ function EarnModal({ onClose }) {
4542
4743
  setFormError("Enter a valid amount");
4543
4744
  return;
4544
4745
  }
4746
+ if (tab === "deposit" && walletAvailable != null && parsed > parseFloat(walletAvailable)) {
4747
+ setFormError("Amount exceeds your wallet balance");
4748
+ return;
4749
+ }
4545
4750
  if (tab === "withdraw" && position && parsed > parseFloat(position.withdrawable)) {
4546
4751
  setFormError("Amount exceeds your position");
4547
4752
  return;
4548
4753
  }
4549
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
+ }
4550
4767
  const params = { provider, opportunity: opportunityId, amount };
4551
4768
  const outcome = tab === "deposit" ? await earnDeposit(params) : await earnWithdraw(params);
4552
4769
  if (outcome.status === "success" || outcome.status === "pending") {
@@ -4577,146 +4794,217 @@ function EarnModal({ onClose }) {
4577
4794
  setCopied(false);
4578
4795
  refreshPosition();
4579
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
+ }
4580
4811
  const title = step === "form" ? "Earn" : txTitle;
4581
- 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: [
4582
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
4583
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-header-left", children: [
4584
- 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" }) }) }),
4585
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: title })
4586
- ] }),
4587
- !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" }) }) })
4588
- ] }),
4589
- step === "form" && providersLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: "Loading Earn options\u2026" }),
4590
- step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
4591
- step === "form" && !earnUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4592
- smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
4593
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-tabs", children: [
4594
- /* @__PURE__ */ jsxRuntime.jsx(
4595
- "button",
4596
- {
4597
- type: "button",
4598
- className: `pollar-earn-tab${tab === "deposit" ? " pollar-earn-tab-active" : ""}`,
4599
- onClick: () => {
4600
- setTab("deposit");
4601
- setFormError("");
4602
- },
4603
- children: "Deposit"
4604
- }
4605
- ),
4606
- /* @__PURE__ */ jsxRuntime.jsx(
4607
- "button",
4608
- {
4609
- type: "button",
4610
- className: `pollar-earn-tab${tab === "withdraw" ? " pollar-earn-tab-active" : ""}`,
4611
- onClick: () => {
4612
- setTab("withdraw");
4613
- setFormError("");
4614
- },
4615
- children: "Withdraw"
4616
- }
4617
- )
4618
- ] }),
4619
- providers && providers.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4620
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Provider" }),
4621
- /* @__PURE__ */ jsxRuntime.jsx(
4622
- "select",
4623
- {
4624
- className: "pollar-input pollar-send-select",
4625
- value: provider ?? "",
4626
- onChange: (e) => setProvider(e.target.value),
4627
- children: providers.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p, children: PROVIDER_LABELS2[p] }, p))
4628
- }
4629
- )
4630
- ] }),
4631
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4632
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
4633
- /* @__PURE__ */ jsxRuntime.jsx(
4634
- "select",
4635
- {
4636
- className: "pollar-input pollar-send-select",
4637
- value: opportunityId,
4638
- disabled: loadingOpps || opportunities.length === 0,
4639
- onChange: (e) => setOpportunityId(e.target.value),
4640
- 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: [
4641
- o.name,
4642
- " \xB7 ",
4643
- o.apy.toFixed(2),
4644
- "% APY"
4645
- ] }, o.id))
4646
- }
4647
- )
4648
- ] }),
4649
- selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote", children: [
4650
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4651
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "Your position" }),
4652
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4653
- position ? formatAmount4(position.balance) : "\u2026",
4654
- " ",
4655
- 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" }) }) })
4656
4858
  ] })
4657
4859
  ] }),
4658
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4659
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "APY" }),
4660
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
4661
- selectedOpportunity.apy.toFixed(2),
4662
- "%"
4663
- ] })
4664
- ] })
4665
- ] }),
4666
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4667
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-label-row", children: [
4668
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: tab === "deposit" ? "Amount" : "Withdraw amount" }),
4669
- tab === "withdraw" && position && /* @__PURE__ */ jsxRuntime.jsxs(
4670
- "button",
4671
- {
4672
- type: "button",
4673
- className: "pollar-swap-custom-toggle",
4674
- onClick: () => setAmount(position.withdrawable),
4675
- 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: [
4676
4959
  "Max: ",
4677
4960
  formatAmount4(position.withdrawable),
4678
4961
  " ",
4679
4962
  amountUnitLabel
4680
- ]
4681
- }
4682
- )
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" }) })
4683
4987
  ] }),
4684
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-amount", children: [
4685
- /* @__PURE__ */ jsxRuntime.jsx(
4686
- "input",
4687
- {
4688
- className: "pollar-input",
4689
- type: "text",
4690
- inputMode: "decimal",
4691
- placeholder: "0.00",
4692
- value: amount,
4693
- onChange: (e) => setAmount(e.target.value)
4694
- }
4695
- ),
4696
- amountUnitLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-earn-amount-unit", children: amountUnitLabel })
4697
- ] })
4698
- ] }),
4699
- formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
4700
- /* @__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" }) })
4701
- ] }),
4702
- step === "tx" && /* @__PURE__ */ jsxRuntime.jsx(
4703
- TxStatusView,
4704
- {
4705
- transaction,
4706
- showXdr,
4707
- copied,
4708
- explorerUrl,
4709
- walletType,
4710
- onSignAndSend: () => {
4711
- },
4712
- onToggleXdr: () => setShowXdr((v) => !v),
4713
- onCopyHash: handleCopyHash,
4714
- onRetry: () => void handleRetry(),
4715
- onDone: onClose
4716
- }
4717
- ),
4718
- /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
4719
- ] }) });
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
+ ) });
4720
5008
  }
4721
5009
  function describeDevice(s) {
4722
5010
  if (s.deviceLabel) return s.deviceLabel;
@@ -4809,30 +5097,46 @@ function SessionsModalTemplate({
4809
5097
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
4810
5098
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Active sessions" }),
4811
5099
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
4812
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
4813
- /* @__PURE__ */ jsxRuntime.jsxs(
4814
- "svg",
4815
- {
4816
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
4817
- width: "13",
4818
- height: "13",
4819
- viewBox: "0 0 13 13",
4820
- fill: "none",
4821
- "aria-hidden": true,
4822
- children: [
4823
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
4824
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
4825
- ]
4826
- }
4827
- ),
4828
- "Refresh"
4829
- ] }),
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
+ ),
4830
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" }) }) })
4831
5133
  ] })
4832
5134
  ] }),
4833
5135
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-sessions-list", children: [
4834
- state.step === "idle" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
4835
- 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
+ ] }),
4836
5140
  state.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: state.message }),
4837
5141
  state.step === "loaded" && sessions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No active sessions." }),
4838
5142
  sessions.map((s) => {
@@ -4861,7 +5165,10 @@ function SessionsModalTemplate({
4861
5165
  className: "pollar-sessions-item-revoke",
4862
5166
  onClick: () => onRevoke(s.familyId),
4863
5167
  disabled: isRevoking || signingOutEverywhere,
4864
- 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"
4865
5172
  }
4866
5173
  )
4867
5174
  ] }, s.familyId);
@@ -4874,7 +5181,10 @@ function SessionsModalTemplate({
4874
5181
  onClick: onLogoutEverywhere,
4875
5182
  disabled: signingOutEverywhere || otherCount === 0,
4876
5183
  title: otherCount === 0 ? "No other devices to sign out" : void 0,
4877
- 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"
4878
5188
  }
4879
5189
  ) }),
4880
5190
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
@@ -5091,7 +5401,7 @@ function renderSummary(summary) {
5091
5401
  last = m.index + address.length;
5092
5402
  }
5093
5403
  if (parts.length === 0) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-title", children: summary });
5094
- 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));
5095
5405
  return parts;
5096
5406
  }
5097
5407
  function TxHistoryModalTemplate({
@@ -5139,30 +5449,47 @@ function TxHistoryModalTemplate({
5139
5449
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
5140
5450
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
5141
5451
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
5142
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
5143
- /* @__PURE__ */ jsxRuntime.jsxs(
5144
- "svg",
5145
- {
5146
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
5147
- width: "13",
5148
- height: "13",
5149
- viewBox: "0 0 13 13",
5150
- fill: "none",
5151
- "aria-hidden": true,
5152
- children: [
5153
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
5154
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
5155
- ]
5156
- }
5157
- ),
5158
- "Refresh"
5159
- ] }),
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
+ ),
5160
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" }) }) })
5161
5485
  ] })
5162
5486
  ] }),
5163
5487
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-list", children: [
5164
5488
  txHistory.step === "idle" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Click Refresh to load transactions." }),
5165
- 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
+ ] }),
5166
5493
  txHistory.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
5167
5494
  txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
5168
5495
  records.map((record) => {
@@ -5355,24 +5682,38 @@ function WalletBalanceModalTemplate({
5355
5682
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
5356
5683
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
5357
5684
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
5358
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
5359
- /* @__PURE__ */ jsxRuntime.jsxs(
5360
- "svg",
5361
- {
5362
- className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
5363
- width: "13",
5364
- height: "13",
5365
- viewBox: "0 0 13 13",
5366
- fill: "none",
5367
- "aria-hidden": true,
5368
- children: [
5369
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
5370
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
5371
- ]
5372
- }
5373
- ),
5374
- "Refresh"
5375
- ] }),
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
+ ),
5376
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" }) }) })
5377
5718
  ] })
5378
5719
  ] }),
@@ -5380,7 +5721,10 @@ function WalletBalanceModalTemplate({
5380
5721
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
5381
5722
  /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: walletAddress, label: "Copy wallet address" })
5382
5723
  ] }),
5383
- 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
+ ] }),
5384
5728
  walletBalance.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
5385
5729
  data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
5386
5730
  "Account not found on ",
@@ -5591,6 +5935,9 @@ function PollarProvider({
5591
5935
  const [sendModalOpen, setSendModalOpen] = react.useState(false);
5592
5936
  const [swapModalOpen, setSwapModalOpen] = react.useState(false);
5593
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);
5594
5941
  const [receiveModalOpen, setReceiveModalOpen] = react.useState(false);
5595
5942
  const [sessionsModalOpen, setSessionsModalOpen] = react.useState(false);
5596
5943
  const [distributionRulesModalOpen, setDistributionRulesModalOpen] = react.useState(false);
@@ -5633,21 +5980,33 @@ function PollarProvider({
5633
5980
  setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
5634
5981
  openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
5635
5982
  // send / receive
5636
- openSendModal: () => setSendModalOpen(true),
5983
+ openSendModal: () => {
5984
+ pollarClient.resetTransactionState();
5985
+ setSendModalKey((k) => k + 1);
5986
+ setSendModalOpen(true);
5987
+ },
5637
5988
  openReceiveModal: () => setReceiveModalOpen(true),
5638
5989
  // swap
5639
5990
  getSwapConfig: () => pollarClient.getSwapConfig(),
5640
5991
  getSwapTokens: () => pollarClient.getSwapTokens(),
5641
5992
  getSwapQuote: (params) => pollarClient.getSwapQuote(params),
5642
5993
  swap: (quote, opts) => pollarClient.swap(quote, opts),
5643
- openSwapModal: () => setSwapModalOpen(true),
5994
+ openSwapModal: () => {
5995
+ pollarClient.resetTransactionState();
5996
+ setSwapModalKey((k) => k + 1);
5997
+ setSwapModalOpen(true);
5998
+ },
5644
5999
  // earn
5645
6000
  getEarnProviders: () => pollarClient.getEarnProviders(),
5646
6001
  getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider),
5647
6002
  getEarnPosition: (params) => pollarClient.getEarnPosition(params),
5648
6003
  earnDeposit: (params) => pollarClient.earnDeposit(params),
5649
6004
  earnWithdraw: (params) => pollarClient.earnWithdraw(params),
5650
- openEarnModal: () => setEarnModalOpen(true),
6005
+ openEarnModal: () => {
6006
+ pollarClient.resetTransactionState();
6007
+ setEarnModalKey((k) => k + 1);
6008
+ setEarnModalOpen(true);
6009
+ },
5651
6010
  // sessions
5652
6011
  sessions,
5653
6012
  openSessionsModal: () => setSessionsModalOpen(true),
@@ -5701,9 +6060,9 @@ function PollarProvider({
5701
6060
  txHistoryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
5702
6061
  walletBalanceModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
5703
6062
  enabledAssetsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEnabledAssetsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EnabledAssetsModal, { onClose: () => setEnabledAssetsModalOpen(false) }) }),
5704
- sendModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }),
5705
- swapModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }),
5706
- 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),
5707
6066
  receiveModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
5708
6067
  sessionsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
5709
6068
  distributionRulesModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setDistributionRulesModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(DistributionRulesModal, { onClose: () => setDistributionRulesModalOpen(false) }) })
@@ -5737,7 +6096,7 @@ function createPollarAdapterHook(key) {
5737
6096
  };
5738
6097
  }
5739
6098
  function ButtonLogo() {
5740
- 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" });
5741
6100
  }
5742
6101
  function cropWallet(address) {
5743
6102
  if (address.length <= 12) return address;
@@ -5770,23 +6129,23 @@ function WalletButtonTemplate({
5770
6129
  onLogin
5771
6130
  }) {
5772
6131
  if (!walletAddress) {
5773
- 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: [
5774
6133
  /* @__PURE__ */ jsxRuntime.jsx(ButtonLogo, {}),
5775
6134
  "Login with Pollar"
5776
6135
  ] });
5777
6136
  }
5778
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wallet-wrapper", ref: wrapperRef, children: [
6137
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, children: [
5779
6138
  /* @__PURE__ */ jsxRuntime.jsxs(
5780
6139
  "button",
5781
6140
  {
5782
- className: "wallet-btn",
6141
+ className: "pollar-wallet-btn",
5783
6142
  style: { backgroundColor: accentColor },
5784
6143
  onClick: isInProgress ? void 0 : onToggleOpen,
5785
6144
  disabled: isInProgress,
5786
6145
  "aria-busy": isInProgress,
5787
6146
  children: [
5788
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "wallet-btn-label", children: cropWallet(walletAddress) }),
5789
- 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: [
5790
6149
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "6", r: "4.5", stroke: "rgba(255,255,255,0.35)", strokeWidth: "1.5" }),
5791
6150
  /* @__PURE__ */ jsxRuntime.jsx(
5792
6151
  "circle",
@@ -5804,7 +6163,7 @@ function WalletButtonTemplate({
5804
6163
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(
5805
6164
  "svg",
5806
6165
  {
5807
- className: `wallet-chevron${open ? " open" : ""}`,
6166
+ className: `pollar-wallet-chevron${open ? " pollar-open" : ""}`,
5808
6167
  viewBox: "0 0 12 12",
5809
6168
  fill: "none",
5810
6169
  stroke: "currentColor",
@@ -5817,12 +6176,12 @@ function WalletButtonTemplate({
5817
6176
  ]
5818
6177
  }
5819
6178
  ),
5820
- 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: [
5821
6180
  showCreateAccount && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5822
6181
  /* @__PURE__ */ jsxRuntime.jsxs(
5823
6182
  "button",
5824
6183
  {
5825
- className: "wallet-dropdown-item",
6184
+ className: "pollar-wallet-dropdown-item",
5826
6185
  style: { color: itemColor },
5827
6186
  onClick: onCreateAccount,
5828
6187
  disabled: creatingAccount,
@@ -5850,9 +6209,9 @@ function WalletButtonTemplate({
5850
6209
  ]
5851
6210
  }
5852
6211
  ),
5853
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" })
6212
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
5854
6213
  ] }),
5855
- /* @__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: [
5856
6215
  /* @__PURE__ */ jsxRuntime.jsxs(
5857
6216
  "svg",
5858
6217
  {
@@ -5872,7 +6231,7 @@ function WalletButtonTemplate({
5872
6231
  ),
5873
6232
  "Send"
5874
6233
  ] }),
5875
- /* @__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: [
5876
6235
  /* @__PURE__ */ jsxRuntime.jsxs(
5877
6236
  "svg",
5878
6237
  {
@@ -5893,8 +6252,8 @@ function WalletButtonTemplate({
5893
6252
  ),
5894
6253
  "Receive"
5895
6254
  ] }),
5896
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
5897
- /* @__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: [
5898
6257
  /* @__PURE__ */ jsxRuntime.jsxs(
5899
6258
  "svg",
5900
6259
  {
@@ -5914,7 +6273,7 @@ function WalletButtonTemplate({
5914
6273
  ),
5915
6274
  copied ? "Copied!" : "Copy address"
5916
6275
  ] }),
5917
- /* @__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: [
5918
6277
  /* @__PURE__ */ jsxRuntime.jsxs(
5919
6278
  "svg",
5920
6279
  {
@@ -5935,7 +6294,7 @@ function WalletButtonTemplate({
5935
6294
  ),
5936
6295
  "Wallet balance"
5937
6296
  ] }),
5938
- /* @__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: [
5939
6298
  /* @__PURE__ */ jsxRuntime.jsxs(
5940
6299
  "svg",
5941
6300
  {
@@ -5958,8 +6317,8 @@ function WalletButtonTemplate({
5958
6317
  ),
5959
6318
  "Transaction history"
5960
6319
  ] }),
5961
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
5962
- /* @__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: [
5963
6322
  /* @__PURE__ */ jsxRuntime.jsxs(
5964
6323
  "svg",
5965
6324
  {
@@ -5981,7 +6340,7 @@ function WalletButtonTemplate({
5981
6340
  ),
5982
6341
  "Buy / Sell"
5983
6342
  ] }),
5984
- /* @__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: [
5985
6344
  /* @__PURE__ */ jsxRuntime.jsxs(
5986
6345
  "svg",
5987
6346
  {
@@ -6002,7 +6361,7 @@ function WalletButtonTemplate({
6002
6361
  ),
6003
6362
  "Identity verification"
6004
6363
  ] }),
6005
- /* @__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: [
6006
6365
  /* @__PURE__ */ jsxRuntime.jsxs(
6007
6366
  "svg",
6008
6367
  {
@@ -6025,7 +6384,7 @@ function WalletButtonTemplate({
6025
6384
  ),
6026
6385
  "Distribution rules"
6027
6386
  ] }),
6028
- /* @__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: [
6029
6388
  /* @__PURE__ */ jsxRuntime.jsxs(
6030
6389
  "svg",
6031
6390
  {
@@ -6046,8 +6405,8 @@ function WalletButtonTemplate({
6046
6405
  ),
6047
6406
  "Active sessions"
6048
6407
  ] }),
6049
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
6050
- /* @__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: [
6051
6410
  /* @__PURE__ */ jsxRuntime.jsxs(
6052
6411
  "svg",
6053
6412
  {