@pollar/react 0.10.1-rc.4 → 0.10.1-rc.5
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 +27 -27
- package/dist/index.css +52 -7
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +377 -272
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -272
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1033,7 +1033,7 @@ var PollarModalFooter = () => {
|
|
|
1033
1033
|
/* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
1034
1034
|
/* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
|
|
1035
1035
|
"v",
|
|
1036
|
-
"0.10.1-rc.
|
|
1036
|
+
"0.10.1-rc.5"
|
|
1037
1037
|
] })
|
|
1038
1038
|
] })
|
|
1039
1039
|
] });
|
|
@@ -1065,16 +1065,7 @@ function CopyButton({ value, label = "Copy", className }) {
|
|
|
1065
1065
|
className: `pollar-copy-btn${className ? ` ${className}` : ""}`,
|
|
1066
1066
|
onClick: handleCopy,
|
|
1067
1067
|
"aria-label": copied ? "Copied" : label,
|
|
1068
|
-
children: copied ? /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx(
|
|
1069
|
-
"path",
|
|
1070
|
-
{
|
|
1071
|
-
d: "M3.5 7l2.5 2.5 4.5-5",
|
|
1072
|
-
stroke: "currentColor",
|
|
1073
|
-
strokeWidth: "1.5",
|
|
1074
|
-
strokeLinecap: "round",
|
|
1075
|
-
strokeLinejoin: "round"
|
|
1076
|
-
}
|
|
1077
|
-
) }) : /* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
1068
|
+
children: copied ? /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3.5 7l2.5 2.5 4.5-5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
1078
1069
|
/* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "8", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1079
1070
|
/* @__PURE__ */ jsx(
|
|
1080
1071
|
"path",
|
|
@@ -2281,12 +2272,38 @@ function PrivyLoginSubmodal({
|
|
|
2281
2272
|
fail(error);
|
|
2282
2273
|
}
|
|
2283
2274
|
}
|
|
2284
|
-
const BackButton = ({ onClick }) => /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": "Back", children: /* @__PURE__ */ jsx(
|
|
2275
|
+
const BackButton = ({ onClick }) => /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": "Back", children: /* @__PURE__ */ jsx(
|
|
2276
|
+
"svg",
|
|
2277
|
+
{
|
|
2278
|
+
width: "20",
|
|
2279
|
+
height: "20",
|
|
2280
|
+
viewBox: "0 0 24 24",
|
|
2281
|
+
fill: "none",
|
|
2282
|
+
stroke: "currentColor",
|
|
2283
|
+
strokeWidth: "2.5",
|
|
2284
|
+
strokeLinecap: "round",
|
|
2285
|
+
strokeLinejoin: "round",
|
|
2286
|
+
children: /* @__PURE__ */ jsx("path", { d: "M15 19l-7-7 7-7" })
|
|
2287
|
+
}
|
|
2288
|
+
) });
|
|
2285
2289
|
const showEmail = options.includes("email");
|
|
2286
2290
|
const showGoogle = options.includes("google");
|
|
2287
2291
|
const showGithub = options.includes("github");
|
|
2288
2292
|
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
2289
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": "Close", children: /* @__PURE__ */ jsx(
|
|
2293
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": "Close", children: /* @__PURE__ */ jsx(
|
|
2294
|
+
"svg",
|
|
2295
|
+
{
|
|
2296
|
+
width: "18",
|
|
2297
|
+
height: "18",
|
|
2298
|
+
viewBox: "0 0 24 24",
|
|
2299
|
+
fill: "none",
|
|
2300
|
+
stroke: "currentColor",
|
|
2301
|
+
strokeWidth: "2.5",
|
|
2302
|
+
strokeLinecap: "round",
|
|
2303
|
+
strokeLinejoin: "round",
|
|
2304
|
+
children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
2305
|
+
}
|
|
2306
|
+
) }),
|
|
2290
2307
|
/* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
|
|
2291
2308
|
/* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx("img", { src: logoUrl ?? LOGO_POLLAR, alt: "Logo", className: "pollar-logo" }) }),
|
|
2292
2309
|
/* @__PURE__ */ jsx("h2", { className: "pollar-title", children: appName }),
|
|
@@ -2539,8 +2556,7 @@ function flattenInstructions(instr) {
|
|
|
2539
2556
|
for (const [k, v] of Object.entries(instr)) {
|
|
2540
2557
|
let value = "";
|
|
2541
2558
|
if (typeof v === "string" || typeof v === "number") value = String(v);
|
|
2542
|
-
else if (Array.isArray(v))
|
|
2543
|
-
value = v.filter((x) => typeof x === "string" || typeof x === "number").join(", ");
|
|
2559
|
+
else if (Array.isArray(v)) value = v.filter((x) => typeof x === "string" || typeof x === "number").join(", ");
|
|
2544
2560
|
else continue;
|
|
2545
2561
|
if (!value) continue;
|
|
2546
2562
|
out.push({ key: k, label: INSTRUCTION_LABELS[k] ?? k, value });
|
|
@@ -2565,6 +2581,7 @@ function RampWidgetTemplate({
|
|
|
2565
2581
|
provider,
|
|
2566
2582
|
txStatus,
|
|
2567
2583
|
kycUrl,
|
|
2584
|
+
tosUrl,
|
|
2568
2585
|
stellarTxHash,
|
|
2569
2586
|
depositInstructions,
|
|
2570
2587
|
canComplete,
|
|
@@ -2578,6 +2595,7 @@ function RampWidgetTemplate({
|
|
|
2578
2595
|
onSelectQuote,
|
|
2579
2596
|
onContactContinue,
|
|
2580
2597
|
onOpenKyc,
|
|
2598
|
+
onOpenTos,
|
|
2581
2599
|
onCompleteWithdraw,
|
|
2582
2600
|
onRetry,
|
|
2583
2601
|
onRefresh,
|
|
@@ -2771,7 +2789,11 @@ function RampWidgetTemplate({
|
|
|
2771
2789
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: label }),
|
|
2772
2790
|
/* @__PURE__ */ jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsx("code", { style: { wordBreak: "break-all" }, children: value }) })
|
|
2773
2791
|
] }, key)),
|
|
2774
|
-
|
|
2792
|
+
tosUrl && !depositInstructions && txStatus !== "completed" && /* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-btn-primary", onClick: onOpenTos, children: [
|
|
2793
|
+
"Accept terms at ",
|
|
2794
|
+
provider
|
|
2795
|
+
] }),
|
|
2796
|
+
kycUrl && !depositInstructions && txStatus !== "completed" && /* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-btn-primary", onClick: onOpenKyc, children: [
|
|
2775
2797
|
"Continue at ",
|
|
2776
2798
|
provider
|
|
2777
2799
|
] }),
|
|
@@ -2813,6 +2835,7 @@ function RampWidget({ onClose }) {
|
|
|
2813
2835
|
const [txId, setTxId] = useState(null);
|
|
2814
2836
|
const [provider, setProvider] = useState("");
|
|
2815
2837
|
const [kycUrl, setKycUrl] = useState(null);
|
|
2838
|
+
const [tosUrl, setTosUrl] = useState(null);
|
|
2816
2839
|
const [txStatus, setTxStatus] = useState(null);
|
|
2817
2840
|
const [stellarTxHash, setStellarTxHash] = useState(null);
|
|
2818
2841
|
const [depositInstructions, setDepositInstructions] = useState(null);
|
|
@@ -2831,8 +2854,7 @@ function RampWidget({ onClose }) {
|
|
|
2831
2854
|
setTxStatus(tx.status);
|
|
2832
2855
|
if (tx.stellarTxHash) setStellarTxHash(tx.stellarTxHash);
|
|
2833
2856
|
if (tx.kycUrl) setKycUrl(tx.kycUrl);
|
|
2834
|
-
|
|
2835
|
-
if (di) setDepositInstructions(di);
|
|
2857
|
+
if (tx.depositInstructions) setDepositInstructions(tx.depositInstructions);
|
|
2836
2858
|
if (TERMINAL.includes(tx.status)) clearInterval(id);
|
|
2837
2859
|
} catch {
|
|
2838
2860
|
}
|
|
@@ -2880,8 +2902,7 @@ function RampWidget({ onClose }) {
|
|
|
2880
2902
|
setTxStatus(tx.status);
|
|
2881
2903
|
if (tx.stellarTxHash) setStellarTxHash(tx.stellarTxHash);
|
|
2882
2904
|
if (tx.kycUrl) setKycUrl(tx.kycUrl);
|
|
2883
|
-
|
|
2884
|
-
if (di) setDepositInstructions(di);
|
|
2905
|
+
if (tx.depositInstructions) setDepositInstructions(tx.depositInstructions);
|
|
2885
2906
|
}
|
|
2886
2907
|
} catch {
|
|
2887
2908
|
} finally {
|
|
@@ -2895,6 +2916,7 @@ function RampWidget({ onClose }) {
|
|
|
2895
2916
|
setTxId(null);
|
|
2896
2917
|
setProvider("");
|
|
2897
2918
|
setKycUrl(null);
|
|
2919
|
+
setTosUrl(null);
|
|
2898
2920
|
setTxStatus(null);
|
|
2899
2921
|
setStellarTxHash(null);
|
|
2900
2922
|
setDepositInstructions(null);
|
|
@@ -2921,6 +2943,7 @@ function RampWidget({ onClose }) {
|
|
|
2921
2943
|
return;
|
|
2922
2944
|
}
|
|
2923
2945
|
setKycUrl(result.kycUrl ?? null);
|
|
2946
|
+
setTosUrl(result.tosUrl ?? null);
|
|
2924
2947
|
setTxStatus(result.status);
|
|
2925
2948
|
setStellarTxHash(result.stellarTxHash ?? null);
|
|
2926
2949
|
setDepositInstructions(result.depositInstructions ?? null);
|
|
@@ -2985,6 +3008,9 @@ function RampWidget({ onClose }) {
|
|
|
2985
3008
|
function handleOpenKyc() {
|
|
2986
3009
|
if (kycUrl) window.open(kycUrl, "_blank", "noopener,noreferrer");
|
|
2987
3010
|
}
|
|
3011
|
+
function handleOpenTos() {
|
|
3012
|
+
if (tosUrl) window.open(tosUrl, "_blank", "noopener,noreferrer");
|
|
3013
|
+
}
|
|
2988
3014
|
async function handleCompleteWithdraw() {
|
|
2989
3015
|
if (!txId) return;
|
|
2990
3016
|
setCompleting(true);
|
|
@@ -3027,6 +3053,7 @@ function RampWidget({ onClose }) {
|
|
|
3027
3053
|
provider,
|
|
3028
3054
|
txStatus,
|
|
3029
3055
|
kycUrl,
|
|
3056
|
+
tosUrl,
|
|
3030
3057
|
stellarTxHash,
|
|
3031
3058
|
depositInstructions,
|
|
3032
3059
|
canComplete,
|
|
@@ -3040,6 +3067,7 @@ function RampWidget({ onClose }) {
|
|
|
3040
3067
|
onSelectQuote: handleSelectQuote,
|
|
3041
3068
|
onContactContinue: handleContactContinue,
|
|
3042
3069
|
onOpenKyc: handleOpenKyc,
|
|
3070
|
+
onOpenTos: handleOpenTos,
|
|
3043
3071
|
onCompleteWithdraw: handleCompleteWithdraw,
|
|
3044
3072
|
onRetry: resetToInput,
|
|
3045
3073
|
onRefresh: handleRefresh,
|
|
@@ -3205,6 +3233,43 @@ function ReceiveModal({ onClose }) {
|
|
|
3205
3233
|
}
|
|
3206
3234
|
) });
|
|
3207
3235
|
}
|
|
3236
|
+
function formatAmount2(value) {
|
|
3237
|
+
const n = parseFloat(value);
|
|
3238
|
+
return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
|
|
3239
|
+
}
|
|
3240
|
+
var optionLabel = (o) => o.available !== void 0 ? `${o.code} \u2014 ${formatAmount2(o.available)} available` : o.code;
|
|
3241
|
+
function AssetSelect({
|
|
3242
|
+
label,
|
|
3243
|
+
value,
|
|
3244
|
+
options,
|
|
3245
|
+
onChange,
|
|
3246
|
+
loading = false,
|
|
3247
|
+
disabled = false,
|
|
3248
|
+
appGroupLabel = "App assets",
|
|
3249
|
+
otherGroupLabel = "Other assets",
|
|
3250
|
+
children
|
|
3251
|
+
}) {
|
|
3252
|
+
const appAssets = options.filter((o) => o.enabledInApp);
|
|
3253
|
+
const otherAssets = options.filter((o) => !o.enabledInApp);
|
|
3254
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
3255
|
+
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: label }),
|
|
3256
|
+
loading ? /* @__PURE__ */ jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxs(
|
|
3257
|
+
"select",
|
|
3258
|
+
{
|
|
3259
|
+
className: "pollar-input pollar-send-select",
|
|
3260
|
+
value,
|
|
3261
|
+
disabled,
|
|
3262
|
+
onChange: (e) => onChange(e.target.value),
|
|
3263
|
+
children: [
|
|
3264
|
+
value === "" && /* @__PURE__ */ jsx("option", { value: "", disabled: true, hidden: true }),
|
|
3265
|
+
appAssets.length > 0 && /* @__PURE__ */ jsx("optgroup", { label: appGroupLabel, children: appAssets.map((o) => /* @__PURE__ */ jsx("option", { value: o.key, children: optionLabel(o) }, o.key)) }),
|
|
3266
|
+
otherAssets.length > 0 && /* @__PURE__ */ jsx("optgroup", { label: otherGroupLabel, children: otherAssets.map((o) => /* @__PURE__ */ jsx("option", { value: o.key, children: optionLabel(o) }, o.key)) })
|
|
3267
|
+
]
|
|
3268
|
+
}
|
|
3269
|
+
),
|
|
3270
|
+
!loading && children
|
|
3271
|
+
] });
|
|
3272
|
+
}
|
|
3208
3273
|
var STATUS_MESSAGES = {
|
|
3209
3274
|
idle: "",
|
|
3210
3275
|
building: "Building transaction\u2026",
|
|
@@ -3457,8 +3522,6 @@ function SendModalTemplate({
|
|
|
3457
3522
|
"--pollar-input-border-radius": "0.5rem",
|
|
3458
3523
|
"--pollar-card-border-radius": "10px"
|
|
3459
3524
|
};
|
|
3460
|
-
const enabledAssets = assets.filter((a) => a.enabledInApp);
|
|
3461
|
-
const otherAssets = assets.filter((a) => !a.enabledInApp);
|
|
3462
3525
|
const selectedKey = selectedAsset ? assetKey3(selectedAsset) : "";
|
|
3463
3526
|
const canSubmit = !!selectedAsset && !!amount && !!destination.trim() && !isLoadingBalance;
|
|
3464
3527
|
const title = step === "form" ? "Send" : txTitle;
|
|
@@ -3478,36 +3541,24 @@ function SendModalTemplate({
|
|
|
3478
3541
|
!isInProgress && /* @__PURE__ */ jsx("div", { className: "pollar-modal-header-actions", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) }) })
|
|
3479
3542
|
] }),
|
|
3480
3543
|
step === "form" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3481
|
-
/* @__PURE__ */
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
"
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
a.code,
|
|
3497
|
-
" \u2014 ",
|
|
3498
|
-
formatBalance(a.available),
|
|
3499
|
-
" available"
|
|
3500
|
-
] }, assetKey3(a))) }),
|
|
3501
|
-
otherAssets.length > 0 && /* @__PURE__ */ jsx("optgroup", { label: "Other assets", children: otherAssets.map((a) => /* @__PURE__ */ jsxs("option", { value: assetKey3(a), children: [
|
|
3502
|
-
a.code,
|
|
3503
|
-
" \u2014 ",
|
|
3504
|
-
formatBalance(a.available),
|
|
3505
|
-
" available"
|
|
3506
|
-
] }, assetKey3(a))) })
|
|
3507
|
-
]
|
|
3544
|
+
/* @__PURE__ */ jsx(
|
|
3545
|
+
AssetSelect,
|
|
3546
|
+
{
|
|
3547
|
+
label: "Asset",
|
|
3548
|
+
value: selectedKey,
|
|
3549
|
+
loading: isLoadingBalance,
|
|
3550
|
+
options: assets.map((a) => ({
|
|
3551
|
+
key: assetKey3(a),
|
|
3552
|
+
code: a.code,
|
|
3553
|
+
available: a.available,
|
|
3554
|
+
enabledInApp: a.enabledInApp
|
|
3555
|
+
})),
|
|
3556
|
+
onChange: (key) => {
|
|
3557
|
+
const found = assets.find((a) => assetKey3(a) === key);
|
|
3558
|
+
if (found) onSelectAsset(found);
|
|
3508
3559
|
}
|
|
3509
|
-
|
|
3510
|
-
|
|
3560
|
+
}
|
|
3561
|
+
),
|
|
3511
3562
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
3512
3563
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-label-row", children: [
|
|
3513
3564
|
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Amount" }),
|
|
@@ -3607,8 +3658,11 @@ function SendModal({ onClose }) {
|
|
|
3607
3658
|
const allAssets = balanceData?.balances ?? [];
|
|
3608
3659
|
const sortedAssets = [
|
|
3609
3660
|
...allAssets.filter((b) => b.enabledInApp),
|
|
3610
|
-
...allAssets.filter((b) => !b.enabledInApp && parseFloat(b.balance) > 0)
|
|
3661
|
+
...allAssets.filter((b) => !b.enabledInApp && (b.type === "native" || parseFloat(b.balance) > 0))
|
|
3611
3662
|
];
|
|
3663
|
+
useEffect(() => {
|
|
3664
|
+
if (!selectedAsset && sortedAssets.length > 0) setSelectedAsset(sortedAssets[0]);
|
|
3665
|
+
}, [sortedAssets, selectedAsset]);
|
|
3612
3666
|
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
3613
3667
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
3614
3668
|
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
|
|
@@ -3715,7 +3769,7 @@ var PROVIDER_LABELS = {
|
|
|
3715
3769
|
soroswap: "Soroswap",
|
|
3716
3770
|
sdex: "Stellar DEX"
|
|
3717
3771
|
};
|
|
3718
|
-
function
|
|
3772
|
+
function formatAmount3(value) {
|
|
3719
3773
|
const n = parseFloat(value);
|
|
3720
3774
|
return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
|
|
3721
3775
|
}
|
|
@@ -3798,214 +3852,229 @@ function SwapModalTemplate({
|
|
|
3798
3852
|
const buyKey = selectedBuy ? assetOptionKey(selectedBuy) : "";
|
|
3799
3853
|
const canSwap = !smartUnsupported && !!selectedSell && !!selectedBuy && !!amount && !!quote && !quoteLoading && !isLoadingData;
|
|
3800
3854
|
const title = step === "form" ? "Swap" : txTitle;
|
|
3801
|
-
return /* @__PURE__ */ jsxs(
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
{
|
|
3811
|
-
type: "button",
|
|
3812
|
-
className: "pollar-modal-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
"
|
|
3816
|
-
|
|
3817
|
-
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx(
|
|
3818
|
-
"path",
|
|
3855
|
+
return /* @__PURE__ */ jsxs(
|
|
3856
|
+
"div",
|
|
3857
|
+
{
|
|
3858
|
+
className: "pollar-modal-card pollar-send-modal",
|
|
3859
|
+
"data-theme": theme,
|
|
3860
|
+
style: cssVars,
|
|
3861
|
+
onClick: (e) => e.stopPropagation(),
|
|
3862
|
+
children: [
|
|
3863
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
|
|
3864
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-send-header-left", children: [
|
|
3865
|
+
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" }) }) }),
|
|
3866
|
+
/* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
|
|
3867
|
+
] }),
|
|
3868
|
+
!isInProgress && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
3869
|
+
step === "form" && /* @__PURE__ */ jsx(
|
|
3870
|
+
"button",
|
|
3819
3871
|
{
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3872
|
+
type: "button",
|
|
3873
|
+
className: "pollar-modal-close",
|
|
3874
|
+
onClick: onRefresh,
|
|
3875
|
+
disabled: configLoading || isLoadingData,
|
|
3876
|
+
"aria-label": "Refresh",
|
|
3877
|
+
title: "Refresh balances and options",
|
|
3878
|
+
children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx(
|
|
3879
|
+
"path",
|
|
3880
|
+
{
|
|
3881
|
+
d: "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2.5v3h-3",
|
|
3882
|
+
stroke: "currentColor",
|
|
3883
|
+
strokeWidth: "1.6",
|
|
3884
|
+
strokeLinecap: "round",
|
|
3885
|
+
strokeLinejoin: "round"
|
|
3886
|
+
}
|
|
3887
|
+
) })
|
|
3825
3888
|
}
|
|
3826
|
-
)
|
|
3827
|
-
|
|
3828
|
-
),
|
|
3829
|
-
/* @__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" }) }) })
|
|
3830
|
-
] })
|
|
3831
|
-
] }),
|
|
3832
|
-
step === "form" && configLoading && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "Loading swap options\u2026" }),
|
|
3833
|
-
step === "form" && !configLoading && swapUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Swap is not available for this app." }),
|
|
3834
|
-
step === "form" && !configLoading && !swapUnavailable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3835
|
-
smartUnsupported && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Swaps are not yet available for smart (passkey) wallets." }),
|
|
3836
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
3837
|
-
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "You pay" }),
|
|
3838
|
-
isLoadingData ? /* @__PURE__ */ jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxs(
|
|
3839
|
-
"select",
|
|
3840
|
-
{
|
|
3841
|
-
className: "pollar-input pollar-send-select",
|
|
3842
|
-
value: sellKey,
|
|
3843
|
-
onChange: (e) => {
|
|
3844
|
-
const found = sellOptions.find((o) => assetOptionKey(o) === e.target.value);
|
|
3845
|
-
if (found) onSelectSell(found);
|
|
3846
|
-
},
|
|
3847
|
-
children: [
|
|
3848
|
-
/* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select asset to sell" }),
|
|
3849
|
-
sellOptions.map((o) => /* @__PURE__ */ jsxs("option", { value: assetOptionKey(o), children: [
|
|
3850
|
-
o.code,
|
|
3851
|
-
o.available !== void 0 ? ` \u2014 ${formatAmount2(o.available)} available` : ""
|
|
3852
|
-
] }, assetOptionKey(o)))
|
|
3853
|
-
]
|
|
3854
|
-
}
|
|
3855
|
-
)
|
|
3856
|
-
] }),
|
|
3857
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
3858
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-send-label-row", children: [
|
|
3859
|
-
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Amount" }),
|
|
3860
|
-
selectedSell?.available !== void 0 && /* @__PURE__ */ jsxs("span", { className: "pollar-send-hint", children: [
|
|
3861
|
-
"Available: ",
|
|
3862
|
-
formatAmount2(selectedSell.available),
|
|
3863
|
-
" ",
|
|
3864
|
-
selectedSell.code
|
|
3889
|
+
),
|
|
3890
|
+
/* @__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" }) }) })
|
|
3865
3891
|
] })
|
|
3866
3892
|
] }),
|
|
3867
|
-
/* @__PURE__ */ jsx(
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
type: "text",
|
|
3872
|
-
inputMode: "decimal",
|
|
3873
|
-
placeholder: "0.00",
|
|
3874
|
-
value: amount,
|
|
3875
|
-
onChange: (e) => onAmountChange(e.target.value)
|
|
3876
|
-
}
|
|
3877
|
-
)
|
|
3878
|
-
] }),
|
|
3879
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
3880
|
-
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "You receive" }),
|
|
3881
|
-
isLoadingData ? /* @__PURE__ */ jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxs(
|
|
3882
|
-
"select",
|
|
3883
|
-
{
|
|
3884
|
-
className: "pollar-input pollar-send-select",
|
|
3885
|
-
value: buyKey,
|
|
3886
|
-
onChange: (e) => {
|
|
3887
|
-
const found = buyOptions.find((o) => assetOptionKey(o) === e.target.value);
|
|
3888
|
-
if (found) onSelectBuy(found);
|
|
3889
|
-
},
|
|
3890
|
-
children: [
|
|
3891
|
-
/* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select asset to buy" }),
|
|
3892
|
-
buyOptions.map((o) => /* @__PURE__ */ jsxs("option", { value: assetOptionKey(o), children: [
|
|
3893
|
-
o.code,
|
|
3894
|
-
o.enabledInApp ? "" : " (external)"
|
|
3895
|
-
] }, assetOptionKey(o)))
|
|
3896
|
-
]
|
|
3897
|
-
}
|
|
3898
|
-
),
|
|
3899
|
-
!isLoadingData && (customOpen ? /* @__PURE__ */ jsxs("div", { className: "pollar-swap-custom", children: [
|
|
3893
|
+
step === "form" && configLoading && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "Loading swap options\u2026" }),
|
|
3894
|
+
step === "form" && !configLoading && swapUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Swap is not available for this app." }),
|
|
3895
|
+
step === "form" && !swapUnavailable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3896
|
+
smartUnsupported && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Swaps are not yet available for smart (passkey) wallets." }),
|
|
3900
3897
|
/* @__PURE__ */ jsx(
|
|
3901
|
-
|
|
3898
|
+
AssetSelect,
|
|
3902
3899
|
{
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3900
|
+
label: "You pay",
|
|
3901
|
+
value: sellKey,
|
|
3902
|
+
loading: isLoadingData,
|
|
3903
|
+
disabled: configLoading,
|
|
3904
|
+
options: sellOptions.map((o) => ({
|
|
3905
|
+
key: assetOptionKey(o),
|
|
3906
|
+
code: o.code,
|
|
3907
|
+
available: o.available,
|
|
3908
|
+
enabledInApp: o.enabledInApp
|
|
3909
|
+
})),
|
|
3910
|
+
onChange: (key) => {
|
|
3911
|
+
const found = sellOptions.find((o) => assetOptionKey(o) === key);
|
|
3912
|
+
if (found) onSelectSell(found);
|
|
3913
|
+
}
|
|
3908
3914
|
}
|
|
3909
3915
|
),
|
|
3916
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
3917
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-send-label-row", children: [
|
|
3918
|
+
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Amount" }),
|
|
3919
|
+
selectedSell?.available !== void 0 && /* @__PURE__ */ jsxs("span", { className: "pollar-send-hint", children: [
|
|
3920
|
+
"Available: ",
|
|
3921
|
+
formatAmount3(selectedSell.available),
|
|
3922
|
+
" ",
|
|
3923
|
+
selectedSell.code
|
|
3924
|
+
] })
|
|
3925
|
+
] }),
|
|
3926
|
+
/* @__PURE__ */ jsx(
|
|
3927
|
+
"input",
|
|
3928
|
+
{
|
|
3929
|
+
className: "pollar-input",
|
|
3930
|
+
type: "text",
|
|
3931
|
+
inputMode: "decimal",
|
|
3932
|
+
placeholder: "0.00",
|
|
3933
|
+
value: amount,
|
|
3934
|
+
disabled: configLoading,
|
|
3935
|
+
onChange: (e) => onAmountChange(e.target.value)
|
|
3936
|
+
}
|
|
3937
|
+
)
|
|
3938
|
+
] }),
|
|
3910
3939
|
/* @__PURE__ */ jsx(
|
|
3911
|
-
|
|
3940
|
+
AssetSelect,
|
|
3912
3941
|
{
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3942
|
+
label: "You receive",
|
|
3943
|
+
value: buyKey,
|
|
3944
|
+
loading: isLoadingData,
|
|
3945
|
+
disabled: configLoading,
|
|
3946
|
+
options: buyOptions.map((o) => ({
|
|
3947
|
+
key: assetOptionKey(o),
|
|
3948
|
+
code: o.code,
|
|
3949
|
+
enabledInApp: o.enabledInApp
|
|
3950
|
+
})),
|
|
3951
|
+
onChange: (key) => {
|
|
3952
|
+
const found = buyOptions.find((o) => assetOptionKey(o) === key);
|
|
3953
|
+
if (found) onSelectBuy(found);
|
|
3954
|
+
},
|
|
3955
|
+
children: customOpen ? /* @__PURE__ */ jsxs("div", { className: "pollar-swap-custom", children: [
|
|
3956
|
+
/* @__PURE__ */ jsx(
|
|
3957
|
+
"input",
|
|
3958
|
+
{
|
|
3959
|
+
className: "pollar-input",
|
|
3960
|
+
type: "text",
|
|
3961
|
+
placeholder: "Code (e.g. USDC)",
|
|
3962
|
+
value: customCode,
|
|
3963
|
+
onChange: (e) => setCustomCode(e.target.value)
|
|
3964
|
+
}
|
|
3965
|
+
),
|
|
3966
|
+
/* @__PURE__ */ jsx(
|
|
3967
|
+
"input",
|
|
3968
|
+
{
|
|
3969
|
+
className: "pollar-input",
|
|
3970
|
+
type: "text",
|
|
3971
|
+
placeholder: "Issuer (G...)",
|
|
3972
|
+
value: customIssuer,
|
|
3973
|
+
onChange: (e) => setCustomIssuer(e.target.value)
|
|
3974
|
+
}
|
|
3975
|
+
),
|
|
3976
|
+
customError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: customError }),
|
|
3977
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-custom-actions", children: [
|
|
3978
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: submitCustomToken, children: "Add token" }),
|
|
3979
|
+
/* @__PURE__ */ jsx(
|
|
3980
|
+
"button",
|
|
3981
|
+
{
|
|
3982
|
+
type: "button",
|
|
3983
|
+
className: "pollar-swap-custom-cancel",
|
|
3984
|
+
onClick: () => {
|
|
3985
|
+
setCustomOpen(false);
|
|
3986
|
+
setCustomError("");
|
|
3987
|
+
},
|
|
3988
|
+
children: "Cancel"
|
|
3989
|
+
}
|
|
3990
|
+
)
|
|
3991
|
+
] })
|
|
3992
|
+
] }) : /* @__PURE__ */ jsx(
|
|
3993
|
+
"button",
|
|
3994
|
+
{
|
|
3995
|
+
type: "button",
|
|
3996
|
+
className: "pollar-swap-custom-toggle",
|
|
3997
|
+
disabled: configLoading,
|
|
3998
|
+
onClick: () => setCustomOpen(true),
|
|
3999
|
+
children: "+ Add a token by code / issuer"
|
|
4000
|
+
}
|
|
4001
|
+
)
|
|
3918
4002
|
}
|
|
3919
4003
|
),
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: submitCustomToken, children: "Add token" }),
|
|
4004
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
4005
|
+
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Route" }),
|
|
3923
4006
|
/* @__PURE__ */ jsx(
|
|
3924
|
-
"
|
|
4007
|
+
"select",
|
|
3925
4008
|
{
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
},
|
|
3932
|
-
children: "Cancel"
|
|
4009
|
+
className: "pollar-input pollar-send-select",
|
|
4010
|
+
value: provider,
|
|
4011
|
+
disabled: configLoading || providers.length === 0,
|
|
4012
|
+
onChange: (e) => onProviderChange(e.target.value),
|
|
4013
|
+
children: providers.length === 0 ? /* @__PURE__ */ jsx("option", { value: provider, children: configLoading ? "Loading\u2026" : PROVIDER_LABELS[provider] }) : providers.map((p) => /* @__PURE__ */ jsx("option", { value: p, children: PROVIDER_LABELS[p] }, p))
|
|
3933
4014
|
}
|
|
3934
4015
|
)
|
|
3935
|
-
] })
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
4016
|
+
] }),
|
|
4017
|
+
quoteLoading && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "Fetching best price\u2026" }),
|
|
4018
|
+
!quoteLoading && quoteError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: quoteError }),
|
|
4019
|
+
!quoteLoading && !quoteError && quote && selectedBuy && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote", children: [
|
|
4020
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
4021
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "You receive" }),
|
|
4022
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4023
|
+
"~ ",
|
|
4024
|
+
formatAmount3(quote.amountOut),
|
|
4025
|
+
" ",
|
|
4026
|
+
selectedBuy.code
|
|
4027
|
+
] })
|
|
4028
|
+
] }),
|
|
4029
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
4030
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Minimum received" }),
|
|
4031
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4032
|
+
formatAmount3(quote.minReceived),
|
|
4033
|
+
" ",
|
|
4034
|
+
selectedBuy.code
|
|
4035
|
+
] })
|
|
4036
|
+
] }),
|
|
4037
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
4038
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Price impact" }),
|
|
4039
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4040
|
+
quote.priceImpactPct,
|
|
4041
|
+
"%"
|
|
4042
|
+
] })
|
|
4043
|
+
] }),
|
|
4044
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
4045
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Route" }),
|
|
4046
|
+
/* @__PURE__ */ jsx("span", { children: PROVIDER_LABELS[quote.provider] })
|
|
4047
|
+
] })
|
|
4048
|
+
] }),
|
|
4049
|
+
!quoteLoading && !quoteError && !quote && selectedSell && selectedBuy && !!amount && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "No route found for this pair." }),
|
|
4050
|
+
buyNeedsTrustline && selectedBuy && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-trustline-notice", children: [
|
|
4051
|
+
"To receive ",
|
|
4052
|
+
selectedBuy.code,
|
|
4053
|
+
" your wallet needs a trustline. Swapping will create it first (~0.5 XLM reserve, refundable if you later remove it)."
|
|
4054
|
+
] }),
|
|
4055
|
+
formError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: formError }),
|
|
4056
|
+
/* @__PURE__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary", onClick: onSwap, disabled: !canSwap, children: buyNeedsTrustline ? "Create trustline & swap" : "Swap" }) })
|
|
4057
|
+
] }),
|
|
4058
|
+
step === "tx" && /* @__PURE__ */ jsx(
|
|
4059
|
+
TxStatusView,
|
|
3942
4060
|
{
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
4061
|
+
transaction,
|
|
4062
|
+
showXdr,
|
|
4063
|
+
copied,
|
|
4064
|
+
explorerUrl,
|
|
4065
|
+
walletType,
|
|
4066
|
+
onSignAndSend: () => {
|
|
4067
|
+
},
|
|
4068
|
+
onToggleXdr,
|
|
4069
|
+
onCopyHash,
|
|
4070
|
+
onRetry,
|
|
4071
|
+
onDone
|
|
3947
4072
|
}
|
|
3948
|
-
)
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
3954
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "You receive" }),
|
|
3955
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
3956
|
-
"~ ",
|
|
3957
|
-
formatAmount2(quote.amountOut),
|
|
3958
|
-
" ",
|
|
3959
|
-
selectedBuy.code
|
|
3960
|
-
] })
|
|
3961
|
-
] }),
|
|
3962
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
3963
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Minimum received" }),
|
|
3964
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
3965
|
-
formatAmount2(quote.minReceived),
|
|
3966
|
-
" ",
|
|
3967
|
-
selectedBuy.code
|
|
3968
|
-
] })
|
|
3969
|
-
] }),
|
|
3970
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
3971
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Price impact" }),
|
|
3972
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
3973
|
-
quote.priceImpactPct,
|
|
3974
|
-
"%"
|
|
3975
|
-
] })
|
|
3976
|
-
] }),
|
|
3977
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
3978
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "Route" }),
|
|
3979
|
-
/* @__PURE__ */ jsx("span", { children: PROVIDER_LABELS[quote.provider] })
|
|
3980
|
-
] })
|
|
3981
|
-
] }),
|
|
3982
|
-
!quoteLoading && !quoteError && !quote && selectedSell && selectedBuy && !!amount && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: "No route found for this pair." }),
|
|
3983
|
-
buyNeedsTrustline && selectedBuy && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-trustline-notice", children: [
|
|
3984
|
-
"To receive ",
|
|
3985
|
-
selectedBuy.code,
|
|
3986
|
-
" your wallet needs a trustline. Swapping will create it first (~0.5 XLM reserve, refundable if you later remove it)."
|
|
3987
|
-
] }),
|
|
3988
|
-
formError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: formError }),
|
|
3989
|
-
/* @__PURE__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary", onClick: onSwap, disabled: !canSwap, children: buyNeedsTrustline ? "Create trustline & swap" : "Swap" }) })
|
|
3990
|
-
] }),
|
|
3991
|
-
step === "tx" && /* @__PURE__ */ jsx(
|
|
3992
|
-
TxStatusView,
|
|
3993
|
-
{
|
|
3994
|
-
transaction,
|
|
3995
|
-
showXdr,
|
|
3996
|
-
copied,
|
|
3997
|
-
explorerUrl,
|
|
3998
|
-
walletType,
|
|
3999
|
-
onSignAndSend: () => {
|
|
4000
|
-
},
|
|
4001
|
-
onToggleXdr,
|
|
4002
|
-
onCopyHash,
|
|
4003
|
-
onRetry,
|
|
4004
|
-
onDone
|
|
4005
|
-
}
|
|
4006
|
-
),
|
|
4007
|
-
/* @__PURE__ */ jsx(PollarModalFooter, {})
|
|
4008
|
-
] });
|
|
4073
|
+
),
|
|
4074
|
+
/* @__PURE__ */ jsx(PollarModalFooter, {})
|
|
4075
|
+
]
|
|
4076
|
+
}
|
|
4077
|
+
);
|
|
4009
4078
|
}
|
|
4010
4079
|
var QUOTE_DEBOUNCE_MS = 400;
|
|
4011
4080
|
function toRef(a) {
|
|
@@ -4083,7 +4152,7 @@ function SwapModal({ onClose }) {
|
|
|
4083
4152
|
const balances = walletBalance.step === "loaded" ? walletBalance.data.balances : [];
|
|
4084
4153
|
const assetRecords = enabledAssets.step === "loaded" ? enabledAssets.data.assets : [];
|
|
4085
4154
|
const isLoadingData = walletBalance.step === "loading" || enabledAssets.step === "loading";
|
|
4086
|
-
const sellOptions = balances.filter((b) =>
|
|
4155
|
+
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 }));
|
|
4087
4156
|
const buyKeyOfSell = selectedSell ? `${selectedSell.code}:${selectedSell.issuer ?? "native"}` : "";
|
|
4088
4157
|
const optKey = (o) => `${o.code}:${o.issuer ?? "native"}`;
|
|
4089
4158
|
const enabledBuy = assetRecords.map((a) => ({
|
|
@@ -4101,9 +4170,19 @@ function SwapModal({ onClose }) {
|
|
|
4101
4170
|
})).filter((o) => !enabledKeys.has(optKey(o)));
|
|
4102
4171
|
const knownKeys = /* @__PURE__ */ new Set([...enabledKeys, ...catalogBuy.map(optKey)]);
|
|
4103
4172
|
const customBuy = customTokens.filter((o) => !knownKeys.has(optKey(o)));
|
|
4104
|
-
const buyOptions = [...enabledBuy, ...catalogBuy, ...customBuy].filter(
|
|
4105
|
-
|
|
4106
|
-
|
|
4173
|
+
const buyOptions = [...enabledBuy, ...catalogBuy, ...customBuy].filter((o) => optKey(o) !== buyKeyOfSell);
|
|
4174
|
+
useEffect(() => {
|
|
4175
|
+
if (sellOptions.length === 0) return;
|
|
4176
|
+
if (!selectedSell || !sellOptions.some((o) => optKey(o) === optKey(selectedSell))) {
|
|
4177
|
+
setSelectedSell(sellOptions[0]);
|
|
4178
|
+
}
|
|
4179
|
+
}, [sellOptions, selectedSell]);
|
|
4180
|
+
useEffect(() => {
|
|
4181
|
+
if (buyOptions.length === 0) return;
|
|
4182
|
+
if (!selectedBuy || !buyOptions.some((o) => optKey(o) === optKey(selectedBuy))) {
|
|
4183
|
+
setSelectedBuy(buyOptions[0]);
|
|
4184
|
+
}
|
|
4185
|
+
}, [buyOptions, selectedBuy]);
|
|
4107
4186
|
function addCustomToken(code, issuer) {
|
|
4108
4187
|
const c = code.trim().toUpperCase();
|
|
4109
4188
|
const i = issuer.trim();
|
|
@@ -4613,6 +4692,9 @@ function StatusBadge({ status }) {
|
|
|
4613
4692
|
function formatDate(iso) {
|
|
4614
4693
|
return new Date(iso).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
|
|
4615
4694
|
}
|
|
4695
|
+
function truncateMiddle(value, head = 4, tail = 4) {
|
|
4696
|
+
return value.length <= head + tail + 1 ? value : `${value.slice(0, head)}\u2026${value.slice(-tail)}`;
|
|
4697
|
+
}
|
|
4616
4698
|
function TxHistoryModalTemplate({
|
|
4617
4699
|
theme,
|
|
4618
4700
|
accentColor,
|
|
@@ -4685,11 +4767,31 @@ function TxHistoryModalTemplate({
|
|
|
4685
4767
|
txHistory.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
|
|
4686
4768
|
txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
|
|
4687
4769
|
records.map((record) => {
|
|
4688
|
-
const
|
|
4770
|
+
const hash = typeof record.hash === "string" && record.hash.length > 0 ? record.hash : void 0;
|
|
4771
|
+
const explorerUrl = hash ? `https://stellar.expert/explorer/${record.network === "testnet" ? "testnet" : "public"}/tx/${hash}` : void 0;
|
|
4689
4772
|
const destination = typeof record.details?.destination === "string" ? record.details.destination : void 0;
|
|
4773
|
+
const asset = typeof record.details?.asset === "string" ? record.details.asset : void 0;
|
|
4774
|
+
const colon = asset ? asset.indexOf(":") : -1;
|
|
4775
|
+
const trustline = record.operation === "change_trust" && asset && colon > 0 ? {
|
|
4776
|
+
prefix: record.summary.split(":")[0],
|
|
4777
|
+
code: asset.slice(0, colon),
|
|
4778
|
+
issuer: asset.slice(colon + 1)
|
|
4779
|
+
} : void 0;
|
|
4690
4780
|
return /* @__PURE__ */ jsxs("div", { className: "pollar-hist-item", children: [
|
|
4691
|
-
/* @__PURE__ */
|
|
4692
|
-
|
|
4781
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-hist-item-top", children: [
|
|
4782
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-hist-item-summary", children: trustline ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4783
|
+
/* @__PURE__ */ jsxs("span", { className: "pollar-hist-item-title", children: [
|
|
4784
|
+
trustline.prefix,
|
|
4785
|
+
": ",
|
|
4786
|
+
trustline.code
|
|
4787
|
+
] }),
|
|
4788
|
+
/* @__PURE__ */ jsxs("span", { className: "pollar-hist-item-issuer", children: [
|
|
4789
|
+
truncateMiddle(trustline.issuer),
|
|
4790
|
+
/* @__PURE__ */ jsx(CopyButton, { value: trustline.issuer, label: "Copy issuer", className: "pollar-copy-btn-sm" })
|
|
4791
|
+
] })
|
|
4792
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "pollar-hist-item-title", children: record.summary }) }),
|
|
4793
|
+
/* @__PURE__ */ jsx(StatusBadge, { status: record.status })
|
|
4794
|
+
] }),
|
|
4693
4795
|
/* @__PURE__ */ jsxs("span", { className: "pollar-hist-item-meta", children: [
|
|
4694
4796
|
/* @__PURE__ */ jsx("span", { children: record.operation }),
|
|
4695
4797
|
typeof record.details?.sponsored === "boolean" && /* @__PURE__ */ jsxs("span", { children: [
|
|
@@ -4701,25 +4803,29 @@ function TxHistoryModalTemplate({
|
|
|
4701
4803
|
record.feeXlm,
|
|
4702
4804
|
" XLM"
|
|
4703
4805
|
] }),
|
|
4704
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
4705
|
-
"\xB7 ",
|
|
4706
|
-
formatDate(record.createdAt)
|
|
4707
|
-
] }),
|
|
4708
4806
|
destination && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4709
4807
|
/* @__PURE__ */ jsx("span", { children: "\xB7" }),
|
|
4710
|
-
/* @__PURE__ */
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4808
|
+
/* @__PURE__ */ jsxs("span", { className: "pollar-hist-item-issuer", children: [
|
|
4809
|
+
truncateMiddle(destination),
|
|
4810
|
+
/* @__PURE__ */ jsx(CopyButton, { value: destination, label: "Copy wallet address", className: "pollar-copy-btn-sm" })
|
|
4811
|
+
] })
|
|
4812
|
+
] })
|
|
4813
|
+
] }),
|
|
4814
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-hist-item-footer", children: [
|
|
4815
|
+
/* @__PURE__ */ jsx("span", { children: formatDate(record.createdAt) }),
|
|
4816
|
+
hash && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4817
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-hist-item-dot", children: "\xB7" }),
|
|
4818
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-hist-item-hash", children: truncateMiddle(hash, 6, 6) }),
|
|
4819
|
+
/* @__PURE__ */ jsx(CopyButton, { value: hash, label: "Copy transaction hash", className: "pollar-copy-btn-sm" }),
|
|
4820
|
+
/* @__PURE__ */ jsx(
|
|
4821
|
+
"a",
|
|
4822
|
+
{
|
|
4823
|
+
className: "pollar-hist-item-explorer",
|
|
4824
|
+
href: explorerUrl,
|
|
4825
|
+
target: "_blank",
|
|
4826
|
+
rel: "noopener noreferrer",
|
|
4827
|
+
"aria-label": "View on Stellar Explorer",
|
|
4828
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
4723
4829
|
/* @__PURE__ */ jsx(
|
|
4724
4830
|
"path",
|
|
4725
4831
|
{
|
|
@@ -4739,11 +4845,10 @@ function TxHistoryModalTemplate({
|
|
|
4739
4845
|
strokeLinejoin: "round"
|
|
4740
4846
|
}
|
|
4741
4847
|
)
|
|
4742
|
-
] })
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
)
|
|
4848
|
+
] })
|
|
4849
|
+
}
|
|
4850
|
+
)
|
|
4851
|
+
] })
|
|
4747
4852
|
] })
|
|
4748
4853
|
] }, record.id);
|
|
4749
4854
|
})
|