@glacislabs/stablegenie-zerodelta 4.6.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GBV2QVCH.js → chunk-2TCYBOYW.js} +161 -11
- package/dist/{chunk-CEBEMZHZ.js → chunk-F46VMTTL.js} +10 -4
- package/dist/core/index.cjs +10 -3
- package/dist/core/index.d.cts +22 -6
- package/dist/core/index.d.ts +22 -6
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +168 -12
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-DjeyxZcy.d.cts → mount-Dxsc7-Fb.d.cts} +21 -2
- package/dist/{mount-qV6l3ZuG.d.ts → mount-LkKQjoZU.d.ts} +21 -2
- package/dist/mount.cjs +168 -12
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +6 -6
- package/dist/{verify-DSCljQtK.d.cts → verify-BEQ8DMvJ.d.cts} +8 -0
- package/dist/{verify-DSCljQtK.d.ts → verify-BEQ8DMvJ.d.ts} +8 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1470,6 +1470,10 @@ function routeDeltaLabel(result, quote) {
|
|
|
1470
1470
|
if (quote.feeBps) return `${quote.feeBps} bps fee`;
|
|
1471
1471
|
return "~0";
|
|
1472
1472
|
}
|
|
1473
|
+
function quotePartnerId(quote) {
|
|
1474
|
+
const raw = quote.partnerId;
|
|
1475
|
+
return typeof raw === "string" && /^0x[0-9a-fA-F]{64}$/.test(raw) ? raw.toLowerCase() : NO_PARTNER_ID;
|
|
1476
|
+
}
|
|
1473
1477
|
function optionTicker(option) {
|
|
1474
1478
|
return option.ticker || option.symbol;
|
|
1475
1479
|
}
|
|
@@ -1635,6 +1639,7 @@ async function buildRoute({
|
|
|
1635
1639
|
}
|
|
1636
1640
|
}
|
|
1637
1641
|
const valueRaw = applyLayerZeroBuffer(quote, option);
|
|
1642
|
+
const partnerId = quotePartnerId(quote);
|
|
1638
1643
|
if (!needsNativeFee) {
|
|
1639
1644
|
if (valueRaw !== 0n) throw new Error("Non-LayerZero route requested a non-zero native value; refusing to sign.");
|
|
1640
1645
|
} else if (valueRaw === 0n && Number(quote.executionChainId) > 0) {
|
|
@@ -1685,7 +1690,7 @@ async function buildRoute({
|
|
|
1685
1690
|
label: "Submit ZeroDelta order",
|
|
1686
1691
|
chainId: option.chainId,
|
|
1687
1692
|
to: escrow,
|
|
1688
|
-
data: encodeSubmitOrder(orders),
|
|
1693
|
+
data: encodeSubmitOrder(orders, partnerId),
|
|
1689
1694
|
value: toHexQuantity(valueRaw),
|
|
1690
1695
|
escrow,
|
|
1691
1696
|
amountRaw: order.bidTokenAmount
|
|
@@ -1698,6 +1703,7 @@ async function buildRoute({
|
|
|
1698
1703
|
gasCostSource: quote.gasCostSource,
|
|
1699
1704
|
msgValue: valueRaw.toString(),
|
|
1700
1705
|
deadline: order.deadline,
|
|
1706
|
+
partnerId: partnerId === NO_PARTNER_ID ? void 0 : partnerId,
|
|
1701
1707
|
iterations: result.iterations,
|
|
1702
1708
|
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1703
1709
|
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
@@ -1712,7 +1718,7 @@ var CHANNEL_HEADER = "x-zd-channel";
|
|
|
1712
1718
|
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
1713
1719
|
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
1714
1720
|
var WIDGET_CHANNEL = "widget";
|
|
1715
|
-
var WIDGET_VERSION = "4.
|
|
1721
|
+
var WIDGET_VERSION = "4.8.0" ;
|
|
1716
1722
|
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
1717
1723
|
function sanitizeVersion(raw) {
|
|
1718
1724
|
const v = String(raw).trim();
|
|
@@ -2368,7 +2374,7 @@ function validatePlannedTransaction(tx, route, expectedRecipient) {
|
|
|
2368
2374
|
if (!decoded) return false;
|
|
2369
2375
|
const first = decoded.orders[0];
|
|
2370
2376
|
const last = decoded.orders[decoded.orders.length - 1];
|
|
2371
|
-
return decoded.partnerId === NO_PARTNER_ID && lower(first.bidToken) === lower(route.source.tokenAddress) && rawEquals(first.bidTokenAmount, tx.amountRaw) && lower(last.askToken) === lower(route.receive.tokenAddress) && Number(last.destinationChainId) === Number(route.receive.chainId) && lower(last.destinationReceiver) === lower(expectedRecipient);
|
|
2377
|
+
return decoded.partnerId === lower(route.quote?.partnerId || NO_PARTNER_ID) && lower(first.bidToken) === lower(route.source.tokenAddress) && rawEquals(first.bidTokenAmount, tx.amountRaw) && lower(last.askToken) === lower(route.receive.tokenAddress) && Number(last.destinationChainId) === Number(route.receive.chainId) && lower(last.destinationReceiver) === lower(expectedRecipient);
|
|
2372
2378
|
}
|
|
2373
2379
|
return false;
|
|
2374
2380
|
}
|
|
@@ -3307,6 +3313,83 @@ function useHoldings(engine, account, routes, initialBalances) {
|
|
|
3307
3313
|
return { balances, loading };
|
|
3308
3314
|
}
|
|
3309
3315
|
|
|
3316
|
+
// src/react/ui/amount.ts
|
|
3317
|
+
var MAX_FRACTION_DIGITS = 8;
|
|
3318
|
+
function trimFraction(fixed) {
|
|
3319
|
+
return fixed.includes(".") ? fixed.replace(/\.?0+$/, "") : fixed;
|
|
3320
|
+
}
|
|
3321
|
+
function groupDecimal(value) {
|
|
3322
|
+
const match = value.match(/^([+-]?)(\d+)(\.\d+)?$/);
|
|
3323
|
+
if (!match) return value;
|
|
3324
|
+
const integer = match[2].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
3325
|
+
return `${match[1]}${integer}${match[3] ?? ""}`;
|
|
3326
|
+
}
|
|
3327
|
+
var SIGNIFICANT_DIGITS = 7;
|
|
3328
|
+
var MIN_FRACTION_DIGITS = 4;
|
|
3329
|
+
function formatCalculatedAmount(value, decimals) {
|
|
3330
|
+
let raw = typeof value === "number" ? String(value) : value.trim();
|
|
3331
|
+
if (typeof value === "number") {
|
|
3332
|
+
if (!Number.isFinite(value)) return raw;
|
|
3333
|
+
if (/e/i.test(raw)) {
|
|
3334
|
+
raw = value.toLocaleString("en-US", {
|
|
3335
|
+
useGrouping: false,
|
|
3336
|
+
maximumFractionDigits: 20
|
|
3337
|
+
});
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
const match = raw.match(/^([+-]?)(\d*)(?:\.(\d*))?$/);
|
|
3341
|
+
if (!match) return raw;
|
|
3342
|
+
const negative = match[1] === "-";
|
|
3343
|
+
const integer = (match[2] || "0").replace(/^0+(?=\d)/, "");
|
|
3344
|
+
const fraction = match[3] ?? "";
|
|
3345
|
+
const firstNonZero = fraction.search(/[1-9]/);
|
|
3346
|
+
const isZero = integer === "0" && firstNonZero === -1;
|
|
3347
|
+
if (isZero) return "0";
|
|
3348
|
+
if (integer === "0" && firstNonZero >= 6) return `${negative ? "-" : ""}<0.000001`;
|
|
3349
|
+
const cap = decimals === void 0 || !Number.isFinite(decimals) ? MAX_FRACTION_DIGITS : Math.min(MAX_FRACTION_DIGITS, Math.max(0, Math.trunc(decimals)));
|
|
3350
|
+
const places = integer !== "0" ? Math.min(cap, Math.max(MIN_FRACTION_DIGITS, SIGNIFICANT_DIGITS - integer.length)) : (
|
|
3351
|
+
// Below one the leading zeros are not significant, so the count starts
|
|
3352
|
+
// at the first digit that is.
|
|
3353
|
+
Math.min(cap, firstNonZero + SIGNIFICANT_DIGITS)
|
|
3354
|
+
);
|
|
3355
|
+
const scale = 10n ** BigInt(places);
|
|
3356
|
+
const padded = fraction.padEnd(places + 1, "0");
|
|
3357
|
+
const kept = padded.slice(0, places);
|
|
3358
|
+
let rounded = BigInt(integer) * scale + BigInt(kept || "0");
|
|
3359
|
+
if ((padded[places] ?? "0") >= "5") rounded += 1n;
|
|
3360
|
+
const whole = rounded / scale;
|
|
3361
|
+
const remainder = rounded % scale;
|
|
3362
|
+
const fixed = places === 0 ? whole.toString() : `${whole}.${remainder.toString().padStart(places, "0")}`;
|
|
3363
|
+
const out = groupDecimal(trimFraction(fixed));
|
|
3364
|
+
return negative && out !== "0" ? `-${out}` : out;
|
|
3365
|
+
}
|
|
3366
|
+
function exactAmountTitle(raw, shown) {
|
|
3367
|
+
const full = typeof raw === "number" ? String(raw) : raw.trim();
|
|
3368
|
+
if (!full || /e/i.test(full)) return void 0;
|
|
3369
|
+
const normalized = full.includes(".") ? trimFraction(full) : full;
|
|
3370
|
+
const grouped = groupDecimal(normalized);
|
|
3371
|
+
return grouped === shown ? void 0 : grouped;
|
|
3372
|
+
}
|
|
3373
|
+
function sanitizeAmount(raw) {
|
|
3374
|
+
const cleaned = raw.replace(/[^0-9.]/g, "");
|
|
3375
|
+
const first = cleaned.indexOf(".");
|
|
3376
|
+
if (first === -1) return cleaned;
|
|
3377
|
+
return cleaned.slice(0, first + 1) + cleaned.slice(first + 1).replace(/\./g, "");
|
|
3378
|
+
}
|
|
3379
|
+
function groupAmountInput(value) {
|
|
3380
|
+
const point = value.indexOf(".");
|
|
3381
|
+
const whole = point === -1 ? value : value.slice(0, point);
|
|
3382
|
+
return whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + (point === -1 ? "" : value.slice(point));
|
|
3383
|
+
}
|
|
3384
|
+
function groupedAmountCaret(grouped, kept) {
|
|
3385
|
+
if (kept <= 0) return 0;
|
|
3386
|
+
let seen = 0;
|
|
3387
|
+
for (let i = 0; i < grouped.length; i++) {
|
|
3388
|
+
if (grouped[i] !== "," && ++seen === kept) return i + 1;
|
|
3389
|
+
}
|
|
3390
|
+
return grouped.length;
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3310
3393
|
// src/react/styles.ts
|
|
3311
3394
|
var WIDGET_CSS = `
|
|
3312
3395
|
/* The card as the ZeroDelta widget design draws it (Figma "Widget Playground", 2026-09-30): no
|
|
@@ -4128,6 +4211,53 @@ function BrandMark({ size = 18, mono = false, className, style, title }) {
|
|
|
4128
4211
|
}
|
|
4129
4212
|
);
|
|
4130
4213
|
}
|
|
4214
|
+
var MIN_FONT_PX = 10;
|
|
4215
|
+
function useFitText(ref, text) {
|
|
4216
|
+
react.useLayoutEffect(() => {
|
|
4217
|
+
const el = ref.current;
|
|
4218
|
+
if (!el) return;
|
|
4219
|
+
const fit = () => {
|
|
4220
|
+
el.style.fontSize = "";
|
|
4221
|
+
const room = el.clientWidth;
|
|
4222
|
+
const needed = el.scrollWidth;
|
|
4223
|
+
if (!room || needed <= room) return;
|
|
4224
|
+
const base = Number.parseFloat(getComputedStyle(el).fontSize);
|
|
4225
|
+
if (!Number.isFinite(base) || base <= 0) return;
|
|
4226
|
+
el.style.fontSize = `${Math.max(MIN_FONT_PX, Math.floor(base * room / needed))}px`;
|
|
4227
|
+
};
|
|
4228
|
+
fit();
|
|
4229
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
4230
|
+
const observer = new ResizeObserver(fit);
|
|
4231
|
+
if (el.parentElement) observer.observe(el.parentElement);
|
|
4232
|
+
return () => observer.disconnect();
|
|
4233
|
+
}, [ref, text]);
|
|
4234
|
+
}
|
|
4235
|
+
function useGroupedAmountInput(amount, onAmount) {
|
|
4236
|
+
const caret = react.useRef(null);
|
|
4237
|
+
const [, rerender] = react.useReducer((n) => n + 1, 0);
|
|
4238
|
+
react.useLayoutEffect(() => {
|
|
4239
|
+
const pending = caret.current;
|
|
4240
|
+
caret.current = null;
|
|
4241
|
+
if (pending === null || pending.input !== document.activeElement) return;
|
|
4242
|
+
const at = groupedAmountCaret(pending.input.value, pending.kept);
|
|
4243
|
+
pending.input.setSelectionRange(at, at);
|
|
4244
|
+
});
|
|
4245
|
+
const onChange = (e) => {
|
|
4246
|
+
const input = e.target;
|
|
4247
|
+
const raw = input.value;
|
|
4248
|
+
caret.current = { input, kept: sanitizeAmount(raw.slice(0, input.selectionEnd ?? raw.length)).length };
|
|
4249
|
+
onAmount(sanitizeAmount(raw));
|
|
4250
|
+
rerender();
|
|
4251
|
+
};
|
|
4252
|
+
const onKeyDown = (e) => {
|
|
4253
|
+
const input = e.currentTarget;
|
|
4254
|
+
const at = input.selectionStart;
|
|
4255
|
+
if (at === null || at !== input.selectionEnd) return;
|
|
4256
|
+
if (e.key === "Backspace" && input.value[at - 1] === ",") input.setSelectionRange(at - 1, at - 1);
|
|
4257
|
+
else if (e.key === "Delete" && input.value[at] === ",") input.setSelectionRange(at + 1, at + 1);
|
|
4258
|
+
};
|
|
4259
|
+
return { value: groupAmountInput(amount), onChange, onKeyDown };
|
|
4260
|
+
}
|
|
4131
4261
|
var SOURCE_CHAIN_LABELS = {
|
|
4132
4262
|
1: "Ethereum",
|
|
4133
4263
|
10: "Optimism",
|
|
@@ -4181,17 +4311,22 @@ function Select(props) {
|
|
|
4181
4311
|
] }) });
|
|
4182
4312
|
}
|
|
4183
4313
|
function AmountInput(props) {
|
|
4314
|
+
const grouped = useGroupedAmountInput(props.value, props.onChange);
|
|
4315
|
+
const field = react.useRef(null);
|
|
4316
|
+
useFitText(field, grouped.value);
|
|
4184
4317
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4185
4318
|
"input",
|
|
4186
4319
|
{
|
|
4320
|
+
ref: field,
|
|
4187
4321
|
className: "sg-input sg-amount sg-mono",
|
|
4188
4322
|
inputMode: "decimal",
|
|
4189
4323
|
placeholder: props.placeholder ?? "0.0",
|
|
4190
|
-
value:
|
|
4324
|
+
value: grouped.value,
|
|
4191
4325
|
disabled: props.disabled,
|
|
4192
4326
|
"aria-invalid": props.invalid || void 0,
|
|
4193
4327
|
"aria-describedby": props.describedBy,
|
|
4194
|
-
onChange:
|
|
4328
|
+
onChange: grouped.onChange,
|
|
4329
|
+
onKeyDown: grouped.onKeyDown
|
|
4195
4330
|
}
|
|
4196
4331
|
);
|
|
4197
4332
|
}
|
|
@@ -4617,11 +4752,11 @@ function QuoteGlyph({ size = 16 }) {
|
|
|
4617
4752
|
)
|
|
4618
4753
|
] });
|
|
4619
4754
|
}
|
|
4620
|
-
function AmountText({ value, suffix }) {
|
|
4621
|
-
const dot = value.indexOf(".");
|
|
4755
|
+
function AmountText({ value, suffix, exact }) {
|
|
4756
|
+
const dot = value.startsWith("<") ? -1 : value.indexOf(".");
|
|
4622
4757
|
const whole = dot < 0 ? value : value.slice(0, dot + 1);
|
|
4623
4758
|
const decimals = dot < 0 ? "" : value.slice(dot + 1);
|
|
4624
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-amt", children: [
|
|
4759
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-amt", title: exact === void 0 ? void 0 : exactAmountTitle(exact, value), children: [
|
|
4625
4760
|
whole,
|
|
4626
4761
|
decimals ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-dec", children: decimals }) : null,
|
|
4627
4762
|
suffix ? ` ${suffix}` : null
|
|
@@ -6547,7 +6682,7 @@ function PayCard(props) {
|
|
|
6547
6682
|
setSheet(false);
|
|
6548
6683
|
requestAnimationFrame(() => complianceBtnRef.current?.focus());
|
|
6549
6684
|
};
|
|
6550
|
-
const payLabel = parked ? "Coming soon" : submitting ? "Paying\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall ? flow.nativeShortfall : sel && selectedVisible ? `Pay ${atLeastCents(sel.source.payAmount)} ${sel.source.ticker || sel.source.asset}` : "Pay";
|
|
6685
|
+
const payLabel = parked ? "Coming soon" : submitting ? "Paying\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall ? flow.nativeShortfall : sel && selectedVisible ? `Pay ${groupDecimal(atLeastCents(sel.source.payAmount))} ${sel.source.ticker || sel.source.asset}` : "Pay";
|
|
6551
6686
|
const walletSlot = wallet.account ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
|
|
6552
6687
|
/* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }),
|
|
6553
6688
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-wallet", "data-connected": "true", children: [
|
|
@@ -6599,7 +6734,7 @@ function PayCard(props) {
|
|
|
6599
6734
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane", "data-kind": "pay", children: [
|
|
6600
6735
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pane-label", children: "You pay" }),
|
|
6601
6736
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane-mid", children: [
|
|
6602
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-out", "aria-live": "polite", children: loadingPlan ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2026" }) : sel && selectedVisible ? /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: atLeastCents(sel.source.payAmount) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2014" }) }),
|
|
6737
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-out", "aria-live": "polite", children: loadingPlan ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2026" }) : sel && selectedVisible ? /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: groupDecimal(atLeastCents(sel.source.payAmount)) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2014" }) }),
|
|
6603
6738
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6604
6739
|
TokenButton,
|
|
6605
6740
|
{
|
|
@@ -6924,6 +7059,15 @@ function ExchangeCard(props) {
|
|
|
6924
7059
|
() => props.defaultToChainId && props.defaultToAsset ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
|
|
6925
7060
|
);
|
|
6926
7061
|
const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
|
|
7062
|
+
const onInputChange = react.useRef(props.onInputChange);
|
|
7063
|
+
onInputChange.current = props.onInputChange;
|
|
7064
|
+
const fromChainId = from?.chainId ?? null;
|
|
7065
|
+
const fromSymbol = from?.symbol ?? null;
|
|
7066
|
+
const toChainId = to?.chainId ?? null;
|
|
7067
|
+
const toSymbolKey = to?.symbol ?? null;
|
|
7068
|
+
react.useEffect(() => {
|
|
7069
|
+
onInputChange.current?.({ fromChainId, fromAsset: fromSymbol, toChainId, toAsset: toSymbolKey, amount });
|
|
7070
|
+
}, [fromChainId, fromSymbol, toChainId, toSymbolKey, amount]);
|
|
6927
7071
|
const [fiatCurrency, setFiatCurrency] = react.useState(props.fiatCurrency ?? "EUR");
|
|
6928
7072
|
const fromToken = react.useMemo(() => from ? findToken(tokens, from.chainId, from.symbol) : null, [tokens, from]);
|
|
6929
7073
|
const toToken = react.useMemo(() => to ? findToken(tokens, to.chainId, to.symbol) : null, [tokens, to]);
|
|
@@ -7061,6 +7205,18 @@ function ExchangeCard(props) {
|
|
|
7061
7205
|
const amountError = overLimit && laneLimit ? laneLimitError(laneLimit, limitSymbol) : gatewayAmountError;
|
|
7062
7206
|
const amountNote = mode === "exchange" ? amountError || (laneLimit ? laneLimitHint(laneLimit, limitSymbol) : null) : null;
|
|
7063
7207
|
const receive = connected ? flow.selected?.receive.amount : preview.data?.receive;
|
|
7208
|
+
const receiveOutRef = react.useRef(null);
|
|
7209
|
+
const receiveSideRef = react.useRef(null);
|
|
7210
|
+
const receiveShown = `${receive ?? ""}|${quoting}|${toTicker}`;
|
|
7211
|
+
useFitText(receiveOutRef, receiveShown);
|
|
7212
|
+
useFitText(receiveSideRef, receiveShown);
|
|
7213
|
+
const toDecimals = react.useMemo(() => {
|
|
7214
|
+
try {
|
|
7215
|
+
return toToken ? assetDecimals(toToken) : void 0;
|
|
7216
|
+
} catch {
|
|
7217
|
+
return void 0;
|
|
7218
|
+
}
|
|
7219
|
+
}, [toToken]);
|
|
7064
7220
|
const meta = connected ? flow.selected ? { bridge: flow.selected.quote.bridge || "ZeroDelta", feeBps: Number(flow.selected.quote.feeBps || 0), duration: Number(flow.selected.quote.estimatedDuration || 0) } : null : preview.data ? { bridge: preview.data.bridge || "ZeroDelta", feeBps: preview.data.feeBps, duration: preview.data.estimatedDuration } : null;
|
|
7065
7221
|
const pct = (p) => {
|
|
7066
7222
|
if (!fromBal || !fromToken) return;
|
|
@@ -7254,7 +7410,7 @@ function ExchangeCard(props) {
|
|
|
7254
7410
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane", "data-kind": "receive", children: [
|
|
7255
7411
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pane-label", children: product === "rwa" ? "You receive (estimated)" : "You receive" }),
|
|
7256
7412
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane-mid", children: [
|
|
7257
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-out", "aria-live": "polite", children: rampMode ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2014" }) : quoting ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2026" }) : receive && quotable && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: receive }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "0" }) }),
|
|
7413
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-out", "aria-live": "polite", ref: receiveOutRef, children: rampMode ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2014" }) : quoting ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "\u2026" }) : receive && quotable && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: formatCalculatedAmount(receive, toDecimals), exact: receive }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-empty", children: "0" }) }),
|
|
7258
7414
|
receiveToken
|
|
7259
7415
|
] }),
|
|
7260
7416
|
/* @__PURE__ */ jsxRuntime.jsx(PaneFoot, { usd: hasQuote ? toUsd : null })
|
|
@@ -7315,7 +7471,7 @@ function ExchangeCard(props) {
|
|
|
7315
7471
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv", children: [
|
|
7316
7472
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-line", children: [
|
|
7317
7473
|
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: to?.symbol ?? "", logoUrl: toToken?.logoUrl, chainId: to?.chainId, size: "xs" }),
|
|
7318
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-recv-amt", children: /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: receive, suffix: toTicker }) })
|
|
7474
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-recv-amt", ref: receiveSideRef, children: /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: formatCalculatedAmount(receive, toDecimals), exact: receive, suffix: toTicker }) })
|
|
7319
7475
|
] }),
|
|
7320
7476
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
|
|
7321
7477
|
"On ",
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland,
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeInput, b as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, c as PaymentIslandKind, d as PaymentIslandProps, e as PillOpenAs, S as SettlementMethod, f as StableGenieConfig, g as StableGenieExchange, h as StableGenieExchangeProps, i as StableGeniePay, j as StableGeniePayProps, k as StableGenieProvider, l as StableGenieRwaExchange, m as StableGenieSwap, n as StableGenieSwapProps, o as StableGenieTheme, p as SuccessInfo, q as SupportedAsset, r as darkTheme, s as lightTheme, t as mount, u as resolveTheme } from './mount-Dxsc7-Fb.cjs';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { C as Compliance } from './verify-
|
|
4
|
-
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-
|
|
3
|
+
import { C as Compliance } from './verify-BEQ8DMvJ.cjs';
|
|
4
|
+
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-BEQ8DMvJ.cjs';
|
|
5
5
|
export { EXECUTABLE_STABLE_ASSETS, Engine, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, createEngine, symbolKey } from './core/index.cjs';
|
|
6
6
|
|
|
7
7
|
declare function CompliancePanel(props: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland,
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeInput, b as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, c as PaymentIslandKind, d as PaymentIslandProps, e as PillOpenAs, S as SettlementMethod, f as StableGenieConfig, g as StableGenieExchange, h as StableGenieExchangeProps, i as StableGeniePay, j as StableGeniePayProps, k as StableGenieProvider, l as StableGenieRwaExchange, m as StableGenieSwap, n as StableGenieSwapProps, o as StableGenieTheme, p as SuccessInfo, q as SupportedAsset, r as darkTheme, s as lightTheme, t as mount, u as resolveTheme } from './mount-LkKQjoZU.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { C as Compliance } from './verify-
|
|
4
|
-
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-
|
|
3
|
+
import { C as Compliance } from './verify-BEQ8DMvJ.js';
|
|
4
|
+
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-BEQ8DMvJ.js';
|
|
5
5
|
export { EXECUTABLE_STABLE_ASSETS, Engine, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, createEngine, symbolKey } from './core/index.js';
|
|
6
6
|
|
|
7
7
|
declare function CompliancePanel(props: {
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-
|
|
2
|
-
export { EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, assetClassOf, brokenLaneReason, complianceChecks, complianceControlsLine, complianceView, counterpartTokens, createEngine, destinationAvailability, humanizeComplianceReason, symbolKey } from './chunk-
|
|
1
|
+
export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-2TCYBOYW.js';
|
|
2
|
+
export { EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, assetClassOf, brokenLaneReason, complianceChecks, complianceControlsLine, complianceView, counterpartTokens, createEngine, destinationAvailability, humanizeComplianceReason, symbolKey } from './chunk-F46VMTTL.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-BEQ8DMvJ.cjs';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|
|
@@ -81,6 +81,15 @@ declare function StableGenieProvider({ children, ...config }: StableGenieConfig
|
|
|
81
81
|
type PillOpenAs = "modal" | "drawer";
|
|
82
82
|
|
|
83
83
|
type ExchangeMode = "exchange" | "onramp" | "offramp";
|
|
84
|
+
/** What the exchange card currently holds — see `onInputChange`. */
|
|
85
|
+
interface ExchangeInput {
|
|
86
|
+
fromChainId: number | null;
|
|
87
|
+
/** The asset's upper-cased symbol key (`"USDC"`, `"USDE"`), as `defaultFromAsset` takes it. */
|
|
88
|
+
fromAsset: string | null;
|
|
89
|
+
toChainId: number | null;
|
|
90
|
+
toAsset: string | null;
|
|
91
|
+
amount: string;
|
|
92
|
+
}
|
|
84
93
|
interface StableGenieExchangeProps extends StableGenieConfig {
|
|
85
94
|
mode?: ExchangeMode;
|
|
86
95
|
/**
|
|
@@ -111,6 +120,16 @@ interface StableGenieExchangeProps extends StableGenieConfig {
|
|
|
111
120
|
defaultToChainId?: number;
|
|
112
121
|
defaultToAsset?: SupportedAsset;
|
|
113
122
|
defaultAmount?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Called with the pair and amount on the card whenever any of them changes — a token picked, the
|
|
125
|
+
* direction flipped, the amount typed — and once on mount with what the card started on.
|
|
126
|
+
*
|
|
127
|
+
* The `default*` props only SEED the card; after that the card owns its state. A host that shows
|
|
128
|
+
* the same pair somewhere else (a configurator, a summary, a URL) needs this to follow the card,
|
|
129
|
+
* or the two drift apart the first time the user touches it. `amount` is the bare number as typed
|
|
130
|
+
* (`"1234.5"`), never the grouped text on screen. A leg is `null` until the card has one.
|
|
131
|
+
*/
|
|
132
|
+
onInputChange?: (input: ExchangeInput) => void;
|
|
114
133
|
/** Optional explicit receiver (defaults to the payer). */
|
|
115
134
|
recipient?: string;
|
|
116
135
|
/** Default fiat currency for the on/off-ramp modes. */
|
|
@@ -260,4 +279,4 @@ type MountConfig = ({
|
|
|
260
279
|
/** Imperatively mount a widget into an element (for non-JSX / vanilla React hosts). Returns unmount. */
|
|
261
280
|
declare function mount(el: HTMLElement, config: MountConfig): () => void;
|
|
262
281
|
|
|
263
|
-
export { type BankPayoutAccount as B, type Eip1193Provider as E, type LinkIdentity as L, type MountConfig as M, PaymentIsland as P, type SettlementMethod as S, type
|
|
282
|
+
export { type BankPayoutAccount as B, type Eip1193Provider as E, type LinkIdentity as L, type MountConfig as M, PaymentIsland as P, type SettlementMethod as S, type ExchangeInput as a, type ExchangeMode as b, type PaymentIslandKind as c, type PaymentIslandProps as d, type PillOpenAs as e, type StableGenieConfig as f, StableGenieExchange as g, type StableGenieExchangeProps as h, StableGeniePay as i, type StableGeniePayProps as j, StableGenieProvider as k, StableGenieRwaExchange as l, StableGenieSwap as m, type StableGenieSwapProps as n, type StableGenieTheme as o, type SuccessInfo as p, type SupportedAsset as q, darkTheme as r, lightTheme as s, mount as t, resolveTheme as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-BEQ8DMvJ.js';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|
|
@@ -81,6 +81,15 @@ declare function StableGenieProvider({ children, ...config }: StableGenieConfig
|
|
|
81
81
|
type PillOpenAs = "modal" | "drawer";
|
|
82
82
|
|
|
83
83
|
type ExchangeMode = "exchange" | "onramp" | "offramp";
|
|
84
|
+
/** What the exchange card currently holds — see `onInputChange`. */
|
|
85
|
+
interface ExchangeInput {
|
|
86
|
+
fromChainId: number | null;
|
|
87
|
+
/** The asset's upper-cased symbol key (`"USDC"`, `"USDE"`), as `defaultFromAsset` takes it. */
|
|
88
|
+
fromAsset: string | null;
|
|
89
|
+
toChainId: number | null;
|
|
90
|
+
toAsset: string | null;
|
|
91
|
+
amount: string;
|
|
92
|
+
}
|
|
84
93
|
interface StableGenieExchangeProps extends StableGenieConfig {
|
|
85
94
|
mode?: ExchangeMode;
|
|
86
95
|
/**
|
|
@@ -111,6 +120,16 @@ interface StableGenieExchangeProps extends StableGenieConfig {
|
|
|
111
120
|
defaultToChainId?: number;
|
|
112
121
|
defaultToAsset?: SupportedAsset;
|
|
113
122
|
defaultAmount?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Called with the pair and amount on the card whenever any of them changes — a token picked, the
|
|
125
|
+
* direction flipped, the amount typed — and once on mount with what the card started on.
|
|
126
|
+
*
|
|
127
|
+
* The `default*` props only SEED the card; after that the card owns its state. A host that shows
|
|
128
|
+
* the same pair somewhere else (a configurator, a summary, a URL) needs this to follow the card,
|
|
129
|
+
* or the two drift apart the first time the user touches it. `amount` is the bare number as typed
|
|
130
|
+
* (`"1234.5"`), never the grouped text on screen. A leg is `null` until the card has one.
|
|
131
|
+
*/
|
|
132
|
+
onInputChange?: (input: ExchangeInput) => void;
|
|
114
133
|
/** Optional explicit receiver (defaults to the payer). */
|
|
115
134
|
recipient?: string;
|
|
116
135
|
/** Default fiat currency for the on/off-ramp modes. */
|
|
@@ -260,4 +279,4 @@ type MountConfig = ({
|
|
|
260
279
|
/** Imperatively mount a widget into an element (for non-JSX / vanilla React hosts). Returns unmount. */
|
|
261
280
|
declare function mount(el: HTMLElement, config: MountConfig): () => void;
|
|
262
281
|
|
|
263
|
-
export { type BankPayoutAccount as B, type Eip1193Provider as E, type LinkIdentity as L, type MountConfig as M, PaymentIsland as P, type SettlementMethod as S, type
|
|
282
|
+
export { type BankPayoutAccount as B, type Eip1193Provider as E, type LinkIdentity as L, type MountConfig as M, PaymentIsland as P, type SettlementMethod as S, type ExchangeInput as a, type ExchangeMode as b, type PaymentIslandKind as c, type PaymentIslandProps as d, type PillOpenAs as e, type StableGenieConfig as f, StableGenieExchange as g, type StableGenieExchangeProps as h, StableGeniePay as i, type StableGeniePayProps as j, StableGenieProvider as k, StableGenieRwaExchange as l, StableGenieSwap as m, type StableGenieSwapProps as n, type StableGenieTheme as o, type SuccessInfo as p, type SupportedAsset as q, darkTheme as r, lightTheme as s, mount as t, resolveTheme as u };
|