@glacislabs/stablegenie-zerodelta 3.0.1 → 3.0.2

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.
@@ -858,6 +858,16 @@ function createApiClient(cfg) {
858
858
  }
859
859
 
860
860
  // src/core/plan.ts
861
+ function optionBalanceKey(option) {
862
+ return `${Number(option.chainId)}:${String(option.address || "").toLowerCase()}`;
863
+ }
864
+ function hasPositiveBalance(option, balances) {
865
+ try {
866
+ return BigInt(balances[optionBalanceKey(option)]?.raw ?? "0") > 0n;
867
+ } catch {
868
+ return false;
869
+ }
870
+ }
861
871
  function validateDestination(destination) {
862
872
  assertAddress(destination.address, "Destination address");
863
873
  const chainId = Number(destination.chainId);
@@ -873,7 +883,7 @@ function planErrorSummary(errors) {
873
883
  const unique = [...new Set(errors.map((error) => error?.message || String(error)).filter(Boolean))].slice(0, 3);
874
884
  return unique.length ? unique.join(" | ") : "No ZeroDelta route is currently available for this payment.";
875
885
  }
876
- async function fetchPaymentPlan(api, request, payer, wallet = {}) {
886
+ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances) {
877
887
  validateDestination(request);
878
888
  assertAddress(payer, "Payer wallet");
879
889
  const [chains, tokens, routes] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes()]);
@@ -884,6 +894,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}) {
884
894
  };
885
895
  const destinationToken = findToken(tokens, destination.chainId, destination.asset);
886
896
  if (!destinationToken) throw new Error(`${destination.asset} is not enabled on ${chainNameOf(destination.chainId, chains)}.`);
897
+ const allowedFunding = wallet.fundingAssets?.length ? new Set(wallet.fundingAssets.map(symbolKey)) : null;
887
898
  const options = buildPayOptions({
888
899
  invoiceAsset: destination.asset,
889
900
  invoiceChainId: destination.chainId,
@@ -891,14 +902,25 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}) {
891
902
  routes,
892
903
  chains,
893
904
  walletChainId: wallet?.chainId
894
- });
905
+ }).filter((option) => option.direct || !allowedFunding || allowedFunding.has(option.symbolKey));
895
906
  if (!options.length) throw new Error(`No enabled ZeroDelta funding assets can settle ${destination.asset} on ${chainNameOf(destination.chainId, chains)}.`);
907
+ const balanceTargets = [];
908
+ const seenTargets = /* @__PURE__ */ new Set();
909
+ for (const option of options) {
910
+ const key = optionBalanceKey(option);
911
+ if (seenTargets.has(key)) continue;
912
+ seenTargets.add(key);
913
+ balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
914
+ }
915
+ const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
896
916
  const candidates = options.filter((option) => option.direct);
917
+ const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
918
+ const heldKeys = new Set(heldOptions.map(optionBalanceKey));
897
919
  const seenChains = /* @__PURE__ */ new Set();
898
920
  const perChainBest = [];
899
921
  const leftovers = [];
900
922
  for (const option of options) {
901
- if (option.direct) continue;
923
+ if (option.direct || heldKeys.has(optionBalanceKey(option))) continue;
902
924
  if (seenChains.has(option.chainId)) {
903
925
  leftovers.push(option);
904
926
  } else {
@@ -906,7 +928,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}) {
906
928
  perChainBest.push(option);
907
929
  }
908
930
  }
