@glacislabs/stablegenie-zerodelta 4.5.0 → 4.7.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.
@@ -1458,6 +1458,10 @@ function routeDeltaLabel(result, quote) {
1458
1458
  if (quote.feeBps) return `${quote.feeBps} bps fee`;
1459
1459
  return "~0";
1460
1460
  }
1461
+ function quotePartnerId(quote) {
1462
+ const raw = quote.partnerId;
1463
+ return typeof raw === "string" && /^0x[0-9a-fA-F]{64}$/.test(raw) ? raw.toLowerCase() : NO_PARTNER_ID;
1464
+ }
1461
1465
  function optionTicker(option) {
1462
1466
  return option.ticker || option.symbol;
1463
1467
  }
@@ -1623,6 +1627,7 @@ async function buildRoute({
1623
1627
  }
1624
1628
  }
1625
1629
  const valueRaw = applyLayerZeroBuffer(quote, option);
1630
+ const partnerId = quotePartnerId(quote);
1626
1631
  if (!needsNativeFee) {
1627
1632
  if (valueRaw !== 0n) throw new Error("Non-LayerZero route requested a non-zero native value; refusing to sign.");
1628
1633
  } else if (valueRaw === 0n && Number(quote.executionChainId) > 0) {
@@ -1673,7 +1678,7 @@ async function buildRoute({
1673
1678
  label: "Submit ZeroDelta order",
1674
1679
  chainId: option.chainId,
1675
1680
  to: escrow,
1676
- data: encodeSubmitOrder(orders),
1681
+ data: encodeSubmitOrder(orders, partnerId),
1677
1682
  value: toHexQuantity(valueRaw),
1678
1683
  escrow,
1679
1684
  amountRaw: order.bidTokenAmount
@@ -1686,6 +1691,7 @@ async function buildRoute({
1686
1691
  gasCostSource: quote.gasCostSource,
1687
1692
  msgValue: valueRaw.toString(),
1688
1693
  deadline: order.deadline,
1694
+ partnerId: partnerId === NO_PARTNER_ID ? void 0 : partnerId,
1689
1695
  iterations: result.iterations,
1690
1696
  // Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
1691
1697
  // drop it, which is why the widget could show a price with no evidence of the control that
@@ -1700,7 +1706,7 @@ var CHANNEL_HEADER = "x-zd-channel";
1700
1706
  var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
1701
1707
  var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
1702
1708
  var WIDGET_CHANNEL = "widget";
1703
- var WIDGET_VERSION = "4.5.0" ;
1709
+ var WIDGET_VERSION = "4.7.0" ;
1704
1710
  var MAX_CHANNEL_VERSION_LEN = 32;
1705
1711
  function sanitizeVersion(raw) {
1706
1712
  const v = String(raw).trim();
@@ -1938,6 +1944,33 @@ function createApiClient(cfg) {
1938
1944
  cache.vaults = { at: Date.now(), value };
1939
1945
  return value;
1940
1946
  }
1947
+ const priceCache = /* @__PURE__ */ new Map();
1948
+ async function fetchPrices(symbols) {
1949
+ const wanted = [...new Set(symbols.map((s) => String(s || "").toUpperCase()).filter((s) => /^[A-Z0-9]{1,16}$/.test(s)))];
1950
+ const missing = wanted.filter((s) => !nowFresh(priceCache.get(s) ?? null));
1951
+ if (missing.length) {
1952
+ let prices = {};
1953
+ try {
1954
+ const snapshot = await apiRequest(`/prices?symbols=${encodeURIComponent(missing.join(","))}`, {
1955
+ timeoutMs: 8e3
1956
+ });
1957
+ prices = snapshot && typeof snapshot === "object" && !snapshot.stale && snapshot.prices && typeof snapshot.prices === "object" ? snapshot.prices : {};
1958
+ } catch {
1959
+ prices = {};
1960
+ }
1961
+ const at = Date.now();
1962
+ for (const s of missing) {
1963
+ const n = Number(prices[s]);
1964
+ priceCache.set(s, { at, value: Number.isFinite(n) && n > 0 ? n : null });
1965
+ }
1966
+ }
1967
+ const out = {};
1968
+ for (const s of wanted) {
1969
+ const value = priceCache.get(s)?.value;
1970
+ if (value != null) out[s] = value;
1971
+ }
1972
+ return out;
1973
+ }
1941
1974
  async function fetchQuote(body, retries = 1) {
1942
1975
  let lastError;
1943
1976
  for (let attempt = 0; attempt <= retries; attempt += 1) {
@@ -1997,7 +2030,7 @@ function createApiClient(cfg) {
1997
2030
  return false;
1998
2031
  }
1999
2032
  }
2000
- return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, reportSubmission, apiBase };
2033
+ return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchPrices, fetchQuote, screenWallet, reportSubmission, apiBase };
2001
2034
  }
2002
2035
 
2003
2036
  // src/core/plan.ts
@@ -2180,6 +2213,14 @@ function validateSwap(swap = {}) {
2180
2213
  if (!/^\d+(\.\d+)?$/.test(amountIn) || Number(amountIn) <= 0 || Number(amountIn) > 1e9) throw new Error("Enter a valid swap amount.");
2181
2214
  return { fromChainId, toChainId, fromToken, toToken, amountIn };
2182
2215
  }
2216
+ function viaOf(quote, tokens) {
2217
+ const orders = Array.isArray(quote.orderRequests) ? quote.orderRequests : [];
2218
+ if (orders.length < 2) return null;
2219
+ const first = orders[0];
2220
+ const wanted = normalizeAddress(first?.askToken);
2221
+ const token = wanted ? tokens.find((t) => Number(t.chainId) === Number(first?.destinationChainId) && normalizeAddress(t.address) === wanted) : void 0;
2222
+ return token ? tokenTicker(token) : "";
2223
+ }
2183
2224
  async function quoteSwapPreview(api, swap, owner) {
2184
2225
  const v = validateSwap(swap);
2185
2226
  const tokens = await api.fetchTokens();
@@ -2208,7 +2249,9 @@ async function quoteSwapPreview(api, swap, owner) {
2208
2249
  toToken: destToken.symbol,
2209
2250
  bridge: quote.bridge || "",
2210
2251
  feeBps: Number(quote.feeBps || 0),
2211
- estimatedDuration: Number(quote.estimatedDuration || 0)
2252
+ estimatedDuration: Number(quote.estimatedDuration || 0),
2253
+ via: viaOf(quote, tokens),
2254
+ nativeFeeRaw: /^\d+$/.test(String(quote.gasCostSource ?? "")) ? String(quote.gasCostSource) : "0"
2212
2255
  };
2213
2256
  }
2214
2257
  async function buildSwapPlan(api, swap, payer, wallet = {}) {
@@ -2319,7 +2362,7 @@ function validatePlannedTransaction(tx, route, expectedRecipient) {
2319
2362
  if (!decoded) return false;
2320
2363
  const first = decoded.orders[0];
2321
2364
  const last = decoded.orders[decoded.orders.length - 1];
2322
- 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);
2365
+ 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);
2323
2366
  }
2324
2367
  return false;
2325
2368
  }
@@ -2702,6 +2745,7 @@ function createEngine(config = {}) {
2702
2745
  fetchRoutes: api.fetchRoutes,
2703
2746
  fetchRouteHealth: api.fetchRouteHealth,
2704
2747
  fetchQuote: api.fetchQuote,
2748
+ fetchPrices: (symbols) => api.fetchPrices ? api.fetchPrices(symbols) : Promise.resolve({}),
2705
2749
  fetchCatalogue: async (allowedAssets, product) => {
2706
2750
  const [chains, registryTokens, routes, health, vaults] = await Promise.all([
2707
2751
  api.fetchChains().catch(() => []),
@@ -2745,4 +2789,4 @@ function createEngine(config = {}) {
2745
2789
  };
2746
2790
  }
2747
2791
 
2748
- 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 };
2792
+ 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, quotePartnerId, 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 };
@@ -1460,6 +1460,10 @@ function routeDeltaLabel(result, quote) {
1460
1460
  if (quote.feeBps) return `${quote.feeBps} bps fee`;
1461
1461
  return "~0";
1462
1462
  }
1463
+ function quotePartnerId(quote) {
1464
+ const raw = quote.partnerId;
1465
+ return typeof raw === "string" && /^0x[0-9a-fA-F]{64}$/.test(raw) ? raw.toLowerCase() : NO_PARTNER_ID;
1466
+ }
1463
1467
  function optionTicker(option) {
1464
1468
  return option.ticker || option.symbol;
1465
1469
  }
@@ -1625,6 +1629,7 @@ async function buildRoute({
1625
1629
  }
1626
1630
  }
1627
1631
  const valueRaw = applyLayerZeroBuffer(quote, option);
1632
+ const partnerId = quotePartnerId(quote);
1628
1633
  if (!needsNativeFee) {
1629
1634
  if (valueRaw !== 0n) throw new Error("Non-LayerZero route requested a non-zero native value; refusing to sign.");
1630
1635
  } else if (valueRaw === 0n && Number(quote.executionChainId) > 0) {
@@ -1675,7 +1680,7 @@ async function buildRoute({
1675
1680
  label: "Submit ZeroDelta order",
1676
1681
  chainId: option.chainId,
1677
1682
  to: escrow,
1678
- data: encodeSubmitOrder(orders),
1683
+ data: encodeSubmitOrder(orders, partnerId),
1679
1684
  value: toHexQuantity(valueRaw),
1680
1685
  escrow,
1681
1686
  amountRaw: order.bidTokenAmount
@@ -1688,6 +1693,7 @@ async function buildRoute({
1688
1693
  gasCostSource: quote.gasCostSource,
1689
1694
  msgValue: valueRaw.toString(),
1690
1695
  deadline: order.deadline,
1696
+ partnerId: partnerId === NO_PARTNER_ID ? void 0 : partnerId,
1691
1697
  iterations: result.iterations,
1692
1698
  // Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
1693
1699
  // drop it, which is why the widget could show a price with no evidence of the control that
@@ -1702,7 +1708,7 @@ var CHANNEL_HEADER = "x-zd-channel";
1702
1708
  var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
1703
1709
  var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
1704
1710
  var WIDGET_CHANNEL = "widget";
1705
- var WIDGET_VERSION = "4.5.0" ;
1711
+ var WIDGET_VERSION = "4.7.0" ;
1706
1712
  var MAX_CHANNEL_VERSION_LEN = 32;
1707
1713
  function sanitizeVersion(raw) {
1708
1714
  const v = String(raw).trim();
@@ -1940,6 +1946,33 @@ function createApiClient(cfg) {
1940
1946
  cache.vaults = { at: Date.now(), value };
1941
1947
  return value;
1942
1948
  }
1949
+ const priceCache = /* @__PURE__ */ new Map();
1950
+ async function fetchPrices(symbols) {
1951
+ const wanted = [...new Set(symbols.map((s) => String(s || "").toUpperCase()).filter((s) => /^[A-Z0-9]{1,16}$/.test(s)))];
1952
+ const missing = wanted.filter((s) => !nowFresh(priceCache.get(s) ?? null));
1953
+ if (missing.length) {
1954
+ let prices = {};
1955
+ try {
1956
+ const snapshot = await apiRequest(`/prices?symbols=${encodeURIComponent(missing.join(","))}`, {
1957
+ timeoutMs: 8e3
1958
+ });
1959
+ prices = snapshot && typeof snapshot === "object" && !snapshot.stale && snapshot.prices && typeof snapshot.prices === "object" ? snapshot.prices : {};
1960
+ } catch {
1961
+ prices = {};
1962
+ }
1963
+ const at = Date.now();
1964
+ for (const s of missing) {
1965
+ const n = Number(prices[s]);
1966
+ priceCache.set(s, { at, value: Number.isFinite(n) && n > 0 ? n : null });
1967
+ }
1968
+ }
1969
+ const out = {};
1970
+ for (const s of wanted) {
1971
+ const value = priceCache.get(s)?.value;
1972
+ if (value != null) out[s] = value;
1973
+ }
1974
+ return out;
1975
+ }
1943
1976
  async function fetchQuote(body, retries = 1) {
1944
1977
  let lastError;
1945
1978
  for (let attempt = 0; attempt <= retries; attempt += 1) {
@@ -1999,7 +2032,7 @@ function createApiClient(cfg) {
1999
2032
  return false;
2000
2033
  }
2001
2034
  }
2002
- return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, reportSubmission, apiBase };
2035
+ return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchPrices, fetchQuote, screenWallet, reportSubmission, apiBase };
2003
2036
  }
2004
2037
 
2005
2038
  // src/core/plan.ts
@@ -2182,6 +2215,14 @@ function validateSwap(swap = {}) {
2182
2215
  if (!/^\d+(\.\d+)?$/.test(amountIn) || Number(amountIn) <= 0 || Number(amountIn) > 1e9) throw new Error("Enter a valid swap amount.");
2183
2216
  return { fromChainId, toChainId, fromToken, toToken, amountIn };
2184
2217
  }
2218
+ function viaOf(quote, tokens) {
2219
+ const orders = Array.isArray(quote.orderRequests) ? quote.orderRequests : [];
2220
+ if (orders.length < 2) return null;
2221
+ const first = orders[0];
2222
+ const wanted = normalizeAddress(first?.askToken);
2223
+ const token = wanted ? tokens.find((t) => Number(t.chainId) === Number(first?.destinationChainId) && normalizeAddress(t.address) === wanted) : void 0;
2224
+ return token ? tokenTicker(token) : "";
2225
+ }
2185
2226
  async function quoteSwapPreview(api, swap, owner) {
2186
2227
  const v = validateSwap(swap);
2187
2228
  const tokens = await api.fetchTokens();
@@ -2210,7 +2251,9 @@ async function quoteSwapPreview(api, swap, owner) {
2210
2251
  toToken: destToken.symbol,
2211
2252
  bridge: quote.bridge || "",
2212
2253
  feeBps: Number(quote.feeBps || 0),
2213
- estimatedDuration: Number(quote.estimatedDuration || 0)
2254
+ estimatedDuration: Number(quote.estimatedDuration || 0),
2255
+ via: viaOf(quote, tokens),
2256
+ nativeFeeRaw: /^\d+$/.test(String(quote.gasCostSource ?? "")) ? String(quote.gasCostSource) : "0"
2214
2257
  };
2215
2258
  }
2216
2259
  async function buildSwapPlan(api, swap, payer, wallet = {}) {
@@ -2321,7 +2364,7 @@ function validatePlannedTransaction(tx, route, expectedRecipient) {
2321
2364
  if (!decoded) return false;
2322
2365
  const first = decoded.orders[0];
2323
2366
  const last = decoded.orders[decoded.orders.length - 1];
2324
- 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);
2367
+ 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);
2325
2368
  }
2326
2369
  return false;
2327
2370
  }
@@ -2704,6 +2747,7 @@ function createEngine(config = {}) {
2704
2747
  fetchRoutes: api.fetchRoutes,
2705
2748
  fetchRouteHealth: api.fetchRouteHealth,
2706
2749
  fetchQuote: api.fetchQuote,
2750
+ fetchPrices: (symbols) => api.fetchPrices ? api.fetchPrices(symbols) : Promise.resolve({}),
2707
2751
  fetchCatalogue: async (allowedAssets, product) => {
2708
2752
  const [chains, registryTokens, routes, health, vaults] = await Promise.all([
2709
2753
  api.fetchChains().catch(() => []),
@@ -2880,6 +2924,7 @@ exports.parseUnitsDecimal = parseUnitsDecimal;
2880
2924
  exports.planErrorSummary = planErrorSummary;
2881
2925
  exports.planMsgValueHex = planMsgValueHex;
2882
2926
  exports.productAssets = productAssets;
2927
+ exports.quotePartnerId = quotePartnerId;
2883
2928
  exports.quoteSwapPreview = quoteSwapPreview;
2884
2929
  exports.recommendedDeadlineSeconds = recommendedDeadlineSeconds;
2885
2930
  exports.registryRpc = registryRpc;
@@ -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-D722uRwZ.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-D722uRwZ.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-BEQ8DMvJ.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-BEQ8DMvJ.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. */
@@ -24,10 +24,11 @@ declare const MAX_QUOTE_CANDIDATES = 8;
24
24
  declare const QUOTE_BUFFER_BPS = 50;
25
25
  declare const LZ_FEE_BUFFER_BPS = 1500n;
26
26
  declare const SUBMIT_ORDER_SELECTOR = "0xaf439ecd";
27
- /** `partnerId` for orders this widget submits — none. The escrow's only use of the argument is
27
+ /** `partnerId` for an order whose quote carried none. The escrow's only use of the argument is
28
28
  * `if (partnerId != bytes32(0)) emit PartnerOrder(partnerId)`; there is no on-chain logic behind
29
- * it and the gateway issues none, so zero is the value that MEANS "no attribution", not a
30
- * placeholder. The pre-sign validator binds the encoded word to exactly this. */
29
+ * it, so zero is the value that MEANS "no attribution", not a placeholder. A quote priced at a
30
+ * key's special rate does carry one — see `quotePartnerId` in route.ts — and the pre-sign
31
+ * validator binds the encoded word to whichever of the two the plan declared. */
31
32
  declare const NO_PARTNER_ID: string;
32
33
  declare const ERC20_APPROVE_SELECTOR = "0x095ea7b3";
33
34
  declare const ERC20_TRANSFER_SELECTOR = "0xa9059cbb";
@@ -323,6 +324,21 @@ interface AssertQuoteArgs {
323
324
  }
324
325
  declare function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }: AssertQuoteArgs): void;
325
326
 
327
+ /**
328
+ * The `partnerId` word for this quote's `submitOrder`.
329
+ *
330
+ * A key with special rates gets its quote priced at them, and the gateway hands back a marker that
331
+ * binds that price to this exact order (wallets, tokens, chains, amounts). The solver only honours
332
+ * the price for an order that EMITS the marker, so dropping it — which this engine did until
333
+ * 2026-10-05, encoding zero unconditionally — submits an order asking for the special rate with
334
+ * nothing behind it, and it sits unfilled.
335
+ *
336
+ * Only a 32-byte hex string is a marker. Anything else is the zero word: absent (an ordinary key),
337
+ * or the `{ error }` object the gateway returns for a quote priced without both wallets. The API
338
+ * is untrusted, but this word buys it nothing: the escrow's whole use of it is one event, and a
339
+ * marker that does not match the order it rides on is simply not honoured.
340
+ */
341
+ declare function quotePartnerId(quote: Pick<Quote, "partnerId">): string;
326
342
  interface BuildRouteArgs {
327
343
  option: PayOption;
328
344
  destination: {
@@ -383,6 +399,15 @@ interface SwapPreview {
383
399
  bridge: string;
384
400
  feeBps: number;
385
401
  estimatedDuration: number;
402
+ /**
403
+ * What a CHAINED order passes through — leg 1's ask, named from the registry (the USDC a vault
404
+ * purchase is routed via) — or null for a single-order route. Display only: the executed plan
405
+ * re-derives every leg and asserts them continuous before anything is signed.
406
+ */
407
+ via: string | null;
408
+ /** The quote's `gasCostSource` in wei — the native fee a LayerZero leg attaches, before the
409
+ * widget's buffer. "0" when the route charges none. Display only. */
410
+ nativeFeeRaw: string;
386
411
  }
387
412
  declare function quoteSwapPreview(api: ApiClient, swap: SwapInput, owner?: string): Promise<SwapPreview>;
388
413
  declare function buildSwapPlan(api: ApiClient, swap: SwapInput, payer: string, wallet?: {
@@ -541,6 +566,8 @@ interface Engine {
541
566
  fetchRoutes: ApiClient["fetchRoutes"];
542
567
  fetchRouteHealth: ApiClient["fetchRouteHealth"];
543
568
  fetchQuote: ApiClient["fetchQuote"];
569
+ /** USD prices by upper-cased symbol, for display only. Never rejects; an unpriced symbol is absent. */
570
+ fetchPrices: (symbols: readonly string[]) => Promise<Record<string, number>>;
544
571
  /**
545
572
  * The selectable catalogue, derived from the LIVE registry — `/chains`, `/tokens`, `/routes` and
546
573
  * the gateway's measured `/route-health`, resolved with the same rules the ZeroDelta dapp uses.
@@ -577,4 +604,4 @@ interface Engine {
577
604
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
578
605
  declare function createEngine(config?: EngineConfig): Engine;
579
606
 
580
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, Catalogue, Chain, Compliance, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, FetchQuoteFn, 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, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, RwaVault, SAME_CLASS_STABLE, 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, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, recommendedDeadlineSeconds, requiresNativeBridgeFee, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
607
+ export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, Catalogue, Chain, Compliance, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, FetchQuoteFn, 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, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, RwaVault, SAME_CLASS_STABLE, 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, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quotePartnerId, quoteSwapPreview, recommendedDeadlineSeconds, requiresNativeBridgeFee, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
@@ -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-D722uRwZ.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-D722uRwZ.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-BEQ8DMvJ.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-BEQ8DMvJ.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. */
@@ -24,10 +24,11 @@ declare const MAX_QUOTE_CANDIDATES = 8;
24
24
  declare const QUOTE_BUFFER_BPS = 50;
25
25
  declare const LZ_FEE_BUFFER_BPS = 1500n;
26
26
  declare const SUBMIT_ORDER_SELECTOR = "0xaf439ecd";
27
- /** `partnerId` for orders this widget submits — none. The escrow's only use of the argument is
27
+ /** `partnerId` for an order whose quote carried none. The escrow's only use of the argument is
28
28
  * `if (partnerId != bytes32(0)) emit PartnerOrder(partnerId)`; there is no on-chain logic behind
29
- * it and the gateway issues none, so zero is the value that MEANS "no attribution", not a
30
- * placeholder. The pre-sign validator binds the encoded word to exactly this. */
29
+ * it, so zero is the value that MEANS "no attribution", not a placeholder. A quote priced at a
30
+ * key's special rate does carry one — see `quotePartnerId` in route.ts — and the pre-sign
31
+ * validator binds the encoded word to whichever of the two the plan declared. */
31
32
  declare const NO_PARTNER_ID: string;
32
33
  declare const ERC20_APPROVE_SELECTOR = "0x095ea7b3";
33
34
  declare const ERC20_TRANSFER_SELECTOR = "0xa9059cbb";
@@ -323,6 +324,21 @@ interface AssertQuoteArgs {
323
324
  }
324
325
  declare function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }: AssertQuoteArgs): void;
325
326
 
327
+ /**
328
+ * The `partnerId` word for this quote's `submitOrder`.
329
+ *
330
+ * A key with special rates gets its quote priced at them, and the gateway hands back a marker that
331
+ * binds that price to this exact order (wallets, tokens, chains, amounts). The solver only honours
332
+ * the price for an order that EMITS the marker, so dropping it — which this engine did until
333
+ * 2026-10-05, encoding zero unconditionally — submits an order asking for the special rate with
334
+ * nothing behind it, and it sits unfilled.
335
+ *
336
+ * Only a 32-byte hex string is a marker. Anything else is the zero word: absent (an ordinary key),
337
+ * or the `{ error }` object the gateway returns for a quote priced without both wallets. The API
338
+ * is untrusted, but this word buys it nothing: the escrow's whole use of it is one event, and a
339
+ * marker that does not match the order it rides on is simply not honoured.
340
+ */
341
+ declare function quotePartnerId(quote: Pick<Quote, "partnerId">): string;
326
342
  interface BuildRouteArgs {
327
343
  option: PayOption;
328
344
  destination: {
@@ -383,6 +399,15 @@ interface SwapPreview {
383
399
  bridge: string;
384
400
  feeBps: number;
385
401
  estimatedDuration: number;
402
+ /**
403
+ * What a CHAINED order passes through — leg 1's ask, named from the registry (the USDC a vault
404
+ * purchase is routed via) — or null for a single-order route. Display only: the executed plan
405
+ * re-derives every leg and asserts them continuous before anything is signed.
406
+ */
407
+ via: string | null;
408
+ /** The quote's `gasCostSource` in wei — the native fee a LayerZero leg attaches, before the
409
+ * widget's buffer. "0" when the route charges none. Display only. */
410
+ nativeFeeRaw: string;
386
411
  }
387
412
  declare function quoteSwapPreview(api: ApiClient, swap: SwapInput, owner?: string): Promise<SwapPreview>;
388
413
  declare function buildSwapPlan(api: ApiClient, swap: SwapInput, payer: string, wallet?: {
@@ -541,6 +566,8 @@ interface Engine {
541
566
  fetchRoutes: ApiClient["fetchRoutes"];
542
567
  fetchRouteHealth: ApiClient["fetchRouteHealth"];
543
568
  fetchQuote: ApiClient["fetchQuote"];
569
+ /** USD prices by upper-cased symbol, for display only. Never rejects; an unpriced symbol is absent. */
570
+ fetchPrices: (symbols: readonly string[]) => Promise<Record<string, number>>;
544
571
  /**
545
572
  * The selectable catalogue, derived from the LIVE registry — `/chains`, `/tokens`, `/routes` and
546
573
  * the gateway's measured `/route-health`, resolved with the same rules the ZeroDelta dapp uses.
@@ -577,4 +604,4 @@ interface Engine {
577
604
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
578
605
  declare function createEngine(config?: EngineConfig): Engine;
579
606
 
580
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, Catalogue, Chain, Compliance, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, FetchQuoteFn, 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, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, RwaVault, SAME_CLASS_STABLE, 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, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, recommendedDeadlineSeconds, requiresNativeBridgeFee, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
607
+ export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, Catalogue, Chain, Compliance, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, FetchQuoteFn, 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, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, RwaVault, SAME_CLASS_STABLE, 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, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quotePartnerId, quoteSwapPreview, recommendedDeadlineSeconds, requiresNativeBridgeFee, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
@@ -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-447DEZ5S.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, quotePartnerId, 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-MZCS5TL2.js';