@glacislabs/stablegenie-zerodelta 3.3.0 → 3.4.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.
@@ -1,10 +1,14 @@
1
- import { a as Token, Q as Quote, N as NormalizedOrder, b as PayOption, R as RouteResult, C as Chain, c as Route, F as FetchQuoteFn, d as SolveResult, O as OrderRequest, B as BalanceTarget, e as BalanceEntry, A as ApiClient, P as Plan, f as SwapInput, g as PlannedTx, h as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-7lk90Ado.cjs';
2
- export { i as Address, j as ApiError, D as Destination, H as Hex, k as PlannedTxKind, l as QuoteBlock, m as ResolvedConfig, n as TxPlan, V as VerifyResult, o as apiError, p as canAttachApiKey, q as classifyQuoteError, r as createApiClient, s as createVerifier, t as parseAllowedApiBase, u as registryRpc, v as resolveApiBase, w as resolveConfig, x as txMatchesPlan } from '../verify-7lk90Ado.cjs';
1
+ import { T as Token, Q as Quote, N as NormalizedOrder, i as PayOption, c as RouteResult, a as Chain, R as Route, C as Catalogue, F as FetchQuoteFn, j as SolveResult, O as OrderRequest, k as BalanceTarget, l as BalanceEntry, m as ApiClient, P as Plan, n as SwapInput, o as PlannedTx, p as Verifier, b as ExchangeProduct, d as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-34voZYj1.cjs';
2
+ export { q as Address, r as ApiError, A as Availability, B as BrokenLane, s as CatalogueContext, t as CatalogueInput, D as Destination, H as Hex, u as PlannedTxKind, v as QuoteBlock, w as ResolvedConfig, x as RouteHealth, y as RouteHealthLane, z as TxPlan, V as VerifyResult, G as apiError, e as assetClassOf, I as brokenLaneFor, f as brokenLaneReason, J as buildCatalogue, K as canAttachApiKey, L as classifyQuoteError, g as counterpartTokens, M as createApiClient, U as createVerifier, h as destinationAvailability, W as destinationKeys, X as executableRoutes, Y as executionChainIds, Z as hasReachableDestination, _ as hubDeliverableSymbols, $ as isExecutableBridge, a0 as isKnownUnbridgeable, a1 as isSourceToken, a2 as laneKey, a3 as laneKeys, a4 as parseAllowedApiBase, a5 as productAssets, a6 as registryRpc, a7 as resolveApiBase, a8 as resolveConfig, a9 as sourceKeys, aa as suppressedLanes, ab as tokenKey, ac as txMatchesPlan } from '../verify-34voZYj1.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. */
6
6
  declare const DEFAULT_WIDGET_API_BASE = "/api/widget/v1";
7
7
  declare const SUPPORTED_CHAIN_IDS: ReadonlySet<number>;
8
+ declare const EXECUTABLE_STABLE_ASSETS: ReadonlySet<string>;
9
+ declare const STABLE_ASSETS: ReadonlySet<string>;
10
+ declare const TRADEABLE_RWA_ASSETS: ReadonlySet<string>;
11
+ /** Everything the engine may price. The catalogue narrows this per product; see availability.ts. */
8
12
  declare const SUPPORTED_ASSETS: ReadonlySet<string>;
9
13
  declare const API_CACHE_TTL_MS = 60000;
10
14
  declare const MAX_QUOTE_CANDIDATES = 8;
@@ -28,11 +32,12 @@ declare const MAX_LZ_MSG_VALUE_WEI: bigint;
28
32
  declare const MAX_LZ_MSG_VALUE_WEI_BY_CHAIN: Record<number, bigint>;
29
33
  /** Cap on the raw, pre-buffer native bridge fee for `chainId`. */
30
34
  declare function maxNativeFeeWei(chainId: number): bigint;
31
- declare const CANONICAL_INBOUND_BRIDGE: Record<string, "layerzero" | "cctp">;
35
+ declare const CANONICAL_INBOUND_BRIDGE: Record<string, "layerzero" | "cctp" | "none">;
32
36
  declare const SAME_CLASS_STABLE: ReadonlySet<string>;
33
37
  declare const MAX_SAME_CLASS_PAY_BPS = 30000n;
34
38
  declare const BUNDLED_NATIVE_SYMBOL: Record<number, string>;
35
39
  declare const BUNDLED_RPC: Record<number, string>;
40
+ declare const CHAIN_DISPLAY_NAMES: Readonly<Record<number, string>>;
36
41
 
37
42
  declare function symbolKey(value: unknown): string;
38
43
  declare function isAddress(value: unknown): boolean;
@@ -149,9 +154,29 @@ declare function nativeFeeShortLabel(check: NativeFeeCheck, symbol: string): str
149
154
  /** Full sentence for the error panel / pre-sign refusal. */
150
155
  declare function nativeFeeShortMessage(check: NativeFeeCheck, symbol: string, chainName: string): string;
151
156
 
157
+ /**
158
+ * A network's name.
159
+ *
160
+ * `GET /chains` only lists the chains ZeroDelta runs an escrow on, so a payout-only DESTINATION —
161
+ * a chain a published route ends at, which a payment can be delivered to but never sent from — has
162
+ * no registry row and used to render as "Chain 747474". The bundled table names those; the registry
163
+ * still wins wherever it has an answer, so an operator can rename a network without a release.
164
+ */
152
165
  declare function chainNameOf(chainId: number, chains: Chain[]): string;
153
166
  declare function chainById(chains: Chain[], chainId: number): Chain | null;
167
+ /**
168
+ * @deprecated Superseded 2026-09-08 by the live route projection (`core/availability.ts`).
169
+ *
170
+ * This was a single hardcoded fact — "USD₮0 on Base is source-disabled" — standing in for the whole
171
+ * question of what can be delivered where. It could only ever encode the cases someone had hit, it
172
+ * went stale the moment the registry changed, and it said nothing at all about the ~1800 other lanes
173
+ * the gateway's prober has measured refusing.
174
+ *
175
+ * Kept, unchanged, only because it is a published export that an integrator may have imported. No
176
+ * engine path consults it any more — `destinationAvailability` does. Do not add cases to it.
177
+ */
154
178
  declare function isDeliverable(symbol: string, chainId: number): boolean;
179
+ /** Whether a chain may be a payment SOURCE: pinned escrow chain, and enabled in the registry. */
155
180
  declare function chainSelectable(chain: Chain | null, chainId: number): boolean;
156
181
  declare function tokenEnabled(token: Partial<Token> | undefined | null): boolean;
157
182
  declare function findToken(tokens: Token[], chainId: number, symbol: string): Token | null;
@@ -162,8 +187,44 @@ interface BuildPayOptionsArgs {
162
187
  routes: Route[];
163
188
  chains: Chain[];
164
189
  walletChainId?: number;
190
+ /**
191
+ * The live catalogue (`engine.fetchCatalogue()`).
192
+ *
193
+ * When it is present AND `ready`, deliverability is decided by the gateway's own route projection
194
+ * and its MEASURED lane health — the same inputs the ZeroDelta dapp uses. When it is absent or not
195
+ * ready (a registry read that failed, a unit fixture, a first paint), the structural fallback below
196
+ * applies and nothing is demoted on data we do not have.
197
+ */
198
+ catalogue?: Catalogue | null;
165
199
  }
166
- declare function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId }: BuildPayOptionsArgs): PayOption[];
200
+ /**
201
+ * The funding options that can settle one invoice.
202
+ *
203
+ * ## What changed on 2026-09-08, and why
204
+ *
205
+ * Two rules here were wrong against the deployed gateway, and both REMOVED working options:
206
+ *
207
+ * 1. **Same-symbol cross-chain funding was refused outright.** The comment said "the ZeroDelta
208
+ * backend rejects same-token swaps", which was true when it was written and is not true now:
209
+ * `POST /quote` for USDC@1 → USDC@42161 answers 200 (measured on dev, 2026-09-08), because the
210
+ * escrow diverts a same-symbol pair onto `bridgeDirect`. What that path genuinely needs is a real
211
+ * source→destination PEER, not a composed hop — so the rule is now `directLaneOK`, keyed on both
212
+ * ends of the lane, exactly as the dapp learned to key it.
213
+ * 2. **A funding asset had to also exist on the invoice chain.** A swap executes on an execution
214
+ * chain and bridges the ask outward; the bid never has to exist at the destination. AUSD@1 →
215
+ * USDC@98866 quotes fine even though AUSD is not deployed on Plume. That gate silently hid every
216
+ * funding asset with a narrow deployment footprint.
217
+ *
218
+ * Both were replaced with the live projection rather than a wider hardcoded rule.
219
+ *
220
+ * ## The discipline
221
+ *
222
+ * An option is dropped only on a POSITIVE signal — a measured refusal, a missing direct peer when
223
+ * the lane set is known, an asset the escrow owns no adapter for. Absent data never demotes: this
224
+ * function runs before the first paint of the funding list, and a candidate wrongly dropped here is
225
+ * a payment route the payer is never shown.
226
+ */
227
+ declare function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId, catalogue }: BuildPayOptionsArgs): PayOption[];
167
228
 
