@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.js CHANGED
@@ -8,13 +8,13 @@ var ethereum = require('@dynamic-labs/ethereum');
8
8
  var solana = require('@dynamic-labs/solana');
9
9
  var wagmiConnector = require('@dynamic-labs/wagmi-connector');
10
10
  var wagmi = require('wagmi');
11
+ var viem = require('viem');
11
12
  var chains$1 = require('wagmi/chains');
12
13
  var react$1 = require('@emotion/react');
13
14
  var jsxRuntime = require('react/jsx-runtime');
14
15
  var axios6 = require('axios');
15
16
  var zustand = require('zustand');
16
17
  var biFraction = require('bi-fraction');
17
- var viem = require('viem');
18
18
  var chains = require('viem/chains');
19
19
  var web3_js = require('@solana/web3.js');
20
20
  var utils = require('viem/utils');
@@ -26,6 +26,8 @@ var io5 = require('react-icons/io5');
26
26
  var fa6 = require('react-icons/fa6');
27
27
  var io = require('react-icons/io');
28
28
  var bs = require('react-icons/bs');
29
+ var hi2 = require('react-icons/hi2');
30
+ var ri = require('react-icons/ri');
29
31
 
30
32
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
31
33
 
@@ -181,7 +183,11 @@ var useWalletConnectedStore = zustand.create((set, get) => ({
181
183
  evmWalletConnectorId: null,
182
184
  setEvmWalletInfo: (address, connectorId) => set({ evmWalletAddress: address, evmWalletConnectorId: connectorId }),
183
185
  isEvmWalletMetamask: false,
184
- setIsEvmWalletMetamask: (isEvmWalletMetamask) => set({ isEvmWalletMetamask })
186
+ setIsEvmWalletMetamask: (isEvmWalletMetamask) => set({ isEvmWalletMetamask }),
187
+ isLoggingOut: false,
188
+ setIsLoggingOut: (isLoggingOut) => set({ isLoggingOut }),
189
+ lastDisconnectTimestamp: 0,
190
+ setLastDisconnectTimestamp: (ts) => set({ lastDisconnectTimestamp: ts })
185
191
  }));
186
192
 
187
193
  // src/stores/useSyncWalletConnectedStore.ts
@@ -191,14 +197,25 @@ var getEvmConnectorId = (wallet) => {
191
197
  };
192
198
  var useSyncWalletConnectedStore = () => {
193
199
  const userWallets = sdkReactCore.useUserWallets();
194
- const { address: wagmiAddress, connector: wagmiConnector, isConnected } = wagmi.useAccount();
200
+ const { address: wagmiAddress, connector: wagmiConnector } = wagmi.useAccount();
195
201
  const {
196
202
  setSolanaWalletAddress,
197
203
  setIsSolanaWalletConnected,
198
204
  setEvmWalletInfo,
199
- setIsEthWalletConnected
205
+ setIsEthWalletConnected,
206
+ isLoggingOut,
207
+ lastDisconnectTimestamp
200
208
  } = useWalletConnectedStore();
201
209
  React5.useEffect(() => {
210
+ if (isLoggingOut) return;
211
+ const msSinceDisconnect = Date.now() - lastDisconnectTimestamp;
212
+ if (msSinceDisconnect < 2e3) {
213
+ const { isEthWalletConnected, isSolanaWalletConnected } = useWalletConnectedStore.getState();
214
+ const hasNoConnectedWallets = !isEthWalletConnected && !isSolanaWalletConnected;
215
+ if (hasNoConnectedWallets) {
216
+ return;
217
+ }
218
+ }
202
219
  const solanaWallet = userWallets.find((wallet) => {
203
220
  const chain = String(
204
221
  wallet.chain ?? ""
@@ -214,15 +231,16 @@ var useSyncWalletConnectedStore = () => {
214
231
  ).toLowerCase();
215
232
  return chain.includes("evm");
216
233
  });
217
- const evmAddress = evmWallet?.address ?? wagmiAddress ?? null;
234
+ const evmAddress = evmWallet?.address ?? (evmWallet ? wagmiAddress : null) ?? null;
218
235
  const evmConnectorId = wagmiConnector?.id ?? getEvmConnectorId(evmWallet) ?? null;
219
236
  setEvmWalletInfo(evmAddress, evmConnectorId);
220
- setIsEthWalletConnected(Boolean(evmAddress || isConnected));
237
+ setIsEthWalletConnected(Boolean(evmAddress));
221
238
  }, [
222
239
  userWallets,
223
240
  wagmiAddress,
224
241
  wagmiConnector?.id,
225
- isConnected,
242
+ isLoggingOut,
243
+ lastDisconnectTimestamp,
226
244
  setSolanaWalletAddress,
227
245
  setIsSolanaWalletConnected,
228
246
  setEvmWalletInfo,
@@ -231,7 +249,8 @@ var useSyncWalletConnectedStore = () => {
231
249
  };
232
250
  var useEvmAddress = () => {
233
251
  const { address } = wagmi.useAccount();
234
- const { evmWalletAddress } = useWalletConnectedStore();
252
+ const { evmWalletAddress, isEthWalletConnected } = useWalletConnectedStore();
253
+ if (!isEthWalletConnected) return void 0;
235
254
  return evmWalletAddress || address;
236
255
  };
237
256
  var FavoritesContext = React5.createContext({
@@ -434,21 +453,140 @@ var useTokenFavoritesContext = () => {
434
453
  if (c === void 0) throw new Error("useTokenFavoritesContext must be used within TokenFavoritesProvider");
435
454
  return c;
436
455
  };
437
- var supportedChains = [chains$1.mainnet, chains$1.base, chains$1.soneium, chains$1.polygon, chains$1.arbitrum, chains$1.optimism, chains$1.sepolia, chains$1.arbitrumSepolia, chains$1.optimismSepolia, chains$1.baseSepolia, chains$1.unichainSepolia, chains$1.arcTestnet];
456
+ var tempo = viem.defineChain({
457
+ id: 4217,
458
+ name: "Tempo",
459
+ network: "Tempo",
460
+ nativeCurrency: { name: "USD", symbol: "USD", decimals: 6 },
461
+ rpcUrls: { default: { http: ["https://rpc.tempo.xyz"] } },
462
+ blockExplorers: { default: { name: "Tempo Explorer", url: "https://explore.tempo.xyz" } },
463
+ testnet: true
464
+ });
465
+ var katana = viem.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" } } });
466
+ var hyperevm = viem.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" } } });
467
+ var stable = viem.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" } } });
468
+ var monad = viem.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" } } });
469
+ var metis = viem.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" } } });
470
+ var polygonZkEvm = viem.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" } } });
471
+ var megaeth = viem.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/" } } });
472
+ var pharos = viem.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" } } });
473
+ var kite = viem.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/" } } });
474
+ var plasma = viem.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 });
475
+ var rari = viem.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 });
476
+ var stabletestnet = viem.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 });
477
+ var giwa = viem.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 });
478
+ var robinhoodTestnet = viem.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 });
479
+ var litvm = viem.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 });
480
+ var supportedChains = [
481
+ // Mainnet (wagmi/chains)
482
+ chains$1.mainnet,
483
+ chains$1.arbitrum,
484
+ chains$1.optimism,
485
+ chains$1.unichain,
486
+ chains$1.base,
487
+ chains$1.ink,
488
+ chains$1.linea,
489
+ chains$1.soneium,
490
+ chains$1.bsc,
491
+ chains$1.worldchain,
492
+ chains$1.opBNB,
493
+ chains$1.mode,
494
+ chains$1.lisk,
495
+ chains$1.zksync,
496
+ chains$1.celo,
497
+ chains$1.polygon,
498
+ chains$1.avalanche,
499
+ chains$1.plumeMainnet,
500
+ chains$1.zora,
501
+ chains$1.sonic,
502
+ chains$1.berachain,
503
+ chains$1.bob,
504
+ chains$1.abstract,
505
+ chains$1.morph,
506
+ chains$1.taiko,
507
+ chains$1.scroll,
508
+ chains$1.hemi,
509
+ chains$1.xLayer,
510
+ chains$1.mantle,
511
+ chains$1.cronos,
512
+ chains$1.gravity,
513
+ chains$1.blast,
514
+ chains$1.manta,
515
+ chains$1.zircuit,
516
+ chains$1.xdc,
517
+ chains$1.sei,
518
+ chains$1.plume,
519
+ chains$1.gnosis,
520
+ chains$1.hashkey,
521
+ chains$1.flowMainnet,
522
+ chains$1.etherlink,
523
+ chains$1.ronin,
524
+ chains$1.flare,
525
+ chains$1.rootstock,
526
+ chains$1.iota,
527
+ chains$1.pulsechain,
528
+ // Mainnet (custom chains — not in wagmi/chains)
529
+ katana,
530
+ hyperevm,
531
+ stable,
532
+ monad,
533
+ metis,
534
+ polygonZkEvm,
535
+ megaeth,
536
+ pharos,
537
+ kite,
538
+ tempo,
539
+ plasma,
540
+ rari,
541
+ // Testnet (wagmi/chains)
542
+ chains$1.sepolia,
543
+ chains$1.arbitrumSepolia,
544
+ chains$1.optimismSepolia,
545
+ chains$1.baseSepolia,
546
+ chains$1.unichainSepolia,
547
+ chains$1.arcTestnet,
548
+ // Testnet (custom chains — not in wagmi/chains)
549
+ stabletestnet,
550
+ giwa,
551
+ robinhoodTestnet,
552
+ litvm
553
+ ];
438
554
  var CORS_FRIENDLY_RPC_MAP = {
555
+ // wagmi/chains mainnet
439
556
  1: "https://eth-mainnet.public.blastapi.io",
440
557
  8453: "https://mainnet.base.org",
441
558
  1868: "https://soneium.rpc.scs.startale.com",
442
559
  137: "https://polygon-rpc.com",
560
+ 56: "https://bsc-dataseed.binance.org",
561
+ 130: "https://rpc.therpc.io/unichain",
562
+ 196: "https://rpc.xlayer.io",
443
563
  42161: "https://arbitrum.gateway.tenderly.co",
444
564
  10: "https://optimism.gateway.tenderly.co",
565
+ // Custom chains (mainnet)
566
+ 4217: "https://rpc.tempo.xyz",
567
+ 747474: "https://rpc.katana.network",
568
+ 999: "https://rpc.hyperliquid.xyz/evm",
569
+ 988: "https://rpc.stable.xyz",
570
+ 143: "https://rpc.monad.xyz",
571
+ 1088: "https://metis.api.onfinality.io/public",
572
+ 1101: "https://zkevm-rpc.com",
573
+ 4326: "https://mainnet.megaeth.com/rpc",
574
+ 1672: "https://rpc.pharos.xyz",
575
+ 2366: "https://rpc.gokite.ai/",
576
+ 9745: "https://rpc.plasma.to",
577
+ 1380012617: "https://mainnet.rpc.rarichain.org/http",
445
578
  // Testnet
446
579
  11155111: "https://ethereum-sepolia.publicnode.com",
447
580
  421614: "https://sepolia-rollup.arbitrum.io/rpc",
448
581
  11155420: "https://optimism-sepolia.gateway.tenderly.co",
449
582
  84532: "https://sepolia.base.org",
450
583
  1301: "https://sepolia.unichain.org",
451
- 5042002: "https://rpc.testnet.arc.network"
584
+ 5042002: "https://rpc.testnet.arc.network",
585
+ // Custom chains (testnet)
586
+ 2201: "https://rpc.testnet.stable.xyz",
587
+ 91342: "https://sepolia-rpc.giwa.io",
588
+ 46630: "https://rpc.testnet.chain.robinhood.com",
589
+ 4441: "https://liteforge.rpc.caldera.xyz/http"
452
590
  };
