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