@glacislabs/stablegenie-zerodelta 4.4.0 → 4.6.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.
@@ -1697,6 +1697,48 @@ async function buildRoute({
1697
1697
  };
1698
1698
  }
1699
1699
 
1700
+ // src/core/channel.ts
1701
+ var CHANNEL_HEADER = "x-zd-channel";
1702
+ var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
1703
+ var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
1704
+ var WIDGET_CHANNEL = "widget";
1705
+ var WIDGET_VERSION = "4.6.0" ;
1706
+ var MAX_CHANNEL_VERSION_LEN = 32;
1707
+ function sanitizeVersion(raw) {
1708
+ const v = String(raw).trim();
1709
+ if (!v) return "";
1710
+ const capped = v.length > MAX_CHANNEL_VERSION_LEN ? v.slice(0, MAX_CHANNEL_VERSION_LEN) : v;
1711
+ return /^[\x20-\x7e]+$/.test(capped) ? capped : "";
1712
+ }
1713
+ function embeddingOrigin(loc) {
1714
+ const origin = ((typeof location !== "undefined" ? location : void 0))?.origin;
1715
+ const v = String(origin ?? "").trim();
1716
+ if (!v || v === "null") return "";
1717
+ try {
1718
+ const url = new URL(v);
1719
+ if (url.protocol !== "https:" && url.protocol !== "http:") return "";
1720
+ return url.origin;
1721
+ } catch {
1722
+ return "";
1723
+ }
1724
+ }
1725
+ function channelHeaders(version, loc) {
1726
+ const headers = { [CHANNEL_HEADER]: WIDGET_CHANNEL };
1727
+ const v = sanitizeVersion(version);
1728
+ if (v) headers[CHANNEL_VERSION_HEADER] = v;
1729
+ const origin = embeddingOrigin();
1730
+ if (origin) headers[CHANNEL_ORIGIN_HEADER] = origin;
1731
+ return headers;
1732
+ }
1733
+ function isReportableSubmission(report) {
1734
+ if (!report) return false;
1735
+ const { txHash, chainId, wallet } = report;
1736
+ if (typeof txHash !== "string") return false;
1737
+ if (!/^0x[0-9a-fA-F]{64}$/.test(txHash) && !/^[1-9A-HJ-NP-Za-km-z]{64,90}$/.test(txHash)) return false;
1738
+ if (typeof chainId !== "number" || !Number.isFinite(chainId) || chainId <= 0) return false;
1739
+ return typeof wallet === "string" && /^0x[0-9a-fA-F]{40}$/.test(wallet);
1740
+ }
1741
+
1700
1742
  // src/core/api.ts
