@pollar/react 0.10.1-rc.9 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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.11.0"
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,
@@ -3722,7 +3880,7 @@ function SendModal({ onClose }) {
3722
3880
  []
3723
3881
  );
3724
3882
  const balanceData = walletBalance.step === "loaded" ? walletBalance.data : null;
3725
- const allAssets = balanceData?.balances ?? [];
3883
+ const allAssets = (balanceData?.balances ?? []).filter((b) => b.chain === void 0 || b.chain === "STELLAR");
3726
3884
  const sortedAssets = [
3727
3885
  ...allAssets.filter((b) => b.enabledInApp),
3728
3886
  ...allAssets.filter((b) => !b.enabledInApp && (b.type === "native" || parseFloat(b.balance) > 0))
@@ -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: [
@@ -4219,7 +4385,9 @@ function SwapModal({ onClose }) {
4219
4385
  const balances = walletBalance.step === "loaded" ? walletBalance.data.balances : [];
4220
4386
  const assetRecords = enabledAssets.step === "loaded" ? enabledAssets.data.assets : [];
4221
4387
  const isLoadingData = walletBalance.step === "loading" || enabledAssets.step === "loading";
4222
- const sellOptions = balances.filter((b) => b.type === "native" || !b.trustlineRemoved).map((b) => ({ ref: toRef(b), code: b.code, issuer: b.issuer, available: b.available, enabledInApp: b.enabledInApp }));
4388
+ const sellOptions = balances.filter(
4389
+ (b) => b.type != null && (b.type === "native" || !b.trustlineRemoved)
4390
+ ).map((b) => ({ ref: toRef(b), code: b.code, issuer: b.issuer, available: b.available, enabledInApp: b.enabledInApp }));
4223
4391
  const buyKeyOfSell = selectedSell ? `${selectedSell.code}:${selectedSell.issuer ?? "native"}` : "";
4224
4392
  const optKey = (o) => `${o.code}:${o.issuer ?? "native"}`;
4225
4393
  const enabledBuy = assetRecords.map((a) => ({
@@ -4415,7 +4583,14 @@ var PROVIDER_LABELS2 = {
4415
4583
  blend: "Blend",
4416
4584
  defindex: "DeFindex"
4417
4585
  };
4418
- var IN_FLIGHT_STEPS2 = ["building", "signing", "submitting", "submitted", "signing-submitting", "building-signing-submitting"];
4586
+ var IN_FLIGHT_STEPS2 = [
4587
+ "building",
4588
+ "signing",
4589
+ "submitting",
4590
+ "submitted",
4591
+ "signing-submitting",
4592
+ "building-signing-submitting"
4593
+ ];
4419
4594
  function formatAmount4(value) {
4420
4595
  const n = parseFloat(value);
4421
4596
  return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
@@ -4429,6 +4604,11 @@ function EarnModal({ onClose }) {
4429
4604
  earnWithdraw,
4430
4605
  tx: transaction,
4431
4606
  wallet,
4607
+ walletBalance,
4608
+ refreshWalletBalance,
4609
+ enabledAssets,
4610
+ refreshAssets,
4611
+ setTrustline,
4432
4612
  network,
4433
4613
  styles
4434
4614
  } = usePollar();
@@ -4446,6 +4626,7 @@ function EarnModal({ onClose }) {
4446
4626
  const [amount, setAmount] = react.useState("");
4447
4627
  const [loadingOpps, setLoadingOpps] = react.useState(false);
4448
4628
  const [formError, setFormError] = react.useState("");
4629
+ const [refreshing, setRefreshing] = react.useState(false);
4449
4630
  const [showXdr, setShowXdr] = react.useState(false);
4450
4631
  const [copied, setCopied] = react.useState(false);
4451
4632
  const copyTimerRef = react.useRef(null);
@@ -4459,6 +4640,10 @@ function EarnModal({ onClose }) {
4459
4640
  react.useEffect(() => {
4460
4641
  void loadProviders();
4461
4642
  }, [loadProviders]);
4643
+ react.useEffect(() => {
4644
+ void refreshWalletBalance();
4645
+ void refreshAssets();
4646
+ }, [refreshWalletBalance, refreshAssets]);
4462
4647
  react.useEffect(() => {
4463
4648
  if (!provider) return;
4464
4649
  let cancelled = false;
@@ -4502,6 +4687,22 @@ function EarnModal({ onClose }) {
4502
4687
  const withdrawUnit = position?.withdrawUnit ?? "asset";
4503
4688
  const assetCode = selectedOpportunity?.asset.code ?? "";
4504
4689
  const amountUnitLabel = tab === "deposit" ? assetCode : withdrawUnit === "shares" ? "shares" : assetCode;
4690
+ const walletAvailable = (() => {
4691
+ if (!selectedOpportunity) return null;
4692
+ const balances = walletBalance.step === "loaded" ? walletBalance.data.balances : [];
4693
+ const issuer = selectedOpportunity.asset.issuer;
4694
+ const rec = balances.find(
4695
+ (b) => issuer === null ? b.type === "native" : b.code === assetCode && b.issuer === issuer
4696
+ );
4697
+ return rec ? rec.available : null;
4698
+ })();
4699
+ const depositAssetRecord = (() => {
4700
+ if (!selectedOpportunity?.asset.issuer || enabledAssets.step !== "loaded") return void 0;
4701
+ return enabledAssets.data.assets.find(
4702
+ (a) => a.code === assetCode && a.issuer === selectedOpportunity.asset.issuer
4703
+ );
4704
+ })();
4705
+ const depositNeedsTrustline = tab === "deposit" && !smartUnsupported && !!selectedOpportunity?.asset.issuer && !depositAssetRecord?.trustlineEstablished;
4505
4706
  const hash = transaction.step === "success" ? transaction.hash : null;
4506
4707
  const buildData = "buildData" in transaction ? transaction.buildData : null;
4507
4708
  const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
@@ -4509,7 +4710,9 @@ function EarnModal({ onClose }) {
4509
4710
  const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
4510
4711
  const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
4511
4712
  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;
4713
+ const parsedAmount = parseFloat(amount);
4714
+ const exceedsAvailable = tab === "deposit" ? walletAvailable != null && parsedAmount > parseFloat(walletAvailable) : position != null && parsedAmount > parseFloat(position.withdrawable);
4715
+ const canSubmit = !smartUnsupported && !!provider && !!opportunityId && !!amount && parsedAmount > 0 && !exceedsAvailable && !providersLoading && !loadingOpps;
4513
4716
  const cssVars = {
4514
4717
  "--pollar-accent": accentColor,
4515
4718
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
@@ -4542,11 +4745,27 @@ function EarnModal({ onClose }) {
4542
4745
  setFormError("Enter a valid amount");
4543
4746
  return;
4544
4747
  }
4748
+ if (tab === "deposit" && walletAvailable != null && parsed > parseFloat(walletAvailable)) {
4749
+ setFormError("Amount exceeds your wallet balance");
4750
+ return;
4751
+ }
4545
4752
  if (tab === "withdraw" && position && parsed > parseFloat(position.withdrawable)) {
4546
4753
  setFormError("Amount exceeds your position");
4547
4754
  return;
4548
4755
  }
4549
4756
  setStep("tx");
4757
+ if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
4758
+ const tl = await setTrustline(
4759
+ { code: assetCode, issuer: selectedOpportunity.asset.issuer },
4760
+ depositAssetRecord?.sponsored ? { sponsored: true } : void 0
4761
+ );
4762
+ if (tl.status === "error") {
4763
+ setFormError(`Trustline for ${assetCode} failed: ${tl.details ?? "unknown error"}`);
4764
+ setStep("form");
4765
+ return;
4766
+ }
4767
+ await refreshAssets();
4768
+ }
4550
4769
  const params = { provider, opportunity: opportunityId, amount };
4551
4770
  const outcome = tab === "deposit" ? await earnDeposit(params) : await earnWithdraw(params);
4552
4771
  if (outcome.status === "success" || outcome.status === "pending") {
@@ -4577,146 +4796,217 @@ function EarnModal({ onClose }) {
4577
4796
  setCopied(false);
4578
4797
  refreshPosition();
4579
4798
  }
4799
+ async function handleRefresh() {
4800
+ if (refreshing || !provider) return;
4801
+ setRefreshing(true);
4802
+ try {
4803
+ void refreshWalletBalance();
4804
+ const opps = await getEarnOpportunities(provider);
4805
+ setOpportunities(opps);
4806
+ setOpportunityId((cur) => opps.some((o) => o.id === cur) ? cur : opps[0]?.id ?? "");
4807
+ refreshPosition();
4808
+ } catch {
4809
+ } finally {
4810
+ setRefreshing(false);
4811
+ }
4812
+ }
4580
4813
  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
4814
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
4815
+ "div",
4816
+ {
4817
+ className: "pollar-modal-card pollar-send-modal",
4818
+ "data-theme": theme,
4819
+ style: cssVars,
4820
+ onClick: (e) => e.stopPropagation(),
4821
+ children: [
4822
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
4823
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-header-left", children: [
4824
+ 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" }) }) }),
4825
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: title })
4826
+ ] }),
4827
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
4828
+ step === "form" && !earnUnavailable && !smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx(
4829
+ "button",
4830
+ {
4831
+ type: "button",
4832
+ className: "pollar-modal-close",
4833
+ onClick: () => void handleRefresh(),
4834
+ disabled: refreshing || providersLoading,
4835
+ "aria-label": "Refresh",
4836
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4837
+ "svg",
4838
+ {
4839
+ className: refreshing ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
4840
+ width: "16",
4841
+ height: "16",
4842
+ viewBox: "0 0 16 16",
4843
+ fill: "none",
4844
+ "aria-hidden": true,
4845
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4846
+ "path",
4847
+ {
4848
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
4849
+ stroke: "currentColor",
4850
+ strokeWidth: "1.6",
4851
+ strokeLinecap: "round",
4852
+ strokeLinejoin: "round"
4853
+ }
4854
+ )
4855
+ }
4856
+ )
4857
+ }
4858
+ ),
4859
+ !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
4860
  ] })
4657
4861
  ] }),
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: [
4862
+ step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
4863
+ step === "form" && !earnUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4864
+ smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
4865
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tabs", children: [
4866
+ /* @__PURE__ */ jsxRuntime.jsx(
4867
+ "button",
4868
+ {
4869
+ type: "button",
4870
+ className: "pollar-tab",
4871
+ "data-active": tab === "deposit",
4872
+ onClick: () => {
4873
+ setTab("deposit");
4874
+ setFormError("");
4875
+ },
4876
+ children: "Deposit"
4877
+ }
4878
+ ),
4879
+ /* @__PURE__ */ jsxRuntime.jsx(
4880
+ "button",
4881
+ {
4882
+ type: "button",
4883
+ className: "pollar-tab",
4884
+ "data-active": tab === "withdraw",
4885
+ onClick: () => {
4886
+ setTab("withdraw");
4887
+ setFormError("");
4888
+ },
4889
+ children: "Withdraw"
4890
+ }
4891
+ )
4892
+ ] }),
4893
+ providers && providers.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4894
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Provider" }),
4895
+ /* @__PURE__ */ jsxRuntime.jsx(
4896
+ "select",
4897
+ {
4898
+ className: "pollar-input pollar-send-select",
4899
+ value: provider ?? "",
4900
+ onChange: (e) => setProvider(e.target.value),
4901
+ children: providers.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p, children: PROVIDER_LABELS2[p] }, p))
4902
+ }
4903
+ )
4904
+ ] }),
4905
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4906
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
4907
+ loadingOpps || providersLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-input pollar-select-loading", children: [
4908
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
4909
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading options\u2026" })
4910
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
4911
+ "select",
4912
+ {
4913
+ className: "pollar-input pollar-send-select",
4914
+ value: opportunityId,
4915
+ disabled: opportunities.length === 0,
4916
+ onChange: (e) => setOpportunityId(e.target.value),
4917
+ children: opportunities.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "None available" }) : opportunities.map((o) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: o.id, children: [
4918
+ o.name,
4919
+ " \xB7 ",
4920
+ o.apy.toFixed(2),
4921
+ "% APY"
4922
+ ] }, o.id))
4923
+ }
4924
+ )
4925
+ ] }),
4926
+ selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote", children: [
4927
+ tab === "deposit" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4928
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "In your wallet" }),
4929
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4930
+ walletAvailable != null ? formatAmount4(walletAvailable) : "\u2026",
4931
+ " ",
4932
+ assetCode
4933
+ ] })
4934
+ ] }),
4935
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4936
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "Your position" }),
4937
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4938
+ position ? formatAmount4(position.balance) : "\u2026",
4939
+ " ",
4940
+ assetCode
4941
+ ] })
4942
+ ] }),
4943
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
4944
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "APY" }),
4945
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
4946
+ selectedOpportunity.apy.toFixed(2),
4947
+ "%"
4948
+ ] })
4949
+ ] })
4950
+ ] }),
4951
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
4952
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-label-row", children: [
4953
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: tab === "deposit" ? "Amount" : "Withdraw amount" }),
4954
+ tab === "deposit" && walletAvailable != null && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-swap-custom-toggle", onClick: () => setAmount(walletAvailable), children: [
4955
+ "Max: ",
4956
+ formatAmount4(walletAvailable),
4957
+ " ",
4958
+ amountUnitLabel
4959
+ ] }),
4960
+ tab === "withdraw" && position && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-swap-custom-toggle", onClick: () => setAmount(position.withdrawable), children: [
4676
4961
  "Max: ",