909
- for (const option of [...perChainBest, ...leftovers].slice(0, MAX_QUOTE_CANDIDATES)) {
931
+ for (const option of [...heldOptions, ...perChainBest, ...leftovers].slice(0, MAX_QUOTE_CANDIDATES)) {
910
932
  candidates.push(option);
911
933
  }
912
934
  const routeErrors = [];
@@ -941,6 +963,8 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}) {
941
963
  expiresAt: new Date(Date.now() + 2 * 60 * 1e3).toISOString(),
942
964
  apiBase: api.apiBase,
943
965
  routes: routesBuilt,
966
+ fundingBalances: walletBalances,
967
+ fundingAccount: payer.toLowerCase(),
944
968
  destination: {
945
969
  asset: destinationToken.symbol,
946
970
  chainId: destination.chainId,
@@ -1221,6 +1245,23 @@ function createVerifier(api, fetchImpl, rpcOverrides = {}) {
1221
1245
  const json = await response.json();
1222
1246
  return json?.result ?? null;
1223
1247
  }
1248
+ async function rpcBatchCall(rpcUrl, calls) {
1249
+ const response = await fetchImpl(rpcUrl, {
1250
+ method: "POST",
1251
+ headers: { "Content-Type": "application/json" },
1252
+ body: JSON.stringify(calls.map((call, index) => ({ jsonrpc: "2.0", id: index + 1, ...call }))),
1253
+ signal: AbortSignal.timeout(TX_VERIFY_FETCH_MS)
1254
+ });
1255
+ if (!response.ok) throw new Error(`RPC ${response.status}`);
1256
+ const json = await response.json();
1257
+ if (!Array.isArray(json)) throw new Error("RPC batch unsupported");
1258
+ const results = /* @__PURE__ */ new Map();
1259
+ for (const item of json) {
1260
+ const id = Number(item?.id);
1261
+ if (Number.isInteger(id) && Object.hasOwn(item || {}, "result")) results.set(id, item.result);
1262
+ }
1263
+ return results;
1264
+ }
1224
1265
  async function payerNonceBaseline(chainId, account) {
1225
1266
  if (!isAddress(account)) return null;
1226
1267
  const rpcUrl = await chainRpcUrl(chainId);
@@ -1287,25 +1328,54 @@ function createVerifier(api, fetchImpl, rpcOverrides = {}) {
1287
1328
  const out = {};
1288
1329
  if (!isAddress(account) || !Array.isArray(targets) || !targets.length) return out;
1289
1330
  const owner = normalizeAddress(account);
1290
- const CONCURRENCY = 6;
1291
- let cursor = 0;
1292
- async function worker() {
1293
- while (cursor < targets.length) {
1294
- const target = targets[cursor++];
1295
- if (!target || !isAddress(target.tokenAddress)) continue;
1296
- const key = `${Number(target.chainId)}:${String(target.tokenAddress).toLowerCase()}`;
1297
- try {
1298
- const rpcUrl = await balanceRpcUrl(Number(target.chainId));
1299
- if (!rpcUrl) continue;
1300
- const hex = await rpcCall(rpcUrl, "eth_call", [{ to: normalizeAddress(target.tokenAddress), data: encodeBalanceOf(owner) }, "latest"]);
1301
- if (typeof hex !== "string" || !/^0x[0-9a-fA-F]*$/.test(hex)) continue;
1302
- const raw = BigInt(hex || "0x0").toString();
1303
- out[key] = { raw, formatted: formatUnits(raw, Number(target.decimals)) };
1304
- } catch {
1305
- }
1331
+ const groups = /* @__PURE__ */ new Map();
1332
+ const seen = /* @__PURE__ */ new Set();
1333
+ for (const target of targets) {
1334
+ if (!target || !isAddress(target.tokenAddress)) continue;
1335
+ const key = `${Number(target.chainId)}:${String(target.tokenAddress).toLowerCase()}`;
1336
+ if (seen.has(key)) continue;
1337
+ seen.add(key);
1338
+ const chainId = Number(target.chainId);
1339
+ const group = groups.get(chainId) || [];
1340
+ group.push(target);
1341
+ groups.set(chainId, group);
1342
+ }
1343
+ function record(target, hex) {
1344
+ if (typeof hex !== "string" || !/^0x[0-9a-fA-F]*$/.test(hex)) return false;
1345
+ const raw = BigInt(hex || "0x0").toString();
1346
+ const key = `${Number(target.chainId)}:${String(target.tokenAddress).toLowerCase()}`;
1347
+ out[key] = { raw, formatted: formatUnits(raw, Number(target.decimals)) };
1348
+ return true;
1349
+ }
1350
+ async function readOne(rpcUrl, target) {
1351
+ try {
1352
+ const hex = await rpcCall(rpcUrl, "eth_call", [{ to: normalizeAddress(target.tokenAddress), data: encodeBalanceOf(owner) }, "latest"]);
1353
+ record(target, hex);
1354
+ } catch {
1355
+ }
1356
+ }
1357
+ async function readGroup(chainId, group) {
1358
+ const rpcUrl = await balanceRpcUrl(chainId).catch(() => "");
1359
+ if (!rpcUrl) return;
1360
+ if (group.length === 1) return readOne(rpcUrl, group[0]);
1361
+ try {
1362
+ const results = await rpcBatchCall(
1363
+ rpcUrl,
1364
+ group.map((target) => ({
1365
+ method: "eth_call",
1366
+ params: [{ to: normalizeAddress(target.tokenAddress), data: encodeBalanceOf(owner) }, "latest"]
1367
+ }))
1368
+ );
1369
+ const missing = [];
1370
+ group.forEach((target, index) => {
1371
+ if (!record(target, results.get(index + 1))) missing.push(target);
1372
+ });
1373
+ await Promise.all(missing.map((target) => readOne(rpcUrl, target)));
1374
+ } catch {
1375
+ await Promise.all(group.map((target) => readOne(rpcUrl, target)));
1306
1376
  }
1307
1377
  }
1308
- await Promise.all(Array.from({ length: Math.min(CONCURRENCY, targets.length) }, () => worker()));
1378
+ await Promise.all([...groups.entries()].map(([chainId, group]) => readGroup(chainId, group)));
1309
1379
  return out;
1310
1380
  }
1311
1381
  async function readNativeBalance(chainId, account) {
@@ -1407,7 +1477,7 @@ function createEngine(config = {}) {
1407
1477
  fetchTokens: api.fetchTokens,
1408
1478
  fetchRoutes: api.fetchRoutes,
1409
1479
  fetchQuote: api.fetchQuote,
1410
- fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet),
1480
+ fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
1411
1481
  quoteSwapPreview: (swap, owner) => quoteSwapPreview(api, swap, owner),
1412
1482
  buildSwapPlan: (swap, payer, wallet) => buildSwapPlan(api, swap, payer, wallet),
1413
1483
  payerNonceBaseline: verifier.payerNonceBaseline,
@@ -1,5 +1,5 @@
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, A as ApiClient, P as Plan, e as SwapInput, f as PlannedTx, g as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-CaO0OD4Z.cjs';
2
- export { h as Address, i as ApiError, B as BalanceEntry, j as BalanceTarget, 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-CaO0OD4Z.cjs';
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-DFTuQ2g3.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-DFTuQ2g3.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. */
@@ -180,11 +180,15 @@ interface PayRequest {
180
180
  asset: string;
181
181
  amount: string;
182
182
  }
183
+ interface PaymentWalletContext {
184
+ chainId?: number;
185
+ /** Host-approved assets that may fund this payment. Direct settlement remains available. */
186
+ fundingAssets?: string[];
187
+ }
188
+ type BalanceReader = (account: string, targets: BalanceTarget[]) => Promise<Record<string, BalanceEntry>>;
183
189
  declare function validateDestination(destination: PayRequest): void;
184
190
  declare function planErrorSummary(errors: unknown[]): string;
185
- declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: {
186
- chainId?: number;
187
- }): Promise<Plan>;
191
+ declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: PaymentWalletContext, readBalances?: BalanceReader): Promise<Plan>;
188
192
 
189
193
  interface ValidatedSwap {
190
194
  fromChainId: number;
@@ -334,9 +338,7 @@ interface Engine {
334
338
  fetchTokens: ApiClient["fetchTokens"];
335
339
  fetchRoutes: ApiClient["fetchRoutes"];
336
340
  fetchQuote: ApiClient["fetchQuote"];
337
- fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: {
338
- chainId?: number;
339
- }) => Promise<Plan>;
341
+ fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
340
342
  quoteSwapPreview: (swap: SwapInput, owner?: string) => Promise<SwapPreview>;
341
343
  buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
342
344
  chainId?: number;
@@ -350,4 +352,4 @@ interface Engine {
350
352
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
351
353
  declare function createEngine(config?: EngineConfig): Engine;
352
354
 
353
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, Chain, DEFAULT_WIDGET_API_BASE, 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, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, 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, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
355
+ 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, 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, 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, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
@@ -1,5 +1,5 @@
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, A as ApiClient, P as Plan, e as SwapInput, f as PlannedTx, g as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-CaO0OD4Z.js';
2
- export { h as Address, i as ApiError, B as BalanceEntry, j as BalanceTarget, 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-CaO0OD4Z.js';
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-DFTuQ2g3.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-DFTuQ2g3.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. */
@@ -180,11 +180,15 @@ interface PayRequest {
180
180
  asset: string;
181
181
  amount: string;
182
182
  }
183
+ interface PaymentWalletContext {
184
+ chainId?: number;
185
+ /** Host-approved assets that may fund this payment. Direct settlement remains available. */
186
+ fundingAssets?: string[];
187
+ }
188
+ type BalanceReader = (account: string, targets: BalanceTarget[]) => Promise<Record<string, BalanceEntry>>;
183
189
  declare function validateDestination(destination: PayRequest): void;
184
190
  declare function planErrorSummary(errors: unknown[]): string;
185
- declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: {
186
- chainId?: number;
187
- }): Promise<Plan>;
191
+ declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: PaymentWalletContext, readBalances?: BalanceReader): Promise<Plan>;
188
192
 
189
193
  interface ValidatedSwap {
190
194
  fromChainId: number;
@@ -334,9 +338,7 @@ interface Engine {
334
338
  fetchTokens: ApiClient["fetchTokens"];
335
339
  fetchRoutes: ApiClient["fetchRoutes"];
336
340
  fetchQuote: ApiClient["fetchQuote"];
337
- fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: {
338
- chainId?: number;
339
- }) => Promise<Plan>;
341
+ fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
340
342
  quoteSwapPreview: (swap: SwapInput, owner?: string) => Promise<SwapPreview>;
341
343
  buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
342
344
  chainId?: number;
@@ -350,4 +352,4 @@ interface Engine {
350
352
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
351
353
  declare function createEngine(config?: EngineConfig): Engine;
352
354
 
353
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, Chain, DEFAULT_WIDGET_API_BASE, 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, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, 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, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
355
+ 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, 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, 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, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, 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, 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, bytesPayload, canAttachApiKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, createApiClient, createEngine, createVerifier, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, txMatchesPlan, uintWord, validateDestination, validatePlannedTransaction, validateSwap } from '../chunk-VL5MWEY2.js';
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, 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, bytesPayload, canAttachApiKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, createApiClient, createEngine, createVerifier, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, txMatchesPlan, uintWord, validateDestination, validatePlannedTransaction, validateSwap } from '../chunk-AZPTL3KD.js';