@wheelx-widget/widget 0.1.4 → 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/LICENSE +21 -21
- package/README.md +197 -197
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +877 -434
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +882 -439
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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 {
|
|
4
|
-
import {
|
|
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';
|
|
5
6
|
import { EthereumWalletConnectors } from '@dynamic-labs/ethereum';
|
|
6
7
|
import { SolanaWalletConnectorsWithConfig } from '@dynamic-labs/solana';
|
|
7
8
|
import { DynamicWagmiConnector } from '@dynamic-labs/wagmi-connector';
|
|
8
|
-
import { useAccount, WagmiProvider, useChainId, useConfig, useReconnect, createConfig, useEstimateFeesPerGas, fallback, http as http$1, useWaitForTransactionReceipt,
|
|
9
|
-
import {
|
|
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';
|
|
10
12
|
import { ThemeProvider } from '@emotion/react';
|
|
11
13
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
12
14
|
import axios6, { AxiosError } from 'axios';
|
|
13
15
|
import { create } from 'zustand';
|
|
14
|
-
import { defineRecipe, chakra, Tooltip as Tooltip$1, Portal, VStack, Box, HStack, InputGroup, Input, Icon, Image, useBreakpointValue, Dialog, Spinner, Link, Button, Popover, Collapsible, useDisclosure } from '@chakra-ui/react';
|
|
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
|
|
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
|
|
213
|
+
setIsEthWalletConnected(Boolean(evmAddress));
|
|
197
214
|
}, [
|
|
198
215
|
userWallets,
|
|
199
216
|
wagmiAddress,
|
|
200
217
|
wagmiConnector?.id,
|
|
201
|
-
|
|
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
|
|
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 = {};
|
|
@@ -450,6 +588,37 @@ function WalletConnectionStateSync() {
|
|
|
450
588
|
useSyncWalletConnectedStore();
|
|
451
589
|
return null;
|
|
452
590
|
}
|
|
591
|
+
function LoadingSkeleton() {
|
|
592
|
+
const { theme } = useWidgetTheme();
|
|
593
|
+
return /* @__PURE__ */ jsxs(
|
|
594
|
+
Box,
|
|
595
|
+
{
|
|
596
|
+
display: "flex",
|
|
597
|
+
flexDirection: "column",
|
|
598
|
+
alignItems: "center",
|
|
599
|
+
justifyContent: "center",
|
|
600
|
+
w: { base: "100%", md: "480px" },
|
|
601
|
+
h: { base: "400px", md: "440px" },
|
|
602
|
+
borderRadius: "24px",
|
|
603
|
+
bg: theme.assistBgColor,
|
|
604
|
+
gap: 4,
|
|
605
|
+
children: [
|
|
606
|
+
/* @__PURE__ */ jsx(
|
|
607
|
+
Box,
|
|
608
|
+
{
|
|
609
|
+
w: "40px",
|
|
610
|
+
h: "40px",
|
|
611
|
+
borderRadius: "full",
|
|
612
|
+
bg: theme.defaultBorderColor,
|
|
613
|
+
opacity: 0.4,
|
|
614
|
+
animation: "pulse 1.5s ease-in-out infinite"
|
|
615
|
+
}
|
|
616
|
+
),
|
|
617
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "14px", color: theme.defaultTextColor, children: "Loading chains and tokens..." })
|
|
618
|
+
]
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
}
|
|
453
622
|
function ChainsAndTokensLoader({ children, config }) {
|
|
454
623
|
const { data } = useChainsAndTokens(true);
|
|
455
624
|
const { setChains, setSlippagePolicies } = useChainsStore();
|
|
@@ -506,7 +675,7 @@ function ChainsAndTokensLoader({ children, config }) {
|
|
|
506
675
|
}, [filteredChains, filteredTokens, data, setChains, setTokens, setSlippagePolicies]);
|
|
507
676
|
const isReady = filteredChains && filteredTokens;
|
|
508
677
|
if (!isReady) {
|
|
509
|
-
return /* @__PURE__ */ jsx(
|
|
678
|
+
return /* @__PURE__ */ jsx(LoadingSkeleton, {});
|
|
510
679
|
}
|
|
511
680
|
return /* @__PURE__ */ jsx(FavoritesProvider, { children: /* @__PURE__ */ jsxs(TokenFavoritesProvider, { children: [
|
|
512
681
|
/* @__PURE__ */ jsx(WalletConnectionStateSync, {}),
|
|
@@ -833,6 +1002,16 @@ var formatDate = (dateString) => {
|
|
|
833
1002
|
const formattedTime = `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
|
|
834
1003
|
return formattedTime;
|
|
835
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
|
+
};
|
|
836
1015
|
|
|
837
1016
|
// src/utils/address.ts
|
|
838
1017
|
var sliceAddress = (address, startLength = 4, endLength = 4) => {
|
|
@@ -904,25 +1083,6 @@ var isSolanaChain = (chain_id) => {
|
|
|
904
1083
|
return chain_id === SOLANA_MAINNET.chain_id;
|
|
905
1084
|
};
|
|
906
1085
|
|
|
907
|
-
// src/utils/shortLinkRegex.ts
|
|
908
|
-
var toRegex = /^\/[a-zA-Z0-9]+$/;
|
|
909
|
-
var toAndTokenRegex = /^\/(?!from)[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
|
|
910
|
-
var fromRegex = /^\/from&[a-zA-Z0-9-+]+$/;
|
|
911
|
-
var fromAndTokenRegex = /^\/from&[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
|
|
912
|
-
var fromAndToRegex = /^\/[a-zA-Z0-9-+]+\/[a-zA-Z0-9-+]+$/;
|
|
913
|
-
var fromAndTokenAndToAndTokenRegex = /^\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
|
|
914
|
-
var allRegexPatterns = [
|
|
915
|
-
toRegex,
|
|
916
|
-
toAndTokenRegex,
|
|
917
|
-
fromRegex,
|
|
918
|
-
fromAndTokenRegex,
|
|
919
|
-
fromAndToRegex,
|
|
920
|
-
fromAndTokenAndToAndTokenRegex
|
|
921
|
-
];
|
|
922
|
-
function matchesAnyPatternUsingArray(inputString) {
|
|
923
|
-
return allRegexPatterns.some((regex) => regex.test(inputString));
|
|
924
|
-
}
|
|
925
|
-
|
|
926
1086
|
// src/utils/tokenSelectionCache.ts
|
|
927
1087
|
var TOKEN_SELECTION = "tokenSelection";
|
|
928
1088
|
var tokenSelectionStore = new localstorage_default(TOKEN_SELECTION);
|
|
@@ -1010,7 +1170,7 @@ var logger = {
|
|
|
1010
1170
|
error: errorWithTimestamp,
|
|
1011
1171
|
debug: debugWithTimestamp
|
|
1012
1172
|
};
|
|
1013
|
-
var wagmiSupportedChains = [mainnet, base$1, soneium$1, polygon, arbitrum, optimism];
|
|
1173
|
+
var wagmiSupportedChains = [mainnet, base$1, soneium$1, polygon, arbitrum, optimism, bsc$1];
|
|
1014
1174
|
var getTxLink = (txHash, chainId) => {
|
|
1015
1175
|
if (isSolanaChain(chainId)) {
|
|
1016
1176
|
return `${SOLANA_MAINNET.explorerUrl}/tx/${txHash}`;
|
|
@@ -1082,20 +1242,6 @@ var isSolanaChain2 = (chain_id) => {
|
|
|
1082
1242
|
};
|
|
1083
1243
|
|
|
1084
1244
|
// src/core/hooks/useSwapAndBridgeContextStore.ts
|
|
1085
|
-
function findItemByName(arr, targetName) {
|
|
1086
|
-
const foundItem = arr.find(
|
|
1087
|
-
(item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
|
|
1088
|
-
);
|
|
1089
|
-
return [foundItem !== void 0, foundItem];
|
|
1090
|
-
}
|
|
1091
|
-
function findItemBySymbol(arr, targetName, chainId, platform_id) {
|
|
1092
|
-
const foundItem = arr.find((item) => {
|
|
1093
|
-
{
|
|
1094
|
-
return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
|
|
1095
|
-
}
|
|
1096
|
-
});
|
|
1097
|
-
return [foundItem !== void 0, foundItem];
|
|
1098
|
-
}
|
|
1099
1245
|
var DEFAULT_FROM_TOKEN = {
|
|
1100
1246
|
name: "Base",
|
|
1101
1247
|
address: zeroAddress,
|
|
@@ -1198,8 +1344,6 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1198
1344
|
const {
|
|
1199
1345
|
setFromTokenInfo,
|
|
1200
1346
|
setToTokenInfo,
|
|
1201
|
-
setIsShortLink,
|
|
1202
|
-
setShortLink,
|
|
1203
1347
|
setFromAmount,
|
|
1204
1348
|
setToAmount
|
|
1205
1349
|
} = useSwapAndBridgeContextStore();
|
|
@@ -1209,11 +1353,6 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1209
1353
|
const address = useEvmAddress();
|
|
1210
1354
|
const { resetTxState } = useTxStateContextStore();
|
|
1211
1355
|
const hasInitialized = useRef(false);
|
|
1212
|
-
const currentPathname = useMemo(() => {
|
|
1213
|
-
if (typeof window === "undefined") return "/";
|
|
1214
|
-
return window.location.pathname;
|
|
1215
|
-
}, []);
|
|
1216
|
-
const pathname = currentPathname;
|
|
1217
1356
|
useEffect(() => {
|
|
1218
1357
|
if (hasInitialized.current) return;
|
|
1219
1358
|
if (!chains || !tokens) return;
|
|
@@ -1255,46 +1394,8 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1255
1394
|
}
|
|
1256
1395
|
}
|
|
1257
1396
|
}
|
|
1258
|
-
if (matchesAnyPatternUsingArray(pathname) && chains && tokens) {
|
|
1259
|
-
setIsShortLink(true);
|
|
1260
|
-
setShortLink(pathname);
|
|
1261
|
-
try {
|
|
1262
|
-
const decodedPath = decodeURIComponent(pathname);
|
|
1263
|
-
const match = decodedPath.match(
|
|
1264
|
-
/^\/([a-zA-Z0-9-+]+)&([a-zA-Z0-9-+.₮Ï]+)\/([a-zA-Z0-9-+]+)&([a-zA-Z0-9-+.₮Ï]+)$/
|
|
1265
|
-
);
|
|
1266
|
-
if (match) {
|
|
1267
|
-
const [, fromChainName, fromTokenSymbol, toChainName, toTokenSymbol] = match;
|
|
1268
|
-
const [, foundFromChain] = findItemByName(
|
|
1269
|
-
chains,
|
|
1270
|
-
fromChainName
|
|
1271
|
-
);
|
|
1272
|
-
const [, foundToChain] = findItemByName(
|
|
1273
|
-
chains,
|
|
1274
|
-
toChainName
|
|
1275
|
-
);
|
|
1276
|
-
if (foundFromChain && foundToChain && tokens) {
|
|
1277
|
-
const [, foundFromToken] = findItemBySymbol(
|
|
1278
|
-
tokens,
|
|
1279
|
-
fromTokenSymbol,
|
|
1280
|
-
foundFromChain.chain_id
|
|
1281
|
-
);
|
|
1282
|
-
const [, foundToToken] = findItemBySymbol(
|
|
1283
|
-
tokens,
|
|
1284
|
-
toTokenSymbol,
|
|
1285
|
-
foundToChain.chain_id
|
|
1286
|
-
);
|
|
1287
|
-
if (foundFromToken && foundToToken) {
|
|
1288
|
-
setFromTokenInfo(foundFromToken);
|
|
1289
|
-
setToTokenInfo(foundToToken);
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
} catch {
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
1397
|
const cached = tokenSelectionStore.get(address || "default");
|
|
1297
|
-
if (cached?.from && cached?.to
|
|
1398
|
+
if (cached?.from && cached?.to) {
|
|
1298
1399
|
setFromTokenInfo(cached.from);
|
|
1299
1400
|
setToTokenInfo(cached.to);
|
|
1300
1401
|
}
|
|
@@ -1306,15 +1407,12 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1306
1407
|
resetTxState();
|
|
1307
1408
|
};
|
|
1308
1409
|
}, [
|
|
1309
|
-
pathname,
|
|
1310
1410
|
address,
|
|
1311
1411
|
chains,
|
|
1312
1412
|
tokens,
|
|
1313
1413
|
config,
|
|
1314
1414
|
setFromTokenInfo,
|
|
1315
1415
|
setToTokenInfo,
|
|
1316
|
-
setIsShortLink,
|
|
1317
|
-
setShortLink,
|
|
1318
1416
|
setFromAmount,
|
|
1319
1417
|
setToAmount,
|
|
1320
1418
|
setDifferentAddress,
|
|
@@ -2834,13 +2932,17 @@ var extractVPathSegment = () => {
|
|
|
2834
2932
|
const match = pathname.match(/^\/v\/([a-zA-Z0-9-+]+)/);
|
|
2835
2933
|
return match ? match[1] : "";
|
|
2836
2934
|
};
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2935
|
+
function toBigInt(balance, decimals = 6) {
|
|
2936
|
+
const balanceStr = typeof balance === "number" ? balance.toString() : balance;
|
|
2937
|
+
const [integerPart, decimalPart = ""] = balanceStr.split(".");
|
|
2938
|
+
const integerBigInt = BigInt(integerPart);
|
|
2939
|
+
const neededDecimalDigits = Math.min(decimalPart.length, decimals);
|
|
2940
|
+
const trimmedDecimal = decimalPart.slice(0, neededDecimalDigits);
|
|
2941
|
+
const paddedDecimal = trimmedDecimal.padEnd(decimals, "0");
|
|
2942
|
+
const decimalBigInt = BigInt(paddedDecimal);
|
|
2943
|
+
const multiplier = BigInt(10 ** decimals);
|
|
2944
|
+
return integerBigInt * multiplier + decimalBigInt;
|
|
2945
|
+
}
|
|
2844
2946
|
function BackIcon(props = {}) {
|
|
2845
2947
|
return createElement("svg", {
|
|
2846
2948
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2862,7 +2964,7 @@ function ArrowRightIcon(props = {}) {
|
|
|
2862
2964
|
height: props.size || 16,
|
|
2863
2965
|
...props,
|
|
2864
2966
|
style: { display: "inline-block", verticalAlign: "middle", ...props.style || {} },
|
|
2865
|
-
dangerouslySetInnerHTML: { __html: `<circle cx="23.0434" cy="23.5005" r="22.9565" fill="
|
|
2967
|
+
dangerouslySetInnerHTML: { __html: `<circle cx="23.0434" cy="23.5005" r="22.9565" fill="currentColor" />
|
|
2866
2968
|
<path
|
|
2867
2969
|
d="M14.0898 22.8301C14.0896 22.822 14.0889 22.8138 14.0889 22.8057C14.0889 22.3529 14.463 21.9813 14.9424 21.9365L15.0391 21.9316L29.0293 21.9316L25.582 18.7607C25.1215 18.3371 25.0489 17.7165 25.4199 17.375C25.7913 17.0335 26.466 17.1007 26.9268 17.5244L31.7939 22.001C32.1346 22.1339 32.374 22.4439 32.374 22.8057C32.374 22.8251 32.3715 22.8442 32.3701 22.8633C32.3705 22.874 32.3721 22.8847 32.3721 22.8955C32.3718 23.2561 32.1341 23.5657 31.7949 23.6992L26.9268 28.1768C26.4661 28.6002 25.7912 28.6674 25.4199 28.3262C25.0488 27.9848 25.1218 27.3641 25.582 26.9404L29.0293 23.7695L15.0371 23.7695L14.9404 23.7646C14.4611 23.7198 14.0872 23.3481 14.0869 22.8955C14.0869 22.8735 14.0881 22.8517 14.0898 22.8301Z"
|
|
2868
2970
|
fill="white" />` }
|
|
@@ -3218,7 +3320,7 @@ var textRecipe = defineRecipe({
|
|
|
3218
3320
|
}
|
|
3219
3321
|
});
|
|
3220
3322
|
var Heading = chakra("h2", headingRecipe);
|
|
3221
|
-
var
|
|
3323
|
+
var Text2 = chakra("p", textRecipe);
|
|
3222
3324
|
var isTouchDevice = () => {
|
|
3223
3325
|
if (typeof window === "undefined") return false;
|
|
3224
3326
|
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
@@ -3346,6 +3448,12 @@ var FormButton = ({
|
|
|
3346
3448
|
}) => {
|
|
3347
3449
|
const { theme } = useWidgetTheme();
|
|
3348
3450
|
const address = useEvmAddress();
|
|
3451
|
+
const {
|
|
3452
|
+
solanaWalletAddress,
|
|
3453
|
+
isSolanaWalletConnected,
|
|
3454
|
+
isEthWalletConnected,
|
|
3455
|
+
evmWalletConnectorId
|
|
3456
|
+
} = useWalletConnectedStore();
|
|
3349
3457
|
const {
|
|
3350
3458
|
address: wagmiAddress,
|
|
3351
3459
|
connector,
|
|
@@ -3363,8 +3471,11 @@ var FormButton = ({
|
|
|
3363
3471
|
return dynamicEvmWallet?.address || void 0;
|
|
3364
3472
|
}, [userWallets]);
|
|
3365
3473
|
const effectiveEvmAddress = useMemo(
|
|
3366
|
-
() =>
|
|
3367
|
-
|
|
3474
|
+
() => {
|
|
3475
|
+
if (!isEthWalletConnected) return void 0;
|
|
3476
|
+
return address || wagmiAddress || dynamicEvmWalletAddress || void 0;
|
|
3477
|
+
},
|
|
3478
|
+
[address, wagmiAddress, dynamicEvmWalletAddress, isEthWalletConnected]
|
|
3368
3479
|
);
|
|
3369
3480
|
const { openModal, openConnectModal } = useWalletConnectModal();
|
|
3370
3481
|
const slippage = address ? slippageStore.get(address) : void 0;
|
|
@@ -3393,15 +3504,9 @@ var FormButton = ({
|
|
|
3393
3504
|
} = useUSDTHandler(fromTokenInfo.chain_id);
|
|
3394
3505
|
const { isSelectPredictionChain, slippagePolicies, chains } = useChainsStore();
|
|
3395
3506
|
const { differentAddress } = useDifferentAddressStore();
|
|
3396
|
-
const {
|
|
3397
|
-
solanaWalletAddress,
|
|
3398
|
-
isSolanaWalletConnected,
|
|
3399
|
-
isEthWalletConnected,
|
|
3400
|
-
evmWalletConnectorId
|
|
3401
|
-
} = useWalletConnectedStore();
|
|
3402
3507
|
const connectors = useConnectors();
|
|
3403
3508
|
const hasEvmUiWallet = Boolean(
|
|
3404
|
-
effectiveEvmAddress || isEthWalletConnected
|
|
3509
|
+
effectiveEvmAddress || isEthWalletConnected
|
|
3405
3510
|
);
|
|
3406
3511
|
const hasEvmExecutionWallet = Boolean(
|
|
3407
3512
|
effectiveEvmAddress && (isWagmiConnected && connector || evmWalletConnectorId && connectors.some((c) => c.id === evmWalletConnectorId) || isEthWalletConnected && connectors.length > 0)
|
|
@@ -3895,7 +4000,7 @@ var FormButton = ({
|
|
|
3895
4000
|
const renderButton = () => {
|
|
3896
4001
|
if (errorMessage || quoteMessage) {
|
|
3897
4002
|
return /* @__PURE__ */ jsx(Button, { ...buttonStyles, disabled: true, bg: theme.disabledButtonBg, children: /* @__PURE__ */ jsx(
|
|
3898
|
-
|
|
4003
|
+
Text2,
|
|
3899
4004
|
{
|
|
3900
4005
|
variant: {
|
|
3901
4006
|
base: "content9",
|
|
@@ -3961,7 +4066,7 @@ var FormButton = ({
|
|
|
3961
4066
|
}
|
|
3962
4067
|
),
|
|
3963
4068
|
/* @__PURE__ */ jsx(
|
|
3964
|
-
|
|
4069
|
+
Text2,
|
|
3965
4070
|
{
|
|
3966
4071
|
position: "absolute",
|
|
3967
4072
|
w: "28px",
|
|
@@ -3976,7 +4081,7 @@ var FormButton = ({
|
|
|
3976
4081
|
]
|
|
3977
4082
|
}
|
|
3978
4083
|
),
|
|
3979
|
-
/* @__PURE__ */ jsx(
|
|
4084
|
+
/* @__PURE__ */ jsx(Text2, { children: "AI is Thinking the Best Price" })
|
|
3980
4085
|
] }) })
|
|
3981
4086
|
}
|
|
3982
4087
|
);
|
|
@@ -4168,13 +4273,13 @@ function filterTokenUnType(items, excludeTypes) {
|
|
|
4168
4273
|
var mainnet3 = { id: 1 };
|
|
4169
4274
|
|
|
4170
4275
|
// src/consts/monad.ts
|
|
4171
|
-
var
|
|
4276
|
+
var monad2 = { id: 10143 };
|
|
4172
4277
|
|
|
4173
4278
|
// src/consts/stable.ts
|
|
4174
|
-
var
|
|
4279
|
+
var stable2 = { id: 1 };
|
|
4175
4280
|
|
|
4176
4281
|
// src/core/SelectTokenModal/hooks/useChainsAndTokensForSelect.ts
|
|
4177
|
-
[mainnet3.id, base.id, ink.id, bsc.id,
|
|
4282
|
+
[mainnet3.id, base.id, ink.id, bsc.id, monad2.id, soneium.id, stable2.id];
|
|
4178
4283
|
var useChainsAndTokensForSelect = ({
|
|
4179
4284
|
data,
|
|
4180
4285
|
selectedChain,
|
|
@@ -4572,7 +4677,7 @@ var Network = ({
|
|
|
4572
4677
|
}
|
|
4573
4678
|
),
|
|
4574
4679
|
/* @__PURE__ */ jsxs(
|
|
4575
|
-
|
|
4680
|
+
Text2,
|
|
4576
4681
|
{
|
|
4577
4682
|
variant: {
|
|
4578
4683
|
base: "content7",
|
|
@@ -4640,20 +4745,6 @@ function countLeadingZerosAfterDecimal(numStr) {
|
|
|
4640
4745
|
if (firstNonZeroIndex === -1) return 0;
|
|
4641
4746
|
return firstNonZeroIndex;
|
|
4642
4747
|
}
|
|
4643
|
-
function findItemByName2(arr, targetName) {
|
|
4644
|
-
const foundItem = arr.find(
|
|
4645
|
-
(item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
|
|
4646
|
-
);
|
|
4647
|
-
return [foundItem !== void 0, foundItem];
|
|
4648
|
-
}
|
|
4649
|
-
function findItemBySymbol2(arr, targetName, chainId, platform_id) {
|
|
4650
|
-
const foundItem = arr.find((item) => {
|
|
4651
|
-
{
|
|
4652
|
-
return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
|
|
4653
|
-
}
|
|
4654
|
-
});
|
|
4655
|
-
return [foundItem !== void 0, foundItem];
|
|
4656
|
-
}
|
|
4657
4748
|
var TokenAmountHeading = ({
|
|
4658
4749
|
amount,
|
|
4659
4750
|
decimals,
|
|
@@ -4661,13 +4752,14 @@ var TokenAmountHeading = ({
|
|
|
4661
4752
|
suffix,
|
|
4662
4753
|
...props
|
|
4663
4754
|
}) => {
|
|
4755
|
+
const { theme } = useWidgetTheme();
|
|
4664
4756
|
const _amount = formatTokenAmount({
|
|
4665
4757
|
amount,
|
|
4666
4758
|
decimals
|
|
4667
4759
|
});
|
|
4668
4760
|
const leadingZeros = countLeadingZerosAfterDecimal(_amount);
|
|
4669
4761
|
if (leadingZeros > 5) {
|
|
4670
|
-
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: [
|
|
4671
4763
|
prefix,
|
|
4672
4764
|
" ",
|
|
4673
4765
|
_amount.slice(0, 3),
|
|
@@ -4686,7 +4778,7 @@ var TokenAmountHeading = ({
|
|
|
4686
4778
|
suffix
|
|
4687
4779
|
] });
|
|
4688
4780
|
}
|
|
4689
|
-
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: [
|
|
4690
4782
|
prefix,
|
|
4691
4783
|
" ",
|
|
4692
4784
|
_amount,
|
|
@@ -4707,7 +4799,7 @@ var TokenAmountText = ({
|
|
|
4707
4799
|
});
|
|
4708
4800
|
const leadingZeros = countLeadingZerosAfterDecimal(_amount);
|
|
4709
4801
|
if (leadingZeros > 5) {
|
|
4710
|
-
return /* @__PURE__ */ jsxs(
|
|
4802
|
+
return /* @__PURE__ */ jsxs(Text2, { variant: "content8", ...props, children: [
|
|
4711
4803
|
prefix,
|
|
4712
4804
|
" ",
|
|
4713
4805
|
_amount.slice(0, 3),
|
|
@@ -4726,7 +4818,7 @@ var TokenAmountText = ({
|
|
|
4726
4818
|
suffix
|
|
4727
4819
|
] });
|
|
4728
4820
|
}
|
|
4729
|
-
return /* @__PURE__ */ jsxs(
|
|
4821
|
+
return /* @__PURE__ */ jsxs(Text2, { variant: "content7", ...props, children: [
|
|
4730
4822
|
prefix,
|
|
4731
4823
|
" ",
|
|
4732
4824
|
_amount,
|
|
@@ -5039,7 +5131,7 @@ var TokenAndAddress = ({
|
|
|
5039
5131
|
)
|
|
5040
5132
|
] }),
|
|
5041
5133
|
/* @__PURE__ */ jsx(
|
|
5042
|
-
|
|
5134
|
+
Text2,
|
|
5043
5135
|
{
|
|
5044
5136
|
variant: {
|
|
5045
5137
|
base: "content9",
|
|
@@ -5067,7 +5159,7 @@ var TokenAndAddress = ({
|
|
|
5067
5159
|
}
|
|
5068
5160
|
),
|
|
5069
5161
|
/* @__PURE__ */ jsx(
|
|
5070
|
-
|
|
5162
|
+
Text2,
|
|
5071
5163
|
{
|
|
5072
5164
|
variant: {
|
|
5073
5165
|
base: "content9",
|
|
@@ -5271,7 +5363,7 @@ var TokenList = ({
|
|
|
5271
5363
|
}
|
|
5272
5364
|
} else {
|
|
5273
5365
|
return /* @__PURE__ */ jsx(HStack, { w: "100%", h: "50px", justify: "center", align: "center", children: /* @__PURE__ */ jsx(
|
|
5274
|
-
|
|
5366
|
+
Text2,
|
|
5275
5367
|
{
|
|
5276
5368
|
color: theme.weakTextColor,
|
|
5277
5369
|
variant: {
|
|
@@ -5370,7 +5462,7 @@ var TokenList = ({
|
|
|
5370
5462
|
cursor: "pointer",
|
|
5371
5463
|
children: [
|
|
5372
5464
|
/* @__PURE__ */ jsx(Icon, { as: item.icon, boxSize: "14px" }),
|
|
5373
|
-
/* @__PURE__ */ jsx(
|
|
5465
|
+
/* @__PURE__ */ jsx(Text2, { children: item.name })
|
|
5374
5466
|
]
|
|
5375
5467
|
},
|
|
5376
5468
|
index
|
|
@@ -5670,7 +5762,7 @@ var MobileContent = memo(function MobileContent2({
|
|
|
5670
5762
|
objectFit: "cover"
|
|
5671
5763
|
}
|
|
5672
5764
|
) }),
|
|
5673
|
-
/* @__PURE__ */ jsx(Icon, { as: ArrowDownIcon, boxSize: "16px" })
|
|
5765
|
+
/* @__PURE__ */ jsx(Icon, { as: ArrowDownIcon, boxSize: "16px", color: theme.defaultTextColor })
|
|
5674
5766
|
]
|
|
5675
5767
|
}
|
|
5676
5768
|
)
|
|
@@ -5726,10 +5818,10 @@ var MobileContent = memo(function MobileContent2({
|
|
|
5726
5818
|
children: [
|
|
5727
5819
|
/* @__PURE__ */ jsx(AllChainsIcon, {}),
|
|
5728
5820
|
/* @__PURE__ */ jsx(
|
|
5729
|
-
|
|
5821
|
+
Text2,
|
|
5730
5822
|
{
|
|
5731
5823
|
variant: "content6_1",
|
|
5732
|
-
color:
|
|
5824
|
+
color: theme.defaultTextColor,
|
|
5733
5825
|
whiteSpace: "nowrap",
|
|
5734
5826
|
children: "Chains with assets"
|
|
5735
5827
|
}
|
|
@@ -5741,7 +5833,7 @@ var MobileContent = memo(function MobileContent2({
|
|
|
5741
5833
|
]
|
|
5742
5834
|
}
|
|
5743
5835
|
),
|
|
5744
|
-
!isPreconfigured && /* @__PURE__ */ jsx(
|
|
5836
|
+
!isPreconfigured && /* @__PURE__ */ jsx(Text2, { px: 2, color: theme.weakTextColor, variant: "content7", my: 2, children: "Popular" }),
|
|
5745
5837
|
/* @__PURE__ */ jsxs(VStack, { w: "100%", align: "start", gap: 0, children: [
|
|
5746
5838
|
popularChains?.map((chain) => /* @__PURE__ */ jsx(
|
|
5747
5839
|
Network,
|
|
@@ -5777,7 +5869,7 @@ var MobileContent = memo(function MobileContent2({
|
|
|
5777
5869
|
chain.chain_id + "fav-chains"
|
|
5778
5870
|
))
|
|
5779
5871
|
] }),
|
|
5780
|
-
!isPreconfigured && /* @__PURE__ */ jsx(
|
|
5872
|
+
!isPreconfigured && /* @__PURE__ */ jsx(Text2, { px: 2, color: theme.weakTextColor, variant: "content7", my: 2, children: "Chains (A-Z)" }),
|
|
5781
5873
|
/* @__PURE__ */ jsx(VStack, { w: "100%", align: "start", gap: 0, children: orderedChains?.filter((chain) => chain.is_testnet !== true)?.map((chain) => /* @__PURE__ */ jsx(
|
|
5782
5874
|
Network,
|
|
5783
5875
|
{
|
|
@@ -5794,7 +5886,7 @@ var MobileContent = memo(function MobileContent2({
|
|
|
5794
5886
|
chain.chain_id + "ordered-chains"
|
|
5795
5887
|
)) }),
|
|
5796
5888
|
!isSelectingFromToken && !isPreconfigured && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5797
|
-
/* @__PURE__ */ jsx(
|
|
5889
|
+
/* @__PURE__ */ jsx(Text2, { px: 2, color: theme.weakTextColor, variant: "content7", my: 2, children: "Prediction" }),
|
|
5798
5890
|
orderedPredictionChains?.map((chain) => /* @__PURE__ */ jsx(
|
|
5799
5891
|
Network,
|
|
5800
5892
|
{
|
|
@@ -5812,7 +5904,7 @@ var MobileContent = memo(function MobileContent2({
|
|
|
5812
5904
|
chain.chain_id + "prediction-chains"
|
|
5813
5905
|
))
|
|
5814
5906
|
] }),
|
|
5815
|
-
!isPreconfigured && /* @__PURE__ */ jsx(
|
|
5907
|
+
!isPreconfigured && /* @__PURE__ */ jsx(Text2, { px: 2, color: theme.weakTextColor, variant: "content7", my: 2, children: "Testnet" }),
|
|
5816
5908
|
orderedChains?.filter((chain) => chain.is_testnet === true)?.map((chain) => /* @__PURE__ */ jsx(
|
|
5817
5909
|
Network,
|
|
5818
5910
|
{
|
|
@@ -6006,7 +6098,7 @@ var DesktopContent = ({
|
|
|
6006
6098
|
children: [
|
|
6007
6099
|
/* @__PURE__ */ jsx(AllChainsIcon, {}),
|
|
6008
6100
|
/* @__PURE__ */ jsx(
|
|
6009
|
-
|
|
6101
|
+
Text2,
|
|
6010
6102
|
{
|
|
6011
6103
|
variant: "content6_1",
|
|
6012
6104
|
color: theme.defaultTextColor,
|
|
@@ -6033,7 +6125,7 @@ var DesktopContent = ({
|
|
|
6033
6125
|
},
|
|
6034
6126
|
chain.chain_id + "search-chains"
|
|
6035
6127
|
)) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6036
|
-
!isPreconfigured && /* @__PURE__ */ jsx(
|
|
6128
|
+
!isPreconfigured && /* @__PURE__ */ jsx(Text2, { px: 2, color: theme.weakTextColor, variant: "content7", mb: 2, children: "Popular" }),
|
|
6037
6129
|
popularChains?.map((chain) => /* @__PURE__ */ jsx(
|
|
6038
6130
|
Network,
|
|
6039
6131
|
{
|
|
@@ -6061,7 +6153,7 @@ var DesktopContent = ({
|
|
|
6061
6153
|
},
|
|
6062
6154
|
chain.chain_id + "fav-chains"
|
|
6063
6155
|
)),
|
|
6064
|
-
!isPreconfigured && /* @__PURE__ */ jsx(
|
|
6156
|
+
!isPreconfigured && /* @__PURE__ */ jsx(Text2, { px: 2, color: theme.weakTextColor, variant: "content7", my: 2, children: "Chains (A-Z)" }),
|
|
6065
6157
|
orderedChains?.filter((chain) => chain.is_testnet === false)?.map((chain) => /* @__PURE__ */ jsx(
|
|
6066
6158
|
Network,
|
|
6067
6159
|
{
|
|
@@ -6077,7 +6169,7 @@ var DesktopContent = ({
|
|
|
6077
6169
|
)),
|
|
6078
6170
|
!isSelectingFromToken && !isPreconfigured && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6079
6171
|
/* @__PURE__ */ jsx(
|
|
6080
|
-
|
|
6172
|
+
Text2,
|
|
6081
6173
|
{
|
|
6082
6174
|
px: 2,
|
|
6083
6175
|
color: theme.weakTextColor,
|
|
@@ -6103,7 +6195,7 @@ var DesktopContent = ({
|
|
|
6103
6195
|
chain.chain_id + "prediction-chains"
|
|
6104
6196
|
))
|
|
6105
6197
|
] }),
|
|
6106
|
-
!isPreconfigured && /* @__PURE__ */ jsx(
|
|
6198
|
+
!isPreconfigured && /* @__PURE__ */ jsx(Text2, { px: 2, color: theme.weakTextColor, variant: "content7", my: 2, children: "Testnet" }),
|
|
6107
6199
|
orderedChains?.filter((chain) => chain.is_testnet === true)?.map((chain) => /* @__PURE__ */ jsx(
|
|
6108
6200
|
Network,
|
|
6109
6201
|
{
|
|
@@ -6234,6 +6326,7 @@ var SelectTokenModal = ({
|
|
|
6234
6326
|
allTokens: tokens
|
|
6235
6327
|
});
|
|
6236
6328
|
const { userHasSelectedFromNetwork, setUserHasSelectedFromNetwork } = useUserHasSelectedFromNetwork();
|
|
6329
|
+
const prevUserHasSelectedRef = useRef(userHasSelectedFromNetwork);
|
|
6237
6330
|
const { chains } = useChainsStore();
|
|
6238
6331
|
const [disableTestnetLimit, setDisableTestnetLimit] = useState(false);
|
|
6239
6332
|
const [tempSelectAll, setTempSelectAll] = useState(false);
|
|
@@ -6268,6 +6361,8 @@ var SelectTokenModal = ({
|
|
|
6268
6361
|
setTempSelectedPlatformId(null);
|
|
6269
6362
|
}
|
|
6270
6363
|
}
|
|
6364
|
+
const userJustSelected = userHasSelectedFromNetwork && !prevUserHasSelectedRef.current;
|
|
6365
|
+
prevUserHasSelectedRef.current = userHasSelectedFromNetwork;
|
|
6271
6366
|
if (isSelectingFromToken) {
|
|
6272
6367
|
if (isLoadingUserBalances) return;
|
|
6273
6368
|
if (isArcTestnetShortLink) {
|
|
@@ -6281,7 +6376,9 @@ var SelectTokenModal = ({
|
|
|
6281
6376
|
setSelectedChain(null);
|
|
6282
6377
|
} else {
|
|
6283
6378
|
setIsSelectAll(false);
|
|
6284
|
-
|
|
6379
|
+
if (!userJustSelected) {
|
|
6380
|
+
setSelectedChain(fromChainId);
|
|
6381
|
+
}
|
|
6285
6382
|
}
|
|
6286
6383
|
} else {
|
|
6287
6384
|
setIsSelectAll(false);
|
|
@@ -6533,7 +6630,7 @@ var TokenInfoCom = ({ tokenInfo, priority = false }) => {
|
|
|
6533
6630
|
}
|
|
6534
6631
|
),
|
|
6535
6632
|
/* @__PURE__ */ jsx(
|
|
6536
|
-
|
|
6633
|
+
Text2,
|
|
6537
6634
|
{
|
|
6538
6635
|
variant: {
|
|
6539
6636
|
base: "content9",
|
|
@@ -6614,7 +6711,9 @@ var TokenSelectAndInput = ({
|
|
|
6614
6711
|
const toTokenBalanceHyper = {
|
|
6615
6712
|
formatted: toTokenBalanceHyperBack?.withdrawable,
|
|
6616
6713
|
value: toBigInt(
|
|
6617
|
-
toTokenBalanceHyperBack?.withdrawable ? toTokenBalanceHyperBack?.withdrawable : "0"
|
|
6714
|
+
toTokenBalanceHyperBack?.withdrawable ? toTokenBalanceHyperBack?.withdrawable : "0",
|
|
6715
|
+
6
|
|
6716
|
+
)
|
|
6618
6717
|
};
|
|
6619
6718
|
useEffect(() => {
|
|
6620
6719
|
if (!isFrom) {
|
|
@@ -6803,7 +6902,7 @@ var TokenSelectAndInput = ({
|
|
|
6803
6902
|
const loss = -(+toAmountToUsd - +fromAmountToUsd) / +fromAmountToUsd;
|
|
6804
6903
|
if (loss >= 0.1) {
|
|
6805
6904
|
return /* @__PURE__ */ jsx(
|
|
6806
|
-
|
|
6905
|
+
Text2,
|
|
6807
6906
|
{
|
|
6808
6907
|
as: "span",
|
|
6809
6908
|
color: "#ff4267",
|
|
@@ -6838,7 +6937,7 @@ var TokenSelectAndInput = ({
|
|
|
6838
6937
|
return /* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
6839
6938
|
renderSolanaWalletIcon(),
|
|
6840
6939
|
/* @__PURE__ */ jsx(
|
|
6841
|
-
|
|
6940
|
+
Text2,
|
|
6842
6941
|
{
|
|
6843
6942
|
variant: "content8",
|
|
6844
6943
|
backgroundColor: theme.highlightBgColor,
|
|
@@ -6855,7 +6954,7 @@ var TokenSelectAndInput = ({
|
|
|
6855
6954
|
return /* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
6856
6955
|
walletIcon,
|
|
6857
6956
|
/* @__PURE__ */ jsx(
|
|
6858
|
-
|
|
6957
|
+
Text2,
|
|
6859
6958
|
{
|
|
6860
6959
|
variant: "content8",
|
|
6861
6960
|
backgroundColor: theme.highlightBgColor,
|
|
@@ -6874,7 +6973,7 @@ var TokenSelectAndInput = ({
|
|
|
6874
6973
|
return /* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
6875
6974
|
walletIcon,
|
|
6876
6975
|
/* @__PURE__ */ jsx(
|
|
6877
|
-
|
|
6976
|
+
Text2,
|
|
6878
6977
|
{
|
|
6879
6978
|
variant: "content8",
|
|
6880
6979
|
backgroundColor: theme.assistBgColor,
|
|
@@ -6888,7 +6987,7 @@ var TokenSelectAndInput = ({
|
|
|
6888
6987
|
}
|
|
6889
6988
|
return /* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
6890
6989
|
/* @__PURE__ */ jsx(
|
|
6891
|
-
|
|
6990
|
+
Text2,
|
|
6892
6991
|
{
|
|
6893
6992
|
variant: "content8",
|
|
6894
6993
|
backgroundColor: theme.assistBgColor,
|
|
@@ -6917,7 +7016,7 @@ var TokenSelectAndInput = ({
|
|
|
6917
7016
|
cursor: "pointer",
|
|
6918
7017
|
children: [
|
|
6919
7018
|
/* @__PURE__ */ jsx(
|
|
6920
|
-
|
|
7019
|
+
Text2,
|
|
6921
7020
|
{
|
|
6922
7021
|
variant: "content8",
|
|
6923
7022
|
backgroundColor: theme.assistBgColor,
|
|
@@ -6956,7 +7055,7 @@ var TokenSelectAndInput = ({
|
|
|
6956
7055
|
cursor: "pointer",
|
|
6957
7056
|
children: [
|
|
6958
7057
|
/* @__PURE__ */ jsx(
|
|
6959
|
-
|
|
7058
|
+
Text2,
|
|
6960
7059
|
{
|
|
6961
7060
|
variant: "content8",
|
|
6962
7061
|
backgroundColor: theme.assistBgColor,
|
|
@@ -6990,7 +7089,7 @@ var TokenSelectAndInput = ({
|
|
|
6990
7089
|
return /* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
6991
7090
|
walletIcon,
|
|
6992
7091
|
/* @__PURE__ */ jsx(
|
|
6993
|
-
|
|
7092
|
+
Text2,
|
|
6994
7093
|
{
|
|
6995
7094
|
variant: "content8",
|
|
6996
7095
|
backgroundColor: theme.assistBgColor,
|
|
@@ -7050,7 +7149,7 @@ var TokenSelectAndInput = ({
|
|
|
7050
7149
|
border: "1px solid",
|
|
7051
7150
|
borderColor: theme.highlightTextColor,
|
|
7052
7151
|
onClick: () => handleQuickInput("50%"),
|
|
7053
|
-
children: /* @__PURE__ */ jsx(
|
|
7152
|
+
children: /* @__PURE__ */ jsx(Text2, { variant: "content9", color: theme.highlightTextColor, children: "50%" })
|
|
7054
7153
|
}
|
|
7055
7154
|
),
|
|
7056
7155
|
/* @__PURE__ */ jsx(
|
|
@@ -7063,10 +7162,10 @@ var TokenSelectAndInput = ({
|
|
|
7063
7162
|
borderRadius: "4px",
|
|
7064
7163
|
bg: theme.highlightButtonBg,
|
|
7065
7164
|
onClick: () => handleQuickInput("Max"),
|
|
7066
|
-
children: /* @__PURE__ */ jsx(
|
|
7165
|
+
children: /* @__PURE__ */ jsx(Text2, { variant: "content9", color: theme.highlightButtonText, children: "Max" })
|
|
7067
7166
|
}
|
|
7068
7167
|
),
|
|
7069
|
-
/* @__PURE__ */ jsxs(
|
|
7168
|
+
/* @__PURE__ */ jsxs(Text2, { variant: "content8", color: theme.weakTextColor, children: [
|
|
7070
7169
|
"Balance:",
|
|
7071
7170
|
" ",
|
|
7072
7171
|
tokenInfo.isSolana && solanaBalance ? solanaBalance.formatted : balance
|
|
@@ -7183,7 +7282,7 @@ var TokenSelectAndInput = ({
|
|
|
7183
7282
|
}
|
|
7184
7283
|
),
|
|
7185
7284
|
/* @__PURE__ */ jsxs(
|
|
7186
|
-
|
|
7285
|
+
Text2,
|
|
7187
7286
|
{
|
|
7188
7287
|
variant: {
|
|
7189
7288
|
base: "content9",
|
|
@@ -7221,10 +7320,10 @@ var TokenSelectAndInput = ({
|
|
|
7221
7320
|
bottom: ["6px", "8px"],
|
|
7222
7321
|
left: 0,
|
|
7223
7322
|
paddingRight: [2, 4],
|
|
7224
|
-
children: !isFrom && !isDepositPlatformToken && /* @__PURE__ */ jsx(Fragment, { children: tokenInfo.isSolana ? solanaWalletAddress && /* @__PURE__ */ jsxs(
|
|
7323
|
+
children: !isFrom && !isDepositPlatformToken && /* @__PURE__ */ jsx(Fragment, { children: tokenInfo.isSolana ? solanaWalletAddress && /* @__PURE__ */ jsxs(Text2, { variant: "content8", children: [
|
|
7225
7324
|
"Balance: ",
|
|
7226
7325
|
displayBalance
|
|
7227
|
-
] }) : address && /* @__PURE__ */ jsxs(
|
|
7326
|
+
] }) : address && /* @__PURE__ */ jsxs(Text2, { variant: "content8", children: [
|
|
7228
7327
|
"Balance: ",
|
|
7229
7328
|
displayBalance
|
|
7230
7329
|
] }) })
|
|
@@ -7318,7 +7417,7 @@ var TipsContent = ({
|
|
|
7318
7417
|
const renderFee = (fee) => {
|
|
7319
7418
|
if (fee === "0") {
|
|
7320
7419
|
return /* @__PURE__ */ jsx(
|
|
7321
|
-
|
|
7420
|
+
Text2,
|
|
7322
7421
|
{
|
|
7323
7422
|
variant: "content9",
|
|
7324
7423
|
color: "white",
|
|
@@ -7330,7 +7429,7 @@ var TipsContent = ({
|
|
|
7330
7429
|
);
|
|
7331
7430
|
}
|
|
7332
7431
|
return /* @__PURE__ */ jsxs(
|
|
7333
|
-
|
|
7432
|
+
Text2,
|
|
7334
7433
|
{
|
|
7335
7434
|
variant: {
|
|
7336
7435
|
base: "content9",
|
|
@@ -7355,7 +7454,7 @@ var TipsContent = ({
|
|
|
7355
7454
|
const sif = +swapImpactFee();
|
|
7356
7455
|
if (toAmountToUsd === null) {
|
|
7357
7456
|
return /* @__PURE__ */ jsx(
|
|
7358
|
-
|
|
7457
|
+
Text2,
|
|
7359
7458
|
{
|
|
7360
7459
|
variant: {
|
|
7361
7460
|
base: "content9",
|
|
@@ -7368,7 +7467,7 @@ var TipsContent = ({
|
|
|
7368
7467
|
}
|
|
7369
7468
|
if (sif > 0 || sif === 0) {
|
|
7370
7469
|
return /* @__PURE__ */ jsxs(
|
|
7371
|
-
|
|
7470
|
+
Text2,
|
|
7372
7471
|
{
|
|
7373
7472
|
variant: {
|
|
7374
7473
|
base: "content9",
|
|
@@ -7383,7 +7482,7 @@ var TipsContent = ({
|
|
|
7383
7482
|
);
|
|
7384
7483
|
}
|
|
7385
7484
|
return /* @__PURE__ */ jsxs(
|
|
7386
|
-
|
|
7485
|
+
Text2,
|
|
7387
7486
|
{
|
|
7388
7487
|
variant: {
|
|
7389
7488
|
base: "content9",
|
|
@@ -7418,7 +7517,7 @@ var TipsContent = ({
|
|
|
7418
7517
|
),
|
|
7419
7518
|
/* @__PURE__ */ jsxs(HStack, { justify: "space-between", w: "100%", children: [
|
|
7420
7519
|
/* @__PURE__ */ jsx(
|
|
7421
|
-
|
|
7520
|
+
Text2,
|
|
7422
7521
|
{
|
|
7423
7522
|
variant: {
|
|
7424
7523
|
base: "content9",
|
|
@@ -7432,7 +7531,7 @@ var TipsContent = ({
|
|
|
7432
7531
|
] }),
|
|
7433
7532
|
/* @__PURE__ */ jsxs(HStack, { justify: "space-between", w: "100%", children: [
|
|
7434
7533
|
/* @__PURE__ */ jsx(
|
|
7435
|
-
|
|
7534
|
+
Text2,
|
|
7436
7535
|
{
|
|
7437
7536
|
variant: {
|
|
7438
7537
|
base: "content9",
|
|
@@ -7443,7 +7542,7 @@ var TipsContent = ({
|
|
|
7443
7542
|
}
|
|
7444
7543
|
),
|
|
7445
7544
|
points === "0" && !fromTokenInfo.isSolana ? /* @__PURE__ */ jsx(
|
|
7446
|
-
|
|
7545
|
+
Text2,
|
|
7447
7546
|
{
|
|
7448
7547
|
variant: "content9",
|
|
7449
7548
|
color: "white",
|
|
@@ -7482,7 +7581,7 @@ var TipsContent = ({
|
|
|
7482
7581
|
),
|
|
7483
7582
|
/* @__PURE__ */ jsxs(HStack, { justify: "space-between", w: "100%", children: [
|
|
7484
7583
|
/* @__PURE__ */ jsx(
|
|
7485
|
-
|
|
7584
|
+
Text2,
|
|
7486
7585
|
{
|
|
7487
7586
|
variant: {
|
|
7488
7587
|
base: "content9",
|
|
@@ -7496,7 +7595,7 @@ var TipsContent = ({
|
|
|
7496
7595
|
] }),
|
|
7497
7596
|
/* @__PURE__ */ jsxs(HStack, { justify: "space-between", w: "100%", children: [
|
|
7498
7597
|
/* @__PURE__ */ jsx(
|
|
7499
|
-
|
|
7598
|
+
Text2,
|
|
7500
7599
|
{
|
|
7501
7600
|
variant: {
|
|
7502
7601
|
base: "content9",
|
|
@@ -7513,7 +7612,7 @@ var TipsContent = ({
|
|
|
7513
7612
|
] }),
|
|
7514
7613
|
/* @__PURE__ */ jsxs(HStack, { justify: "space-between", w: "100%", children: [
|
|
7515
7614
|
/* @__PURE__ */ jsx(
|
|
7516
|
-
|
|
7615
|
+
Text2,
|
|
7517
7616
|
{
|
|
7518
7617
|
variant: {
|
|
7519
7618
|
base: "content9",
|
|
@@ -7524,7 +7623,7 @@ var TipsContent = ({
|
|
|
7524
7623
|
}
|
|
7525
7624
|
),
|
|
7526
7625
|
points === "0" && !fromTokenInfo.isSolana ? /* @__PURE__ */ jsx(
|
|
7527
|
-
|
|
7626
|
+
Text2,
|
|
7528
7627
|
{
|
|
7529
7628
|
variant: "content9",
|
|
7530
7629
|
color: "white",
|
|
@@ -7581,7 +7680,7 @@ var TxInfo = ({
|
|
|
7581
7680
|
const renderPriceImpactPercentage = () => {
|
|
7582
7681
|
if (priceImpact.bridgeFee === "0" && priceImpact.dstGasFee === "0" && priceImpact.swapFee === "0") {
|
|
7583
7682
|
return /* @__PURE__ */ jsx(
|
|
7584
|
-
|
|
7683
|
+
Text2,
|
|
7585
7684
|
{
|
|
7586
7685
|
variant: "content9",
|
|
7587
7686
|
color: theme.highlightButtonText,
|
|
@@ -7596,17 +7695,17 @@ var TxInfo = ({
|
|
|
7596
7695
|
const inPrice = Number(fromAmountToUsd.replace(/,/g, ""));
|
|
7597
7696
|
const outPrice = Number(toAmountToUsd.replace(/,/g, ""));
|
|
7598
7697
|
if (outPrice > inPrice) {
|
|
7599
|
-
return /* @__PURE__ */ jsx(
|
|
7698
|
+
return /* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.defaultTextColor, children: `+${((outPrice - inPrice) / inPrice * 100).toFixed(2)}%` });
|
|
7600
7699
|
}
|
|
7601
|
-
return /* @__PURE__ */ jsx(
|
|
7700
|
+
return /* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.defaultTextColor, children: `-${((inPrice - outPrice) / inPrice * 100).toFixed(2)}%` });
|
|
7602
7701
|
}
|
|
7603
|
-
return /* @__PURE__ */ jsx(
|
|
7702
|
+
return /* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.defaultTextColor, children: "-" });
|
|
7604
7703
|
};
|
|
7605
7704
|
const renderSoneiumScore = useMemo(() => {
|
|
7606
7705
|
if (fromTokenInfo.chain_id === 1868 && toTokenInfo.chain_id !== 1868 || fromTokenInfo.chain_id === 1868 && toTokenInfo.chain_id === 1868) {
|
|
7607
7706
|
return /* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", children: [
|
|
7608
|
-
/* @__PURE__ */ jsx(
|
|
7609
|
-
/* @__PURE__ */ jsx(
|
|
7707
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.weakTextColor, children: "Soneium Score" }),
|
|
7708
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, children: "+ 1" })
|
|
7610
7709
|
] });
|
|
7611
7710
|
}
|
|
7612
7711
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
@@ -7625,7 +7724,7 @@ var TxInfo = ({
|
|
|
7625
7724
|
alignItems: "center",
|
|
7626
7725
|
children: [
|
|
7627
7726
|
/* @__PURE__ */ jsx(
|
|
7628
|
-
|
|
7727
|
+
Text2,
|
|
7629
7728
|
{
|
|
7630
7729
|
variant: textVariant,
|
|
7631
7730
|
fontSize: ["10px", "12px"],
|
|
@@ -7642,7 +7741,7 @@ var TxInfo = ({
|
|
|
7642
7741
|
margin: "0 2px"
|
|
7643
7742
|
}
|
|
7644
7743
|
),
|
|
7645
|
-
/* @__PURE__ */ jsx(
|
|
7744
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, fontSize: ["10px", "12px"], children: "Score" })
|
|
7646
7745
|
]
|
|
7647
7746
|
}
|
|
7648
7747
|
);
|
|
@@ -7708,7 +7807,7 @@ var TxInfo = ({
|
|
|
7708
7807
|
] }, index);
|
|
7709
7808
|
}) });
|
|
7710
7809
|
}
|
|
7711
|
-
return /* @__PURE__ */ jsx(
|
|
7810
|
+
return /* @__PURE__ */ jsx(Text2, { variant: textVariant, children: router });
|
|
7712
7811
|
};
|
|
7713
7812
|
return /* @__PURE__ */ jsxs(
|
|
7714
7813
|
Collapsible.Root,
|
|
@@ -7738,7 +7837,7 @@ var TxInfo = ({
|
|
|
7738
7837
|
h: "14px"
|
|
7739
7838
|
}
|
|
7740
7839
|
),
|
|
7741
|
-
/* @__PURE__ */ jsx(
|
|
7840
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, whiteSpace: "nowrap", children: isRateReversed ? `1 ${toTokenInfo.symbol} = ${fromAmountInUnit} ${fromTokenInfo.symbol}` : `1 ${fromTokenInfo.symbol} = ${toAmountInUnitStr} ${toTokenInfo.symbol}` })
|
|
7742
7841
|
]
|
|
7743
7842
|
}
|
|
7744
7843
|
),
|
|
@@ -7760,7 +7859,7 @@ var TxInfo = ({
|
|
|
7760
7859
|
/* @__PURE__ */ jsx(Collapsible.Content, { w: "100%", pb: 1.5, color: theme.defaultTextColor, children: /* @__PURE__ */ jsxs(VStack, { w: "100%", align: "start", fontSize: "xs", gap: 3, children: [
|
|
7761
7860
|
/* @__PURE__ */ jsxs(VStack, { bg: theme.defaultBgColor, p: 3, borderRadius: "12px", w: "100%", children: [
|
|
7762
7861
|
/* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", children: [
|
|
7763
|
-
/* @__PURE__ */ jsx(
|
|
7862
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.weakTextColor, children: "Price Impact" }),
|
|
7764
7863
|
/* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
7765
7864
|
renderPriceImpactPercentage(),
|
|
7766
7865
|
/* @__PURE__ */ jsx(
|
|
@@ -7790,14 +7889,14 @@ var TxInfo = ({
|
|
|
7790
7889
|
] })
|
|
7791
7890
|
] }),
|
|
7792
7891
|
/* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", children: [
|
|
7793
|
-
/* @__PURE__ */ jsx(
|
|
7794
|
-
/* @__PURE__ */ jsxs(
|
|
7892
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.weakTextColor, children: "Slippage" }),
|
|
7893
|
+
/* @__PURE__ */ jsxs(Text2, { variant: textVariant, children: [
|
|
7795
7894
|
formatSlippage(slippage),
|
|
7796
7895
|
"%"
|
|
7797
7896
|
] })
|
|
7798
7897
|
] }),
|
|
7799
7898
|
/* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", children: [
|
|
7800
|
-
/* @__PURE__ */ jsx(
|
|
7899
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.weakTextColor, children: "Min. Received" }),
|
|
7801
7900
|
/* @__PURE__ */ jsx(HStack, { gap: 1, children: /* @__PURE__ */ jsx(
|
|
7802
7901
|
TokenAmountText,
|
|
7803
7902
|
{
|
|
@@ -7810,10 +7909,10 @@ var TxInfo = ({
|
|
|
7810
7909
|
] }),
|
|
7811
7910
|
/* @__PURE__ */ jsxs(VStack, { bg: theme.defaultBgColor, p: 3, borderRadius: "12px", w: "100%", children: [
|
|
7812
7911
|
/* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", children: [
|
|
7813
|
-
/* @__PURE__ */ jsx(
|
|
7912
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.weakTextColor, children: "Estimated Time" }),
|
|
7814
7913
|
/* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
7815
7914
|
/* @__PURE__ */ jsx(Icon, { boxSize: "14px", children: /* @__PURE__ */ jsx(TimeIcon, {}) }),
|
|
7816
|
-
/* @__PURE__ */ jsxs(
|
|
7915
|
+
/* @__PURE__ */ jsxs(Text2, { variant: textVariant, children: [
|
|
7817
7916
|
"~",
|
|
7818
7917
|
estimatedTime,
|
|
7819
7918
|
"s"
|
|
@@ -7821,11 +7920,11 @@ var TxInfo = ({
|
|
|
7821
7920
|
] })
|
|
7822
7921
|
] }),
|
|
7823
7922
|
/* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", children: [
|
|
7824
|
-
/* @__PURE__ */ jsx(
|
|
7825
|
-
/* @__PURE__ */ jsx(
|
|
7923
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.weakTextColor, children: "Recipient Address" }),
|
|
7924
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, children: sliceAddress(recipient) })
|
|
7826
7925
|
] }),
|
|
7827
7926
|
/* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", children: [
|
|
7828
|
-
/* @__PURE__ */ jsx(
|
|
7927
|
+
/* @__PURE__ */ jsx(Text2, { variant: textVariant, color: theme.weakTextColor, children: "AI Router" }),
|
|
7829
7928
|
renderAiRouter()
|
|
7830
7929
|
] }),
|
|
7831
7930
|
renderSoneiumScore
|
|
@@ -8232,10 +8331,6 @@ var DifferentAddressDialog = ({
|
|
|
8232
8331
|
);
|
|
8233
8332
|
};
|
|
8234
8333
|
var DifferentAddressDialog_default = DifferentAddressDialog;
|
|
8235
|
-
var useRouter = () => ({ push: (_url) => {
|
|
8236
|
-
}, replace: (_url) => {
|
|
8237
|
-
} });
|
|
8238
|
-
var usePathname = () => "";
|
|
8239
8334
|
var FormBody = ({
|
|
8240
8335
|
getQuote,
|
|
8241
8336
|
quoteInfo,
|
|
@@ -8247,6 +8342,7 @@ var FormBody = ({
|
|
|
8247
8342
|
refetchQuote,
|
|
8248
8343
|
config
|
|
8249
8344
|
}) => {
|
|
8345
|
+
const { theme } = useWidgetTheme();
|
|
8250
8346
|
const {
|
|
8251
8347
|
fromAmount,
|
|
8252
8348
|
toAmount,
|
|
@@ -8262,129 +8358,8 @@ var FormBody = ({
|
|
|
8262
8358
|
} = useSwapAndBridgeContextStore();
|
|
8263
8359
|
const { chains } = useChainsStore();
|
|
8264
8360
|
const { tokens } = useTokensStore();
|
|
8265
|
-
const { replace: replaceLink } = useRouter();
|
|
8266
|
-
const pathname = usePathname();
|
|
8267
|
-
const { isTrendingOpen, setTrendingClientReact, setIsTrendingLonger } = { isTrendingOpen: false, setTrendingClientReact: (_v) => {
|
|
8268
|
-
}, setIsTrendingLonger: (_v) => {
|
|
8269
|
-
} };
|
|
8270
|
-
const isMobile = useBreakpointValue({ base: true, md: false });
|
|
8271
8361
|
const [isFromHyperChain, setIsFromHyperChain] = useState(false);
|
|
8272
8362
|
const [isToHyperChain, setIsToHyperChain] = useState(false);
|
|
8273
|
-
const updateSearchParams = useCallback(
|
|
8274
|
-
(params) => {
|
|
8275
|
-
if (typeof window === "undefined") return;
|
|
8276
|
-
const searchParams = window?.location?.search;
|
|
8277
|
-
const newParams = new URLSearchParams(searchParams);
|
|
8278
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
8279
|
-
newParams.set(key, value);
|
|
8280
|
-
});
|
|
8281
|
-
const newPath = decodeURIComponent(pathname.replace(/\/+$/, ""));
|
|
8282
|
-
if (tokens && chains && matchesAnyPatternUsingArray(newPath)) {
|
|
8283
|
-
if (toRegex.test(newPath)) {
|
|
8284
|
-
const [exists, chainsInfo2] = findItemByName2(
|
|
8285
|
-
chains || [],
|
|
8286
|
-
newPath.replace("/", "")
|
|
8287
|
-
);
|
|
8288
|
-
if (!exists) return;
|
|
8289
|
-
const foundItem = tokens.find(
|
|
8290
|
-
(item) => item.chain_id === chainsInfo2?.chain_id
|
|
8291
|
-
);
|
|
8292
|
-
if (foundItem) {
|
|
8293
|
-
newParams.set("to_chain", foundItem.chain_id.toString());
|
|
8294
|
-
newParams.set("to_token", foundItem.address.toString());
|
|
8295
|
-
}
|
|
8296
|
-
} else if (toAndTokenRegex.test(newPath)) {
|
|
8297
|
-
const arr = newPath.replace("/", "").split("&");
|
|
8298
|
-
const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
|
|
8299
|
-
if (!exists) return;
|
|
8300
|
-
const [result, foundItem] = findItemBySymbol2(
|
|
8301
|
-
tokens,
|
|
8302
|
-
arr[1],
|
|
8303
|
-
chainsInfo2?.chain_id
|
|
8304
|
-
);
|
|
8305
|
-
if (!result) return;
|
|
8306
|
-
if (result && foundItem) {
|
|
8307
|
-
newParams.set("to_chain", foundItem.chain_id.toString());
|
|
8308
|
-
newParams.set("to_token", foundItem.address.toString());
|
|
8309
|
-
}
|
|
8310
|
-
} else if (fromRegex.test(newPath)) {
|
|
8311
|
-
const arr = newPath.split("&");
|
|
8312
|
-
const [exists, chainsInfo2] = findItemByName2(chains, arr[1]);
|
|
8313
|
-
if (!exists) return;
|
|
8314
|
-
const foundItem = tokens.find(
|
|
8315
|
-
(item) => item.chain_id === chainsInfo2?.chain_id
|
|
8316
|
-
);
|
|
8317
|
-
if (foundItem) {
|
|
8318
|
-
newParams.set("from_chain", foundItem.chain_id.toString());
|
|
8319
|
-
newParams.set("from_token", foundItem.address.toString());
|
|
8320
|
-
}
|
|
8321
|
-
} else if (fromAndTokenRegex.test(newPath)) {
|
|
8322
|
-
const arr = newPath.replace("/", "").split("&");
|
|
8323
|
-
const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
|
|
8324
|
-
if (!exists) return;
|
|
8325
|
-
const [result, foundItem] = findItemBySymbol2(
|
|
8326
|
-
tokens,
|
|
8327
|
-
arr[1],
|
|
8328
|
-
chainsInfo2?.chain_id
|
|
8329
|
-
);
|
|
8330
|
-
if (!result) return;
|
|
8331
|
-
if (result && foundItem) {
|
|
8332
|
-
newParams.set("from_chain", foundItem.chain_id.toString());
|
|
8333
|
-
newParams.set("from_token", foundItem.address.toString());
|
|
8334
|
-
}
|
|
8335
|
-
} else if (fromAndToRegex.test(newPath)) {
|
|
8336
|
-
const arr = newPath.split("/");
|
|
8337
|
-
const [resultFrom, fromChainsInfo] = findItemByName2(chains, arr[1]);
|
|
8338
|
-
if (!resultFrom) return;
|
|
8339
|
-
const foundFromItem = tokens.find(
|
|
8340
|
-
(item) => item.chain_id === fromChainsInfo?.chain_id
|
|
8341
|
-
);
|
|
8342
|
-
if (!foundFromItem) return;
|
|
8343
|
-
newParams.set("from_chain", foundFromItem.chain_id.toString());
|
|
8344
|
-
newParams.set("from_token", foundFromItem.address.toString());
|
|
8345
|
-
const [resultTo, toChainsInfo] = findItemByName2(chains, arr[2]);
|
|
8346
|
-
if (!resultTo) return;
|
|
8347
|
-
const foundToItem = tokens.find(
|
|
8348
|
-
(item) => item.chain_id === toChainsInfo?.chain_id
|
|
8349
|
-
);
|
|
8350
|
-
if (!foundToItem) return;
|
|
8351
|
-
newParams.set("to_chain", foundToItem.chain_id.toString());
|
|
8352
|
-
newParams.set("to_token", foundToItem.address.toString());
|
|
8353
|
-
} else if (fromAndTokenAndToAndTokenRegex.test(newPath)) {
|
|
8354
|
-
const arr = newPath.split("/");
|
|
8355
|
-
const arrFrom = arr[1].split("&");
|
|
8356
|
-
const [resultFrom, fromChainsInfo] = findItemByName2(
|
|
8357
|
-
chains,
|
|
8358
|
-
arrFrom[0]
|
|
8359
|
-
);
|
|
8360
|
-
if (!resultFrom) return;
|
|
8361
|
-
const [resultFromToken, fromTokenInfo2] = findItemBySymbol2(
|
|
8362
|
-
tokens,
|
|
8363
|
-
arrFrom[1],
|
|
8364
|
-
fromChainsInfo?.chain_id
|
|
8365
|
-
);
|
|
8366
|
-
if (!resultFromToken) return;
|
|
8367
|
-
const arrTo = arr[2].split("&");
|
|
8368
|
-
const [resultTo, toChainsInfo] = findItemByName2(chains, arrTo[0]);
|
|
8369
|
-
if (!resultTo) return;
|
|
8370
|
-
const [resultToToken, toTokenInfo2] = findItemBySymbol2(
|
|
8371
|
-
tokens,
|
|
8372
|
-
arrTo[1],
|
|
8373
|
-
toChainsInfo?.chain_id
|
|
8374
|
-
);
|
|
8375
|
-
if (!resultToToken) return;
|
|
8376
|
-
if (fromTokenInfo2 && toTokenInfo2) {
|
|
8377
|
-
newParams.set("to_chain", toTokenInfo2.chain_id.toString());
|
|
8378
|
-
newParams.set("to_token", toTokenInfo2.address.toString());
|
|
8379
|
-
newParams.set("from_chain", fromTokenInfo2.chain_id.toString());
|
|
8380
|
-
newParams.set("from_token", fromTokenInfo2.address.toString());
|
|
8381
|
-
}
|
|
8382
|
-
}
|
|
8383
|
-
}
|
|
8384
|
-
replaceLink(`${pathname.replace(pathname, "")}/?${newParams.toString()}`);
|
|
8385
|
-
},
|
|
8386
|
-
[pathname, replaceLink, chains, tokens]
|
|
8387
|
-
);
|
|
8388
8363
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
8389
8364
|
const [isDifferentAddressDialogOpen, setIsDifferentAddressDialogOpen] = useState(false);
|
|
8390
8365
|
const [isSelectingFromToken, setIsSelectingFromToken] = useState(false);
|
|
@@ -8408,20 +8383,24 @@ var FormBody = ({
|
|
|
8408
8383
|
address,
|
|
8409
8384
|
isToHyperChain
|
|
8410
8385
|
);
|
|
8411
|
-
const fromTokenBalanceHyper = {
|
|
8386
|
+
const fromTokenBalanceHyper = useMemo(() => ({
|
|
8412
8387
|
decimals: 6,
|
|
8413
8388
|
formatted: fromTokenBalanceHyperBack?.withdrawable,
|
|
8414
8389
|
symbol: "USDC",
|
|
8415
8390
|
value: toBigInt(
|
|
8416
|
-
fromTokenBalanceHyperBack?.withdrawable ? fromTokenBalanceHyperBack?.withdrawable : "0"
|
|
8417
|
-
|
|
8418
|
-
|
|
8391
|
+
fromTokenBalanceHyperBack?.withdrawable ? fromTokenBalanceHyperBack?.withdrawable : "0",
|
|
8392
|
+
6
|
|
8393
|
+
)
|
|
8394
|
+
}), [fromTokenBalanceHyperBack?.withdrawable]);
|
|
8395
|
+
const toTokenBalanceHyper = useMemo(() => ({
|
|
8419
8396
|
decimals: 6,
|
|
8420
8397
|
formatted: toTokenBalanceHyperBack?.withdrawable,
|
|
8421
8398
|
symbol: "USDC",
|
|
8422
8399
|
value: toBigInt(
|
|
8423
|
-
toTokenBalanceHyperBack?.withdrawable ? toTokenBalanceHyperBack?.withdrawable : "0"
|
|
8424
|
-
|
|
8400
|
+
toTokenBalanceHyperBack?.withdrawable ? toTokenBalanceHyperBack?.withdrawable : "0",
|
|
8401
|
+
6
|
|
8402
|
+
)
|
|
8403
|
+
}), [toTokenBalanceHyperBack?.withdrawable]);
|
|
8425
8404
|
useEffect(() => {
|
|
8426
8405
|
if (fromTokenInfo.chain_id === hyperliquidChainId) {
|
|
8427
8406
|
setIsFromHyperChain(true);
|
|
@@ -8591,15 +8570,12 @@ var FormBody = ({
|
|
|
8591
8570
|
}, [tokens]);
|
|
8592
8571
|
const handleSelectToken = useCallback(
|
|
8593
8572
|
(tokenInfo) => {
|
|
8594
|
-
const params = {};
|
|
8595
8573
|
const isTestnetChain = (chainId) => {
|
|
8596
8574
|
const chainInfo = chains?.find((chain) => chain.chain_id === chainId);
|
|
8597
8575
|
return chainInfo?.is_testnet === true;
|
|
8598
8576
|
};
|
|
8599
8577
|
if (isSelectingFromToken) {
|
|
8600
8578
|
setFromTokenInfo(tokenInfo);
|
|
8601
|
-
params.from_chain = tokenInfo.chain_id.toString();
|
|
8602
|
-
params.from_token = tokenInfo.address;
|
|
8603
8579
|
if (isTestnetChain(tokenInfo.chain_id)) {
|
|
8604
8580
|
const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === zeroAddress;
|
|
8605
8581
|
if (isNativeToken) {
|
|
@@ -8608,8 +8584,6 @@ var FormBody = ({
|
|
|
8608
8584
|
);
|
|
8609
8585
|
if (otherToken) {
|
|
8610
8586
|
setToTokenInfo(otherToken);
|
|
8611
|
-
params.to_chain = otherToken.chain_id.toString();
|
|
8612
|
-
params.to_token = otherToken.address;
|
|
8613
8587
|
}
|
|
8614
8588
|
} else {
|
|
8615
8589
|
const nativeToken = tokens?.find(
|
|
@@ -8617,16 +8591,12 @@ var FormBody = ({
|
|
|
8617
8591
|
);
|
|
8618
8592
|
if (nativeToken && (nativeToken.chain_id !== toTokenInfo?.chain_id || nativeToken.address !== toTokenInfo?.address)) {
|
|
8619
8593
|
setToTokenInfo(nativeToken);
|
|
8620
|
-
params.to_chain = nativeToken.chain_id.toString();
|
|
8621
|
-
params.to_token = nativeToken.address;
|
|
8622
8594
|
} else if (!nativeToken) {
|
|
8623
8595
|
const otherToken = tokens?.find(
|
|
8624
8596
|
(t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
|
|
8625
8597
|
);
|
|
8626
8598
|
if (otherToken) {
|
|
8627
8599
|
setToTokenInfo(otherToken);
|
|
8628
|
-
params.to_chain = otherToken.chain_id.toString();
|
|
8629
|
-
params.to_token = otherToken.address;
|
|
8630
8600
|
}
|
|
8631
8601
|
}
|
|
8632
8602
|
}
|
|
@@ -8637,15 +8607,11 @@ var FormBody = ({
|
|
|
8637
8607
|
);
|
|
8638
8608
|
if (baseEthToken) {
|
|
8639
8609
|
setToTokenInfo(baseEthToken);
|
|
8640
|
-
params.to_chain = baseEthToken.chain_id.toString();
|
|
8641
|
-
params.to_token = baseEthToken.address;
|
|
8642
8610
|
}
|
|
8643
8611
|
}
|
|
8644
8612
|
}
|
|
8645
8613
|
} else {
|
|
8646
8614
|
setToTokenInfo(tokenInfo);
|
|
8647
|
-
params.to_chain = tokenInfo.chain_id.toString();
|
|
8648
|
-
params.to_token = tokenInfo.address;
|
|
8649
8615
|
if (isTestnetChain(tokenInfo.chain_id)) {
|
|
8650
8616
|
const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === zeroAddress;
|
|
8651
8617
|
if (isNativeToken) {
|
|
@@ -8654,8 +8620,6 @@ var FormBody = ({
|
|
|
8654
8620
|
);
|
|
8655
8621
|
if (otherToken) {
|
|
8656
8622
|
setFromTokenInfo(otherToken);
|
|
8657
|
-
params.from_chain = otherToken.chain_id.toString();
|
|
8658
|
-
params.from_token = otherToken.address;
|
|
8659
8623
|
}
|
|
8660
8624
|
} else {
|
|
8661
8625
|
const nativeToken = tokens?.find(
|
|
@@ -8663,16 +8627,12 @@ var FormBody = ({
|
|
|
8663
8627
|
);
|
|
8664
8628
|
if (nativeToken && (nativeToken.chain_id !== fromTokenInfo?.chain_id || nativeToken.address !== fromTokenInfo?.address)) {
|
|
8665
8629
|
setFromTokenInfo(nativeToken);
|
|
8666
|
-
params.from_chain = nativeToken.chain_id.toString();
|
|
8667
|
-
params.from_token = nativeToken.address;
|
|
8668
8630
|
} else if (!nativeToken) {
|
|
8669
8631
|
const otherToken = tokens?.find(
|
|
8670
8632
|
(t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
|
|
8671
8633
|
);
|
|
8672
8634
|
if (otherToken) {
|
|
8673
8635
|
setFromTokenInfo(otherToken);
|
|
8674
|
-
params.from_chain = otherToken.chain_id.toString();
|
|
8675
|
-
params.from_token = otherToken.address;
|
|
8676
8636
|
}
|
|
8677
8637
|
}
|
|
8678
8638
|
}
|
|
@@ -8683,13 +8643,10 @@ var FormBody = ({
|
|
|
8683
8643
|
);
|
|
8684
8644
|
if (soneiumEthToken) {
|
|
8685
8645
|
setFromTokenInfo(soneiumEthToken);
|
|
8686
|
-
params.from_chain = soneiumEthToken.chain_id.toString();
|
|
8687
|
-
params.from_token = soneiumEthToken.address;
|
|
8688
8646
|
}
|
|
8689
8647
|
}
|
|
8690
8648
|
}
|
|
8691
8649
|
}
|
|
8692
|
-
updateSearchParams(params);
|
|
8693
8650
|
handleCloseModal();
|
|
8694
8651
|
setQuoteInfo(initialQuoteInfo);
|
|
8695
8652
|
saveTokenSelection();
|
|
@@ -8700,7 +8657,6 @@ var FormBody = ({
|
|
|
8700
8657
|
setFromTokenInfo,
|
|
8701
8658
|
setQuoteInfo,
|
|
8702
8659
|
setToTokenInfo,
|
|
8703
|
-
updateSearchParams,
|
|
8704
8660
|
tokens,
|
|
8705
8661
|
fromTokenInfo,
|
|
8706
8662
|
toTokenInfo,
|
|
@@ -8718,12 +8674,6 @@ var FormBody = ({
|
|
|
8718
8674
|
const _fromAmount = toAmount;
|
|
8719
8675
|
setDifferentAddress(void 0);
|
|
8720
8676
|
switchTokens();
|
|
8721
|
-
updateSearchParams({
|
|
8722
|
-
from_chain: _fromTokenInfo.chain_id.toString(),
|
|
8723
|
-
from_token: _fromTokenInfo.address,
|
|
8724
|
-
to_chain: _toTokenInfo.chain_id.toString(),
|
|
8725
|
-
to_token: _toTokenInfo.address
|
|
8726
|
-
});
|
|
8727
8677
|
const _fromAddress = () => {
|
|
8728
8678
|
if (_fromTokenInfo.isSolana) {
|
|
8729
8679
|
return solanaWalletAddress || "";
|
|
@@ -8778,15 +8728,6 @@ var FormBody = ({
|
|
|
8778
8728
|
const handleToAmountChange = (value) => {
|
|
8779
8729
|
setToAmount(value);
|
|
8780
8730
|
};
|
|
8781
|
-
useEffect(() => {
|
|
8782
|
-
document.getElementById("js_main_form");
|
|
8783
|
-
}, [
|
|
8784
|
-
isMobile,
|
|
8785
|
-
isTrendingOpen,
|
|
8786
|
-
setTrendingClientReact,
|
|
8787
|
-
quoteInfo,
|
|
8788
|
-
setIsTrendingLonger
|
|
8789
|
-
]);
|
|
8790
8731
|
useEffect(() => {
|
|
8791
8732
|
const refetchQuote2 = async () => {
|
|
8792
8733
|
await getQuote({
|
|
@@ -8842,7 +8783,7 @@ var FormBody = ({
|
|
|
8842
8783
|
transform: ["translate(-50%, -100%)", "translate(-50%, -82.5%)"],
|
|
8843
8784
|
cursor: toTokenInfo.chain_id === hyperliquidChainId ? "default" : "pointer",
|
|
8844
8785
|
onClick: handleSwitchTokens,
|
|
8845
|
-
color:
|
|
8786
|
+
color: theme.weakTextColor,
|
|
8846
8787
|
boxSize: {
|
|
8847
8788
|
base: "20px",
|
|
8848
8789
|
md: "30px"
|
|
@@ -9087,7 +9028,9 @@ var SlippageSettings = ({ refetchQuote }) => {
|
|
|
9087
9028
|
base: "20px",
|
|
9088
9029
|
md: "22px"
|
|
9089
9030
|
},
|
|
9090
|
-
as: SettingsIcon
|
|
9031
|
+
as: SettingsIcon,
|
|
9032
|
+
position: "relative",
|
|
9033
|
+
top: "-2px"
|
|
9091
9034
|
}
|
|
9092
9035
|
),
|
|
9093
9036
|
showYellowDot && /* @__PURE__ */ jsx(
|
|
@@ -9135,7 +9078,7 @@ var SlippageSettings = ({ refetchQuote }) => {
|
|
|
9135
9078
|
boxShadow: "0px 0px 10px 0px rgba(0, 0, 0, 0.1)"
|
|
9136
9079
|
},
|
|
9137
9080
|
content: /* @__PURE__ */ jsx(
|
|
9138
|
-
|
|
9081
|
+
Text2,
|
|
9139
9082
|
{
|
|
9140
9083
|
variant: {
|
|
9141
9084
|
base: "content8",
|
|
@@ -9170,7 +9113,7 @@ var SlippageSettings = ({ refetchQuote }) => {
|
|
|
9170
9113
|
top: 0,
|
|
9171
9114
|
right: 0,
|
|
9172
9115
|
children: /* @__PURE__ */ jsx(
|
|
9173
|
-
|
|
9116
|
+
Text2,
|
|
9174
9117
|
{
|
|
9175
9118
|
variant: {
|
|
9176
9119
|
base: "content9",
|
|
@@ -9201,7 +9144,7 @@ var SlippageSettings = ({ refetchQuote }) => {
|
|
|
9201
9144
|
borderRadius: "10px",
|
|
9202
9145
|
onClick: () => handlePresetClick(presetValue),
|
|
9203
9146
|
children: /* @__PURE__ */ jsxs(
|
|
9204
|
-
|
|
9147
|
+
Text2,
|
|
9205
9148
|
{
|
|
9206
9149
|
variant: {
|
|
9207
9150
|
base: "content9",
|
|
@@ -9289,7 +9232,7 @@ var SlippageSettings = ({ refetchQuote }) => {
|
|
|
9289
9232
|
}
|
|
9290
9233
|
),
|
|
9291
9234
|
/* @__PURE__ */ jsx(
|
|
9292
|
-
|
|
9235
|
+
Text2,
|
|
9293
9236
|
{
|
|
9294
9237
|
variant: {
|
|
9295
9238
|
base: "content9",
|
|
@@ -9314,10 +9257,92 @@ var FormTop = ({
|
|
|
9314
9257
|
quoteInfo,
|
|
9315
9258
|
clearLockedRequestId,
|
|
9316
9259
|
refreshInterval = 30,
|
|
9317
|
-
hideCountdown = false
|
|
9260
|
+
hideCountdown = false,
|
|
9261
|
+
onHistoryClick
|
|
9318
9262
|
}) => {
|
|
9319
9263
|
const { isLoading: isLoadingRefresh } = useRefreshLoading();
|
|
9320
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
|
+
]);
|
|
9321
9346
|
const isPolling = Boolean(quoteInfo?.request_id && !isLoadingRefresh);
|
|
9322
9347
|
const [countdown, setCountdown] = useState(refreshInterval);
|
|
9323
9348
|
useEffect(() => {
|
|
@@ -9355,7 +9380,24 @@ var FormTop = ({
|
|
|
9355
9380
|
children: "Bridge & Swap"
|
|
9356
9381
|
}
|
|
9357
9382
|
),
|
|
9358
|
-
/* @__PURE__ */ jsxs(HStack, { color: theme.weakTextColor
|
|
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
|
+
),
|
|
9359
9401
|
/* @__PURE__ */ jsxs(
|
|
9360
9402
|
HStack,
|
|
9361
9403
|
{
|
|
@@ -9418,15 +9460,43 @@ var FormTop = ({
|
|
|
9418
9460
|
textAlign: "center",
|
|
9419
9461
|
lineHeight: "28px",
|
|
9420
9462
|
fontSize: "10px",
|
|
9421
|
-
color: countdown <= 10 ?
|
|
9463
|
+
color: countdown <= 10 ? theme.defaultTextColor : theme.highlightTextColor,
|
|
9422
9464
|
children: isPolling && !hideCountdown && countdown > 0 ? countdown : ""
|
|
9423
9465
|
}
|
|
9424
9466
|
)
|
|
9425
9467
|
]
|
|
9426
9468
|
}
|
|
9427
9469
|
),
|
|
9428
|
-
/* @__PURE__ */ jsx(SlippageSettings, { refetchQuote })
|
|
9429
|
-
|
|
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
|
+
] }) })
|
|
9430
9500
|
] });
|
|
9431
9501
|
};
|
|
9432
9502
|
var Timer = ({ stop, onTick }) => {
|
|
@@ -9473,7 +9543,7 @@ var Timer = ({ stop, onTick }) => {
|
|
|
9473
9543
|
}
|
|
9474
9544
|
}, [stop]);
|
|
9475
9545
|
return /* @__PURE__ */ jsx(
|
|
9476
|
-
|
|
9546
|
+
Text2,
|
|
9477
9547
|
{
|
|
9478
9548
|
variant: {
|
|
9479
9549
|
base: "content8",
|
|
@@ -9855,7 +9925,7 @@ var TxState = ({
|
|
|
9855
9925
|
if (isSolanaTransaction && solanaFromTxHash) {
|
|
9856
9926
|
if (solanaStatus === "confirmed") {
|
|
9857
9927
|
return /* @__PURE__ */ jsx(Link, { href: getSolanaTxLink(solanaFromTxHash), target: "_blank", children: /* @__PURE__ */ jsxs(
|
|
9858
|
-
|
|
9928
|
+
Text2,
|
|
9859
9929
|
{
|
|
9860
9930
|
variant: {
|
|
9861
9931
|
base: "content9",
|
|
@@ -9873,7 +9943,7 @@ var TxState = ({
|
|
|
9873
9943
|
}
|
|
9874
9944
|
if (solanaStatus === "failed") {
|
|
9875
9945
|
return /* @__PURE__ */ jsx(
|
|
9876
|
-
|
|
9946
|
+
Text2,
|
|
9877
9947
|
{
|
|
9878
9948
|
variant: {
|
|
9879
9949
|
base: "content9",
|
|
@@ -9885,7 +9955,7 @@ var TxState = ({
|
|
|
9885
9955
|
);
|
|
9886
9956
|
}
|
|
9887
9957
|
return /* @__PURE__ */ jsx(
|
|
9888
|
-
|
|
9958
|
+
Text2,
|
|
9889
9959
|
{
|
|
9890
9960
|
variant: {
|
|
9891
9961
|
base: "content9",
|
|
@@ -9903,7 +9973,7 @@ var TxState = ({
|
|
|
9903
9973
|
href: getTxLink(fromTxHash, fromTokenInfo.chain_id),
|
|
9904
9974
|
target: "_blank",
|
|
9905
9975
|
children: /* @__PURE__ */ jsxs(
|
|
9906
|
-
|
|
9976
|
+
Text2,
|
|
9907
9977
|
{
|
|
9908
9978
|
variant: {
|
|
9909
9979
|
base: "content9",
|
|
@@ -9923,7 +9993,7 @@ var TxState = ({
|
|
|
9923
9993
|
}
|
|
9924
9994
|
if (fromTxHash && receiptStatus === "failed" || isFetched) {
|
|
9925
9995
|
return /* @__PURE__ */ jsx(
|
|
9926
|
-
|
|
9996
|
+
Text2,
|
|
9927
9997
|
{
|
|
9928
9998
|
variant: {
|
|
9929
9999
|
base: "content9",
|
|
@@ -9936,7 +10006,7 @@ var TxState = ({
|
|
|
9936
10006
|
}
|
|
9937
10007
|
if (isTransactionBlocked) {
|
|
9938
10008
|
return /* @__PURE__ */ jsx(
|
|
9939
|
-
|
|
10009
|
+
Text2,
|
|
9940
10010
|
{
|
|
9941
10011
|
variant: {
|
|
9942
10012
|
base: "content9",
|
|
@@ -9948,7 +10018,7 @@ var TxState = ({
|
|
|
9948
10018
|
);
|
|
9949
10019
|
}
|
|
9950
10020
|
return /* @__PURE__ */ jsx(
|
|
9951
|
-
|
|
10021
|
+
Text2,
|
|
9952
10022
|
{
|
|
9953
10023
|
variant: {
|
|
9954
10024
|
base: "content9",
|
|
@@ -10098,7 +10168,7 @@ var TxState = ({
|
|
|
10098
10168
|
}
|
|
10099
10169
|
),
|
|
10100
10170
|
/* @__PURE__ */ jsx(
|
|
10101
|
-
|
|
10171
|
+
Text2,
|
|
10102
10172
|
{
|
|
10103
10173
|
variant: {
|
|
10104
10174
|
base: "content8",
|
|
@@ -10110,7 +10180,7 @@ var TxState = ({
|
|
|
10110
10180
|
)
|
|
10111
10181
|
] }),
|
|
10112
10182
|
/* @__PURE__ */ jsx(
|
|
10113
|
-
|
|
10183
|
+
Text2,
|
|
10114
10184
|
{
|
|
10115
10185
|
variant: {
|
|
10116
10186
|
base: "content8",
|
|
@@ -10162,6 +10232,7 @@ var TxState = ({
|
|
|
10162
10232
|
md: "16px"
|
|
10163
10233
|
},
|
|
10164
10234
|
w: "100%",
|
|
10235
|
+
backgroundColor: theme.assistBgColor,
|
|
10165
10236
|
children: /* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", gap: 1, children: [
|
|
10166
10237
|
/* @__PURE__ */ jsx(
|
|
10167
10238
|
BoxWithBg,
|
|
@@ -10205,6 +10276,7 @@ var TxState = ({
|
|
|
10205
10276
|
base: "20px",
|
|
10206
10277
|
md: "32px"
|
|
10207
10278
|
},
|
|
10279
|
+
color: theme.weakTextColor,
|
|
10208
10280
|
as: ArrowRightIcon
|
|
10209
10281
|
}
|
|
10210
10282
|
),
|
|
@@ -10251,7 +10323,7 @@ var TxState = ({
|
|
|
10251
10323
|
),
|
|
10252
10324
|
target: "_blank",
|
|
10253
10325
|
children: /* @__PURE__ */ jsxs(
|
|
10254
|
-
|
|
10326
|
+
Text2,
|
|
10255
10327
|
{
|
|
10256
10328
|
variant: {
|
|
10257
10329
|
base: "content9",
|
|
@@ -10268,7 +10340,7 @@ var TxState = ({
|
|
|
10268
10340
|
)
|
|
10269
10341
|
}
|
|
10270
10342
|
) : /* @__PURE__ */ jsx(
|
|
10271
|
-
|
|
10343
|
+
Text2,
|
|
10272
10344
|
{
|
|
10273
10345
|
variant: {
|
|
10274
10346
|
base: "content9",
|
|
@@ -10302,7 +10374,7 @@ var TxState = ({
|
|
|
10302
10374
|
/* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
10303
10375
|
/* @__PURE__ */ jsx(Icon, { as: DateIcon }),
|
|
10304
10376
|
/* @__PURE__ */ jsx(
|
|
10305
|
-
|
|
10377
|
+
Text2,
|
|
10306
10378
|
{
|
|
10307
10379
|
variant: {
|
|
10308
10380
|
base: "content8",
|
|
@@ -10314,7 +10386,7 @@ var TxState = ({
|
|
|
10314
10386
|
)
|
|
10315
10387
|
] }),
|
|
10316
10388
|
/* @__PURE__ */ jsx(
|
|
10317
|
-
|
|
10389
|
+
Text2,
|
|
10318
10390
|
{
|
|
10319
10391
|
variant: {
|
|
10320
10392
|
base: "content8",
|
|
@@ -10329,7 +10401,7 @@ var TxState = ({
|
|
|
10329
10401
|
/* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
10330
10402
|
/* @__PURE__ */ jsx(Icon, { as: TimeIcon }),
|
|
10331
10403
|
/* @__PURE__ */ jsx(
|
|
10332
|
-
|
|
10404
|
+
Text2,
|
|
10333
10405
|
{
|
|
10334
10406
|
variant: {
|
|
10335
10407
|
base: "content8",
|
|
@@ -10352,7 +10424,7 @@ var TxState = ({
|
|
|
10352
10424
|
/* @__PURE__ */ jsxs(HStack, { gap: 1, children: [
|
|
10353
10425
|
/* @__PURE__ */ jsx(Icon, { as: MoneyIcon }),
|
|
10354
10426
|
/* @__PURE__ */ jsx(
|
|
10355
|
-
|
|
10427
|
+
Text2,
|
|
10356
10428
|
{
|
|
10357
10429
|
variant: {
|
|
10358
10430
|
base: "content8",
|
|
@@ -10364,7 +10436,7 @@ var TxState = ({
|
|
|
10364
10436
|
)
|
|
10365
10437
|
] }),
|
|
10366
10438
|
/* @__PURE__ */ jsx(
|
|
10367
|
-
|
|
10439
|
+
Text2,
|
|
10368
10440
|
{
|
|
10369
10441
|
variant: {
|
|
10370
10442
|
base: "content8",
|
|
@@ -10385,6 +10457,381 @@ var TxState = ({
|
|
|
10385
10457
|
}
|
|
10386
10458
|
) });
|
|
10387
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
|
+
}
|
|
10388
10835
|
var initialQuoteInfo = {
|
|
10389
10836
|
isFetching: false,
|
|
10390
10837
|
error: null,
|
|
@@ -10433,6 +10880,7 @@ var MainForm = ({ config }) => {
|
|
|
10433
10880
|
const refreshIntervalRef = useRef(30);
|
|
10434
10881
|
const timerRef = useRef(null);
|
|
10435
10882
|
const isQuoteStoppedRef = useRef(false);
|
|
10883
|
+
const [showHistory, setShowHistory] = useState(false);
|
|
10436
10884
|
const { differentAddress } = useDifferentAddressStore();
|
|
10437
10885
|
const { chains, slippagePolicies } = useChainsStore();
|
|
10438
10886
|
const prevAddressRef = useRef(address);
|
|
@@ -10837,6 +11285,16 @@ var MainForm = ({ config }) => {
|
|
|
10837
11285
|
}
|
|
10838
11286
|
) });
|
|
10839
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
|
+
}
|
|
10840
11298
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10841
11299
|
/* @__PURE__ */ jsx(
|
|
10842
11300
|
FormTop,
|
|
@@ -10845,7 +11303,8 @@ var MainForm = ({ config }) => {
|
|
|
10845
11303
|
quoteInfo,
|
|
10846
11304
|
clearLockedRequestId,
|
|
10847
11305
|
refreshInterval,
|
|
10848
|
-
hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains)
|
|
11306
|
+
hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains),
|
|
11307
|
+
onHistoryClick: () => setShowHistory(true)
|
|
10849
11308
|
}
|
|
10850
11309
|
),
|
|
10851
11310
|
/* @__PURE__ */ jsx(
|
|
@@ -10916,7 +11375,23 @@ var MainForm = ({ config }) => {
|
|
|
10916
11375
|
src: "https://wheelx.fi/images/success-sprites.png",
|
|
10917
11376
|
alt: "success"
|
|
10918
11377
|
}
|
|
10919
|
-
)
|
|
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
|
+
] }) }) })
|
|
10920
11395
|
]
|
|
10921
11396
|
}
|
|
10922
11397
|
),
|
|
@@ -10930,39 +11405,7 @@ var MainForm = ({ config }) => {
|
|
|
10930
11405
|
md: "480px"
|
|
10931
11406
|
}
|
|
10932
11407
|
}
|
|
10933
|
-
)
|
|
10934
|
-
/* @__PURE__ */ jsx(Box, { marginTop: "30px", fontSize: "14px", children: /* @__PURE__ */ jsx(
|
|
10935
|
-
"a",
|
|
10936
|
-
{
|
|
10937
|
-
href: "https://github.com/wheelx-fi/wheelx-contracts/blob/main/audits/ABDK_WheelX_WheelXContracts_v_1_0.pdf",
|
|
10938
|
-
target: "_blank",
|
|
10939
|
-
children: /* @__PURE__ */ jsxs(
|
|
10940
|
-
Text,
|
|
10941
|
-
{
|
|
10942
|
-
color: "#5D6270",
|
|
10943
|
-
display: "flex",
|
|
10944
|
-
alignItems: "center",
|
|
10945
|
-
justifyContent: "center",
|
|
10946
|
-
children: [
|
|
10947
|
-
"Audited By",
|
|
10948
|
-
" ",
|
|
10949
|
-
/* @__PURE__ */ jsx(
|
|
10950
|
-
Image,
|
|
10951
|
-
{
|
|
10952
|
-
display: "block",
|
|
10953
|
-
width: "70px",
|
|
10954
|
-
height: "28px",
|
|
10955
|
-
marginLeft: "2px",
|
|
10956
|
-
objectFit: "contain",
|
|
10957
|
-
src: "https://wheelx.fi/images/adbk.png",
|
|
10958
|
-
alt: ""
|
|
10959
|
-
}
|
|
10960
|
-
)
|
|
10961
|
-
]
|
|
10962
|
-
}
|
|
10963
|
-
)
|
|
10964
|
-
}
|
|
10965
|
-
) })
|
|
11408
|
+
)
|
|
10966
11409
|
] })
|
|
10967
11410
|
}
|
|
10968
11411
|
),
|