4677
4962
  formatAmount4(position.withdrawable),
4678
4963
  " ",
4679
4964
  amountUnitLabel
4680
- ]
4681
- }
4682
- )
4965
+ ] })
4966
+ ] }),
4967
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-amount", children: [
4968
+ /* @__PURE__ */ jsxRuntime.jsx(
4969
+ "input",
4970
+ {
4971
+ className: "pollar-input",
4972
+ type: "text",
4973
+ inputMode: "decimal",
4974
+ placeholder: "0.00",
4975
+ value: amount,
4976
+ onChange: (e) => setAmount(e.target.value)
4977
+ }
4978
+ ),
4979
+ amountUnitLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-earn-amount-unit", children: amountUnitLabel })
4980
+ ] })
4981
+ ] }),
4982
+ formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
4983
+ depositNeedsTrustline && selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-trustline-notice", children: [
4984
+ "To deposit ",
4985
+ assetCode,
4986
+ " 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."
4987
+ ] }),
4988
+ /* @__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
4989
  ] }),
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
- ] }) });
4990
+ step === "tx" && /* @__PURE__ */ jsxRuntime.jsx(
4991
+ TxStatusView,
4992
+ {
4993
+ transaction,
4994
+ showXdr,
4995
+ copied,
4996
+ explorerUrl,
4997
+ walletType,
4998
+ onSignAndSend: () => {
4999
+ },
5000
+ onToggleXdr: () => setShowXdr((v) => !v),
5001
+ onCopyHash: handleCopyHash,
5002
+ onRetry: () => void handleRetry(),
5003
+ onDone: onClose
5004
+ }
5005
+ ),
5006
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5007
+ ]
5008
+ }
5009
+ ) });
4720
5010
  }
