@glacislabs/stablegenie-zerodelta 4.20.1 → 4.21.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-4WBNXYOV.js → chunk-3E554IZO.js} +35 -4
- package/dist/{chunk-RUHREVDT.js → chunk-KOFREX5L.js} +56 -11
- package/dist/core/index.cjs +55 -10
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +89 -13
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-DuTF5CQV.d.ts → mount-867H-JSe.d.ts} +1 -1
- package/dist/{mount-D2tDkHea.d.cts → mount-C2GLFqgK.d.cts} +1 -1
- package/dist/mount.cjs +89 -13
- 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 +8 -8
- package/dist/{verify-UqDjAVxa.d.cts → verify-CeHRSKl2.d.cts} +10 -1
- package/dist/{verify-UqDjAVxa.d.ts → verify-CeHRSKl2.d.ts} +10 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, isSellableRwa, formatUnits, amountFieldError, solanaQuoteCompliance, directComplianceFromScreens, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, zdHeavyExpected, preflightZdHeavyPlan, allowanceCovers, validatePlannedTransaction, priceCompareOptions, parity, pickForWait, cornerTags, extraVsFastest, proposedWait, visibleOptions, promotionFor, estimateBonus, pairPromotionsInto, promotedAssets, TRACKING, mergeHistory, hasValidChecksum, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, clampWait, waitScaleFor, waitFraction, waitLabel, WAIT_POSITIONS, snapWait, WAIT_STEP_SEC, waitFromFraction, compareDuration, compareAmount, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-
|
|
1
|
+
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, isSellableRwa, formatUnits, amountFieldError, solanaQuoteCompliance, directComplianceFromScreens, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, ZdHeavyQuoteExpiredError, assertZdHeavyQuoteFresh, nativeFeeShortMessage, zdHeavyExpected, preflightZdHeavyPlan, allowanceCovers, validatePlannedTransaction, priceCompareOptions, parity, pickForWait, cornerTags, extraVsFastest, proposedWait, visibleOptions, promotionFor, estimateBonus, pairPromotionsInto, promotedAssets, TRACKING, mergeHistory, hasValidChecksum, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, clampWait, waitScaleFor, waitFraction, waitLabel, WAIT_POSITIONS, snapWait, WAIT_STEP_SEC, waitFromFraction, compareDuration, compareAmount, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-KOFREX5L.js';
|
|
2
2
|
import { createContext, useState, useRef, useMemo, useEffect, useCallback, useId, useLayoutEffect, createElement, useContext, useSyncExternalStore, useReducer } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -472,6 +472,8 @@ function useUserPresence() {
|
|
|
472
472
|
}
|
|
473
473
|
|
|
474
474
|
// src/react/hooks/useFlow.ts
|
|
475
|
+
var REFRESH_LEAD_SECONDS = 20;
|
|
476
|
+
var SIGN_MIN_SECONDS = 15;
|
|
475
477
|
function reportQuietly(engine, report, stage) {
|
|
476
478
|
try {
|
|
477
479
|
void engine.reportSubmission?.({ ...report, stage })?.catch?.(() => {
|
|
@@ -495,6 +497,7 @@ function useFlow(args) {
|
|
|
495
497
|
const [nonce, setNonce] = useState(0);
|
|
496
498
|
const reqId = useRef(0);
|
|
497
499
|
const busyRef = useRef(false);
|
|
500
|
+
const keepExpiryError = useRef(false);
|
|
498
501
|
const [planAt, setPlanAt] = useState(0);
|
|
499
502
|
const planAtRef = useRef(0);
|
|
500
503
|
const statusRef = useRef("idle");
|
|
@@ -524,7 +527,8 @@ function useFlow(args) {
|
|
|
524
527
|
}
|
|
525
528
|
const id = ++reqId.current;
|
|
526
529
|
setStatus("loading");
|
|
527
|
-
setError(null);
|
|
530
|
+
if (!keepExpiryError.current) setError(null);
|
|
531
|
+
keepExpiryError.current = false;
|
|
528
532
|
setVerdict(null);
|
|
529
533
|
setTxHash(null);
|
|
530
534
|
setLastTxEntry(null);
|
|
@@ -617,6 +621,10 @@ function useFlow(args) {
|
|
|
617
621
|
setVerdict(null);
|
|
618
622
|
const patch = (id, s, hash) => setSteps((prev) => prev.map((st) => st.id === id ? { ...st, state: s, ...hash ? { hash } : {} } : st));
|
|
619
623
|
try {
|
|
624
|
+
if (route.zdHeavy) {
|
|
625
|
+
if (route.zdHeavy.order.expiresAt - Date.now() / 1e3 < SIGN_MIN_SECONDS) throw new ZdHeavyQuoteExpiredError();
|
|
626
|
+
assertZdHeavyQuoteFresh(route.zdHeavy.order, Math.floor(Date.now() / 1e3));
|
|
627
|
+
}
|
|
620
628
|
const current = await getChainId(provider);
|
|
621
629
|
if (current !== Number(sourceChainId)) {
|
|
622
630
|
await switchChain(provider, Number(sourceChainId));
|
|
@@ -647,6 +655,7 @@ function useFlow(args) {
|
|
|
647
655
|
patch(tx.id, "done");
|
|
648
656
|
continue;
|
|
649
657
|
}
|
|
658
|
+
if (route.zdHeavy && tx.kind === "submitOrder") assertZdHeavyQuoteFresh(route.zdHeavy.order, Math.floor(Date.now() / 1e3));
|
|
650
659
|
if (!validatePlannedTransaction(tx, route, recipient, heavyExpected ? { ...heavyExpected, nowSec: Math.floor(Date.now() / 1e3) } : void 0)) {
|
|
651
660
|
throw new Error(`Refusing to sign a ${tx.kind} that does not match the reviewed plan.`);
|
|
652
661
|
}
|
|
@@ -711,13 +720,17 @@ function useFlow(args) {
|
|
|
711
720
|
}
|
|
712
721
|
} catch (e) {
|
|
713
722
|
setStatus("error");
|
|
714
|
-
setError(normalizeWalletError(e));
|
|
723
|
+
setError(e instanceof ZdHeavyQuoteExpiredError ? e.message : normalizeWalletError(e));
|
|
724
|
+
if (e instanceof ZdHeavyQuoteExpiredError) {
|
|
725
|
+
keepExpiryError.current = true;
|
|
726
|
+
reload();
|
|
727
|
+
}
|
|
715
728
|
setSteps((prev) => prev.map((st) => st.state === "active" ? { ...st, state: "error" } : st));
|
|
716
729
|
onError?.(e instanceof Error ? e : new Error(String(e)));
|
|
717
730
|
} finally {
|
|
718
731
|
busyRef.current = false;
|
|
719
732
|
}
|
|
720
|
-
}, [selected, wallet.provider, wallet.account, engine, kind, recipientFor, onSuccess, onError]);
|
|
733
|
+
}, [selected, wallet.provider, wallet.account, engine, kind, recipientFor, onSuccess, onError, reload]);
|
|
721
734
|
const [prices, setPrices] = useState(null);
|
|
722
735
|
const priceKey = baseSelected?.options?.length ? `${baseSelected.source.asset}|${baseSelected.receive.asset}` : "";
|
|
723
736
|
useEffect(() => {
|
|
@@ -813,6 +826,24 @@ function useFlow(args) {
|
|
|
813
826
|
const quoteReady = status === "ready" && !!plan;
|
|
814
827
|
const quotePaused = quoteReady && idle2;
|
|
815
828
|
const quoteStale = quoteReady && (idle2 || planAt < returnedAt2);
|
|
829
|
+
useEffect(() => {
|
|
830
|
+
if (!enabled || !selected?.zdHeavy || !quoteReady || quotePaused || busyRef.current) return;
|
|
831
|
+
let timer2;
|
|
832
|
+
const schedule = () => {
|
|
833
|
+
clearTimeout(timer2);
|
|
834
|
+
if (document.visibilityState !== "visible" || busyRef.current) return;
|
|
835
|
+
const delay = Math.max(3e3, (selected.zdHeavy.order.expiresAt - REFRESH_LEAD_SECONDS) * 1e3 - Date.now());
|
|
836
|
+
timer2 = setTimeout(() => {
|
|
837
|
+
if (!busyRef.current && statusRef.current === "ready" && !isUserIdle() && document.visibilityState === "visible") reload();
|
|
838
|
+
}, delay);
|
|
839
|
+
};
|
|
840
|
+
schedule();
|
|
841
|
+
document.addEventListener("visibilitychange", schedule);
|
|
842
|
+
return () => {
|
|
843
|
+
clearTimeout(timer2);
|
|
844
|
+
document.removeEventListener("visibilitychange", schedule);
|
|
845
|
+
};
|
|
846
|
+
}, [enabled, selected, quoteReady, quotePaused, reload]);
|
|
816
847
|
return {
|
|
817
848
|
status,
|
|
818
849
|
plan,
|
|
@@ -1061,6 +1061,7 @@ function hubDeliverableSymbols(tokens, execution) {
|
|
|
1061
1061
|
function isSourceToken(token, ctx) {
|
|
1062
1062
|
const chainId = Number(token.chainId);
|
|
1063
1063
|
if (!ctx.sourceChains.has(chainId)) return false;
|
|
1064
|
+
if (ctx.zdHeavySources?.has(tokenKey(chainId, token.address))) return true;
|
|
1064
1065
|
return ctx.execution.has(chainId) || !isKnownUnbridgeable(token.bridge) && ctx.source.has(tokenKey(chainId, token.address));
|
|
1065
1066
|
}
|
|
1066
1067
|
function directLaneOK(token, source, lanes) {
|
|
@@ -1079,6 +1080,7 @@ function laneLimitFor(token, source, limitedLanes2) {
|
|
|
1079
1080
|
}
|
|
1080
1081
|
function destinationAvailability(token, ctx, source) {
|
|
1081
1082
|
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
1083
|
+
if (source && ctx.zdHeavyLanes?.has(laneKey(source.chainId, source.address, token.chainId, token.address))) return "available";
|
|
1082
1084
|
if (directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
1083
1085
|
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
1084
1086
|
if (token.isChainedDestination === true) return "available";
|
|
@@ -1097,6 +1099,7 @@ function hasReachableDestination(source, catalogue, ctx) {
|
|
|
1097
1099
|
}
|
|
1098
1100
|
function buildCatalogue(input) {
|
|
1099
1101
|
const { chains, tokens, routes, supportedChainIds, brokenLanes } = input;
|
|
1102
|
+
const zdHeavy = (input.zdHeavyRoutes ?? []).filter((r) => !!r && typeof r === "object" && !Array.isArray(r) && r.isEnabled !== false && r.isQuotable === true);
|
|
1100
1103
|
const product = input.product ?? "stable";
|
|
1101
1104
|
const universe = productAssets(product);
|
|
1102
1105
|
const allowedAssets = input.allowedAssets ? new Set([...input.allowedAssets].filter((a) => universe.has(a))) : universe;
|
|
@@ -1104,7 +1107,10 @@ function buildCatalogue(input) {
|
|
|
1104
1107
|
const registryChainIds = new Set(enabledChains.map((c) => Number(c.chainId)));
|
|
1105
1108
|
const sourceChains = new Set([...registryChainIds].filter((id) => supportedChainIds.has(id)));
|
|
1106
1109
|
const execution = executionChainIds(enabledChains);
|
|
1107
|
-
const projected = product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes);
|
|
1110
|
+
const projected = [...product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes), ...zdHeavy];
|
|
1111
|
+
const zdHeavyLanes = laneKeys(zdHeavy);
|
|
1112
|
+
const zdHeavySources = sourceKeys(zdHeavy);
|
|
1113
|
+
const zdHeavyKeys = /* @__PURE__ */ new Set([...zdHeavySources, ...destinationKeys(zdHeavy)]);
|
|
1108
1114
|
const source = sourceKeys(projected);
|
|
1109
1115
|
const destination = destinationKeys(projected);
|
|
1110
1116
|
const lanes = laneKeys(projected);
|
|
@@ -1119,14 +1125,15 @@ function buildCatalogue(input) {
|
|
|
1119
1125
|
if (!chainIds.has(chainId)) return false;
|
|
1120
1126
|
if (product === "rwa") return true;
|
|
1121
1127
|
if (execution.has(chainId) || token.isChainedDestination === true) return true;
|
|
1122
|
-
if (!isExecutableBridge(token)) return false;
|
|
1123
1128
|
const key2 = tokenKey(token.chainId, token.address);
|
|
1129
|
+
if (zdHeavyKeys.has(key2)) return true;
|
|
1130
|
+
if (!isExecutableBridge(token)) return false;
|
|
1124
1131
|
return source.has(key2) || destination.has(key2);
|
|
1125
1132
|
});
|
|
1126
1133
|
const ready = chains.length > 0 && routes.length > 0 && projectedCatalogue.length > 0;
|
|
1127
1134
|
const catalogue = ready ? projectedCatalogue : allowed;
|
|
1128
1135
|
const hubSymbols = hubDeliverableSymbols(catalogue, execution);
|
|
1129
|
-
const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...brokenLanes ? { brokenLanes } : {} };
|
|
1136
|
+
const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...zdHeavy.length ? { zdHeavyLanes, zdHeavySources } : {}, ...brokenLanes ? { brokenLanes } : {} };
|
|
1130
1137
|
const sellable = (token) => product !== "rwa" || isSellableRwa(token);
|
|
1131
1138
|
const sources = ready ? catalogue.filter((token) => sellable(token) && isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
|
|
1132
1139
|
// Unprojected: the only rule we can still apply with confidence is the escrow-chain bound,
|
|
@@ -2543,6 +2550,15 @@ function zdHeavyRouterPinned(chainId, router) {
|
|
|
2543
2550
|
}
|
|
2544
2551
|
|
|
2545
2552
|
// src/core/quote-option.ts
|
|
2553
|
+
function gateZdHeavyOptions(response, request, quotableRoutes) {
|
|
2554
|
+
if (!Array.isArray(response?.options)) return response;
|
|
2555
|
+
const matchesToken = (chainId, token, address, symbol) => typeof address === "string" && !!address && chainAddressKey(chainId, token) === chainAddressKey(chainId, address) || typeof symbol === "string" && !!symbolKey(symbol) && symbolKey(token) === symbolKey(symbol);
|
|
2556
|
+
const matchesLane = quotableRoutes.some(
|
|
2557
|
+
(r) => !!r && typeof r === "object" && !Array.isArray(r) && r.isEnabled !== false && r.isQuotable === true && Number(r.fromChainId) === Number(request.inputChain) && Number(r.toChainId) === Number(request.outputChain) && matchesToken(request.inputChain, request.inputToken, r.fromAddress, r.fromSymbol) && matchesToken(request.outputChain, request.outputToken, r.toAddress, r.toSymbol)
|
|
2558
|
+
);
|
|
2559
|
+
if (matchesLane) return response;
|
|
2560
|
+
return { ...response, options: response.options.filter((option) => option?.protocol !== "zdheavy") };
|
|
2561
|
+
}
|
|
2546
2562
|
function zdHeavyExecutable(q) {
|
|
2547
2563
|
const order = q.execution?.order;
|
|
2548
2564
|
const chainId = typeof q.fromChainId === "number" ? q.fromChainId : Number(order?.chainNumber);
|
|
@@ -3474,6 +3490,16 @@ async function allowanceCovers(tx, account, ethCall) {
|
|
|
3474
3490
|
}
|
|
3475
3491
|
|
|
3476
3492
|
// src/core/zdheavy-route.ts
|
|
3493
|
+
var ZdHeavyQuoteExpiredError = class extends Error {
|
|
3494
|
+
code = "zdheavy_quote_expired";
|
|
3495
|
+
constructor() {
|
|
3496
|
+
super("This ZD Heavy quote expired before it was signed. A fresh quote is loading \u2014 review it and press Exchange again.");
|
|
3497
|
+
this.name = "ZdHeavyQuoteExpiredError";
|
|
3498
|
+
}
|
|
3499
|
+
};
|
|
3500
|
+
function assertZdHeavyQuoteFresh(order, nowSec) {
|
|
3501
|
+
if (order && (order.expiresAt <= nowSec || order.expiryDate <= nowSec)) throw new ZdHeavyQuoteExpiredError();
|
|
3502
|
+
}
|
|
3477
3503
|
function zdHeavyExpected(route, owner, receiver, tokens, routes) {
|
|
3478
3504
|
const heavy = route.zdHeavy;
|
|
3479
3505
|
if (!heavy) throw new Error("Missing ZD Heavy order.");
|
|
@@ -3499,6 +3525,7 @@ function zdHeavyExpected(route, owner, receiver, tokens, routes) {
|
|
|
3499
3525
|
};
|
|
3500
3526
|
}
|
|
3501
3527
|
function validateZdHeavyPlan(route, expected) {
|
|
3528
|
+
assertZdHeavyQuoteFresh(expected.order, expected.nowSec);
|
|
3502
3529
|
if (route.transactions.length !== 2 || route.transactions[0].kind !== "approve" || route.transactions[1].kind !== "submitOrder") {
|
|
3503
3530
|
throw new Error("ZD Heavy requires exactly approve then submitOrder; refusing to sign.");
|
|
3504
3531
|
}
|
|
@@ -4370,7 +4397,7 @@ var CHANNEL_HEADER = "x-zd-channel";
|
|
|
4370
4397
|
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
4371
4398
|
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
4372
4399
|
var WIDGET_CHANNEL = "widget";
|
|
4373
|
-
var WIDGET_VERSION = "4.
|
|
4400
|
+
var WIDGET_VERSION = "4.21.0" ;
|
|
4374
4401
|
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
4375
4402
|
function sanitizeVersion(raw2) {
|
|
4376
4403
|
const v = String(raw2).trim();
|
|
@@ -4494,7 +4521,7 @@ function wait(ms) {
|
|
|
4494
4521
|
}
|
|
4495
4522
|
var PAGE_LIMIT = 500;
|
|
4496
4523
|
var MAX_PAGES = 10;
|
|
4497
|
-
var newRegistryCache = () => ({ chains: null, tokens: null, routes: null, health: null, vaults: null, promotions: null, inflight: /* @__PURE__ */ new Map() });
|
|
4524
|
+
var newRegistryCache = () => ({ chains: null, tokens: null, routes: null, zdHeavy: null, health: null, vaults: null, promotions: null, inflight: /* @__PURE__ */ new Map() });
|
|
4498
4525
|
var SHARED_REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
4499
4526
|
function registryCacheFor(scope) {
|
|
4500
4527
|
if (!scope) return newRegistryCache();
|
|
@@ -4571,13 +4598,14 @@ function createApiClient(cfg) {
|
|
|
4571
4598
|
const json = await requestJson(path, init);
|
|
4572
4599
|
return json?.data ?? json;
|
|
4573
4600
|
}
|
|
4574
|
-
async function requestAllPages(path) {
|
|
4601
|
+
async function requestAllPages(path, params = {}) {
|
|
4575
4602
|
const rows = [];
|
|
4576
4603
|
let firstRow = "";
|
|
4577
4604
|
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
4578
|
-
const json = await requestJson(`${path}${toQuery({ limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
4605
|
+
const json = await requestJson(`${path}${toQuery({ ...params, limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
4579
4606
|
const envelope = json && !Array.isArray(json) ? json : {};
|
|
4580
4607
|
const data = Array.isArray(json) ? json : envelope.data;
|
|
4608
|
+
if (params.protocol === "zdheavy" && !Array.isArray(data)) throw apiError(`ZeroDelta returned an unusable list (${path}).`, { code: "bad_response" });
|
|
4581
4609
|
const pageRows = Array.isArray(data) ? data : [];
|
|
4582
4610
|
const head = pageRows.length ? JSON.stringify(pageRows[0]) : "";
|
|
4583
4611
|
if (page === 0) firstRow = head;
|
|
@@ -4623,6 +4651,20 @@ function createApiClient(cfg) {
|
|
|
4623
4651
|
}
|
|
4624
4652
|
});
|
|
4625
4653
|
}
|
|
4654
|
+
function fetchZdHeavyRoutes() {
|
|
4655
|
+
if (nowFresh(cache.zdHeavy)) return Promise.resolve(cache.zdHeavy.value);
|
|
4656
|
+
return once("zdHeavy", async () => {
|
|
4657
|
+
let value = [];
|
|
4658
|
+
try {
|
|
4659
|
+
const rows = await requestAllPages("/routes", { protocol: "zdheavy", isEnabled: true });
|
|
4660
|
+
value = rows.filter((r) => !!r && typeof r === "object" && !Array.isArray(r) && r.isEnabled !== false && r.isQuotable === true);
|
|
4661
|
+
} catch {
|
|
4662
|
+
value = [];
|
|
4663
|
+
}
|
|
4664
|
+
cache.zdHeavy = { at: Date.now(), value };
|
|
4665
|
+
return value;
|
|
4666
|
+
});
|
|
4667
|
+
}
|
|
4626
4668
|
function fetchRouteHealth() {
|
|
4627
4669
|
if (nowFresh(cache.health)) return Promise.resolve(cache.health.value);
|
|
4628
4670
|
return once("health", async () => {
|
|
@@ -4701,7 +4743,8 @@ function createApiClient(cfg) {
|
|
|
4701
4743
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
4702
4744
|
try {
|
|
4703
4745
|
const quote = await apiRequest("/quote", { method: "POST", headers: { "X-ZD-Shape": "native" }, body: JSON.stringify(request), timeoutMs: 18e3 });
|
|
4704
|
-
|
|
4746
|
+
const gated = Array.isArray(quote?.options) && quote.options.some((option) => option?.protocol === "zdheavy") ? gateZdHeavyOptions(quote, request, await fetchZdHeavyRoutes()) : quote;
|
|
4747
|
+
return normalizeQuoteResponse(gated, request);
|
|
4705
4748
|
} catch (error) {
|
|
4706
4749
|
lastError = error;
|
|
4707
4750
|
if (attempt >= retries || !isTransientQuoteError(error)) throw error;
|
|
@@ -4757,7 +4800,7 @@ function createApiClient(cfg) {
|
|
|
4757
4800
|
return false;
|
|
4758
4801
|
}
|
|
4759
4802
|
}
|
|
4760
|
-
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchPrices, fetchPromotions, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
4803
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchZdHeavyRoutes, fetchRouteHealth, fetchRwaVaults, fetchPrices, fetchPromotions, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
4761
4804
|
}
|
|
4762
4805
|
|
|
4763
4806
|
// src/core/plan.ts
|
|
@@ -5448,10 +5491,11 @@ function createEngine(config = {}) {
|
|
|
5448
5491
|
fetchPrices: (symbols) => api.fetchPrices ? api.fetchPrices(symbols) : Promise.resolve({}),
|
|
5449
5492
|
fetchPromotions: () => api.fetchPromotions ? api.fetchPromotions() : Promise.resolve([]),
|
|
5450
5493
|
fetchCatalogue: async (allowedAssets, product, options) => {
|
|
5451
|
-
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
5494
|
+
const [chains, registryTokens, routes, zdHeavyRoutes, health, vaults] = await Promise.all([
|
|
5452
5495
|
api.fetchChains().catch(() => []),
|
|
5453
5496
|
api.fetchTokens().catch(() => []),
|
|
5454
5497
|
api.fetchRoutes().catch(() => []),
|
|
5498
|
+
api.fetchZdHeavyRoutes(),
|
|
5455
5499
|
api.fetchRouteHealth(),
|
|
5456
5500
|
api.fetchRwaVaults()
|
|
5457
5501
|
]);
|
|
@@ -5462,6 +5506,7 @@ function createEngine(config = {}) {
|
|
|
5462
5506
|
chains,
|
|
5463
5507
|
tokens,
|
|
5464
5508
|
routes,
|
|
5509
|
+
zdHeavyRoutes,
|
|
5465
5510
|
product,
|
|
5466
5511
|
...allowed ? { allowedAssets: allowed } : {},
|
|
5467
5512
|
// Solana is a SOURCE only for a surface that can pay from it (the exchange card, through the
|
|
@@ -5502,4 +5547,4 @@ function createEngine(config = {}) {
|
|
|
5502
5547
|
};
|
|
5503
5548
|
}
|
|
5504
5549
|
|
|
5505
|
-
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BUNDLED_SOLANA_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CANONICAL_SOLANA_PROGRAM, CENTIBIPS_PER_UNIT, 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_QUOTE_CARDS, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, SOLANA_CHAIN_ID, SOLANA_DESTINATION_ASSETS, SOL_SHORTFALL_MESSAGE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_DISCRIMINATOR, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SolanaSendError, TOKEN_2022_PROGRAM, TOKEN_PROGRAM, TRACKING, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, WAIT_MAX_SEC, WAIT_MIN_SEC, WAIT_POSITIONS, WAIT_STEP_SEC, WALLET_HISTORY_LIMIT, ZD_HEAVY_KEY_PREFIX, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, askCovers, askTokenDecimals, assertAddress, assertChainAddress, assertQuoteMatchesSelection, assertWalletMessage, assetClassOf, assetDecimals, associatedTokenAddress, base58Decode, base58Encode, base64Decode, base64Encode, bestOutputOption, blockLabelFor, bonusFigure, bonusPercentLabel, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSolanaSourcePlan, buildSwapPlan, bytes32Word, bytesEqual, bytesPayload, canAttachApiKey, categoryLabel, chainAddressKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, checkSolanaPlan, checkSolanaProgram, checkSolanaReceiver, checkSolanaRouteBuffer, clampWait, classifyQuoteError, compareAmount, compareDuration, compareFeeUsd, compareHops, compareOptionOf, compareOptionsOf, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, cornerTags, cosignSolanaEvent, counterpartTokens, createApiClient, createEngine, createSolanaRpc, createVerifier, decodeSolanaSubmitOrder, decodeSubmitOrderCalldata, deriveSolanaEvent, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeNextSolanaOrders, encodeSubmitOrder, encodeTransfer, estimateBonus, exceedsLaneLimit, executableRoutes, executeSolanaPlan, executeSolanaPlanStaged, executionChainIds, expectedSolanaDelivery, extraVsFastest, fastestOption, fetchDelivery, fetchPaymentPlan, fetchWalletHistory, finalOf, findProgramAddress, findToken, foldTicker, formatJurisdiction, formatNative, formatUnits, fundedByLabel, hasReachableDestination, hasValidChecksum, hexBytes, hexToSolanaKey, historyEntryFromOrder, historyKey, hubDeliverableSymbols, humanizeComplianceReason, insteadFigures, isAddress, isChainAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSellableRwa, isSolanaAddress, isSolanaChainId, isSourceToken, isSubmitOrder, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, mergeHistory, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeDelivery, normalizeOrderRequest, normalizeOrderRequests, overwriteBlockhash, pairPromotionsInto, parity, parseAddressLookupTable, parseAllowedApiBase, parsePromotion, parsePromotions, parseSolanaTransaction, parseUnitsDecimal, pickForWait, placeSignature, planErrorSummary, planMsgValueHex, pollSolanaConfirmation, preflightZdHeavyPlan, previewSolanaSource, priceCompareOptions, productAssets, promotedAssets, promotionFor, proposedWait, quotePartnerId, quotePayOption, quoteSolanaSource, quoteSwapPreview, readSolanaBalance, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSolanaKeys, resolveSwapReceiver, resolveVaultIcon, resultForOption, routeBadges, routeNativeValue, routeShapeLabel, safeTicker, sameAddress, scaleDecimals, screeningOutcomeOf, selectableOptions, serializeSolanaTransaction, sha256, simulateSolanaCost, snapWait, solanaBridgeOf, solanaDestinationAsset, solanaKeyBytes, solanaKeyHex, solanaLamportShortfall, solanaPlanNeedsPreparation, solanaQuoteCompliance, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, usdStablePair, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, visibleOptions, waitFraction, waitFromFraction, waitLabel, waitScaleFor, withVaultArtwork, zdHeavyExpected, zdHeavyOptionKey, zdHeavyUnavailableStatus };
|
|
5550
|
+
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BUNDLED_SOLANA_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CANONICAL_SOLANA_PROGRAM, CENTIBIPS_PER_UNIT, 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_QUOTE_CARDS, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, SOLANA_CHAIN_ID, SOLANA_DESTINATION_ASSETS, SOL_SHORTFALL_MESSAGE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_DISCRIMINATOR, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SolanaSendError, TOKEN_2022_PROGRAM, TOKEN_PROGRAM, TRACKING, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, WAIT_MAX_SEC, WAIT_MIN_SEC, WAIT_POSITIONS, WAIT_STEP_SEC, WALLET_HISTORY_LIMIT, ZD_HEAVY_KEY_PREFIX, ZERO_ADDRESS, ZdHeavyQuoteExpiredError, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, askCovers, askTokenDecimals, assertAddress, assertChainAddress, assertQuoteMatchesSelection, assertWalletMessage, assertZdHeavyQuoteFresh, assetClassOf, assetDecimals, associatedTokenAddress, base58Decode, base58Encode, base64Decode, base64Encode, bestOutputOption, blockLabelFor, bonusFigure, bonusPercentLabel, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSolanaSourcePlan, buildSwapPlan, bytes32Word, bytesEqual, bytesPayload, canAttachApiKey, categoryLabel, chainAddressKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, checkSolanaPlan, checkSolanaProgram, checkSolanaReceiver, checkSolanaRouteBuffer, clampWait, classifyQuoteError, compareAmount, compareDuration, compareFeeUsd, compareHops, compareOptionOf, compareOptionsOf, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, cornerTags, cosignSolanaEvent, counterpartTokens, createApiClient, createEngine, createSolanaRpc, createVerifier, decodeSolanaSubmitOrder, decodeSubmitOrderCalldata, deriveSolanaEvent, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeNextSolanaOrders, encodeSubmitOrder, encodeTransfer, estimateBonus, exceedsLaneLimit, executableRoutes, executeSolanaPlan, executeSolanaPlanStaged, executionChainIds, expectedSolanaDelivery, extraVsFastest, fastestOption, fetchDelivery, fetchPaymentPlan, fetchWalletHistory, finalOf, findProgramAddress, findToken, foldTicker, formatJurisdiction, formatNative, formatUnits, fundedByLabel, hasReachableDestination, hasValidChecksum, hexBytes, hexToSolanaKey, historyEntryFromOrder, historyKey, hubDeliverableSymbols, humanizeComplianceReason, insteadFigures, isAddress, isChainAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSellableRwa, isSolanaAddress, isSolanaChainId, isSourceToken, isSubmitOrder, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, mergeHistory, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeDelivery, normalizeOrderRequest, normalizeOrderRequests, overwriteBlockhash, pairPromotionsInto, parity, parseAddressLookupTable, parseAllowedApiBase, parsePromotion, parsePromotions, parseSolanaTransaction, parseUnitsDecimal, pickForWait, placeSignature, planErrorSummary, planMsgValueHex, pollSolanaConfirmation, preflightZdHeavyPlan, previewSolanaSource, priceCompareOptions, productAssets, promotedAssets, promotionFor, proposedWait, quotePartnerId, quotePayOption, quoteSolanaSource, quoteSwapPreview, readSolanaBalance, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSolanaKeys, resolveSwapReceiver, resolveVaultIcon, resultForOption, routeBadges, routeNativeValue, routeShapeLabel, safeTicker, sameAddress, scaleDecimals, screeningOutcomeOf, selectableOptions, serializeSolanaTransaction, sha256, simulateSolanaCost, snapWait, solanaBridgeOf, solanaDestinationAsset, solanaKeyBytes, solanaKeyHex, solanaLamportShortfall, solanaPlanNeedsPreparation, solanaQuoteCompliance, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, usdStablePair, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, visibleOptions, waitFraction, waitFromFraction, waitLabel, waitScaleFor, withVaultArtwork, zdHeavyExpected, zdHeavyOptionKey, zdHeavyUnavailableStatus };
|
package/dist/core/index.cjs
CHANGED
|
@@ -1633,6 +1633,7 @@ function hubDeliverableSymbols(tokens, execution) {
|
|
|
1633
1633
|
function isSourceToken(token, ctx) {
|
|
1634
1634
|
const chainId = Number(token.chainId);
|
|
1635
1635
|
if (!ctx.sourceChains.has(chainId)) return false;
|
|
1636
|
+
if (ctx.zdHeavySources?.has(tokenKey(chainId, token.address))) return true;
|
|
1636
1637
|
return ctx.execution.has(chainId) || !isKnownUnbridgeable(token.bridge) && ctx.source.has(tokenKey(chainId, token.address));
|
|
1637
1638
|
}
|
|
1638
1639
|
function directLaneOK(token, source, lanes) {
|
|
@@ -1651,6 +1652,7 @@ function laneLimitFor(token, source, limitedLanes2) {
|
|
|
1651
1652
|
}
|
|
1652
1653
|
function destinationAvailability(token, ctx, source) {
|
|
1653
1654
|
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
1655
|
+
if (source && ctx.zdHeavyLanes?.has(laneKey(source.chainId, source.address, token.chainId, token.address))) return "available";
|
|
1654
1656
|
if (directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
1655
1657
|
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
1656
1658
|
if (token.isChainedDestination === true) return "available";
|
|
@@ -1669,6 +1671,7 @@ function hasReachableDestination(source, catalogue, ctx) {
|
|
|
1669
1671
|
}
|
|
1670
1672
|
function buildCatalogue(input) {
|
|
1671
1673
|
const { chains, tokens, routes, supportedChainIds, brokenLanes } = input;
|
|
1674
|
+
const zdHeavy = (input.zdHeavyRoutes ?? []).filter((r) => !!r && typeof r === "object" && !Array.isArray(r) && r.isEnabled !== false && r.isQuotable === true);
|
|
1672
1675
|
const product = input.product ?? "stable";
|
|
1673
1676
|
const universe = productAssets(product);
|
|
1674
1677
|
const allowedAssets = input.allowedAssets ? new Set([...input.allowedAssets].filter((a) => universe.has(a))) : universe;
|
|
@@ -1676,7 +1679,10 @@ function buildCatalogue(input) {
|
|
|
1676
1679
|
const registryChainIds = new Set(enabledChains.map((c) => Number(c.chainId)));
|
|
1677
1680
|
const sourceChains = new Set([...registryChainIds].filter((id) => supportedChainIds.has(id)));
|
|
1678
1681
|
const execution = executionChainIds(enabledChains);
|
|
1679
|
-
const projected = product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes);
|
|
1682
|
+
const projected = [...product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes), ...zdHeavy];
|
|
1683
|
+
const zdHeavyLanes = laneKeys(zdHeavy);
|
|
1684
|
+
const zdHeavySources = sourceKeys(zdHeavy);
|
|
1685
|
+
const zdHeavyKeys = /* @__PURE__ */ new Set([...zdHeavySources, ...destinationKeys(zdHeavy)]);
|
|
1680
1686
|
const source = sourceKeys(projected);
|
|
1681
1687
|
const destination = destinationKeys(projected);
|
|
1682
1688
|
const lanes = laneKeys(projected);
|
|
@@ -1691,14 +1697,15 @@ function buildCatalogue(input) {
|
|
|
1691
1697
|
if (!chainIds.has(chainId)) return false;
|
|
1692
1698
|
if (product === "rwa") return true;
|
|
1693
1699
|
if (execution.has(chainId) || token.isChainedDestination === true) return true;
|
|
1694
|
-
if (!isExecutableBridge(token)) return false;
|
|
1695
1700
|
const key2 = tokenKey(token.chainId, token.address);
|
|
1701
|
+
if (zdHeavyKeys.has(key2)) return true;
|
|
1702
|
+
if (!isExecutableBridge(token)) return false;
|
|
1696
1703
|
return source.has(key2) || destination.has(key2);
|
|
1697
1704
|
});
|
|
1698
1705
|
const ready = chains.length > 0 && routes.length > 0 && projectedCatalogue.length > 0;
|
|
1699
1706
|
const catalogue = ready ? projectedCatalogue : allowed;
|
|
1700
1707
|
const hubSymbols = hubDeliverableSymbols(catalogue, execution);
|
|
1701
|
-
const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...brokenLanes ? { brokenLanes } : {} };
|
|
1708
|
+
const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...zdHeavy.length ? { zdHeavyLanes, zdHeavySources } : {}, ...brokenLanes ? { brokenLanes } : {} };
|
|
1702
1709
|
const sellable = (token) => product !== "rwa" || isSellableRwa(token);
|
|
1703
1710
|
const sources = ready ? catalogue.filter((token) => sellable(token) && isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
|
|
1704
1711
|
// Unprojected: the only rule we can still apply with confidence is the escrow-chain bound,
|
|
@@ -3115,6 +3122,15 @@ function zdHeavyRouterPinned(chainId, router) {
|
|
|
3115
3122
|
}
|
|
3116
3123
|
|
|
3117
3124
|
// src/core/quote-option.ts
|
|
3125
|
+
function gateZdHeavyOptions(response, request, quotableRoutes) {
|
|
3126
|
+
if (!Array.isArray(response?.options)) return response;
|
|
3127
|
+
const matchesToken = (chainId, token, address, symbol) => typeof address === "string" && !!address && chainAddressKey(chainId, token) === chainAddressKey(chainId, address) || typeof symbol === "string" && !!symbolKey(symbol) && symbolKey(token) === symbolKey(symbol);
|
|
3128
|
+
const matchesLane = quotableRoutes.some(
|
|
3129
|
+
(r) => !!r && typeof r === "object" && !Array.isArray(r) && r.isEnabled !== false && r.isQuotable === true && Number(r.fromChainId) === Number(request.inputChain) && Number(r.toChainId) === Number(request.outputChain) && matchesToken(request.inputChain, request.inputToken, r.fromAddress, r.fromSymbol) && matchesToken(request.outputChain, request.outputToken, r.toAddress, r.toSymbol)
|
|
3130
|
+
);
|
|
3131
|
+
if (matchesLane) return response;
|
|
3132
|
+
return { ...response, options: response.options.filter((option) => option?.protocol !== "zdheavy") };
|
|
3133
|
+
}
|
|
3118
3134
|
function zdHeavyExecutable(q) {
|
|
3119
3135
|
const order = q.execution?.order;
|
|
3120
3136
|
const chainId = typeof q.fromChainId === "number" ? q.fromChainId : Number(order?.chainNumber);
|
|
@@ -4041,6 +4057,16 @@ async function allowanceCovers(tx, account, ethCall) {
|
|
|
4041
4057
|
}
|
|
4042
4058
|
|
|
4043
4059
|
// src/core/zdheavy-route.ts
|
|
4060
|
+
var ZdHeavyQuoteExpiredError = class extends Error {
|
|
4061
|
+
code = "zdheavy_quote_expired";
|
|
4062
|
+
constructor() {
|
|
4063
|
+
super("This ZD Heavy quote expired before it was signed. A fresh quote is loading \u2014 review it and press Exchange again.");
|
|
4064
|
+
this.name = "ZdHeavyQuoteExpiredError";
|
|
4065
|
+
}
|
|
4066
|
+
};
|
|
4067
|
+
function assertZdHeavyQuoteFresh(order, nowSec) {
|
|
4068
|
+
if (order && (order.expiresAt <= nowSec || order.expiryDate <= nowSec)) throw new ZdHeavyQuoteExpiredError();
|
|
4069
|
+
}
|
|
4044
4070
|
function zdHeavyExpected(route, owner, receiver, tokens, routes) {
|
|
4045
4071
|
const heavy = route.zdHeavy;
|
|
4046
4072
|
if (!heavy) throw new Error("Missing ZD Heavy order.");
|
|
@@ -4066,6 +4092,7 @@ function zdHeavyExpected(route, owner, receiver, tokens, routes) {
|
|
|
4066
4092
|
};
|
|
4067
4093
|
}
|
|
4068
4094
|
function validateZdHeavyPlan(route, expected) {
|
|
4095
|
+
assertZdHeavyQuoteFresh(expected.order, expected.nowSec);
|
|
4069
4096
|
if (route.transactions.length !== 2 || route.transactions[0].kind !== "approve" || route.transactions[1].kind !== "submitOrder") {
|
|
4070
4097
|
throw new Error("ZD Heavy requires exactly approve then submitOrder; refusing to sign.");
|
|
4071
4098
|
}
|
|
@@ -4931,7 +4958,7 @@ var CHANNEL_HEADER = "x-zd-channel";
|
|
|
4931
4958
|
var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
|
|
4932
4959
|
var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
|
|
4933
4960
|
var WIDGET_CHANNEL = "widget";
|
|
4934
|
-
var WIDGET_VERSION = "4.
|
|
4961
|
+
var WIDGET_VERSION = "4.21.0" ;
|
|
4935
4962
|
var MAX_CHANNEL_VERSION_LEN = 32;
|
|
4936
4963
|
function sanitizeVersion(raw2) {
|
|
4937
4964
|
const v = String(raw2).trim();
|
|
@@ -5055,7 +5082,7 @@ function wait(ms) {
|
|
|
5055
5082
|
}
|
|
5056
5083
|
var PAGE_LIMIT = 500;
|
|
5057
5084
|
var MAX_PAGES = 10;
|
|
5058
|
-
var newRegistryCache = () => ({ chains: null, tokens: null, routes: null, health: null, vaults: null, promotions: null, inflight: /* @__PURE__ */ new Map() });
|
|
5085
|
+
var newRegistryCache = () => ({ chains: null, tokens: null, routes: null, zdHeavy: null, health: null, vaults: null, promotions: null, inflight: /* @__PURE__ */ new Map() });
|
|
5059
5086
|
var SHARED_REGISTRY = /* @__PURE__ */ new WeakMap();
|
|
5060
5087
|
function registryCacheFor(scope) {
|
|
5061
5088
|
if (!scope) return newRegistryCache();
|
|
@@ -5132,13 +5159,14 @@ function createApiClient(cfg) {
|
|
|
5132
5159
|
const json = await requestJson(path, init);
|
|
5133
5160
|
return json?.data ?? json;
|
|
5134
5161
|
}
|
|
5135
|
-
async function requestAllPages(path) {
|
|
5162
|
+
async function requestAllPages(path, params = {}) {
|
|
5136
5163
|
const rows = [];
|
|
5137
5164
|
let firstRow = "";
|
|
5138
5165
|
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
5139
|
-
const json = await requestJson(`${path}${toQuery({ limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
5166
|
+
const json = await requestJson(`${path}${toQuery({ ...params, limit: PAGE_LIMIT, offset: rows.length || void 0 })}`);
|
|
5140
5167
|
const envelope = json && !Array.isArray(json) ? json : {};
|
|
5141
5168
|
const data = Array.isArray(json) ? json : envelope.data;
|
|
5169
|
+
if (params.protocol === "zdheavy" && !Array.isArray(data)) throw apiError(`ZeroDelta returned an unusable list (${path}).`, { code: "bad_response" });
|
|
5142
5170
|
const pageRows = Array.isArray(data) ? data : [];
|
|
5143
5171
|
const head = pageRows.length ? JSON.stringify(pageRows[0]) : "";
|
|
5144
5172
|
if (page === 0) firstRow = head;
|
|
@@ -5184,6 +5212,20 @@ function createApiClient(cfg) {
|
|
|
5184
5212
|
}
|
|
5185
5213
|
});
|
|
5186
5214
|
}
|
|
5215
|
+
function fetchZdHeavyRoutes() {
|
|
5216
|
+
if (nowFresh(cache.zdHeavy)) return Promise.resolve(cache.zdHeavy.value);
|
|
5217
|
+
return once("zdHeavy", async () => {
|
|
5218
|
+
let value = [];
|
|
5219
|
+
try {
|
|
5220
|
+
const rows = await requestAllPages("/routes", { protocol: "zdheavy", isEnabled: true });
|
|
5221
|
+
value = rows.filter((r) => !!r && typeof r === "object" && !Array.isArray(r) && r.isEnabled !== false && r.isQuotable === true);
|
|
5222
|
+
} catch {
|
|
5223
|
+
value = [];
|
|
5224
|
+
}
|
|
5225
|
+
cache.zdHeavy = { at: Date.now(), value };
|
|
5226
|
+
return value;
|
|
5227
|
+
});
|
|
5228
|
+
}
|
|
5187
5229
|
function fetchRouteHealth() {
|
|
5188
5230
|
if (nowFresh(cache.health)) return Promise.resolve(cache.health.value);
|
|
5189
5231
|
return once("health", async () => {
|
|
@@ -5262,7 +5304,8 @@ function createApiClient(cfg) {
|
|
|
5262
5304
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
5263
5305
|
try {
|
|
5264
5306
|
const quote = await apiRequest("/quote", { method: "POST", headers: { "X-ZD-Shape": "native" }, body: JSON.stringify(request), timeoutMs: 18e3 });
|
|
5265
|
-
|
|
5307
|
+
const gated = Array.isArray(quote?.options) && quote.options.some((option) => option?.protocol === "zdheavy") ? gateZdHeavyOptions(quote, request, await fetchZdHeavyRoutes()) : quote;
|
|
5308
|
+
return normalizeQuoteResponse(gated, request);
|
|
5266
5309
|
} catch (error) {
|
|
5267
5310
|
lastError = error;
|
|
5268
5311
|
if (attempt >= retries || !isTransientQuoteError(error)) throw error;
|
|
@@ -5318,7 +5361,7 @@ function createApiClient(cfg) {
|
|
|
5318
5361
|
return false;
|
|
5319
5362
|
}
|
|
5320
5363
|
}
|
|
5321
|
-
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchPrices, fetchPromotions, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
5364
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchZdHeavyRoutes, fetchRouteHealth, fetchRwaVaults, fetchPrices, fetchPromotions, fetchQuote, screenWallet, reportSubmission, apiBase };
|
|
5322
5365
|
}
|
|
5323
5366
|
|
|
5324
5367
|
// src/core/plan.ts
|
|
@@ -6009,10 +6052,11 @@ function createEngine(config = {}) {
|
|
|
6009
6052
|
fetchPrices: (symbols) => api.fetchPrices ? api.fetchPrices(symbols) : Promise.resolve({}),
|
|
6010
6053
|
fetchPromotions: () => api.fetchPromotions ? api.fetchPromotions() : Promise.resolve([]),
|
|
6011
6054
|
fetchCatalogue: async (allowedAssets, product, options) => {
|
|
6012
|
-
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
6055
|
+
const [chains, registryTokens, routes, zdHeavyRoutes, health, vaults] = await Promise.all([
|
|
6013
6056
|
api.fetchChains().catch(() => []),
|
|
6014
6057
|
api.fetchTokens().catch(() => []),
|
|
6015
6058
|
api.fetchRoutes().catch(() => []),
|
|
6059
|
+
api.fetchZdHeavyRoutes(),
|
|
6016
6060
|
api.fetchRouteHealth(),
|
|
6017
6061
|
api.fetchRwaVaults()
|
|
6018
6062
|
]);
|
|
@@ -6023,6 +6067,7 @@ function createEngine(config = {}) {
|
|
|
6023
6067
|
chains,
|
|
6024
6068
|
tokens,
|
|
6025
6069
|
routes,
|
|
6070
|
+
zdHeavyRoutes,
|
|
6026
6071
|
product,
|
|
6027
6072
|
...allowed ? { allowedAssets: allowed } : {},
|
|
6028
6073
|
// Solana is a SOURCE only for a surface that can pay from it (the exchange card, through the
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NormalizedOrder, s as ApiClient, t as SwapInput, P as Plan, C as Compliance, S as SanitizedTxEntry, T as Token, Q as Quote, u as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, v as RwaVault, F as FetchQuoteFn, w as SolveResult, O as OrderRequest, x as BalanceTarget, y as BalanceEntry, z as PlannedTx, Z as ZdHeavyExpected, D as Verifier, G as Promotion, f as ExchangeProduct, i as TxHistoryEntry, E as EngineConfig } from '../verify-
|
|
2
|
-
export { H as Address, I as ApiError, A as Availability, J as BLOCK_LABEL_DEFAULT, K as BonusInputs, B as BrokenLane, M as CENTIBIPS_PER_UNIT, U as COMPLIANCE_CHECK_ORDER, X as COMPLIANCE_DENY_LABEL, Y as CatalogueContext, _ as CatalogueInput, $ as CompareContext, a0 as CompareHop, a1 as CompareOption, c as ComplianceCheck, a2 as ComplianceCheckId, a3 as ComplianceDecision, d as ComplianceTone, e as ComplianceView, a4 as CornerTag, a5 as DIRECT_CHECK_IDS, a6 as DIRECT_SCOPE_NOTE, a7 as Destination, a8 as FLOOR_CATEGORIES, a9 as GatewayEvmTx, aa as Hex, ab as InsteadFigures, ac as LaneAvailabilityState, L as LaneLimit, ad as MAX_QUOTE_CARDS, ae as Parity, af as PlannedTxKind, ag as PromotedAsset, ah as PromotedNetwork, ai as PromotionFunder, aj as PromotionKind, ak as PromotionToken, al as QuoteBlock, am as QuoteOption, an as ResolvedConfig, ao as RouteBadge, ap as RouteHealth, aq as RouteHealthAvailability, ar as RouteHealthLane, g as RouteLeg, as as SCREENING_BUCKETS, at as ScreenProvider, au as ScreeningBucket, av as ScreeningOutcome, aw as SwapEnds, ax as TUNABLE_CATEGORIES, ay as TagTone, az as TxPlan, V as VerifyResult, aA as WAIT_MAX_SEC, aB as WAIT_MIN_SEC, aC as WAIT_POSITIONS, aD as WAIT_STEP_SEC, aE as WaitScale, W as WalletScreen, aF as ZD_HEAVY_KEY_PREFIX, aG as amountFieldError, aH as apiError, j as assetClassOf, aI as bestOutputOption, aJ as blockLabelFor, aK as bonusFigure, aL as bonusPercentLabel, aM as brokenLaneFor, k as brokenLaneReason, aN as buildCatalogue, aO as canAttachApiKey, aP as categoryLabel, aQ as clampWait, aR as classifyQuoteError, aS as compareAmount, aT as compareDuration, aU as compareFeeUsd, aV as compareHops, aW as compareOptionOf, aX as compareOptionsOf, l as complianceChecks, aY as complianceControlsEvaluated, m as complianceControlsLine, aZ as complianceReasonHead, a_ as complianceReasonTag, a$ as complianceTagOf, n as complianceView, b0 as cornerTags, o as counterpartTokens, b1 as createApiClient, b2 as createVerifier, p as destinationAvailability, b3 as destinationKeys, b4 as directComplianceFromScreens, b5 as distinctScreenedWallets, b6 as estimateBonus, b7 as exceedsLaneLimit, b8 as executableRoutes, b9 as executionChainIds, ba as extraVsFastest, bb as fastestOption, q as formatJurisdiction, bc as fundedByLabel, bd as hasReachableDestination, be as hubDeliverableSymbols, r as humanizeComplianceReason, bf as insteadFigures, bg as isExecutableBridge, bh as isKnownUnbridgeable, bi as isSellableRwa, bj as isSourceToken, bk as laneAvailabilityState, bl as laneKey, bm as laneKeys, bn as laneLimitAmount, bo as laneLimitError, bp as laneLimitFor, bq as laneLimitHint, br as laneLimitSymbol, bs as limitedLanes, bt as pairPromotionsInto, bu as parity, bv as parseAllowedApiBase, bw as parsePromotion, bx as parsePromotions, by as pickForWait, bz as priceCompareOptions, bA as productAssets, bB as promotedAssets, bC as promotionFor, bD as proposedWait, bE as registryRpc, bF as resolveApiBase, bG as resolveConfig, bH as routeBadges, bI as routeShapeLabel, bJ as sameAddress, bK as screeningOutcomeOf, bL as selectableOptions, bM as snapWait, bN as sourceKeys, bO as suppressedLanes, bP as tokenKey, bQ as txMatchesPlan, bR as unattributedComplianceReasons, bS as usdStablePair, bT as visibleOptions, bU as waitFraction, bV as waitFromFraction, bW as waitLabel, bX as waitScaleFor, bY as zdHeavyOptionKey, bZ as zdHeavyUnavailableStatus } from '../verify-
|
|
1
|
+
import { N as NormalizedOrder, s as ApiClient, t as SwapInput, P as Plan, C as Compliance, S as SanitizedTxEntry, T as Token, Q as Quote, u as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, v as RwaVault, F as FetchQuoteFn, w as SolveResult, O as OrderRequest, x as BalanceTarget, y as BalanceEntry, z as PlannedTx, Z as ZdHeavyExpected, D as Verifier, G as Promotion, f as ExchangeProduct, i as TxHistoryEntry, E as EngineConfig } from '../verify-CeHRSKl2.cjs';
|
|
2
|
+
export { H as Address, I as ApiError, A as Availability, J as BLOCK_LABEL_DEFAULT, K as BonusInputs, B as BrokenLane, M as CENTIBIPS_PER_UNIT, U as COMPLIANCE_CHECK_ORDER, X as COMPLIANCE_DENY_LABEL, Y as CatalogueContext, _ as CatalogueInput, $ as CompareContext, a0 as CompareHop, a1 as CompareOption, c as ComplianceCheck, a2 as ComplianceCheckId, a3 as ComplianceDecision, d as ComplianceTone, e as ComplianceView, a4 as CornerTag, a5 as DIRECT_CHECK_IDS, a6 as DIRECT_SCOPE_NOTE, a7 as Destination, a8 as FLOOR_CATEGORIES, a9 as GatewayEvmTx, aa as Hex, ab as InsteadFigures, ac as LaneAvailabilityState, L as LaneLimit, ad as MAX_QUOTE_CARDS, ae as Parity, af as PlannedTxKind, ag as PromotedAsset, ah as PromotedNetwork, ai as PromotionFunder, aj as PromotionKind, ak as PromotionToken, al as QuoteBlock, am as QuoteOption, an as ResolvedConfig, ao as RouteBadge, ap as RouteHealth, aq as RouteHealthAvailability, ar as RouteHealthLane, g as RouteLeg, as as SCREENING_BUCKETS, at as ScreenProvider, au as ScreeningBucket, av as ScreeningOutcome, aw as SwapEnds, ax as TUNABLE_CATEGORIES, ay as TagTone, az as TxPlan, V as VerifyResult, aA as WAIT_MAX_SEC, aB as WAIT_MIN_SEC, aC as WAIT_POSITIONS, aD as WAIT_STEP_SEC, aE as WaitScale, W as WalletScreen, aF as ZD_HEAVY_KEY_PREFIX, aG as amountFieldError, aH as apiError, j as assetClassOf, aI as bestOutputOption, aJ as blockLabelFor, aK as bonusFigure, aL as bonusPercentLabel, aM as brokenLaneFor, k as brokenLaneReason, aN as buildCatalogue, aO as canAttachApiKey, aP as categoryLabel, aQ as clampWait, aR as classifyQuoteError, aS as compareAmount, aT as compareDuration, aU as compareFeeUsd, aV as compareHops, aW as compareOptionOf, aX as compareOptionsOf, l as complianceChecks, aY as complianceControlsEvaluated, m as complianceControlsLine, aZ as complianceReasonHead, a_ as complianceReasonTag, a$ as complianceTagOf, n as complianceView, b0 as cornerTags, o as counterpartTokens, b1 as createApiClient, b2 as createVerifier, p as destinationAvailability, b3 as destinationKeys, b4 as directComplianceFromScreens, b5 as distinctScreenedWallets, b6 as estimateBonus, b7 as exceedsLaneLimit, b8 as executableRoutes, b9 as executionChainIds, ba as extraVsFastest, bb as fastestOption, q as formatJurisdiction, bc as fundedByLabel, bd as hasReachableDestination, be as hubDeliverableSymbols, r as humanizeComplianceReason, bf as insteadFigures, bg as isExecutableBridge, bh as isKnownUnbridgeable, bi as isSellableRwa, bj as isSourceToken, bk as laneAvailabilityState, bl as laneKey, bm as laneKeys, bn as laneLimitAmount, bo as laneLimitError, bp as laneLimitFor, bq as laneLimitHint, br as laneLimitSymbol, bs as limitedLanes, bt as pairPromotionsInto, bu as parity, bv as parseAllowedApiBase, bw as parsePromotion, bx as parsePromotions, by as pickForWait, bz as priceCompareOptions, bA as productAssets, bB as promotedAssets, bC as promotionFor, bD as proposedWait, bE as registryRpc, bF as resolveApiBase, bG as resolveConfig, bH as routeBadges, bI as routeShapeLabel, bJ as sameAddress, bK as screeningOutcomeOf, bL as selectableOptions, bM as snapWait, bN as sourceKeys, bO as suppressedLanes, bP as tokenKey, bQ as txMatchesPlan, bR as unattributedComplianceReasons, bS as usdStablePair, bT as visibleOptions, bU as waitFraction, bV as waitFromFraction, bW as waitLabel, bX as waitScaleFor, bY as zdHeavyOptionKey, bZ as zdHeavyUnavailableStatus } from '../verify-CeHRSKl2.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. */
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NormalizedOrder, s as ApiClient, t as SwapInput, P as Plan, C as Compliance, S as SanitizedTxEntry, T as Token, Q as Quote, u as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, v as RwaVault, F as FetchQuoteFn, w as SolveResult, O as OrderRequest, x as BalanceTarget, y as BalanceEntry, z as PlannedTx, Z as ZdHeavyExpected, D as Verifier, G as Promotion, f as ExchangeProduct, i as TxHistoryEntry, E as EngineConfig } from '../verify-
|
|
2
|
-
export { H as Address, I as ApiError, A as Availability, J as BLOCK_LABEL_DEFAULT, K as BonusInputs, B as BrokenLane, M as CENTIBIPS_PER_UNIT, U as COMPLIANCE_CHECK_ORDER, X as COMPLIANCE_DENY_LABEL, Y as CatalogueContext, _ as CatalogueInput, $ as CompareContext, a0 as CompareHop, a1 as CompareOption, c as ComplianceCheck, a2 as ComplianceCheckId, a3 as ComplianceDecision, d as ComplianceTone, e as ComplianceView, a4 as CornerTag, a5 as DIRECT_CHECK_IDS, a6 as DIRECT_SCOPE_NOTE, a7 as Destination, a8 as FLOOR_CATEGORIES, a9 as GatewayEvmTx, aa as Hex, ab as InsteadFigures, ac as LaneAvailabilityState, L as LaneLimit, ad as MAX_QUOTE_CARDS, ae as Parity, af as PlannedTxKind, ag as PromotedAsset, ah as PromotedNetwork, ai as PromotionFunder, aj as PromotionKind, ak as PromotionToken, al as QuoteBlock, am as QuoteOption, an as ResolvedConfig, ao as RouteBadge, ap as RouteHealth, aq as RouteHealthAvailability, ar as RouteHealthLane, g as RouteLeg, as as SCREENING_BUCKETS, at as ScreenProvider, au as ScreeningBucket, av as ScreeningOutcome, aw as SwapEnds, ax as TUNABLE_CATEGORIES, ay as TagTone, az as TxPlan, V as VerifyResult, aA as WAIT_MAX_SEC, aB as WAIT_MIN_SEC, aC as WAIT_POSITIONS, aD as WAIT_STEP_SEC, aE as WaitScale, W as WalletScreen, aF as ZD_HEAVY_KEY_PREFIX, aG as amountFieldError, aH as apiError, j as assetClassOf, aI as bestOutputOption, aJ as blockLabelFor, aK as bonusFigure, aL as bonusPercentLabel, aM as brokenLaneFor, k as brokenLaneReason, aN as buildCatalogue, aO as canAttachApiKey, aP as categoryLabel, aQ as clampWait, aR as classifyQuoteError, aS as compareAmount, aT as compareDuration, aU as compareFeeUsd, aV as compareHops, aW as compareOptionOf, aX as compareOptionsOf, l as complianceChecks, aY as complianceControlsEvaluated, m as complianceControlsLine, aZ as complianceReasonHead, a_ as complianceReasonTag, a$ as complianceTagOf, n as complianceView, b0 as cornerTags, o as counterpartTokens, b1 as createApiClient, b2 as createVerifier, p as destinationAvailability, b3 as destinationKeys, b4 as directComplianceFromScreens, b5 as distinctScreenedWallets, b6 as estimateBonus, b7 as exceedsLaneLimit, b8 as executableRoutes, b9 as executionChainIds, ba as extraVsFastest, bb as fastestOption, q as formatJurisdiction, bc as fundedByLabel, bd as hasReachableDestination, be as hubDeliverableSymbols, r as humanizeComplianceReason, bf as insteadFigures, bg as isExecutableBridge, bh as isKnownUnbridgeable, bi as isSellableRwa, bj as isSourceToken, bk as laneAvailabilityState, bl as laneKey, bm as laneKeys, bn as laneLimitAmount, bo as laneLimitError, bp as laneLimitFor, bq as laneLimitHint, br as laneLimitSymbol, bs as limitedLanes, bt as pairPromotionsInto, bu as parity, bv as parseAllowedApiBase, bw as parsePromotion, bx as parsePromotions, by as pickForWait, bz as priceCompareOptions, bA as productAssets, bB as promotedAssets, bC as promotionFor, bD as proposedWait, bE as registryRpc, bF as resolveApiBase, bG as resolveConfig, bH as routeBadges, bI as routeShapeLabel, bJ as sameAddress, bK as screeningOutcomeOf, bL as selectableOptions, bM as snapWait, bN as sourceKeys, bO as suppressedLanes, bP as tokenKey, bQ as txMatchesPlan, bR as unattributedComplianceReasons, bS as usdStablePair, bT as visibleOptions, bU as waitFraction, bV as waitFromFraction, bW as waitLabel, bX as waitScaleFor, bY as zdHeavyOptionKey, bZ as zdHeavyUnavailableStatus } from '../verify-
|
|
1
|
+
import { N as NormalizedOrder, s as ApiClient, t as SwapInput, P as Plan, C as Compliance, S as SanitizedTxEntry, T as Token, Q as Quote, u as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, v as RwaVault, F as FetchQuoteFn, w as SolveResult, O as OrderRequest, x as BalanceTarget, y as BalanceEntry, z as PlannedTx, Z as ZdHeavyExpected, D as Verifier, G as Promotion, f as ExchangeProduct, i as TxHistoryEntry, E as EngineConfig } from '../verify-CeHRSKl2.js';
|
|
2
|
+
export { H as Address, I as ApiError, A as Availability, J as BLOCK_LABEL_DEFAULT, K as BonusInputs, B as BrokenLane, M as CENTIBIPS_PER_UNIT, U as COMPLIANCE_CHECK_ORDER, X as COMPLIANCE_DENY_LABEL, Y as CatalogueContext, _ as CatalogueInput, $ as CompareContext, a0 as CompareHop, a1 as CompareOption, c as ComplianceCheck, a2 as ComplianceCheckId, a3 as ComplianceDecision, d as ComplianceTone, e as ComplianceView, a4 as CornerTag, a5 as DIRECT_CHECK_IDS, a6 as DIRECT_SCOPE_NOTE, a7 as Destination, a8 as FLOOR_CATEGORIES, a9 as GatewayEvmTx, aa as Hex, ab as InsteadFigures, ac as LaneAvailabilityState, L as LaneLimit, ad as MAX_QUOTE_CARDS, ae as Parity, af as PlannedTxKind, ag as PromotedAsset, ah as PromotedNetwork, ai as PromotionFunder, aj as PromotionKind, ak as PromotionToken, al as QuoteBlock, am as QuoteOption, an as ResolvedConfig, ao as RouteBadge, ap as RouteHealth, aq as RouteHealthAvailability, ar as RouteHealthLane, g as RouteLeg, as as SCREENING_BUCKETS, at as ScreenProvider, au as ScreeningBucket, av as ScreeningOutcome, aw as SwapEnds, ax as TUNABLE_CATEGORIES, ay as TagTone, az as TxPlan, V as VerifyResult, aA as WAIT_MAX_SEC, aB as WAIT_MIN_SEC, aC as WAIT_POSITIONS, aD as WAIT_STEP_SEC, aE as WaitScale, W as WalletScreen, aF as ZD_HEAVY_KEY_PREFIX, aG as amountFieldError, aH as apiError, j as assetClassOf, aI as bestOutputOption, aJ as blockLabelFor, aK as bonusFigure, aL as bonusPercentLabel, aM as brokenLaneFor, k as brokenLaneReason, aN as buildCatalogue, aO as canAttachApiKey, aP as categoryLabel, aQ as clampWait, aR as classifyQuoteError, aS as compareAmount, aT as compareDuration, aU as compareFeeUsd, aV as compareHops, aW as compareOptionOf, aX as compareOptionsOf, l as complianceChecks, aY as complianceControlsEvaluated, m as complianceControlsLine, aZ as complianceReasonHead, a_ as complianceReasonTag, a$ as complianceTagOf, n as complianceView, b0 as cornerTags, o as counterpartTokens, b1 as createApiClient, b2 as createVerifier, p as destinationAvailability, b3 as destinationKeys, b4 as directComplianceFromScreens, b5 as distinctScreenedWallets, b6 as estimateBonus, b7 as exceedsLaneLimit, b8 as executableRoutes, b9 as executionChainIds, ba as extraVsFastest, bb as fastestOption, q as formatJurisdiction, bc as fundedByLabel, bd as hasReachableDestination, be as hubDeliverableSymbols, r as humanizeComplianceReason, bf as insteadFigures, bg as isExecutableBridge, bh as isKnownUnbridgeable, bi as isSellableRwa, bj as isSourceToken, bk as laneAvailabilityState, bl as laneKey, bm as laneKeys, bn as laneLimitAmount, bo as laneLimitError, bp as laneLimitFor, bq as laneLimitHint, br as laneLimitSymbol, bs as limitedLanes, bt as pairPromotionsInto, bu as parity, bv as parseAllowedApiBase, bw as parsePromotion, bx as parsePromotions, by as pickForWait, bz as priceCompareOptions, bA as productAssets, bB as promotedAssets, bC as promotionFor, bD as proposedWait, bE as registryRpc, bF as resolveApiBase, bG as resolveConfig, bH as routeBadges, bI as routeShapeLabel, bJ as sameAddress, bK as screeningOutcomeOf, bL as selectableOptions, bM as snapWait, bN as sourceKeys, bO as suppressedLanes, bP as tokenKey, bQ as txMatchesPlan, bR as unattributedComplianceReasons, bS as usdStablePair, bT as visibleOptions, bU as waitFraction, bV as waitFromFraction, bW as waitLabel, bX as waitScaleFor, bY as zdHeavyOptionKey, bZ as zdHeavyUnavailableStatus } from '../verify-CeHRSKl2.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. */
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BUNDLED_SOLANA_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CANONICAL_SOLANA_PROGRAM, CENTIBIPS_PER_UNIT, 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_QUOTE_CARDS, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, SOLANA_CHAIN_ID, SOLANA_DESTINATION_ASSETS, SOL_SHORTFALL_MESSAGE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_DISCRIMINATOR, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SolanaSendError, TOKEN_2022_PROGRAM, TOKEN_PROGRAM, TRACKING, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, WAIT_MAX_SEC, WAIT_MIN_SEC, WAIT_POSITIONS, WAIT_STEP_SEC, WALLET_HISTORY_LIMIT, ZD_HEAVY_KEY_PREFIX, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, askCovers, askTokenDecimals, assertAddress, assertChainAddress, assertQuoteMatchesSelection, assertWalletMessage, assetClassOf, assetDecimals, associatedTokenAddress, base58Decode, base58Encode, base64Decode, base64Encode, bestOutputOption, blockLabelFor, bonusFigure, bonusPercentLabel, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSolanaSourcePlan, buildSwapPlan, bytes32Word, bytesEqual, bytesPayload, canAttachApiKey, categoryLabel, chainAddressKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, checkSolanaPlan as checkPlan, checkSolanaPlan, checkSolanaProgram, checkSolanaReceiver, checkSolanaRouteBuffer, clampWait, classifyQuoteError, compareAmount, compareDuration, compareFeeUsd, compareHops, compareOptionOf, compareOptionsOf, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, cornerTags, cosignSolanaEvent, counterpartTokens, createApiClient, createEngine, createSolanaRpc, createVerifier, decodeSolanaSubmitOrder, decodeSolanaSubmitOrder as decodeSubmitOrder, decodeSubmitOrderCalldata, deriveSolanaEvent, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeNextSolanaOrders, encodeSubmitOrder, encodeTransfer, estimateBonus, exceedsLaneLimit, executableRoutes, executeSolanaPlan, executeSolanaPlanStaged, executionChainIds, expectedSolanaDelivery, extraVsFastest, fastestOption, fetchDelivery, fetchPaymentPlan, fetchWalletHistory, finalOf, findProgramAddress, findToken, foldTicker, formatJurisdiction, formatNative, formatUnits, fundedByLabel, hasReachableDestination, hexBytes, hexToSolanaKey, historyEntryFromOrder, historyKey, hubDeliverableSymbols, humanizeComplianceReason, insteadFigures, isAddress, isChainAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSellableRwa, isSolanaAddress, isSolanaChainId, isSourceToken, isSubmitOrder, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, mergeHistory, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeDelivery, normalizeOrderRequest, normalizeOrderRequests, overwriteBlockhash, pairPromotionsInto, parity, parseAddressLookupTable, parseAllowedApiBase, parsePromotion, parsePromotions, parseSolanaTransaction, parseUnitsDecimal, pickForWait, placeSignature, planErrorSummary, planMsgValueHex, pollSolanaConfirmation, previewSolanaSource, priceCompareOptions, productAssets, promotedAssets, promotionFor, proposedWait, quotePartnerId, quotePayOption, quoteSolanaSource, quoteSwapPreview, readSolanaBalance, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSolanaKeys, resolveSwapReceiver, resolveVaultIcon, resultForOption, routeBadges, routeNativeValue, routeShapeLabel, safeTicker, sameAddress, scaleDecimals, screeningOutcomeOf, selectableOptions, serializeSolanaTransaction, sha256, simulateSolanaCost, snapWait, solanaBridgeOf, solanaDestinationAsset, solanaKeyBytes, solanaKeyHex, solanaLamportShortfall, solanaPlanNeedsPreparation, solanaQuoteCompliance, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, usdStablePair, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, verifySolanaSubmit as verifySubmit, verifySolanaTransaction as verifyTransaction, visibleOptions, waitFraction, waitFromFraction, waitLabel, waitScaleFor, withVaultArtwork, zdHeavyOptionKey, zdHeavyUnavailableStatus } from '../chunk-
|
|
1
|
+
export { API_CACHE_TTL_MS, BLOCK_LABEL_DEFAULT, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BUNDLED_SOLANA_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CANONICAL_SOLANA_PROGRAM, CENTIBIPS_PER_UNIT, 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_QUOTE_CARDS, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, SCREENING_BUCKETS, SCREEN_CACHE_TTL_MS, SOLANA_CHAIN_ID, SOLANA_DESTINATION_ASSETS, SOL_SHORTFALL_MESSAGE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_DISCRIMINATOR, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SolanaSendError, TOKEN_2022_PROGRAM, TOKEN_PROGRAM, TRACKING, TRADEABLE_RWA_ASSETS, TUNABLE_CATEGORIES, WAIT_MAX_SEC, WAIT_MIN_SEC, WAIT_POSITIONS, WAIT_STEP_SEC, WALLET_HISTORY_LIMIT, ZD_HEAVY_KEY_PREFIX, ZERO_ADDRESS, addressWord, allowanceCovers, amountFieldError, apiError, applyLayerZeroBuffer, askCovers, askTokenDecimals, assertAddress, assertChainAddress, assertQuoteMatchesSelection, assertWalletMessage, assetClassOf, assetDecimals, associatedTokenAddress, base58Decode, base58Encode, base64Decode, base64Encode, bestOutputOption, blockLabelFor, bonusFigure, bonusPercentLabel, brokenLaneFor, brokenLaneReason, buildCatalogue, buildPayOptions, buildRoute, buildSolanaSourcePlan, buildSwapPlan, bytes32Word, bytesEqual, bytesPayload, canAttachApiKey, categoryLabel, chainAddressKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, checkSolanaPlan as checkPlan, checkSolanaPlan, checkSolanaProgram, checkSolanaReceiver, checkSolanaRouteBuffer, clampWait, classifyQuoteError, compareAmount, compareDuration, compareFeeUsd, compareHops, compareOptionOf, compareOptionsOf, complianceChecks, complianceControlsEvaluated, complianceControlsLine, complianceReasonHead, complianceReasonTag, complianceTagOf, complianceView, cornerTags, cosignSolanaEvent, counterpartTokens, createApiClient, createEngine, createSolanaRpc, createVerifier, decodeSolanaSubmitOrder, decodeSolanaSubmitOrder as decodeSubmitOrder, decodeSubmitOrderCalldata, deriveSolanaEvent, destinationAvailability, destinationKeys, directComplianceFromScreens, distinctScreenedWallets, encodeAllowance, encodeApprove, encodeBalanceOf, encodeNextSolanaOrders, encodeSubmitOrder, encodeTransfer, estimateBonus, exceedsLaneLimit, executableRoutes, executeSolanaPlan, executeSolanaPlanStaged, executionChainIds, expectedSolanaDelivery, extraVsFastest, fastestOption, fetchDelivery, fetchPaymentPlan, fetchWalletHistory, finalOf, findProgramAddress, findToken, foldTicker, formatJurisdiction, formatNative, formatUnits, fundedByLabel, hasReachableDestination, hexBytes, hexToSolanaKey, historyEntryFromOrder, historyKey, hubDeliverableSymbols, humanizeComplianceReason, insteadFigures, isAddress, isChainAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSellableRwa, isSolanaAddress, isSolanaChainId, isSourceToken, isSubmitOrder, laneAvailabilityState, laneKey, laneKeys, laneLimitAmount, laneLimitError, laneLimitFor, laneLimitHint, laneLimitSymbol, limitedLanes, maxDeadlineSeconds, maxNativeFeeWei, mergeHistory, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeDelivery, normalizeOrderRequest, normalizeOrderRequests, overwriteBlockhash, pairPromotionsInto, parity, parseAddressLookupTable, parseAllowedApiBase, parsePromotion, parsePromotions, parseSolanaTransaction, parseUnitsDecimal, pickForWait, placeSignature, planErrorSummary, planMsgValueHex, pollSolanaConfirmation, previewSolanaSource, priceCompareOptions, productAssets, promotedAssets, promotionFor, proposedWait, quotePartnerId, quotePayOption, quoteSolanaSource, quoteSwapPreview, readSolanaBalance, recommendedDeadlineSeconds, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSolanaKeys, resolveSwapReceiver, resolveVaultIcon, resultForOption, routeBadges, routeNativeValue, routeShapeLabel, safeTicker, sameAddress, scaleDecimals, screeningOutcomeOf, selectableOptions, serializeSolanaTransaction, sha256, simulateSolanaCost, snapWait, solanaBridgeOf, solanaDestinationAsset, solanaKeyBytes, solanaKeyHex, solanaLamportShortfall, solanaPlanNeedsPreparation, solanaQuoteCompliance, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenKey, tokenTicker, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, usdStablePair, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, verifySolanaSubmit as verifySubmit, verifySolanaTransaction as verifyTransaction, visibleOptions, waitFraction, waitFromFraction, waitLabel, waitScaleFor, withVaultArtwork, zdHeavyOptionKey, zdHeavyUnavailableStatus } from '../chunk-KOFREX5L.js';
|