453
591
  function buildStableTransports() {
454
592
  const transports = {};
@@ -888,6 +1026,16 @@ var formatDate = (dateString) => {
888
1026
  const formattedTime = `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
889
1027
  return formattedTime;
890
1028
  };
1029
+ var dateFormatter = (isoString) => {
1030
+ const date = new Date(isoString);
1031
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1032
+ const day = String(date.getDate()).padStart(2, "0");
1033
+ const year = date.getFullYear();
1034
+ const hours = String(date.getHours()).padStart(2, "0");
1035
+ const minutes = String(date.getMinutes()).padStart(2, "0");
1036
+ const seconds = String(date.getSeconds()).padStart(2, "0");
1037
+ return `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
1038
+ };
891
1039
 
892
1040
  // src/utils/address.ts
893
1041
  var sliceAddress = (address, startLength = 4, endLength = 4) => {
@@ -959,25 +1107,6 @@ var isSolanaChain = (chain_id) => {
959
1107
  return chain_id === SOLANA_MAINNET.chain_id;
960
1108
  };
961
1109
 
962
- // src/utils/shortLinkRegex.ts
963
- var toRegex = /^\/[a-zA-Z0-9]+$/;
964
- var toAndTokenRegex = /^\/(?!from)[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
965
- var fromRegex = /^\/from&[a-zA-Z0-9-+]+$/;
966
- var fromAndTokenRegex = /^\/from&[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
967
- var fromAndToRegex = /^\/[a-zA-Z0-9-+]+\/[a-zA-Z0-9-+]+$/;
968
- var fromAndTokenAndToAndTokenRegex = /^\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
969
- var allRegexPatterns = [
970
- toRegex,
971
- toAndTokenRegex,
972
- fromRegex,
973
- fromAndTokenRegex,
974
- fromAndToRegex,
975
- fromAndTokenAndToAndTokenRegex
976
- ];
977
- function matchesAnyPatternUsingArray(inputString) {
978
- return allRegexPatterns.some((regex) => regex.test(inputString));
979
- }
980
-
981
1110
  // src/utils/tokenSelectionCache.ts
982
1111
  var TOKEN_SELECTION = "tokenSelection";
983
1112
  var tokenSelectionStore = new localstorage_default(TOKEN_SELECTION);
@@ -1065,7 +1194,7 @@ var logger = {
1065
1194
  error: errorWithTimestamp,
1066
1195
  debug: debugWithTimestamp
1067
1196
  };
1068
- var wagmiSupportedChains = [chains$1.mainnet, chains$1.base, chains$1.soneium, chains$1.polygon, chains$1.arbitrum, chains$1.optimism];
1197
+ var wagmiSupportedChains = [chains$1.mainnet, chains$1.base, chains$1.soneium, chains$1.polygon, chains$1.arbitrum, chains$1.optimism, chains$1.bsc];
1069
1198
  var getTxLink = (txHash, chainId) => {
1070
1199
  if (isSolanaChain(chainId)) {
1071
1200
  return `${SOLANA_MAINNET.explorerUrl}/tx/${txHash}`;
@@ -1137,20 +1266,6 @@ var isSolanaChain2 = (chain_id) => {
1137
1266
  };
1138
1267
 
1139
1268
  // src/core/hooks/useSwapAndBridgeContextStore.ts
1140
- function findItemByName(arr, targetName) {
1141
- const foundItem = arr.find(
1142
- (item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
1143
- );
1144
- return [foundItem !== void 0, foundItem];
1145
- }
1146
- function findItemBySymbol(arr, targetName, chainId, platform_id) {
1147
- const foundItem = arr.find((item) => {
1148
- {
1149
- return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
1150
- }
1151
- });
1152
- return [foundItem !== void 0, foundItem];
1153
- }
1154
1269
  var DEFAULT_FROM_TOKEN = {
1155
1270
  name: "Base",
1156
1271
  address: viem.zeroAddress,
@@ -1253,8 +1368,6 @@ var useInitSwapAndBridgeState = (config) => {
1253
1368
  const {
1254
1369
  setFromTokenInfo,
1255
1370
  setToTokenInfo,
1256
- setIsShortLink,
1257
- setShortLink,
1258
1371
  setFromAmount,
1259
1372
  setToAmount
1260
1373
  } = useSwapAndBridgeContextStore();
@@ -1264,11 +1377,6 @@ var useInitSwapAndBridgeState = (config) => {
1264
1377
  const address = useEvmAddress();
1265
1378
  const { resetTxState } = useTxStateContextStore();
1266
1379
  const hasInitialized = React5.useRef(false);
1267
- const currentPathname = React5.useMemo(() => {
1268
- if (typeof window === "undefined") return "/";
1269
- return window.location.pathname;
1270
- }, []);
1271
- const pathname = currentPathname;
1272
1380
  React5.useEffect(() => {
1273
1381
  if (hasInitialized.current) return;
1274
1382
  if (!chains || !tokens) return;
@@ -1310,46 +1418,8 @@ var useInitSwapAndBridgeState = (config) => {
1310
1418
  }
1311
1419
  }
1312
1420
  }
1313
- if (matchesAnyPatternUsingArray(pathname) && chains && tokens) {
1314
- setIsShortLink(true);
1315
- setShortLink(pathname);
1316
- try {
1317
- const decodedPath = decodeURIComponent(pathname);
1318
- const match = decodedPath.match(
1319
- /^\/([a-zA-Z0-9-+]+)&([a-zA-Z0-9-+.₮Ï]+)\/([a-zA-Z0-9-+]+)&([a-zA-Z0-9-+.₮Ï]+)$/
1320
- );
1321
- if (match) {
1322
- const [, fromChainName, fromTokenSymbol, toChainName, toTokenSymbol] = match;
1323
- const [, foundFromChain] = findItemByName(
1324
- chains,
1325
- fromChainName
1326
- );
1327
- const [, foundToChain] = findItemByName(
1328
- chains,
1329
- toChainName
1330
- );
1331
- if (foundFromChain && foundToChain && tokens) {
1332
- const [, foundFromToken] = findItemBySymbol(
1333
- tokens,
1334
- fromTokenSymbol,
1335
- foundFromChain.chain_id
1336
- );
1337
- const [, foundToToken] = findItemBySymbol(
1338
- tokens,
1339
- toTokenSymbol,
1340
- foundToChain.chain_id
1341
- );
1342
- if (foundFromToken && foundToToken) {
1343
- setFromTokenInfo(foundFromToken);
1344
- setToTokenInfo(foundToToken);
1345
- }
1346
- }
1347
- }
1348
- } catch {
1349
- }
1350
- }
1351
1421
  const cached = tokenSelectionStore.get(address || "default");
1352
- if (cached?.from && cached?.to && !matchesAnyPatternUsingArray(pathname)) {
1422
+ if (cached?.from && cached?.to) {
1353
1423
  setFromTokenInfo(cached.from);
1354
1424
  setToTokenInfo(cached.to);
1355
1425
  }
@@ -1361,15 +1431,12 @@ var useInitSwapAndBridgeState = (config) => {
1361
1431
  resetTxState();
1362
1432
  };
1363
1433
  }, [
1364
- pathname,
1365
1434
  address,
1366
1435
  chains,
1367
1436
  tokens,
1368
1437
  config,
1369
1438
  setFromTokenInfo,
1370
1439
  setToTokenInfo,
1371
- setIsShortLink,
1372
- setShortLink,
1373
1440
  setFromAmount,
1374
1441
  setToAmount,
1375
1442
  setDifferentAddress,
@@ -3405,6 +3472,12 @@ var FormButton = ({
3405
3472
  }) => {
3406
3473
  const { theme } = useWidgetTheme();
3407
3474
  const address = useEvmAddress();
3475
+ const {
3476
+ solanaWalletAddress,
3477
+ isSolanaWalletConnected,
3478
+ isEthWalletConnected,
3479
+ evmWalletConnectorId
3480
+ } = useWalletConnectedStore();
3408
3481
  const {
3409
3482
  address: wagmiAddress,
3410
3483
  connector,
@@ -3422,8 +3495,11 @@ var FormButton = ({
3422
3495
  return dynamicEvmWallet?.address || void 0;
3423
3496
  }, [userWallets]);
3424
3497
  const effectiveEvmAddress = React5.useMemo(
3425
- () => address || wagmiAddress || dynamicEvmWalletAddress || void 0,
3426
- [address, wagmiAddress, dynamicEvmWalletAddress]
3498
+ () => {
3499
+ if (!isEthWalletConnected) return void 0;
3500
+ return address || wagmiAddress || dynamicEvmWalletAddress || void 0;
3501
+ },
3502
+ [address, wagmiAddress, dynamicEvmWalletAddress, isEthWalletConnected]
3427
3503
  );
3428
3504
  const { openModal, openConnectModal } = useWalletConnectModal();
3429
3505
  const slippage = address ? slippageStore.get(address) : void 0;
@@ -3452,15 +3528,9 @@ var FormButton = ({
3452
3528
  } = useUSDTHandler(fromTokenInfo.chain_id);
3453
3529
  const { isSelectPredictionChain, slippagePolicies, chains } = useChainsStore();
3454
3530
  const { differentAddress } = useDifferentAddressStore();
3455
- const {
3456
- solanaWalletAddress,
3457
- isSolanaWalletConnected,
3458
- isEthWalletConnected,
3459
- evmWalletConnectorId
3460
- } = useWalletConnectedStore();
3461
3531
  const connectors = wagmi.useConnectors();
3462
3532
  const hasEvmUiWallet = Boolean(
3463
- effectiveEvmAddress || isEthWalletConnected || isWagmiConnected
3533
+ effectiveEvmAddress || isEthWalletConnected
3464
3534
  );
3465
3535
  const hasEvmExecutionWallet = Boolean(
3466
3536
  effectiveEvmAddress && (isWagmiConnected && connector || evmWalletConnectorId && connectors.some((c) => c.id === evmWalletConnectorId) || isEthWalletConnected && connectors.length > 0)
@@ -4227,13 +4297,13 @@ function filterTokenUnType(items, excludeTypes) {
4227
4297
  var mainnet3 = { id: 1 };
4228
4298
 
4229
4299
  // src/consts/monad.ts
4230
- var monad = { id: 10143 };
4300
+ var monad2 = { id: 10143 };
4231
4301
 
4232
4302
  // src/consts/stable.ts
4233
- var stable = { id: 1 };
4303
+ var stable2 = { id: 1 };
4234
4304
 
4235
4305
  // src/core/SelectTokenModal/hooks/useChainsAndTokensForSelect.ts
4236
- [mainnet3.id, chains.base.id, chains.ink.id, chains.bsc.id, monad.id, chains.soneium.id, stable.id];
4306
+ [mainnet3.id, chains.base.id, chains.ink.id, chains.bsc.id, monad2.id, chains.soneium.id, stable2.id];
4237
4307
  var useChainsAndTokensForSelect = ({
4238
4308
  data,
4239
4309
  selectedChain,
@@ -4699,20 +4769,6 @@ function countLeadingZerosAfterDecimal(numStr) {
4699
4769
  if (firstNonZeroIndex === -1) return 0;
4700
4770
  return firstNonZeroIndex;
4701
4771
  }
4702
- function findItemByName2(arr, targetName) {
4703
- const foundItem = arr.find(
4704
- (item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
4705
- );
4706
- return [foundItem !== void 0, foundItem];
4707
- }
4708
- function findItemBySymbol2(arr, targetName, chainId, platform_id) {
4709
- const foundItem = arr.find((item) => {
4710
- {
4711
- return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
4712
- }
4713
- });
4714
- return [foundItem !== void 0, foundItem];
4715
- }
4716
4772
  var TokenAmountHeading = ({
4717
4773
  amount,
4718
4774
  decimals,
@@ -4720,13 +4776,14 @@ var TokenAmountHeading = ({
4720
4776
  suffix,
4721
4777
  ...props
4722
4778
  }) => {
4779
+ const { theme } = useWidgetTheme();
4723
4780
  const _amount = formatTokenAmount({
4724
4781
  amount,
4725
4782
  decimals
4726
4783
  });
4727
4784
  const leadingZeros = countLeadingZerosAfterDecimal(_amount);
4728
4785
  if (leadingZeros > 5) {
4729
- return /* @__PURE__ */ jsxRuntime.jsxs(Heading, { variant: "heading8", ...props, as: "div", children: [
4786
+ return /* @__PURE__ */ jsxRuntime.jsxs(Heading, { variant: "heading8", ...props, as: "div", color: theme.defaultTextColor, whiteSpace: "nowrap", children: [
4730
4787
  prefix,
4731
4788
  " ",
4732
4789
  _amount.slice(0, 3),
@@ -4745,7 +4802,7 @@ var TokenAmountHeading = ({
4745
4802
  suffix
4746
4803
  ] });
4747
4804
  }
4748
- return /* @__PURE__ */ jsxRuntime.jsxs(Heading, { variant: "heading11", ...props, as: "div", children: [
4805
+ return /* @__PURE__ */ jsxRuntime.jsxs(Heading, { variant: "heading11", ...props, as: "div", color: theme.defaultTextColor, whiteSpace: "nowrap", children: [
4749
4806
  prefix,
4750
4807
  " ",
4751
4808
  _amount,
@@ -6293,6 +6350,7 @@ var SelectTokenModal = ({
6293
6350
  allTokens: tokens
6294
6351
  });
6295
6352
  const { userHasSelectedFromNetwork, setUserHasSelectedFromNetwork } = useUserHasSelectedFromNetwork();
6353
+ const prevUserHasSelectedRef = React5.useRef(userHasSelectedFromNetwork);
6296
6354
  const { chains } = useChainsStore();
6297
6355
  const [disableTestnetLimit, setDisableTestnetLimit] = React5.useState(false);
6298
6356
  const [tempSelectAll, setTempSelectAll] = React5.useState(false);
@@ -6327,6 +6385,8 @@ var SelectTokenModal = ({
6327
6385
  setTempSelectedPlatformId(null);
6328
6386
  }
6329
6387
  }
6388
+ const userJustSelected = userHasSelectedFromNetwork && !prevUserHasSelectedRef.current;
6389
+ prevUserHasSelectedRef.current = userHasSelectedFromNetwork;
6330
6390
  if (isSelectingFromToken) {
6331
6391
  if (isLoadingUserBalances) return;
6332
6392
  if (isArcTestnetShortLink) {
@@ -6340,7 +6400,9 @@ var SelectTokenModal = ({
6340
6400
  setSelectedChain(null);
6341
6401
  } else {
6342
6402
  setIsSelectAll(false);
6343
- setSelectedChain(fromChainId);
6403
+ if (!userJustSelected) {
6404
+ setSelectedChain(fromChainId);
6405
+ }
6344
6406
  }
6345
6407
  } else {
6346
6408
  setIsSelectAll(false);
@@ -8322,127 +8384,6 @@ var FormBody = ({
8322
8384
  const { tokens } = useTokensStore();
8323
8385
  const [isFromHyperChain, setIsFromHyperChain] = React5.useState(false);
8324
8386
  const [isToHyperChain, setIsToHyperChain] = React5.useState(false);
8325
- const pathname = typeof window !== "undefined" ? window.location.pathname : "";
8326
- const replaceLink = React5.useCallback((url) => {
8327
- if (typeof window !== "undefined") {
8328
- window.history.replaceState(null, "", url);
8329
- }
8330
- }, []);
8331
- const updateSearchParams = React5.useCallback(
8332
- (params) => {
8333
- if (typeof window === "undefined") return;
8334
- const searchParams = window?.location?.search;
8335
- const newParams = new URLSearchParams(searchParams);
8336
- Object.entries(params).forEach(([key, value]) => {
8337
- newParams.set(key, value);
8338
- });
8339
- const newPath = decodeURIComponent(pathname.replace(/\/+$/, ""));
8340
- if (tokens && chains && matchesAnyPatternUsingArray(newPath)) {
8341
- if (toRegex.test(newPath)) {
8342
- const [exists, chainsInfo2] = findItemByName2(
8343
- chains || [],
8344
- newPath.replace("/", "")
8345
- );
8346
- if (!exists) return;
8347
- const foundItem = tokens.find(
8348
- (item) => item.chain_id === chainsInfo2?.chain_id
8349
- );
8350
- if (foundItem) {
8351
- newParams.set("to_chain", foundItem.chain_id.toString());
8352
- newParams.set("to_token", foundItem.address.toString());
8353
- }
8354
- } else if (toAndTokenRegex.test(newPath)) {
8355
- const arr = newPath.replace("/", "").split("&");
8356
- const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
8357
- if (!exists) return;
8358
- const [result, foundItem] = findItemBySymbol2(
8359
- tokens,
8360
- arr[1],
8361
- chainsInfo2?.chain_id
8362
- );
8363
- if (!result) return;
8364
- if (result && foundItem) {
8365
- newParams.set("to_chain", foundItem.chain_id.toString());
8366
- newParams.set("to_token", foundItem.address.toString());
8367
- }
8368
- } else if (fromRegex.test(newPath)) {
8369
- const arr = newPath.split("&");
8370
- const [exists, chainsInfo2] = findItemByName2(chains, arr[1]);
8371
- if (!exists) return;
8372
- const foundItem = tokens.find(
8373
- (item) => item.chain_id === chainsInfo2?.chain_id
8374
- );
8375
- if (foundItem) {
8376
- newParams.set("from_chain", foundItem.chain_id.toString());
8377
- newParams.set("from_token", foundItem.address.toString());
8378
- }
8379
- } else if (fromAndTokenRegex.test(newPath)) {
8380
- const arr = newPath.replace("/", "").split("&");
8381
- const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
8382
- if (!exists) return;
8383
- const [result, foundItem] = findItemBySymbol2(
8384
- tokens,
8385
- arr[1],
8386
- chainsInfo2?.chain_id
8387
- );
8388
- if (!result) return;
8389
- if (result && foundItem) {
8390
- newParams.set("from_chain", foundItem.chain_id.toString());
8391
- newParams.set("from_token", foundItem.address.toString());
8392
- }
8393
- } else if (fromAndToRegex.test(newPath)) {
8394
- const arr = newPath.split("/");
8395
- const [resultFrom, fromChainsInfo] = findItemByName2(chains, arr[1]);
8396
- if (!resultFrom) return;
8397
- const foundFromItem = tokens.find(
8398
- (item) => item.chain_id === fromChainsInfo?.chain_id
8399
- );
8400
- if (!foundFromItem) return;
8401
- newParams.set("from_chain", foundFromItem.chain_id.toString());
8402
- newParams.set("from_token", foundFromItem.address.toString());
8403
- const [resultTo, toChainsInfo] = findItemByName2(chains, arr[2]);
8404
- if (!resultTo) return;
8405
- const foundToItem = tokens.find(
8406
- (item) => item.chain_id === toChainsInfo?.chain_id
8407
- );
8408
- if (!foundToItem) return;
8409
- newParams.set("to_chain", foundToItem.chain_id.toString());
8410
- newParams.set("to_token", foundToItem.address.toString());
8411
- } else if (fromAndTokenAndToAndTokenRegex.test(newPath)) {
8412
- const arr = newPath.split("/");
8413
- const arrFrom = arr[1].split("&");
8414
- const [resultFrom, fromChainsInfo] = findItemByName2(
8415
- chains,
8416
- arrFrom[0]
8417
- );
8418
- if (!resultFrom) return;
8419
- const [resultFromToken, fromTokenInfo2] = findItemBySymbol2(
8420
- tokens,
8421
- arrFrom[1],
8422
- fromChainsInfo?.chain_id
8423
- );
8424
- if (!resultFromToken) return;
8425
- const arrTo = arr[2].split("&");
8426
- const [resultTo, toChainsInfo] = findItemByName2(chains, arrTo[0]);
8427
- if (!resultTo) return;
8428
- const [resultToToken, toTokenInfo2] = findItemBySymbol2(
8429
- tokens,
8430
- arrTo[1],
8431
- toChainsInfo?.chain_id
8432
- );
8433
- if (!resultToToken) return;
8434
- if (fromTokenInfo2 && toTokenInfo2) {
8435
- newParams.set("to_chain", toTokenInfo2.chain_id.toString());
8436
- newParams.set("to_token", toTokenInfo2.address.toString());
8437
- newParams.set("from_chain", fromTokenInfo2.chain_id.toString());
8438
- newParams.set("from_token", fromTokenInfo2.address.toString());
8439
- }
8440
- }
8441
- }
8442
- replaceLink(`${pathname.replace(pathname, "")}/?${newParams.toString()}`);
8443
- },
8444
- [pathname, replaceLink, chains, tokens]
8445
- );
8446
8387
  const [isModalOpen, setIsModalOpen] = React5.useState(false);
8447
8388
  const [isDifferentAddressDialogOpen, setIsDifferentAddressDialogOpen] = React5.useState(false);
8448
8389
  const [isSelectingFromToken, setIsSelectingFromToken] = React5.useState(false);
@@ -8653,15 +8594,12 @@ var FormBody = ({
8653
8594
  }, [tokens]);
8654
8595
  const handleSelectToken = React5.useCallback(
8655
8596
  (tokenInfo) => {
8656
- const params = {};
8657
8597
  const isTestnetChain = (chainId) => {
8658
8598
  const chainInfo = chains?.find((chain) => chain.chain_id === chainId);
8659
8599
  return chainInfo?.is_testnet === true;
8660
8600
  };
8661
8601
  if (isSelectingFromToken) {
8662
8602
  setFromTokenInfo(tokenInfo);
8663
- params.from_chain = tokenInfo.chain_id.toString();
8664
- params.from_token = tokenInfo.address;
8665
8603
  if (isTestnetChain(tokenInfo.chain_id)) {
8666
8604
  const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === viem.zeroAddress;
8667
8605
  if (isNativeToken) {
@@ -8670,8 +8608,6 @@ var FormBody = ({
8670
8608
  );
8671
8609
  if (otherToken) {
8672
8610
  setToTokenInfo(otherToken);
8673
- params.to_chain = otherToken.chain_id.toString();
8674
- params.to_token = otherToken.address;
8675
8611
  }
8676
8612
  } else {
8677
8613
  const nativeToken = tokens?.find(
@@ -8679,16 +8615,12 @@ var FormBody = ({
8679
8615
  );
8680
8616
  if (nativeToken && (nativeToken.chain_id !== toTokenInfo?.chain_id || nativeToken.address !== toTokenInfo?.address)) {
8681
8617
  setToTokenInfo(nativeToken);
8682
- params.to_chain = nativeToken.chain_id.toString();
8683
- params.to_token = nativeToken.address;
8684
8618
  } else if (!nativeToken) {
8685
8619
  const otherToken = tokens?.find(
8686
8620
  (t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
8687
8621
  );
8688
8622
  if (otherToken) {
8689
8623
  setToTokenInfo(otherToken);
8690
- params.to_chain = otherToken.chain_id.toString();
8691
- params.to_token = otherToken.address;
8692
8624
  }
8693
8625
  }
8694
8626
  }
@@ -8699,15 +8631,11 @@ var FormBody = ({
8699
8631
  );
8700
8632
  if (baseEthToken) {
8701
8633
  setToTokenInfo(baseEthToken);
8702
- params.to_chain = baseEthToken.chain_id.toString();
8703
- params.to_token = baseEthToken.address;
8704
8634
  }
8705
8635
  }
8706
8636
  }
8707
8637
  } else {
8708
8638
  setToTokenInfo(tokenInfo);
8709
- params.to_chain = tokenInfo.chain_id.toString();
8710
- params.to_token = tokenInfo.address;
8711
8639
  if (isTestnetChain(tokenInfo.chain_id)) {
8712
8640
  const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === viem.zeroAddress;
8713
8641
  if (isNativeToken) {
@@ -8716,8 +8644,6 @@ var FormBody = ({
8716
8644
  );
8717
8645
  if (otherToken) {
8718
8646
  setFromTokenInfo(otherToken);
8719
- params.from_chain = otherToken.chain_id.toString();
8720
- params.from_token = otherToken.address;
8721
8647
  }
8722
8648
  } else {
8723
8649
  const nativeToken = tokens?.find(
@@ -8725,16 +8651,12 @@ var FormBody = ({
8725
8651
  );
8726
8652
  if (nativeToken && (nativeToken.chain_id !== fromTokenInfo?.chain_id || nativeToken.address !== fromTokenInfo?.address)) {
8727
8653
  setFromTokenInfo(nativeToken);
8728
- params.from_chain = nativeToken.chain_id.toString();
8729
- params.from_token = nativeToken.address;
8730
8654
  } else if (!nativeToken) {
8731
8655
  const otherToken = tokens?.find(
8732
8656
  (t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
8733
8657
  );
8734
8658
  if (otherToken) {
8735
8659
  setFromTokenInfo(otherToken);
8736
- params.from_chain = otherToken.chain_id.toString();
8737
- params.from_token = otherToken.address;
8738
8660
  }
8739
8661
  }
8740
8662
  }
@@ -8745,13 +8667,10 @@ var FormBody = ({
8745
8667
  );
8746
8668
  if (soneiumEthToken) {
8747
8669
  setFromTokenInfo(soneiumEthToken);
8748
- params.from_chain = soneiumEthToken.chain_id.toString();
8749
- params.from_token = soneiumEthToken.address;
8750
8670
  }
8751
8671
  }
8752
8672
  }
8753
8673
  }
8754
- updateSearchParams(params);
8755
8674
  handleCloseModal();
8756
8675
  setQuoteInfo(initialQuoteInfo);
8757
8676
  saveTokenSelection();
@@ -8762,7 +8681,6 @@ var FormBody = ({
8762
8681
  setFromTokenInfo,
8763
8682
  setQuoteInfo,
8764
8683
  setToTokenInfo,
8765
- updateSearchParams,
8766
8684
  tokens,
8767
8685
  fromTokenInfo,
8768
8686
  toTokenInfo,
@@ -8780,12 +8698,6 @@ var FormBody = ({
8780
8698
  const _fromAmount = toAmount;
8781
8699
  setDifferentAddress(void 0);
8782
8700
  switchTokens();
8783
- updateSearchParams({
8784
- from_chain: _fromTokenInfo.chain_id.toString(),
8785
- from_token: _fromTokenInfo.address,
8786
- to_chain: _toTokenInfo.chain_id.toString(),
8787
- to_token: _toTokenInfo.address
8788
- });
8789
8701
  const _fromAddress = () => {
8790
8702
  if (_fromTokenInfo.isSolana) {
8791
8703
  return solanaWalletAddress || "";
@@ -9140,7 +9052,9 @@ var SlippageSettings = ({ refetchQuote }) => {
9140
9052
  base: "20px",
9141
9053
  md: "22px"
9142
9054
  },
9143
- as: SettingsIcon
9055
+ as: SettingsIcon,
9056
+ position: "relative",
9057
+ top: "-2px"
9144
9058
  }
9145
9059
  ),
9146
9060
  showYellowDot && /* @__PURE__ */ jsxRuntime.jsx(
@@ -9367,10 +9281,92 @@ var FormTop = ({
9367
9281
  quoteInfo,
9368
9282
  clearLockedRequestId,
9369
9283
  refreshInterval = 30,
9370
- hideCountdown = false
9284
+ hideCountdown = false,
9285
+ onHistoryClick
9371
9286
  }) => {
9372
9287
  const { isLoading: isLoadingRefresh } = useRefreshLoading();
9373
9288
  const { theme } = useWidgetTheme();
9289
+ const { disconnect } = wagmi.useDisconnect();
9290
+ const connectors = wagmi.useConnectors();
9291
+ const { connector: wagmiConnector } = wagmi.useAccount();
9292
+ const { removeWallet } = sdkReactCore.useDynamicContext();
9293
+ const userWallets = sdkReactCore.useUserWallets();
9294
+ const {
9295
+ isEthWalletConnected,
9296
+ evmWalletConnectorId,
9297
+ isSolanaWalletConnected,
9298
+ setEvmWalletInfo,
9299
+ setIsEthWalletConnected,
9300
+ setSolanaWalletAddress,
9301
+ setIsSolanaWalletConnected,
9302
+ setIsLoggingOut: setStoreLoggingOut,
9303
+ setLastDisconnectTimestamp
9304
+ } = useWalletConnectedStore();
9305
+ const isAnyWalletConnected = isEthWalletConnected || isSolanaWalletConnected;
9306
+ const [isLogoutDialogOpen, setIsLogoutDialogOpen] = React5.useState(false);
9307
+ const [isLoggingOut, setIsLoggingOut] = React5.useState(false);
9308
+ const handleLogout = React5.useCallback(async () => {
9309
+ setIsLoggingOut(true);
9310
+ setStoreLoggingOut(true);
9311
+ const currentEvmConnectorId = evmWalletConnectorId;
9312
+ try {
9313
+ for (const wallet of userWallets) {
9314
+ const walletId = wallet.id || wallet.walletId;
9315
+ if (walletId) {
9316
+ try {
9317
+ await removeWallet(walletId);
9318
+ } catch (e) {
9319
+ console.error("Dynamic removeWallet failed:", e);
9320
+ }
9321
+ }
9322
+ }
9323
+ const evmConnector = connectors.find((c) => c.id === currentEvmConnectorId);
9324
+ if (evmConnector) {
9325
+ disconnect({ connector: evmConnector });
9326
+ } else if (wagmiConnector) {
9327
+ disconnect({ connector: wagmiConnector });
9328
+ }
9329
+ if (typeof window !== "undefined") {
9330
+ window.localStorage.removeItem("wagmi.cache");
9331
+ window.localStorage.removeItem("wagmi.wallet");
9332
+ window.sessionStorage.removeItem("wagmi.cache");
9333
+ window.sessionStorage.removeItem("wagmi.wallet");
9334
+ const storages = [window.localStorage, window.sessionStorage];
9335
+ storages.forEach((storage) => {
9336
+ const keysToRemove = [];
9337
+ for (let i = 0; i < storage.length; i++) {
9338
+ const key = storage.key(i);
9339
+ if (key && (key.startsWith("dynamic_") || key.includes("_dynamic_"))) {
9340
+ keysToRemove.push(key);
9341
+ }
9342
+ }
9343
+ keysToRemove.forEach((key) => storage.removeItem(key));
9344
+ });
9345
+ }
9346
+ setEvmWalletInfo(null, null);
9347
+ setIsEthWalletConnected(false);
9348
+ setSolanaWalletAddress(null);
9349
+ setIsSolanaWalletConnected(false);
9350
+ setLastDisconnectTimestamp(Date.now());
9351
+ } finally {
9352
+ setStoreLoggingOut(false);
9353
+ setIsLoggingOut(false);
9354
+ setIsLogoutDialogOpen(false);
9355
+ }
9356
+ }, [
9357
+ userWallets,
9358
+ removeWallet,
9359
+ connectors,
9360
+ evmWalletConnectorId,
9361
+ wagmiConnector,
9362
+ disconnect,
9363
+ setEvmWalletInfo,
9364
+ setIsEthWalletConnected,
9365
+ setSolanaWalletAddress,
9366
+ setIsSolanaWalletConnected,
9367
+ setStoreLoggingOut,
9368
+ setLastDisconnectTimestamp
9369
+ ]);
9374
9370
  const isPolling = Boolean(quoteInfo?.request_id && !isLoadingRefresh);
9375
9371
  const [countdown, setCountdown] = React5.useState(refreshInterval);
9376
9372
  React5.useEffect(() => {
@@ -9408,7 +9404,24 @@ var FormTop = ({
9408
9404
  children: "Bridge & Swap"
9409
9405
  }
9410
9406
  ),
9411
- /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { color: theme.weakTextColor || "#81728C", children: [
9407
+ /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { color: theme.weakTextColor, children: [
9408
+ isAnyWalletConnected && /* @__PURE__ */ jsxRuntime.jsx(
9409
+ react.Box,
9410
+ {
9411
+ w: "21px",
9412
+ h: "21px",
9413
+ display: "flex",
9414
+ alignItems: "center",
9415
+ justifyContent: "center",
9416
+ cursor: "pointer",
9417
+ onClick: onHistoryClick,
9418
+ title: "Transaction history",
9419
+ children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", children: [
9420
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: theme.weakTextColor, d: "M14 2l-8 8v20h22v-28h-14zM14 4.8v5.2h-5.2l5.2-5.2zM26 28h-18v-16h8v-8h10v24z" }),
9421
+ /* @__PURE__ */ jsxRuntime.jsx("path", { fill: theme.weakTextColor, d: "M10 14h14v2h-14v-2zM10 18h14v2h-14v-2zM10 22h14v2h-14v-2z" })
9422
+ ] })
9423
+ }
9424
+ ),
9412
9425
  /* @__PURE__ */ jsxRuntime.jsxs(
9413
9426
  react.HStack,
9414
9427
  {
@@ -9478,8 +9491,36 @@ var FormTop = ({
9478
9491
  ]
9479
9492
  }
9480
9493
  ),
9481
- /* @__PURE__ */ jsxRuntime.jsx(SlippageSettings, { refetchQuote })
9482
- ] })
9494
+ /* @__PURE__ */ jsxRuntime.jsx(SlippageSettings, { refetchQuote }),
9495
+ isAnyWalletConnected && /* @__PURE__ */ jsxRuntime.jsx(
9496
+ react.HStack,
9497
+ {
9498
+ w: "30px",
9499
+ h: "30px",
9500
+ display: "flex",
9501
+ alignItems: "center",
9502
+ justifyContent: "center",
9503
+ cursor: "pointer",
9504
+ title: "Disconnect all wallets",
9505
+ onClick: () => setIsLogoutDialogOpen(true),
9506
+ children: /* @__PURE__ */ jsxRuntime.jsx(io.IoMdLogOut, { style: { width: "22px", height: "22px" }, color: theme.weakTextColor })
9507
+ }
9508
+ )
9509
+ ] }),
9510
+ /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.Root, { open: isLogoutDialogOpen, onOpenChange: (e) => setIsLogoutDialogOpen(e.open), children: /* @__PURE__ */ jsxRuntime.jsxs(react.Portal, { children: [
9511
+ /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.Backdrop, {}),
9512
+ /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.Positioner, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxRuntime.jsxs(react.Dialog.Content, { bgColor: theme.defaultBgColor, color: theme.defaultTextColor, width: ["90vw", "400px"], children: [
9513
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Dialog.Header, { justifyContent: "center", children: [
9514
+ /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.Title, { padding: "15px 0", children: "Disconnect Wallet" }),
9515
+ /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.CloseTrigger, {})
9516
+ ] }),
9517
+ /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.Body, { marginBottom: "20px", children: /* @__PURE__ */ jsxRuntime.jsx(react.Text, { textAlign: "center", padding: ["0 15px", "0 30px"], children: "This operation will disconnect all connected wallets." }) }),
9518
+ /* @__PURE__ */ jsxRuntime.jsxs(react.Dialog.Footer, { padding: ["10px 20px 20px"], justifyContent: "center", children: [
9519
+ /* @__PURE__ */ jsxRuntime.jsx(react.Dialog.ActionTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Button, { variant: "outline", disabled: isLoggingOut, w: "100px", bgColor: theme.normalButtonBg, color: theme.normalButtonText, children: "Cancel" }) }),
9520
+ /* @__PURE__ */ jsxRuntime.jsx(react.Button, { bgColor: theme.highlightButtonBg, color: theme.highlightButtonText, onClick: handleLogout, loading: isLoggingOut, w: "100px", children: "Disconnect" })
9521
+ ] })
9522
+ ] }) })
9523
+ ] }) })
9483
9524
  ] });
9484
9525
  };
9485
9526
  var Timer = ({ stop, onTick }) => {
@@ -10440,6 +10481,381 @@ var TxState = ({
10440
10481
  }
10441
10482
  ) });
10442
10483
  };
10484
+ async function getOrderHistory(address, offset = 0, limit = 4) {
10485
+ const url = `${BASE_API_URL}/v1/orders`;
10486
+ const res = await axios6__default.default.get(url, {
10487
+ params: {
10488
+ address: Array.isArray(address) ? address : [address],
10489
+ offset,
10490
+ limit
10491
+ },
10492
+ paramsSerializer: {
10493
+ indexes: null
10494
+ }
10495
+ });
10496
+ return res.data;
10497
+ }
10498
+ var useOrderHistory = (address, address2, offset, limit) => {
10499
+ const addresses = address && address2 ? [address, address2] : address;
10500
+ return reactQuery.useQuery({
10501
+ queryKey: ["orderHistory", addresses, offset],
10502
+ queryFn: () => addresses ? getOrderHistory(addresses, offset, limit) : Promise.reject("No address provided"),
10503
+ enabled: !!addresses,
10504
+ placeholderData: reactQuery.keepPreviousData,
10505
+ refetchOnWindowFocus: false
10506
+ });
10507
+ };
10508
+ function SuccessIcon() {
10509
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "16px", h: "16px", borderRadius: "full", bg: "#00CBB3", display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1 4L3.5 6.5L9 1", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) });
10510
+ }
10511
+ function ErrorIcon() {
10512
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "16px", h: "16px", borderRadius: "full", bg: "#FF4267", display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1 1L7 7M7 1L1 7", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round" }) }) });
10513
+ }
10514
+ function PendingIcon() {
10515
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "16px", h: "16px", borderRadius: "full", bg: "#FFD200", display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "4", cy: "4", r: "3", stroke: "white", strokeWidth: "1.5" }) }) });
10516
+ }
10517
+ function getStatusIcon(status) {
10518
+ switch (status) {
10519
+ case "Filled":
10520
+ return /* @__PURE__ */ jsxRuntime.jsx(SuccessIcon, {});
10521
+ case "Refund":
10522
+ case "Failed":
10523
+ return /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, {});
10524
+ case "Open":
10525
+ return /* @__PURE__ */ jsxRuntime.jsx(PendingIcon, {});
10526
+ default:
10527
+ return /* @__PURE__ */ jsxRuntime.jsx(SuccessIcon, {});
10528
+ }
10529
+ }
10530
+ function OrderHistoryItem({ order }) {
10531
+ const { theme } = useWidgetTheme();
10532
+ const fromTokenInfo = order.from_token_info;
10533
+ const toTokenInfo = order.to_token_info;
10534
+ const isSameChainSwap = order.from_chain === order.to_chain;
10535
+ const renderTxLink = (txHash, chainId, label) => {
10536
+ const link = getTxLink(txHash, chainId);
10537
+ if (!link) {
10538
+ return /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content8", color: theme.defaultTextColor, children: sliceAddress(txHash, 6) });
10539
+ }
10540
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href: link, target: "_blank", rel: "noreferrer", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(react.HStack, { gap: 1, children: /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content8", color: theme.highlightTextColor, children: sliceAddress(txHash, 6) }) }) });
10541
+ };
10542
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10543
+ react.Box,
10544
+ {
10545
+ w: "100%",
10546
+ borderRadius: "12px",
10547
+ p: "10px 15px",
10548
+ bg: theme.assistBgColor,
10549
+ _hover: { bg: theme.highlightBgColor },
10550
+ transition: "background 0.15s",
10551
+ children: [
10552
+ /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { justify: "center", mb: 2, children: [
10553
+ /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 1.5, children: [
10554
+ getStatusIcon(isSameChainSwap ? "Filled" : order.status),
10555
+ /* @__PURE__ */ jsxRuntime.jsx(
10556
+ Text2,
10557
+ {
10558
+ variant: "content7",
10559
+ color: theme.defaultTextColor || "#15003E",
10560
+ fontWeight: 500,
10561
+ children: isSameChainSwap ? "Filled" : order.status
10562
+ }
10563
+ )
10564
+ ] }),
10565
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content8", color: theme.weakTextColor || "#81728C", children: dateFormatter(order.open_timestamp) })
10566
+ ] }),
10567
+ /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { justify: "space-between", w: "100%", children: [
10568
+ /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 2, mb: 1.5, children: [
10569
+ /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "32px", h: "32px", flexShrink: 0, marginRight: "10px", children: /* @__PURE__ */ jsxRuntime.jsx(
10570
+ TokenIconWithNetworkLogo,
10571
+ {
10572
+ w: "100%",
10573
+ h: "100%",
10574
+ tokenInfo: fromTokenInfo
10575
+ }
10576
+ ) }),
10577
+ /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { align: "start", gap: 0.5, flex: 1, w: "80px", children: [
10578
+ /* @__PURE__ */ jsxRuntime.jsx(
10579
+ TokenAmountHeading,
10580
+ {
10581
+ amount: new biFraction.Fraction(order.from_amount),
10582
+ decimals: fromTokenInfo?.decimals,
10583
+ suffix: fromTokenInfo?.symbol,
10584
+ variant: "heading12"
10585
+ }
10586
+ ),
10587
+ /* @__PURE__ */ jsxRuntime.jsx(react.HStack, { gap: 1, children: renderTxLink(order.open_tx_hash, order.from_chain) })
10588
+ ] })
10589
+ ] }),
10590
+ /* @__PURE__ */ jsxRuntime.jsx(react.HStack, { justify: "center", my: 0.5, flex: 1, children: /* @__PURE__ */ jsxRuntime.jsx(hi2.HiMiniArrowRight, { color: theme.weakTextColor, width: "30px", height: "30px" }) }),
10591
+ /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 2, mt: 0, children: [
10592
+ /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { align: "start", gap: 0.5, flex: 1, w: "80px", children: [
10593
+ /* @__PURE__ */ jsxRuntime.jsx(
10594
+ TokenAmountHeading,
10595
+ {
10596
+ amount: new biFraction.Fraction(order.to_amount || order.amount_out || "0"),
10597
+ decimals: toTokenInfo?.decimals,
10598
+ suffix: toTokenInfo?.symbol,
10599
+ variant: "heading12",
10600
+ justifyContent: "flex-end",
10601
+ width: "100%",
10602
+ display: "flex"
10603
+ }
10604
+ ),
10605
+ /* @__PURE__ */ jsxRuntime.jsx(react.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__ */ jsxRuntime.jsx(Text2, { variant: "content8", color: theme.defaultTextColor, children: "Receiving..." }) })
10606
+ ] }),
10607
+ /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "32px", h: "32px", flexShrink: 0, marginRight: "10px", marginLeft: "3px", children: /* @__PURE__ */ jsxRuntime.jsx(
10608
+ TokenIconWithNetworkLogo,
10609
+ {
10610
+ w: "100%",
10611
+ h: "100%",
10612
+ tokenInfo: toTokenInfo
10613
+ }
10614
+ ) })
10615
+ ] })
10616
+ ] })
10617
+ ]
10618
+ }
10619
+ );
10620
+ }
10621
+ var PaginationButton = ({
10622
+ currentPage,
10623
+ page,
10624
+ onClick
10625
+ }) => {
10626
+ const { theme } = useWidgetTheme();
10627
+ return /* @__PURE__ */ jsxRuntime.jsx(
10628
+ react.Box,
10629
+ {
10630
+ bg: currentPage === page ? theme.highlightButtonBg : "transparent",
10631
+ color: currentPage === page ? theme.highlightButtonText : theme.weakTextColor,
10632
+ w: "24px",
10633
+ h: "24px",
10634
+ borderRadius: "full",
10635
+ display: "flex",
10636
+ alignItems: "center",
10637
+ justifyContent: "center",
10638
+ cursor: "pointer",
10639
+ onClick,
10640
+ fontSize: "12px",
10641
+ fontWeight: 500,
10642
+ transition: "all 0.2s",
10643
+ children: page
10644
+ }
10645
+ );
10646
+ };
10647
+ function OrderHistoryPagination({
10648
+ currentPage,
10649
+ totalPages,
10650
+ setCurrentPage
10651
+ }) {
10652
+ const { theme } = useWidgetTheme();
10653
+ const handlePrevious = () => {
10654
+ if (currentPage > 1) setCurrentPage(currentPage - 1);
10655
+ };
10656
+ const handleNext = () => {
10657
+ if (currentPage < totalPages) setCurrentPage(currentPage + 1);
10658
+ };
10659
+ if (totalPages <= 1) return null;
10660
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10661
+ react.HStack,
10662
+ {
10663
+ justify: "space-between",
10664
+ align: "center",
10665
+ pt: 2,
10666
+ pb: 1,
10667
+ gap: 2,
10668
+ w: "100%",
10669
+ children: [
10670
+ /* @__PURE__ */ jsxRuntime.jsx(
10671
+ react.Button,
10672
+ {
10673
+ variant: "plain",
10674
+ onClick: handlePrevious,
10675
+ disabled: currentPage === 1,
10676
+ h: "28px",
10677
+ minW: "28px",
10678
+ p: 0,
10679
+ children: /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { gap: 0, color: currentPage === 1 ? theme.disabledButtonText || "#B5B5B5" : theme.defaultTextColor || "#15003E", children: [
10680
+ /* @__PURE__ */ jsxRuntime.jsx(BackIcon, { size: 20 }),
10681
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content7", fontSize: "11px", children: "Prev" })
10682
+ ] })
10683
+ }
10684
+ ),
10685
+ /* @__PURE__ */ jsxRuntime.jsx(react.HStack, { gap: 1, color: theme.weakTextColor || "#81728C", children: totalPages <= 7 ? Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ jsxRuntime.jsx(
10686
+ PaginationButton,
10687
+ {
10688
+ currentPage,
10689
+ page,
10690
+ onClick: () => setCurrentPage(page)
10691
+ },
10692
+ page
10693
+ )) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10694
+ /* @__PURE__ */ jsxRuntime.jsx(
10695
+ PaginationButton,
10696
+ {
10697
+ currentPage,
10698
+ page: 1,
10699
+ onClick: () => setCurrentPage(1)
10700
+ }
10701
+ ),
10702
+ currentPage > 4 && /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content7", fontSize: "12px", children: "..." }),
10703
+ Array.from({ length: 3 }, (_, i) => {
10704
+ const page = currentPage - 1 + i;
10705
+ if (page > 1 && page < totalPages) {
10706
+ return /* @__PURE__ */ jsxRuntime.jsx(
10707
+ PaginationButton,
10708
+ {
10709
+ currentPage,
10710
+ page,
10711
+ onClick: () => setCurrentPage(page)
10712
+ },
10713
+ page
10714
+ );
10715
+ }
10716
+ return null;
10717
+ }),
10718
+ currentPage < totalPages - 3 && /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content7", fontSize: "12px", children: "..." }),
10719
+ totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsx(
10720
+ PaginationButton,
10721
+ {
10722
+ currentPage,
10723
+ page: totalPages,
10724
+ onClick: () => setCurrentPage(totalPages)
10725
+ }
10726
+ )
10727
+ ] }) }),
10728
+ /* @__PURE__ */ jsxRuntime.jsx(
10729
+ react.Button,
10730
+ {
10731
+ variant: "plain",
10732
+ onClick: handleNext,
10733
+ disabled: currentPage === totalPages,
10734
+ h: "28px",
10735
+ minW: "28px",
10736
+ p: 0,
10737
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
10738
+ react.HStack,
10739
+ {
10740
+ gap: 0,
10741
+ color: currentPage === totalPages ? theme.disabledButtonText || "#B5B5B5" : theme.defaultTextColor || "#15003E",
10742
+ children: [
10743
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content7", fontSize: "11px", children: "Next" }),
10744
+ /* @__PURE__ */ jsxRuntime.jsx(react.Box, { transform: "rotate(180deg)", children: /* @__PURE__ */ jsxRuntime.jsx(BackIcon, { size: 20 }) })
10745
+ ]
10746
+ }
10747
+ )
10748
+ }
10749
+ )
10750
+ ]
10751
+ }
10752
+ );
10753
+ }
10754
+ var PAGE_SIZE = 4;
10755
+ function OrderHistory({ address, solanaAddress, onBack }) {
10756
+ const { theme } = useWidgetTheme();
10757
+ const [currentPage, setCurrentPage] = React5.useState(1);
10758
+ const [offset, setOffset] = React5.useState(0);
10759
+ const { data, isLoading, error, isFetching } = useOrderHistory(
10760
+ address,
10761
+ solanaAddress,
10762
+ offset,
10763
+ PAGE_SIZE
10764
+ );
10765
+ const totalItems = data?.total || 0;
10766
+ const totalPages = Math.ceil(totalItems / PAGE_SIZE);
10767
+ const currentOrders = data?.orders || [];
10768
+ const handlePageChange = (page) => {
10769
+ const newOffset = (page - 1) * PAGE_SIZE;
10770
+ setOffset(newOffset);
10771
+ setCurrentPage(page);
10772
+ };
10773
+ const renderContent = () => {
10774
+ if (isLoading) {
10775
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { gap: 4, py: 10, align: "center", w: "100%", children: [
10776
+ /* @__PURE__ */ jsxRuntime.jsx(react.Spinner, { size: "md", color: theme.highlightTextColor }),
10777
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content7", color: theme.weakTextColor || "#81728C", children: "Loading transactions..." })
10778
+ ] });
10779
+ }
10780
+ if (error) {
10781
+ return /* @__PURE__ */ jsxRuntime.jsx(
10782
+ react.Box,
10783
+ {
10784
+ border: "1px solid #FF4267",
10785
+ borderRadius: "8px",
10786
+ p: 3,
10787
+ my: 4,
10788
+ bg: "#FFF5F5",
10789
+ children: /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content7", color: "#FF4267", textAlign: "center", children: "Failed to load transaction history. Please try again." })
10790
+ }
10791
+ );
10792
+ }
10793
+ if (currentOrders.length === 0) {
10794
+ const emptyColor = theme.defaultBorderColor || "#E0D8E8";
10795
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { gap: 4, py: 10, align: "center", w: "100%", children: [
10796
+ /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", children: [
10797
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4", y: "8", width: "40", height: "32", rx: "4", stroke: emptyColor, strokeWidth: "2", fill: "none" }),
10798
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 20H32", stroke: emptyColor, strokeWidth: "2", strokeLinecap: "round" }),
10799
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 28H28", stroke: emptyColor, strokeWidth: "2", strokeLinecap: "round" })
10800
+ ] }),
10801
+ /* @__PURE__ */ jsxRuntime.jsx(Text2, { variant: "content7", color: theme.weakTextColor || "#81728C", textAlign: "center", children: "No transaction history yet" })
10802
+ ] });
10803
+ }
10804
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { position: "relative", w: "100%", children: [
10805
+ isFetching && /* @__PURE__ */ jsxRuntime.jsx(
10806
+ react.Box,
10807
+ {
10808
+ position: "absolute",
10809
+ zIndex: 10,
10810
+ top: 0,
10811
+ left: 0,
10812
+ right: 0,
10813
+ bottom: 0,
10814
+ display: "flex",
10815
+ alignItems: "center",
10816
+ justifyContent: "center",
10817
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.Spinner, { size: "sm", color: theme.highlightTextColor })
10818
+ }
10819
+ ),
10820
+ /* @__PURE__ */ jsxRuntime.jsx(react.VStack, { gap: 2.5, w: "100%", children: currentOrders.map((order) => /* @__PURE__ */ jsxRuntime.jsx(OrderHistoryItem, { order }, order.order_id)) }),
10821
+ /* @__PURE__ */ jsxRuntime.jsx(
10822
+ OrderHistoryPagination,
10823
+ {
10824
+ currentPage,
10825
+ totalPages,
10826
+ setCurrentPage: handlePageChange
10827
+ }
10828
+ )
10829
+ ] });
10830
+ };
10831
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.VStack, { w: "100%", gap: 4, align: "start", children: [
10832
+ /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { w: "100%", justify: "space-between", align: "center", children: [
10833
+ /* @__PURE__ */ jsxRuntime.jsx(
10834
+ react.Button,
10835
+ {
10836
+ variant: "plain",
10837
+ onClick: onBack,
10838
+ h: "24px",
10839
+ minW: "24px",
10840
+ p: 0,
10841
+ children: /* @__PURE__ */ jsxRuntime.jsx(ri.RiArrowGoBackFill, { color: theme.defaultTextColor, size: 20 })
10842
+ }
10843
+ ),
10844
+ /* @__PURE__ */ jsxRuntime.jsx(
10845
+ Text2,
10846
+ {
10847
+ color: theme.defaultTextColor,
10848
+ textAlign: "center",
10849
+ fontWeight: 600,
10850
+ fontSize: "16px",
10851
+ children: "Transaction history"
10852
+ }
10853
+ ),
10854
+ /* @__PURE__ */ jsxRuntime.jsx(react.Box, { w: "24px" })
10855
+ ] }),
10856
+ renderContent()
10857
+ ] });
10858
+ }
10443
10859
  var initialQuoteInfo = {
10444
10860
  isFetching: false,
10445
10861
  error: null,
@@ -10488,6 +10904,7 @@ var MainForm = ({ config }) => {
10488
10904
  const refreshIntervalRef = React5.useRef(30);
10489
10905
  const timerRef = React5.useRef(null);
10490
10906
  const isQuoteStoppedRef = React5.useRef(false);
10907
+ const [showHistory, setShowHistory] = React5.useState(false);
10491
10908
  const { differentAddress } = useDifferentAddressStore();
10492
10909
  const { chains, slippagePolicies } = useChainsStore();
10493
10910
  const prevAddressRef = React5.useRef(address);
@@ -10892,6 +11309,16 @@ var MainForm = ({ config }) => {
10892
11309
  }
10893
11310
  ) });