4721
5011
  function describeDevice(s) {
4722
5012
  if (s.deviceLabel) return s.deviceLabel;
@@ -4809,30 +5099,46 @@ function SessionsModalTemplate({
4809
5099
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
4810
5100
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Active sessions" }),
4811
5101
  /* @__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
- ] }),
5102
+ /* @__PURE__ */ jsxRuntime.jsx(
5103
+ "button",
5104
+ {
5105
+ type: "button",
5106
+ className: "pollar-modal-close",
5107
+ onClick: onRefresh,
5108
+ disabled: isLoading,
5109
+ "aria-label": "Refresh",
5110
+ title: "Refresh",
5111
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5112
+ "svg",
5113
+ {
5114
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
5115
+ width: "16",
5116
+ height: "16",
5117
+ viewBox: "0 0 16 16",
5118
+ fill: "none",
5119
+ "aria-hidden": true,
5120
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5121
+ "path",
5122
+ {
5123
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
5124
+ stroke: "currentColor",
5125
+ strokeWidth: "1.6",
5126
+ strokeLinecap: "round",
5127
+ strokeLinejoin: "round"
5128
+ }
5129
+ )
5130
+ }
5131
+ )
5132
+ }
5133
+ ),
4830
5134
  /* @__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
5135
  ] })
4832
5136
  ] }),
4833
5137
  /* @__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" }),
5138
+ (state.step === "idle" || isLoading) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5139
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5140
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
5141
+ ] }),
4836
5142
  state.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: state.message }),
4837
5143
  state.step === "loaded" && sessions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No active sessions." }),
4838
5144
  sessions.map((s) => {
@@ -4861,7 +5167,10 @@ function SessionsModalTemplate({
4861
5167
  className: "pollar-sessions-item-revoke",
4862
5168
  onClick: () => onRevoke(s.familyId),
4863
5169
  disabled: isRevoking || signingOutEverywhere,
4864
- children: isRevoking ? "Revoking\u2026" : "Revoke"
5170
+ children: isRevoking ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5171
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }),
5172
+ "Revoking\u2026"
5173
+ ] }) : "Revoke"
4865
5174
  }
4866
5175
  )
4867
5176
  ] }, s.familyId);
@@ -4874,7 +5183,10 @@ function SessionsModalTemplate({
4874
5183
  onClick: onLogoutEverywhere,
4875
5184
  disabled: signingOutEverywhere || otherCount === 0,
4876
5185
  title: otherCount === 0 ? "No other devices to sign out" : void 0,
4877
- children: signingOutEverywhere ? "Signing out\u2026" : "Sign out everywhere"
5186
+ children: signingOutEverywhere ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5187
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm pollar-spinner-current" }),
5188
+ "Signing out\u2026"
5189
+ ] }) : "Sign out everywhere"
4878
5190
  }
4879
5191
  ) }),
4880
5192
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
@@ -5091,7 +5403,7 @@ function renderSummary(summary) {
5091
5403
  last = m.index + address.length;
5092
5404
  }
5093
5405
  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++));
5406
+ if (last < summary.length) parts.push(/* @__PURE__ */ jsxRuntime.jsx("span", { children: summary.slice(last) }, key));
5095
5407
  return parts;
