@glacislabs/stablegenie-zerodelta 2.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-DSQ7MRF7.js → chunk-DH7QYQG4.js} +152 -152
- package/dist/index.cjs +152 -152
- package/dist/index.js +1 -1
- package/dist/mount.cjs +152 -152
- package/dist/mount.js +1 -1
- package/dist/standalone.global.js +13 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2060,6 +2060,10 @@ var WIDGET_CSS = `
|
|
|
2060
2060
|
.sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2061
2061
|
.sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2062
2062
|
.sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
|
|
2063
|
+
.sg-funding-glyphs{display:flex;align-items:center;flex:0 0 auto;padding-right:2px}
|
|
2064
|
+
.sg-funding-glyphs .sg-tok{box-shadow:0 0 0 2px var(--sg-surface);border-radius:999px}
|
|
2065
|
+
.sg-funding-glyphs .sg-tok+.sg-tok{margin-left:-8px}
|
|
2066
|
+
.sg-funding-copy{display:flex;flex-direction:column;min-width:0}
|
|
2063
2067
|
.sg-ft-arrow{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:30px;height:30px;border-radius:999px;background:var(--sg-bg);border:1px solid var(--sg-border);display:flex;align-items:center;justify-content:center;color:var(--sg-text-muted);z-index:1;pointer-events:none}
|
|
2064
2068
|
|
|
2065
2069
|
/* token identity: logo circle + tiny chain badge, with a letters fallback */
|
|
@@ -2247,9 +2251,7 @@ var WIDGET_CSS = `
|
|
|
2247
2251
|
.sg-soonpanel-title{font-size:14px;font-weight:700;margin-bottom:6px}
|
|
2248
2252
|
.sg-soonpanel-sub{font-size:12px;color:var(--sg-text-muted);line-height:1.45}
|
|
2249
2253
|
|
|
2250
|
-
/*
|
|
2251
|
-
the payer never edits it). Reveal mirrors the island's grid-rows morph; reduced-motion covered by
|
|
2252
|
-
the .sg-island guard below (it disables transitions on .sg-island *). */
|
|
2254
|
+
/* payout slot \u2014 bank settlement only (the stablecoin destination anchor is never rendered) */
|
|
2253
2255
|
.sg-merch-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
|
|
2254
2256
|
.sg-merch-lead{min-width:0}
|
|
2255
2257
|
/* bank payout destination (settlement="bank") \u2014 sits in the same anchor slot as the stablecoin
|
|
@@ -2259,19 +2261,6 @@ var WIDGET_CSS = `
|
|
|
2259
2261
|
.sg-bank-text{display:flex;flex-direction:column;min-width:0}
|
|
2260
2262
|
.sg-bank-name{font-size:16px;font-weight:700;color:var(--sg-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
2261
2263
|
.sg-bank-cur{font-size:12px;color:var(--sg-text-muted)}
|
|
2262
|
-
.sg-details-toggle{flex:0 0 auto;display:inline-flex;align-items:center;gap:4px;padding:5px 10px;border:1px solid var(--sg-border);border-radius:var(--sg-radius-cta);background:transparent;color:var(--sg-text-muted);font:inherit;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap;transition:color var(--sg-motion-fast) var(--sg-ease-out-soft),border-color var(--sg-motion-fast) var(--sg-ease-out-soft)}
|
|
2263
|
-
.sg-details-toggle:hover{color:var(--sg-accent);border-color:var(--sg-accent)}
|
|
2264
|
-
.sg-details-chev{display:inline-flex;font-size:11px;line-height:1;transition:transform var(--sg-motion-fast) var(--sg-ease-out-soft)}
|
|
2265
|
-
.sg-details-toggle[data-open="true"] .sg-details-chev{transform:rotate(180deg)}
|
|
2266
|
-
.sg-details-reveal{display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--sg-motion-base) var(--sg-ease-out-soft)}
|
|
2267
|
-
.sg-details-reveal[data-open="true"]{grid-template-rows:1fr}
|
|
2268
|
-
.sg-details-reveal-inner{min-height:0;overflow:hidden}
|
|
2269
|
-
.sg-details-body{margin-top:12px;padding-top:12px;border-top:1px solid var(--sg-border)}
|
|
2270
|
-
.sg-details-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:4px 0;font-size:12px}
|
|
2271
|
-
.sg-details-k{flex:0 0 auto;color:var(--sg-text-muted)}
|
|
2272
|
-
.sg-details-v{min-width:0;text-align:right;color:var(--sg-text)}
|
|
2273
|
-
.sg-details-addr{word-break:break-all;font-size:11px}
|
|
2274
|
-
.sg-details-note{margin-top:8px;font-size:11px;color:var(--sg-text-muted);line-height:1.45}
|
|
2275
2264
|
|
|
2276
2265
|
/* express-card compaction for the 5-tab method selector (already overflow-x:auto for narrow cells) */
|
|
2277
2266
|
.sg-widget[data-sg-express] .sg-tabs{margin:12px 0 8px}
|
|
@@ -2301,7 +2290,7 @@ var WIDGET_CSS = `
|
|
|
2301
2290
|
broken) and shows the static accent dot instead; the label + live region carry the state. */
|
|
2302
2291
|
@media (prefers-reduced-motion:reduce){
|
|
2303
2292
|
.sg-island,.sg-island *{transition:none!important;animation:none!important}
|
|
2304
|
-
.sg-island-reveal
|
|
2293
|
+
.sg-island-reveal{transition:none!important}
|
|
2305
2294
|
.sg-island .sg-spinner{display:none!important}
|
|
2306
2295
|
.sg-island .sg-rm-dot{display:inline-block}
|
|
2307
2296
|
}
|
|
@@ -2549,14 +2538,22 @@ function StepList(props) {
|
|
|
2549
2538
|
}
|
|
2550
2539
|
var SHOW_ROADMAP_METHODS = true;
|
|
2551
2540
|
var METHODS = [
|
|
2552
|
-
{ id: "recommended", label: "Recommended", live: true },
|
|
2553
2541
|
{ id: "stablecoin", label: "Stablecoin", live: true },
|
|
2554
|
-
{ id: "anyasset", label: "Any asset", live: true },
|
|
2555
2542
|
{ id: "card", label: "Card", live: false },
|
|
2556
|
-
{ id: "bank", label: "Bank", live: false }
|
|
2543
|
+
{ id: "bank", label: "Bank account", live: false }
|
|
2557
2544
|
];
|
|
2558
2545
|
function isLiveMethod(m) {
|
|
2559
|
-
return m === "
|
|
2546
|
+
return m === "stablecoin";
|
|
2547
|
+
}
|
|
2548
|
+
function balanceRank(raw, decimals) {
|
|
2549
|
+
if (raw == null) return 0n;
|
|
2550
|
+
try {
|
|
2551
|
+
const d = Number.isFinite(Number(decimals)) ? Math.max(0, Math.trunc(Number(decimals))) : 18;
|
|
2552
|
+
const v = BigInt(raw);
|
|
2553
|
+
return d <= 18 ? v * 10n ** BigInt(18 - d) : v / 10n ** BigInt(d - 18);
|
|
2554
|
+
} catch {
|
|
2555
|
+
return 0n;
|
|
2556
|
+
}
|
|
2560
2557
|
}
|
|
2561
2558
|
function MethodTabs(props) {
|
|
2562
2559
|
const showRoadmap = props.showRoadmap ?? SHOW_ROADMAP_METHODS;
|
|
@@ -2703,6 +2700,31 @@ function TokenTile(props) {
|
|
|
2703
2700
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-main", children: glyph })
|
|
2704
2701
|
] });
|
|
2705
2702
|
}
|
|
2703
|
+
function FundingTile(props) {
|
|
2704
|
+
const symbols = props.assets.map((asset) => asset.symbol);
|
|
2705
|
+
const summary = props.loading ? "Checking wallet assets\u2026" : symbols.length ? symbols.join(", ") : "No payable balance";
|
|
2706
|
+
const detail = props.loading ? "Finding what you can pay with" : symbols.length ? `${symbols.length} wallet asset${symbols.length === 1 ? "" : "s"} available` : "Open to review funding options";
|
|
2707
|
+
const ariaLabel = `${props.label}: ${props.loading ? "checking wallet assets" : symbols.length ? symbols.join(", ") : "no payable balance"}`;
|
|
2708
|
+
const glyphs = props.loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "\u2026" }) }) : symbols.length ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-funding-glyphs", "aria-hidden": "true", children: props.assets.slice(0, 3).map((asset) => /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: asset.symbol, logoUrl: asset.logoUrl, size: "sm" }, asset.symbol)) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "?" }) });
|
|
2709
|
+
const main = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2710
|
+
glyphs,
|
|
2711
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-funding-copy", children: [
|
|
2712
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: summary }),
|
|
2713
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: detail })
|
|
2714
|
+
] })
|
|
2715
|
+
] });
|
|
2716
|
+
if (props.row) {
|
|
2717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile sg-tile--row", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
|
|
2718
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
|
|
2719
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-rowmain", children: main }),
|
|
2720
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chev", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) })
|
|
2721
|
+
] });
|
|
2722
|
+
}
|
|
2723
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
|
|
2724
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
|
|
2725
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-main", children: main })
|
|
2726
|
+
] });
|
|
2727
|
+
}
|
|
2706
2728
|
function ChainChip(props) {
|
|
2707
2729
|
const [broken, setBroken] = react.useState(false);
|
|
2708
2730
|
const logo = props.chain?.logoUrl;
|
|
@@ -3031,55 +3053,6 @@ function forgetIdentity(account) {
|
|
|
3031
3053
|
var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
3032
3054
|
var chainName = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
|
|
3033
3055
|
var STABLES = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE"]);
|
|
3034
|
-
function MerchantReceives(props) {
|
|
3035
|
-
const [open, setOpen] = react.useState(false);
|
|
3036
|
-
const bodyId = react.useId();
|
|
3037
|
-
const hasDetails = Boolean(props.recipient);
|
|
3038
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel sg-merch", children: [
|
|
3039
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-merch-head", children: [
|
|
3040
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-merch-lead", children: [
|
|
3041
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children: "Merchant receives exactly" }),
|
|
3042
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
3043
|
-
props.amount,
|
|
3044
|
-
" ",
|
|
3045
|
-
props.asset
|
|
3046
|
-
] })
|
|
3047
|
-
] }),
|
|
3048
|
-
hasDetails ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3049
|
-
"button",
|
|
3050
|
-
{
|
|
3051
|
-
type: "button",
|
|
3052
|
-
className: "sg-details-toggle",
|
|
3053
|
-
"data-open": open,
|
|
3054
|
-
"aria-expanded": open,
|
|
3055
|
-
"aria-controls": bodyId,
|
|
3056
|
-
onClick: () => setOpen((o) => !o),
|
|
3057
|
-
children: [
|
|
3058
|
-
"Details",
|
|
3059
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-details-chev", "aria-hidden": "true", children: "\u2304" })
|
|
3060
|
-
]
|
|
3061
|
-
}
|
|
3062
|
-
) : null
|
|
3063
|
-
] }),
|
|
3064
|
-
hasDetails ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-details-reveal", "data-open": open, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-details-reveal-inner", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-details-body", id: bodyId, children: [
|
|
3065
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-details-row", children: [
|
|
3066
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-details-k", children: "Network" }),
|
|
3067
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-details-v", children: chainName(props.chainId) })
|
|
3068
|
-
] }),
|
|
3069
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-details-row", children: [
|
|
3070
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-details-k", children: "Recipient" }),
|
|
3071
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-details-v sg-mono sg-details-addr", children: props.recipient })
|
|
3072
|
-
] }),
|
|
3073
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-details-note", children: [
|
|
3074
|
-
"Settled like a card \u2014 the merchant always receives exactly ",
|
|
3075
|
-
props.amount,
|
|
3076
|
-
" ",
|
|
3077
|
-
props.asset,
|
|
3078
|
-
". You pay a little more to cover the network cost."
|
|
3079
|
-
] })
|
|
3080
|
-
] }) }) }) : null
|
|
3081
|
-
] });
|
|
3082
|
-
}
|
|
3083
3056
|
function BankGlyph() {
|
|
3084
3057
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 10h18M5 10v8M10 10v8M14 10v8M19 10v8M3 19h18M12 3 3 8h18Z" }) });
|
|
3085
3058
|
}
|
|
@@ -3282,7 +3255,7 @@ function PaymentIsland(props) {
|
|
|
3282
3255
|
onSuccess: config.onSuccess,
|
|
3283
3256
|
onError: config.onError
|
|
3284
3257
|
});
|
|
3285
|
-
const [method, setMethod] = react.useState("
|
|
3258
|
+
const [method, setMethod] = react.useState("stablecoin");
|
|
3286
3259
|
const parked = isPay && !isLiveMethod(method);
|
|
3287
3260
|
const fundingSet = react.useMemo(
|
|
3288
3261
|
() => props.fundingAssets?.length ? new Set(props.fundingAssets.map((a) => a.toUpperCase())) : null,
|
|
@@ -3308,7 +3281,13 @@ function PaymentIsland(props) {
|
|
|
3308
3281
|
}),
|
|
3309
3282
|
[visibleRoutes, holdings.balances]
|
|
3310
3283
|
);
|
|
3311
|
-
const held = react.useMemo(
|
|
3284
|
+
const held = react.useMemo(
|
|
3285
|
+
() => annotated.filter((a) => a.affordable === true).sort((a, b) => {
|
|
3286
|
+
const d = balanceRank(b.balance?.raw, b.route.source.decimals) - balanceRank(a.balance?.raw, a.route.source.decimals);
|
|
3287
|
+
return d > 0n ? 1 : d < 0n ? -1 : 0;
|
|
3288
|
+
}),
|
|
3289
|
+
[annotated]
|
|
3290
|
+
);
|
|
3312
3291
|
const heldIds = react.useMemo(() => new Set(held.map((a) => a.route.id)), [held]);
|
|
3313
3292
|
const optionStates = react.useMemo(() => {
|
|
3314
3293
|
const map = {};
|
|
@@ -3389,6 +3368,18 @@ function PaymentIsland(props) {
|
|
|
3389
3368
|
const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
|
|
3390
3369
|
return chains.filter((c) => ids.has(Number(c.chainId)));
|
|
3391
3370
|
}, [chains, fundingTokens]);
|
|
3371
|
+
const payableAssets = react.useMemo(() => {
|
|
3372
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3373
|
+
const list = [];
|
|
3374
|
+
for (const { route } of held) {
|
|
3375
|
+
const symbol = symbolKey(route.source.asset);
|
|
3376
|
+
if (seen.has(symbol)) continue;
|
|
3377
|
+
seen.add(symbol);
|
|
3378
|
+
const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq(t.address, route.source.tokenAddress));
|
|
3379
|
+
list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
|
|
3380
|
+
}
|
|
3381
|
+
return list;
|
|
3382
|
+
}, [held, registryTokens]);
|
|
3392
3383
|
const userPicked = react.useRef(false);
|
|
3393
3384
|
const selectRoute = react.useCallback(
|
|
3394
3385
|
(id) => {
|
|
@@ -3491,15 +3482,11 @@ function PaymentIsland(props) {
|
|
|
3491
3482
|
const submitting = flow.status === "submitting";
|
|
3492
3483
|
const sel = flow.selected;
|
|
3493
3484
|
const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
|
|
3494
|
-
const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
|
|
3495
|
-
const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq(t.address, sel.source.tokenAddress)) ?? null : null;
|
|
3496
3485
|
const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
|
|
3497
3486
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
3498
3487
|
const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
|
|
3499
3488
|
const destAsset = isPay ? props.toAsset : exToAsset;
|
|
3500
|
-
const
|
|
3501
|
-
const anchorLabel = isPay ? "Merchant receives exactly" : "You receive (estimated)";
|
|
3502
|
-
const anchorAmount = isPay ? props.amount : sel?.receive.amount ?? (flow.status === "loading" ? "\u2026" : "\u2014");
|
|
3489
|
+
const anchorAmount = sel?.receive.amount ?? (flow.status === "loading" ? "\u2026" : "\u2014");
|
|
3503
3490
|
const successAmount = isPay ? props.amount : sel?.receive.amount;
|
|
3504
3491
|
const money = props.moneyDisplay ?? (isPay ? props.amount ? `${props.amount} ${props.toAsset}` : "" : exAmount ? `${exAmount} ${exFromAsset ?? ""}`.trim() : "");
|
|
3505
3492
|
const verb = isPay ? { present: "Pay", gerund: "Paying", past: "Paid" } : kind === "swap" ? { present: "Swap", gerund: "Swapping", past: "Swapped" } : { present: "Exchange", gerund: "Exchanging", past: "Exchanged" };
|
|
@@ -3621,7 +3608,7 @@ function PaymentIsland(props) {
|
|
|
3621
3608
|
} else if (!wallet.account) {
|
|
3622
3609
|
body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3623
3610
|
/* @__PURE__ */ jsxRuntime.jsx(IdentityLine, { account: null, email: identity?.email }),
|
|
3624
|
-
isPay ?
|
|
3611
|
+
isPay ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3625
3612
|
exchangeControls,
|
|
3626
3613
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
|
|
3627
3614
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children: "You receive (estimated)" }),
|
|
@@ -3692,10 +3679,10 @@ function PaymentIsland(props) {
|
|
|
3692
3679
|
const walletError = flow.status === "error" && flow.steps.length > 0;
|
|
3693
3680
|
body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3694
3681
|
/* @__PURE__ */ jsxRuntime.jsx(IdentityLine, { account: wallet.account, email: identity?.email }),
|
|
3695
|
-
isPay ?
|
|
3682
|
+
isPay ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3696
3683
|
exchangeControls,
|
|
3697
3684
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
|
|
3698
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children:
|
|
3685
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children: "You receive (estimated)" }),
|
|
3699
3686
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
3700
3687
|
anchorAmount,
|
|
3701
3688
|
" ",
|
|
@@ -3718,7 +3705,18 @@ function PaymentIsland(props) {
|
|
|
3718
3705
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: true, children: method === "card" ? "Card \u2014 coming soon" : "Bank \u2014 coming soon" }) })
|
|
3719
3706
|
] })
|
|
3720
3707
|
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3721
|
-
isPay ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3708
|
+
isPay ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3709
|
+
FundingTile,
|
|
3710
|
+
{
|
|
3711
|
+
row: true,
|
|
3712
|
+
label: "Pay with",
|
|
3713
|
+
assets: payableAssets,
|
|
3714
|
+
loading: flow.status === "loading" || holdings.loading,
|
|
3715
|
+
disabled: submitting || !visibleRoutes.length,
|
|
3716
|
+
btnRef: methodRowRef,
|
|
3717
|
+
onClick: () => setView("select")
|
|
3718
|
+
}
|
|
3719
|
+
) }) : null,
|
|
3722
3720
|
loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
|
|
3723
3721
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-skel" }),
|
|
3724
3722
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
|
|
@@ -3802,7 +3800,7 @@ function StableGeniePay(props) {
|
|
|
3802
3800
|
onSuccess: config.onSuccess,
|
|
3803
3801
|
onError: config.onError
|
|
3804
3802
|
});
|
|
3805
|
-
const [method, setMethod] = react.useState("
|
|
3803
|
+
const [method, setMethod] = react.useState("stablecoin");
|
|
3806
3804
|
const fundingSet = react.useMemo(
|
|
3807
3805
|
() => props.fundingAssets?.length ? new Set(props.fundingAssets.map((a) => a.toUpperCase())) : null,
|
|
3808
3806
|
[props.fundingAssets]
|
|
@@ -3827,7 +3825,13 @@ function StableGeniePay(props) {
|
|
|
3827
3825
|
}),
|
|
3828
3826
|
[visibleRoutes, holdings.balances]
|
|
3829
3827
|
);
|
|
3830
|
-
const held = react.useMemo(
|
|
3828
|
+
const held = react.useMemo(
|
|
3829
|
+
() => annotated.filter((a) => a.affordable === true).sort((a, b) => {
|
|
3830
|
+
const d = balanceRank(b.balance?.raw, b.route.source.decimals) - balanceRank(a.balance?.raw, a.route.source.decimals);
|
|
3831
|
+
return d > 0n ? 1 : d < 0n ? -1 : 0;
|
|
3832
|
+
}),
|
|
3833
|
+
[annotated]
|
|
3834
|
+
);
|
|
3831
3835
|
const heldIds = react.useMemo(() => new Set(held.map((a) => a.route.id)), [held]);
|
|
3832
3836
|
const scannedEmpty = !holdings.loading && Object.keys(holdings.balances).length > 0 && held.length === 0;
|
|
3833
3837
|
const optionStates = react.useMemo(() => {
|
|
@@ -3887,6 +3891,18 @@ function StableGeniePay(props) {
|
|
|
3887
3891
|
const ids = new Set(fundingTokens.map((t) => Number(t.chainId)));
|
|
3888
3892
|
return chains.filter((c) => ids.has(Number(c.chainId)));
|
|
3889
3893
|
}, [chains, fundingTokens]);
|
|
3894
|
+
const payableAssets = react.useMemo(() => {
|
|
3895
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3896
|
+
const list = [];
|
|
3897
|
+
for (const { route } of held) {
|
|
3898
|
+
const symbol = symbolKey(route.source.asset);
|
|
3899
|
+
if (seen.has(symbol)) continue;
|
|
3900
|
+
seen.add(symbol);
|
|
3901
|
+
const token = registryTokens.find((t) => Number(t.chainId) === route.source.chainId && addrEq2(t.address, route.source.tokenAddress));
|
|
3902
|
+
list.push({ symbol: route.source.asset, logoUrl: token?.logoUrl });
|
|
3903
|
+
}
|
|
3904
|
+
return list;
|
|
3905
|
+
}, [held, registryTokens]);
|
|
3890
3906
|
const userPicked = react.useRef(false);
|
|
3891
3907
|
const selectRoute = react.useCallback(
|
|
3892
3908
|
(id) => {
|
|
@@ -3930,15 +3946,15 @@ function StableGeniePay(props) {
|
|
|
3930
3946
|
if (r) selectRoute(r.id);
|
|
3931
3947
|
closeSelector();
|
|
3932
3948
|
};
|
|
3933
|
-
const chainName2 = CHAIN_LABELS[props.toChainId] || `Chain ${props.toChainId}`;
|
|
3934
3949
|
const parked = !isLiveMethod(method);
|
|
3935
3950
|
const submitting = flow.status === "submitting";
|
|
3936
3951
|
const sel = flow.selected;
|
|
3937
3952
|
const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
|
|
3938
|
-
const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
|
|
3939
|
-
const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq2(t.address, sel.source.tokenAddress)) ?? null : null;
|
|
3940
3953
|
const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
|
|
3941
|
-
const why = parked ? "" : sel && selectedVisible ? sel.state === "DIRECT" ? `Direct ${sel.source.asset} transfer on ${CHAIN_LABELS[sel.source.chainId] || sel.source.chainName} \xB7 lowest cost` :
|
|
3954
|
+
const why = parked ? "" : sel && selectedVisible ? sel.state === "DIRECT" ? `Direct ${sel.source.asset} transfer on ${CHAIN_LABELS[sel.source.chainId] || sel.source.chainName} \xB7 lowest cost` : (
|
|
3955
|
+
// Deliberately does NOT restate the destination amount — that is merchant config, not a payer fact.
|
|
3956
|
+
`Routed through ZeroDelta \xB7 the extra covers the network cost`
|
|
3957
|
+
) : "Pay with USDC, USDT, or USDE from your wallet.";
|
|
3942
3958
|
const comingSoon = method === "card" ? "Card payments are coming soon. Today StableGenie pays from your connected wallet." : "Bank transfers are coming soon.";
|
|
3943
3959
|
const payLabel = parked ? method === "card" ? "Card \u2014 coming soon" : "Bank \u2014 coming soon" : submitting ? "Paying\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall ? flow.nativeShortfall : sel && selectedVisible ? `Pay ${sel.source.payAmount} ${sel.source.asset}` : "Pay";
|
|
3944
3960
|
const walletSlot = wallet.account ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
|
|
@@ -3949,82 +3965,66 @@ function StableGeniePay(props) {
|
|
|
3949
3965
|
] })
|
|
3950
3966
|
] }) : void 0;
|
|
3951
3967
|
if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "pay", ...props });
|
|
3952
|
-
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TokenSelect, { title: "Pay with", chains: fundingChains, tokens: fundingTokens, balances: holdings.balances, optionStates, onBack: closeSelector, onPick: pickFunding }) : /* @__PURE__ */ jsxRuntime.
|
|
3953
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3954
|
-
|
|
3955
|
-
|
|
3968
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TokenSelect, { title: "Pay with", chains: fundingChains, tokens: fundingTokens, balances: holdings.balances, optionStates, onBack: closeSelector, onPick: pickFunding }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !wallet.account ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
3969
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }),
|
|
3970
|
+
wallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
|
|
3971
|
+
] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3972
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
|
|
3973
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph3, {}) }),
|
|
3974
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
3956
3975
|
props.amount,
|
|
3957
3976
|
" ",
|
|
3958
3977
|
props.toAsset
|
|
3959
3978
|
] }),
|
|
3960
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-
|
|
3961
|
-
"on ",
|
|
3962
|
-
chainName2,
|
|
3979
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
3980
|
+
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
3963
3981
|
" \xB7 ",
|
|
3964
3982
|
shortAddress(props.recipient)
|
|
3965
3983
|
] })
|
|
3966
3984
|
] }),
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3985
|
+
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
3986
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3987
|
+
/* @__PURE__ */ jsxRuntime.jsx(MethodTabs, { value: method, onChange: setMethod }),
|
|
3988
|
+
parked ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: comingSoon }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3989
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3990
|
+
FundingTile,
|
|
3991
|
+
{
|
|
3992
|
+
label: "Pay with",
|
|
3993
|
+
assets: payableAssets,
|
|
3994
|
+
loading: flow.status === "loading" || holdings.loading,
|
|
3995
|
+
disabled: submitting || !visibleRoutes.length,
|
|
3996
|
+
btnRef: payTileRef,
|
|
3997
|
+
onClick: () => setView("select")
|
|
3998
|
+
}
|
|
3999
|
+
) }),
|
|
4000
|
+
flow.status === "loading" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-route", style: { marginTop: 12 }, children: [
|
|
4001
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-skel" }),
|
|
4002
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
|
|
4003
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-spinner" }),
|
|
4004
|
+
" Finding the best way to pay\u2026"
|
|
4005
|
+
] })
|
|
4006
|
+
] }) : null,
|
|
4007
|
+
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4008
|
+
sel && selectedVisible && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
|
|
4009
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children: "You pay" }),
|
|
4010
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
4011
|
+
sel.source.payAmount,
|
|
3975
4012
|
" ",
|
|
3976
|
-
|
|
4013
|
+
sel.source.asset
|
|
3977
4014
|
] }),
|
|
3978
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
4015
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
4016
|
+
"on ",
|
|
4017
|
+
CHAIN_LABELS[sel.source.chainId] || sel.source.chainName,
|
|
4018
|
+
selBal ? ` \xB7 balance ${selBal.formatted}` : ""
|
|
3982
4019
|
] })
|
|
3983
|
-
] }),
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
label: "Pay with",
|
|
3992
|
-
pick: selPick,
|
|
3993
|
-
token: selToken,
|
|
3994
|
-
disabled: submitting || !visibleRoutes.length,
|
|
3995
|
-
btnRef: payTileRef,
|
|
3996
|
-
onClick: () => setView("select")
|
|
3997
|
-
}
|
|
3998
|
-
) }),
|
|
3999
|
-
flow.status === "loading" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-route", style: { marginTop: 12 }, children: [
|
|
4000
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-skel" }),
|
|
4001
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
|
|
4002
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-spinner" }),
|
|
4003
|
-
" Finding the best way to pay\u2026"
|
|
4004
|
-
] })
|
|
4005
|
-
] }) : null,
|
|
4006
|
-
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4007
|
-
sel && selectedVisible && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
|
|
4008
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children: "You pay" }),
|
|
4009
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
|
|
4010
|
-
sel.source.payAmount,
|
|
4011
|
-
" ",
|
|
4012
|
-
sel.source.asset
|
|
4013
|
-
] }),
|
|
4014
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
|
|
4015
|
-
"on ",
|
|
4016
|
-
CHAIN_LABELS[sel.source.chainId] || sel.source.chainName,
|
|
4017
|
-
selBal ? ` \xB7 balance ${selBal.formatted}` : ""
|
|
4018
|
-
] })
|
|
4019
|
-
] }) : null,
|
|
4020
|
-
why ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-why", style: { marginTop: 10 }, children: why }) : null,
|
|
4021
|
-
scannedEmpty ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
|
|
4022
|
-
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4023
|
-
] }),
|
|
4024
|
-
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4025
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: parked || !selectedVisible ? void 0 : flow.submit, busy: submitting, disabled: parked || !selectedVisible || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading", children: payLabel }) })
|
|
4026
|
-
] })
|
|
4027
|
-
] }) });
|
|
4020
|
+
] }) : null,
|
|
4021
|
+
why ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-why", style: { marginTop: 10 }, children: why }) : null,
|
|
4022
|
+
scannedEmpty ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
|
|
4023
|
+
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4024
|
+
] }),
|
|
4025
|
+
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4026
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: parked || !selectedVisible ? void 0 : flow.submit, busy: submitting, disabled: parked || !selectedVisible || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading", children: payLabel }) })
|
|
4027
|
+
] }) }) });
|
|
4028
4028
|
}
|
|
4029
4029
|
var chainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
|
|
4030
4030
|
var assetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-
|
|
1
|
+
export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-DH7QYQG4.js';
|
|
2
2
|
export { createEngine } from './chunk-VL5MWEY2.js';
|