@glacislabs/stablegenie-zerodelta 4.7.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -898,6 +898,20 @@ function withVaultArtwork(tokens, icons) {
898
898
  }
899
899
 
900
900
  // src/core/compliance.ts
901
+ function formatJurisdiction(jurisdiction, country) {
902
+ const region = jurisdiction?.trim() ?? "";
903
+ const explicitCountry = country?.trim() ?? "";
904
+ const countryCode = (explicitCountry || (/^[a-z]{2}$/i.test(region) && region.toUpperCase() !== "EU" ? region : "")).toUpperCase();
905
+ if (!countryCode) return region;
906
+ let countryLabel = countryCode;
907
+ try {
908
+ countryLabel = new Intl.DisplayNames(["en"], { type: "region" }).of(countryCode) ?? countryCode;
909
+ } catch {
910
+ }
911
+ const namedCountry = countryLabel === countryCode ? countryCode : `${countryLabel} (${countryCode})`;
912
+ if (!region || region.toUpperCase() === countryCode) return namedCountry;
913
+ return `${region} \xB7 ${namedCountry}`;
914
+ }
901
915
  var COMPLIANCE_DENY_LABEL = "Compliance check failed";
902
916
  function complianceView(compliance, hasQuote = true) {
903
917
  if (!hasQuote) {
@@ -1718,7 +1732,7 @@ var CHANNEL_HEADER = "x-zd-channel";
1718
1732
  var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
1719
1733
  var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
1720
1734
  var WIDGET_CHANNEL = "widget";
1721
- var WIDGET_VERSION = "4.7.0" ;
1735
+ var WIDGET_VERSION = "4.9.0" ;
1722
1736
  var MAX_CHANNEL_VERSION_LEN = 32;
1723
1737
  function sanitizeVersion(raw) {
1724
1738
  const v = String(raw).trim();
@@ -3313,6 +3327,83 @@ function useHoldings(engine, account, routes, initialBalances) {
3313
3327
  return { balances, loading };
3314
3328
  }
3315
3329
 
3330
+ // src/react/ui/amount.ts
3331
+ var MAX_FRACTION_DIGITS = 8;
3332
+ function trimFraction(fixed) {
3333
+ return fixed.includes(".") ? fixed.replace(/\.?0+$/, "") : fixed;
3334
+ }
3335
+ function groupDecimal(value) {
3336
+ const match = value.match(/^([+-]?)(\d+)(\.\d+)?$/);
3337
+ if (!match) return value;
3338
+ const integer = match[2].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
3339
+ return `${match[1]}${integer}${match[3] ?? ""}`;
3340
+ }
3341
+ var SIGNIFICANT_DIGITS = 7;
3342
+ var MIN_FRACTION_DIGITS = 4;
3343
+ function formatCalculatedAmount(value, decimals) {
3344
+ let raw = typeof value === "number" ? String(value) : value.trim();
3345
+ if (typeof value === "number") {
3346
+ if (!Number.isFinite(value)) return raw;
3347
+ if (/e/i.test(raw)) {
3348
+ raw = value.toLocaleString("en-US", {
3349
+ useGrouping: false,
3350
+ maximumFractionDigits: 20
3351
+ });
3352
+ }
3353
+ }
3354
+ const match = raw.match(/^([+-]?)(\d*)(?:\.(\d*))?$/);
3355
+ if (!match) return raw;
3356
+ const negative = match[1] === "-";
3357
+ const integer = (match[2] || "0").replace(/^0+(?=\d)/, "");
3358
+ const fraction = match[3] ?? "";
3359
+ const firstNonZero = fraction.search(/[1-9]/);
3360
+ const isZero = integer === "0" && firstNonZero === -1;
3361
+ if (isZero) return "0";
3362
+ if (integer === "0" && firstNonZero >= 6) return `${negative ? "-" : ""}<0.000001`;
3363
+ const cap = decimals === void 0 || !Number.isFinite(decimals) ? MAX_FRACTION_DIGITS : Math.min(MAX_FRACTION_DIGITS, Math.max(0, Math.trunc(decimals)));
3364
+ const places = integer !== "0" ? Math.min(cap, Math.max(MIN_FRACTION_DIGITS, SIGNIFICANT_DIGITS - integer.length)) : (
3365
+ // Below one the leading zeros are not significant, so the count starts
3366
+ // at the first digit that is.
3367
+ Math.min(cap, firstNonZero + SIGNIFICANT_DIGITS)
3368
+ );
3369
+ const scale = 10n ** BigInt(places);
3370
+ const padded = fraction.padEnd(places + 1, "0");
3371
+ const kept = padded.slice(0, places);
3372
+ let rounded = BigInt(integer) * scale + BigInt(kept || "0");
3373
+ if ((padded[places] ?? "0") >= "5") rounded += 1n;
3374
+ const whole = rounded / scale;
3375
+ const remainder = rounded % scale;
3376
+ const fixed = places === 0 ? whole.toString() : `${whole}.${remainder.toString().padStart(places, "0")}`;
3377
+ const out = groupDecimal(trimFraction(fixed));
3378
+ return negative && out !== "0" ? `-${out}` : out;
3379
+ }
3380
+ function exactAmountTitle(raw, shown) {
3381
+ const full = typeof raw === "number" ? String(raw) : raw.trim();
3382
+ if (!full || /e/i.test(full)) return void 0;
3383
+ const normalized = full.includes(".") ? trimFraction(full) : full;
3384
+ const grouped = groupDecimal(normalized);
3385
+ return grouped === shown ? void 0 : grouped;
3386
+ }
3387
+ function sanitizeAmount(raw) {
3388
+ const cleaned = raw.replace(/[^0-9.]/g, "");
3389
+ const first = cleaned.indexOf(".");
3390
+ if (first === -1) return cleaned;
3391
+ return cleaned.slice(0, first + 1) + cleaned.slice(first + 1).replace(/\./g, "");
3392
+ }
3393
+ function groupAmountInput(value) {
3394
+ const point = value.indexOf(".");
3395
+ const whole = point === -1 ? value : value.slice(0, point);
3396
+ return whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + (point === -1 ? "" : value.slice(point));
3397
+ }
3398
+ function groupedAmountCaret(grouped, kept) {
3399
+ if (kept <= 0) return 0;
3400
+ let seen = 0;
3401
+ for (let i = 0; i < grouped.length; i++) {
3402
+ if (grouped[i] !== "," && ++seen === kept) return i + 1;
3403
+ }
3404
+ return grouped.length;
3405
+ }
3406
+
3316
3407
  // src/react/styles.ts
3317
3408
  var WIDGET_CSS = `
3318
3409
  /* The card as the ZeroDelta widget design draws it (Figma "Widget Playground", 2026-09-30): no
@@ -4134,6 +4225,53 @@ function BrandMark({ size = 18, mono = false, className, style, title }) {
4134
4225
  }
4135
4226
  );
4136
4227
  }
4228
+ var MIN_FONT_PX = 10;
4229
+ function useFitText(ref, text) {
4230
+ react.useLayoutEffect(() => {
4231
+ const el = ref.current;
4232
+ if (!el) return;
4233
+ const fit = () => {
4234
+ el.style.fontSize = "";
4235
+ const room = el.clientWidth;
4236
+ const needed = el.scrollWidth;
4237
+ if (!room || needed <= room) return;
4238
+ const base = Number.parseFloat(getComputedStyle(el).fontSize);
4239
+ if (!Number.isFinite(base) || base <= 0) return;
4240
+ el.style.fontSize = `${Math.max(MIN_FONT_PX, Math.floor(base * room / needed))}px`;
4241
+ };
4242
+ fit();
4243
+ if (typeof ResizeObserver === "undefined") return;
4244
+ const observer = new ResizeObserver(fit);
4245
+ if (el.parentElement) observer.observe(el.parentElement);
4246
+ return () => observer.disconnect();
4247
+ }, [ref, text]);
4248
+ }
4249
+ function useGroupedAmountInput(amount, onAmount) {
4250
+ const caret = react.useRef(null);
4251
+ const [, rerender] = react.useReducer((n) => n + 1, 0);
4252
+ react.useLayoutEffect(() => {
4253
+ const pending = caret.current;
4254
+ caret.current = null;
4255
+ if (pending === null || pending.input !== document.activeElement) return;
4256
+ const at = groupedAmountCaret(pending.input.value, pending.kept);
4257
+ pending.input.setSelectionRange(at, at);
4258
+ });
4259
+ const onChange = (e) => {
4260
+ const input = e.target;
4261
+ const raw = input.value;
4262
+ caret.current = { input, kept: sanitizeAmount(raw.slice(0, input.selectionEnd ?? raw.length)).length };
4263
+ onAmount(sanitizeAmount(raw));
4264
+ rerender();
4265
+ };
4266
+ const onKeyDown = (e) => {
4267
+ const input = e.currentTarget;
4268
+ const at = input.selectionStart;
4269
+ if (at === null || at !== input.selectionEnd) return;
4270
+ if (e.key === "Backspace" && input.value[at - 1] === ",") input.setSelectionRange(at - 1, at - 1);
4271
+ else if (e.key === "Delete" && input.value[at] === ",") input.setSelectionRange(at + 1, at + 1);
4272
+ };
4273
+ return { value: groupAmountInput(amount), onChange, onKeyDown };
4274
+ }
4137
4275
  var SOURCE_CHAIN_LABELS = {
4138
4276
  1: "Ethereum",
4139
4277
  10: "Optimism",
@@ -4187,17 +4325,22 @@ function Select(props) {
4187
4325
  ] }) });
4188
4326
  }
4189
4327
  function AmountInput(props) {
4328
+ const grouped = useGroupedAmountInput(props.value, props.onChange);
4329
+ const field = react.useRef(null);
4330
+ useFitText(field, grouped.value);
4190
4331
  return /* @__PURE__ */ jsxRuntime.jsx(
4191
4332
  "input",
4192
4333
  {
4334
+ ref: field,
4193
4335
  className: "sg-input sg-amount sg-mono",
4194
4336
  inputMode: "decimal",
4195
4337
  placeholder: props.placeholder ?? "0.0",
4196
- value: props.value,
4338
+ value: grouped.value,
4197
4339
  disabled: props.disabled,
4198
4340
  "aria-invalid": props.invalid || void 0,
4199
4341
  "aria-describedby": props.describedBy,
4200
- onChange: (e) => props.onChange(e.target.value.replace(/[^0-9.,]/g, ""))
4342
+ onChange: grouped.onChange,
4343
+ onKeyDown: grouped.onKeyDown
4201
4344
  }
4202
4345
  );
4203
4346
  }
@@ -4623,11 +4766,11 @@ function QuoteGlyph({ size = 16 }) {
4623
4766
  )
4624
4767
  ] });
4625
4768
  }
4626
- function AmountText({ value, suffix }) {
4627
- const dot = value.indexOf(".");
4769
+ function AmountText({ value, suffix, exact }) {
4770
+ const dot = value.startsWith("<") ? -1 : value.indexOf(".");
4628
4771
  const whole = dot < 0 ? value : value.slice(0, dot + 1);
4629
4772
  const decimals = dot < 0 ? "" : value.slice(dot + 1);
4630
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-amt", children: [
4773
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-amt", title: exact === void 0 ? void 0 : exactAmountTitle(exact, value), children: [
4631
4774
  whole,
4632
4775
  decimals ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-amt-dec", children: decimals }) : null,
4633
4776
  suffix ? ` ${suffix}` : null
@@ -4882,7 +5025,7 @@ function QuoteChecks({
4882
5025
  const summary = allPassed ? "All checks passed" : cv.label;
4883
5026
  const orphans = unattributedComplianceReasons(compliance, cv);
4884
5027
  const wallets = distinctScreenedWallets(compliance);
4885
- const jurisdiction = compliance?.sourceJurisdiction?.trim();
5028
+ const jurisdiction = formatJurisdiction(compliance?.sourceJurisdiction, compliance?.sourceCountry);
4886
5029
  const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
4887
5030
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
4888
5031
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
@@ -6553,7 +6696,7 @@ function PayCard(props) {
6553
6696
  setSheet(false);
6554
6697
  requestAnimationFrame(() => complianceBtnRef.current?.focus());
6555
6698
  };
6556
- 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";
6699
+ 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";
6557
6700
  const walletSlot = wallet.account ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
6558
6701
  /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }),
6559
6702
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-wallet", "data-connected": "true", children: [
@@ -6605,7 +6748,7 @@ function PayCard(props) {
6605
6748
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane", "data-kind": "pay", children: [
6606
6749
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pane-label", children: "You pay" }),
6607
6750
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane-mid", children: [
6608
- /* @__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" }) }),
6751
+ /* @__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" }) }),
6609
6752
  /* @__PURE__ */ jsxRuntime.jsx(
6610
6753
  TokenButton,
6611
6754
  {
@@ -6930,6 +7073,15 @@ function ExchangeCard(props) {
6930
7073
  () => props.defaultToChainId && props.defaultToAsset ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
6931
7074
  );
6932
7075
  const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
7076
+ const onInputChange = react.useRef(props.onInputChange);
7077
+ onInputChange.current = props.onInputChange;
7078
+ const fromChainId = from?.chainId ?? null;
7079
+ const fromSymbol = from?.symbol ?? null;
7080
+ const toChainId = to?.chainId ?? null;
7081
+ const toSymbolKey = to?.symbol ?? null;
7082
+ react.useEffect(() => {
7083
+ onInputChange.current?.({ fromChainId, fromAsset: fromSymbol, toChainId, toAsset: toSymbolKey, amount });
7084
+ }, [fromChainId, fromSymbol, toChainId, toSymbolKey, amount]);
6933
7085
  const [fiatCurrency, setFiatCurrency] = react.useState(props.fiatCurrency ?? "EUR");
6934
7086
  const fromToken = react.useMemo(() => from ? findToken(tokens, from.chainId, from.symbol) : null, [tokens, from]);
6935
7087
  const toToken = react.useMemo(() => to ? findToken(tokens, to.chainId, to.symbol) : null, [tokens, to]);
@@ -7067,6 +7219,18 @@ function ExchangeCard(props) {
7067
7219
  const amountError = overLimit && laneLimit ? laneLimitError(laneLimit, limitSymbol) : gatewayAmountError;
7068
7220
  const amountNote = mode === "exchange" ? amountError || (laneLimit ? laneLimitHint(laneLimit, limitSymbol) : null) : null;
7069
7221
  const receive = connected ? flow.selected?.receive.amount : preview.data?.receive;
7222
+ const receiveOutRef = react.useRef(null);
7223
+ const receiveSideRef = react.useRef(null);
7224
+ const receiveShown = `${receive ?? ""}|${quoting}|${toTicker}`;
7225
+ useFitText(receiveOutRef, receiveShown);
7226
+ useFitText(receiveSideRef, receiveShown);
7227
+ const toDecimals = react.useMemo(() => {
7228
+ try {
7229
+ return toToken ? assetDecimals(toToken) : void 0;
7230
+ } catch {
7231
+ return void 0;
7232
+ }
7233
+ }, [toToken]);
7070
7234
  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;
7071
7235
  const pct = (p) => {
7072
7236
  if (!fromBal || !fromToken) return;
@@ -7260,7 +7424,7 @@ function ExchangeCard(props) {
7260
7424
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane", "data-kind": "receive", children: [
7261
7425
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pane-label", children: product === "rwa" ? "You receive (estimated)" : "You receive" }),
7262
7426
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane-mid", children: [
7263
- /* @__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" }) }),
7427
+ /* @__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" }) }),
7264
7428
  receiveToken
7265
7429
  ] }),
7266
7430
  /* @__PURE__ */ jsxRuntime.jsx(PaneFoot, { usd: hasQuote ? toUsd : null })
@@ -7321,7 +7485,7 @@ function ExchangeCard(props) {
7321
7485
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv", children: [
7322
7486
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-line", children: [
7323
7487
  /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: to?.symbol ?? "", logoUrl: toToken?.logoUrl, chainId: to?.chainId, size: "xs" }),
7324
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-recv-amt", children: /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: receive, suffix: toTicker }) })
7488
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-recv-amt", ref: receiveSideRef, children: /* @__PURE__ */ jsxRuntime.jsx(AmountText, { value: formatCalculatedAmount(receive, toDecimals), exact: receive, suffix: toTicker }) })
7325
7489
  ] }),
7326
7490
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
7327
7491
  "On ",
@@ -7383,6 +7547,7 @@ exports.counterpartTokens = counterpartTokens;
7383
7547
  exports.createEngine = createEngine;
7384
7548
  exports.darkTheme = darkTheme;
7385
7549
  exports.destinationAvailability = destinationAvailability;
7550
+ exports.formatJurisdiction = formatJurisdiction;
7386
7551
  exports.humanizeComplianceReason = humanizeComplianceReason;
7387
7552
  exports.lightTheme = lightTheme;
7388
7553
  exports.mount = mount;
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, b as PaymentIslandKind, c as PaymentIslandProps, d as PillOpenAs, S as SettlementMethod, e as StableGenieConfig, f as StableGenieExchange, g as StableGenieExchangeProps, h as StableGeniePay, i as StableGeniePayProps, j as StableGenieProvider, k as StableGenieRwaExchange, l as StableGenieSwap, m as StableGenieSwapProps, n as StableGenieTheme, o as SuccessInfo, p as SupportedAsset, q as darkTheme, r as lightTheme, s as mount, t as resolveTheme } from './mount-D4mbJwdc.cjs';
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-CQ2kUcrx.cjs';
2
2
  import * as react from 'react';
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';
3
+ import { C as Compliance } from './verify-CbsVzIkp.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 formatJurisdiction, r as humanizeComplianceReason } from './verify-CbsVzIkp.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, b as PaymentIslandKind, c as PaymentIslandProps, d as PillOpenAs, S as SettlementMethod, e as StableGenieConfig, f as StableGenieExchange, g as StableGenieExchangeProps, h as StableGeniePay, i as StableGeniePayProps, j as StableGenieProvider, k as StableGenieRwaExchange, l as StableGenieSwap, m as StableGenieSwapProps, n as StableGenieTheme, o as SuccessInfo, p as SupportedAsset, q as darkTheme, r as lightTheme, s as mount, t as resolveTheme } from './mount-D5TIOkMe.js';
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-BdpykBEW.js';
2
2
  import * as react from 'react';
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';
3
+ import { C as Compliance } from './verify-CbsVzIkp.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 formatJurisdiction, r as humanizeComplianceReason } from './verify-CbsVzIkp.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-L7ZEFAZ4.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-MZCS5TL2.js';
1
+ export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-YGBSCSBP.js';
2
+ export { EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, assetClassOf, brokenLaneReason, complianceChecks, complianceControlsLine, complianceView, counterpartTokens, createEngine, destinationAvailability, formatJurisdiction, humanizeComplianceReason, symbolKey } from './chunk-ZRGTK4B2.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-BEQ8DMvJ.js';
3
+ import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-CbsVzIkp.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 ExchangeMode as a, type PaymentIslandKind as b, type PaymentIslandProps as c, type PillOpenAs as d, type StableGenieConfig as e, StableGenieExchange as f, type StableGenieExchangeProps as g, StableGeniePay as h, type StableGeniePayProps as i, StableGenieProvider as j, StableGenieRwaExchange as k, StableGenieSwap as l, type StableGenieSwapProps as m, type StableGenieTheme as n, type SuccessInfo as o, type SupportedAsset as p, darkTheme as q, lightTheme as r, mount as s, resolveTheme as t };
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-BEQ8DMvJ.cjs';
3
+ import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-CbsVzIkp.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 ExchangeMode as a, type PaymentIslandKind as b, type PaymentIslandProps as c, type PillOpenAs as d, type StableGenieConfig as e, StableGenieExchange as f, type StableGenieExchangeProps as g, StableGeniePay as h, type StableGeniePayProps as i, StableGenieProvider as j, StableGenieRwaExchange as k, StableGenieSwap as l, type StableGenieSwapProps as m, type StableGenieTheme as n, type SuccessInfo as o, type SupportedAsset as p, darkTheme as q, lightTheme as r, mount as s, resolveTheme as t };
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 };