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