10894
11311
  }
11312
+ if (showHistory) {
11313
+ return /* @__PURE__ */ jsxRuntime.jsx(
11314
+ OrderHistory,
11315
+ {
11316
+ address,
11317
+ solanaAddress: solanaWalletAddress || void 0,
11318
+ onBack: () => setShowHistory(false)
11319
+ }
11320
+ );
11321
+ }
10895
11322
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10896
11323
  /* @__PURE__ */ jsxRuntime.jsx(
10897
11324
  FormTop,
@@ -10900,7 +11327,8 @@ var MainForm = ({ config }) => {
10900
11327
  quoteInfo,
10901
11328
  clearLockedRequestId,
10902
11329
  refreshInterval,
10903
- hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains)
11330
+ hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains),
11331
+ onHistoryClick: () => setShowHistory(true)
10904
11332
  }
10905
11333
  ),
10906
11334
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10971,7 +11399,23 @@ var MainForm = ({ config }) => {
10971
11399
  src: "https://wheelx.fi/images/success-sprites.png",
10972
11400
  alt: "success"
10973
11401
  }
10974
- )
11402
+ ),
11403
+ !showHistory && /* @__PURE__ */ jsxRuntime.jsx(react.HStack, { w: "100%", justifyContent: "center", alignItems: "center", opacity: "0.7", fontSize: "13px", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://wheelx.fi/", target: "_blank", style: { display: "block" }, children: /* @__PURE__ */ jsxRuntime.jsxs(react.HStack, { color: theme.weakTextColor, fontSize: "12px", alignContent: "center", alignItems: "center", w: "100%", children: [
11404
+ /* @__PURE__ */ jsxRuntime.jsx(react.Box, { children: "Powered by" }),
11405
+ /* @__PURE__ */ jsxRuntime.jsx(
11406
+ react.Box,
11407
+ {
11408
+ w: "14px",
11409
+ h: "14px",
11410
+ backgroundColor: "currentColor",
11411
+ maskSize: "contain",
11412
+ maskRepeat: "no-repeat",
11413
+ maskPosition: "center center",
11414
+ 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)"
11415
+ }
11416
+ ),
11417
+ /* @__PURE__ */ jsxRuntime.jsx(react.Box, { children: "WheelX" })
11418
+ ] }) }) })
10975
11419
  ]
