@glacislabs/stablegenie-zerodelta 4.3.0 → 4.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.
- package/dist/{chunk-PMVF6A2D.js → chunk-53K3BXT5.js} +18 -8
- package/dist/{chunk-RFBNRCFB.js → chunk-NYIORRFU.js} +1 -1
- package/dist/core/index.cjs +19 -7
- package/dist/core/index.d.cts +31 -7
- package/dist/core/index.d.ts +31 -7
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +17 -7
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-BX_B0fzO.d.ts → mount-Blg-caPn.d.ts} +1 -1
- package/dist/{mount-Dw3LvQZi.d.cts → mount-D8hY-a-s.d.cts} +1 -1
- package/dist/mount.cjs +17 -7
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +6 -6
- package/dist/{verify-CPaT8Upe.d.cts → verify-C1VaWfiy.d.cts} +9 -0
- package/dist/{verify-CPaT8Upe.d.ts → verify-C1VaWfiy.d.ts} +9 -0
- package/package.json +1 -1
|
@@ -1351,9 +1351,18 @@ async function solveExactIn({ option, destination, destinationToken, payer, fetc
|
|
|
1351
1351
|
// src/core/order.ts
|
|
1352
1352
|
var DEFAULT_DEADLINE_SECONDS = 1800;
|
|
1353
1353
|
var MAX_DEADLINE_SECONDS = 60 * 60;
|
|
1354
|
-
|
|
1354
|
+
var ABSOLUTE_MAX_DEADLINE_SECONDS = 24 * 60 * 60;
|
|
1355
|
+
function recommendedDeadlineSeconds(quote) {
|
|
1356
|
+
const recommended = Number(quote?.recommendedDeadlineSeconds);
|
|
1357
|
+
if (!Number.isFinite(recommended) || recommended <= 0) return DEFAULT_DEADLINE_SECONDS;
|
|
1358
|
+
return Math.min(Math.floor(recommended), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1359
|
+
}
|
|
1360
|
+
function maxDeadlineSeconds(quote) {
|
|
1361
|
+
return Math.min(Math.max(MAX_DEADLINE_SECONDS, recommendedDeadlineSeconds(quote)), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1362
|
+
}
|
|
1363
|
+
function normalizeOrderRequest(order, payer, destination, fallbackExecutionChainId, deadlineOverride, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1355
1364
|
const apiDeadline = Number(order.deadline);
|
|
1356
|
-
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) +
|
|
1365
|
+
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) + lifetimeSeconds));
|
|
1357
1366
|
const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
|
|
1358
1367
|
if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
|
|
1359
1368
|
return {
|
|
@@ -1368,10 +1377,10 @@ function normalizeOrderRequest(order, payer, destination, fallbackExecutionChain
|
|
|
1368
1377
|
deadline
|
|
1369
1378
|
};
|
|
1370
1379
|
}
|
|
1371
|
-
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId) {
|
|
1380
|
+
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1372
1381
|
if (!requests.length) throw new Error("ZeroDelta quote did not include any order requests.");
|
|
1373
1382
|
return requests.map(
|
|
1374
|
-
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1383
|
+
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, void 0, lifetimeSeconds) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1375
1384
|
);
|
|
1376
1385
|
}
|
|
1377
1386
|
function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }) {
|
|
@@ -1421,7 +1430,8 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1421
1430
|
if (BigInt(finalOrder.askTokenAmount || "0") < BigInt(result.recipientReceivesRaw || "0")) {
|
|
1422
1431
|
throw new Error("ZeroDelta order guarantees less than the displayed receive amount.");
|
|
1423
1432
|
}
|
|
1424
|
-
|
|
1433
|
+
const maxDeadline = maxDeadlineSeconds(quote);
|
|
1434
|
+
if (!Number.isFinite(deadline) || deadline <= now || deadline > now + maxDeadline) {
|
|
1425
1435
|
throw new Error("ZeroDelta quote deadline is invalid or too far in the future.");
|
|
1426
1436
|
}
|
|
1427
1437
|
for (let index = 1; index < list.length; index += 1) {
|
|
@@ -1434,7 +1444,7 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1434
1444
|
throw new Error("ZeroDelta chained quote returned disconnected execution chains.");
|
|
1435
1445
|
}
|
|
1436
1446
|
const followupDeadline = Number(current.deadline || 0);
|
|
1437
|
-
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now +
|
|
1447
|
+
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now + maxDeadline)) {
|
|
1438
1448
|
throw new Error("ZeroDelta chained quote returned an invalid follow-up deadline.");
|
|
1439
1449
|
}
|
|
1440
1450
|
}
|
|
@@ -1597,7 +1607,7 @@ async function buildRoute({
|
|
|
1597
1607
|
if (!requestList.length) throw new Error("ZeroDelta quote did not include an order request.");
|
|
1598
1608
|
const sourceChain = chainById(chains, option.chainId);
|
|
1599
1609
|
const escrow = checkEscrow(option.chainId, quote.escrowAddress, sourceChain?.escrowContract);
|
|
1600
|
-
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId);
|
|
1610
|
+
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId, recommendedDeadlineSeconds(quote));
|
|
1601
1611
|
const order = orders[0];
|
|
1602
1612
|
assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result });
|
|
1603
1613
|
const needsNativeFee = requiresNativeBridgeFee(quote, option);
|
|
@@ -2667,4 +2677,4 @@ function createEngine(config = {}) {
|
|
|
2667
2677
|
};
|
|
2668
2678
|
}
|
|
2669
2679
|
|
|
2670
|
-
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, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, 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 };
|
|
2680
|
+
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceChecks, DIRECT_CHECK_IDS, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, amountFieldError, SUPPORTED_CHAIN_IDS, formatUnits, unattributedComplianceReasons, distinctScreenedWallets, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, foldTicker, BUNDLED_RPC } from './chunk-
|
|
1
|
+
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceChecks, DIRECT_CHECK_IDS, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, amountFieldError, SUPPORTED_CHAIN_IDS, formatUnits, unattributedComplianceReasons, distinctScreenedWallets, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, foldTicker, BUNDLED_RPC } from './chunk-53K3BXT5.js';
|
|
2
2
|
import { createContext, useState, useRef, useEffect, useMemo, useCallback, useId, createElement, useContext } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
package/dist/core/index.cjs
CHANGED
|
@@ -1353,9 +1353,18 @@ async function solveExactIn({ option, destination, destinationToken, payer, fetc
|
|
|
1353
1353
|
// src/core/order.ts
|
|
1354
1354
|
var DEFAULT_DEADLINE_SECONDS = 1800;
|
|
1355
1355
|
var MAX_DEADLINE_SECONDS = 60 * 60;
|
|
1356
|
-
|
|
1356
|
+
var ABSOLUTE_MAX_DEADLINE_SECONDS = 24 * 60 * 60;
|
|
1357
|
+
function recommendedDeadlineSeconds(quote) {
|
|
1358
|
+
const recommended = Number(quote?.recommendedDeadlineSeconds);
|
|
1359
|
+
if (!Number.isFinite(recommended) || recommended <= 0) return DEFAULT_DEADLINE_SECONDS;
|
|
1360
|
+
return Math.min(Math.floor(recommended), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1361
|
+
}
|
|
1362
|
+
function maxDeadlineSeconds(quote) {
|
|
1363
|
+
return Math.min(Math.max(MAX_DEADLINE_SECONDS, recommendedDeadlineSeconds(quote)), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1364
|
+
}
|
|
1365
|
+
function normalizeOrderRequest(order, payer, destination, fallbackExecutionChainId, deadlineOverride, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1357
1366
|
const apiDeadline = Number(order.deadline);
|
|
1358
|
-
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) +
|
|
1367
|
+
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) + lifetimeSeconds));
|
|
1359
1368
|
const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
|
|
1360
1369
|
if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
|
|
1361
1370
|
return {
|
|
@@ -1370,10 +1379,10 @@ function normalizeOrderRequest(order, payer, destination, fallbackExecutionChain
|
|
|
1370
1379
|
deadline
|
|
1371
1380
|
};
|
|
1372
1381
|
}
|
|
1373
|
-
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId) {
|
|
1382
|
+
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1374
1383
|
if (!requests.length) throw new Error("ZeroDelta quote did not include any order requests.");
|
|
1375
1384
|
return requests.map(
|
|
1376
|
-
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1385
|
+
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, void 0, lifetimeSeconds) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1377
1386
|
);
|
|
1378
1387
|
}
|
|
1379
1388
|
function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }) {
|
|
@@ -1423,7 +1432,8 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1423
1432
|
if (BigInt(finalOrder.askTokenAmount || "0") < BigInt(result.recipientReceivesRaw || "0")) {
|
|
1424
1433
|
throw new Error("ZeroDelta order guarantees less than the displayed receive amount.");
|
|
1425
1434
|
}
|
|
1426
|
-
|
|
1435
|
+
const maxDeadline = maxDeadlineSeconds(quote);
|
|
1436
|
+
if (!Number.isFinite(deadline) || deadline <= now || deadline > now + maxDeadline) {
|
|
1427
1437
|
throw new Error("ZeroDelta quote deadline is invalid or too far in the future.");
|
|
1428
1438
|
}
|
|
1429
1439
|
for (let index = 1; index < list.length; index += 1) {
|
|
@@ -1436,7 +1446,7 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1436
1446
|
throw new Error("ZeroDelta chained quote returned disconnected execution chains.");
|
|
1437
1447
|
}
|
|
1438
1448
|
const followupDeadline = Number(current.deadline || 0);
|
|
1439
|
-
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now +
|
|
1449
|
+
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now + maxDeadline)) {
|
|
1440
1450
|
throw new Error("ZeroDelta chained quote returned an invalid follow-up deadline.");
|
|
1441
1451
|
}
|
|
1442
1452
|
}
|
|
@@ -1599,7 +1609,7 @@ async function buildRoute({
|
|
|
1599
1609
|
if (!requestList.length) throw new Error("ZeroDelta quote did not include an order request.");
|
|
1600
1610
|
const sourceChain = chainById(chains, option.chainId);
|
|
1601
1611
|
const escrow = checkEscrow(option.chainId, quote.escrowAddress, sourceChain?.escrowContract);
|
|
1602
|
-
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId);
|
|
1612
|
+
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId, recommendedDeadlineSeconds(quote));
|
|
1603
1613
|
const order = orders[0];
|
|
1604
1614
|
assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result });
|
|
1605
1615
|
const needsNativeFee = requiresNativeBridgeFee(quote, option);
|
|
@@ -2788,6 +2798,7 @@ exports.laneLimitFor = laneLimitFor;
|
|
|
2788
2798
|
exports.laneLimitHint = laneLimitHint;
|
|
2789
2799
|
exports.laneLimitSymbol = laneLimitSymbol;
|
|
2790
2800
|
exports.limitedLanes = limitedLanes;
|
|
2801
|
+
exports.maxDeadlineSeconds = maxDeadlineSeconds;
|
|
2791
2802
|
exports.maxNativeFeeWei = maxNativeFeeWei;
|
|
2792
2803
|
exports.nativeFeeShortLabel = nativeFeeShortLabel;
|
|
2793
2804
|
exports.nativeFeeShortMessage = nativeFeeShortMessage;
|
|
@@ -2802,6 +2813,7 @@ exports.planErrorSummary = planErrorSummary;
|
|
|
2802
2813
|
exports.planMsgValueHex = planMsgValueHex;
|
|
2803
2814
|
exports.productAssets = productAssets;
|
|
2804
2815
|
exports.quoteSwapPreview = quoteSwapPreview;
|
|
2816
|
+
exports.recommendedDeadlineSeconds = recommendedDeadlineSeconds;
|
|
2805
2817
|
exports.registryRpc = registryRpc;
|
|
2806
2818
|
exports.requiresNativeBridgeFee = requiresNativeBridgeFee;
|
|
2807
2819
|
exports.resolveApiBase = resolveApiBase;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -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-
|
|
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-
|
|
1
|
+
import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-C1VaWfiy.cjs';
|
|
2
|
+
export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-C1VaWfiy.cjs';
|
|
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. */
|
|
@@ -268,20 +268,44 @@ interface SolveArgs {
|
|
|
268
268
|
declare function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }: SolveArgs): Promise<SolveResult>;
|
|
269
269
|
declare function solveExactIn({ option, destination, destinationToken, payer, fetchQuote, amountInRaw }: SolveArgs): Promise<SolveResult>;
|
|
270
270
|
|
|
271
|
+
/**
|
|
272
|
+
* How long the order should live, per the gateway, for the lane it just priced.
|
|
273
|
+
*
|
|
274
|
+
* Derived server-side from THAT lane's `estimatedDuration`, so a slow pathway asks for more than a
|
|
275
|
+
* fast one. It exists because the escrow refuses to fill past the deadline
|
|
276
|
+
* (`fillOrderWithFlashloan` reverts `ZDLite__OrderExpired`) and this widget used to pick one blind:
|
|
277
|
+
* a flat 30 minutes for a lane the gateway knew took forty.
|
|
278
|
+
*
|
|
279
|
+
* Absent (an older gateway), unparseable or non-positive falls back to that flat 30 minutes, so
|
|
280
|
+
* nothing changes where there is nothing to read.
|
|
281
|
+
*
|
|
282
|
+
* ⚠️ Read from the QUOTE, never from `orderRequests[].deadline` — the gateway returns that as "0"
|
|
283
|
+
* on purpose (see normalizeOrderRequest).
|
|
284
|
+
*/
|
|
285
|
+
declare function recommendedDeadlineSeconds(quote: Pick<Quote, "recommendedDeadlineSeconds"> | undefined): number;
|
|
286
|
+
/**
|
|
287
|
+
* The widest deadline `assertQuoteMatchesSelection` accepts for this quote.
|
|
288
|
+
*
|
|
289
|
+
* Never below the historical hour, so a gateway that recommends nothing behaves exactly as before;
|
|
290
|
+
* never above the absolute cap. ⚠️ The ceiling has to admit the gateway's own recommendation,
|
|
291
|
+
* because that is the number this module is about to sign — a ceiling below it would reject the
|
|
292
|
+
* deadline we just built, turning a merely slow lane into an unsignable one.
|
|
293
|
+
*/
|
|
294
|
+
declare function maxDeadlineSeconds(quote: Pick<Quote, "recommendedDeadlineSeconds"> | undefined): number;
|
|
271
295
|
declare function normalizeOrderRequest(order: OrderRequest, payer: string, destination: {
|
|
272
296
|
address: string;
|
|
273
297
|
chainId: number | string;
|
|
274
|
-
}, fallbackExecutionChainId?: number | string, deadlineOverride?: string): NormalizedOrder;
|
|
298
|
+
}, fallbackExecutionChainId?: number | string, deadlineOverride?: string, lifetimeSeconds?: number): NormalizedOrder;
|
|
275
299
|
/**
|
|
276
300
|
* Normalize the whole `orderRequests` list of a quote. A chained (RWA) quote is one signature and
|
|
277
301
|
* several legs: leg 1 is the user's order and gets the client-side fills (owner, receiver, a fresh
|
|
278
|
-
* deadline); follow-up legs keep whatever deadline the gateway issued —
|
|
279
|
-
* deadline" marker and must be forwarded verbatim, not replaced.
|
|
302
|
+
* deadline sized by `lifetimeSeconds`); follow-up legs keep whatever deadline the gateway issued —
|
|
303
|
+
* `0` is its "no separate deadline" marker and must be forwarded verbatim, not replaced.
|
|
280
304
|
*/
|
|
281
305
|
declare function normalizeOrderRequests(requests: OrderRequest[], payer: string, destination: {
|
|
282
306
|
address: string;
|
|
283
307
|
chainId: number | string;
|
|
284
|
-
}, fallbackExecutionChainId?: number | string): NormalizedOrder[];
|
|
308
|
+
}, fallbackExecutionChainId?: number | string, lifetimeSeconds?: number): NormalizedOrder[];
|
|
285
309
|
interface AssertQuoteArgs {
|
|
286
310
|
quote: Quote;
|
|
287
311
|
/** The first (user-signed) leg. Kept as a separate argument so single-leg callers stay simple. */
|
|
@@ -548,4 +572,4 @@ interface Engine {
|
|
|
548
572
|
/** Create an engine bound to a config. The 60s resource cache is per-engine. */
|
|
549
573
|
declare function createEngine(config?: EngineConfig): Engine;
|
|
550
574
|
|
|
551
|
-
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, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
|
|
575
|
+
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 };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
1
|
+
import { T as Token, Q as Quote, N as NormalizedOrder, r as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, s as RwaVault, F as FetchQuoteFn, t as SolveResult, O as OrderRequest, C as Compliance, u as BalanceTarget, v as BalanceEntry, w as ApiClient, P as Plan, x as SwapInput, y as PlannedTx, z as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-C1VaWfiy.js';
|
|
2
|
+
export { D as Address, G as ApiError, A as Availability, H as BLOCK_LABEL_DEFAULT, B as BrokenLane, I as COMPLIANCE_CHECK_ORDER, J as COMPLIANCE_DENY_LABEL, K as CatalogueContext, M as CatalogueInput, c as ComplianceCheck, U as ComplianceCheckId, X as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Y as DIRECT_CHECK_IDS, Z as DIRECT_SCOPE_NOTE, _ as Destination, $ as FLOOR_CATEGORIES, a0 as Hex, a1 as LaneAvailabilityState, L as LaneLimit, a2 as PlannedTxKind, a3 as QuoteBlock, a4 as ResolvedConfig, a5 as RouteHealth, a6 as RouteHealthAvailability, a7 as RouteHealthLane, g as RouteLeg, a8 as SCREENING_BUCKETS, a9 as ScreenProvider, aa as ScreeningBucket, ab as ScreeningOutcome, ac as TUNABLE_CATEGORIES, ad as TxPlan, V as VerifyResult, W as WalletScreen, ae as amountFieldError, af as apiError, j as assetClassOf, ag as blockLabelFor, ah as brokenLaneFor, k as brokenLaneReason, ai as buildCatalogue, aj as canAttachApiKey, ak as categoryLabel, al as classifyQuoteError, l as complianceChecks, am as complianceControlsEvaluated, m as complianceControlsLine, an as complianceReasonHead, ao as complianceReasonTag, ap as complianceTagOf, n as complianceView, o as counterpartTokens, aq as createApiClient, ar as createVerifier, p as destinationAvailability, as as destinationKeys, at as directComplianceFromScreens, au as distinctScreenedWallets, av as exceedsLaneLimit, aw as executableRoutes, ax as executionChainIds, ay as hasReachableDestination, az as hubDeliverableSymbols, q as humanizeComplianceReason, aA as isExecutableBridge, aB as isKnownUnbridgeable, aC as isSourceToken, aD as laneAvailabilityState, aE as laneKey, aF as laneKeys, aG as laneLimitAmount, aH as laneLimitError, aI as laneLimitFor, aJ as laneLimitHint, aK as laneLimitSymbol, aL as limitedLanes, aM as parseAllowedApiBase, aN as productAssets, aO as registryRpc, aP as resolveApiBase, aQ as resolveConfig, aR as screeningOutcomeOf, aS as sourceKeys, aT as suppressedLanes, aU as tokenKey, aV as txMatchesPlan, aW as unattributedComplianceReasons } from '../verify-C1VaWfiy.js';
|
|
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. */
|
|
@@ -268,20 +268,44 @@ interface SolveArgs {
|
|
|
268
268
|
declare function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }: SolveArgs): Promise<SolveResult>;
|
|
269
269
|
declare function solveExactIn({ option, destination, destinationToken, payer, fetchQuote, amountInRaw }: SolveArgs): Promise<SolveResult>;
|
|
270
270
|
|
|
271
|
+
/**
|
|
272
|
+
* How long the order should live, per the gateway, for the lane it just priced.
|
|
273
|
+
*
|
|
274
|
+
* Derived server-side from THAT lane's `estimatedDuration`, so a slow pathway asks for more than a
|
|
275
|
+
* fast one. It exists because the escrow refuses to fill past the deadline
|
|
276
|
+
* (`fillOrderWithFlashloan` reverts `ZDLite__OrderExpired`) and this widget used to pick one blind:
|
|
277
|
+
* a flat 30 minutes for a lane the gateway knew took forty.
|
|
278
|
+
*
|
|
279
|
+
* Absent (an older gateway), unparseable or non-positive falls back to that flat 30 minutes, so
|
|
280
|
+
* nothing changes where there is nothing to read.
|
|
281
|
+
*
|
|
282
|
+
* ⚠️ Read from the QUOTE, never from `orderRequests[].deadline` — the gateway returns that as "0"
|
|
283
|
+
* on purpose (see normalizeOrderRequest).
|
|
284
|
+
*/
|
|
285
|
+
declare function recommendedDeadlineSeconds(quote: Pick<Quote, "recommendedDeadlineSeconds"> | undefined): number;
|
|
286
|
+
/**
|
|
287
|
+
* The widest deadline `assertQuoteMatchesSelection` accepts for this quote.
|
|
288
|
+
*
|
|
289
|
+
* Never below the historical hour, so a gateway that recommends nothing behaves exactly as before;
|
|
290
|
+
* never above the absolute cap. ⚠️ The ceiling has to admit the gateway's own recommendation,
|
|
291
|
+
* because that is the number this module is about to sign — a ceiling below it would reject the
|
|
292
|
+
* deadline we just built, turning a merely slow lane into an unsignable one.
|
|
293
|
+
*/
|
|
294
|
+
declare function maxDeadlineSeconds(quote: Pick<Quote, "recommendedDeadlineSeconds"> | undefined): number;
|
|
271
295
|
declare function normalizeOrderRequest(order: OrderRequest, payer: string, destination: {
|
|
272
296
|
address: string;
|
|
273
297
|
chainId: number | string;
|
|
274
|
-
}, fallbackExecutionChainId?: number | string, deadlineOverride?: string): NormalizedOrder;
|
|
298
|
+
}, fallbackExecutionChainId?: number | string, deadlineOverride?: string, lifetimeSeconds?: number): NormalizedOrder;
|
|
275
299
|
/**
|
|
276
300
|
* Normalize the whole `orderRequests` list of a quote. A chained (RWA) quote is one signature and
|
|
277
301
|
* several legs: leg 1 is the user's order and gets the client-side fills (owner, receiver, a fresh
|
|
278
|
-
* deadline); follow-up legs keep whatever deadline the gateway issued —
|
|
279
|
-
* deadline" marker and must be forwarded verbatim, not replaced.
|
|
302
|
+
* deadline sized by `lifetimeSeconds`); follow-up legs keep whatever deadline the gateway issued —
|
|
303
|
+
* `0` is its "no separate deadline" marker and must be forwarded verbatim, not replaced.
|
|
280
304
|
*/
|
|
281
305
|
declare function normalizeOrderRequests(requests: OrderRequest[], payer: string, destination: {
|
|
282
306
|
address: string;
|
|
283
307
|
chainId: number | string;
|
|
284
|
-
}, fallbackExecutionChainId?: number | string): NormalizedOrder[];
|
|
308
|
+
}, fallbackExecutionChainId?: number | string, lifetimeSeconds?: number): NormalizedOrder[];
|
|
285
309
|
interface AssertQuoteArgs {
|
|
286
310
|
quote: Quote;
|
|
287
311
|
/** The first (user-signed) leg. Kept as a separate argument so single-leg callers stay simple. */
|
|
@@ -548,4 +572,4 @@ interface Engine {
|
|
|
548
572
|
/** Create an engine bound to a config. The 60s resource cache is per-engine. */
|
|
549
573
|
declare function createEngine(config?: EngineConfig): Engine;
|
|
550
574
|
|
|
551
|
-
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, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
|
|
575
|
+
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 };
|
package/dist/core/index.js
CHANGED
|
@@ -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, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, 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-
|
|
1
|
+
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, COMPLIANCE_CHECK_ORDER, COMPLIANCE_DENY_LABEL, DEFAULT_WIDGET_API_BASE, DIRECT_CHECK_IDS, DIRECT_SCOPE_NOTE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, FLOOR_CATEGORIES, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetClassOf, assetDecimals, blockLabelFor, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, categoryLabel, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, counterpartTokens, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, exceedsLaneLimit, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, screeningOutcomeOf, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork } from '../chunk-53K3BXT5.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1363,9 +1363,18 @@ async function solveExactIn({ option, destination, destinationToken, payer, fetc
|
|
|
1363
1363
|
// src/core/order.ts
|
|
1364
1364
|
var DEFAULT_DEADLINE_SECONDS = 1800;
|
|
1365
1365
|
var MAX_DEADLINE_SECONDS = 60 * 60;
|
|
1366
|
-
|
|
1366
|
+
var ABSOLUTE_MAX_DEADLINE_SECONDS = 24 * 60 * 60;
|
|
1367
|
+
function recommendedDeadlineSeconds(quote) {
|
|
1368
|
+
const recommended = Number(quote?.recommendedDeadlineSeconds);
|
|
1369
|
+
if (!Number.isFinite(recommended) || recommended <= 0) return DEFAULT_DEADLINE_SECONDS;
|
|
1370
|
+
return Math.min(Math.floor(recommended), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1371
|
+
}
|
|
1372
|
+
function maxDeadlineSeconds(quote) {
|
|
1373
|
+
return Math.min(Math.max(MAX_DEADLINE_SECONDS, recommendedDeadlineSeconds(quote)), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1374
|
+
}
|
|
1375
|
+
function normalizeOrderRequest(order, payer, destination, fallbackExecutionChainId, deadlineOverride, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1367
1376
|
const apiDeadline = Number(order.deadline);
|
|
1368
|
-
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) +
|
|
1377
|
+
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) + lifetimeSeconds));
|
|
1369
1378
|
const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
|
|
1370
1379
|
if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
|
|
1371
1380
|
return {
|
|
@@ -1380,10 +1389,10 @@ function normalizeOrderRequest(order, payer, destination, fallbackExecutionChain
|
|
|
1380
1389
|
deadline
|
|
1381
1390
|
};
|
|
1382
1391
|
}
|
|
1383
|
-
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId) {
|
|
1392
|
+
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1384
1393
|
if (!requests.length) throw new Error("ZeroDelta quote did not include any order requests.");
|
|
1385
1394
|
return requests.map(
|
|
1386
|
-
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1395
|
+
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, void 0, lifetimeSeconds) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1387
1396
|
);
|
|
1388
1397
|
}
|
|
1389
1398
|
function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }) {
|
|
@@ -1433,7 +1442,8 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1433
1442
|
if (BigInt(finalOrder.askTokenAmount || "0") < BigInt(result.recipientReceivesRaw || "0")) {
|
|
1434
1443
|
throw new Error("ZeroDelta order guarantees less than the displayed receive amount.");
|
|
1435
1444
|
}
|
|
1436
|
-
|
|
1445
|
+
const maxDeadline = maxDeadlineSeconds(quote);
|
|
1446
|
+
if (!Number.isFinite(deadline) || deadline <= now || deadline > now + maxDeadline) {
|
|
1437
1447
|
throw new Error("ZeroDelta quote deadline is invalid or too far in the future.");
|
|
1438
1448
|
}
|
|
1439
1449
|
for (let index = 1; index < list.length; index += 1) {
|
|
@@ -1446,7 +1456,7 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1446
1456
|
throw new Error("ZeroDelta chained quote returned disconnected execution chains.");
|
|
1447
1457
|
}
|
|
1448
1458
|
const followupDeadline = Number(current.deadline || 0);
|
|
1449
|
-
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now +
|
|
1459
|
+
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now + maxDeadline)) {
|
|
1450
1460
|
throw new Error("ZeroDelta chained quote returned an invalid follow-up deadline.");
|
|
1451
1461
|
}
|
|
1452
1462
|
}
|
|
@@ -1609,7 +1619,7 @@ async function buildRoute({
|
|
|
1609
1619
|
if (!requestList.length) throw new Error("ZeroDelta quote did not include an order request.");
|
|
1610
1620
|
const sourceChain = chainById(chains, option.chainId);
|
|
1611
1621
|
const escrow = checkEscrow(option.chainId, quote.escrowAddress, sourceChain?.escrowContract);
|
|
1612
|
-
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId);
|
|
1622
|
+
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId, recommendedDeadlineSeconds(quote));
|
|
1613
1623
|
const order = orders[0];
|
|
1614
1624
|
assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result });
|
|
1615
1625
|
const needsNativeFee = requiresNativeBridgeFee(quote, option);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-D8hY-a-s.cjs';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { C as Compliance } from './verify-
|
|
4
|
-
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-
|
|
3
|
+
import { C as Compliance } from './verify-C1VaWfiy.cjs';
|
|
4
|
+
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-C1VaWfiy.cjs';
|
|
5
5
|
export { EXECUTABLE_STABLE_ASSETS, Engine, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, createEngine, symbolKey } from './core/index.cjs';
|
|
6
6
|
|
|
7
7
|
declare function CompliancePanel(props: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieRwaExchange, k as StableGenieSwap, l as StableGenieSwapProps, m as StableGenieTheme, n as SuccessInfo, o as SupportedAsset, p as darkTheme, q as lightTheme, r as mount, s as resolveTheme } from './mount-Blg-caPn.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { C as Compliance } from './verify-
|
|
4
|
-
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-
|
|
3
|
+
import { C as Compliance } from './verify-C1VaWfiy.js';
|
|
4
|
+
export { A as Availability, B as BrokenLane, a as Catalogue, b as Chain, c as ComplianceCheck, d as ComplianceTone, e as ComplianceView, E as EngineConfig, f as ExchangeProduct, L as LaneLimit, P as Plan, R as Route, g as RouteLeg, h as RouteResult, S as SanitizedTxEntry, T as Token, i as TxHistoryEntry, V as VerifyResult, W as WalletScreen, j as assetClassOf, k as brokenLaneReason, l as complianceChecks, m as complianceControlsLine, n as complianceView, o as counterpartTokens, p as destinationAvailability, q as humanizeComplianceReason } from './verify-C1VaWfiy.js';
|
|
5
5
|
export { EXECUTABLE_STABLE_ASSETS, Engine, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, createEngine, symbolKey } from './core/index.js';
|
|
6
6
|
|
|
7
7
|
declare function CompliancePanel(props: {
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-
|
|
2
|
-
export { EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, assetClassOf, brokenLaneReason, complianceChecks, complianceControlsLine, complianceView, counterpartTokens, createEngine, destinationAvailability, humanizeComplianceReason, symbolKey } from './chunk-
|
|
1
|
+
export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-NYIORRFU.js';
|
|
2
|
+
export { EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, TRADEABLE_RWA_ASSETS, assetClassOf, brokenLaneReason, complianceChecks, complianceControlsLine, complianceView, counterpartTokens, createEngine, destinationAvailability, humanizeComplianceReason, symbolKey } from './chunk-53K3BXT5.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-C1VaWfiy.js';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, h as RouteResult, S as SanitizedTxEntry, f as ExchangeProduct } from './verify-C1VaWfiy.cjs';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|
package/dist/mount.cjs
CHANGED
|
@@ -1344,9 +1344,18 @@ async function solveExactIn({ option, destination, destinationToken, payer, fetc
|
|
|
1344
1344
|
// src/core/order.ts
|
|
1345
1345
|
var DEFAULT_DEADLINE_SECONDS = 1800;
|
|
1346
1346
|
var MAX_DEADLINE_SECONDS = 60 * 60;
|
|
1347
|
-
|
|
1347
|
+
var ABSOLUTE_MAX_DEADLINE_SECONDS = 24 * 60 * 60;
|
|
1348
|
+
function recommendedDeadlineSeconds(quote) {
|
|
1349
|
+
const recommended = Number(quote?.recommendedDeadlineSeconds);
|
|
1350
|
+
if (!Number.isFinite(recommended) || recommended <= 0) return DEFAULT_DEADLINE_SECONDS;
|
|
1351
|
+
return Math.min(Math.floor(recommended), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1352
|
+
}
|
|
1353
|
+
function maxDeadlineSeconds(quote) {
|
|
1354
|
+
return Math.min(Math.max(MAX_DEADLINE_SECONDS, recommendedDeadlineSeconds(quote)), ABSOLUTE_MAX_DEADLINE_SECONDS);
|
|
1355
|
+
}
|
|
1356
|
+
function normalizeOrderRequest(order, payer, destination, fallbackExecutionChainId, deadlineOverride, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1348
1357
|
const apiDeadline = Number(order.deadline);
|
|
1349
|
-
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) +
|
|
1358
|
+
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) + lifetimeSeconds));
|
|
1350
1359
|
const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
|
|
1351
1360
|
if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
|
|
1352
1361
|
return {
|
|
@@ -1361,10 +1370,10 @@ function normalizeOrderRequest(order, payer, destination, fallbackExecutionChain
|
|
|
1361
1370
|
deadline
|
|
1362
1371
|
};
|
|
1363
1372
|
}
|
|
1364
|
-
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId) {
|
|
1373
|
+
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId, lifetimeSeconds = DEFAULT_DEADLINE_SECONDS) {
|
|
1365
1374
|
if (!requests.length) throw new Error("ZeroDelta quote did not include any order requests.");
|
|
1366
1375
|
return requests.map(
|
|
1367
|
-
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1376
|
+
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, void 0, lifetimeSeconds) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
1368
1377
|
);
|
|
1369
1378
|
}
|
|
1370
1379
|
function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }) {
|
|
@@ -1414,7 +1423,8 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1414
1423
|
if (BigInt(finalOrder.askTokenAmount || "0") < BigInt(result.recipientReceivesRaw || "0")) {
|
|
1415
1424
|
throw new Error("ZeroDelta order guarantees less than the displayed receive amount.");
|
|
1416
1425
|
}
|
|
1417
|
-
|
|
1426
|
+
const maxDeadline = maxDeadlineSeconds(quote);
|
|
1427
|
+
if (!Number.isFinite(deadline) || deadline <= now || deadline > now + maxDeadline) {
|
|
1418
1428
|
throw new Error("ZeroDelta quote deadline is invalid or too far in the future.");
|
|
1419
1429
|
}
|
|
1420
1430
|
for (let index = 1; index < list.length; index += 1) {
|
|
@@ -1427,7 +1437,7 @@ function assertQuoteMatchesSelection({ quote, order, orders, option, destination
|
|
|
1427
1437
|
throw new Error("ZeroDelta chained quote returned disconnected execution chains.");
|
|
1428
1438
|
}
|
|
1429
1439
|
const followupDeadline = Number(current.deadline || 0);
|
|
1430
|
-
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now +
|
|
1440
|
+
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now + maxDeadline)) {
|
|
1431
1441
|
throw new Error("ZeroDelta chained quote returned an invalid follow-up deadline.");
|
|
1432
1442
|
}
|
|
1433
1443
|
}
|
|
@@ -1590,7 +1600,7 @@ async function buildRoute({
|
|
|
1590
1600
|
if (!requestList.length) throw new Error("ZeroDelta quote did not include an order request.");
|
|
1591
1601
|
const sourceChain = chainById(chains, option.chainId);
|
|
1592
1602
|
const escrow = checkEscrow(option.chainId, quote.escrowAddress, sourceChain?.escrowContract);
|
|
1593
|
-
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId);
|
|
1603
|
+
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId, recommendedDeadlineSeconds(quote));
|
|
1594
1604
|
const order = orders[0];
|
|
1595
1605
|
assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result });
|
|
1596
1606
|
const needsNativeFee = requiresNativeBridgeFee(quote, option);
|
package/dist/mount.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { M as MountConfig, r as mount } from './mount-
|
|
1
|
+
export { M as MountConfig, r as mount } from './mount-D8hY-a-s.cjs';
|
|
2
2
|
import 'react';
|
|
3
|
-
import './verify-
|
|
3
|
+
import './verify-C1VaWfiy.cjs';
|
package/dist/mount.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { M as MountConfig, r as mount } from './mount-
|
|
1
|
+
export { M as MountConfig, r as mount } from './mount-Blg-caPn.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import './verify-
|
|
3
|
+
import './verify-C1VaWfiy.js';
|
package/dist/mount.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { mount } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { mount } from './chunk-NYIORRFU.js';
|
|
2
|
+
import './chunk-53K3BXT5.js';
|