5096
5408
  }
5097
5409
  function TxHistoryModalTemplate({
@@ -5139,30 +5451,47 @@ function TxHistoryModalTemplate({
5139
5451
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
5140
5452
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
5141
5453
  /* @__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
- ] }),
5454
+ /* @__PURE__ */ jsxRuntime.jsx(
5455
+ "button",
5456
+ {
5457
+ type: "button",
5458
+ className: "pollar-modal-close",
5459
+ onClick: onRefresh,
5460
+ disabled: isLoading,
5461
+ "aria-label": "Refresh",
5462
+ title: "Refresh",
5463
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5464
+ "svg",
5465
+ {
5466
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
5467
+ width: "16",
5468
+ height: "16",
5469
+ viewBox: "0 0 16 16",
5470
+ fill: "none",
5471
+ "aria-hidden": true,
5472
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5473
+ "path",
5474
+ {
5475
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
5476
+ stroke: "currentColor",
5477
+ strokeWidth: "1.6",
5478
+ strokeLinecap: "round",
5479
+ strokeLinejoin: "round"
5480
+ }
5481
+ )
5482
+ }
5483
+ )
5484
+ }
5485
+ ),
5160
5486
  /* @__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
5487
  ] })
5162
5488
  ] }),
5163
5489
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-list", children: [
5164
5490
  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" }),
5491
+ isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5492
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5493
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
5494
+ ] }),
5166
5495
  txHistory.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
5167
5496
  txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
5168
5497
  records.map((record) => {
@@ -5304,11 +5633,23 @@ function cropAddress2(address) {
5304
5633
  if (address.length <= 16) return address;
5305
5634
  return `${address.slice(0, 8)}...${address.slice(-8)}`;
5306
5635
  }
5307
- function BalanceItem({ record }) {
5636
+ var CHAIN_TAG = {
5637
+ STELLAR: { label: "Stellar", color: "#7d00ff" },
5638
+ POLYGON: { label: "Polygon", color: "#8247e5" },
5639
+ SOLANA: { label: "Solana", color: "#14f195" }
5640
+ };
5641
+ function ChainTag({ chain }) {
5642
+ const tag = CHAIN_TAG[chain] ?? { label: chain, color: "#6b7280" };
5643
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-chain-tag", style: { "--pollar-chain-color": tag.color }, children: tag.label });
5644
+ }
5645
+ function BalanceItem({ record, showChain }) {
5308
5646
  const balanceDiffers = record.balance !== record.available;
5309
5647
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-item", children: [
5310
5648
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-asset-info", children: [
5311
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-asset", children: record.code }),
5649
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-bal-asset-code-row", children: [
5650
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-asset", children: record.code }),
5651
+ showChain && record.chain && /* @__PURE__ */ jsxRuntime.jsx(ChainTag, { chain: record.chain })
5652
+ ] }),
5312
5653
  record.issuer && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-bal-issuer", children: [