10976
11420
  }
10977
11421
  ),
@@ -10985,39 +11429,7 @@ var MainForm = ({ config }) => {
10985
11429
  md: "480px"
10986
11430
  }
10987
11431
  }
10988
- ),
10989
- /* @__PURE__ */ jsxRuntime.jsx(react.Box, { marginTop: "30px", fontSize: "14px", children: /* @__PURE__ */ jsxRuntime.jsx(
10990
- "a",
10991
- {
10992
- href: "https://github.com/wheelx-fi/wheelx-contracts/blob/main/audits/ABDK_WheelX_WheelXContracts_v_1_0.pdf",
10993
- target: "_blank",
10994
- children: /* @__PURE__ */ jsxRuntime.jsxs(
10995
- Text2,
10996
- {
10997
- color: "#5D6270",
10998
- display: "flex",
10999
- alignItems: "center",
11000
- justifyContent: "center",
11001
- children: [
11002
- "Audited By",
11003
- " ",
11004
- /* @__PURE__ */ jsxRuntime.jsx(
11005
- react.Image,
11006
- {
11007
- display: "block",
11008
- width: "70px",
11009
- height: "28px",
11010
- marginLeft: "2px",
11011
- objectFit: "contain",
11012
- src: "https://wheelx.fi/images/adbk.png",
11013
- alt: ""
11014
- }
11015
- )
11016
- ]
11017
- }
11018
- )
11019
- }
11020
- ) })
11432
+ )
11021
11433
  ] })
11022
11434
  }
11023
11435
  ),