1701
1743
  function apiError(message, props = {}) {
1702
1744
  const err = new Error(message);
@@ -1779,9 +1821,14 @@ function createApiClient(cfg) {
1779
1821
  const screenCache = /* @__PURE__ */ new Map();
1780
1822
  const screenInflight = /* @__PURE__ */ new Map();
1781
1823
  const apiBase = cfg.apiBase.replace(/\/$/, "");
1824
+ const channel = channelHeaders(WIDGET_VERSION);
1782
1825
  async function requestJson(path, init = {}) {
1783
1826
  const apiKey = await cfg.getApiKey();
1784
- const headers = { "Content-Type": "application/json", ...init.headers || {} };
1827
+ const headers = {
1828
+ "Content-Type": "application/json",
1829
+ ...channel,
1830
+ ...init.headers || {}
1831
+ };
1785
1832
  if (apiKey) headers["x-api-key"] = apiKey;
1786
1833
  const controller = new AbortController();
1787
1834
  const timeoutId = setTimeout(() => controller.abort(), init.timeoutMs || 15e3);
@@ -1893,6 +1940,33 @@ function createApiClient(cfg) {
1893
1940
  cache.vaults = { at: Date.now(), value };
1894
1941
  return value;
1895
1942
  }
1943
+ const priceCache = /* @__PURE__ */ new Map();
1944
+ async function fetchPrices(symbols) {
1945
+ const wanted = [...new Set(symbols.map((s) => String(s || "").toUpperCase()).filter((s) => /^[A-Z0-9]{1,16}$/.test(s)))];
1946
+ const missing = wanted.filter((s) => !nowFresh(priceCache.get(s) ?? null));
1947
+ if (missing.length) {
1948
+ let prices = {};
1949
+ try {
1950
+ const snapshot = await apiRequest(`/prices?symbols=${encodeURIComponent(missing.join(","))}`, {
1951
+ timeoutMs: 8e3
1952
+ });
1953
+ prices = snapshot && typeof snapshot === "object" && !snapshot.stale && snapshot.prices && typeof snapshot.prices === "object" ? snapshot.prices : {};
1954
+ } catch {
1955
+ prices = {};
1956
+ }
1957
+ const at = Date.now();
1958
+ for (const s of missing) {
1959
+ const n = Number(prices[s]);
1960
+ priceCache.set(s, { at, value: Number.isFinite(n) && n > 0 ? n : null });
1961
+ }
1962
+ }
1963
+ const out = {};
1964
+ for (const s of wanted) {
1965
+ const value = priceCache.get(s)?.value;
1966
+ if (value != null) out[s] = value;
1967
+ }
1968
+ return out;
1969
+ }
1896
1970
  async function fetchQuote(body, retries = 1) {
1897
1971
  let lastError;
1898
1972
  for (let attempt = 0; attempt <= retries; attempt += 1) {
@@ -1932,7 +2006,27 @@ function createApiClient(cfg) {
1932
2006
  screenInflight.set(key, request);
1933
2007
  return request;
1934
2008
  }
1935
- return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
2009
+ async function reportSubmission(report) {
2010
+ if (!isReportableSubmission(report)) return false;
2011
+ try {
2012
+ await apiRequest("/submissions", {
2013
+ method: "POST",
2014
+ body: JSON.stringify({
2015
+ txHash: report.txHash,
2016
+ chainId: report.chainId,
2017
+ wallet: report.wallet,
2018
+ // Absent reads as "submitted" at the gateway too; sent explicitly so
2019
+ // a reader of the wire does not have to know that.
2020
+ stage: report.stage ?? "submitted"
2021
+ }),
2022
+ timeoutMs: 5e3
2023
+ });
2024
+ return true;
2025
+ } catch {
2026
+ return false;
2027
+ }
2028
+ }
2029
+ return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchPrices, fetchQuote, screenWallet, reportSubmission, apiBase };
1936
2030
  }
1937
2031
 
1938
2032
  // src/core/plan.ts
@@ -2115,6 +2209,14 @@ function validateSwap(swap = {}) {
2115
2209
  if (!/^\d+(\.\d+)?$/.test(amountIn) || Number(amountIn) <= 0 || Number(amountIn) > 1e9) throw new Error("Enter a valid swap amount.");
2116
2210
  return { fromChainId, toChainId, fromToken, toToken, amountIn };
2117
2211
  }
2212
+ function viaOf(quote, tokens) {
2213
+ const orders = Array.isArray(quote.orderRequests) ? quote.orderRequests : [];
2214
+ if (orders.length < 2) return null;
2215
+ const first = orders[0];
2216
+ const wanted = normalizeAddress(first?.askToken);
2217
+ const token = wanted ? tokens.find((t) => Number(t.chainId) === Number(first?.destinationChainId) && normalizeAddress(t.address) === wanted) : void 0;
2218
+ return token ? tokenTicker(token) : "";
2219
+ }
2118
2220
  async function quoteSwapPreview(api, swap, owner) {
2119
2221
  const v = validateSwap(swap);
2120
2222
  const tokens = await api.fetchTokens();
@@ -2143,7 +2245,9 @@ async function quoteSwapPreview(api, swap, owner) {
2143
2245
  toToken: destToken.symbol,
2144
2246
  bridge: quote.bridge || "",
2145
2247
  feeBps: Number(quote.feeBps || 0),
2146
- estimatedDuration: Number(quote.estimatedDuration || 0)
2248
+ estimatedDuration: Number(quote.estimatedDuration || 0),
2249
+ via: viaOf(quote, tokens),
2250
+ nativeFeeRaw: /^\d+$/.test(String(quote.gasCostSource ?? "")) ? String(quote.gasCostSource) : "0"
2147
2251
  };
2148
2252
  }
2149
2253
  async function buildSwapPlan(api, swap, payer, wallet = {}) {
@@ -2637,6 +2741,7 @@ function createEngine(config = {}) {
2637
2741
  fetchRoutes: api.fetchRoutes,
2638
2742
  fetchRouteHealth: api.fetchRouteHealth,
2639
2743
  fetchQuote: api.fetchQuote,
2744
+ fetchPrices: (symbols) => api.fetchPrices ? api.fetchPrices(symbols) : Promise.resolve({}),
2640
2745
  fetchCatalogue: async (allowedAssets, product) => {
2641
2746
  const [chains, registryTokens, routes, health, vaults] = await Promise.all([
2642
2747
  api.fetchChains().catch(() => []),
@@ -2668,6 +2773,7 @@ function createEngine(config = {}) {
2668
2773
  verifySubmittedTx: verifier.verifySubmittedTx,
2669
2774
  readBalances: verifier.readBalances,
2670
2775
  readNativeBalance: verifier.readNativeBalance,
2776
+ reportSubmission: api.reportSubmission,
2671
2777
  recordTransaction: (entry) => {
2672
2778
  const clean = sanitizeTxEntry(entry);
2673
2779
  try {
@@ -1,5 +1,5 @@
1
- import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-C1VaWfiy.cjs';
2
- export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-C1VaWfiy.cjs';
1
+ import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-DSCljQtK.cjs';
2
+ export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-DSCljQtK.cjs';
3
3
 
4
4
  /** Default request base for the widget: the same-origin keyless custody proxy (server injects the
5
5
  * ZeroDelta key). A host may override to `/api/v1` + an apiKey for the demo-first fallback path. */
@@ -383,6 +383,15 @@ interface SwapPreview {
383
383
  bridge: string;
384
384
  feeBps: number;
385
385
  estimatedDuration: number;
386
+ /**
387
+ * What a CHAINED order passes through — leg 1's ask, named from the registry (the USDC a vault
388
+ * purchase is routed via) — or null for a single-order route. Display only: the executed plan
389
+ * re-derives every leg and asserts them continuous before anything is signed.
390
+ */
391
+ via: string | null;
392
+ /** The quote's `gasCostSource` in wei — the native fee a LayerZero leg attaches, before the
393
+ * widget's buffer. "0" when the route charges none. Display only. */
394
+ nativeFeeRaw: string;
386
395
  }
387
396
  declare function quoteSwapPreview(api: ApiClient, swap: SwapInput, owner?: string): Promise<SwapPreview>;
388
397
  declare function buildSwapPlan(api: ApiClient, swap: SwapInput, payer: string, wallet?: {
@@ -541,6 +550,8 @@ interface Engine {
541
550
  fetchRoutes: ApiClient["fetchRoutes"];
542
551
  fetchRouteHealth: ApiClient["fetchRouteHealth"];
543
552
  fetchQuote: ApiClient["fetchQuote"];
553
+ /** USD prices by upper-cased symbol, for display only. Never rejects; an unpriced symbol is absent. */
554
+ fetchPrices: (symbols: readonly string[]) => Promise<Record<string, number>>;
544
555
  /**
545
556
  * The selectable catalogue, derived from the LIVE registry — `/chains`, `/tokens`, `/routes` and
546
557
  * the gateway's measured `/route-health`, resolved with the same rules the ZeroDelta dapp uses.
@@ -568,6 +579,11 @@ interface Engine {
568
579
  readBalances: Verifier["readBalances"];
569
580
  readNativeBalance: Verifier["readNativeBalance"];
570
581
  recordTransaction: (entry: TxHistoryEntry) => SanitizedTxEntry;
582
+ /**
583
+ * Tell the gateway this widget submitted a transaction. Called on the HASH,
584
+ * never on the click; never throws and never blocks. See `api.ts`.
585
+ */
586
+ reportSubmission?: ApiClient["reportSubmission"];
571
587
  }
572
588
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
573
589
  declare function createEngine(config?: EngineConfig): Engine;
@@ -1,5 +1,5 @@
1
- import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-C1VaWfiy.js';
2
- export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-C1VaWfiy.js';
1
+ import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-DSCljQtK.js';
2
+ export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-DSCljQtK.js';
3
3
 
4
4
  /** Default request base for the widget: the same-origin keyless custody proxy (server injects the
5
5
  * ZeroDelta key). A host may override to `/api/v1` + an apiKey for the demo-first fallback path. */
@@ -383,6 +383,15 @@ interface SwapPreview {
383
383
  bridge: string;
384
384
  feeBps: number;
385
385
  estimatedDuration: number;
386
+ /**
387
+ * What a CHAINED order passes through — leg 1's ask, named from the registry (the USDC a vault
388
+ * purchase is routed via) — or null for a single-order route. Display only: the executed plan
389
+ * re-derives every leg and asserts them continuous before anything is signed.
390
+ */
391
+ via: string | null;
392
+ /** The quote's `gasCostSource` in wei — the native fee a LayerZero leg attaches, before the
393
+ * widget's buffer. "0" when the route charges none. Display only. */
394
+ nativeFeeRaw: string;
386
395
  }
387
396
  declare function quoteSwapPreview(api: ApiClient, swap: SwapInput, owner?: string): Promise<SwapPreview>;
388
397
  declare function buildSwapPlan(api: ApiClient, swap: SwapInput, payer: string, wallet?: {
@@ -541,6 +550,8 @@ interface Engine {
541
550
  fetchRoutes: ApiClient["fetchRoutes"];
542
551
  fetchRouteHealth: ApiClient["fetchRouteHealth"];
543
552
  fetchQuote: ApiClient["fetchQuote"];
553
+ /** USD prices by upper-cased symbol, for display only. Never rejects; an unpriced symbol is absent. */
554
+ fetchPrices: (symbols: readonly string[]) => Promise<Record<string, number>>;
544
555
  /**
545
556
  * The selectable catalogue, derived from the LIVE registry — `/chains`, `/tokens`, `/routes` and
546
557
  * the gateway's measured `/route-health`, resolved with the same rules the ZeroDelta dapp uses.
@@ -568,6 +579,11 @@ interface Engine {
568
579
  readBalances: Verifier["readBalances"];
569
580
  readNativeBalance: Verifier["readNativeBalance"];
570
581
  recordTransaction: (entry: TxHistoryEntry) => SanitizedTxEntry;
582
+ /**
583
+ * Tell the gateway this widget submitted a transaction. Called on the HASH,
584
+ * never on the click; never throws and never blocks. See `api.ts`.
585
+ */
586
+ reportSubmission?: ApiClient["reportSubmission"];
571
587
  }
572
588
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
573
589
  declare function createEngine(config?: EngineConfig): Engine;
@@ -1 +1 @@
1
- export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, COMPLIANCE_CHECK_ORDER, COMPLIANCE_DENY_LABEL, DEFAULT_WIDGET_API_BASE, DIRECT_CHECK_IDS, DIRECT_SCOPE_NOTE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, FLOOR_CATEGORIES, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetClassOf, assetDecimals, blockLabelFor, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, categoryLabel, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, counterpartTokens, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, exceedsLaneLimit, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, screeningOutcomeOf, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork } from '../chunk-53K3BXT5.js';
1
+ export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, COMPLIANCE_CHECK_ORDER, COMPLIANCE_DENY_LABEL, DEFAULT_WIDGET_API_BASE, DIRECT_CHECK_IDS, DIRECT_SCOPE_NOTE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, FLOOR_CATEGORIES, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetClassOf, assetDecimals, blockLabelFor, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, categoryLabel, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, counterpartTokens, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, exceedsLaneLimit, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, screeningOutcomeOf, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork } from '../chunk-CEBEMZHZ.js';