5313
5654
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-issuer-addr", children: cropAddress2(record.issuer) }),
5314
5655
  /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: record.issuer, label: "Copy issuer address", className: "pollar-copy-btn-sm" })
@@ -5355,24 +5696,38 @@ function WalletBalanceModalTemplate({
5355
5696
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
5356
5697
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
5357
5698
  /* @__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
- ] }),
5699
+ /* @__PURE__ */ jsxRuntime.jsx(
5700
+ "button",
5701
+ {
5702
+ type: "button",
5703
+ className: "pollar-modal-close",
5704
+ onClick: onRefresh,
5705
+ disabled: isLoading,
5706
+ "aria-label": "Refresh",
5707
+ title: "Refresh",
5708
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5709
+ "svg",
5710
+ {
5711
+ className: isLoading ? "pollar-modal-refresh-icon pollar-spinning" : "pollar-modal-refresh-icon",
5712
+ width: "16",
5713
+ height: "16",
5714
+ viewBox: "0 0 16 16",
5715
+ fill: "none",
5716
+ "aria-hidden": true,
5717
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5718
+ "path",
5719
+ {
5720
+ d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2v3h-3",
5721
+ stroke: "currentColor",
5722
+ strokeWidth: "1.6",
5723
+ strokeLinecap: "round",
5724
+ strokeLinejoin: "round"
5725
+ }
5726
+ )
5727
+ }
5728
+ )
5729
+ }
5730
+ ),
5376
5731
  /* @__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
5732
  ] })
5378
5733
  ] }),
@@ -5380,7 +5735,10 @@ function WalletBalanceModalTemplate({
5380
5735
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-address", children: cropAddress2(walletAddress) }),
5381
5736
  /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: walletAddress, label: "Copy wallet address" })
5382
5737
  ] }),
5383
- isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
5738
+ isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5739
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5740
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading\u2026" })
5741
+ ] }),
5384
5742
  walletBalance.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
5385
5743
  data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
5386
5744
  "Account not found on ",
@@ -5388,7 +5746,7 @@ function WalletBalanceModalTemplate({
5388
5746
  "."
5389
5747
  ] }),
5390
5748
  data?.exists && data.balances.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No balances found." }),
5391
- data?.exists && data.balances.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-list", children: data.balances.map((b) => /* @__PURE__ */ jsxRuntime.jsx(BalanceItem, { record: b }, b.code + (b.issuer ?? ""))) }),
5749
+ data?.exists && data.balances.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-list", children: data.balances.map((b) => /* @__PURE__ */ jsxRuntime.jsx(BalanceItem, { record: b, showChain: data.multichain === true }, (b.chain ?? "") + b.code + (b.issuer ?? ""))) }),
5392
5750
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5393
5751
  ] });
