@wheelx-widget/widget 0.1.5 → 0.1.7
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 +748 -343
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +754 -349
- 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 { defineRecipe, chakra, Tooltip as Tooltip$1, Portal, VStack, Box, HStack, InputGroup, Input, Icon, Image, useBreakpointValue, Dialog, Spinner, Link,
|
|
4
|
-
import { useQuery, QueryClient, QueryClientProvider, useMutation } from '@tanstack/react-query';
|
|
5
|
-
import { useUserWallets, DynamicContextProvider, useRpcProviders, useTokenBalances, ChainEnum,
|
|
3
|
+
import { defineRecipe, chakra, Tooltip as Tooltip$1, Portal, VStack, Box, HStack, InputGroup, Input, Icon, Image, useBreakpointValue, Dialog, Spinner, Link, Button, Text, Popover, Collapsible, useDisclosure } from '@chakra-ui/react';
|
|
4
|
+
import { useQuery, QueryClient, QueryClientProvider, useMutation, keepPreviousData } from '@tanstack/react-query';
|
|
5
|
+
import { useUserWallets, DynamicContextProvider, useRpcProviders, useDynamicContext, useTokenBalances, ChainEnum, useDynamicModals, useIsLoggedIn } from '@dynamic-labs/sdk-react-core';
|
|
6
6
|
import { EthereumWalletConnectors } from '@dynamic-labs/ethereum';
|
|
7
7
|
import { SolanaWalletConnectorsWithConfig } from '@dynamic-labs/solana';
|
|
8
8
|
import { DynamicWagmiConnector } from '@dynamic-labs/wagmi-connector';
|
|
9
|
-
import { useAccount, WagmiProvider, useChainId, useConfig, useReconnect, createConfig, useEstimateFeesPerGas, fallback, http as http$1, useWaitForTransactionReceipt,
|
|
10
|
-
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';
|
|
11
12
|
import { ThemeProvider } from '@emotion/react';
|
|
12
13
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
13
14
|
import axios6, { AxiosError } from 'axios';
|
|
14
15
|
import { create } from 'zustand';
|
|
15
16
|
import { Fraction, RoundingMode } from 'bi-fraction';
|
|
16
|
-
import { zeroAddress, createPublicClient, http, parseUnits, erc20Abi, formatUnits, isAddress, hexToString, createClient, custom } from 'viem';
|
|
17
17
|
import { base, soneium, ink, bsc } from 'viem/chains';
|
|
18
18
|
import { PublicKey, VersionedTransaction, VersionedMessage, Transaction } from '@solana/web3.js';
|
|
19
19
|
import { parseAccount, getAddress } from 'viem/utils';
|
|
@@ -23,8 +23,10 @@ import { WalletIcon as WalletIcon$1 } from '@dynamic-labs/wallet-book';
|
|
|
23
23
|
import { FiEdit } from 'react-icons/fi';
|
|
24
24
|
import { IoAddCircleOutline, IoClose } from 'react-icons/io5';
|
|
25
25
|
import { FaTriangleExclamation, FaGasPump } from 'react-icons/fa6';
|
|
26
|
-
import { IoIosFlash } from 'react-icons/io';
|
|
26
|
+
import { IoMdLogOut, IoIosFlash } from 'react-icons/io';
|
|
27
27
|
import { BsFillClipboardMinusFill } from 'react-icons/bs';
|
|
28
|
+
import { HiMiniArrowRight } from 'react-icons/hi2';
|
|
29
|
+
import { RiArrowGoBackFill } from 'react-icons/ri';
|
|
28
30
|
|
|
29
31
|
// src/providers/WheelXProvider.tsx
|
|
30
32
|
|
|
@@ -157,7 +159,11 @@ var useWalletConnectedStore = create((set, get) => ({
|
|
|
157
159
|
evmWalletConnectorId: null,
|
|
158
160
|
setEvmWalletInfo: (address, connectorId) => set({ evmWalletAddress: address, evmWalletConnectorId: connectorId }),
|
|
159
161
|
isEvmWalletMetamask: false,
|
|
160
|
-
setIsEvmWalletMetamask: (isEvmWalletMetamask) => set({ isEvmWalletMetamask })
|
|
162
|
+
setIsEvmWalletMetamask: (isEvmWalletMetamask) => set({ isEvmWalletMetamask }),
|
|
163
|
+
isLoggingOut: false,
|
|
164
|
+
setIsLoggingOut: (isLoggingOut) => set({ isLoggingOut }),
|
|
165
|
+
lastDisconnectTimestamp: 0,
|
|
166
|
+
setLastDisconnectTimestamp: (ts) => set({ lastDisconnectTimestamp: ts })
|
|
161
167
|
}));
|
|
162
168
|
|
|
163
169
|
// src/stores/useSyncWalletConnectedStore.ts
|
|
@@ -167,14 +173,25 @@ var getEvmConnectorId = (wallet) => {
|
|
|
167
173
|
};
|
|
168
174
|
var useSyncWalletConnectedStore = () => {
|
|
169
175
|
const userWallets = useUserWallets();
|
|
170
|
-
const { address: wagmiAddress, connector: wagmiConnector
|
|
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 = {};
|
|
@@ -498,35 +636,8 @@ function ChainsAndTokensLoader({ children, config }) {
|
|
|
498
636
|
if (data.deposit_platforms?.prediction?.tokens) l.push(...data.deposit_platforms.prediction.tokens);
|
|
499
637
|
return l;
|
|
500
638
|
}, [data]);
|
|
501
|
-
const filteredChains =
|
|
502
|
-
|
|
503
|
-
const fromChains = config?.from?.chains;
|
|
504
|
-
const toChains = config?.to?.chains;
|
|
505
|
-
if (!fromChains?.length && !toChains?.length) return allChains;
|
|
506
|
-
const allowedSet = /* @__PURE__ */ new Set();
|
|
507
|
-
fromChains?.forEach((id) => allowedSet.add(id));
|
|
508
|
-
toChains?.forEach((id) => allowedSet.add(id));
|
|
509
|
-
return allChains.filter((c) => allowedSet.has(c.chain_id));
|
|
510
|
-
}, [allChains, config?.from?.chains, config?.to?.chains]);
|
|
511
|
-
const filteredTokens = useMemo(() => {
|
|
512
|
-
if (!allTokens) return null;
|
|
513
|
-
const fromTokenConfig = config?.from?.chainTokens;
|
|
514
|
-
const toTokenConfig = config?.to?.chainTokens;
|
|
515
|
-
if (!fromTokenConfig && !toTokenConfig) return allTokens;
|
|
516
|
-
const allowedSet = /* @__PURE__ */ new Set();
|
|
517
|
-
const addTokens = (tc) => {
|
|
518
|
-
if (!tc) return;
|
|
519
|
-
for (const entries of Object.values(tc)) {
|
|
520
|
-
for (const t of entries) {
|
|
521
|
-
allowedSet.add(`${t.chainId}:${t.address.toLowerCase()}`);
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
addTokens(fromTokenConfig);
|
|
526
|
-
addTokens(toTokenConfig);
|
|
527
|
-
if (allowedSet.size === 0) return allTokens;
|
|
528
|
-
return allTokens.filter((t) => allowedSet.has(`${t.chain_id}:${t.address.toLowerCase()}`));
|
|
529
|
-
}, [allTokens, config?.from?.chainTokens, config?.to?.chainTokens]);
|
|
639
|
+
const filteredChains = allChains;
|
|
640
|
+
const filteredTokens = allTokens;
|
|
530
641
|
React5__default.useEffect(() => {
|
|
531
642
|
if (filteredChains && !initialDataRef.current) {
|
|
532
643
|
setChains(filteredChains);
|
|
@@ -864,6 +975,16 @@ var formatDate = (dateString) => {
|
|
|
864
975
|
const formattedTime = `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
|
|
865
976
|
return formattedTime;
|
|
866
977
|
};
|
|
978
|
+
var dateFormatter = (isoString) => {
|
|
979
|
+
const date = new Date(isoString);
|
|
980
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
981
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
982
|
+
const year = date.getFullYear();
|
|
983
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
984
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
985
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
986
|
+
return `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
|
|
987
|
+
};
|
|
867
988
|
|
|
868
989
|
// src/utils/address.ts
|
|
869
990
|
var sliceAddress = (address, startLength = 4, endLength = 4) => {
|
|
@@ -935,25 +1056,6 @@ var isSolanaChain = (chain_id) => {
|
|
|
935
1056
|
return chain_id === SOLANA_MAINNET.chain_id;
|
|
936
1057
|
};
|
|
937
1058
|
|
|
938
|
-
// src/utils/shortLinkRegex.ts
|
|
939
|
-
var toRegex = /^\/[a-zA-Z0-9]+$/;
|
|
940
|
-
var toAndTokenRegex = /^\/(?!from)[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
|
|
941
|
-
var fromRegex = /^\/from&[a-zA-Z0-9-+]+$/;
|
|
942
|
-
var fromAndTokenRegex = /^\/from&[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
|
|
943
|
-
var fromAndToRegex = /^\/[a-zA-Z0-9-+]+\/[a-zA-Z0-9-+]+$/;
|
|
944
|
-
var fromAndTokenAndToAndTokenRegex = /^\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+\/[a-zA-Z0-9-+]+&[a-zA-Z0-9-+.₮Ï]+$/;
|
|
945
|
-
var allRegexPatterns = [
|
|
946
|
-
toRegex,
|
|
947
|
-
toAndTokenRegex,
|
|
948
|
-
fromRegex,
|
|
949
|
-
fromAndTokenRegex,
|
|
950
|
-
fromAndToRegex,
|
|
951
|
-
fromAndTokenAndToAndTokenRegex
|
|
952
|
-
];
|
|
953
|
-
function matchesAnyPatternUsingArray(inputString) {
|
|
954
|
-
return allRegexPatterns.some((regex) => regex.test(inputString));
|
|
955
|
-
}
|
|
956
|
-
|
|
957
1059
|
// src/utils/tokenSelectionCache.ts
|
|
958
1060
|
var TOKEN_SELECTION = "tokenSelection";
|
|
959
1061
|
var tokenSelectionStore = new localstorage_default(TOKEN_SELECTION);
|
|
@@ -1041,7 +1143,7 @@ var logger = {
|
|
|
1041
1143
|
error: errorWithTimestamp,
|
|
1042
1144
|
debug: debugWithTimestamp
|
|
1043
1145
|
};
|
|
1044
|
-
var wagmiSupportedChains = [mainnet, base$1, soneium$1, polygon, arbitrum, optimism];
|
|
1146
|
+
var wagmiSupportedChains = [mainnet, base$1, soneium$1, polygon, arbitrum, optimism, bsc$1];
|
|
1045
1147
|
var getTxLink = (txHash, chainId) => {
|
|
1046
1148
|
if (isSolanaChain(chainId)) {
|
|
1047
1149
|
return `${SOLANA_MAINNET.explorerUrl}/tx/${txHash}`;
|
|
@@ -1113,20 +1215,6 @@ var isSolanaChain2 = (chain_id) => {
|
|
|
1113
1215
|
};
|
|
1114
1216
|
|
|
1115
1217
|
// src/core/hooks/useSwapAndBridgeContextStore.ts
|
|
1116
|
-
function findItemByName(arr, targetName) {
|
|
1117
|
-
const foundItem = arr.find(
|
|
1118
|
-
(item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
|
|
1119
|
-
);
|
|
1120
|
-
return [foundItem !== void 0, foundItem];
|
|
1121
|
-
}
|
|
1122
|
-
function findItemBySymbol(arr, targetName, chainId, platform_id) {
|
|
1123
|
-
const foundItem = arr.find((item) => {
|
|
1124
|
-
{
|
|
1125
|
-
return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
|
|
1126
|
-
}
|
|
1127
|
-
});
|
|
1128
|
-
return [foundItem !== void 0, foundItem];
|
|
1129
|
-
}
|
|
1130
1218
|
var DEFAULT_FROM_TOKEN = {
|
|
1131
1219
|
name: "Base",
|
|
1132
1220
|
address: zeroAddress,
|
|
@@ -1229,8 +1317,6 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1229
1317
|
const {
|
|
1230
1318
|
setFromTokenInfo,
|
|
1231
1319
|
setToTokenInfo,
|
|
1232
|
-
setIsShortLink,
|
|
1233
|
-
setShortLink,
|
|
1234
1320
|
setFromAmount,
|
|
1235
1321
|
setToAmount
|
|
1236
1322
|
} = useSwapAndBridgeContextStore();
|
|
@@ -1240,11 +1326,6 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1240
1326
|
const address = useEvmAddress();
|
|
1241
1327
|
const { resetTxState } = useTxStateContextStore();
|
|
1242
1328
|
const hasInitialized = useRef(false);
|
|
1243
|
-
const currentPathname = useMemo(() => {
|
|
1244
|
-
if (typeof window === "undefined") return "/";
|
|
1245
|
-
return window.location.pathname;
|
|
1246
|
-
}, []);
|
|
1247
|
-
const pathname = currentPathname;
|
|
1248
1329
|
useEffect(() => {
|
|
1249
1330
|
if (hasInitialized.current) return;
|
|
1250
1331
|
if (!chains || !tokens) return;
|
|
@@ -1257,6 +1338,14 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1257
1338
|
(t) => t.chain_id === config.from?.defaultToken?.chainId && t.address.toLowerCase() === config.from?.defaultToken?.address.toLowerCase()
|
|
1258
1339
|
);
|
|
1259
1340
|
}
|
|
1341
|
+
if (!defaultToken) {
|
|
1342
|
+
const ct = config.from?.chainTokens?.[fromChain.chain_id];
|
|
1343
|
+
if (ct?.length) {
|
|
1344
|
+
defaultToken = tokens.find(
|
|
1345
|
+
(t) => t.chain_id === ct[0].chainId && t.address.toLowerCase() === ct[0].address.toLowerCase()
|
|
1346
|
+
);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1260
1349
|
if (!defaultToken) {
|
|
1261
1350
|
defaultToken = tokens.find(
|
|
1262
1351
|
(t) => t.chain_id === fromChain.chain_id && t.address.toLowerCase() === fromChain.eth_token.toLowerCase()
|
|
@@ -1276,6 +1365,14 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1276
1365
|
(t) => t.chain_id === config.to?.defaultToken?.chainId && t.address.toLowerCase() === config.to?.defaultToken?.address.toLowerCase()
|
|
1277
1366
|
);
|
|
1278
1367
|
}
|
|
1368
|
+
if (!defaultToken) {
|
|
1369
|
+
const ct = config.to?.chainTokens?.[toChain.chain_id];
|
|
1370
|
+
if (ct?.length) {
|
|
1371
|
+
defaultToken = tokens.find(
|
|
1372
|
+
(t) => t.chain_id === ct[0].chainId && t.address.toLowerCase() === ct[0].address.toLowerCase()
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1279
1376
|
if (!defaultToken) {
|
|
1280
1377
|
defaultToken = tokens.find(
|
|
1281
1378
|
(t) => t.chain_id === toChain.chain_id && t.address.toLowerCase() === toChain.eth_token.toLowerCase()
|
|
@@ -1286,49 +1383,15 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1286
1383
|
}
|
|
1287
1384
|
}
|
|
1288
1385
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
);
|
|
1297
|
-
if (match) {
|
|
1298
|
-
const [, fromChainName, fromTokenSymbol, toChainName, toTokenSymbol] = match;
|
|
1299
|
-
const [, foundFromChain] = findItemByName(
|
|
1300
|
-
chains,
|
|
1301
|
-
fromChainName
|
|
1302
|
-
);
|
|
1303
|
-
const [, foundToChain] = findItemByName(
|
|
1304
|
-
chains,
|
|
1305
|
-
toChainName
|
|
1306
|
-
);
|
|
1307
|
-
if (foundFromChain && foundToChain && tokens) {
|
|
1308
|
-
const [, foundFromToken] = findItemBySymbol(
|
|
1309
|
-
tokens,
|
|
1310
|
-
fromTokenSymbol,
|
|
1311
|
-
foundFromChain.chain_id
|
|
1312
|
-
);
|
|
1313
|
-
const [, foundToToken] = findItemBySymbol(
|
|
1314
|
-
tokens,
|
|
1315
|
-
toTokenSymbol,
|
|
1316
|
-
foundToChain.chain_id
|
|
1317
|
-
);
|
|
1318
|
-
if (foundFromToken && foundToToken) {
|
|
1319
|
-
setFromTokenInfo(foundFromToken);
|
|
1320
|
-
setToTokenInfo(foundToToken);
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
} catch {
|
|
1386
|
+
const hasConfigFrom = !!(config?.from?.defaultChainId || config?.from?.chainTokens || config?.from?.defaultToken);
|
|
1387
|
+
const hasConfigTo = !!(config?.to?.defaultChainId || config?.to?.chainTokens || config?.to?.defaultToken);
|
|
1388
|
+
if (!hasConfigFrom && !hasConfigTo) {
|
|
1389
|
+
const cached = tokenSelectionStore.get(address || "default");
|
|
1390
|
+
if (cached?.from && cached?.to) {
|
|
1391
|
+
setFromTokenInfo(cached.from);
|
|
1392
|
+
setToTokenInfo(cached.to);
|
|
1325
1393
|
}
|
|
1326
1394
|
}
|
|
1327
|
-
const cached = tokenSelectionStore.get(address || "default");
|
|
1328
|
-
if (cached?.from && cached?.to && !matchesAnyPatternUsingArray(pathname)) {
|
|
1329
|
-
setFromTokenInfo(cached.from);
|
|
1330
|
-
setToTokenInfo(cached.to);
|
|
1331
|
-
}
|
|
1332
1395
|
hasInitialized.current = true;
|
|
1333
1396
|
return () => {
|
|
1334
1397
|
setFromAmount("");
|
|
@@ -1337,15 +1400,12 @@ var useInitSwapAndBridgeState = (config) => {
|
|
|
1337
1400
|
resetTxState();
|
|
1338
1401
|
};
|
|
1339
1402
|
}, [
|
|
1340
|
-
pathname,
|
|
1341
1403
|
address,
|
|
1342
1404
|
chains,
|
|
1343
1405
|
tokens,
|
|
1344
1406
|
config,
|
|
1345
1407
|
setFromTokenInfo,
|
|
1346
1408
|
setToTokenInfo,
|
|
1347
|
-
setIsShortLink,
|
|
1348
|
-
setShortLink,
|
|
1349
1409
|
setFromAmount,
|
|
1350
1410
|
setToAmount,
|
|
1351
1411
|
setDifferentAddress,
|
|
@@ -3381,6 +3441,12 @@ var FormButton = ({
|
|
|
3381
3441
|
}) => {
|
|
3382
3442
|
const { theme } = useWidgetTheme();
|
|
3383
3443
|
const address = useEvmAddress();
|
|
3444
|
+
const {
|
|
3445
|
+
solanaWalletAddress,
|
|
3446
|
+
isSolanaWalletConnected,
|
|
3447
|
+
isEthWalletConnected,
|
|
3448
|
+
evmWalletConnectorId
|
|
3449
|
+
} = useWalletConnectedStore();
|
|
3384
3450
|
const {
|
|
3385
3451
|
address: wagmiAddress,
|
|
3386
3452
|
connector,
|
|
@@ -3398,8 +3464,11 @@ var FormButton = ({
|
|
|
3398
3464
|
return dynamicEvmWallet?.address || void 0;
|
|
3399
3465
|
}, [userWallets]);
|
|
3400
3466
|
const effectiveEvmAddress = useMemo(
|
|
3401
|
-
() =>
|
|
3402
|
-
|
|
3467
|
+
() => {
|
|
3468
|
+
if (!isEthWalletConnected) return void 0;
|
|
3469
|
+
return address || wagmiAddress || dynamicEvmWalletAddress || void 0;
|
|
3470
|
+
},
|
|
3471
|
+
[address, wagmiAddress, dynamicEvmWalletAddress, isEthWalletConnected]
|
|
3403
3472
|
);
|
|
3404
3473
|
const { openModal, openConnectModal } = useWalletConnectModal();
|
|
3405
3474
|
const slippage = address ? slippageStore.get(address) : void 0;
|
|
@@ -3428,15 +3497,9 @@ var FormButton = ({
|
|
|
3428
3497
|
} = useUSDTHandler(fromTokenInfo.chain_id);
|
|
3429
3498
|
const { isSelectPredictionChain, slippagePolicies, chains } = useChainsStore();
|
|
3430
3499
|
const { differentAddress } = useDifferentAddressStore();
|
|
3431
|
-
const {
|
|
3432
|
-
solanaWalletAddress,
|
|
3433
|
-
isSolanaWalletConnected,
|
|
3434
|
-
isEthWalletConnected,
|
|
3435
|
-
evmWalletConnectorId
|
|
3436
|
-
} = useWalletConnectedStore();
|
|
3437
3500
|
const connectors = useConnectors();
|
|
3438
3501
|
const hasEvmUiWallet = Boolean(
|
|
3439
|
-
effectiveEvmAddress || isEthWalletConnected
|
|
3502
|
+
effectiveEvmAddress || isEthWalletConnected
|
|
3440
3503
|
);
|
|
3441
3504
|
const hasEvmExecutionWallet = Boolean(
|
|
3442
3505
|
effectiveEvmAddress && (isWagmiConnected && connector || evmWalletConnectorId && connectors.some((c) => c.id === evmWalletConnectorId) || isEthWalletConnected && connectors.length > 0)
|
|
@@ -4203,13 +4266,13 @@ function filterTokenUnType(items, excludeTypes) {
|
|
|
4203
4266
|
var mainnet3 = { id: 1 };
|
|
4204
4267
|
|
|
4205
4268
|
// src/consts/monad.ts
|
|
4206
|
-
var
|
|
4269
|
+
var monad2 = { id: 10143 };
|
|
4207
4270
|
|
|
4208
4271
|
// src/consts/stable.ts
|
|
4209
|
-
var
|
|
4272
|
+
var stable2 = { id: 1 };
|
|
4210
4273
|
|
|
4211
4274
|
// src/core/SelectTokenModal/hooks/useChainsAndTokensForSelect.ts
|
|
4212
|
-
[mainnet3.id, base.id, ink.id, bsc.id,
|
|
4275
|
+
[mainnet3.id, base.id, ink.id, bsc.id, monad2.id, soneium.id, stable2.id];
|
|
4213
4276
|
var useChainsAndTokensForSelect = ({
|
|
4214
4277
|
data,
|
|
4215
4278
|
selectedChain,
|
|
@@ -4675,20 +4738,6 @@ function countLeadingZerosAfterDecimal(numStr) {
|
|
|
4675
4738
|
if (firstNonZeroIndex === -1) return 0;
|
|
4676
4739
|
return firstNonZeroIndex;
|
|
4677
4740
|
}
|
|
4678
|
-
function findItemByName2(arr, targetName) {
|
|
4679
|
-
const foundItem = arr.find(
|
|
4680
|
-
(item) => item.name.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase()
|
|
4681
|
-
);
|
|
4682
|
-
return [foundItem !== void 0, foundItem];
|
|
4683
|
-
}
|
|
4684
|
-
function findItemBySymbol2(arr, targetName, chainId, platform_id) {
|
|
4685
|
-
const foundItem = arr.find((item) => {
|
|
4686
|
-
{
|
|
4687
|
-
return item.symbol.replace(/\s+/g, "").toLowerCase() === targetName.replace(/\s+/g, "").toLowerCase() && item.chain_id === chainId;
|
|
4688
|
-
}
|
|
4689
|
-
});
|
|
4690
|
-
return [foundItem !== void 0, foundItem];
|
|
4691
|
-
}
|
|
4692
4741
|
var TokenAmountHeading = ({
|
|
4693
4742
|
amount,
|
|
4694
4743
|
decimals,
|
|
@@ -4696,13 +4745,14 @@ var TokenAmountHeading = ({
|
|
|
4696
4745
|
suffix,
|
|
4697
4746
|
...props
|
|
4698
4747
|
}) => {
|
|
4748
|
+
const { theme } = useWidgetTheme();
|
|
4699
4749
|
const _amount = formatTokenAmount({
|
|
4700
4750
|
amount,
|
|
4701
4751
|
decimals
|
|
4702
4752
|
});
|
|
4703
4753
|
const leadingZeros = countLeadingZerosAfterDecimal(_amount);
|
|
4704
4754
|
if (leadingZeros > 5) {
|
|
4705
|
-
return /* @__PURE__ */ jsxs(Heading, { variant: "heading8", ...props, as: "div", children: [
|
|
4755
|
+
return /* @__PURE__ */ jsxs(Heading, { variant: "heading8", ...props, as: "div", color: theme.defaultTextColor, whiteSpace: "nowrap", children: [
|
|
4706
4756
|
prefix,
|
|
4707
4757
|
" ",
|
|
4708
4758
|
_amount.slice(0, 3),
|
|
@@ -4721,7 +4771,7 @@ var TokenAmountHeading = ({
|
|
|
4721
4771
|
suffix
|
|
4722
4772
|
] });
|
|
4723
4773
|
}
|
|
4724
|
-
return /* @__PURE__ */ jsxs(Heading, { variant: "heading11", ...props, as: "div", children: [
|
|
4774
|
+
return /* @__PURE__ */ jsxs(Heading, { variant: "heading11", ...props, as: "div", color: theme.defaultTextColor, whiteSpace: "nowrap", children: [
|
|
4725
4775
|
prefix,
|
|
4726
4776
|
" ",
|
|
4727
4777
|
_amount,
|
|
@@ -6269,6 +6319,7 @@ var SelectTokenModal = ({
|
|
|
6269
6319
|
allTokens: tokens
|
|
6270
6320
|
});
|
|
6271
6321
|
const { userHasSelectedFromNetwork, setUserHasSelectedFromNetwork } = useUserHasSelectedFromNetwork();
|
|
6322
|
+
const prevUserHasSelectedRef = useRef(userHasSelectedFromNetwork);
|
|
6272
6323
|
const { chains } = useChainsStore();
|
|
6273
6324
|
const [disableTestnetLimit, setDisableTestnetLimit] = useState(false);
|
|
6274
6325
|
const [tempSelectAll, setTempSelectAll] = useState(false);
|
|
@@ -6303,6 +6354,8 @@ var SelectTokenModal = ({
|
|
|
6303
6354
|
setTempSelectedPlatformId(null);
|
|
6304
6355
|
}
|
|
6305
6356
|
}
|
|
6357
|
+
const userJustSelected = userHasSelectedFromNetwork && !prevUserHasSelectedRef.current;
|
|
6358
|
+
prevUserHasSelectedRef.current = userHasSelectedFromNetwork;
|
|
6306
6359
|
if (isSelectingFromToken) {
|
|
6307
6360
|
if (isLoadingUserBalances) return;
|
|
6308
6361
|
if (isArcTestnetShortLink) {
|
|
@@ -6316,7 +6369,9 @@ var SelectTokenModal = ({
|
|
|
6316
6369
|
setSelectedChain(null);
|
|
6317
6370
|
} else {
|
|
6318
6371
|
setIsSelectAll(false);
|
|
6319
|
-
|
|
6372
|
+
if (!userJustSelected) {
|
|
6373
|
+
setSelectedChain(fromChainId);
|
|
6374
|
+
}
|
|
6320
6375
|
}
|
|
6321
6376
|
} else {
|
|
6322
6377
|
setIsSelectAll(false);
|
|
@@ -8298,127 +8353,6 @@ var FormBody = ({
|
|
|
8298
8353
|
const { tokens } = useTokensStore();
|
|
8299
8354
|
const [isFromHyperChain, setIsFromHyperChain] = useState(false);
|
|
8300
8355
|
const [isToHyperChain, setIsToHyperChain] = useState(false);
|
|
8301
|
-
const pathname = typeof window !== "undefined" ? window.location.pathname : "";
|
|
8302
|
-
const replaceLink = useCallback((url) => {
|
|
8303
|
-
if (typeof window !== "undefined") {
|
|
8304
|
-
window.history.replaceState(null, "", url);
|
|
8305
|
-
}
|
|
8306
|
-
}, []);
|
|
8307
|
-
const updateSearchParams = useCallback(
|
|
8308
|
-
(params) => {
|
|
8309
|
-
if (typeof window === "undefined") return;
|
|
8310
|
-
const searchParams = window?.location?.search;
|
|
8311
|
-
const newParams = new URLSearchParams(searchParams);
|
|
8312
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
8313
|
-
newParams.set(key, value);
|
|
8314
|
-
});
|
|
8315
|
-
const newPath = decodeURIComponent(pathname.replace(/\/+$/, ""));
|
|
8316
|
-
if (tokens && chains && matchesAnyPatternUsingArray(newPath)) {
|
|
8317
|
-
if (toRegex.test(newPath)) {
|
|
8318
|
-
const [exists, chainsInfo2] = findItemByName2(
|
|
8319
|
-
chains || [],
|
|
8320
|
-
newPath.replace("/", "")
|
|
8321
|
-
);
|
|
8322
|
-
if (!exists) return;
|
|
8323
|
-
const foundItem = tokens.find(
|
|
8324
|
-
(item) => item.chain_id === chainsInfo2?.chain_id
|
|
8325
|
-
);
|
|
8326
|
-
if (foundItem) {
|
|
8327
|
-
newParams.set("to_chain", foundItem.chain_id.toString());
|
|
8328
|
-
newParams.set("to_token", foundItem.address.toString());
|
|
8329
|
-
}
|
|
8330
|
-
} else if (toAndTokenRegex.test(newPath)) {
|
|
8331
|
-
const arr = newPath.replace("/", "").split("&");
|
|
8332
|
-
const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
|
|
8333
|
-
if (!exists) return;
|
|
8334
|
-
const [result, foundItem] = findItemBySymbol2(
|
|
8335
|
-
tokens,
|
|
8336
|
-
arr[1],
|
|
8337
|
-
chainsInfo2?.chain_id
|
|
8338
|
-
);
|
|
8339
|
-
if (!result) return;
|
|
8340
|
-
if (result && foundItem) {
|
|
8341
|
-
newParams.set("to_chain", foundItem.chain_id.toString());
|
|
8342
|
-
newParams.set("to_token", foundItem.address.toString());
|
|
8343
|
-
}
|
|
8344
|
-
} else if (fromRegex.test(newPath)) {
|
|
8345
|
-
const arr = newPath.split("&");
|
|
8346
|
-
const [exists, chainsInfo2] = findItemByName2(chains, arr[1]);
|
|
8347
|
-
if (!exists) return;
|
|
8348
|
-
const foundItem = tokens.find(
|
|
8349
|
-
(item) => item.chain_id === chainsInfo2?.chain_id
|
|
8350
|
-
);
|
|
8351
|
-
if (foundItem) {
|
|
8352
|
-
newParams.set("from_chain", foundItem.chain_id.toString());
|
|
8353
|
-
newParams.set("from_token", foundItem.address.toString());
|
|
8354
|
-
}
|
|
8355
|
-
} else if (fromAndTokenRegex.test(newPath)) {
|
|
8356
|
-
const arr = newPath.replace("/", "").split("&");
|
|
8357
|
-
const [exists, chainsInfo2] = findItemByName2(chains, arr[0]);
|
|
8358
|
-
if (!exists) return;
|
|
8359
|
-
const [result, foundItem] = findItemBySymbol2(
|
|
8360
|
-
tokens,
|
|
8361
|
-
arr[1],
|
|
8362
|
-
chainsInfo2?.chain_id
|
|
8363
|
-
);
|
|
8364
|
-
if (!result) return;
|
|
8365
|
-
if (result && foundItem) {
|
|
8366
|
-
newParams.set("from_chain", foundItem.chain_id.toString());
|
|
8367
|
-
newParams.set("from_token", foundItem.address.toString());
|
|
8368
|
-
}
|
|
8369
|
-
} else if (fromAndToRegex.test(newPath)) {
|
|
8370
|
-
const arr = newPath.split("/");
|
|
8371
|
-
const [resultFrom, fromChainsInfo] = findItemByName2(chains, arr[1]);
|
|
8372
|
-
if (!resultFrom) return;
|
|
8373
|
-
const foundFromItem = tokens.find(
|
|
8374
|
-
(item) => item.chain_id === fromChainsInfo?.chain_id
|
|
8375
|
-
);
|
|
8376
|
-
if (!foundFromItem) return;
|
|
8377
|
-
newParams.set("from_chain", foundFromItem.chain_id.toString());
|
|
8378
|
-
newParams.set("from_token", foundFromItem.address.toString());
|
|
8379
|
-
const [resultTo, toChainsInfo] = findItemByName2(chains, arr[2]);
|
|
8380
|
-
if (!resultTo) return;
|
|
8381
|
-
const foundToItem = tokens.find(
|
|
8382
|
-
(item) => item.chain_id === toChainsInfo?.chain_id
|
|
8383
|
-
);
|
|
8384
|
-
if (!foundToItem) return;
|
|
8385
|
-
newParams.set("to_chain", foundToItem.chain_id.toString());
|
|
8386
|
-
newParams.set("to_token", foundToItem.address.toString());
|
|
8387
|
-
} else if (fromAndTokenAndToAndTokenRegex.test(newPath)) {
|
|
8388
|
-
const arr = newPath.split("/");
|
|
8389
|
-
const arrFrom = arr[1].split("&");
|
|
8390
|
-
const [resultFrom, fromChainsInfo] = findItemByName2(
|
|
8391
|
-
chains,
|
|
8392
|
-
arrFrom[0]
|
|
8393
|
-
);
|
|
8394
|
-
if (!resultFrom) return;
|
|
8395
|
-
const [resultFromToken, fromTokenInfo2] = findItemBySymbol2(
|
|
8396
|
-
tokens,
|
|
8397
|
-
arrFrom[1],
|
|
8398
|
-
fromChainsInfo?.chain_id
|
|
8399
|
-
);
|
|
8400
|
-
if (!resultFromToken) return;
|
|
8401
|
-
const arrTo = arr[2].split("&");
|
|
8402
|
-
const [resultTo, toChainsInfo] = findItemByName2(chains, arrTo[0]);
|
|
8403
|
-
if (!resultTo) return;
|
|
8404
|
-
const [resultToToken, toTokenInfo2] = findItemBySymbol2(
|
|
8405
|
-
tokens,
|
|
8406
|
-
arrTo[1],
|
|
8407
|
-
toChainsInfo?.chain_id
|
|
8408
|
-
);
|
|
8409
|
-
if (!resultToToken) return;
|
|
8410
|
-
if (fromTokenInfo2 && toTokenInfo2) {
|
|
8411
|
-
newParams.set("to_chain", toTokenInfo2.chain_id.toString());
|
|
8412
|
-
newParams.set("to_token", toTokenInfo2.address.toString());
|
|
8413
|
-
newParams.set("from_chain", fromTokenInfo2.chain_id.toString());
|
|
8414
|
-
newParams.set("from_token", fromTokenInfo2.address.toString());
|
|
8415
|
-
}
|
|
8416
|
-
}
|
|
8417
|
-
}
|
|
8418
|
-
replaceLink(`${pathname.replace(pathname, "")}/?${newParams.toString()}`);
|
|
8419
|
-
},
|
|
8420
|
-
[pathname, replaceLink, chains, tokens]
|
|
8421
|
-
);
|
|
8422
8356
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
8423
8357
|
const [isDifferentAddressDialogOpen, setIsDifferentAddressDialogOpen] = useState(false);
|
|
8424
8358
|
const [isSelectingFromToken, setIsSelectingFromToken] = useState(false);
|
|
@@ -8629,15 +8563,12 @@ var FormBody = ({
|
|
|
8629
8563
|
}, [tokens]);
|
|
8630
8564
|
const handleSelectToken = useCallback(
|
|
8631
8565
|
(tokenInfo) => {
|
|
8632
|
-
const params = {};
|
|
8633
8566
|
const isTestnetChain = (chainId) => {
|
|
8634
8567
|
const chainInfo = chains?.find((chain) => chain.chain_id === chainId);
|
|
8635
8568
|
return chainInfo?.is_testnet === true;
|
|
8636
8569
|
};
|
|
8637
8570
|
if (isSelectingFromToken) {
|
|
8638
8571
|
setFromTokenInfo(tokenInfo);
|
|
8639
|
-
params.from_chain = tokenInfo.chain_id.toString();
|
|
8640
|
-
params.from_token = tokenInfo.address;
|
|
8641
8572
|
if (isTestnetChain(tokenInfo.chain_id)) {
|
|
8642
8573
|
const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === zeroAddress;
|
|
8643
8574
|
if (isNativeToken) {
|
|
@@ -8646,8 +8577,6 @@ var FormBody = ({
|
|
|
8646
8577
|
);
|
|
8647
8578
|
if (otherToken) {
|
|
8648
8579
|
setToTokenInfo(otherToken);
|
|
8649
|
-
params.to_chain = otherToken.chain_id.toString();
|
|
8650
|
-
params.to_token = otherToken.address;
|
|
8651
8580
|
}
|
|
8652
8581
|
} else {
|
|
8653
8582
|
const nativeToken = tokens?.find(
|
|
@@ -8655,16 +8584,12 @@ var FormBody = ({
|
|
|
8655
8584
|
);
|
|
8656
8585
|
if (nativeToken && (nativeToken.chain_id !== toTokenInfo?.chain_id || nativeToken.address !== toTokenInfo?.address)) {
|
|
8657
8586
|
setToTokenInfo(nativeToken);
|
|
8658
|
-
params.to_chain = nativeToken.chain_id.toString();
|
|
8659
|
-
params.to_token = nativeToken.address;
|
|
8660
8587
|
} else if (!nativeToken) {
|
|
8661
8588
|
const otherToken = tokens?.find(
|
|
8662
8589
|
(t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
|
|
8663
8590
|
);
|
|
8664
8591
|
if (otherToken) {
|
|
8665
8592
|
setToTokenInfo(otherToken);
|
|
8666
|
-
params.to_chain = otherToken.chain_id.toString();
|
|
8667
|
-
params.to_token = otherToken.address;
|
|
8668
8593
|
}
|
|
8669
8594
|
}
|
|
8670
8595
|
}
|
|
@@ -8675,15 +8600,11 @@ var FormBody = ({
|
|
|
8675
8600
|
);
|
|
8676
8601
|
if (baseEthToken) {
|
|
8677
8602
|
setToTokenInfo(baseEthToken);
|
|
8678
|
-
params.to_chain = baseEthToken.chain_id.toString();
|
|
8679
|
-
params.to_token = baseEthToken.address;
|
|
8680
8603
|
}
|
|
8681
8604
|
}
|
|
8682
8605
|
}
|
|
8683
8606
|
} else {
|
|
8684
8607
|
setToTokenInfo(tokenInfo);
|
|
8685
|
-
params.to_chain = tokenInfo.chain_id.toString();
|
|
8686
|
-
params.to_token = tokenInfo.address;
|
|
8687
8608
|
if (isTestnetChain(tokenInfo.chain_id)) {
|
|
8688
8609
|
const isNativeToken = tokenInfo.tags?.includes("native") || tokenInfo.address === zeroAddress;
|
|
8689
8610
|
if (isNativeToken) {
|
|
@@ -8692,8 +8613,6 @@ var FormBody = ({
|
|
|
8692
8613
|
);
|
|
8693
8614
|
if (otherToken) {
|
|
8694
8615
|
setFromTokenInfo(otherToken);
|
|
8695
|
-
params.from_chain = otherToken.chain_id.toString();
|
|
8696
|
-
params.from_token = otherToken.address;
|
|
8697
8616
|
}
|
|
8698
8617
|
} else {
|
|
8699
8618
|
const nativeToken = tokens?.find(
|
|
@@ -8701,16 +8620,12 @@ var FormBody = ({
|
|
|
8701
8620
|
);
|
|
8702
8621
|
if (nativeToken && (nativeToken.chain_id !== fromTokenInfo?.chain_id || nativeToken.address !== fromTokenInfo?.address)) {
|
|
8703
8622
|
setFromTokenInfo(nativeToken);
|
|
8704
|
-
params.from_chain = nativeToken.chain_id.toString();
|
|
8705
|
-
params.from_token = nativeToken.address;
|
|
8706
8623
|
} else if (!nativeToken) {
|
|
8707
8624
|
const otherToken = tokens?.find(
|
|
8708
8625
|
(t) => t.chain_id === tokenInfo.chain_id && t.address !== tokenInfo.address
|
|
8709
8626
|
);
|
|
8710
8627
|
if (otherToken) {
|
|
8711
8628
|
setFromTokenInfo(otherToken);
|
|
8712
|
-
params.from_chain = otherToken.chain_id.toString();
|
|
8713
|
-
params.from_token = otherToken.address;
|
|
8714
8629
|
}
|
|
8715
8630
|
}
|
|
8716
8631
|
}
|
|
@@ -8721,13 +8636,10 @@ var FormBody = ({
|
|
|
8721
8636
|
);
|
|
8722
8637
|
if (soneiumEthToken) {
|
|
8723
8638
|
setFromTokenInfo(soneiumEthToken);
|
|
8724
|
-
params.from_chain = soneiumEthToken.chain_id.toString();
|
|
8725
|
-
params.from_token = soneiumEthToken.address;
|
|
8726
8639
|
}
|
|
8727
8640
|
}
|
|
8728
8641
|
}
|
|
8729
8642
|
}
|
|
8730
|
-
updateSearchParams(params);
|
|
8731
8643
|
handleCloseModal();
|
|
8732
8644
|
setQuoteInfo(initialQuoteInfo);
|
|
8733
8645
|
saveTokenSelection();
|
|
@@ -8738,7 +8650,6 @@ var FormBody = ({
|
|
|
8738
8650
|
setFromTokenInfo,
|
|
8739
8651
|
setQuoteInfo,
|
|
8740
8652
|
setToTokenInfo,
|
|
8741
|
-
updateSearchParams,
|
|
8742
8653
|
tokens,
|
|
8743
8654
|
fromTokenInfo,
|
|
8744
8655
|
toTokenInfo,
|
|
@@ -8756,12 +8667,6 @@ var FormBody = ({
|
|
|
8756
8667
|
const _fromAmount = toAmount;
|
|
8757
8668
|
setDifferentAddress(void 0);
|
|
8758
8669
|
switchTokens();
|
|
8759
|
-
updateSearchParams({
|
|
8760
|
-
from_chain: _fromTokenInfo.chain_id.toString(),
|
|
8761
|
-
from_token: _fromTokenInfo.address,
|
|
8762
|
-
to_chain: _toTokenInfo.chain_id.toString(),
|
|
8763
|
-
to_token: _toTokenInfo.address
|
|
8764
|
-
});
|
|
8765
8670
|
const _fromAddress = () => {
|
|
8766
8671
|
if (_fromTokenInfo.isSolana) {
|
|
8767
8672
|
return solanaWalletAddress || "";
|
|
@@ -9116,7 +9021,9 @@ var SlippageSettings = ({ refetchQuote }) => {
|
|
|
9116
9021
|
base: "20px",
|
|
9117
9022
|
md: "22px"
|
|
9118
9023
|
},
|
|
9119
|
-
as: SettingsIcon
|
|
9024
|
+
as: SettingsIcon,
|
|
9025
|
+
position: "relative",
|
|
9026
|
+
top: "-2px"
|
|
9120
9027
|
}
|
|
9121
9028
|
),
|
|
9122
9029
|
showYellowDot && /* @__PURE__ */ jsx(
|
|
@@ -9343,10 +9250,92 @@ var FormTop = ({
|
|
|
9343
9250
|
quoteInfo,
|
|
9344
9251
|
clearLockedRequestId,
|
|
9345
9252
|
refreshInterval = 30,
|
|
9346
|
-
hideCountdown = false
|
|
9253
|
+
hideCountdown = false,
|
|
9254
|
+
onHistoryClick
|
|
9347
9255
|
}) => {
|
|
9348
9256
|
const { isLoading: isLoadingRefresh } = useRefreshLoading();
|
|
9349
9257
|
const { theme } = useWidgetTheme();
|
|
9258
|
+
const { disconnect } = useDisconnect();
|
|
9259
|
+
const connectors = useConnectors();
|
|
9260
|
+
const { connector: wagmiConnector } = useAccount();
|
|
9261
|
+
const { removeWallet } = useDynamicContext();
|
|
9262
|
+
const userWallets = useUserWallets();
|
|
9263
|
+
const {
|
|
9264
|
+
isEthWalletConnected,
|
|
9265
|
+
evmWalletConnectorId,
|
|
9266
|
+
isSolanaWalletConnected,
|
|
9267
|
+
setEvmWalletInfo,
|
|
9268
|
+
setIsEthWalletConnected,
|
|
9269
|
+
setSolanaWalletAddress,
|
|
9270
|
+
setIsSolanaWalletConnected,
|
|
9271
|
+
setIsLoggingOut: setStoreLoggingOut,
|
|
9272
|
+
setLastDisconnectTimestamp
|
|
9273
|
+
} = useWalletConnectedStore();
|
|
9274
|
+
const isAnyWalletConnected = isEthWalletConnected || isSolanaWalletConnected;
|
|
9275
|
+
const [isLogoutDialogOpen, setIsLogoutDialogOpen] = useState(false);
|
|
9276
|
+
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
9277
|
+
const handleLogout = useCallback(async () => {
|
|
9278
|
+
setIsLoggingOut(true);
|
|
9279
|
+
setStoreLoggingOut(true);
|
|
9280
|
+
const currentEvmConnectorId = evmWalletConnectorId;
|
|
9281
|
+
try {
|
|
9282
|
+
for (const wallet of userWallets) {
|
|
9283
|
+
const walletId = wallet.id || wallet.walletId;
|
|
9284
|
+
if (walletId) {
|
|
9285
|
+
try {
|
|
9286
|
+
await removeWallet(walletId);
|
|
9287
|
+
} catch (e) {
|
|
9288
|
+
console.error("Dynamic removeWallet failed:", e);
|
|
9289
|
+
}
|
|
9290
|
+
}
|
|
9291
|
+
}
|
|
9292
|
+
const evmConnector = connectors.find((c) => c.id === currentEvmConnectorId);
|
|
9293
|
+
if (evmConnector) {
|
|
9294
|
+
disconnect({ connector: evmConnector });
|
|
9295
|
+
} else if (wagmiConnector) {
|
|
9296
|
+
disconnect({ connector: wagmiConnector });
|
|
9297
|
+
}
|
|
9298
|
+
if (typeof window !== "undefined") {
|
|
9299
|
+
window.localStorage.removeItem("wagmi.cache");
|
|
9300
|
+
window.localStorage.removeItem("wagmi.wallet");
|
|
9301
|
+
window.sessionStorage.removeItem("wagmi.cache");
|
|
9302
|
+
window.sessionStorage.removeItem("wagmi.wallet");
|
|
9303
|
+
const storages = [window.localStorage, window.sessionStorage];
|
|
9304
|
+
storages.forEach((storage) => {
|
|
9305
|
+
const keysToRemove = [];
|
|
9306
|
+
for (let i = 0; i < storage.length; i++) {
|
|
9307
|
+
const key = storage.key(i);
|
|
9308
|
+
if (key && (key.startsWith("dynamic_") || key.includes("_dynamic_"))) {
|
|
9309
|
+
keysToRemove.push(key);
|
|
9310
|
+
}
|
|
9311
|
+
}
|
|
9312
|
+
keysToRemove.forEach((key) => storage.removeItem(key));
|
|
9313
|
+
});
|
|
9314
|
+
}
|
|
9315
|
+
setEvmWalletInfo(null, null);
|
|
9316
|
+
setIsEthWalletConnected(false);
|
|
9317
|
+
setSolanaWalletAddress(null);
|
|
9318
|
+
setIsSolanaWalletConnected(false);
|
|
9319
|
+
setLastDisconnectTimestamp(Date.now());
|
|
9320
|
+
} finally {
|
|
9321
|
+
setStoreLoggingOut(false);
|
|
9322
|
+
setIsLoggingOut(false);
|
|
9323
|
+
setIsLogoutDialogOpen(false);
|
|
9324
|
+
}
|
|
9325
|
+
}, [
|
|
9326
|
+
userWallets,
|
|
9327
|
+
removeWallet,
|
|
9328
|
+
connectors,
|
|
9329
|
+
evmWalletConnectorId,
|
|
9330
|
+
wagmiConnector,
|
|
9331
|
+
disconnect,
|
|
9332
|
+
setEvmWalletInfo,
|
|
9333
|
+
setIsEthWalletConnected,
|
|
9334
|
+
setSolanaWalletAddress,
|
|
9335
|
+
setIsSolanaWalletConnected,
|
|
9336
|
+
setStoreLoggingOut,
|
|
9337
|
+
setLastDisconnectTimestamp
|
|
9338
|
+
]);
|
|
9350
9339
|
const isPolling = Boolean(quoteInfo?.request_id && !isLoadingRefresh);
|
|
9351
9340
|
const [countdown, setCountdown] = useState(refreshInterval);
|
|
9352
9341
|
useEffect(() => {
|
|
@@ -9384,7 +9373,24 @@ var FormTop = ({
|
|
|
9384
9373
|
children: "Bridge & Swap"
|
|
9385
9374
|
}
|
|
9386
9375
|
),
|
|
9387
|
-
/* @__PURE__ */ jsxs(HStack, { color: theme.weakTextColor
|
|
9376
|
+
/* @__PURE__ */ jsxs(HStack, { color: theme.weakTextColor, children: [
|
|
9377
|
+
isAnyWalletConnected && /* @__PURE__ */ jsx(
|
|
9378
|
+
Box,
|
|
9379
|
+
{
|
|
9380
|
+
w: "21px",
|
|
9381
|
+
h: "21px",
|
|
9382
|
+
display: "flex",
|
|
9383
|
+
alignItems: "center",
|
|
9384
|
+
justifyContent: "center",
|
|
9385
|
+
cursor: "pointer",
|
|
9386
|
+
onClick: onHistoryClick,
|
|
9387
|
+
title: "Transaction history",
|
|
9388
|
+
children: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", children: [
|
|
9389
|
+
/* @__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" }),
|
|
9390
|
+
/* @__PURE__ */ jsx("path", { fill: theme.weakTextColor, d: "M10 14h14v2h-14v-2zM10 18h14v2h-14v-2zM10 22h14v2h-14v-2z" })
|
|
9391
|
+
] })
|
|
9392
|
+
}
|
|
9393
|
+
),
|
|
9388
9394
|
/* @__PURE__ */ jsxs(
|
|
9389
9395
|
HStack,
|
|
9390
9396
|
{
|
|
@@ -9454,8 +9460,36 @@ var FormTop = ({
|
|
|
9454
9460
|
]
|
|
9455
9461
|
}
|
|
9456
9462
|
),
|
|
9457
|
-
/* @__PURE__ */ jsx(SlippageSettings, { refetchQuote })
|
|
9458
|
-
|
|
9463
|
+
/* @__PURE__ */ jsx(SlippageSettings, { refetchQuote }),
|
|
9464
|
+
isAnyWalletConnected && /* @__PURE__ */ jsx(
|
|
9465
|
+
HStack,
|
|
9466
|
+
{
|
|
9467
|
+
w: "30px",
|
|
9468
|
+
h: "30px",
|
|
9469
|
+
display: "flex",
|
|
9470
|
+
alignItems: "center",
|
|
9471
|
+
justifyContent: "center",
|
|
9472
|
+
cursor: "pointer",
|
|
9473
|
+
title: "Disconnect all wallets",
|
|
9474
|
+
onClick: () => setIsLogoutDialogOpen(true),
|
|
9475
|
+
children: /* @__PURE__ */ jsx(IoMdLogOut, { style: { width: "22px", height: "22px" }, color: theme.weakTextColor })
|
|
9476
|
+
}
|
|
9477
|
+
)
|
|
9478
|
+
] }),
|
|
9479
|
+
/* @__PURE__ */ jsx(Dialog.Root, { open: isLogoutDialogOpen, onOpenChange: (e) => setIsLogoutDialogOpen(e.open), children: /* @__PURE__ */ jsxs(Portal, { children: [
|
|
9480
|
+
/* @__PURE__ */ jsx(Dialog.Backdrop, {}),
|
|
9481
|
+
/* @__PURE__ */ jsx(Dialog.Positioner, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs(Dialog.Content, { bgColor: theme.defaultBgColor, color: theme.defaultTextColor, width: ["90vw", "400px"], children: [
|
|
9482
|
+
/* @__PURE__ */ jsxs(Dialog.Header, { justifyContent: "center", children: [
|
|
9483
|
+
/* @__PURE__ */ jsx(Dialog.Title, { padding: "15px 0", children: "Disconnect Wallet" }),
|
|
9484
|
+
/* @__PURE__ */ jsx(Dialog.CloseTrigger, {})
|
|
9485
|
+
] }),
|
|
9486
|
+
/* @__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." }) }),
|
|
9487
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { padding: ["10px 20px 20px"], justifyContent: "center", children: [
|
|
9488
|
+
/* @__PURE__ */ jsx(Dialog.ActionTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "outline", disabled: isLoggingOut, w: "100px", bgColor: theme.normalButtonBg, color: theme.normalButtonText, children: "Cancel" }) }),
|
|
9489
|
+
/* @__PURE__ */ jsx(Button, { bgColor: theme.highlightButtonBg, color: theme.highlightButtonText, onClick: handleLogout, loading: isLoggingOut, w: "100px", children: "Disconnect" })
|
|
9490
|
+
] })
|
|
9491
|
+
] }) })
|
|
9492
|
+
] }) })
|
|
9459
9493
|
] });
|
|
9460
9494
|
};
|
|
9461
9495
|
var Timer = ({ stop, onTick }) => {
|
|
@@ -10416,6 +10450,381 @@ var TxState = ({
|
|
|
10416
10450
|
}
|
|
10417
10451
|
) });
|
|
10418
10452
|
};
|
|
10453
|
+
async function getOrderHistory(address, offset = 0, limit = 4) {
|
|
10454
|
+
const url = `${BASE_API_URL}/v1/orders`;
|
|
10455
|
+
const res = await axios6.get(url, {
|
|
10456
|
+
params: {
|
|
10457
|
+
address: Array.isArray(address) ? address : [address],
|
|
10458
|
+
offset,
|
|
10459
|
+
limit
|
|
10460
|
+
},
|
|
10461
|
+
paramsSerializer: {
|
|
10462
|
+
indexes: null
|
|
10463
|
+
}
|
|
10464
|
+
});
|
|
10465
|
+
return res.data;
|
|
10466
|
+
}
|
|
10467
|
+
var useOrderHistory = (address, address2, offset, limit) => {
|
|
10468
|
+
const addresses = address && address2 ? [address, address2] : address;
|
|
10469
|
+
return useQuery({
|
|
10470
|
+
queryKey: ["orderHistory", addresses, offset],
|
|
10471
|
+
queryFn: () => addresses ? getOrderHistory(addresses, offset, limit) : Promise.reject("No address provided"),
|
|
10472
|
+
enabled: !!addresses,
|
|
10473
|
+
placeholderData: keepPreviousData,
|
|
10474
|
+
refetchOnWindowFocus: false
|
|
10475
|
+
});
|
|
10476
|
+
};
|
|
10477
|
+
function SuccessIcon() {
|
|
10478
|
+
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" }) }) });
|
|
10479
|
+
}
|
|
10480
|
+
function ErrorIcon() {
|
|
10481
|
+
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" }) }) });
|
|
10482
|
+
}
|
|
10483
|
+
function PendingIcon() {
|
|
10484
|
+
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" }) }) });
|
|
10485
|
+
}
|
|
10486
|
+
function getStatusIcon(status) {
|
|
10487
|
+
switch (status) {
|
|
10488
|
+
case "Filled":
|
|
10489
|
+
return /* @__PURE__ */ jsx(SuccessIcon, {});
|
|
10490
|
+
case "Refund":
|
|
10491
|
+
case "Failed":
|
|
10492
|
+
return /* @__PURE__ */ jsx(ErrorIcon, {});
|
|
10493
|
+
case "Open":
|
|
10494
|
+
return /* @__PURE__ */ jsx(PendingIcon, {});
|
|
10495
|
+
default:
|
|
10496
|
+
return /* @__PURE__ */ jsx(SuccessIcon, {});
|
|
10497
|
+
}
|
|
10498
|
+
}
|
|
10499
|
+
function OrderHistoryItem({ order }) {
|
|
10500
|
+
const { theme } = useWidgetTheme();
|
|
10501
|
+
const fromTokenInfo = order.from_token_info;
|
|
10502
|
+
const toTokenInfo = order.to_token_info;
|
|
10503
|
+
const isSameChainSwap = order.from_chain === order.to_chain;
|
|
10504
|
+
const renderTxLink = (txHash, chainId, label) => {
|
|
10505
|
+
const link = getTxLink(txHash, chainId);
|
|
10506
|
+
if (!link) {
|
|
10507
|
+
return /* @__PURE__ */ jsx(Text2, { variant: "content8", color: theme.defaultTextColor, children: sliceAddress(txHash, 6) });
|
|
10508
|
+
}
|
|
10509
|
+
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) }) }) });
|
|
10510
|
+
};
|
|
10511
|
+
return /* @__PURE__ */ jsxs(
|
|
10512
|
+
Box,
|
|
10513
|
+
{
|
|
10514
|
+
w: "100%",
|
|
10515
|
+
borderRadius: "12px",
|
|
10516
|
+
p: "10px 15px",
|
|
10517
|
+
bg: theme.assistBgColor,
|
|
10518
|
+
_hover: { bg: theme.highlightBgColor },
|
|
10519
|
+
transition: "background 0.15s",
|
|
10520
|
+
children: [
|
|
10521
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "center", mb: 2, children: [
|
|
10522
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 1.5, children: [
|
|
10523
|
+
getStatusIcon(isSameChainSwap ? "Filled" : order.status),
|
|
10524
|
+
/* @__PURE__ */ jsx(
|
|
10525
|
+
Text2,
|
|
10526
|
+
{
|
|
10527
|
+
variant: "content7",
|
|
10528
|
+
color: theme.defaultTextColor || "#15003E",
|
|
10529
|
+
fontWeight: 500,
|
|
10530
|
+
children: isSameChainSwap ? "Filled" : order.status
|
|
10531
|
+
}
|
|
10532
|
+
)
|
|
10533
|
+
] }),
|
|
10534
|
+
/* @__PURE__ */ jsx(Text2, { variant: "content8", color: theme.weakTextColor || "#81728C", children: dateFormatter(order.open_timestamp) })
|
|
10535
|
+
] }),
|
|
10536
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "space-between", w: "100%", children: [
|
|
10537
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 2, mb: 1.5, children: [
|
|
10538
|
+
/* @__PURE__ */ jsx(Box, { w: "32px", h: "32px", flexShrink: 0, marginRight: "10px", children: /* @__PURE__ */ jsx(
|
|
10539
|
+
TokenIconWithNetworkLogo,
|
|
10540
|
+
{
|
|
10541
|
+
w: "100%",
|
|
10542
|
+
h: "100%",
|
|
10543
|
+
tokenInfo: fromTokenInfo
|
|
10544
|
+
}
|
|
10545
|
+
) }),
|
|
10546
|
+
/* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0.5, flex: 1, w: "80px", children: [
|
|
10547
|
+
/* @__PURE__ */ jsx(
|
|
10548
|
+
TokenAmountHeading,
|
|
10549
|
+
{
|
|
10550
|
+
amount: new Fraction(order.from_amount),
|
|
10551
|
+
decimals: fromTokenInfo?.decimals,
|
|
10552
|
+
suffix: fromTokenInfo?.symbol,
|
|
10553
|
+
variant: "heading12"
|
|
10554
|
+
}
|
|
10555
|
+
),
|
|
10556
|
+
/* @__PURE__ */ jsx(HStack, { gap: 1, children: renderTxLink(order.open_tx_hash, order.from_chain) })
|
|
10557
|
+
] })
|
|
10558
|
+
] }),
|
|
10559
|
+
/* @__PURE__ */ jsx(HStack, { justify: "center", my: 0.5, flex: 1, children: /* @__PURE__ */ jsx(HiMiniArrowRight, { color: theme.weakTextColor, width: "30px", height: "30px" }) }),
|
|
10560
|
+
/* @__PURE__ */ jsxs(HStack, { gap: 2, mt: 0, children: [
|
|
10561
|
+
/* @__PURE__ */ jsxs(VStack, { align: "start", gap: 0.5, flex: 1, w: "80px", children: [
|
|
10562
|
+
/* @__PURE__ */ jsx(
|
|
10563
|
+
TokenAmountHeading,
|
|
10564
|
+
{
|
|
10565
|
+
amount: new Fraction(order.to_amount || order.amount_out || "0"),
|
|
10566
|
+
decimals: toTokenInfo?.decimals,
|
|
10567
|
+
suffix: toTokenInfo?.symbol,
|
|
10568
|
+
variant: "heading12",
|
|
10569
|
+
justifyContent: "flex-end",
|
|
10570
|
+
width: "100%",
|
|
10571
|
+
display: "flex"
|
|
10572
|
+
}
|
|
10573
|
+
),
|
|
10574
|
+
/* @__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..." }) })
|
|
10575
|
+
] }),
|
|
10576
|
+
/* @__PURE__ */ jsx(Box, { w: "32px", h: "32px", flexShrink: 0, marginRight: "10px", marginLeft: "3px", children: /* @__PURE__ */ jsx(
|
|
10577
|
+
TokenIconWithNetworkLogo,
|
|
10578
|
+
{
|
|
10579
|
+
w: "100%",
|
|
10580
|
+
h: "100%",
|
|
10581
|
+
tokenInfo: toTokenInfo
|
|
10582
|
+
}
|
|
10583
|
+
) })
|
|
10584
|
+
] })
|
|
10585
|
+
] })
|
|
10586
|
+
]
|
|
10587
|
+
}
|
|
10588
|
+
);
|
|
10589
|
+
}
|
|
10590
|
+
var PaginationButton = ({
|
|
10591
|
+
currentPage,
|
|
10592
|
+
page,
|
|
10593
|
+
onClick
|
|
10594
|
+
}) => {
|
|
10595
|
+
const { theme } = useWidgetTheme();
|
|
10596
|
+
return /* @__PURE__ */ jsx(
|
|
10597
|
+
Box,
|
|
10598
|
+
{
|
|
10599
|
+
bg: currentPage === page ? theme.highlightButtonBg : "transparent",
|
|
10600
|
+
color: currentPage === page ? theme.highlightButtonText : theme.weakTextColor,
|
|
10601
|
+
w: "24px",
|
|
10602
|
+
h: "24px",
|
|
10603
|
+
borderRadius: "full",
|
|
10604
|
+
display: "flex",
|
|
10605
|
+
alignItems: "center",
|
|
10606
|
+
justifyContent: "center",
|
|
10607
|
+
cursor: "pointer",
|
|
10608
|
+
onClick,
|
|
10609
|
+
fontSize: "12px",
|
|
10610
|
+
fontWeight: 500,
|
|
10611
|
+
transition: "all 0.2s",
|
|
10612
|
+
children: page
|
|
10613
|
+
}
|
|
10614
|
+
);
|
|
10615
|
+
};
|
|
10616
|
+
function OrderHistoryPagination({
|
|
10617
|
+
currentPage,
|
|
10618
|
+
totalPages,
|
|
10619
|
+
setCurrentPage
|
|
10620
|
+
}) {
|
|
10621
|
+
const { theme } = useWidgetTheme();
|
|
10622
|
+
const handlePrevious = () => {
|
|
10623
|
+
if (currentPage > 1) setCurrentPage(currentPage - 1);
|
|
10624
|
+
};
|
|
10625
|
+
const handleNext = () => {
|
|
10626
|
+
if (currentPage < totalPages) setCurrentPage(currentPage + 1);
|
|
10627
|
+
};
|
|
10628
|
+
if (totalPages <= 1) return null;
|
|
10629
|
+
return /* @__PURE__ */ jsxs(
|
|
10630
|
+
HStack,
|
|
10631
|
+
{
|
|
10632
|
+
justify: "space-between",
|
|
10633
|
+
align: "center",
|
|
10634
|
+
pt: 2,
|
|
10635
|
+
pb: 1,
|
|
10636
|
+
gap: 2,
|
|
10637
|
+
w: "100%",
|
|
10638
|
+
children: [
|
|
10639
|
+
/* @__PURE__ */ jsx(
|
|
10640
|
+
Button,
|
|
10641
|
+
{
|
|
10642
|
+
variant: "plain",
|
|
10643
|
+
onClick: handlePrevious,
|
|
10644
|
+
disabled: currentPage === 1,
|
|
10645
|
+
h: "28px",
|
|
10646
|
+
minW: "28px",
|
|
10647
|
+
p: 0,
|
|
10648
|
+
children: /* @__PURE__ */ jsxs(HStack, { gap: 0, color: currentPage === 1 ? theme.disabledButtonText || "#B5B5B5" : theme.defaultTextColor || "#15003E", children: [
|
|
10649
|
+
/* @__PURE__ */ jsx(BackIcon, { size: 20 }),
|
|
10650
|
+
/* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "11px", children: "Prev" })
|
|
10651
|
+
] })
|
|
10652
|
+
}
|
|
10653
|
+
),
|
|
10654
|
+
/* @__PURE__ */ jsx(HStack, { gap: 1, color: theme.weakTextColor || "#81728C", children: totalPages <= 7 ? Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ jsx(
|
|
10655
|
+
PaginationButton,
|
|
10656
|
+
{
|
|
10657
|
+
currentPage,
|
|
10658
|
+
page,
|
|
10659
|
+
onClick: () => setCurrentPage(page)
|
|
10660
|
+
},
|
|
10661
|
+
page
|
|
10662
|
+
)) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10663
|
+
/* @__PURE__ */ jsx(
|
|
10664
|
+
PaginationButton,
|
|
10665
|
+
{
|
|
10666
|
+
currentPage,
|
|
10667
|
+
page: 1,
|
|
10668
|
+
onClick: () => setCurrentPage(1)
|
|
10669
|
+
}
|
|
10670
|
+
),
|
|
10671
|
+
currentPage > 4 && /* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "12px", children: "..." }),
|
|
10672
|
+
Array.from({ length: 3 }, (_, i) => {
|
|
10673
|
+
const page = currentPage - 1 + i;
|
|
10674
|
+
if (page > 1 && page < totalPages) {
|
|
10675
|
+
return /* @__PURE__ */ jsx(
|
|
10676
|
+
PaginationButton,
|
|
10677
|
+
{
|
|
10678
|
+
currentPage,
|
|
10679
|
+
page,
|
|
10680
|
+
onClick: () => setCurrentPage(page)
|
|
10681
|
+
},
|
|
10682
|
+
page
|
|
10683
|
+
);
|
|
10684
|
+
}
|
|
10685
|
+
return null;
|
|
10686
|
+
}),
|
|
10687
|
+
currentPage < totalPages - 3 && /* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "12px", children: "..." }),
|
|
10688
|
+
totalPages > 1 && /* @__PURE__ */ jsx(
|
|
10689
|
+
PaginationButton,
|
|
10690
|
+
{
|
|
10691
|
+
currentPage,
|
|
10692
|
+
page: totalPages,
|
|
10693
|
+
onClick: () => setCurrentPage(totalPages)
|
|
10694
|
+
}
|
|
10695
|
+
)
|
|
10696
|
+
] }) }),
|
|
10697
|
+
/* @__PURE__ */ jsx(
|
|
10698
|
+
Button,
|
|
10699
|
+
{
|
|
10700
|
+
variant: "plain",
|
|
10701
|
+
onClick: handleNext,
|
|
10702
|
+
disabled: currentPage === totalPages,
|
|
10703
|
+
h: "28px",
|
|
10704
|
+
minW: "28px",
|
|
10705
|
+
p: 0,
|
|
10706
|
+
children: /* @__PURE__ */ jsxs(
|
|
10707
|
+
HStack,
|
|
10708
|
+
{
|
|
10709
|
+
gap: 0,
|
|
10710
|
+
color: currentPage === totalPages ? theme.disabledButtonText || "#B5B5B5" : theme.defaultTextColor || "#15003E",
|
|
10711
|
+
children: [
|
|
10712
|
+
/* @__PURE__ */ jsx(Text2, { variant: "content7", fontSize: "11px", children: "Next" }),
|
|
10713
|
+
/* @__PURE__ */ jsx(Box, { transform: "rotate(180deg)", children: /* @__PURE__ */ jsx(BackIcon, { size: 20 }) })
|
|
10714
|
+
]
|
|
10715
|
+
}
|
|
10716
|
+
)
|
|
10717
|
+
}
|
|
10718
|
+
)
|
|
10719
|
+
]
|
|
10720
|
+
}
|
|
10721
|
+
);
|
|
10722
|
+
}
|
|
10723
|
+
var PAGE_SIZE = 4;
|
|
10724
|
+
function OrderHistory({ address, solanaAddress, onBack }) {
|
|
10725
|
+
const { theme } = useWidgetTheme();
|
|
10726
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
10727
|
+
const [offset, setOffset] = useState(0);
|
|
10728
|
+
const { data, isLoading, error, isFetching } = useOrderHistory(
|
|
10729
|
+
address,
|
|
10730
|
+
solanaAddress,
|
|
10731
|
+
offset,
|
|
10732
|
+
PAGE_SIZE
|
|
10733
|
+
);
|
|
10734
|
+
const totalItems = data?.total || 0;
|
|
10735
|
+
const totalPages = Math.ceil(totalItems / PAGE_SIZE);
|
|
10736
|
+
const currentOrders = data?.orders || [];
|
|
10737
|
+
const handlePageChange = (page) => {
|
|
10738
|
+
const newOffset = (page - 1) * PAGE_SIZE;
|
|
10739
|
+
setOffset(newOffset);
|
|
10740
|
+
setCurrentPage(page);
|
|
10741
|
+
};
|
|
10742
|
+
const renderContent = () => {
|
|
10743
|
+
if (isLoading) {
|
|
10744
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: 4, py: 10, align: "center", w: "100%", children: [
|
|
10745
|
+
/* @__PURE__ */ jsx(Spinner, { size: "md", color: theme.highlightTextColor }),
|
|
10746
|
+
/* @__PURE__ */ jsx(Text2, { variant: "content7", color: theme.weakTextColor || "#81728C", children: "Loading transactions..." })
|
|
10747
|
+
] });
|
|
10748
|
+
}
|
|
10749
|
+
if (error) {
|
|
10750
|
+
return /* @__PURE__ */ jsx(
|
|
10751
|
+
Box,
|
|
10752
|
+
{
|
|
10753
|
+
border: "1px solid #FF4267",
|
|
10754
|
+
borderRadius: "8px",
|
|
10755
|
+
p: 3,
|
|
10756
|
+
my: 4,
|
|
10757
|
+
bg: "#FFF5F5",
|
|
10758
|
+
children: /* @__PURE__ */ jsx(Text2, { variant: "content7", color: "#FF4267", textAlign: "center", children: "Failed to load transaction history. Please try again." })
|
|
10759
|
+
}
|
|
10760
|
+
);
|
|
10761
|
+
}
|
|
10762
|
+
if (currentOrders.length === 0) {
|
|
10763
|
+
const emptyColor = theme.defaultBorderColor || "#E0D8E8";
|
|
10764
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: 4, py: 10, align: "center", w: "100%", children: [
|
|
10765
|
+
/* @__PURE__ */ jsxs("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", children: [
|
|
10766
|
+
/* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "40", height: "32", rx: "4", stroke: emptyColor, strokeWidth: "2", fill: "none" }),
|
|
10767
|
+
/* @__PURE__ */ jsx("path", { d: "M16 20H32", stroke: emptyColor, strokeWidth: "2", strokeLinecap: "round" }),
|
|
10768
|
+
/* @__PURE__ */ jsx("path", { d: "M16 28H28", stroke: emptyColor, strokeWidth: "2", strokeLinecap: "round" })
|
|
10769
|
+
] }),
|
|
10770
|
+
/* @__PURE__ */ jsx(Text2, { variant: "content7", color: theme.weakTextColor || "#81728C", textAlign: "center", children: "No transaction history yet" })
|
|
10771
|
+
] });
|
|
10772
|
+
}
|
|
10773
|
+
return /* @__PURE__ */ jsxs(Box, { position: "relative", w: "100%", children: [
|
|
10774
|
+
isFetching && /* @__PURE__ */ jsx(
|
|
10775
|
+
Box,
|
|
10776
|
+
{
|
|
10777
|
+
position: "absolute",
|
|
10778
|
+
zIndex: 10,
|
|
10779
|
+
top: 0,
|
|
10780
|
+
left: 0,
|
|
10781
|
+
right: 0,
|
|
10782
|
+
bottom: 0,
|
|
10783
|
+
display: "flex",
|
|
10784
|
+
alignItems: "center",
|
|
10785
|
+
justifyContent: "center",
|
|
10786
|
+
children: /* @__PURE__ */ jsx(Spinner, { size: "sm", color: theme.highlightTextColor })
|
|
10787
|
+
}
|
|
10788
|
+
),
|
|
10789
|
+
/* @__PURE__ */ jsx(VStack, { gap: 2.5, w: "100%", children: currentOrders.map((order) => /* @__PURE__ */ jsx(OrderHistoryItem, { order }, order.order_id)) }),
|
|
10790
|
+
/* @__PURE__ */ jsx(
|
|
10791
|
+
OrderHistoryPagination,
|
|
10792
|
+
{
|
|
10793
|
+
currentPage,
|
|
10794
|
+
totalPages,
|
|
10795
|
+
setCurrentPage: handlePageChange
|
|
10796
|
+
}
|
|
10797
|
+
)
|
|
10798
|
+
] });
|
|
10799
|
+
};
|
|
10800
|
+
return /* @__PURE__ */ jsxs(VStack, { w: "100%", gap: 4, align: "start", children: [
|
|
10801
|
+
/* @__PURE__ */ jsxs(HStack, { w: "100%", justify: "space-between", align: "center", children: [
|
|
10802
|
+
/* @__PURE__ */ jsx(
|
|
10803
|
+
Button,
|
|
10804
|
+
{
|
|
10805
|
+
variant: "plain",
|
|
10806
|
+
onClick: onBack,
|
|
10807
|
+
h: "24px",
|
|
10808
|
+
minW: "24px",
|
|
10809
|
+
p: 0,
|
|
10810
|
+
children: /* @__PURE__ */ jsx(RiArrowGoBackFill, { color: theme.defaultTextColor, size: 20 })
|
|
10811
|
+
}
|
|
10812
|
+
),
|
|
10813
|
+
/* @__PURE__ */ jsx(
|
|
10814
|
+
Text2,
|
|
10815
|
+
{
|
|
10816
|
+
color: theme.defaultTextColor,
|
|
10817
|
+
textAlign: "center",
|
|
10818
|
+
fontWeight: 600,
|
|
10819
|
+
fontSize: "16px",
|
|
10820
|
+
children: "Transaction history"
|
|
10821
|
+
}
|
|
10822
|
+
),
|
|
10823
|
+
/* @__PURE__ */ jsx(Box, { w: "24px" })
|
|
10824
|
+
] }),
|
|
10825
|
+
renderContent()
|
|
10826
|
+
] });
|
|
10827
|
+
}
|
|
10419
10828
|
var initialQuoteInfo = {
|
|
10420
10829
|
isFetching: false,
|
|
10421
10830
|
error: null,
|
|
@@ -10464,6 +10873,7 @@ var MainForm = ({ config }) => {
|
|
|
10464
10873
|
const refreshIntervalRef = useRef(30);
|
|
10465
10874
|
const timerRef = useRef(null);
|
|
10466
10875
|
const isQuoteStoppedRef = useRef(false);
|
|
10876
|
+
const [showHistory, setShowHistory] = useState(false);
|
|
10467
10877
|
const { differentAddress } = useDifferentAddressStore();
|
|
10468
10878
|
const { chains, slippagePolicies } = useChainsStore();
|
|
10469
10879
|
const prevAddressRef = useRef(address);
|
|
@@ -10868,6 +11278,16 @@ var MainForm = ({ config }) => {
|
|
|
10868
11278
|
}
|
|
10869
11279
|
) });
|
|
10870
11280
|
}
|
|
11281
|
+
if (showHistory) {
|
|
11282
|
+
return /* @__PURE__ */ jsx(
|
|
11283
|
+
OrderHistory,
|
|
11284
|
+
{
|
|
11285
|
+
address,
|
|
11286
|
+
solanaAddress: solanaWalletAddress || void 0,
|
|
11287
|
+
onBack: () => setShowHistory(false)
|
|
11288
|
+
}
|
|
11289
|
+
);
|
|
11290
|
+
}
|
|
10871
11291
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10872
11292
|
/* @__PURE__ */ jsx(
|
|
10873
11293
|
FormTop,
|
|
@@ -10876,7 +11296,8 @@ var MainForm = ({ config }) => {
|
|
|
10876
11296
|
quoteInfo,
|
|
10877
11297
|
clearLockedRequestId,
|
|
10878
11298
|
refreshInterval,
|
|
10879
|
-
hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains)
|
|
11299
|
+
hideCountdown: isETHtoETHBridge(fromTokenInfo, toTokenInfo, chains),
|
|
11300
|
+
onHistoryClick: () => setShowHistory(true)
|
|
10880
11301
|
}
|
|
10881
11302
|
),
|
|
10882
11303
|
/* @__PURE__ */ jsx(
|
|
@@ -10947,7 +11368,23 @@ var MainForm = ({ config }) => {
|
|
|
10947
11368
|
src: "https://wheelx.fi/images/success-sprites.png",
|
|
10948
11369
|
alt: "success"
|
|
10949
11370
|
}
|
|
10950
|
-
)
|
|
11371
|
+
),
|
|
11372
|
+
!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: [
|
|
11373
|
+
/* @__PURE__ */ jsx(Box, { children: "Powered by" }),
|
|
11374
|
+
/* @__PURE__ */ jsx(
|
|
11375
|
+
Box,
|
|
11376
|
+
{
|
|
11377
|
+
w: "14px",
|
|
11378
|
+
h: "14px",
|
|
11379
|
+
backgroundColor: "currentColor",
|
|
11380
|
+
maskSize: "contain",
|
|
11381
|
+
maskRepeat: "no-repeat",
|
|
11382
|
+
maskPosition: "center center",
|
|
11383
|
+
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)"
|
|
11384
|
+
}
|
|
11385
|
+
),
|
|
11386
|
+
/* @__PURE__ */ jsx(Box, { children: "WheelX" })
|
|
11387
|
+
] }) }) })
|
|
10951
11388
|
]
|
|
10952
11389
|
}
|
|
10953
11390
|
),
|
|
@@ -10961,39 +11398,7 @@ var MainForm = ({ config }) => {
|
|
|
10961
11398
|
md: "480px"
|
|
10962
11399
|
}
|
|
10963
11400
|
}
|
|
10964
|
-
)
|
|
10965
|
-
/* @__PURE__ */ jsx(Box, { marginTop: "30px", fontSize: "14px", children: /* @__PURE__ */ jsx(
|
|
10966
|
-
"a",
|
|
10967
|
-
{
|
|
10968
|
-
href: "https://github.com/wheelx-fi/wheelx-contracts/blob/main/audits/ABDK_WheelX_WheelXContracts_v_1_0.pdf",
|
|
10969
|
-
target: "_blank",
|
|
10970
|
-
children: /* @__PURE__ */ jsxs(
|
|
10971
|
-
Text2,
|
|
10972
|
-
{
|
|
10973
|
-
color: "#5D6270",
|
|
10974
|
-
display: "flex",
|
|
10975
|
-
alignItems: "center",
|
|
10976
|
-
justifyContent: "center",
|
|
10977
|
-
children: [
|
|
10978
|
-
"Audited By",
|
|
10979
|
-
" ",
|
|
10980
|
-
/* @__PURE__ */ jsx(
|
|
10981
|
-
Image,
|
|
10982
|
-
{
|
|
10983
|
-
display: "block",
|
|
10984
|
-
width: "70px",
|
|
10985
|
-
height: "28px",
|
|
10986
|
-
marginLeft: "2px",
|
|
10987
|
-
objectFit: "contain",
|
|
10988
|
-
src: "https://wheelx.fi/images/adbk.png",
|
|
10989
|
-
alt: ""
|
|
10990
|
-
}
|
|
10991
|
-
)
|
|
10992
|
-
]
|
|
10993
|
-
}
|
|
10994
|
-
)
|
|
10995
|
-
}
|
|
10996
|
-
) })
|
|
11401
|
+
)
|
|
10997
11402
|
] })
|
|
10998
11403
|
}
|
|
10999
11404
|
),
|