@wheelx-widget/widget 0.1.5 → 0.1.6

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/index.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  import * as React5 from 'react';
2
2
  import React5__default, { createContext, memo, useState, useMemo, useRef, useEffect, useContext, createElement, useCallback } from 'react';
3
- import { defineRecipe, chakra, Tooltip as Tooltip$1, Portal, VStack, Box, HStack, InputGroup, Input, Icon, Image, useBreakpointValue, Dialog, Spinner, Link, Text, Button, Popover, Collapsible, useDisclosure } from '@chakra-ui/react';
4
- import { useQuery, QueryClient, QueryClientProvider, useMutation } from '@tanstack/react-query';
5
- import { useUserWallets, DynamicContextProvider, useRpcProviders, useTokenBalances, ChainEnum, useDynamicContext, useDynamicModals, useIsLoggedIn } from '@dynamic-labs/sdk-react-core';
3
+ import { defineRecipe, chakra, Tooltip as Tooltip$1, Portal, VStack, Box, HStack, InputGroup, Input, Icon, Image, useBreakpointValue, Dialog, Spinner, Link, Button, Text, Popover, Collapsible, useDisclosure } from '@chakra-ui/react';
4
+ import { useQuery, QueryClient, QueryClientProvider, useMutation, keepPreviousData } from '@tanstack/react-query';
5
+ import { useUserWallets, DynamicContextProvider, useRpcProviders, useDynamicContext, useTokenBalances, ChainEnum, useDynamicModals, useIsLoggedIn } from '@dynamic-labs/sdk-react-core';
6
6
  import { EthereumWalletConnectors } from '@dynamic-labs/ethereum';
7
7
  import { SolanaWalletConnectorsWithConfig } from '@dynamic-labs/solana';
8
8
  import { DynamicWagmiConnector } from '@dynamic-labs/wagmi-connector';
9
- import { useAccount, WagmiProvider, useChainId, useConfig, useReconnect, createConfig, useEstimateFeesPerGas, fallback, http as http$1, useWaitForTransactionReceipt, useConnectors, useSendTransaction } from 'wagmi';
10
- import { mainnet, base as base$1, soneium as soneium$1, polygon, arbitrum, optimism, sepolia, arbitrumSepolia, optimismSepolia, baseSepolia, unichainSepolia, arcTestnet } from 'wagmi/chains';
9
+ import { useAccount, WagmiProvider, useChainId, useConfig, useReconnect, createConfig, useDisconnect, useConnectors, useEstimateFeesPerGas, fallback, http as http$1, useWaitForTransactionReceipt, useSendTransaction } from 'wagmi';
10
+ import { defineChain, zeroAddress, createPublicClient, http, parseUnits, erc20Abi, formatUnits, isAddress, hexToString, createClient, custom } from 'viem';
11
+ import { mainnet, arbitrum, optimism, unichain, base as base$1, ink as ink$1, linea, soneium as soneium$1, bsc as bsc$1, worldchain, opBNB, mode, lisk, zksync, celo, polygon, avalanche, plumeMainnet, zora, sonic, berachain, bob, abstract, morph, taiko, scroll, hemi, xLayer, mantle, cronos, gravity, blast, manta, zircuit, xdc, sei, plume, gnosis, hashkey, flowMainnet, etherlink, ronin, flare, rootstock, iota, pulsechain, sepolia, arbitrumSepolia, optimismSepolia, baseSepolia, unichainSepolia, arcTestnet } from 'wagmi/chains';
11
12
  import { ThemeProvider } from '@emotion/react';
12
13
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
13
14
  import axios6, { AxiosError } from 'axios';
14
15
  import { create } from 'zustand';
15
16
  import { Fraction, RoundingMode } from 'bi-fraction';
16
- import { zeroAddress, createPublicClient, http, parseUnits, erc20Abi, formatUnits, isAddress, hexToString, createClient, custom } from 'viem';
17
17
  import { base, soneium, ink, bsc } from 'viem/chains';
18
18
  import { PublicKey, VersionedTransaction, VersionedMessage, Transaction } from '@solana/web3.js';
19
19
  import { parseAccount, getAddress } from 'viem/utils';
@@ -23,8 +23,10 @@ import { WalletIcon as WalletIcon$1 } from '@dynamic-labs/wallet-book';
23
23
  import { FiEdit } from 'react-icons/fi';
24
24
  import { IoAddCircleOutline, IoClose } from 'react-icons/io5';
25
25
  import { FaTriangleExclamation, FaGasPump } from 'react-icons/fa6';
26
- import { IoIosFlash } from 'react-icons/io';
26
+ import { IoMdLogOut, IoIosFlash } from 'react-icons/io';
27
27
  import { BsFillClipboardMinusFill } from 'react-icons/bs';
28
+ import { HiMiniArrowRight } from 'react-icons/hi2';
29
+ import { RiArrowGoBackFill } from 'react-icons/ri';
28
30
 
29
31
  // src/providers/WheelXProvider.tsx
30
32
 
@@ -157,7 +159,11 @@ var useWalletConnectedStore = create((set, get) => ({
157
159
  evmWalletConnectorId: null,
158
160
  setEvmWalletInfo: (address, connectorId) => set({ evmWalletAddress: address, evmWalletConnectorId: connectorId }),
159
161
  isEvmWalletMetamask: false,
160
- setIsEvmWalletMetamask: (isEvmWalletMetamask) => set({ isEvmWalletMetamask })
162
+ setIsEvmWalletMetamask: (isEvmWalletMetamask) => set({ isEvmWalletMetamask }),
163
+ isLoggingOut: false,
164
+ setIsLoggingOut: (isLoggingOut) => set({ isLoggingOut }),
165
+ lastDisconnectTimestamp: 0,
166
+ setLastDisconnectTimestamp: (ts) => set({ lastDisconnectTimestamp: ts })
161
167
  }));
162
168
 
163
169
  // src/stores/useSyncWalletConnectedStore.ts
@@ -167,14 +173,25 @@ var getEvmConnectorId = (wallet) => {
167
173
  };