5394
5752
  }
@@ -5591,6 +5949,9 @@ function PollarProvider({
5591
5949
  const [sendModalOpen, setSendModalOpen] = react.useState(false);
5592
5950
  const [swapModalOpen, setSwapModalOpen] = react.useState(false);
5593
5951
  const [earnModalOpen, setEarnModalOpen] = react.useState(false);
5952
+ const [sendModalKey, setSendModalKey] = react.useState(0);
5953
+ const [swapModalKey, setSwapModalKey] = react.useState(0);
5954
+ const [earnModalKey, setEarnModalKey] = react.useState(0);
5594
5955
  const [receiveModalOpen, setReceiveModalOpen] = react.useState(false);
5595
5956
  const [sessionsModalOpen, setSessionsModalOpen] = react.useState(false);
5596
5957
  const [distributionRulesModalOpen, setDistributionRulesModalOpen] = react.useState(false);
@@ -5633,21 +5994,33 @@ function PollarProvider({
5633
5994
  setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
5634
5995
  openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
5635
5996
  // send / receive
5636
- openSendModal: () => setSendModalOpen(true),
5997
+ openSendModal: () => {
5998
+ pollarClient.resetTransactionState();
5999
+ setSendModalKey((k) => k + 1);
6000
+ setSendModalOpen(true);
6001
+ },
5637
6002
  openReceiveModal: () => setReceiveModalOpen(true),
5638
6003
  // swap
5639
6004
  getSwapConfig: () => pollarClient.getSwapConfig(),
5640
6005
  getSwapTokens: () => pollarClient.getSwapTokens(),
5641
6006
  getSwapQuote: (params) => pollarClient.getSwapQuote(params),
5642
6007
  swap: (quote, opts) => pollarClient.swap(quote, opts),
5643
- openSwapModal: () => setSwapModalOpen(true),
6008
+ openSwapModal: () => {
6009
+ pollarClient.resetTransactionState();
6010
+ setSwapModalKey((k) => k + 1);
6011
+ setSwapModalOpen(true);
6012
+ },
5644
6013
  // earn
5645
6014
  getEarnProviders: () => pollarClient.getEarnProviders(),
5646
6015
  getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider),
5647
6016
  getEarnPosition: (params) => pollarClient.getEarnPosition(params),
5648
6017
  earnDeposit: (params) => pollarClient.earnDeposit(params),
5649
6018
  earnWithdraw: (params) => pollarClient.earnWithdraw(params),
5650
- openEarnModal: () => setEarnModalOpen(true),
6019
+ openEarnModal: () => {
6020
+ pollarClient.resetTransactionState();
6021
+ setEarnModalKey((k) => k + 1);
6022
+ setEarnModalOpen(true);
6023
+ },
5651
6024
  // sessions
5652
6025
  sessions,
5653
6026
  openSessionsModal: () => setSessionsModalOpen(true),
@@ -5701,9 +6074,9 @@ function PollarProvider({
5701
6074
  txHistoryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
5702
6075
  walletBalanceModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
5703
6076
  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) }) }),
