@glacislabs/stablegenie-zerodelta 4.0.0 → 4.1.1
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/README.md +52 -20
- package/dist/{chunk-ABI6ZH7O.js → chunk-6BYXMDVN.js} +214 -49
- package/dist/{chunk-FJQQLB2K.js → chunk-MQ4XLBVF.js} +167 -16
- package/dist/core/index.cjs +169 -15
- package/dist/core/index.d.cts +25 -4
- package/dist/core/index.d.ts +25 -4
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +381 -65
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-D5k_u92L.d.ts → mount-CoLgvvsE.d.ts} +1 -1
- package/dist/{mount-mcyZAzZc.d.cts → mount-Dz9LffFx.d.cts} +1 -1
- package/dist/mount.cjs +381 -65
- 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 +63 -7
- package/dist/{verify-C9vzpm4T.d.cts → verify-Bdw8-YWZ.d.cts} +74 -3
- package/dist/{verify-C9vzpm4T.d.ts → verify-Bdw8-YWZ.d.ts} +74 -3
- package/package.json +1 -1
|
@@ -531,10 +531,10 @@ function brokenLaneFor(token, source, brokenLanes) {
|
|
|
531
531
|
}
|
|
532
532
|
function destinationAvailability(token, ctx, source) {
|
|
533
533
|
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
return "available";
|
|
534
|
+
if (directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
535
|
+
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
536
|
+
if (token.isChainedDestination === true) return "available";
|
|
537
|
+
if (!isKnownUnbridgeable(token.bridge) && ctx.destination.has(tokenKey(token.chainId, token.address))) return "available";
|
|
538
538
|
}
|
|
539
539
|
return ctx.hubSymbols.has(symbolKey(token.symbol)) ? "hub-only" : "unreachable";
|
|
540
540
|
}
|
|
@@ -584,7 +584,7 @@ function buildCatalogue(input) {
|
|
|
584
584
|
);
|
|
585
585
|
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
586
586
|
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
587
|
-
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
587
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready, vaultIcons: input.vaultIcons ?? /* @__PURE__ */ new Map() };
|
|
588
588
|
}
|
|
589
589
|
|
|
590
590
|
// src/core/options.ts
|
|
@@ -726,7 +726,8 @@ function suppressedLanes(health) {
|
|
|
726
726
|
if (health?.mode !== "enforce" || !Array.isArray(health.lanes)) return EMPTY;
|
|
727
727
|
const out = /* @__PURE__ */ new Map();
|
|
728
728
|
for (const lane of health.lanes) {
|
|
729
|
-
|
|
729
|
+
const firewalled = lane?.status === "unknown" && lane?.kind === "firewalled";
|
|
730
|
+
if (lane?.status !== "broken" && !firewalled) continue;
|
|
730
731
|
const key = typeof lane.laneKey === "string" ? lane.laneKey.toLowerCase() : "";
|
|
731
732
|
if (!key) continue;
|
|
732
733
|
out.set(key, {
|
|
@@ -743,6 +744,8 @@ function brokenLaneReason(lane) {
|
|
|
743
744
|
switch (lane.kind) {
|
|
744
745
|
case "bridge-throttled":
|
|
745
746
|
return "The issuer's bridge for this pair is closed right now.";
|
|
747
|
+
case "firewalled":
|
|
748
|
+
return "This pair is temporarily unavailable.";
|
|
746
749
|
case "vault-closed":
|
|
747
750
|
return "This vault is not accepting deposits right now.";
|
|
748
751
|
default:
|
|
@@ -750,6 +753,34 @@ function brokenLaneReason(lane) {
|
|
|
750
753
|
}
|
|
751
754
|
}
|
|
752
755
|
|
|
756
|
+
// src/core/rwa-icons.ts
|
|
757
|
+
var GATEWAY_ICON_PREFIX = "/api/v1/rwa/icons/";
|
|
758
|
+
var ICON_FILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:png|jpg|jpeg|webp|gif)$/;
|
|
759
|
+
function resolveVaultIcon(apiBase, iconPath) {
|
|
760
|
+
if (typeof iconPath !== "string" || !iconPath.startsWith(GATEWAY_ICON_PREFIX)) return void 0;
|
|
761
|
+
const file = iconPath.slice(GATEWAY_ICON_PREFIX.length);
|
|
762
|
+
if (!ICON_FILE.test(file)) return void 0;
|
|
763
|
+
return `${apiBase.replace(/\/$/, "")}/rwa/icons/${file}`;
|
|
764
|
+
}
|
|
765
|
+
function vaultIconsBySymbol(apiBase, vaults) {
|
|
766
|
+
const out = /* @__PURE__ */ new Map();
|
|
767
|
+
for (const vault of vaults) {
|
|
768
|
+
const key = symbolKey(vault?.symbol);
|
|
769
|
+
if (!key || out.has(key)) continue;
|
|
770
|
+
const url = resolveVaultIcon(apiBase, vault?.iconMiniUrl) ?? resolveVaultIcon(apiBase, vault?.iconUrl);
|
|
771
|
+
if (url) out.set(key, url);
|
|
772
|
+
}
|
|
773
|
+
return out;
|
|
774
|
+
}
|
|
775
|
+
function withVaultArtwork(tokens, icons) {
|
|
776
|
+
if (!icons.size) return tokens;
|
|
777
|
+
return tokens.map((token) => {
|
|
778
|
+
if (token.logoUrl) return token;
|
|
779
|
+
const url = icons.get(symbolKey(token.symbol));
|
|
780
|
+
return url ? { ...token, logoUrl: url } : token;
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
|
|
753
784
|
// src/core/compliance.ts
|
|
754
785
|
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
755
786
|
function complianceView(compliance, hasQuote = true) {
|
|
@@ -1318,7 +1349,63 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
1318
1349
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
1319
1350
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
1320
1351
|
}
|
|
1321
|
-
|
|
1352
|
+
function tokenAt(tokens, chainId, address) {
|
|
1353
|
+
const wanted = normalizeAddress(address);
|
|
1354
|
+
if (!wanted || !tokens?.length) return void 0;
|
|
1355
|
+
return tokens.find((t) => Number(t.chainId) === Number(chainId) && normalizeAddress(t.address) === wanted);
|
|
1356
|
+
}
|
|
1357
|
+
function legAmount(raw, decimals) {
|
|
1358
|
+
if (decimals === void 0) return "";
|
|
1359
|
+
try {
|
|
1360
|
+
return formatUnits(raw || "0", decimals);
|
|
1361
|
+
} catch {
|
|
1362
|
+
return "";
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
function buildLegs(orders, ctx) {
|
|
1366
|
+
const legs = [];
|
|
1367
|
+
let fromChainId = ctx.option.chainId;
|
|
1368
|
+
let fromAsset = ctx.option.symbol;
|
|
1369
|
+
let fromDecimals = ctx.option.decimals;
|
|
1370
|
+
for (let index = 0; index < orders.length; index += 1) {
|
|
1371
|
+
const order = orders[index];
|
|
1372
|
+
const isLast = index === orders.length - 1;
|
|
1373
|
+
const toChainId = Number(order.destinationChainId);
|
|
1374
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
|
|
1375
|
+
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
1376
|
+
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
1377
|
+
const executionChainId = Number(order.executionChainId);
|
|
1378
|
+
legs.push({
|
|
1379
|
+
index: index + 1,
|
|
1380
|
+
fromAsset,
|
|
1381
|
+
fromChainId,
|
|
1382
|
+
fromChainName: chainNameOf(fromChainId, ctx.chains),
|
|
1383
|
+
fromAmount: legAmount(order.bidTokenAmount, fromDecimals),
|
|
1384
|
+
toAsset,
|
|
1385
|
+
toChainId,
|
|
1386
|
+
toChainName: chainNameOf(toChainId, ctx.chains),
|
|
1387
|
+
toAmount: legAmount(order.askTokenAmount, toDecimals),
|
|
1388
|
+
executionChainId,
|
|
1389
|
+
executionChainName: chainNameOf(executionChainId, ctx.chains)
|
|
1390
|
+
});
|
|
1391
|
+
fromChainId = toChainId;
|
|
1392
|
+
fromAsset = toAsset;
|
|
1393
|
+
fromDecimals = toDecimals;
|
|
1394
|
+
}
|
|
1395
|
+
return legs;
|
|
1396
|
+
}
|
|
1397
|
+
async function buildRoute({
|
|
1398
|
+
option,
|
|
1399
|
+
destination,
|
|
1400
|
+
destinationToken,
|
|
1401
|
+
chains,
|
|
1402
|
+
tokens,
|
|
1403
|
+
payer,
|
|
1404
|
+
fetchQuote,
|
|
1405
|
+
solve = solveExactOut,
|
|
1406
|
+
amountInRaw,
|
|
1407
|
+
compliance
|
|
1408
|
+
}) {
|
|
1322
1409
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
1323
1410
|
const quote = result.quote;
|
|
1324
1411
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1348,6 +1435,23 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1348
1435
|
},
|
|
1349
1436
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1350
1437
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1438
|
+
// A direct transfer submits no order at all, but it is still ONE hop and history renders the
|
|
1439
|
+
// same shape for it — an empty `legs` would leave "one order or two?" unanswerable for it alone.
|
|
1440
|
+
legs: [
|
|
1441
|
+
{
|
|
1442
|
+
index: 1,
|
|
1443
|
+
fromAsset: option.symbol,
|
|
1444
|
+
fromChainId: option.chainId,
|
|
1445
|
+
fromChainName: option.chainName,
|
|
1446
|
+
fromAmount: sourceAmount,
|
|
1447
|
+
toAsset: destinationToken.symbol,
|
|
1448
|
+
toChainId: Number(destination.chainId),
|
|
1449
|
+
toChainName: chainNameOf(Number(destination.chainId), chains),
|
|
1450
|
+
toAmount: receiveAmount,
|
|
1451
|
+
executionChainId: option.chainId,
|
|
1452
|
+
executionChainName: option.chainName
|
|
1453
|
+
}
|
|
1454
|
+
],
|
|
1351
1455
|
transactions: [
|
|
1352
1456
|
{
|
|
1353
1457
|
id: "transfer",
|
|
@@ -1421,6 +1525,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1421
1525
|
},
|
|
1422
1526
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1423
1527
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1528
|
+
legs: buildLegs(orders, { option, destinationToken, chains, tokens }),
|
|
1424
1529
|
transactions: [
|
|
1425
1530
|
{
|
|
1426
1531
|
id: "approve",
|
|
@@ -1528,7 +1633,8 @@ function createApiClient(cfg) {
|
|
|
1528
1633
|
chains: null,
|
|
1529
1634
|
tokens: null,
|
|
1530
1635
|
routes: null,
|
|
1531
|
-
health: null
|
|
1636
|
+
health: null,
|
|
1637
|
+
vaults: null
|
|
1532
1638
|
};
|
|
1533
1639
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1534
1640
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
@@ -1612,6 +1718,19 @@ function createApiClient(cfg) {
|
|
|
1612
1718
|
cache.health = { at: Date.now(), value };
|
|
1613
1719
|
return value;
|
|
1614
1720
|
}
|
|
1721
|
+
async function fetchRwaVaults() {
|
|
1722
|
+
if (nowFresh(cache.vaults)) return cache.vaults.value;
|
|
1723
|
+
let value = [];
|
|
1724
|
+
try {
|
|
1725
|
+
const payload = await apiRequest("/rwa/vaults?status=active,coming_soon", { timeoutMs: 8e3 });
|
|
1726
|
+
const rows = Array.isArray(payload) ? payload : payload?.vaults;
|
|
1727
|
+
value = Array.isArray(rows) ? rows.filter((v) => !!v && typeof v === "object") : [];
|
|
1728
|
+
} catch {
|
|
1729
|
+
value = [];
|
|
1730
|
+
}
|
|
1731
|
+
cache.vaults = { at: Date.now(), value };
|
|
1732
|
+
return value;
|
|
1733
|
+
}
|
|
1615
1734
|
async function fetchQuote(body, retries = 1) {
|
|
1616
1735
|
let lastError;
|
|
1617
1736
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -1651,7 +1770,7 @@ function createApiClient(cfg) {
|
|
|
1651
1770
|
screenInflight.set(key, request);
|
|
1652
1771
|
return request;
|
|
1653
1772
|
}
|
|
1654
|
-
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
1773
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
|
|
1655
1774
|
}
|
|
1656
1775
|
|
|
1657
1776
|
// src/core/plan.ts
|
|
@@ -1768,7 +1887,16 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1768
1887
|
}
|
|
1769
1888
|
const routeErrors = [];
|
|
1770
1889
|
const routePromises = candidates.map(
|
|
1771
|
-
(option) => buildRoute({
|
|
1890
|
+
(option) => buildRoute({
|
|
1891
|
+
option,
|
|
1892
|
+
destination,
|
|
1893
|
+
destinationToken,
|
|
1894
|
+
chains,
|
|
1895
|
+
tokens,
|
|
1896
|
+
payer,
|
|
1897
|
+
fetchQuote: api.fetchQuote,
|
|
1898
|
+
compliance: option.direct ? directCompliance ?? void 0 : void 0
|
|
1899
|
+
}).catch((error) => {
|
|
1772
1900
|
routeErrors.push(error);
|
|
1773
1901
|
return null;
|
|
1774
1902
|
})
|
|
@@ -1881,7 +2009,7 @@ async function buildSwapPlan(api, swap, payer, wallet = {}) {
|
|
|
1881
2009
|
direct: false
|
|
1882
2010
|
};
|
|
1883
2011
|
const destination = { address: receiver, chainId: v.toChainId, asset: destToken.symbol };
|
|
1884
|
-
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
2012
|
+
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, tokens, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
1885
2013
|
if (route.state === "SHORT") throw new Error("ZeroDelta could not price this swap right now.");
|
|
1886
2014
|
route.recommended = true;
|
|
1887
2015
|
return {
|
|
@@ -2291,6 +2419,24 @@ function resolveConfig(config = {}) {
|
|
|
2291
2419
|
}
|
|
2292
2420
|
|
|
2293
2421
|
// src/core/index.ts
|
|
2422
|
+
function sanitizeLegs(legs) {
|
|
2423
|
+
if (!Array.isArray(legs) || !legs.length) return void 0;
|
|
2424
|
+
const text = (v, max) => String(v ?? "").slice(0, max);
|
|
2425
|
+
const chain = (v) => Number(v) || 0;
|
|
2426
|
+
return legs.slice(0, 8).map((leg, i) => ({
|
|
2427
|
+
index: Number(leg?.index) || i + 1,
|
|
2428
|
+
fromAsset: text(leg?.fromAsset, 12),
|
|
2429
|
+
fromChainId: chain(leg?.fromChainId),
|
|
2430
|
+
fromChainName: text(leg?.fromChainName, 40),
|
|
2431
|
+
fromAmount: text(leg?.fromAmount, 40),
|
|
2432
|
+
toAsset: text(leg?.toAsset, 12),
|
|
2433
|
+
toChainId: chain(leg?.toChainId),
|
|
2434
|
+
toChainName: text(leg?.toChainName, 40),
|
|
2435
|
+
toAmount: text(leg?.toAmount, 40),
|
|
2436
|
+
executionChainId: chain(leg?.executionChainId),
|
|
2437
|
+
executionChainName: text(leg?.executionChainName, 40)
|
|
2438
|
+
}));
|
|
2439
|
+
}
|
|
2294
2440
|
function sanitizeTxEntry(entry) {
|
|
2295
2441
|
return {
|
|
2296
2442
|
kind: entry.kind === "swap" ? "swap" : "payment",
|
|
@@ -2306,7 +2452,8 @@ function sanitizeTxEntry(entry) {
|
|
|
2306
2452
|
recipient: isAddress(entry.recipient) ? normalizeAddress(entry.recipient) : "",
|
|
2307
2453
|
settlement: entry.settlement === "direct" ? "direct" : "escrow",
|
|
2308
2454
|
status: entry.status && ["confirmed", "unconfirmed", "error"].includes(entry.status) ? entry.status : "submitted",
|
|
2309
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2455
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2456
|
+
legs: sanitizeLegs(entry.legs)
|
|
2310
2457
|
};
|
|
2311
2458
|
}
|
|
2312
2459
|
function createEngine(config = {}) {
|
|
@@ -2323,12 +2470,15 @@ function createEngine(config = {}) {
|
|
|
2323
2470
|
fetchRouteHealth: api.fetchRouteHealth,
|
|
2324
2471
|
fetchQuote: api.fetchQuote,
|
|
2325
2472
|
fetchCatalogue: async (allowedAssets, product) => {
|
|
2326
|
-
const [chains,
|
|
2473
|
+
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
2327
2474
|
api.fetchChains().catch(() => []),
|
|
2328
2475
|
api.fetchTokens().catch(() => []),
|
|
2329
2476
|
api.fetchRoutes().catch(() => []),
|
|
2330
|
-
api.fetchRouteHealth()
|
|
2477
|
+
api.fetchRouteHealth(),
|
|
2478
|
+
api.fetchRwaVaults()
|
|
2331
2479
|
]);
|
|
2480
|
+
const vaultIcons = vaultIconsBySymbol(api.apiBase, vaults);
|
|
2481
|
+
const tokens = withVaultArtwork(registryTokens, vaultIcons);
|
|
2332
2482
|
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
2333
2483
|
return buildCatalogue({
|
|
2334
2484
|
chains,
|
|
@@ -2337,7 +2487,8 @@ function createEngine(config = {}) {
|
|
|
2337
2487
|
product,
|
|
2338
2488
|
...allowed ? { allowedAssets: allowed } : {},
|
|
2339
2489
|
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
2340
|
-
brokenLanes: suppressedLanes(health)
|
|
2490
|
+
brokenLanes: suppressedLanes(health),
|
|
2491
|
+
vaultIcons
|
|
2341
2492
|
});
|
|
2342
2493
|
},
|
|
2343
2494
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
@@ -2358,4 +2509,4 @@ function createEngine(config = {}) {
|
|
|
2358
2509
|
};
|
|
2359
2510
|
}
|
|
2360
2511
|
|
|
2361
|
-
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, 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, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneKey, laneKeys, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, routeNativeValue, scaleDecimals, screeningOutcomeOf, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, toHexQuantity, tokenEnabled, tokenKey, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap };
|
|
2512
|
+
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, 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, executableRoutes, executionChainIds, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, hasReachableDestination, hubDeliverableSymbols, humanizeComplianceReason, isAddress, isDeliverable, isExecutableBridge, isHexAddress, isHexData, isHexQuantity, isKnownUnbridgeable, isLayerZeroRoute, isSourceToken, laneKey, laneKeys, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, productAssets, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, scaleDecimals, screeningOutcomeOf, solveExactIn, solveExactOut, sourceKeys, stableGenieIntentSchema, strip0x, suppressedLanes, symbolKey, toHexQuantity, tokenEnabled, tokenKey, txMatchesPlan, uint64Word, uintWord, unattributedComplianceReasons, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
|
package/dist/core/index.cjs
CHANGED
|
@@ -533,10 +533,10 @@ function brokenLaneFor(token, source, brokenLanes) {
|
|
|
533
533
|
}
|
|
534
534
|
function destinationAvailability(token, ctx, source) {
|
|
535
535
|
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
536
|
-
if (
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
return "available";
|
|
536
|
+
if (directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
537
|
+
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
538
|
+
if (token.isChainedDestination === true) return "available";
|
|
539
|
+
if (!isKnownUnbridgeable(token.bridge) && ctx.destination.has(tokenKey(token.chainId, token.address))) return "available";
|
|
540
540
|
}
|
|
541
541
|
return ctx.hubSymbols.has(symbolKey(token.symbol)) ? "hub-only" : "unreachable";
|
|
542
542
|
}
|
|
@@ -586,7 +586,7 @@ function buildCatalogue(input) {
|
|
|
586
586
|
);
|
|
587
587
|
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
588
588
|
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
589
|
-
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
589
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready, vaultIcons: input.vaultIcons ?? /* @__PURE__ */ new Map() };
|
|
590
590
|
}
|
|
591
591
|
|
|
592
592
|
// src/core/options.ts
|
|
@@ -728,7 +728,8 @@ function suppressedLanes(health) {
|
|
|
728
728
|
if (health?.mode !== "enforce" || !Array.isArray(health.lanes)) return EMPTY;
|
|
729
729
|
const out = /* @__PURE__ */ new Map();
|
|
730
730
|
for (const lane of health.lanes) {
|
|
731
|
-
|
|
731
|
+
const firewalled = lane?.status === "unknown" && lane?.kind === "firewalled";
|
|
732
|
+
if (lane?.status !== "broken" && !firewalled) continue;
|
|
732
733
|
const key = typeof lane.laneKey === "string" ? lane.laneKey.toLowerCase() : "";
|
|
733
734
|
if (!key) continue;
|
|
734
735
|
out.set(key, {
|
|
@@ -745,6 +746,8 @@ function brokenLaneReason(lane) {
|
|
|
745
746
|
switch (lane.kind) {
|
|
746
747
|
case "bridge-throttled":
|
|
747
748
|
return "The issuer's bridge for this pair is closed right now.";
|
|
749
|
+
case "firewalled":
|
|
750
|
+
return "This pair is temporarily unavailable.";
|
|
748
751
|
case "vault-closed":
|
|
749
752
|
return "This vault is not accepting deposits right now.";
|
|
750
753
|
default:
|
|
@@ -752,6 +755,34 @@ function brokenLaneReason(lane) {
|
|
|
752
755
|
}
|
|
753
756
|
}
|
|
754
757
|
|
|
758
|
+
// src/core/rwa-icons.ts
|
|
759
|
+
var GATEWAY_ICON_PREFIX = "/api/v1/rwa/icons/";
|
|
760
|
+
var ICON_FILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:png|jpg|jpeg|webp|gif)$/;
|
|
761
|
+
function resolveVaultIcon(apiBase, iconPath) {
|
|
762
|
+
if (typeof iconPath !== "string" || !iconPath.startsWith(GATEWAY_ICON_PREFIX)) return void 0;
|
|
763
|
+
const file = iconPath.slice(GATEWAY_ICON_PREFIX.length);
|
|
764
|
+
if (!ICON_FILE.test(file)) return void 0;
|
|
765
|
+
return `${apiBase.replace(/\/$/, "")}/rwa/icons/${file}`;
|
|
766
|
+
}
|
|
767
|
+
function vaultIconsBySymbol(apiBase, vaults) {
|
|
768
|
+
const out = /* @__PURE__ */ new Map();
|
|
769
|
+
for (const vault of vaults) {
|
|
770
|
+
const key = symbolKey(vault?.symbol);
|
|
771
|
+
if (!key || out.has(key)) continue;
|
|
772
|
+
const url = resolveVaultIcon(apiBase, vault?.iconMiniUrl) ?? resolveVaultIcon(apiBase, vault?.iconUrl);
|
|
773
|
+
if (url) out.set(key, url);
|
|
774
|
+
}
|
|
775
|
+
return out;
|
|
776
|
+
}
|
|
777
|
+
function withVaultArtwork(tokens, icons) {
|
|
778
|
+
if (!icons.size) return tokens;
|
|
779
|
+
return tokens.map((token) => {
|
|
780
|
+
if (token.logoUrl) return token;
|
|
781
|
+
const url = icons.get(symbolKey(token.symbol));
|
|
782
|
+
return url ? { ...token, logoUrl: url } : token;
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
|
|
755
786
|
// src/core/compliance.ts
|
|
756
787
|
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
757
788
|
function complianceView(compliance, hasQuote = true) {
|
|
@@ -1320,7 +1351,63 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
1320
1351
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
1321
1352
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
1322
1353
|
}
|
|
1323
|
-
|
|
1354
|
+
function tokenAt(tokens, chainId, address) {
|
|
1355
|
+
const wanted = normalizeAddress(address);
|
|
1356
|
+
if (!wanted || !tokens?.length) return void 0;
|
|
1357
|
+
return tokens.find((t) => Number(t.chainId) === Number(chainId) && normalizeAddress(t.address) === wanted);
|
|
1358
|
+
}
|
|
1359
|
+
function legAmount(raw, decimals) {
|
|
1360
|
+
if (decimals === void 0) return "";
|
|
1361
|
+
try {
|
|
1362
|
+
return formatUnits(raw || "0", decimals);
|
|
1363
|
+
} catch {
|
|
1364
|
+
return "";
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
function buildLegs(orders, ctx) {
|
|
1368
|
+
const legs = [];
|
|
1369
|
+
let fromChainId = ctx.option.chainId;
|
|
1370
|
+
let fromAsset = ctx.option.symbol;
|
|
1371
|
+
let fromDecimals = ctx.option.decimals;
|
|
1372
|
+
for (let index = 0; index < orders.length; index += 1) {
|
|
1373
|
+
const order = orders[index];
|
|
1374
|
+
const isLast = index === orders.length - 1;
|
|
1375
|
+
const toChainId = Number(order.destinationChainId);
|
|
1376
|
+
const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
|
|
1377
|
+
const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
|
|
1378
|
+
const toDecimals = askToken ? assetDecimals(askToken) : void 0;
|
|
1379
|
+
const executionChainId = Number(order.executionChainId);
|
|
1380
|
+
legs.push({
|
|
1381
|
+
index: index + 1,
|
|
1382
|
+
fromAsset,
|
|
1383
|
+
fromChainId,
|
|
1384
|
+
fromChainName: chainNameOf(fromChainId, ctx.chains),
|
|
1385
|
+
fromAmount: legAmount(order.bidTokenAmount, fromDecimals),
|
|
1386
|
+
toAsset,
|
|
1387
|
+
toChainId,
|
|
1388
|
+
toChainName: chainNameOf(toChainId, ctx.chains),
|
|
1389
|
+
toAmount: legAmount(order.askTokenAmount, toDecimals),
|
|
1390
|
+
executionChainId,
|
|
1391
|
+
executionChainName: chainNameOf(executionChainId, ctx.chains)
|
|
1392
|
+
});
|
|
1393
|
+
fromChainId = toChainId;
|
|
1394
|
+
fromAsset = toAsset;
|
|
1395
|
+
fromDecimals = toDecimals;
|
|
1396
|
+
}
|
|
1397
|
+
return legs;
|
|
1398
|
+
}
|
|
1399
|
+
async function buildRoute({
|
|
1400
|
+
option,
|
|
1401
|
+
destination,
|
|
1402
|
+
destinationToken,
|
|
1403
|
+
chains,
|
|
1404
|
+
tokens,
|
|
1405
|
+
payer,
|
|
1406
|
+
fetchQuote,
|
|
1407
|
+
solve = solveExactOut,
|
|
1408
|
+
amountInRaw,
|
|
1409
|
+
compliance
|
|
1410
|
+
}) {
|
|
1324
1411
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
1325
1412
|
const quote = result.quote;
|
|
1326
1413
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -1350,6 +1437,23 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1350
1437
|
},
|
|
1351
1438
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1352
1439
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1440
|
+
// A direct transfer submits no order at all, but it is still ONE hop and history renders the
|
|
1441
|
+
// same shape for it — an empty `legs` would leave "one order or two?" unanswerable for it alone.
|
|
1442
|
+
legs: [
|
|
1443
|
+
{
|
|
1444
|
+
index: 1,
|
|
1445
|
+
fromAsset: option.symbol,
|
|
1446
|
+
fromChainId: option.chainId,
|
|
1447
|
+
fromChainName: option.chainName,
|
|
1448
|
+
fromAmount: sourceAmount,
|
|
1449
|
+
toAsset: destinationToken.symbol,
|
|
1450
|
+
toChainId: Number(destination.chainId),
|
|
1451
|
+
toChainName: chainNameOf(Number(destination.chainId), chains),
|
|
1452
|
+
toAmount: receiveAmount,
|
|
1453
|
+
executionChainId: option.chainId,
|
|
1454
|
+
executionChainName: option.chainName
|
|
1455
|
+
}
|
|
1456
|
+
],
|
|
1353
1457
|
transactions: [
|
|
1354
1458
|
{
|
|
1355
1459
|
id: "transfer",
|
|
@@ -1423,6 +1527,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
1423
1527
|
},
|
|
1424
1528
|
routeLabel: routeLabelFor(option, destinationToken, result),
|
|
1425
1529
|
deltaLabel: routeDeltaLabel(result, quote),
|
|
1530
|
+
legs: buildLegs(orders, { option, destinationToken, chains, tokens }),
|
|
1426
1531
|
transactions: [
|
|
1427
1532
|
{
|
|
1428
1533
|
id: "approve",
|
|
@@ -1530,7 +1635,8 @@ function createApiClient(cfg) {
|
|
|
1530
1635
|
chains: null,
|
|
1531
1636
|
tokens: null,
|
|
1532
1637
|
routes: null,
|
|
1533
|
-
health: null
|
|
1638
|
+
health: null,
|
|
1639
|
+
vaults: null
|
|
1534
1640
|
};
|
|
1535
1641
|
const screenCache = /* @__PURE__ */ new Map();
|
|
1536
1642
|
const screenInflight = /* @__PURE__ */ new Map();
|
|
@@ -1614,6 +1720,19 @@ function createApiClient(cfg) {
|
|
|
1614
1720
|
cache.health = { at: Date.now(), value };
|
|
1615
1721
|
return value;
|
|
1616
1722
|
}
|
|
1723
|
+
async function fetchRwaVaults() {
|
|
1724
|
+
if (nowFresh(cache.vaults)) return cache.vaults.value;
|
|
1725
|
+
let value = [];
|
|
1726
|
+
try {
|
|
1727
|
+
const payload = await apiRequest("/rwa/vaults?status=active,coming_soon", { timeoutMs: 8e3 });
|
|
1728
|
+
const rows = Array.isArray(payload) ? payload : payload?.vaults;
|
|
1729
|
+
value = Array.isArray(rows) ? rows.filter((v) => !!v && typeof v === "object") : [];
|
|
1730
|
+
} catch {
|
|
1731
|
+
value = [];
|
|
1732
|
+
}
|
|
1733
|
+
cache.vaults = { at: Date.now(), value };
|
|
1734
|
+
return value;
|
|
1735
|
+
}
|
|
1617
1736
|
async function fetchQuote(body, retries = 1) {
|
|
1618
1737
|
let lastError;
|
|
1619
1738
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -1653,7 +1772,7 @@ function createApiClient(cfg) {
|
|
|
1653
1772
|
screenInflight.set(key, request);
|
|
1654
1773
|
return request;
|
|
1655
1774
|
}
|
|
1656
|
-
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
1775
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
|
|
1657
1776
|
}
|
|
1658
1777
|
|
|
1659
1778
|
// src/core/plan.ts
|
|
@@ -1770,7 +1889,16 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1770
1889
|
}
|
|
1771
1890
|
const routeErrors = [];
|
|
1772
1891
|
const routePromises = candidates.map(
|
|
1773
|
-
(option) => buildRoute({
|
|
1892
|
+
(option) => buildRoute({
|
|
1893
|
+
option,
|
|
1894
|
+
destination,
|
|
1895
|
+
destinationToken,
|
|
1896
|
+
chains,
|
|
1897
|
+
tokens,
|
|
1898
|
+
payer,
|
|
1899
|
+
fetchQuote: api.fetchQuote,
|
|
1900
|
+
compliance: option.direct ? directCompliance ?? void 0 : void 0
|
|
1901
|
+
}).catch((error) => {
|
|
1774
1902
|
routeErrors.push(error);
|
|
1775
1903
|
return null;
|
|
1776
1904
|
})
|
|
@@ -1883,7 +2011,7 @@ async function buildSwapPlan(api, swap, payer, wallet = {}) {
|
|
|
1883
2011
|
direct: false
|
|
1884
2012
|
};
|
|
1885
2013
|
const destination = { address: receiver, chainId: v.toChainId, asset: destToken.symbol };
|
|
1886
|
-
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
2014
|
+
const route = await buildRoute({ option, destination, destinationToken: destToken, chains, tokens, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
|
|
1887
2015
|
if (route.state === "SHORT") throw new Error("ZeroDelta could not price this swap right now.");
|
|
1888
2016
|
route.recommended = true;
|
|
1889
2017
|
return {
|
|
@@ -2293,6 +2421,24 @@ function resolveConfig(config = {}) {
|
|
|
2293
2421
|
}
|
|
2294
2422
|
|
|
2295
2423
|
// src/core/index.ts
|
|
2424
|
+
function sanitizeLegs(legs) {
|
|
2425
|
+
if (!Array.isArray(legs) || !legs.length) return void 0;
|
|
2426
|
+
const text = (v, max) => String(v ?? "").slice(0, max);
|
|
2427
|
+
const chain = (v) => Number(v) || 0;
|
|
2428
|
+
return legs.slice(0, 8).map((leg, i) => ({
|
|
2429
|
+
index: Number(leg?.index) || i + 1,
|
|
2430
|
+
fromAsset: text(leg?.fromAsset, 12),
|
|
2431
|
+
fromChainId: chain(leg?.fromChainId),
|
|
2432
|
+
fromChainName: text(leg?.fromChainName, 40),
|
|
2433
|
+
fromAmount: text(leg?.fromAmount, 40),
|
|
2434
|
+
toAsset: text(leg?.toAsset, 12),
|
|
2435
|
+
toChainId: chain(leg?.toChainId),
|
|
2436
|
+
toChainName: text(leg?.toChainName, 40),
|
|
2437
|
+
toAmount: text(leg?.toAmount, 40),
|
|
2438
|
+
executionChainId: chain(leg?.executionChainId),
|
|
2439
|
+
executionChainName: text(leg?.executionChainName, 40)
|
|
2440
|
+
}));
|
|
2441
|
+
}
|
|
2296
2442
|
function sanitizeTxEntry(entry) {
|
|
2297
2443
|
return {
|
|
2298
2444
|
kind: entry.kind === "swap" ? "swap" : "payment",
|
|
@@ -2308,7 +2454,8 @@ function sanitizeTxEntry(entry) {
|
|
|
2308
2454
|
recipient: isAddress(entry.recipient) ? normalizeAddress(entry.recipient) : "",
|
|
2309
2455
|
settlement: entry.settlement === "direct" ? "direct" : "escrow",
|
|
2310
2456
|
status: entry.status && ["confirmed", "unconfirmed", "error"].includes(entry.status) ? entry.status : "submitted",
|
|
2311
|
-
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
2457
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2458
|
+
legs: sanitizeLegs(entry.legs)
|
|
2312
2459
|
};
|
|
2313
2460
|
}
|
|
2314
2461
|
function createEngine(config = {}) {
|
|
@@ -2325,12 +2472,15 @@ function createEngine(config = {}) {
|
|
|
2325
2472
|
fetchRouteHealth: api.fetchRouteHealth,
|
|
2326
2473
|
fetchQuote: api.fetchQuote,
|
|
2327
2474
|
fetchCatalogue: async (allowedAssets, product) => {
|
|
2328
|
-
const [chains,
|
|
2475
|
+
const [chains, registryTokens, routes, health, vaults] = await Promise.all([
|
|
2329
2476
|
api.fetchChains().catch(() => []),
|
|
2330
2477
|
api.fetchTokens().catch(() => []),
|
|
2331
2478
|
api.fetchRoutes().catch(() => []),
|
|
2332
|
-
api.fetchRouteHealth()
|
|
2479
|
+
api.fetchRouteHealth(),
|
|
2480
|
+
api.fetchRwaVaults()
|
|
2333
2481
|
]);
|
|
2482
|
+
const vaultIcons = vaultIconsBySymbol(api.apiBase, vaults);
|
|
2483
|
+
const tokens = withVaultArtwork(registryTokens, vaultIcons);
|
|
2334
2484
|
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
2335
2485
|
return buildCatalogue({
|
|
2336
2486
|
chains,
|
|
@@ -2339,7 +2489,8 @@ function createEngine(config = {}) {
|
|
|
2339
2489
|
product,
|
|
2340
2490
|
...allowed ? { allowedAssets: allowed } : {},
|
|
2341
2491
|
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
2342
|
-
brokenLanes: suppressedLanes(health)
|
|
2492
|
+
brokenLanes: suppressedLanes(health),
|
|
2493
|
+
vaultIcons
|
|
2343
2494
|
});
|
|
2344
2495
|
},
|
|
2345
2496
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
@@ -2488,6 +2639,7 @@ exports.requiresNativeBridgeFee = requiresNativeBridgeFee;
|
|
|
2488
2639
|
exports.resolveApiBase = resolveApiBase;
|
|
2489
2640
|
exports.resolveConfig = resolveConfig;
|
|
2490
2641
|
exports.resolveSwapReceiver = resolveSwapReceiver;
|
|
2642
|
+
exports.resolveVaultIcon = resolveVaultIcon;
|
|
2491
2643
|
exports.routeNativeValue = routeNativeValue;
|
|
2492
2644
|
exports.scaleDecimals = scaleDecimals;
|
|
2493
2645
|
exports.screeningOutcomeOf = screeningOutcomeOf;
|
|
@@ -2508,3 +2660,5 @@ exports.unattributedComplianceReasons = unattributedComplianceReasons;
|
|
|
2508
2660
|
exports.validateDestination = validateDestination;
|
|
2509
2661
|
exports.validatePlannedTransaction = validatePlannedTransaction;
|
|
2510
2662
|
exports.validateSwap = validateSwap;
|
|
2663
|
+
exports.vaultIconsBySymbol = vaultIconsBySymbol;
|
|
2664
|
+
exports.withVaultArtwork = withVaultArtwork;
|