168
229
  interface SolveArgs {
169
230
  option: PayOption;
@@ -346,7 +407,7 @@ declare const stableGenieIntentSchema: {
346
407
  };
347
408
  readonly chainId: {
348
409
  readonly type: "integer";
349
- readonly enum: readonly number[];
410
+ readonly minimum: 1;
350
411
  };
351
412
  readonly chainName: {
352
413
  readonly type: "string";
@@ -390,7 +451,25 @@ interface Engine {
390
451
  fetchChains: ApiClient["fetchChains"];
391
452
  fetchTokens: ApiClient["fetchTokens"];
392
453
  fetchRoutes: ApiClient["fetchRoutes"];
454
+ fetchRouteHealth: ApiClient["fetchRouteHealth"];
393
455
  fetchQuote: ApiClient["fetchQuote"];
456
+ /**
457
+ * The selectable catalogue, derived from the LIVE registry — `/chains`, `/tokens`, `/routes` and
458
+ * the gateway's measured `/route-health`, resolved with the same rules the ZeroDelta dapp uses.
459
+ *
460
+ * This is what a picker should render. The bundled `SUPPORTED_ASSETS` / `SUPPORTED_CHAIN_IDS`
461
+ * constants only BOUND it; they are not the list, and rendering them directly is what left the
462
+ * widget offering three stables where the dapp offers seven.
463
+ *
464
+ * `product` picks the universe — `"stable"` for the stable ⇄ stable exchange, `"rwa"` for the
465
+ * stable ⇄ real-world-asset one. They are NOT the same catalogue: the RWA product carries a wider
466
+ * stable list, admits assets that publish no route rows, and reaches its destinations through
467
+ * chained two-leg orders. `allowedAssets` narrows further (a host restricting what it accepts).
468
+ *
469
+ * Never rejects: a failed read yields a catalogue with `ready: false`, which callers must treat as
470
+ * "not known yet" rather than "nothing is supported".
471
+ */
472
+ fetchCatalogue: (allowedAssets?: readonly string[], product?: ExchangeProduct) => Promise<Catalogue>;
394
473
  fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
395
474
  quoteSwapPreview: (swap: SwapInput, owner?: string) => Promise<SwapPreview>;
396
475
  buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
@@ -405,4 +484,4 @@ interface Engine {
405
484
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
406
485
  declare function createEngine(config?: EngineConfig): Engine;
407
486
 
408
- 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, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, type Engine, EngineConfig, 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, SAME_CLASS_STABLE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, 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, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
487
+ 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, 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, SAME_CLASS_STABLE, 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, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
@@ -1,10 +1,14 @@
1
- import { a as Token, Q as Quote, N as NormalizedOrder, b as PayOption, R as RouteResult, C as Chain, c as Route, F as FetchQuoteFn, d as SolveResult, O as OrderRequest, B as BalanceTarget, e as BalanceEntry, A as ApiClient, P as Plan, f as SwapInput, g as PlannedTx, h as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-7lk90Ado.js';
2
- export { i as Address, j as ApiError, D as Destination, H as Hex, k as PlannedTxKind, l as QuoteBlock, m as ResolvedConfig, n as TxPlan, V as VerifyResult, o as apiError, p as canAttachApiKey, q as classifyQuoteError, r as createApiClient, s as createVerifier, t as parseAllowedApiBase, u as registryRpc, v as resolveApiBase, w as resolveConfig, x as txMatchesPlan } from '../verify-7lk90Ado.js';
1
+ import { T as Token, Q as Quote, N as NormalizedOrder, i as PayOption, c as RouteResult, a as Chain, R as Route, C as Catalogue, F as FetchQuoteFn, j as SolveResult, O as OrderRequest, k as BalanceTarget, l as BalanceEntry, m as ApiClient, P as Plan, n as SwapInput, o as PlannedTx, p as Verifier, b as ExchangeProduct, d as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-34voZYj1.js';
2
+ export { q as Address, r as ApiError, A as Availability, B as BrokenLane, s as CatalogueContext, t as CatalogueInput, D as Destination, H as Hex, u as PlannedTxKind, v as QuoteBlock, w as ResolvedConfig, x as RouteHealth, y as RouteHealthLane, z as TxPlan, V as VerifyResult, G as apiError, e as assetClassOf, I as brokenLaneFor, f as brokenLaneReason, J as buildCatalogue, K as canAttachApiKey, L as classifyQuoteError, g as counterpartTokens, M as createApiClient, U as createVerifier, h as destinationAvailability, W as destinationKeys, X as executableRoutes, Y as executionChainIds, Z as hasReachableDestination, _ as hubDeliverableSymbols, $ as isExecutableBridge, a0 as isKnownUnbridgeable, a1 as isSourceToken, a2 as laneKey, a3 as laneKeys, a4 as parseAllowedApiBase, a5 as productAssets, a6 as registryRpc, a7 as resolveApiBase, a8 as resolveConfig, a9 as sourceKeys, aa as suppressedLanes, ab as tokenKey, ac as txMatchesPlan } from '../verify-34voZYj1.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. */
6
6
  declare const DEFAULT_WIDGET_API_BASE = "/api/widget/v1";
7
7
  declare const SUPPORTED_CHAIN_IDS: ReadonlySet<number>;
8
+ declare const EXECUTABLE_STABLE_ASSETS: ReadonlySet<string>;
9
+ declare const STABLE_ASSETS: ReadonlySet<string>;
10
+ declare const TRADEABLE_RWA_ASSETS: ReadonlySet<string>;
11
+ /** Everything the engine may price. The catalogue narrows this per product; see availability.ts. */
8
12
  declare const SUPPORTED_ASSETS: ReadonlySet<string>;
9
13
  declare const API_CACHE_TTL_MS = 60000;
10
14
  declare const MAX_QUOTE_CANDIDATES = 8;
@@ -28,11 +32,12 @@ declare const MAX_LZ_MSG_VALUE_WEI: bigint;
28
32
  declare const MAX_LZ_MSG_VALUE_WEI_BY_CHAIN: Record<number, bigint>;
29
33
  /** Cap on the raw, pre-buffer native bridge fee for `chainId`. */
30
34
  declare function maxNativeFeeWei(chainId: number): bigint;
31
- declare const CANONICAL_INBOUND_BRIDGE: Record<string, "layerzero" | "cctp">;
35
+ declare const CANONICAL_INBOUND_BRIDGE: Record<string, "layerzero" | "cctp" | "none">;
32
36
  declare const SAME_CLASS_STABLE: ReadonlySet<string>;
33
37
  declare const MAX_SAME_CLASS_PAY_BPS = 30000n;
34
38
  declare const BUNDLED_NATIVE_SYMBOL: Record<number, string>;
35
39
  declare const BUNDLED_RPC: Record<number, string>;
40
+ declare const CHAIN_DISPLAY_NAMES: Readonly<Record<number, string>>;
36
41
 
37
42
  declare function symbolKey(value: unknown): string;
38
43
  declare function isAddress(value: unknown): boolean;
@@ -149,9 +154,29 @@ declare function nativeFeeShortLabel(check: NativeFeeCheck, symbol: string): str
149
154
  /** Full sentence for the error panel / pre-sign refusal. */
150
155
  declare function nativeFeeShortMessage(check: NativeFeeCheck, symbol: string, chainName: string): string;
151
156
 
157
+ /**
158
+ * A network's name.
159
+ *
160
+ * `GET /chains` only lists the chains ZeroDelta runs an escrow on, so a payout-only DESTINATION —
161
+ * a chain a published route ends at, which a payment can be delivered to but never sent from — has
162
+ * no registry row and used to render as "Chain 747474". The bundled table names those; the registry
163
+ * still wins wherever it has an answer, so an operator can rename a network without a release.
164
+ */
152
165
  declare function chainNameOf(chainId: number, chains: Chain[]): string;
153
166
  declare function chainById(chains: Chain[], chainId: number): Chain | null;
167
+ /**
168
+ * @deprecated Superseded 2026-09-08 by the live route projection (`core/availability.ts`).
169
+ *
170
+ * This was a single hardcoded fact — "USD₮0 on Base is source-disabled" — standing in for the whole
171
+ * question of what can be delivered where. It could only ever encode the cases someone had hit, it
172
+ * went stale the moment the registry changed, and it said nothing at all about the ~1800 other lanes
173
+ * the gateway's prober has measured refusing.
174
+ *
175
+ * Kept, unchanged, only because it is a published export that an integrator may have imported. No
176
+ * engine path consults it any more — `destinationAvailability` does. Do not add cases to it.
177
+ */
154
178
  declare function isDeliverable(symbol: string, chainId: number): boolean;
179
+ /** Whether a chain may be a payment SOURCE: pinned escrow chain, and enabled in the registry. */
155
180
  declare function chainSelectable(chain: Chain | null, chainId: number): boolean;
156
181
  declare function tokenEnabled(token: Partial<Token> | undefined | null): boolean;
157
182
  declare function findToken(tokens: Token[], chainId: number, symbol: string): Token | null;
@@ -162,8 +187,44 @@ interface BuildPayOptionsArgs {
162
187
  routes: Route[];
163
188
  chains: Chain[];
164
189
  walletChainId?: number;
190
+ /**
191
+ * The live catalogue (`engine.fetchCatalogue()`).
192
+ *
193
+ * When it is present AND `ready`, deliverability is decided by the gateway's own route projection
194
+ * and its MEASURED lane health — the same inputs the ZeroDelta dapp uses. When it is absent or not
195
+ * ready (a registry read that failed, a unit fixture, a first paint), the structural fallback below
196
+ * applies and nothing is demoted on data we do not have.
197
+ */
198
+ catalogue?: Catalogue | null;
165
199
  }
166
- declare function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId }: BuildPayOptionsArgs): PayOption[];
200
+ /**
201
+ * The funding options that can settle one invoice.
202
+ *
203
+ * ## What changed on 2026-09-08, and why
204
+ *
205
+ * Two rules here were wrong against the deployed gateway, and both REMOVED working options:
206
+ *
207
+ * 1. **Same-symbol cross-chain funding was refused outright.** The comment said "the ZeroDelta
208
+ * backend rejects same-token swaps", which was true when it was written and is not true now:
209
+ * `POST /quote` for USDC@1 → USDC@42161 answers 200 (measured on dev, 2026-09-08), because the
210
+ * escrow diverts a same-symbol pair onto `bridgeDirect`. What that path genuinely needs is a real
211
+ * source→destination PEER, not a composed hop — so the rule is now `directLaneOK`, keyed on both
212
+ * ends of the lane, exactly as the dapp learned to key it.
213
+ * 2. **A funding asset had to also exist on the invoice chain.** A swap executes on an execution
214
+ * chain and bridges the ask outward; the bid never has to exist at the destination. AUSD@1 →
215
+ * USDC@98866 quotes fine even though AUSD is not deployed on Plume. That gate silently hid every
216
+ * funding asset with a narrow deployment footprint.
217
+ *
218
+ * Both were replaced with the live projection rather than a wider hardcoded rule.
219
+ *
220
+ * ## The discipline
221
+ *
222
+ * An option is dropped only on a POSITIVE signal — a measured refusal, a missing direct peer when
223
+ * the lane set is known, an asset the escrow owns no adapter for. Absent data never demotes: this
224
+ * function runs before the first paint of the funding list, and a candidate wrongly dropped here is
225
+ * a payment route the payer is never shown.
226
+ */
227
+ declare function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId, catalogue }: BuildPayOptionsArgs): PayOption[];
167
228
 
168
229
  interface SolveArgs {
169
230
  option: PayOption;
@@ -346,7 +407,7 @@ declare const stableGenieIntentSchema: {
346
407
  };
347
408
  readonly chainId: {
348
409
  readonly type: "integer";
349
- readonly enum: readonly number[];
410
+ readonly minimum: 1;
350
411
  };
351
412
  readonly chainName: {
352
413
  readonly type: "string";
@@ -390,7 +451,25 @@ interface Engine {
390
451
  fetchChains: ApiClient["fetchChains"];
391
452
  fetchTokens: ApiClient["fetchTokens"];
392
453
  fetchRoutes: ApiClient["fetchRoutes"];
454
+ fetchRouteHealth: ApiClient["fetchRouteHealth"];
393
455
  fetchQuote: ApiClient["fetchQuote"];
456
+ /**
457
+ * The selectable catalogue, derived from the LIVE registry — `/chains`, `/tokens`, `/routes` and
458
+ * the gateway's measured `/route-health`, resolved with the same rules the ZeroDelta dapp uses.
459
+ *
460
+ * This is what a picker should render. The bundled `SUPPORTED_ASSETS` / `SUPPORTED_CHAIN_IDS`
461
+ * constants only BOUND it; they are not the list, and rendering them directly is what left the
462
+ * widget offering three stables where the dapp offers seven.
463
+ *
464
+ * `product` picks the universe — `"stable"` for the stable ⇄ stable exchange, `"rwa"` for the
465
+ * stable ⇄ real-world-asset one. They are NOT the same catalogue: the RWA product carries a wider
466
+ * stable list, admits assets that publish no route rows, and reaches its destinations through
467
+ * chained two-leg orders. `allowedAssets` narrows further (a host restricting what it accepts).
468
+ *
469
+ * Never rejects: a failed read yields a catalogue with `ready: false`, which callers must treat as
470
+ * "not known yet" rather than "nothing is supported".
471
+ */
472
+ fetchCatalogue: (allowedAssets?: readonly string[], product?: ExchangeProduct) => Promise<Catalogue>;
394
473
  fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
395
474
  quoteSwapPreview: (swap: SwapInput, owner?: string) => Promise<SwapPreview>;
396
475
  buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
@@ -405,4 +484,4 @@ interface Engine {
405
484
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
406
485
  declare function createEngine(config?: EngineConfig): Engine;
407
486
 
408
- 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, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, type Engine, EngineConfig, 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, SAME_CLASS_STABLE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, 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, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
487
+ 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, 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, SAME_CLASS_STABLE, 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, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
@@ -1 +1 @@
1
- export { API_CACHE_TTL_MS, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, DEFAULT_WIDGET_API_BASE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, 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, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, ZERO_ADDRESS, addressWord, allowanceCovers, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, txMatchesPlan, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap } from '../chunk-OOURZ5DL.js';
1
+ export { API_CACHE_TTL_MS, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, DEFAULT_WIDGET_API_BASE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, 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, 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, ZERO_ADDRESS, addressWord, allowanceCovers, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetClassOf, assetDecimals, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, counterpartTokens, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, destinationAvailability, destinationKeys, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneKey, laneKeys, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, toHexQuantity, tokenEnabled, tokenKey, txMatchesPlan, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap } from '../chunk-TYQF2L5C.js';