6077
+ sendModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }, sendModalKey),
6078
+ swapModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }, swapModalKey),
6079
+ earnModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEarnModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EarnModal, { onClose: () => setEarnModalOpen(false) }) }, earnModalKey),
5707
6080
  receiveModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
5708
6081
  sessionsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
5709
6082
  distributionRulesModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setDistributionRulesModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(DistributionRulesModal, { onClose: () => setDistributionRulesModalOpen(false) }) })
@@ -5737,7 +6110,7 @@ function createPollarAdapterHook(key) {
5737
6110
  };
5738
6111
  }
5739
6112
  function ButtonLogo() {
5740
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
6113
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "pollar-wallet-btn-logo" });
5741
6114
  }
5742
6115
  function cropWallet(address) {
5743
6116
  if (address.length <= 12) return address;
@@ -5770,23 +6143,23 @@ function WalletButtonTemplate({
5770
6143
  onLogin
5771
6144
  }) {
5772
6145
  if (!walletAddress) {
5773
- return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "wallet-login-btn", style: { backgroundColor: accentColor }, onClick: onLogin, children: [
6146
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-wallet-login-btn", style: { backgroundColor: accentColor }, onClick: onLogin, children: [
5774
6147
  /* @__PURE__ */ jsxRuntime.jsx(ButtonLogo, {}),
5775
6148
  "Login with Pollar"
5776
6149
  ] });
5777
6150
  }
