@rash2x/bridge-widget 0.6.75 → 0.6.77
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/evaa-bridge.cjs +1 -1
- package/dist/evaa-bridge.mjs +1 -1
- package/dist/{index-DxQZLKun.cjs → index-Bwsox4tK.cjs} +2 -2
- package/dist/{index-DxQZLKun.cjs.map → index-Bwsox4tK.cjs.map} +1 -1
- package/dist/{index-CoLBqDP8.js → index-Cf0s9o1V.js} +237 -255
- package/dist/index-Cf0s9o1V.js.map +1 -0
- package/dist/{index-CAsaCbOJ.cjs → index-CmGINAdQ.cjs} +237 -255
- package/dist/index-CmGINAdQ.cjs.map +1 -0
- package/dist/{index-BduwbWx8.js → index-aQ85eLjl.js} +2 -2
- package/dist/{index-BduwbWx8.js.map → index-aQ85eLjl.js.map} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/index-CAsaCbOJ.cjs.map +0 -1
- package/dist/index-CoLBqDP8.js.map +0 -1
|
@@ -300,6 +300,7 @@ const useChainsStore = zustand.create()(
|
|
|
300
300
|
allowedFromChains: void 0,
|
|
301
301
|
allowedToChains: void 0,
|
|
302
302
|
isLoadingToChains: false,
|
|
303
|
+
isUrlInitialized: false,
|
|
303
304
|
setChains: async (data) => {
|
|
304
305
|
const prev = get2().chains;
|
|
305
306
|
const same = (() => {
|
|
@@ -353,6 +354,7 @@ const useChainsStore = zustand.create()(
|
|
|
353
354
|
set2({ allowedToChains: data });
|
|
354
355
|
},
|
|
355
356
|
setIsLoadingToChains: (v2) => set2({ isLoadingToChains: v2 }),
|
|
357
|
+
setIsUrlInitialized: (v2) => set2({ isUrlInitialized: v2 }),
|
|
356
358
|
swapChains: () => set2((state2) => ({
|
|
357
359
|
fromChain: state2.toChain,
|
|
358
360
|
toChain: state2.fromChain
|
|
@@ -1323,34 +1325,6 @@ async function getDestTokens(srcChainKey, srcTokenAddr) {
|
|
|
1323
1325
|
});
|
|
1324
1326
|
return unique.map(normalizeTokenSymbol);
|
|
1325
1327
|
}
|
|
1326
|
-
function parseBridgeUrlParams(source) {
|
|
1327
|
-
if (source && typeof source === "object") {
|
|
1328
|
-
return source;
|
|
1329
|
-
}
|
|
1330
|
-
const queryString = typeof source === "string" ? source : typeof window !== "undefined" ? window.location.search : "";
|
|
1331
|
-
const searchParams = new URLSearchParams(queryString);
|
|
1332
|
-
return {
|
|
1333
|
-
srcToken: searchParams.get("srcToken") || void 0,
|
|
1334
|
-
srcChain: searchParams.get("srcChain") || void 0,
|
|
1335
|
-
dstChain: searchParams.get("dstChain") || void 0,
|
|
1336
|
-
amount: searchParams.get("amount") || void 0
|
|
1337
|
-
};
|
|
1338
|
-
}
|
|
1339
|
-
function buildQueryString(params) {
|
|
1340
|
-
const searchParams = new URLSearchParams();
|
|
1341
|
-
if (params.srcToken) searchParams.set("srcToken", params.srcToken);
|
|
1342
|
-
if (params.srcChain) searchParams.set("srcChain", params.srcChain);
|
|
1343
|
-
if (params.dstChain) searchParams.set("dstChain", params.dstChain);
|
|
1344
|
-
if (params.amount) searchParams.set("amount", params.amount);
|
|
1345
|
-
const queryString = searchParams.toString();
|
|
1346
|
-
return queryString ? `?${queryString}` : "";
|
|
1347
|
-
}
|
|
1348
|
-
function updateBridgeUrlNative(params) {
|
|
1349
|
-
if (typeof window === "undefined" || !window.history) return;
|
|
1350
|
-
const queryString = buildQueryString(params);
|
|
1351
|
-
const newUrl = `${window.location.pathname}${queryString}${window.location.hash}`;
|
|
1352
|
-
window.history.replaceState(null, "", newUrl);
|
|
1353
|
-
}
|
|
1354
1328
|
function resolveTokenOnChainFromMatrix$1(assetMatrix, assetSymbol, chainKey) {
|
|
1355
1329
|
if (!assetMatrix || !assetSymbol || !chainKey) return void 0;
|
|
1356
1330
|
const byChain = assetMatrix[assetSymbol.toUpperCase()];
|
|
@@ -1369,7 +1343,8 @@ const useChainDerivations = () => {
|
|
|
1369
1343
|
allowedToChains,
|
|
1370
1344
|
setAllowedToChains,
|
|
1371
1345
|
isLoadingToChains,
|
|
1372
|
-
setIsLoadingToChains
|
|
1346
|
+
setIsLoadingToChains,
|
|
1347
|
+
isUrlInitialized
|
|
1373
1348
|
} = useChainsStore();
|
|
1374
1349
|
const supportedFrom = react.useMemo(() => {
|
|
1375
1350
|
if (typeof selectedAssetSymbol !== "string" || !assetMatrix || !chains?.length)
|
|
@@ -1380,10 +1355,8 @@ const useChainDerivations = () => {
|
|
|
1380
1355
|
return result;
|
|
1381
1356
|
}, [selectedAssetSymbol, assetMatrix, chains]);
|
|
1382
1357
|
react.useEffect(() => {
|
|
1383
|
-
const urlParams = parseBridgeUrlParams();
|
|
1384
|
-
const hasUrlParams = !!urlParams.srcToken || !!urlParams.srcChain || !!urlParams.dstChain;
|
|
1385
1358
|
setAllowedFromChains(supportedFrom);
|
|
1386
|
-
if (
|
|
1359
|
+
if (!isUrlInitialized) {
|
|
1387
1360
|
return;
|
|
1388
1361
|
}
|
|
1389
1362
|
if (!supportedFrom.length) {
|
|
@@ -1409,7 +1382,8 @@ const useChainDerivations = () => {
|
|
|
1409
1382
|
setAllowedFromChains,
|
|
1410
1383
|
setFromChain,
|
|
1411
1384
|
setToChain,
|
|
1412
|
-
setAllowedToChains
|
|
1385
|
+
setAllowedToChains,
|
|
1386
|
+
isUrlInitialized
|
|
1413
1387
|
]);
|
|
1414
1388
|
react.useEffect(() => {
|
|
1415
1389
|
let ignore = false;
|
|
@@ -1451,8 +1425,10 @@ const useChainDerivations = () => {
|
|
|
1451
1425
|
list = list.filter((c2) => c2.chainKey !== fromChain.chainKey);
|
|
1452
1426
|
}
|
|
1453
1427
|
setAllowedToChains(list);
|
|
1454
|
-
if (
|
|
1455
|
-
|
|
1428
|
+
if (isUrlInitialized) {
|
|
1429
|
+
if (!toChain || !list.some((c2) => c2.chainKey === toChain.chainKey)) {
|
|
1430
|
+
setToChain(list[0]);
|
|
1431
|
+
}
|
|
1456
1432
|
}
|
|
1457
1433
|
} catch (e2) {
|
|
1458
1434
|
if (!ignore) {
|
|
@@ -1476,7 +1452,8 @@ const useChainDerivations = () => {
|
|
|
1476
1452
|
toChain,
|
|
1477
1453
|
setAllowedToChains,
|
|
1478
1454
|
setToChain,
|
|
1479
|
-
setIsLoadingToChains
|
|
1455
|
+
setIsLoadingToChains,
|
|
1456
|
+
isUrlInitialized
|
|
1480
1457
|
]);
|
|
1481
1458
|
return {
|
|
1482
1459
|
allowedFromChains,
|
|
@@ -2382,58 +2359,51 @@ const ChainSelectModal = ({
|
|
|
2382
2359
|
chain2.chainKey
|
|
2383
2360
|
);
|
|
2384
2361
|
};
|
|
2385
|
-
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2386
|
-
dialog.
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col", children: [
|
|
2363
|
+
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "text-left pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-xl leading-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0", children: [
|
|
2364
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: t2("bridge.select") }),
|
|
2365
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: t2(
|
|
2366
|
+
isSource ? "bridge.sourceNetwork" : "bridge.destinationNetwork"
|
|
2367
|
+
) })
|
|
2368
|
+
] }) }) }),
|
|
2369
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2370
|
+
SearchInput,
|
|
2371
|
+
{
|
|
2372
|
+
placeholder: t2("bridge.search"),
|
|
2373
|
+
value: query,
|
|
2374
|
+
onChange: setQuery,
|
|
2375
|
+
className: "text-foreground placeholder:text-muted-foreground"
|
|
2376
|
+
}
|
|
2377
|
+
),
|
|
2378
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30", children: [
|
|
2379
|
+
groupedChains.available.length > 0 && groupedChains.available.map((c2) => renderChainItem(c2, false)),
|
|
2380
|
+
groupedChains.willChangeSrc.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2397
2381
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2398
|
-
|
|
2382
|
+
"p",
|
|
2399
2383
|
{
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
onChange: setQuery,
|
|
2403
|
-
className: "text-foreground placeholder:text-muted-foreground"
|
|
2384
|
+
className: `px-5 py-2 leading-4 text-base font-semibold text-muted-foreground uppercase ${groupedChains.available.length > 0 ? "mt-10" : ""}`,
|
|
2385
|
+
children: t2("bridge.willChangeSourceChain")
|
|
2404
2386
|
}
|
|
2405
2387
|
),
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
)
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
children: t2("bridge.willChangeSourceNetworkAndToken")
|
|
2426
|
-
}
|
|
2427
|
-
),
|
|
2428
|
-
groupedChains.willChangeTokenAndSrc.map(
|
|
2429
|
-
(c2) => renderChainItem(c2, false, true)
|
|
2430
|
-
)
|
|
2431
|
-
] }),
|
|
2432
|
-
groupedChains.available.length === 0 && groupedChains.willChangeSrc.length === 0 && groupedChains.willChangeTokenAndSrc.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t2("bridge.chainNotFound") })
|
|
2433
|
-
] })
|
|
2434
|
-
]
|
|
2435
|
-
}
|
|
2436
|
-
) });
|
|
2388
|
+
groupedChains.willChangeSrc.map(
|
|
2389
|
+
(c2) => renderChainItem(c2, true, false)
|
|
2390
|
+
)
|
|
2391
|
+
] }),
|
|
2392
|
+
groupedChains.willChangeTokenAndSrc.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2393
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2394
|
+
"p",
|
|
2395
|
+
{
|
|
2396
|
+
className: `px-5 py-2 leading-4 text-base font-semibold text-muted-foreground uppercase ${groupedChains.available.length > 0 || groupedChains.willChangeSrc.length > 0 ? "mt-10" : ""}`,
|
|
2397
|
+
children: t2("bridge.willChangeSourceNetworkAndToken")
|
|
2398
|
+
}
|
|
2399
|
+
),
|
|
2400
|
+
groupedChains.willChangeTokenAndSrc.map(
|
|
2401
|
+
(c2) => renderChainItem(c2, false, true)
|
|
2402
|
+
)
|
|
2403
|
+
] }),
|
|
2404
|
+
groupedChains.available.length === 0 && groupedChains.willChangeSrc.length === 0 && groupedChains.willChangeTokenAndSrc.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t2("bridge.chainNotFound") })
|
|
2405
|
+
] })
|
|
2406
|
+
] }) });
|
|
2437
2407
|
};
|
|
2438
2408
|
const useWalletSelectModal = zustand.create((set2) => ({
|
|
2439
2409
|
isOpen: false,
|
|
@@ -4162,7 +4132,7 @@ const WalletSelectModal = () => {
|
|
|
4162
4132
|
}
|
|
4163
4133
|
return a2.order - b2.order;
|
|
4164
4134
|
});
|
|
4165
|
-
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, {
|
|
4135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { children: [
|
|
4166
4136
|
/* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogHeader, { className: "text-left", children: [
|
|
4167
4137
|
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t2("wallets.chooseWallet") }),
|
|
4168
4138
|
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogDescription, { children: t2("wallets.oneWalletPerEnv") })
|
|
@@ -6498,103 +6468,96 @@ const SettingsModal = ({ isOpen, onClose }) => {
|
|
|
6498
6468
|
);
|
|
6499
6469
|
const activeBtn = "bg-primary hover:bg-primary/80 text-primary-foreground transition-colors";
|
|
6500
6470
|
const notActiveBtn = "bg-accent hover:bg-accent/80 text-accent-foreground transition-colors";
|
|
6501
|
-
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6502
|
-
dialog.
|
|
6503
|
-
{
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
6510
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
6511
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6512
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.gasOnDestination") }),
|
|
6513
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.gasOnDestinationDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
|
|
6514
|
-
] }),
|
|
6515
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground text-sm font-medium leading-4", children: formatUsd(gasUsdValue) })
|
|
6516
|
-
] }),
|
|
6517
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
6518
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center w-1/3 gap-2 shrink-0", children: [
|
|
6519
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6520
|
-
TokenSymbol,
|
|
6521
|
-
{
|
|
6522
|
-
symbol: dstNativeToken?.symbol || "eth",
|
|
6523
|
-
className: "h-4 w-4 rounded-full",
|
|
6524
|
-
alt: dstNativeToken?.symbol || t2("common.nativeToken", { defaultValue: "Native Token" })
|
|
6525
|
-
}
|
|
6526
|
-
),
|
|
6527
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg text-foreground leading-5 font-semibold h-5", children: gasDisplayAmount % 1 === 0 ? gasDisplayAmount.toFixed(0) : gasDisplayAmount.toFixed(
|
|
6528
|
-
gasDisplayAmount < 1e-3 ? 6 : 3
|
|
6529
|
-
) }) })
|
|
6530
|
-
] }),
|
|
6531
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: gasPresets.map((g2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6532
|
-
badge.Badge,
|
|
6533
|
-
{
|
|
6534
|
-
onClick: () => setGasPreset(g2),
|
|
6535
|
-
className: utils$1.cn(
|
|
6536
|
-
"cursor-pointer h-7 rounded px-2",
|
|
6537
|
-
gasPreset === g2 ? activeBtn : notActiveBtn
|
|
6538
|
-
),
|
|
6539
|
-
children: t2(`settings.gasPresets.${g2}`)
|
|
6540
|
-
},
|
|
6541
|
-
g2
|
|
6542
|
-
)) })
|
|
6543
|
-
] })
|
|
6471
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { onOpenAutoFocus: (e2) => e2.preventDefault(), children: [
|
|
6472
|
+
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "text-left", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t2("settings.title") }) }),
|
|
6473
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-5 flex-1 pt-4", children: [
|
|
6474
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
6475
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
6476
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6477
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.gasOnDestination") }),
|
|
6478
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.gasOnDestinationDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
|
|
6544
6479
|
] }),
|
|
6545
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
] }),
|
|
6552
|
-
slippageBps >= 500 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs font-medium", children: t2("settings.highSlippageWarning", {
|
|
6553
|
-
defaultValue: "High slippage warning"
|
|
6554
|
-
}) })
|
|
6555
|
-
] }),
|
|
6556
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-6", children: [
|
|
6557
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg text-foreground leading-5 font-semibold h-5", children: slippagePercent }) }),
|
|
6558
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: slippagePresets.map((p2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6559
|
-
badge.Badge,
|
|
6560
|
-
{
|
|
6561
|
-
onClick: () => {
|
|
6562
|
-
const bps = parseFloat(p2.replace("%", "")) * 100;
|
|
6563
|
-
setSlippageBps(bps);
|
|
6564
|
-
},
|
|
6565
|
-
className: utils$1.cn(
|
|
6566
|
-
"cursor-pointer h-7 rounded px-2",
|
|
6567
|
-
activeSlippagePreset === p2 ? activeBtn : notActiveBtn
|
|
6568
|
-
),
|
|
6569
|
-
children: p2
|
|
6570
|
-
},
|
|
6571
|
-
p2
|
|
6572
|
-
)) })
|
|
6573
|
-
] })
|
|
6574
|
-
] }),
|
|
6575
|
-
/* @__PURE__ */ jsxRuntime.jsx("hr", {}),
|
|
6576
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
6577
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6578
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.routePriority") }),
|
|
6579
|
-
/* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.routePriorityDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
|
|
6580
|
-
] }) }),
|
|
6581
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end gap-2", children: routePresets.map((r2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6582
|
-
badge.Badge,
|
|
6480
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-foreground text-sm font-medium leading-4", children: formatUsd(gasUsdValue) })
|
|
6481
|
+
] }),
|
|
6482
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
6483
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
6484
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6485
|
+
TokenSymbol,
|
|
6583
6486
|
{
|
|
6584
|
-
|
|
6585
|
-
className:
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6487
|
+
symbol: dstNativeToken?.symbol || "eth",
|
|
6488
|
+
className: "h-4 w-4 rounded-full",
|
|
6489
|
+
alt: dstNativeToken?.symbol || t2("common.nativeToken", { defaultValue: "Native Token" })
|
|
6490
|
+
}
|
|
6491
|
+
),
|
|
6492
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg text-foreground leading-5 font-semibold h-5", children: gasDisplayAmount % 1 === 0 ? gasDisplayAmount.toFixed(0) : gasDisplayAmount.toFixed(
|
|
6493
|
+
gasDisplayAmount < 1e-3 ? 6 : 3
|
|
6494
|
+
) }) })
|
|
6495
|
+
] }),
|
|
6496
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: gasPresets.map((g2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6497
|
+
badge.Badge,
|
|
6498
|
+
{
|
|
6499
|
+
onClick: () => setGasPreset(g2),
|
|
6500
|
+
className: utils$1.cn(
|
|
6501
|
+
"cursor-pointer h-7 rounded px-2",
|
|
6502
|
+
gasPreset === g2 ? activeBtn : notActiveBtn
|
|
6503
|
+
),
|
|
6504
|
+
children: t2(`settings.gasPresets.${g2}`)
|
|
6505
|
+
},
|
|
6506
|
+
g2
|
|
6507
|
+
)) })
|
|
6508
|
+
] })
|
|
6509
|
+
] }),
|
|
6510
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", {}),
|
|
6511
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
6512
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center", children: [
|
|
6513
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6514
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.slippageTolerance") }),
|
|
6515
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.slippageToleranceDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
|
|
6516
|
+
] }),
|
|
6517
|
+
slippageBps >= 500 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs font-medium", children: t2("settings.highSlippageWarning", {
|
|
6518
|
+
defaultValue: "High slippage warning"
|
|
6519
|
+
}) })
|
|
6520
|
+
] }),
|
|
6521
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-6", children: [
|
|
6522
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg text-foreground leading-5 font-semibold h-5", children: slippagePercent }) }),
|
|
6523
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: slippagePresets.map((p2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6524
|
+
badge.Badge,
|
|
6525
|
+
{
|
|
6526
|
+
onClick: () => {
|
|
6527
|
+
const bps = parseFloat(p2.replace("%", "")) * 100;
|
|
6528
|
+
setSlippageBps(bps);
|
|
6590
6529
|
},
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6530
|
+
className: utils$1.cn(
|
|
6531
|
+
"cursor-pointer h-7 rounded px-2",
|
|
6532
|
+
activeSlippagePreset === p2 ? activeBtn : notActiveBtn
|
|
6533
|
+
),
|
|
6534
|
+
children: p2
|
|
6535
|
+
},
|
|
6536
|
+
p2
|
|
6537
|
+
)) })
|
|
6594
6538
|
] })
|
|
6595
|
-
]
|
|
6596
|
-
|
|
6597
|
-
|
|
6539
|
+
] }),
|
|
6540
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", {}),
|
|
6541
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
6542
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
6543
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm font-medium leading-4", children: t2("settings.routePriority") }),
|
|
6544
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tip, { text: t2("settings.routePriorityDescription"), children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon, { className: "w-4 h-4 text-muted-foreground" }) })
|
|
6545
|
+
] }) }),
|
|
6546
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end gap-2", children: routePresets.map((r2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6547
|
+
badge.Badge,
|
|
6548
|
+
{
|
|
6549
|
+
onClick: () => setRoutePriority(r2),
|
|
6550
|
+
className: utils$1.cn(
|
|
6551
|
+
"cursor-pointer h-7 rounded px-2",
|
|
6552
|
+
routePriority === r2 ? activeBtn : notActiveBtn
|
|
6553
|
+
),
|
|
6554
|
+
children: t2(`settings.routePresets.${r2}`)
|
|
6555
|
+
},
|
|
6556
|
+
r2
|
|
6557
|
+
)) })
|
|
6558
|
+
] })
|
|
6559
|
+
] })
|
|
6560
|
+
] }) });
|
|
6598
6561
|
};
|
|
6599
6562
|
const TOKEN_ROW_HEIGHT = 52;
|
|
6600
6563
|
const TokenRow = ({
|
|
@@ -6892,74 +6855,67 @@ const TokenSelectModal = ({
|
|
|
6892
6855
|
},
|
|
6893
6856
|
[effectiveTab, virtualItems]
|
|
6894
6857
|
);
|
|
6895
|
-
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6896
|
-
dialog.
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
},
|
|
6919
|
-
size: "sm",
|
|
6920
|
-
className: utils$1.cn(
|
|
6921
|
-
"px-4 h-9 cursor-pointer",
|
|
6922
|
-
effectiveTab !== "my" && "bg-muted hover:bg-accent"
|
|
6923
|
-
),
|
|
6924
|
-
children: t2("bridge.myTokens")
|
|
6925
|
-
}
|
|
6858
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog, { open: isOpen, onOpenChange: (open) => !open && handleClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogContent, { className: "md:max-h-[90dvh] md:h-[90dvh] overflow-hidden flex flex-col gap-4", children: [
|
|
6859
|
+
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogHeader, { className: "text-left pb-2", children: /* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { className: "text-2xl leading-8", children: t2("bridge.selectToken") }) }),
|
|
6860
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6861
|
+
SearchInput,
|
|
6862
|
+
{
|
|
6863
|
+
placeholder: t2("bridge.searchToken"),
|
|
6864
|
+
value: query,
|
|
6865
|
+
onChange: setQuery
|
|
6866
|
+
}
|
|
6867
|
+
),
|
|
6868
|
+
hasSourceWallet() && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
6869
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6870
|
+
button.Button,
|
|
6871
|
+
{
|
|
6872
|
+
variant: effectiveTab === "my" ? "default" : "ghost",
|
|
6873
|
+
onClick: () => {
|
|
6874
|
+
setTab("my");
|
|
6875
|
+
setManualTabSwitch(true);
|
|
6876
|
+
},
|
|
6877
|
+
size: "sm",
|
|
6878
|
+
className: utils$1.cn(
|
|
6879
|
+
"px-4 h-9 cursor-pointer",
|
|
6880
|
+
effectiveTab !== "my" && "bg-muted hover:bg-accent"
|
|
6926
6881
|
),
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
)
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6882
|
+
children: t2("bridge.myTokens")
|
|
6883
|
+
}
|
|
6884
|
+
),
|
|
6885
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6886
|
+
button.Button,
|
|
6887
|
+
{
|
|
6888
|
+
variant: effectiveTab === "all" ? "default" : "ghost",
|
|
6889
|
+
onClick: () => {
|
|
6890
|
+
setTab("all");
|
|
6891
|
+
setManualTabSwitch(true);
|
|
6892
|
+
},
|
|
6893
|
+
size: "sm",
|
|
6894
|
+
className: utils$1.cn(
|
|
6895
|
+
"px-4 h-9 cursor-pointer",
|
|
6896
|
+
effectiveTab !== "all" && "bg-muted hover:bg-accent"
|
|
6897
|
+
),
|
|
6898
|
+
children: t2("bridge.allTokens")
|
|
6899
|
+
}
|
|
6900
|
+
)
|
|
6901
|
+
] }),
|
|
6902
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { id: "token-select-list", className: "flex-1 -mx-5 min-h-0", children: hasNoResults ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground px-12 py-2 h-28 flex items-center justify-center text-center", children: t2("bridge.tokenNotFound") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6903
|
+
effectiveTab === "my" && myTokens.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "leading-4 px-5 text-base text-muted-foreground uppercase py-2", children: t2("bridge.noBalancesFound") }),
|
|
6904
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6905
|
+
reactWindow.FixedSizeList,
|
|
6906
|
+
{
|
|
6907
|
+
height: listHeight,
|
|
6908
|
+
itemCount: virtualItems.length,
|
|
6909
|
+
itemSize: TOKEN_ROW_HEIGHT,
|
|
6910
|
+
width: "100%",
|
|
6911
|
+
itemKey,
|
|
6912
|
+
className: "[&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30",
|
|
6913
|
+
overscanCount: 5,
|
|
6914
|
+
children: VirtualRow
|
|
6915
|
+
}
|
|
6916
|
+
)
|
|
6917
|
+
] }) })
|
|
6918
|
+
] }) });
|
|
6963
6919
|
};
|
|
6964
6920
|
function useBridgeRefresh() {
|
|
6965
6921
|
const qc = reactQuery.useQueryClient();
|
|
@@ -25778,7 +25734,7 @@ class WalletConnectModal {
|
|
|
25778
25734
|
}
|
|
25779
25735
|
async initUi() {
|
|
25780
25736
|
if (typeof window !== "undefined") {
|
|
25781
|
-
await Promise.resolve().then(() => require("./index-
|
|
25737
|
+
await Promise.resolve().then(() => require("./index-Bwsox4tK.cjs"));
|
|
25782
25738
|
const modal = document.createElement("wcm-modal");
|
|
25783
25739
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
25784
25740
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -26034,13 +25990,41 @@ function useTronWalletConnect(projectId) {
|
|
|
26034
25990
|
signTransaction
|
|
26035
25991
|
};
|
|
26036
25992
|
}
|
|
25993
|
+
function parseBridgeUrlParams(source) {
|
|
25994
|
+
if (source && typeof source === "object") {
|
|
25995
|
+
return source;
|
|
25996
|
+
}
|
|
25997
|
+
const queryString = typeof source === "string" ? source : typeof window !== "undefined" ? window.location.search : "";
|
|
25998
|
+
const searchParams = new URLSearchParams(queryString);
|
|
25999
|
+
return {
|
|
26000
|
+
srcToken: searchParams.get("srcToken") || void 0,
|
|
26001
|
+
srcChain: searchParams.get("srcChain") || void 0,
|
|
26002
|
+
dstChain: searchParams.get("dstChain") || void 0,
|
|
26003
|
+
amount: searchParams.get("amount") || void 0
|
|
26004
|
+
};
|
|
26005
|
+
}
|
|
26006
|
+
function buildQueryString(params) {
|
|
26007
|
+
const searchParams = new URLSearchParams();
|
|
26008
|
+
if (params.srcToken) searchParams.set("srcToken", params.srcToken);
|
|
26009
|
+
if (params.srcChain) searchParams.set("srcChain", params.srcChain);
|
|
26010
|
+
if (params.dstChain) searchParams.set("dstChain", params.dstChain);
|
|
26011
|
+
if (params.amount) searchParams.set("amount", params.amount);
|
|
26012
|
+
const queryString = searchParams.toString();
|
|
26013
|
+
return queryString ? `?${queryString}` : "";
|
|
26014
|
+
}
|
|
26015
|
+
function updateBridgeUrlNative(params) {
|
|
26016
|
+
if (typeof window === "undefined" || !window.history) return;
|
|
26017
|
+
const queryString = buildQueryString(params);
|
|
26018
|
+
const newUrl = `${window.location.pathname}${queryString}${window.location.hash}`;
|
|
26019
|
+
window.history.replaceState(null, "", newUrl);
|
|
26020
|
+
}
|
|
26037
26021
|
function useUrlSync(options) {
|
|
26038
26022
|
const {
|
|
26039
26023
|
enabled = true,
|
|
26040
26024
|
urlParams: externalUrlParams,
|
|
26041
26025
|
onUrlParamsChange
|
|
26042
26026
|
} = options || {};
|
|
26043
|
-
const { chains, setFromChain, setToChain } = useChainsStore();
|
|
26027
|
+
const { chains, setFromChain, setToChain, setIsUrlInitialized } = useChainsStore();
|
|
26044
26028
|
const { tokens, assetMatrix, setSelectedAssetSymbol } = useTokensStore();
|
|
26045
26029
|
const { setInputAmount } = useBridgeQuoteStore();
|
|
26046
26030
|
const internalData = useBridgeExternalData();
|
|
@@ -26121,12 +26105,7 @@ function useUrlSync(options) {
|
|
|
26121
26105
|
isSyncingRef.current = false;
|
|
26122
26106
|
}, 0);
|
|
26123
26107
|
},
|
|
26124
|
-
[
|
|
26125
|
-
enabled,
|
|
26126
|
-
hasInitialized,
|
|
26127
|
-
currentUrlParams,
|
|
26128
|
-
onUrlParamsChange
|
|
26129
|
-
]
|
|
26108
|
+
[enabled, hasInitialized, currentUrlParams, onUrlParamsChange]
|
|
26130
26109
|
);
|
|
26131
26110
|
const handleAmountBlur = react.useCallback(() => {
|
|
26132
26111
|
if (!enabled || !hasInitialized) return;
|
|
@@ -26138,6 +26117,7 @@ function useUrlSync(options) {
|
|
|
26138
26117
|
}
|
|
26139
26118
|
const urlParams = externalUrlParams ? parseBridgeUrlParams(externalUrlParams) : parseBridgeUrlParams();
|
|
26140
26119
|
if (!urlParams.srcToken && !urlParams.srcChain && !urlParams.dstChain && !urlParams.amount) {
|
|
26120
|
+
setIsUrlInitialized(true);
|
|
26141
26121
|
setHasInitialized(true);
|
|
26142
26122
|
return;
|
|
26143
26123
|
}
|
|
@@ -26161,6 +26141,7 @@ function useUrlSync(options) {
|
|
|
26161
26141
|
dstChain: validated.dstChain?.chainKey,
|
|
26162
26142
|
amount: validated.amount
|
|
26163
26143
|
};
|
|
26144
|
+
setIsUrlInitialized(true);
|
|
26164
26145
|
setHasInitialized(true);
|
|
26165
26146
|
}, 0);
|
|
26166
26147
|
return () => clearTimeout(timeoutId);
|
|
@@ -26173,7 +26154,8 @@ function useUrlSync(options) {
|
|
|
26173
26154
|
setSelectedAssetSymbol,
|
|
26174
26155
|
setFromChain,
|
|
26175
26156
|
setToChain,
|
|
26176
|
-
setInputAmount
|
|
26157
|
+
setInputAmount,
|
|
26158
|
+
setIsUrlInitialized
|
|
26177
26159
|
]);
|
|
26178
26160
|
react.useEffect(() => {
|
|
26179
26161
|
if (!enabled || !hasInitialized) return;
|
|
@@ -26545,4 +26527,4 @@ exports.useSettingsStore = useSettingsStore;
|
|
|
26545
26527
|
exports.useSwapModel = useSwapModel;
|
|
26546
26528
|
exports.useTokensStore = useTokensStore;
|
|
26547
26529
|
exports.useTransactionStore = useTransactionStore;
|
|
26548
|
-
//# sourceMappingURL=index-
|
|
26530
|
+
//# sourceMappingURL=index-CmGINAdQ.cjs.map
|