168
174
  var useSyncWalletConnectedStore = () => {
169
175
  const userWallets = useUserWallets();
170
- const { address: wagmiAddress, connector: wagmiConnector, isConnected } = useAccount();
176
+ const { address: wagmiAddress, connector: wagmiConnector } = useAccount();
171
177
  const {
172
178
  setSolanaWalletAddress,
173
179
  setIsSolanaWalletConnected,
174
180
  setEvmWalletInfo,
175
- setIsEthWalletConnected
181
+ setIsEthWalletConnected,
182
+ isLoggingOut,
183
+ lastDisconnectTimestamp
176
184
  } = useWalletConnectedStore();
177
185
  useEffect(() => {
186
+ if (isLoggingOut) return;
187
+ const msSinceDisconnect = Date.now() - lastDisconnectTimestamp;
188
+ if (msSinceDisconnect < 2e3) {
189
+ const { isEthWalletConnected, isSolanaWalletConnected } = useWalletConnectedStore.getState();
190
+ const hasNoConnectedWallets = !isEthWalletConnected && !isSolanaWalletConnected;
191
+ if (hasNoConnectedWallets) {
192
+ return;
193
+ }
194
+ }
178
195
  const solanaWallet = userWallets.find((wallet) => {
179
196
  const chain = String(
180
197
  wallet.chain ?? ""
@@ -190,15 +207,16 @@ var useSyncWalletConnectedStore = () => {
190
207
  ).toLowerCase();
191
208
  return chain.includes("evm");
192
209
  });
193
- const evmAddress = evmWallet?.address ?? wagmiAddress ?? null;
210
+ const evmAddress = evmWallet?.address ?? (evmWallet ? wagmiAddress : null) ?? null;
194
211
  const evmConnectorId = wagmiConnector?.id ?? getEvmConnectorId(evmWallet) ?? null;
195
212
  setEvmWalletInfo(evmAddress, evmConnectorId);
196
- setIsEthWalletConnected(Boolean(evmAddress || isConnected));
213
+ setIsEthWalletConnected(Boolean(evmAddress));
197
214
  }, [
198
215
  userWallets,
199
216
  wagmiAddress,
200
217
  wagmiConnector?.id,
201
- isConnected,
218
+ isLoggingOut,
219
+ lastDisconnectTimestamp,
202
220
  setSolanaWalletAddress,
203
221
  setIsSolanaWalletConnected,
204
222
  setEvmWalletInfo,
@@ -207,7 +225,8 @@ var useSyncWalletConnectedStore = () => {
207
225
  };
208
226
  var useEvmAddress = () => {
209
227
  const { address } = useAccount();
210
- const { evmWalletAddress } = useWalletConnectedStore();
228
+ const { evmWalletAddress, isEthWalletConnected } = useWalletConnectedStore();
229
+ if (!isEthWalletConnected) return void 0;
211
230
  return evmWalletAddress || address;
212
231
  };
213
232
  var FavoritesContext = createContext({
@@ -410,21 +429,140 @@ var useTokenFavoritesContext = () => {
410
429
  if (c === void 0) throw new Error("useTokenFavoritesContext must be used within TokenFavoritesProvider");
411
430
  return c;
412
431
  };
413
- var supportedChains = [mainnet, base$1, soneium$1, polygon, arbitrum, optimism, sepolia, arbitrumSepolia, optimismSepolia, baseSepolia, unichainSepolia, arcTestnet];
432
+ var tempo = defineChain({
433
+ id: 4217,
434
+ name: "Tempo",
435
+ network: "Tempo",
436
+ nativeCurrency: { name: "USD", symbol: "USD", decimals: 6 },
437
+ rpcUrls: { default: { http: ["https://rpc.tempo.xyz"] } },
438
+ blockExplorers: { default: { name: "Tempo Explorer", url: "https://explore.tempo.xyz" } },
439
+ testnet: true
440
+ });
441
+ var katana = defineChain({ id: 747474, name: "Katana", network: "Katana", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.katana.network"] } }, blockExplorers: { default: { name: "Katana Explorer", url: "https://explorer.katanarpc.com" } } });
442
+ var hyperevm = defineChain({ id: 999, name: "HyperEVM", network: "HyperEVM", nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.hyperliquid.xyz/evm", "https://rpc.hypurrscan.io"] } }, blockExplorers: { default: { name: "Purrsec", url: "https://hyperevmscan.io" } } });
443
+ var stable = defineChain({ id: 988, name: "Stable", network: "Stable", nativeCurrency: { name: "STB", symbol: "STB", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.stable.xyz"] } }, blockExplorers: { default: { name: "Stablescan", url: "https://stablescan.xyz" } } });
444
+ var monad = defineChain({ id: 143, name: "Monad", network: "Monad", nativeCurrency: { name: "MON", symbol: "MON", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.monad.xyz", "https://rpc1.monad.xyz"] } }, blockExplorers: { default: { name: "MonadVision", url: "https://monadvision.com" } } });
445
+ var metis = defineChain({ id: 1088, name: "Metis", network: "Metis", nativeCurrency: { name: "METIS", symbol: "METIS", decimals: 18 }, rpcUrls: { default: { http: ["https://metis.api.onfinality.io/public", "https://metis-public.nodies.app"] } }, blockExplorers: { default: { name: "Metis Explorer", url: "https://explorer.metis.io" } } });
446
+ var polygonZkEvm = defineChain({ id: 1101, name: "Polygon zkEVM", network: "Polygon zkEVM", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://zkevm-rpc.com"] } }, blockExplorers: { default: { name: "PolygonScan zkEVM", url: "https://www.oklink.com/polygon-zkevm" } } });
447
+ var megaeth = defineChain({ id: 4326, name: "MegaETH", network: "MegaETH", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://mainnet.megaeth.com/rpc"] } }, blockExplorers: { default: { name: "MegaETH Explorer", url: "https://megaeth.blockscout.com/" } } });
448
+ var pharos = defineChain({ id: 1672, name: "Pharos", network: "Pharos", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.pharos.xyz"] } }, blockExplorers: { default: { name: "Pharoscan", url: "https://pharosscan.xyz" } } });
449
+ var kite = defineChain({ id: 2366, name: "Kite", network: "Kite", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.gokite.ai/"] } }, blockExplorers: { default: { name: "Kitescan", url: "https://kitescan.ai/" } } });
450
+ var plasma = defineChain({ id: 9745, name: "Plasma", network: "Plasma", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.plasma.to"] } }, blockExplorers: { default: { name: "Plasma Explorer", url: "https://plasmascan.to" } }, testnet: true });
451
+ var rari = defineChain({ id: 1380012617, name: "RARI", network: "RARI", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://mainnet.rpc.rarichain.org/http"] } }, blockExplorers: { default: { name: "RARI Explorer", url: "https://mainnet.explorer.rarichain.org/" } }, testnet: true });
452
+ var stabletestnet = defineChain({ id: 2201, name: "Stable Testnet", network: "Stable Testnet", nativeCurrency: { name: "STB", symbol: "STB", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.testnet.stable.xyz"] } }, blockExplorers: { default: { name: "Stablescan Testnet", url: "https://testnet.stablescan.xyz" } }, testnet: true });
453
+ var giwa = defineChain({ id: 91342, name: "GIWA Testnet", network: "GIWA Testnet", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://sepolia-rpc.giwa.io"] } }, blockExplorers: { default: { name: "GIWA Explorer", url: "https://sepolia-explorer.giwa.io" } }, testnet: true });
454
+ var robinhoodTestnet = defineChain({ id: 46630, name: "Robinhood Testnet", network: "Robinhood Testnet", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.testnet.chain.robinhood.com"] } }, blockExplorers: { default: { name: "Robinhood Explorer", url: "https://explorer.testnet.chain.robinhood.com/" } }, testnet: true });
455
+ var litvm = defineChain({ id: 4441, name: "LitVM Testnet", network: "LitVM Testnet", nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 }, rpcUrls: { default: { http: ["https://liteforge.rpc.caldera.xyz/http"] } }, blockExplorers: { default: { name: "LitVM Explorer", url: "https://liteforge.explorer.caldera.xyz" } }, testnet: true });
456
+ var supportedChains = [
457
+ // Mainnet (wagmi/chains)
458
+ mainnet,
459
+ arbitrum,
460
+ optimism,
461
+ unichain,
462
+ base$1,
463
+ ink$1,
464
+ linea,
465
+ soneium$1,
466
+ bsc$1,
467
+ worldchain,
468
+ opBNB,
469
+ mode,
470
+ lisk,
471
+ zksync,
472
+ celo,
473
+ polygon,
474
+ avalanche,
475
+ plumeMainnet,
476
+ zora,
477
+ sonic,
478
+ berachain,
479
+ bob,
480
+ abstract,
481
+ morph,
482
+ taiko,
483
+ scroll,
484
+ hemi,
485
+ xLayer,
486
+ mantle,
487
+ cronos,
488
+ gravity,
489
+ blast,
490
+ manta,
491
+ zircuit,
492
+ xdc,
493
+ sei,
494
+ plume,
495
+ gnosis,
496
+ hashkey,
497
+ flowMainnet,
498
+ etherlink,
499
+ ronin,
500
+ flare,
501
+ rootstock,
502
+ iota,
503
+ pulsechain,
504
+ // Mainnet (custom chains — not in wagmi/chains)
505
+ katana,
506
+ hyperevm,
507
+ stable,
508
+ monad,
509
+ metis,
510
+ polygonZkEvm,
511
+ megaeth,
512
+ pharos,
513
+ kite,
514
+ tempo,
515
+ plasma,
516
+ rari,
517
+ // Testnet (wagmi/chains)
518
+ sepolia,
519
+ arbitrumSepolia,
520
+ optimismSepolia,
521
+ baseSepolia,
522
+ unichainSepolia,
523
+ arcTestnet,
524
+ // Testnet (custom chains — not in wagmi/chains)
525
+ stabletestnet,
526
+ giwa,
527
+ robinhoodTestnet,
528
+ litvm
529
+ ];
414
530
  var CORS_FRIENDLY_RPC_MAP = {
531
+ // wagmi/chains mainnet
415
532
  1: "https://eth-mainnet.public.blastapi.io",
416
533
  8453: "https://mainnet.base.org",
417
534
  1868: "https://soneium.rpc.scs.startale.com",
418
535
  137: "https://polygon-rpc.com",
536
+ 56: "https://bsc-dataseed.binance.org",
537
+ 130: "https://rpc.therpc.io/unichain",
538
+ 196: "https://rpc.xlayer.io",
419
539
  42161: "https://arbitrum.gateway.tenderly.co",
420
540
  10: "https://optimism.gateway.tenderly.co",
541
+ // Custom chains (mainnet)
542
+ 4217: "https://rpc.tempo.xyz",
543
+ 747474: "https://rpc.katana.network",
544
+ 999: "https://rpc.hyperliquid.xyz/evm",
545
+ 988: "https://rpc.stable.xyz",
546
+ 143: "https://rpc.monad.xyz",
547
+ 1088: "https://metis.api.onfinality.io/public",
548
+ 1101: "https://zkevm-rpc.com",
549
+ 4326: "https://mainnet.megaeth.com/rpc",
550
+ 1672: "https://rpc.pharos.xyz",
551
+ 2366: "https://rpc.gokite.ai/",
552
+ 9745: "https://rpc.plasma.to",
553
+ 1380012617: "https://mainnet.rpc.rarichain.org/http",
421
554
  // Testnet
422
555
  11155111: "https://ethereum-sepolia.publicnode.com",
423
556
  421614: "https://sepolia-rollup.arbitrum.io/rpc",
424
557
  11155420: "https://optimism-sepolia.gateway.tenderly.co",
425
558
  84532: "https://sepolia.base.org",
426
559
  1301: "https://sepolia.unichain.org",
427
- 5042002: "https://rpc.testnet.arc.network"
560
+ 5042002: "https://rpc.testnet.arc.network",
561
+ // Custom chains (testnet)
562
+ 2201: "https://rpc.testnet.stable.xyz",
563
+ 91342: "https://sepolia-rpc.giwa.io",
564
+ 46630: "https://rpc.testnet.chain.robinhood.com",
565
+ 4441: "https://liteforge.rpc.caldera.xyz/http"
428
566
  };
429
567
  function buildStableTransports() {
430
568
  const transports = {};
@@ -864,6 +1002,16 @@ var formatDate = (dateString) => {
864
1002
  const formattedTime = `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
865
1003
  return formattedTime;
866
1004
  };
1005
+ var dateFormatter = (isoString) => {
1006
+ const date = new Date(isoString);
1007
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1008
+ const day = String(date.getDate()).padStart(2, "0");
1009
+ const year = date.getFullYear();
1010
+ const hours = String(date.getHours()).padStart(2, "0");
1011
+ const minutes = String(date.getMinutes()).padStart(2, "0");
1012
+ const seconds = String(date.getSeconds()).padStart(2, "0");
1013
+ return `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
1014
+ };
867
1015
 
868
1016
  // src/utils/address.ts
869
1017
  var sliceAddress = (address, startLength = 4, endLength = 4) => {
@@ -935,25 +1083,6 @@ var isSolanaChain = (chain_id) => {
935
1083
  return chain_id === SOLANA_MAINNET.chain_id;
936
1084
  };
937
1085
 
938
- // src/utils/shortLinkRegex.ts
939
- var toRegex = /^\/[a-zA-Z0-9]+$/;
940
- var toAndTokenRegex = /^\/(?!from)[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
941
- var fromRegex = /^\/from&[a-zA-Z0-9-+]+$/;
942
- var fromAndTokenRegex = /^\/from&[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
943
- var fromAndToRegex = /^\/[a-zA-Z0-9-+]+\/[a-zA-Z0-9-+]+$/;
944
- var fromAndTokenAndToAndTokenRegex = /^\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
945
- var allRegexPatterns = [
946
- toRegex,
947
- toAndTokenRegex,
948
- fromRegex,
949
- fromAndTokenRegex,
950
- fromAndToRegex,
951
- fromAndTokenAndToAndTokenRegex
952
- ];
953
- function matchesAnyPatternUsingArray(inputString) {
954
- return allRegexPatterns.some((regex) => regex.test(inputString));
955
- }
956
-
957
1086
  // src/utils/tokenSelectionCache.ts
958
1087
  var TOKEN_SELECTION = "tokenSelection";
959
1088
  var tokenSelectionStore = new localstorage_default(TOKEN_SELECTION);
@@ -1041,7 +1170,7 @@ var logger = {
1041
1170
  error: errorWithTimestamp,
1042
1171
  debug: debugWithTimestamp
1043
1172
  };
1044
- var wagmiSupportedChains = [mainnet, base$1, soneium$1, polygon, arbitrum, optimism];
1173
+ var wagmiSupportedChains = [mainnet, base$1, soneium$1, polygon, arbitrum, optimism, bsc$1];
1045
1174
  var getTxLink = (txHash, chainId) => {
1046
1175
  if (isSolanaChain(chainId)) {
1047
1176
  return `${SOLANA_MAINNET.explorerUrl}/tx/${txHash}`;
@@ -1113,20 +1242,6 @@ var isSolanaChain2 = (chain_id) => {
1113
1242
  };
1114
1243
 
1115
1244
  // src/core/hooks/useSwapAndBridgeContextStore.ts
1116
- function findItemByName(arr, targetName) {
1117
- const foundItem = arr.find(
1118
- (item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
1119
- );
1120
- return [foundItem !== void 0, foundItem];
1121
- }
1122
- function findItemBySymbol(arr, targetName, chainId, platform_id) {
1123
- const foundItem = arr.find((item) => {
1124
- {
1125
- return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
1126
- }
1127
- });
1128
- return [foundItem !== void 0, foundItem];
1129
- }
1130
1245
  var DEFAULT_FROM_TOKEN = {
1131
1246
  name: "Base",
1132
1247
  address: zeroAddress,
@@ -1229,8 +1344,6 @@ var useInitSwapAndBridgeState = (config) => {
1229
1344
  const {
1230
1345
  setFromTokenInfo,
1231
1346
  setToTokenInfo,
1232
- setIsShortLink,
1233
- setShortLink,
1234
1347
  setFromAmount,
1235
1348
  setToAmount
1236
1349
  } = useSwapAndBridgeContextStore();
@@ -1240,11 +1353,6 @@ var useInitSwapAndBridgeState = (config) => {
1240
1353
  const address = useEvmAddress();
1241
1354
  const { resetTxState } = useTxStateContextStore();
1242
1355
  const hasInitialized = useRef(false);
1243
- const currentPathname = useMemo(() => {
1244
- if (typeof window === "undefined") return "/";
1245
- return window.location.pathname;
1246
- }, []);
1247
- const pathname = currentPathname;
1248
1356
  useEffect(() => {
1249
1357
  if (hasInitialized.current) return;
1250
1358
  if (!chains || !tokens) return;
@@ -1286,46 +1394,8 @@ var useInitSwapAndBridgeState = (config) => {
1286
1394
  }
1287
1395
  }
1288
1396
  }
1289
- if (matchesAnyPatternUsingArray(pathname) && chains && tokens) {
1290
- setIsShortLink(true);
1291
- setShortLink(pathname);
1292
- try {
1293
- const decodedPath = decodeURIComponent(pathname);
1294
- const match = decodedPath.match(
1295
- /^\/([a-zA-Z0-9-+]+)&([a-zA-Z0-9-+.₮Ï]+)\/([a-zA-Z0-9-+]+)&([a-zA-Z0-9-+.₮Ï]+)$/
1296
- );
1297
- if (match) {
1298
- const [, fromChainName, fromTokenSymbol, toChainName, toTokenSymbol] = match;
1299
- const [, foundFromChain] = findItemByName(
1300
- chains,
1301
- fromChainName
1302
- );
1303
- const [, foundToChain] = findItemByName(
1304
- chains,
1305
- toChainName
1306
- );
1307
- if (foundFromChain && foundToChain && tokens) {
1308
- const [, foundFromToken] = findItemBySymbol(
1309
- tokens,
1310
- fromTokenSymbol,
1311
- foundFromChain.chain_id
1312
- );
1313
- const [, foundToToken] = findItemBySymbol(
1314
- tokens,
1315
- toTokenSymbol,
1316
- foundToChain.chain_id
1317
- );
1318
- if (foundFromToken && foundToToken) {
1319
- setFromTokenInfo(foundFromToken);
1320
- setToTokenInfo(foundToToken);
1321
- }
1322
- }
1323
- }
1324
- } catch {
1325
- }
1326
- }
1327
1397
  const cached = tokenSelectionStore.get(address || "default");
1328
- if (cached?.from && cached?.to && !matchesAnyPatternUsingArray(pathname)) {
1398
+ if (cached?.from && cached?.to) {
1329
1399
  setFromTokenInfo(cached.from);
1330
1400
  setToTokenInfo(cached.to);
1331
1401
  }
@@ -1337,15 +1407,12 @@ var useInitSwapAndBridgeState = (config) => {
1337
1407
  resetTxState();
1338
1408
  };
1339
1409
  }, [
1340
- pathname,
1341
1410
  address,
1342
1411
  chains,
1343
1412
  tokens,
1344
1413
  config,
1345
1414
  setFromTokenInfo,
1346
1415
  setToTokenInfo,
1347
- setIsShortLink,
1348
- setShortLink,
1349
1416
  setFromAmount,
1350
1417
  setToAmount,
1351
1418
  setDifferentAddress,
@@ -3381,6 +3448,12 @@ var FormButton = ({
3381
3448
  }) => {
3382
3449
  const { theme } = useWidgetTheme();
3383
3450
  const address = useEvmAddress();
3451
+ const {
3452
+ solanaWalletAddress,
3453
+ isSolanaWalletConnected,
3454
+ isEthWalletConnected,
3455
+ evmWalletConnectorId
3456
+ } = useWalletConnectedStore();
3384
3457
  const {
3385
3458
  address: wagmiAddress,
3386
3459
  connector,
@@ -3398,8 +3471,11 @@ var FormButton = ({
3398
3471
  return dynamicEvmWallet?.address || void 0;
3399
3472
  }, [userWallets]);
3400
3473
  const effectiveEvmAddress = useMemo(
3401
- () => address || wagmiAddress || dynamicEvmWalletAddress || void 0,
3402
- [address, wagmiAddress, dynamicEvmWalletAddress]
3474
+ () => {
3475
+ if (!isEthWalletConnected) return void 0;
3476
+ return address || wagmiAddress || dynamicEvmWalletAddress || void 0;
3477
+ },
3478
+ [address, wagmiAddress, dynamicEvmWalletAddress, isEthWalletConnected]
3403
3479
  );
3404
3480
  const { openModal, openConnectModal } = useWalletConnectModal();
3405
3481
  const slippage = address ? slippageStore.get(address) : void 0;
@@ -3428,15 +3504,9 @@ var FormButton = ({
3428
3504
  } = useUSDTHandler(fromTokenInfo.chain_id);
3429
3505
  const { isSelectPredictionChain, slippagePolicies, chains } = useChainsStore();
3430
3506
  const { differentAddress } = useDifferentAddressStore();
3431
- const {
3432
- solanaWalletAddress,
3433
- isSolanaWalletConnected,
3434
- isEthWalletConnected,
3435
- evmWalletConnectorId
3436
- } = useWalletConnectedStore();
3437
3507
  const connectors = useConnectors();
3438
3508
  const hasEvmUiWallet = Boolean(
3439
- effectiveEvmAddress || isEthWalletConnected || isWagmiConnected
3509
+ effectiveEvmAddress || isEthWalletConnected
3440
3510
  );
3441
3511
  const hasEvmExecutionWallet = Boolean(
3442
3512
  effectiveEvmAddress && (isWagmiConnected && connector || evmWalletConnectorId && connectors.some((c) => c.id === evmWalletConnectorId) || isEthWalletConnected && connectors.length > 0)
@@ -4203,13 +4273,13 @@ function filterTokenUnType(items, excludeTypes) {
4203
4273
  var mainnet3 = { id: 1 };
4204
4274
 
4205
4275
  // src/consts/monad.ts
4206
- var monad = { id: 10143 };
4276
+ var monad2 = { id: 10143 };
4207
4277
 
4208
4278
  // src/consts/stable.ts
4209
- var stable = { id: 1 };
4279
+ var stable2 = { id: 1 };
4210
4280
 
4211
4281
  // src/core/SelectTokenModal/hooks/useChainsAndTokensForSelect.ts
4212
- [mainnet3.id, base.id, ink.id, bsc.id, monad.id, soneium.id, stable.id];
4282
+ [mainnet3.id, base.id, ink.id, bsc.id, monad2.id, soneium.id, stable2.id];
4213
4283
  var useChainsAndTokensForSelect = ({
4214
4284
  data,
4215
4285
  selectedChain,
@@ -4675,20 +4745,6 @@ function countLeadingZerosAfterDecimal(numStr) {
4675
4745
  if (firstNonZeroIndex === -1) return 0;
4676
4746
  return firstNonZeroIndex;
4677
4747
  }
4678
- function findItemByName2(arr, targetName) {
4679
- const foundItem = arr.find(
4680
- (item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
4681
- );
4682
- return [foundItem !== void 0, foundItem];
4683
- }
4684
- function findItemBySymbol2(arr, targetName, chainId, platform_id) {
4685
- const foundItem = arr.find((item) => {
4686
- {
4687
- return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
4688
- }
4689
- });
4690
- return [foundItem !== void 0, foundItem];
4691
- }
4692
4748
  var TokenAmountHeading = ({
4693
4749
  amount,
4694
4750
  decimals,
@@ -4696,13 +4752,14 @@ var TokenAmountHeading = ({
4696
4752
  suffix,
4697
4753
  ...props
4698
4754
  }) => {
4755
+ const { theme } = useWidgetTheme();
4699
4756
  const _amount = formatTokenAmount({
4700
4757
  amount,
4701
4758
  decimals
4702
4759
  });
4703
4760
  const leadingZeros = countLeadingZerosAfterDecimal(_amount);
4704
4761
  if (leadingZeros > 5) {
4705
- return /* @__PURE__ */ jsxs(Heading, { variant: "heading8", ...props, as: "div", children: [
4762
+ return /* @__PURE__ */ jsxs(Heading, { variant: "heading8", ...props, as: "div", color: theme.defaultTextColor, whiteSpace: "nowrap", children: [
4706
4763
  prefix,
4707
4764
  " ",
4708
4765
  _amount.slice(0, 3),
@@ -4721,7 +4778,7 @@ var TokenAmountHeading = ({
4721
4778
  suffix
4722
4779
  ] });
4723
4780
  }
4724
- return /* @__PURE__ */ jsxs(Heading, { variant: "heading11", ...props, as: "div", children: [
4781
+ return /* @__PURE__ */ jsxs(Heading, { variant: "heading11", ...props, as: "div", color: theme.defaultTextColor, whiteSpace: "nowrap", children: [
4725
4782
  prefix,
4726
4783
  " ",
4727
4784
  _amount,
@@ -6269,6 +6326,7 @@ var SelectTokenModal = ({
6269
6326
  allTokens: tokens
6270
6327
  });
6271
6328
  const { userHasSelectedFromNetwork, setUserHasSelectedFromNetwork } = useUserHasSelectedFromNetwork();
6329
+ const prevUserHasSelectedRef = useRef(userHasSelectedFromNetwork);
6272
6330
  const { chains } = useChainsStore();
6273
6331
  const [disableTestnetLimit, setDisableTestnetLimit] = useState(false);
6274
6332
  const [tempSelectAll, setTempSelectAll] = useState(false);
@@ -6303,6 +6361,8 @@ var SelectTokenModal = ({
6303
6361
  setTempSelectedPlatformId(null);
6304
6362
  }
6305
6363
  }
6364
+ const userJustSelected = userHasSelectedFromNetwork && !prevUserHasSelectedRef.current;
6365
+ prevUserHasSelectedRef.current = userHasSelectedFromNetwork;
6306
6366
  if (isSelectingFromToken) {
6307
6367
  if (isLoadingUserBalances) return;
6308
6368
  if (isArcTestnetShortLink) {
@@ -6316,7 +6376,9 @@ var SelectTokenModal = ({
6316
6376
  setSelectedChain(null);
6317
6377
  } else {
6318
6378
  setIsSelectAll(false);
6319
- setSelectedChain(fromChainId);
6379
+ if (!userJustSelected) {
6380
+ setSelectedChain(fromChainId);
6381
+ }
6320
6382
  }
6321
6383
  } else {
6322
6384
  setIsSelectAll(false);
@@ -8298,127 +8360,6 @@ var FormBody = ({
8298
8360
  const { tokens } = useTokensStore();
8299
8361
  const [isFromHyperChain, setIsFromHyperChain] = useState(false);
8300
8362
  const [isToHyperChain, setIsToHyperChain] = useState(false);
8301
- const pathname = typeof window !== "undefined" ? window.location.pathname : "";
8302
- const replaceLink = useCallback((url) => {
8303
- if (typeof window !== "undefined") {
8304
- window.history.replaceState(null, "", url);
8305
- }
8306
- }, []);
8307
- const updateSearchParams = useCallback(
8308
- (params) => {
8309
- if (typeof window === "undefined") return;
8310
- const searchParams = window?.location?.search;
8311
- const newParams = new URLSearchParams(searchParams);
8312
- Object.entries(params).forEach(([key, value]) => {
8313
- newParams.set(key, value);
8314
- });
8315
- const newPath = decodeURIComponent(pathname.replace(/\/+$/, ""));
8316
- if (tokens && chains && matchesAnyPatternUsingArray(newPath)) {
8317
- if (toRegex.test(newPath)) {
8318
- const [exists, chainsInfo2] = findItemByName2(
8319
- chains || [],
8320
- newPath.replace("/", "")
8321
- );
8322
- if (!exists) return;
8323
- const foundItem = tokens.find(
8324
- (item) => item.chain_id === chainsInfo2?.chain_id
8325
- );
8326
- if (foundItem) {
8327
- newParams.set("to_chain", foundItem.chain_id.toString());
8328
- newParams.set("to_token", foundItem.address.toString());
8329
- }
8330
- } else if (toAndTokenRegex.test(newPath)) {
8331
- const arr = newPath.replace("/", "").split("&");
8332
- const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
8333
- if (!exists) return;
8334
- const [result, foundItem] = findItemBySymbol2(
8335
- tokens,
8336
- arr[1],
8337
- chainsInfo2?.chain_id
8338
- );
8339
- if (!result) return;
8340
- if (result && foundItem) {
8341
- newParams.set("to_chain", foundItem.chain_id.toString());
8342
- newParams.set("to_token", foundItem.address.toString());
8343
- }
8344
- } else if (fromRegex.test(newPath)) {
8345
- const arr = newPath.split("&");
8346
- const [exists, chainsInfo2] = findItemByName2(chains, arr[1]);
8347
- if (!exists) return;
8348
- const foundItem = tokens.find(
8349
- (item) => item.chain_id === chainsInfo2?.chain_id
8350
- );
8351
- if (foundItem) {
8352
- newParams.set("from_chain", foundItem.chain_id.toString());
8353
- newParams.set("from_token", foundItem.address.toString());
8354
- }
8355
- } else if (fromAndTokenRegex.test(newPath)) {
8356
- const arr = newPath.replace("/", "").split("&");
8357
- const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
8358
- if (!exists) return;
8359
- const [result, foundItem] = findItemBySymbol2(
8360
- tokens,
8361
- arr[1],
8362
- chainsInfo2?.chain_id
8363
- );
8364
- if (!result) return;
8365
- if (result && foundItem) {
8366
- newParams.set("from_chain", foundItem.chain_id.toString());
8367
- newParams.set("from_token", foundItem.address.toString());
8368
- }
8369
- } else if (fromAndToRegex.test(newPath)) {
8370
- const arr = newPath.split("/");
8371
- const [resultFrom, fromChainsInfo] = findItemByName2(chains, arr[1]);
8372
- if (!resultFrom) return;
8373
- const foundFromItem = tokens.find(
8374
- (item) => item.chain_id === fromChainsInfo?.chain_id
8375
- );
8376
- if (!foundFromItem) return;
8377
- newParams.set("from_chain", foundFromItem.chain_id.toString());
8378
- newParams.set("from_token", foundFromItem.address.toString());
8379
- const [resultTo, toChainsInfo] = findItemByName2(chains, arr[2]);
8380
- if (!resultTo) return;
8381
- const foundToItem = tokens.find(
8382
- (item) => item.chain_id === toChainsInfo?.chain_id
8383
- );
8384
- if (!foundToItem) return;
8385
- newParams.set("to_chain", foundToItem.chain_id.toString());
8386
- newParams.set("to_token", foundToItem.address.toString());
8387
- } else if (fromAndTokenAndToAndTokenRegex.test(newPath)) {
8388
- const arr = newPath.split("/");
8389
- const arrFrom = arr[1].split("&");
8390
- const [resultFrom, fromChainsInfo] = findItemByName2(
8391
- chains,
8392
- arrFrom[0]
8393
- );
8394
- if (!resultFrom) return;
8395
- const [resultFromToken, fromTokenInfo2] = findItemBySymbol2(
8396
- tokens,
8397
- arrFrom[1],
8398
- fromChainsInfo?.chain_id
8399
- );
8400
- if (!resultFromToken) return;
8401
- const arrTo = arr[2].split("&");
8402
- const [resultTo, toChainsInfo] = findItemByName2(chains, arrTo[0]);
8403
- if (!resultTo) return;
8404
- const [resultToToken, toTokenInfo2] = findItemBySymbol2(
8405
- tokens,
8406
- arrTo[1],
8407
- toChainsInfo?.chain_id
8408
- );
8409
- if (!resultToToken) return;
8410
- if (fromTokenInfo2 && toTokenInfo2) {
8411
- newParams.set("to_chain", toTokenInfo2.chain_id.toString());
8412
- newParams.set("to_token", toTokenInfo2.address.toString());
8413
- newParams.set("from_chain", fromTokenInfo2.chain_id.toString());
8414
- newParams.set("from_token", fromTokenInfo2.address.toString());
8415
- }
8416
- }
8417
- }
8418
- replaceLink(`${pathname.replace(pathname, "")}/?${newParams.toString()}`);
8419
- },
8420
- [pathname, replaceLink, chains, tokens]
8421
- );
8422
8363
  const [isModalOpen, setIsModalOpen] = useState(false);
8423
8364
  const [isDifferentAddressDialogOpen, setIsDifferentAddressDialogOpen] = useState(false);
8424
8365
  const [isSelectingFromToken, setIsSelectingFromToken] = useState(false);
@@ -8629,15 +8570,12 @@ var FormBody = ({
8629
8570
  }, [tokens]);
8630
8571
  const handleSelectToken = useCallback(
8631
8572
  (tokenInfo) => {
8632
- const params = {};
8633
8573
  const isTestnetChain = (chainId) => {
8634
8574
  const chainInfo = chains?.find((chain) => chain.chain_id === chainId);
8635
8575
  return chainInfo?.is_testnet === true;
8636
8576
  };
8637
8577
  if (isSelectingFromToken) {
8638
8578
  setFromTokenInfo(tokenInfo);
8639
- params.from_chain = tokenInfo.chain_id.toString();
8640
- params.from_token = tokenInfo.address;
8641
8579
  if (isTestnetChain(tokenInfo.chain_id)) {
8642
8580
  const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === zeroAddress;
8643
8581
  if (isNativeToken) {
@@ -8646,8 +8584,6 @@ var FormBody = ({
8646
8584
  );
8647
8585
  if (otherToken) {
8648
8586
  setToTokenInfo(otherToken);
8649
- params.to_chain = otherToken.chain_id.toString();
8650
- params.to_token = otherToken.address;
8651
8587
  }
8652
8588
  } else {
8653
8589
  const nativeToken = tokens?.find(
@@ -8655,16 +8591,12 @@ var FormBody = ({
8655
8591
  );
8656
8592
  if (nativeToken && (nativeToken.chain_id !== toTokenInfo?.chain_id || nativeToken.address !== toTokenInfo?.address)) {
8657
8593
  setToTokenInfo(nativeToken);
8658
- params.to_chain = nativeToken.chain_id.toString();
8659
- params.to_token = nativeToken.address;
8660
8594
  } else if (!nativeToken) {
8661
8595
  const otherToken = tokens?.find(
8662
8596
  (t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
8663
8597
  );
8664
8598
  if (otherToken) {
8665
8599
  setToTokenInfo(otherToken);
8666
- params.to_chain = otherToken.chain_id.toString();
8667
- params.to_token = otherToken.address;
8668
8600
  }
8669
8601
  }
8670
8602
  }
@@ -8675,15 +8607,11 @@ var FormBody = ({
8675
8607
  );
8676
8608
  if (baseEthToken) {
8677
8609
  setToTokenInfo(baseEthToken);
8678
- params.to_chain = baseEthToken.chain_id.toString();
8679
- params.to_token = baseEthToken.address;
8680
8610
  }
8681
8611
  }
8682
8612
  }
8683
8613
  } else {
8684
8614
  setToTokenInfo(tokenInfo);
8685
- params.to_chain = tokenInfo.chain_id.toString();
8686
- params.to_token = tokenInfo.address;
8687
8615
  if (isTestnetChain(tokenInfo.chain_id)) {
8688
8616
  const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === zeroAddress;
8689
8617
  if (isNativeToken) {
@@ -8692,8 +8620,6 @@ var FormBody = ({
8692
8620
  );
8693
8621
  if (otherToken) {
8694
8622
  setFromTokenInfo(otherToken);
8695
- params.from_chain = otherToken.chain_id.toString();
8696
- params.from_token = otherToken.address;
8697
8623
  }
8698
8624
  } else {
8699
8625
  const nativeToken = tokens?.find(
@@ -8701,16 +8627,12 @@ var FormBody = ({
8701
8627
  );
8702
8628
  if (nativeToken && (nativeToken.chain_id !== fromTokenInfo?.chain_id || nativeToken.address !== fromTokenInfo?.address)) {
8703
8629
  setFromTokenInfo(nativeToken);
8704
- params.from_chain = nativeToken.chain_id.toString();
8705
- params.from_token = nativeToken.address;
8706
8630
  } else if (!nativeToken) {
8707
8631
  const otherToken = tokens?.find(
8708
8632
  (t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
8709
8633
  );
8710
8634
  if (otherToken) {
8711
8635
  setFromTokenInfo(otherToken);
8712
- params.from_chain = otherToken.chain_id.toString();
8713
- params.from_token = otherToken.address;
8714
8636
  }
8715
8637
  }
8716
8638
  }
@@ -8721,13 +8643,10 @@ var FormBody = ({
8721
8643
  );
8722
8644
  if (soneiumEthToken) {
8723
8645
  setFromTokenInfo(soneiumEthToken);
8724
- params.from_chain = soneiumEthToken.chain_id.toString();
8725
- params.from_token = soneiumEthToken.address;
8726
8646
  }
8727
8647
  }
8728
8648
  }
8729
8649
  }
8730
- updateSearchParams(params);
8731
8650
  handleCloseModal();
8732
8651
  setQuoteInfo(initialQuoteInfo);
8733
8652
  saveTokenSelection();
@@ -8738,7 +8657,6 @@ var FormBody = ({
8738
8657
  setFromTokenInfo,
8739
8658
  setQuoteInfo,
8740
8659
  setToTokenInfo,
8741
- updateSearchParams,
8742
8660
  tokens,
8743
8661
  fromTokenInfo,
8744
8662
  toTokenInfo,
@@ -8756,12 +8674,6 @@ var FormBody = ({
8756
8674
  const _fromAmount = toAmount;
8757
8675
  setDifferentAddress(void 0);
8758
8676
  switchTokens();
8759
- updateSearchParams({
8760
- from_chain: _fromTokenInfo.chain_id.toString(),
8761
- from_token: _fromTokenInfo.address,
8762
- to_chain: _toTokenInfo.chain_id.toString(),
8763
- to_token: _toTokenInfo.address
8764
- });
8765
8677
  const _fromAddress = () => {
8766
8678
  if (_fromTokenInfo.isSolana) {
8767
8679
  return solanaWalletAddress || "";
@@ -9116,7 +9028,9 @@ var SlippageSettings = ({ refetchQuote }) => {
9116
9028
  base: "20px",
9117
9029
  md: "22px"
9118
9030
  },
9119
- as: SettingsIcon
9031
+ as: SettingsIcon,
9032
+ position: "relative",
9033
+ top: "-2px"
9120
9034
  }
9121
9035
  ),
9122
9036
  showYellowDot && /* @__PURE__ */ jsx(
@@ -9343,10 +9257,92 @@ var FormTop = ({
9343
9257
  quoteInfo,
9344
9258
  clearLockedRequestId,
9345
9259
  refreshInterval = 30,
9346
- hideCountdown = false
9260
+ hideCountdown = false,
9261
+ onHistoryClick
9347
9262
  }) => {
9348
9263
  const { isLoading: isLoadingRefresh } = useRefreshLoading();
9349
9264
  const { theme } = useWidgetTheme();
9265
+ const { disconnect } = useDisconnect();
9266
+ const connectors = useConnectors();
9267
+ const { connector: wagmiConnector } = useAccount();
9268
+ const { removeWallet } = useDynamicContext();
9269
+ const userWallets = useUserWallets();
9270
+ const {
9271
+ isEthWalletConnected,
9272
+ evmWalletConnectorId,
9273
+ isSolanaWalletConnected,
9274
+ setEvmWalletInfo,
9275
+ setIsEthWalletConnected,
9276
+ setSolanaWalletAddress,
9277
+ setIsSolanaWalletConnected,
9278
+ setIsLoggingOut: setStoreLoggingOut,
9279
+ setLastDisconnectTimestamp
9280
+ } = useWalletConnectedStore();
9281
+ const isAnyWalletConnected = isEthWalletConnected || isSolanaWalletConnected;
9282
+ const [isLogoutDialogOpen, setIsLogoutDialogOpen] = useState(false);
9283
+ const [isLoggingOut, setIsLoggingOut] = useState(false);
9284
+ const handleLogout = useCallback(async () => {
9285
+ setIsLoggingOut(true);
9286
+ setStoreLoggingOut(true);
9287
+ const currentEvmConnectorId = evmWalletConnectorId;
9288
+ try {
9289
+ for (const wallet of userWallets) {
9290
+ const walletId = wallet.id || wallet.walletId;
9291
+ if (walletId) {
9292
+ try {
9293
+ await removeWallet(walletId);
9294
+ } catch (e) {
9295
+ console.error("Dynamic removeWallet failed:", e);
9296
+ }
9297
+ }
9298
+ }
9299
+ const evmConnector = connectors.find((c) => c.id === currentEvmConnectorId);
9300
+ if (evmConnector) {
9301
+ disconnect({ connector: evmConnector });
9302
+ } else if (wagmiConnector) {
9303
+ disconnect({ connector: wagmiConnector });
9304
+ }
9305
+ if (typeof window !== "undefined") {
9306
+ window.localStorage.removeItem("wagmi.cache");
9307
+ window.localStorage.removeItem("wagmi.wallet");
9308
+ window.sessionStorage.removeItem("wagmi.cache");
9309
+ window.sessionStorage.removeItem("wagmi.wallet");
9310
+ const storages = [window.localStorage, window.sessionStorage];
9311
+ storages.forEach((storage) => {
9312
+ const keysToRemove = [];
9313
+ for (let i = 0; i < storage.length; i++) {
9314
+ const key = storage.key(i);
9315
+ if (key && (key.startsWith("dynamic_") || key.includes("_dynamic_"))) {
9316
+ keysToRemove.push(key);
9317
+ }
9318
+ }
9319
+ keysToRemove.forEach((key) => storage.removeItem(key));
9320
+ });
9321
+ }
9322
+ setEvmWalletInfo(null, null);
9323
+ setIsEthWalletConnected(false);
9324
+ setSolanaWalletAddress(null);
9325
+ setIsSolanaWalletConnected(false);
9326
+ setLastDisconnectTimestamp(Date.now());
9327
+ } finally {
9328
+ setStoreLoggingOut(false);
9329
+ setIsLoggingOut(false);
9330
+ setIsLogoutDialogOpen(false);
9331
+ }
9332
+ }, [
9333
+ userWallets,
9334
+ removeWallet,
9335
+ connectors,
9336
+ evmWalletConnectorId,
9337
+ wagmiConnector,
9338
+ disconnect,
9339
+ setEvmWalletInfo,
9340
+ setIsEthWalletConnected,
9341
+ setSolanaWalletAddress,
9342
+ setIsSolanaWalletConnected,
9343
+ setStoreLoggingOut,
9344
+ setLastDisconnectTimestamp
9345
+ ]);
9350
9346
  const isPolling = Boolean(quoteInfo?.request_id && !isLoadingRefresh);
9351
9347
  const [countdown, setCountdown] = useState(refreshInterval);
9352
9348
  useEffect(() => {
@@ -9384,7 +9380,24 @@ var FormTop = ({
9384
9380
  children: "Bridge & Swap"
9385
9381
  }
9386
9382
  ),
9387
- /* @__PURE__ */ jsxs(HStack, { color: theme.weakTextColor || "#81728C", children: [
9383
+ /* @__PURE__ */ jsxs(HStack, { color: theme.weakTextColor, children: [
9384
+ isAnyWalletConnected && /* @__PURE__ */ jsx(
9385
+ Box,
9386
+ {
9387
+ w: "21px",
9388
+ h: "21px",
9389
+ display: "flex",
9390
+ alignItems: "center",
9391
+ justifyContent: "center",
9392
+ cursor: "pointer",
9393
+ onClick: onHistoryClick,
9394
+ title: "Transaction history",
9395
+ children: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", children: [
9396
+ /* @__PURE__ */ jsx("path", { fill: theme.weakTextColor, d: "M14 2l-8 8v20h22v-28h-14zM14 4.8v5.2h-5.2l5.2-5.2zM26 28h-18v-16h8v-8h10v24z" }),
9397
+ /* @__PURE__ */ jsx("path", { fill: theme.weakTextColor, d: "M10 14h14v2h-14v-2zM10 18h14v2h-14v-2zM10 22h14v2h-14v-2z" })
9398
+ ] })
9399
+ }
9400
+ ),
9388
9401
  /* @__PURE__ */ jsxs(
9389
9402
  HStack,
9390
9403
  {
@@ -9454,8 +9467,36 @@ var FormTop = ({
9454
9467
  ]
9455
9468
  }
9456
9469
  ),
9457
- /* @__PURE__ */ jsx(SlippageSettings, { refetchQuote })
9458
- ] })
9470
+ /* @__PURE__ */ jsx(SlippageSettings, { refetchQuote }),
9471
+ isAnyWalletConnected && /* @__PURE__ */ jsx(
9472
+ HStack,
9473
+ {
9474
+ w: "30px",
9475
+ h: "30px",
9476
+ display: "flex",
9477
+ alignItems: "center",
9478
+ justifyContent: "center",
9479
+ cursor: "pointer",
9480
+ title: "Disconnect all wallets",
9481
+ onClick: () => setIsLogoutDialogOpen(true),
9482
+ children: /* @__PURE__ */ jsx(IoMdLogOut, { style: { width: "22px", height: "22px" }, color: theme.weakTextColor })
9483
+ }
9484
+ )
9485
+ ] }),
9486
+ /* @__PURE__ */ jsx(Dialog.Root, { open: isLogoutDialogOpen, onOpenChange: (e) => setIsLogoutDialogOpen(e.open), children: /* @__PURE__ */ jsxs(Portal, { children: [
9487
+ /* @__PURE__ */ jsx(Dialog.Backdrop, {}),
9488
+ /* @__PURE__ */ jsx(Dialog.Positioner, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs(Dialog.Content, { bgColor: theme.defaultBgColor, color: theme.defaultTextColor, width: ["90vw", "400px"], children: [
9489
+ /* @__PURE__ */ jsxs(Dialog.Header, { justifyContent: "center", children: [
9490
+ /* @__PURE__ */ jsx(Dialog.Title, { padding: "15px 0", children: "Disconnect Wallet" }),
9491
+ /* @__PURE__ */ jsx(Dialog.CloseTrigger, {})
9492
+ ] }),
9493
+ /* @__PURE__ */ jsx(Dialog.Body, { marginBottom: "20px", children: /* @__PURE__ */ jsx(Text, { textAlign: "center", padding: ["0 15px", "0 30px"], children: "This operation will disconnect all connected wallets." }) }),
9494
+ /* @__PURE__ */ jsxs(Dialog.Footer, { padding: ["10px 20px 20px"], justifyContent: "center", children: [
9495
+ /* @__PURE__ */ jsx(Dialog.ActionTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "outline", disabled: isLoggingOut, w: "100px", bgColor: theme.normalButtonBg, color: theme.normalButtonText, children: "Cancel" }) }),
9496
+ /* @__PURE__ */ jsx(Button, { bgColor: theme.highlightButtonBg, color: theme.highlightButtonText, onClick: handleLogout, loading: isLoggingOut, w: "100px", children: "Disconnect" })
9497
+ ] })
9498
+ ] }) })
9499
+ ] }) })
9459
9500
  ] });
9460
9501
  };
9461
9502
  var Timer = ({ stop, onTick }) => {
@@ -10416,6 +10457,381 @@ var TxState = ({
10416
10457
  }
10417
10458
  ) });
10418
10459
  };
10460
+ async function getOrderHistory(address, offset = 0, limit = 4) {
10461
+ const url = `${BASE_API_URL}/v1/orders`;
10462
+ const res = await axios6.get(url, {
10463
+ params: {
10464
+ address: Array.isArray(address) ? address : [address],
10465
+ offset,
10466
+ limit
10467
+ },
10468
+ paramsSerializer: {
10469
+ indexes: null
10470
+ }
10471
+ });
10472
+ return res.data;
10473
+ }
10474
+ var useOrderHistory = (address, address2, offset, limit) => {
10475
+ const addresses = address && address2 ? [address, address2] : address;
10476
+ return useQuery({
10477
+ queryKey: ["orderHistory", addresses, offset],
10478
+ queryFn: () => addresses ? getOrderHistory(addresses, offset, limit) : Promise.reject("No address provided"),
10479
+ enabled: !!addresses,
10480
+ placeholderData: keepPreviousData,
10481
+ refetchOnWindowFocus: false
10482
+ });
10483
+ };
10484
+ function SuccessIcon() {
10485
+ return /* @__PURE__ */ jsx(Box, { w: "16px", h: "16px", borderRadius: "full", bg: "#00CBB3", display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M1 4L3.5 6.5L9 1", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) });
10486
+ }
10487
+ function ErrorIcon() {
10488
+ return /* @__PURE__ */ jsx(Box, { w: "16px", h: "16px", borderRadius: "full", bg: "#FF4267", display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M1 1L7 7M7 1L1 7", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round" }) }) });
10489
+ }
10490
+ function PendingIcon() {
10491
+ return /* @__PURE__ */ jsx(Box, { w: "16px", h: "16px", borderRadius: "full", bg: "#FFD200", display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", children: /* @__PURE__ */ jsx("circle", { cx: "4", cy: "4", r: "3", stroke: "white", strokeWidth: "1.5" }) }) });
10492
+ }
10493
+ function getStatusIcon(status) {
10494
+ switch (status) {
10495
+ case "Filled":
10496
+ return /* @__PURE__ */ jsx(SuccessIcon, {});
10497
+ case "Refund":
10498
+ case "Failed":
10499
+ return /* @__PURE__ */ jsx(ErrorIcon, {});
10500
+ case "Open":
10501
+ return /* @__PURE__ */ jsx(PendingIcon, {});
10502
+ default:
10503
+ return /* @__PURE__ */ jsx(SuccessIcon, {});
10504
+ }
10505
+ }
10506
+ function OrderHistoryItem({ order }) {
10507
+ const { theme } = useWidgetTheme();
10508
+ const fromTokenInfo = order.from_token_info;
10509
+ const toTokenInfo = order.to_token_info;
10510
+ const isSameChainSwap = order.from_chain === order.to_chain;
10511
+ const renderTxLink = (txHash, chainId, label) => {
10512
+ const link = getTxLink(txHash, chainId);
10513
+ if (!link) {
10514
+ return /* @__PURE__ */ jsx(Text2, { variant: "content8", color: theme.defaultTextColor, children: sliceAddress(txHash, 6) });
10515
+ }
10516
+ return /* @__PURE__ */ jsx("a", { href: link, target: "_blank", rel: "noreferrer", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsx(HStack, { gap: 1, children: /* @__PURE__ */ jsx(Text2, { variant: "content8", color: theme.highlightTextColor, children: sliceAddress(txHash, 6) }) }) });
10517
+ };
10518
+ return /* @__PURE__ */ jsxs(
10519
+ Box,
10520
+ {
10521
+ w: "100%",
10522
+ borderRadius: "12px",
10523
+ p: "10px 15px",
10524
+ bg: theme.assistBgColor,
10525
+ _hover: { bg: theme.highlightBgColor },
10526
+ transition: "background 0.15s",
10527
+ children: [
10528
+ /* @__PURE__ */ jsxs(HStack, { justify: "center", mb: 2, children: [
10529
+ /* @__PURE__ */ jsxs(HStack, { gap: 1.5, children: [
10530
+ getStatusIcon(isSameChainSwap ? "Filled" : order.status),
10531
+ /* @__PURE__ */ jsx(
10532
+ Text2,
10533
+ {
10534
+ variant: "content7",
10535
+ color: theme.defaultTextColor || "#15003E",
10536
+ fontWeight: 500,
10537
+ children: isSameChainSwap ? "Filled" : order.status
10538
+ }
10539
+ )
10540
+ ] }),
10541
+ /* @__PURE__ */ jsx(Text2, { variant: "content8", color: theme.weakTextColor || "#81728C", children: dateFormatter(order.open_timestamp) })
10542
+ ] }),
10543
+ /* @__PURE__ */ jsxs(HStack, { justify: "space-between", w: "100%", children: [
10544
+ /* @__PURE__ */ jsxs(HStack, { gap: 2, mb: 1.5, children: [
10545
+ /* @__PURE__ */ jsx(Box, { w: "32px", h: "32px", flexShrink: 0, marginRight: "10px", children: /* @__PURE__ */ jsx(
10546
+ TokenIconWithNetworkLogo,
10547
+ {
10548
+ w: "100%",
10549
+ h: "100%",
10550
+ tokenInfo: fromTokenInfo
10551
+ }
10552
+ ) }),
10553
+ /* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0.5, flex: 1, w: "80px", children: [
10554
+ /* @__PURE__ */ jsx(
10555
+ TokenAmountHeading,
10556
+ {
10557
+ amount: new Fraction(order.from_amount),
10558
+ decimals: fromTokenInfo?.decimals,
10559
+ suffix: fromTokenInfo?.symbol,
10560
+ variant: "heading12"
10561
+ }
10562
+ ),
10563
+ /* @__PURE__ */ jsx(HStack, { gap: 1, children: renderTxLink(order.open_tx_hash, order.from_chain) })
10564
+ ] })
10565
+ ] }),
10566
+ /* @__PURE__ */ jsx(HStack, { justify: "center", my: 0.5, flex: 1, children: /* @__PURE__ */ jsx(HiMiniArrowRight, { color: theme.weakTextColor, width: "30px", height: "30px" }) }),
10567
+ /* @__PURE__ */ jsxs(HStack, { gap: 2, mt: 0, children: [
10568
+ /* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0.5, flex: 1, w: "80px", children: [
10569
+ /* @__PURE__ */ jsx(
10570
+ TokenAmountHeading,
10571
+ {
10572
+ amount: new Fraction(order.to_amount || order.amount_out || "0"),
10573
+ decimals: toTokenInfo?.decimals,
10574
+ suffix: toTokenInfo?.symbol,
10575
+ variant: "heading12",
10576
+ justifyContent: "flex-end",
10577
+ width: "100%",
10578
+ display: "flex"
10579
+ }
10580
+ ),
10581
+ /* @__PURE__ */ jsx(HStack, { gap: 1, justifyContent: "flex-end", w: "100%", children: isSameChainSwap ? renderTxLink(order.open_tx_hash, order.from_chain) : order.fill_tx_hash ? renderTxLink(order.fill_tx_hash, order.to_chain) : /* @__PURE__ */ jsx(Text2, { variant: "content8", color: theme.defaultTextColor, children: "Receiving..." }) })
10582
+ ] }),
10583
+ /* @__PURE__ */ jsx(Box, { w: "32px", h: "32px", flexShrink: 0, marginRight: "10px", marginLeft: "3px", children: /* @__PURE__ */ jsx(
10584
+ TokenIconWithNetworkLogo,
10585
+ {
10586
+ w: "100%",
10587
+ h: "100%",
10588
+ tokenInfo: toTokenInfo
10589
+ }
10590
+ ) })
10591
+ ] })
10592
+ ] })
10593
+ ]
10594
+ }
10595
+ );
10596
+ }
10597
+ var PaginationButton = ({
10598
+ currentPage,
10599
+ page,
10600
+ onClick
10601
+ }) => {
10602
+ const { theme } = useWidgetTheme();
10603
+ return /* @__PURE__ */ jsx(
10604
+ Box,
10605
+ {
10606
+ bg: currentPage === page ? theme.highlightButtonBg : "transparent",
10607
+ color: currentPage === page ? theme.highlightButtonText : theme.weakTextColor,
10608
+ w: "24px",
10609
+ h: "24px",
10610
+ borderRadius: "full",
10611
+ display: "flex",
10612
+ alignItems: "center",
10613
+ justifyContent: "center",
10614
+ cursor: "pointer",
10615
+ onClick,
10616
+ fontSize: "12px",
10617
+ fontWeight: 500,
10618
+ transition: "all 0.2s",
10619
+ children: page
10620
+ }
10621
+ );
10622
+ };
10623
+ function OrderHistoryPagination({
10624
+ currentPage,
10625
+ totalPages,
10626
+ setCurrentPage
10627
+ }) {
10628
+ const { theme } = useWidgetTheme();
10629
+ const handlePrevious = () => {
10630
+ if (currentPage > 1) setCurrentPage(currentPage - 1);
10631
+ };
10632
+ const handleNext = () => {
10633
+ if (currentPage < totalPages) setCurrentPage(currentPage + 1);
10634
+ };
10635
+ if (totalPages <= 1) return null;
10636
+ return /* @__PURE__ */ jsxs(
10637
+ HStack,
10638
+ {
10639
+ justify: "space-between",
10640
+ align: "center",
10641
+ pt: 2,
10642
+ pb: 1,
10643
+ gap: 2,
10644
+ w: "100%",
10645
+ children: [
10646
+ /* @__PURE__ */ jsx(
10647
+ Button,
10648
+ {
10649
+ variant: "plain",
10650
+ onClick: handlePrevious,
10651
+ disabled: currentPage === 1,
10652
+ h: "28px",
10653
+ minW: "28px",
10654
+ p: 0,
10655
+ children: /* @__PURE__ */ jsxs(HStack, { gap: 0, color: currentPage === 1 ? theme.disabledButtonText || "#B5B5B5" : theme.defaultTextColor || "#15003E", children: [
10656
+ /* @__PURE__ */ jsx(BackIcon, { size: 20 }),
10657
+ /* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "11px", children: "Prev" })
10658
+ ] })
10659
+ }
10660
+ ),
10661
+ /* @__PURE__ */ jsx(HStack, { gap: 1, color: theme.weakTextColor || "#81728C", children: totalPages <= 7 ? Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ jsx(
10662
+ PaginationButton,
10663
+ {
10664
+ currentPage,
10665
+ page,
10666
+ onClick: () => setCurrentPage(page)
10667
+ },
10668
+ page
10669
+ )) : /* @__PURE__ */ jsxs(Fragment, { children: [
10670
+ /* @__PURE__ */ jsx(
10671
+ PaginationButton,
10672
+ {
10673
+ currentPage,
10674
+ page: 1,
10675
+ onClick: () => setCurrentPage(1)
10676
+ }
10677
+ ),
10678
+ currentPage > 4 && /* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "12px", children: "..." }),
10679
+ Array.from({ length: 3 }, (_, i) => {
10680
+ const page = currentPage - 1 + i;
10681
+ if (page > 1 && page < totalPages) {
10682
+ return /* @__PURE__ */ jsx(
10683
+ PaginationButton,
10684
+ {
10685
+ currentPage,
10686
+ page,
10687
+ onClick: () => setCurrentPage(page)
10688
+ },
10689
+ page
10690
+ );
10691
+ }
10692
+ return null;
10693
+ }),
10694
+ currentPage < totalPages - 3 && /* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "12px", children: "..." }),
10695
+ totalPages > 1 && /* @__PURE__ */ jsx(
10696
+ PaginationButton,
10697
+ {
10698
+ currentPage,
10699
+ page: totalPages,
10700
+ onClick: () => setCurrentPage(totalPages)
10701
+ }
10702
+ )
10703
+ ] }) }),
10704
+ /* @__PURE__ */ jsx(
10705
+ Button,
10706
+ {
10707
+ variant: "plain",
10708
+ onClick: handleNext,
10709
+ disabled: currentPage === totalPages,
10710
+ h: "28px",
10711
+ minW: "28px",
10712
+ p: 0,
10713
+ children: /* @__PURE__ */ jsxs(
10714
+ HStack,
10715
+ {
10716
+ gap: 0,
10717
+ color: currentPage === totalPages ? theme.disabledButtonText || "#B5B5B5" : theme.defaultTextColor || "#15003E",
10718
+ children: [
10719
+ /* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "11px", children: "Next" }),
10720
+ /* @__PURE__ */ jsx(Box, { transform: "rotate(180deg)", children: /* @__PURE__ */ jsx(BackIcon, { size: 20 }) })
10721
+ ]
10722
+ }
10723
+ )
10724
+ }
10725
+ )
10726
+ ]
10727
+ }
10728
+ );
10729
+ }
10730
+ var PAGE_SIZE = 4;
10731
+ function OrderHistory({ address, solanaAddress, onBack }) {
10732
+ const { theme } = useWidgetTheme();
10733
+ const [currentPage, setCurrentPage] = useState(1);
10734
+ const [offset, setOffset] = useState(0);
10735
+ const { data, isLoading, error, isFetching } = useOrderHistory(
10736
+ address,
10737
+ solanaAddress,
10738
+ offset,
10739
+ PAGE_SIZE
10740
+ );
10741
+ const totalItems = data?.total || 0;
10742
+ const totalPages = Math.ceil(totalItems / PAGE_SIZE);
10743
+ const currentOrders = data?.orders || [];
10744
+ const handlePageChange = (page) => {
10745
+ const newOffset = (page - 1) * PAGE_SIZE;
10746
+ setOffset(newOffset);
10747
+ setCurrentPage(page);
10748
+ };
10749
+ const renderContent = () => {
10750
+ if (isLoading) {
10751
+ return /* @__PURE__ */ jsxs(VStack, { gap: 4, py: 10, align: "center", w: "100%", children: [
10752
+ /* @__PURE__ */ jsx(Spinner, { size: "md", color: theme.highlightTextColor }),
10753
+ /* @__PURE__ */ jsx(Text2, { variant: "content7", color: theme.weakTextColor || "#81728C", children: "Loading transactions..." })
10754
+ ] });
10755
+ }
10756
+ if (error) {
10757
+ return /* @__PURE__ */ jsx(
10758
+ Box,
10759
+ {
10760
+ border: "1px solid #FF4267",
10761
+ borderRadius: "8px",
10762
+ p: 3,
10763
+ my: 4,
10764
+ bg: "#FFF5F5",
10765
+ children: /* @__PURE__ */ jsx(Text2, { variant: "content7", color: "#FF4267", textAlign: "center", children: "Failed to load transaction history. Please try again." })
10766
+ }
10767
+ );
10768
+ }
10769
+ if (currentOrders.length === 0) {
10770
+ const emptyColor = theme.defaultBorderColor || "#E0D8E8";
10771
+ return /* @__PURE__ */ jsxs(VStack, { gap: 4, py: 10, align: "center", w: "100%", children: [
10772
+ /* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", children: [
10773
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "40", height: "32", rx: "4", stroke: emptyColor, strokeWidth: "2", fill: "none" }),
10774
+ /* @__PURE__ */ jsx("path", { d: "M16 20H32", stroke: emptyColor, strokeWidth: "2", strokeLinecap: "round" }),
10775
+ /* @__PURE__ */ jsx("path", { d: "M16 28H28", stroke: emptyColor, strokeWidth: "2", strokeLinecap: "round" })
10776
+ ] }),
10777
+ /* @__PURE__ */ jsx(Text2, { variant: "content7", color: theme.weakTextColor || "#81728C", textAlign: "center", children: "No transaction history yet" })
10778
+ ] });
10779
+ }
10780
+ return /* @__PURE__ */ jsxs(Box, { position: "relative", w: "100%", children: [
10781
+ isFetching && /* @__PURE__ */ jsx(
10782
+ Box,
10783
+ {
10784
+ position: "absolute",
10785
+ zIndex: 10,
10786
+ top: 0,
10787
+ left: 0,
10788
+ right: 0,
10789
+ bottom: 0,
10790
+ display: "flex",
10791
+ alignItems: "center",
10792
+ justifyContent: "center",
10793
+ children: /* @__PURE__ */ jsx(Spinner, { size: "sm", color: theme.highlightTextColor })
10794
+ }
10795
+ ),
10796
+ /* @__PURE__ */ jsx(VStack, { gap: 2.5, w: "100%", children: currentOrders.map((order) => /* @__PURE__ */ jsx(OrderHistoryItem, { order }, order.order_id)) }),
10797
+ /* @__PURE__ */ jsx(
10798
+ OrderHistoryPagination,
10799
+ {
10800
+ currentPage,
10801
+ totalPages,
10802
+ setCurrentPage: handlePageChange
10803
+ }
10804
+ )
10805
+ ] });
10806
+ };
10807
+ return /* @__PURE__ */ jsxs(VStack, { w: "100%", gap: 4, align: "start", children: [
10808
+ /* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", align: "center", children: [
10809
+ /* @__PURE__ */ jsx(
10810
+ Button,
10811
+ {
10812
+ variant: "plain",
10813
+ onClick: onBack,
10814
+ h: "24px",
10815
+ minW: "24px",
10816
+ p: 0,
10817
+ children: /* @__PURE__ */ jsx(RiArrowGoBackFill, { color: theme.defaultTextColor, size: 20 })
10818
+ }
10819
+ ),
10820
+ /* @__PURE__ */ jsx(
10821
+ Text2,
10822
+ {
10823
+ color: theme.defaultTextColor,
10824
+ textAlign: "center",
10825
+ fontWeight: 600,
10826
+ fontSize: "16px",
10827
+ children: "Transaction history"
10828
+ }
10829
+ ),
10830
+ /* @__PURE__ */ jsx(Box, { w: "24px" })
10831
+ ] }),
10832
+ renderContent()
10833
+ ] });
10834
+ }
10419
10835
  var initialQuoteInfo = {
10420
10836
  isFetching: false,
10421
10837
  error: null,
@@ -10464,6 +10880,7 @@ var MainForm = ({ config }) => {
10464
10880
  const refreshIntervalRef = useRef(30);
10465
10881
  const timerRef = useRef(null);
10466
10882
  const isQuoteStoppedRef = useRef(false);
10883
+ const [showHistory, setShowHistory] = useState(false);
10467
10884
  const { differentAddress } = useDifferentAddressStore();
10468
10885
  const { chains, slippagePolicies } = useChainsStore();
10469
10886
  const prevAddressRef = useRef(address);
@@ -10868,6 +11285,16 @@ var MainForm = ({ config }) => {
10868
11285
  }
10869
11286
  ) });
10870
11287
  }
11288
+ if (showHistory) {
11289
+ return /* @__PURE__ */ jsx(
11290
+ OrderHistory,
11291
+ {
11292
+ address,
11293
+ solanaAddress: solanaWalletAddress || void 0,
11294
+ onBack: () => setShowHistory(false)
11295
+ }
11296
+ );
11297
+ }
10871
11298
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10872
11299
  /* @__PURE__ */ jsx(
10873
11300
  FormTop,
@@ -10876,7 +11303,8 @@ var MainForm = ({ config }) => {
10876
11303
  quoteInfo,
10877
11304
  clearLockedRequestId,
10878
11305
  refreshInterval,
10879
- hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains)
11306
+ hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains),
11307
+ onHistoryClick: () => setShowHistory(true)
10880
11308
  }
10881
11309
  ),
10882
11310
  /* @__PURE__ */ jsx(
@@ -10947,7 +11375,23 @@ var MainForm = ({ config }) => {
10947
11375
  src: "https://wheelx.fi/images/success-sprites.png",
10948
11376
  alt: "success"
10949
11377
  }
10950
- )
11378
+ ),
11379
+ !showHistory && /* @__PURE__ */ jsx(HStack, { w: "100%", justifyContent: "center", alignItems: "center", opacity: "0.7", fontSize: "13px", children: /* @__PURE__ */ jsx("a", { href: "https://wheelx.fi/", target: "_blank", style: { display: "block" }, children: /* @__PURE__ */ jsxs(HStack, { color: theme.weakTextColor, fontSize: "12px", alignContent: "center", alignItems: "center", w: "100%", children: [
11380
+ /* @__PURE__ */ jsx(Box, { children: "Powered by" }),
11381
+ /* @__PURE__ */ jsx(
11382
+ Box,
11383
+ {
11384
+ w: "14px",
11385
+ h: "14px",
11386
+ backgroundColor: "currentColor",
11387
+ maskSize: "contain",
11388
+ maskRepeat: "no-repeat",
11389
+ maskPosition: "center center",
11390
+ maskImage: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA/CAMAAACLtlvuAAAAeFBMVEUAAAAVAD4VAD4VAD4VAD4VAD4dAEAUAD8VAD4VAD8VAD4VAD4VAD8XAD8VAD4VAD4VAD4XAD8XAD8VAD4VAD4VAD8VAD8XAD8XAD8VAD4WAD8WAD8WAD8VAD4XAD8XAD8XAD8WAD4VAD4VAD4WAD8WAD8VAD4TAD0voTQoAAAAJnRSTlMA+ufG7bEXnPRh0KlsPuHZj3RDvLZWSiwfl1wwE6MmDAaIfcE6USqlGmwAAAMlSURBVEjHnZbpgqowDEZTFqnsiCgoAm4f7/+GVypMpkivjueXSo6pNWlD/2GfC+E29BU7KKKv5BgK/8vE36deT/L9Czma5D19wRWKLX3CJk1v2gfu4AaGGJ3tLLSJKjw4rYvWEMMEUHijObwVthS5A0Be2t8x1dw9YqQc9soCrocVkSWGQstiIF89XnCM4Y/Z0cqHc6AHSla06ZDvzjE6xc+3boCCiOWRFP4FI5uZXMuxGD24RAsylRYEFFZLM0I8EWvSZeYERX+gFwoH2Ma4klG2AenA2tEC3ZFC2HAN8srpd2fcqaNljv2ZqvlvZndNFFtkQiZE5MFdkGtrcKnpTwb3giNNNsucl2NeaXEiYptldh+IqyFxSZMdsKy7lC33t2MTEedmWbm8Pm9pq3EgzVaycrWy2IoF+YyaZnYGpG2n9plZa+tehWm4IvJjIs2+JnggJfRyLBFSmaVhzUfshoRLDFfy68mBs2p+Ef10uLzJ8/z8m9jPH1hQdkkenrgy1I86/HA2LCklC08cBx8iMJKTjyeJE+c2kyccbQ0P+ImFEZcu09qcTL9fWQ4Nyw5pTG2TqF7O4uVrMrHzUSFqh28KOrJsvU18YPG+6XBRd4nXPavktlKXC5F2boSe2pUT9AK44T4otfbhYepU7oVS4vZT51zGLb1Q4/zbPXBXVZodJ7RALrS8LGu5j7z5ek0VWl6W2eatmZM4nFeXyZv2vMHFNEhk7LKs5fZBBk5oeM26TJXKHfbm8SZJ6mTKyzLn3uNinEnWheTLl2W2E2TZZkHtrgCsGD69uyVd40ziS2dlkDcSit44kyRRjHBRDpDIdzPJjVw40YucAbvo7Uzy8CIHTtb+kksPsGu6v5tJLNWluxiQQbhx5O1+sQHkpRZjmEmmAikzHxACAsC26LSYNb1QWEC8m+9iRZ0pRmffkI4fe4heYj7D7hty+4i+Ieg3qo2aL9zz2F0O6j+7WZ+N5wqsv7oFV/C+t//mRr37+03wF7fpfX0Z6eduPblsZ594a991gxjbdLu1nzeId90GlUQeuHb1Rk7xQDiCm8cax5oHCen8A09+fN7BIX4wAAAAAElFTkSuQmCC)"
11391
+ }
11392
+ ),
11393
+ /* @__PURE__ */ jsx(Box, { children: "WheelX" })
11394
+ ] }) }) })
10951
11395
  ]
10952
11396
  }
10953
11397
  ),
@@ -10961,39 +11405,7 @@ var MainForm = ({ config }) => {
10961
11405
  md: "480px"
10962
11406
  }
10963
11407
  }
10964
- ),
10965
- /* @__PURE__ */ jsx(Box, { marginTop: "30px", fontSize: "14px", children: /* @__PURE__ */ jsx(
10966
- "a",
10967
- {
10968
- href: "https://github.com/wheelx-fi/wheelx-contracts/blob/main/audits/ABDK_WheelX_WheelXContracts_v_1_0.pdf",
10969
- target: "_blank",
10970
- children: /* @__PURE__ */ jsxs(
10971
- Text2,
10972
- {
10973
- color: "#5D6270",
10974
- display: "flex",
10975
- alignItems: "center",
10976
- justifyContent: "center",
10977
- children: [
10978
- "Audited By",
10979
- " ",
10980
- /* @__PURE__ */ jsx(
10981
- Image,
10982
- {
10983
- display: "block",
10984
- width: "70px",
10985
- height: "28px",
10986
- marginLeft: "2px",
10987
- objectFit: "contain",
10988
- src: "https://wheelx.fi/images/adbk.png",
10989
- alt: ""
10990
- }
10991
- )
10992
- ]
10993
- }
10994
- )
10995
- }
10996
- ) })
11408
+ )
10997
11409
  ] })
10998
11410
  }
10999
11411
  ),