5778
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wallet-wrapper", ref: wrapperRef, children: [
6151
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, children: [
5779
6152
  /* @__PURE__ */ jsxRuntime.jsxs(
5780
6153
  "button",
5781
6154
  {
5782
- className: "wallet-btn",
6155
+ className: "pollar-wallet-btn",
5783
6156
  style: { backgroundColor: accentColor },
5784
6157
  onClick: isInProgress ? void 0 : onToggleOpen,
5785
6158
  disabled: isInProgress,
5786
6159
  "aria-busy": isInProgress,
5787
6160
  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: [
6161
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-btn-label", children: cropWallet(walletAddress) }),
6162
+ 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
6163
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "6", cy: "6", r: "4.5", stroke: "rgba(255,255,255,0.35)", strokeWidth: "1.5" }),
5791
6164
  /* @__PURE__ */ jsxRuntime.jsx(
5792
6165
  "circle",
@@ -5804,7 +6177,7 @@ function WalletButtonTemplate({
5804
6177
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(
5805
6178
  "svg",
5806
6179
  {
5807
- className: `wallet-chevron${open ? " open" : ""}`,
6180
+ className: `pollar-wallet-chevron${open ? " pollar-open" : ""}`,
5808
6181
  viewBox: "0 0 12 12",
5809
6182
  fill: "none",
5810
6183
  stroke: "currentColor",
@@ -5817,12 +6190,12 @@ function WalletButtonTemplate({
5817
6190
  ]
5818
6191
  }
5819
6192
  ),
5820
- open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
6193
+ open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
5821
6194
  showCreateAccount && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5822
6195
  /* @__PURE__ */ jsxRuntime.jsxs(
5823
6196
  "button",
5824
6197
  {
5825
- className: "wallet-dropdown-item",
6198
+ className: "pollar-wallet-dropdown-item",
5826
6199
  style: { color: itemColor },
5827
6200
  onClick: onCreateAccount,
5828
6201
  disabled: creatingAccount,
@@ -5850,9 +6223,9 @@ function WalletButtonTemplate({
5850
6223
  ]
5851
6224
  }
5852
6225
  ),
5853
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" })
6226
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
5854
6227
  ] }),
5855
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSend, children: [
6228
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onSend, children: [
5856
6229
  /* @__PURE__ */ jsxRuntime.jsxs(
5857
6230
  "svg",
5858
6231
  {
@@ -5872,7 +6245,7 @@ function WalletButtonTemplate({
5872
6245
  ),
5873
6246
  "Send"
5874
6247
  ] }),
5875
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onReceive, children: [
6248
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onReceive, children: [
5876
6249
  /* @__PURE__ */ jsxRuntime.jsxs(
5877
6250
  "svg",
5878
6251
  {
@@ -5893,8 +6266,8 @@ function WalletButtonTemplate({
5893
6266
  ),
5894
6267
  "Receive"
5895
6268
  ] }),
5896
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
5897
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
6269
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6270
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
5898
6271
  /* @__PURE__ */ jsxRuntime.jsxs(
5899
6272
  "svg",
5900
6273
  {
@@ -5914,7 +6287,7 @@ function WalletButtonTemplate({
5914
6287
  ),
5915
6288
  copied ? "Copied!" : "Copy address"
5916
6289
  ] }),
5917
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onWalletBalance, children: [
6290
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onWalletBalance, children: [
5918
6291
  /* @__PURE__ */ jsxRuntime.jsxs(
5919
6292
  "svg",
5920
6293
  {
@@ -5935,7 +6308,7 @@ function WalletButtonTemplate({
5935
6308
  ),
5936
6309
  "Wallet balance"
5937
6310
  ] }),
5938
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onTxHistory, children: [
6311
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onTxHistory, children: [
5939
6312
  /* @__PURE__ */ jsxRuntime.jsxs(
5940
6313
  "svg",
5941
6314
  {
@@ -5958,8 +6331,8 @@ function WalletButtonTemplate({
5958
6331
  ),
5959
6332
  "Transaction history"
5960
6333
  ] }),
5961
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
5962
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
6334
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6335
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onRamp, children: [
5963
6336
  /* @__PURE__ */ jsxRuntime.jsxs(
5964
6337
  "svg",
5965
6338
  {
@@ -5981,7 +6354,7 @@ function WalletButtonTemplate({
5981
6354
  ),
5982
6355
  "Buy / Sell"
5983
6356
  ] }),
5984
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
6357
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onKyc, children: [
5985
6358
  /* @__PURE__ */ jsxRuntime.jsxs(
5986
6359
  "svg",
5987
6360
  {
@@ -6002,7 +6375,7 @@ function WalletButtonTemplate({
6002
6375
  ),
6003
6376
  "Identity verification"
6004
6377
  ] }),
6005
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
6378
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onDistributionRules, children: [
6006
6379
  /* @__PURE__ */ jsxRuntime.jsxs(
6007
6380
  "svg",
6008
6381
  {
@@ -6025,7 +6398,7 @@ function WalletButtonTemplate({
6025
6398
  ),
6026
6399
  "Distribution rules"
6027
6400
  ] }),
6028
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
6401
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", style: { color: itemColor }, onClick: onSessions, children: [
6029
6402
  /* @__PURE__ */ jsxRuntime.jsxs(
6030
6403
  "svg",
6031
6404
  {
@@ -6046,8 +6419,8 @@ function WalletButtonTemplate({
6046
6419
  ),
6047
6420
  "Active sessions"
6048
6421
  ] }),
6049
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "wallet-dropdown-divider" }),
6050
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item danger", onClick: onLogout, children: [
6422
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
6423
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item pollar-danger", onClick: onLogout, children: [
6051
6424
  /* @__PURE__ */ jsxRuntime.jsxs(
6052
6425
  "svg",
6053
6426
  {