From a0e61fa23366747115dc1049a1276cbcd61b4d1d Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Tue, 6 Aug 2024 18:38:38 +0700 Subject: [PATCH 01/21] feat: ton connect --- package.json | 1 + public/manifest.json | 5 + .../WalletByNetwork/WalletByNetwork.tsx | 32 ++++- .../WalletItem/WalletItem.module.scss | 111 +++++++++--------- .../ModalDisconnect/ModalDisconnect.tsx | 10 +- .../WalletManagement/MyWallet/MyWallet.tsx | 19 ++- .../WalletManagement/WalletManagement.tsx | 3 + .../WalletManagement/walletConfig.ts | 35 +++++- src/config/chainInfos.ts | 61 +++++++++- src/context/ton-provider.tsx | 28 +++++ src/helper/index.tsx | 2 + src/hooks/useTonConnectAddress.ts | 74 ++++++++++++ src/layouts/App.tsx | 19 +-- src/reducer/config.ts | 2 + src/reducer/wallet.ts | 4 +- src/styles/_reboot.scss | 5 + yarn.lock | 86 +++++++++++++- 17 files changed, 417 insertions(+), 80 deletions(-) create mode 100644 public/manifest.json create mode 100644 src/context/ton-provider.tsx create mode 100644 src/hooks/useTonConnectAddress.ts diff --git a/package.json b/package.json index eba66bed7..8e0e5c266 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@tanstack/react-query": "^4.32.6", "@tharsis/proto": "^0.1.17", "@tippyjs/react": "^4.2.0", + "@tonconnect/ui-react": "^2.0.6", "@walletconnect/browser-utils": "^1.8.0", "@walletconnect/ethereum-provider": "^1.7.8", "axios": "^0.26.1", diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 000000000..2005f7544 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,5 @@ +{ + "url": "https://oraidex.io", + "name": "OraiDex", + "iconUrl": "https://oraidex.io/favicon.svg" +} diff --git a/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx b/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx index 322d6f23c..4dc379a65 100644 --- a/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx +++ b/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx @@ -8,13 +8,15 @@ import useTheme from 'hooks/useTheme'; import useWalletReducer from 'hooks/useWalletReducer'; import Keplr from 'libs/keplr'; import { initClient } from 'libs/utils'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { WalletItem } from '../WalletItem'; import styles from './WalletByNetwork.module.scss'; import { useInactiveConnect } from 'hooks/useMetamask'; import Metamask from 'libs/metamask'; import { ReactComponent as DefaultIcon } from 'assets/icons/tokens.svg'; import { ChainEnableByNetwork, triggerUnlockOwalletInEvmNetwork } from 'components/WalletManagement/wallet-helper'; +import { useTonConnectModal, useTonConnectUI } from '@tonconnect/ui-react'; +import useTonConnectAddress from 'hooks/useTonConnectAddress'; export type ConnectStatus = 'init' | 'confirming-switch' | 'confirming-disconnect' | 'loading' | 'failed' | 'success'; export const WalletByNetwork = ({ walletProvider }: { walletProvider: WalletProvider }) => { @@ -25,11 +27,14 @@ export const WalletByNetwork = ({ walletProvider }: { walletProvider: WalletProv const [, setOraiAddress] = useConfigReducer('address'); const [, setTronAddress] = useConfigReducer('tronAddress'); const [, setBtcAddress] = useConfigReducer('btcAddress'); + const [, setTonAddress] = useConfigReducer('tonAddress'); const [, setMetamaskAddress] = useConfigReducer('metamaskAddress'); const [, setCosmosAddress] = useConfigReducer('cosmosAddress'); const [walletByNetworks, setWalletByNetworks] = useWalletReducer('walletsByNetwork'); const connect = useInactiveConnect(); + const { handleConnectTon, handleDisconnectTon } = useTonConnectAddress(); + const handleConfirmSwitch = async () => { setConnectStatus('loading'); await handleConnectWalletByNetwork(currentWalletConnecting); @@ -86,6 +91,14 @@ export const WalletByNetwork = ({ walletProvider }: { walletProvider: WalletProv setBtcAddress(btcAddress); }; + const handleConnectWalletInTONNetwork = async (walletType: WalletType) => { + if (walletType === 'owallet') { + // TODO: need check when use multi wallet support bitcoin + } + + handleConnectTon(); + }; + const handleConnectWalletByNetwork = async (wallet: WalletNetwork) => { try { setConnectStatus('loading'); @@ -102,14 +115,20 @@ export const WalletByNetwork = ({ walletProvider }: { walletProvider: WalletProv case 'bitcoin': await handleConnectWalletInBtcNetwork(wallet.nameRegistry); break; + case 'ton': + await handleConnectWalletInTONNetwork(wallet.nameRegistry); + break; default: setConnectStatus('init'); break; } - setWalletByNetworks({ - ...walletByNetworks, - [networkType]: wallet.nameRegistry - }); + + if (networkType !== 'ton') { + setWalletByNetworks({ + ...walletByNetworks, + [networkType]: wallet.nameRegistry + }); + } setCurrentWalletConnecting(null); setConnectStatus('init'); } catch (error) { @@ -158,6 +177,9 @@ export const WalletByNetwork = ({ walletProvider }: { walletProvider: WalletProv case 'bitcoin': setBtcAddress(undefined); break; + case 'ton': + handleDisconnectTon(); + break; default: break; } diff --git a/src/components/WalletManagement/ModalChooseWallet/WalletItem/WalletItem.module.scss b/src/components/WalletManagement/ModalChooseWallet/WalletItem/WalletItem.module.scss index 20bfc2787..c4aa48472 100644 --- a/src/components/WalletManagement/ModalChooseWallet/WalletItem/WalletItem.module.scss +++ b/src/components/WalletManagement/ModalChooseWallet/WalletItem/WalletItem.module.scss @@ -1,74 +1,77 @@ .walletItem { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 8px; + padding: 10px; + border-radius: 8px; + cursor: pointer; + + .loadingIcon { + flex: 1; display: flex; - flex-direction: column; - justify-content: center; align-items: center; - gap: 8px; - padding: 10px; - border-radius: 8px; - cursor: pointer; - - .loadingIcon { - flex: 1; - display: flex; - align-items: center; - justify-content: center; + justify-content: center; - div { - background-color: #aee67f; - padding: 8px; - border-radius: 50%; - width: 40px; - height: 40px; - } + div { + background-color: #aee67f; + padding: 8px; + border-radius: 50%; + width: 40px; + height: 40px; } + } - &:hover { - background-color: #DFE0DE; - } + &:hover { + background-color: #dfe0de; + } - &>button { - padding: 5px 10px; - font-size: 14px; - } + & > button { + padding: 5px 10px; + font-size: 14px; + } - .walletIcon { - display: flex; - width: 40px; - height: 40px; - } + .walletIcon { + display: flex; + width: 40px; + height: 40px; - .walletName { - color: #232521; - font-size: 14px; - font-weight: 500; - line-height: 150%; - text-align: center; + svg { + width: 40px; + height: 40px; } + } + + .walletName { + color: #232521; + font-size: 14px; + font-weight: 500; + line-height: 150%; + text-align: center; + } } .dark { - &:hover { - background-color: #494949; - } + &:hover { + background-color: #494949; + } - .walletName { - color: #f7f7f7; - } + .walletName { + color: #f7f7f7; + } } .disabled { - opacity: 0.5; - cursor: not-allowed; - pointer-events: none; + opacity: 0.5; + cursor: not-allowed; + pointer-events: none; } .connecting { - flex: 1; - display: flex; - flex-direction: column; - align-items: center; - width: 100%; - - -} \ No newline at end of file + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + width: 100%; +} diff --git a/src/components/WalletManagement/ModalDisconnect/ModalDisconnect.tsx b/src/components/WalletManagement/ModalDisconnect/ModalDisconnect.tsx index ef65b90d8..54efcef49 100644 --- a/src/components/WalletManagement/ModalDisconnect/ModalDisconnect.tsx +++ b/src/components/WalletManagement/ModalDisconnect/ModalDisconnect.tsx @@ -9,6 +9,7 @@ import useWalletReducer from 'hooks/useWalletReducer'; import { reduceString } from 'libs/utils'; import { useCopyClipboard } from 'hooks/useCopyClipboard'; import { ReactComponent as SuccessIcon } from 'assets/icons/toast_success.svg'; +import useTonConnectAddress from 'hooks/useTonConnectAddress'; const cx = cn.bind(styles); @@ -21,9 +22,11 @@ export const ModalDisconnect: React.FC<{ const [walletByNetworks, setWalletByNetworks] = useWalletReducer('walletsByNetwork'); const [oraiAddress, setOraiAddress] = useConfigReducer('address'); const [tronAddress, setTronAddress] = useConfigReducer('tronAddress'); + const [tonAddress, setTonAddress] = useConfigReducer('tonAddress'); const [btcAddress, setBtcAddress] = useConfigReducer('btcAddress'); const [metamaskAddress, setMetamaskAddress] = useConfigReducer('metamaskAddress'); const { isCopied, copiedValue, handleCopy } = useCopyClipboard(); + const { handleDisconnectTon } = useTonConnectAddress(); const chains = walletProvider.find((provider) => provider.networkType === currentDisconnectingNetwork)?.networks || []; @@ -47,6 +50,9 @@ export const ModalDisconnect: React.FC<{ case 'tron': choosedAddressDisplayByNetwork = tronAddress; break; + case 'ton': + choosedAddressDisplayByNetwork = tonAddress; + break; default: break; } @@ -60,7 +66,6 @@ export const ModalDisconnect: React.FC<{ }); switch (currentDisconnectingNetwork) { case 'cosmos': - setOraiAddress(undefined); // TODO: need to refactor later if (walletByNetworks.cosmos === 'eip191') { @@ -76,6 +81,9 @@ export const ModalDisconnect: React.FC<{ case 'tron': setTronAddress(undefined); break; + case 'ton': + handleDisconnectTon(); + break; default: break; } diff --git a/src/components/WalletManagement/MyWallet/MyWallet.tsx b/src/components/WalletManagement/MyWallet/MyWallet.tsx index d1914da64..6a192d023 100644 --- a/src/components/WalletManagement/MyWallet/MyWallet.tsx +++ b/src/components/WalletManagement/MyWallet/MyWallet.tsx @@ -12,14 +12,16 @@ import { evmWallets, btcWallets, type NetworkType, - WalletNetwork + WalletNetwork, + tonWallets } from 'components/WalletManagement/walletConfig'; import { tronNetworksWithIcon, cosmosNetworksWithIcon, evmNetworksIconWithoutTron, getListAddressCosmos, - btcNetworksWithIcon + btcNetworksWithIcon, + tonNetworksWithIcon } from 'helper'; import { useCoinGeckoPrices } from 'hooks/useCoingecko'; import useConfigReducer from 'hooks/useConfigReducer'; @@ -46,6 +48,7 @@ export const MyWallet: React.FC<{ const [oraiAddress] = useConfigReducer('address'); const [tronAddress] = useConfigReducer('tronAddress'); const [btcAddress] = useConfigReducer('btcAddress'); + const [tonAddress] = useConfigReducer('tonAddress'); const [metamaskAddress] = useConfigReducer('metamaskAddress'); const [cosmosAddresses, setCosmosAddress] = useConfigReducer('cosmosAddress'); @@ -169,6 +172,17 @@ export const MyWallet: React.FC<{ return renderWalletAddress(btcNetworks, btcWalletConnected, (_network) => btcAddress); }; + const renderTonAddresses = () => { + if (!tonAddress) return null; + const tonWalletConnected = tonWallets.find((item) => item.nameRegistry === walletByNetworks.ton); + + if (!tonWalletConnected) return <>; + + const tonNetworks = tonNetworksWithIcon.map((evm) => ({ ...evm, typeChain: 'ton' })); + + return renderWalletAddress(tonNetworks, tonWalletConnected, (_network) => tonAddress); + }; + return (
diff --git a/src/components/WalletManagement/WalletManagement.tsx b/src/components/WalletManagement/WalletManagement.tsx index e5fdf4e1d..a3e3b8b67 100644 --- a/src/components/WalletManagement/WalletManagement.tsx +++ b/src/components/WalletManagement/WalletManagement.tsx @@ -65,6 +65,9 @@ export const WalletManagement: FC<{}> = () => { case 'bitcoin': isActive = isCheckOwallet; break; + case 'ton': + isActive = true; + break; } return { ...wallet, isActive }; } diff --git a/src/components/WalletManagement/walletConfig.ts b/src/components/WalletManagement/walletConfig.ts index 8449247d3..9a428eae9 100644 --- a/src/components/WalletManagement/walletConfig.ts +++ b/src/components/WalletManagement/walletConfig.ts @@ -3,10 +3,17 @@ import { ReactComponent as KeplrIcon } from 'assets/icons/keplr-icon.svg'; import { ReactComponent as MetamaskIcon } from 'assets/icons/metamask-icon.svg'; import { ReactComponent as OwalletIcon } from 'assets/icons/owallet-icon.svg'; import { ReactComponent as TronIcon } from 'assets/icons/tron-icon.svg'; -import { cosmosNetworksWithIcon, evmNetworksIconWithoutTron, tronNetworksWithIcon, btcNetworksWithIcon } from 'helper'; +import { ReactComponent as TonIcon } from 'assets/icons/ton.svg'; +import { + cosmosNetworksWithIcon, + evmNetworksIconWithoutTron, + tronNetworksWithIcon, + btcNetworksWithIcon, + tonNetworksWithIcon +} from 'helper'; -export type NetworkType = 'cosmos' | 'evm' | 'tron' | 'bitcoin'; -export type WalletType = WalletCosmosType | 'metamask' | 'tronLink' | 'eip191' | 'bitcoin'; +export type NetworkType = 'cosmos' | 'evm' | 'tron' | 'bitcoin' | 'ton'; +export type WalletType = WalletCosmosType | 'metamask' | 'tronLink' | 'eip191' | 'bitcoin' | 'ton'; export type WalletNetwork = { icon: React.FunctionComponent< React.SVGProps & { @@ -94,7 +101,22 @@ export const btcWallets: WalletNetwork[] = [ } ]; -export const allWallets: WalletNetwork[] = [...cosmosWallets, ...tronWallets, ...evmWallets, ...btcWallets]; +export const tonWallets: WalletNetwork[] = [ + { + icon: TonIcon, + name: 'TonConnect', + nameRegistry: 'ton', + isActive: true + } +]; + +export const allWallets: WalletNetwork[] = [ + ...cosmosWallets, + ...tronWallets, + ...evmWallets, + ...btcWallets, + ...tonWallets +]; export const walletProvider: WalletProvider[] = [ { @@ -116,5 +138,10 @@ export const walletProvider: WalletProvider[] = [ networkType: 'bitcoin', networks: btcNetworksWithIcon, wallets: btcWallets + }, + { + networkType: 'ton', + networks: tonNetworksWithIcon, + wallets: tonWallets } ]; diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index 11c8c940f..e229095d8 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -84,6 +84,7 @@ import { flatten } from 'lodash'; import { bitcoinChainId } from 'helper/constants'; import { OBTCContractAddress } from 'libs/nomic/models/ibc-chain'; import { listOsmosisToken } from './alphaNetwwork'; +import { TON_SCAN, TonChainId } from 'context/ton-provider'; const [otherChainTokens, oraichainTokens] = tokens; type TokenIcon = Pick; @@ -136,6 +137,55 @@ export const bitcoinMainnet: CustomChainInfo = { accountUrl: 'https://blockstream.info/address/{address}' } }; +export const tonNetworkMainnet: CustomChainInfo = { + rest: 'https://blockstream.info/api', + rpc: 'https://blockstream.info/api', + chainId: TonChainId, + chainName: 'Ton', + bip44: { + coinType: 0 + }, + coinType: 0, + Icon: TonIcon, + IconLight: TonIcon, + stakeCurrency: { + coinDenom: 'TON', + coinMinimalDenom: 'ton', + coinDecimals: 8, + coinGeckoId: 'the-open-network', + coinImageUrl: 'https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png' + }, + bech32Config: defaultBech32Config('bc'), + networkType: 'ton', + currencies: [ + { + coinDenom: 'TON', + coinMinimalDenom: 'ton', + coinDecimals: 8, + bridgeTo: ['Oraichain'], + prefixToken: 'ton', + Icon: BTCIcon, + coinGeckoId: 'ton', + coinImageUrl: 'https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png', + gasPriceStep: { + low: 0, + average: 0, + high: 0 + } + } + ], + get feeCurrencies() { + return this.currencies; + }, + // features: ['isBtc'], + + txExplorer: { + name: 'BlockStream', + txUrl: `${TON_SCAN}/transaction/{txHash}`, + accountUrl: `${TON_SCAN}/{address}` + } +}; + export const tokensIcon: TokenIcon[] = [ { coinGeckoId: 'oraichain-token', @@ -319,6 +369,11 @@ export const chainIcons: ChainIcon[] = [ chainId: 'oraibtc-mainnet-1', Icon: BitcoinIcon, IconLight: BitcoinIcon + }, + { + chainId: TonChainId, + Icon: TonIcon, + IconLight: TonIcon } ]; export const mapListWithIcon = (list: any[], listIcon: ChainIcon[] | TokenIcon[], key: 'chainId' | 'coinGeckoId') => { @@ -341,7 +396,11 @@ export const mapListWithIcon = (list: any[], listIcon: ChainIcon[] | TokenIcon[] }; // mapped chain info with icon -export const chainInfosWithIcon = mapListWithIcon([...customChainInfos, bitcoinMainnet], chainIcons, 'chainId'); +export const chainInfosWithIcon = mapListWithIcon( + [...customChainInfos, bitcoinMainnet, tonNetworkMainnet], + chainIcons, + 'chainId' +); // mapped token with icon export const oraichainTokensWithIcon = mapListWithIcon(oraichainTokens, tokensIcon, 'coinGeckoId'); diff --git a/src/context/ton-provider.tsx b/src/context/ton-provider.tsx new file mode 100644 index 000000000..161ddfc12 --- /dev/null +++ b/src/context/ton-provider.tsx @@ -0,0 +1,28 @@ +import { TonConnectUIProvider } from '@tonconnect/ui-react'; + +export const TonChainId = 'ton'; + +export enum TonNetwork { + Mainnet = 'mainnet', + Testnet = 'testnet' +} + +export const TonInteractionContract = { + [TonNetwork.Mainnet]: { + lightClient: 'EQDt5RAUICxUeHaNicwspH8obI__z3X0UHy6vv1xhpi3AbfT', + whitelist: 'EQATDM6mfPZjPDMD9TVa6D9dlbmAKY5w6xOJiTXJ9Nqj_dsu', + bridgeAdapter: 'EQArWlaBgdGClwJrAkQjQP_8zxIK_bdgbH-6qdl4f5JEfo3r' + }, + [TonNetwork.Testnet]: { + lightClient: '', + whitelist: 'EQD2xPIqdeggqtP3q852Y-7yD-RRHi12Zy7M4iUx4-7q0E1', + bridgeAdapter: 'EQDZfQX89gMo3HAiW1tSK9visb2gouUvDCt6PODo3qkXKeox' + } +}; + +export const TON_SCAN = 'https://tonviewer.com'; +export const MANIFEST_URL = `${window.location?.origin}/manifest.json`; + +export const TonProvider = (props: React.PropsWithChildren<{}>) => { + return {props.children}; +}; diff --git a/src/helper/index.tsx b/src/helper/index.tsx index e5f31524c..c7600a5f5 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -29,6 +29,7 @@ import { MetamaskOfflineSigner } from 'libs/eip191'; import Keplr from 'libs/keplr'; import { WalletsByNetwork } from 'reducer/wallet'; import { evmChainInfos } from 'config/evmChainInfos'; +import { TonChainId } from 'context/ton-provider'; export interface Tokens { denom?: string; @@ -67,6 +68,7 @@ export const evmNetworksIconWithoutTron = chainInfosWithIcon.filter( export const tronNetworks = chainInfos.filter((c) => c.chainId === '0x2b6653dc'); export const tronNetworksWithIcon = chainInfosWithIcon.filter((c) => c.chainId === '0x2b6653dc'); export const btcNetworksWithIcon = chainInfosWithIcon.filter((c) => c.chainId === bitcoinChainId); +export const tonNetworksWithIcon = chainInfosWithIcon.filter((c) => c.chainId === TonChainId); export const filterChainBridge = (token: Tokens, item: CustomChainInfo) => { const tokenCanBridgeTo = token.bridgeTo ?? ['Oraichain']; diff --git a/src/hooks/useTonConnectAddress.ts b/src/hooks/useTonConnectAddress.ts new file mode 100644 index 000000000..bdaae186f --- /dev/null +++ b/src/hooks/useTonConnectAddress.ts @@ -0,0 +1,74 @@ +import { useTonAddress, useTonConnectModal, useTonConnectUI, useTonWallet } from '@tonconnect/ui-react'; +import { useEffect } from 'react'; +import useConfigReducer from './useConfigReducer'; +import useWalletReducer from './useWalletReducer'; + +const useTonConnectAddress = () => { + const userFriendlyAddress = useTonAddress(); + const wallet = useTonWallet(); + const { open: openConnect } = useTonConnectModal(); + const [tonConnectUI] = useTonConnectUI(); + const [tonAddress, setTonAddress] = useConfigReducer('tonAddress'); + const [walletByNetworks, setWalletByNetworks] = useWalletReducer('walletsByNetwork'); + + useEffect(() => { + if (!(userFriendlyAddress && wallet)) { + setTonAddress(undefined); + setWalletByNetworks({ + ...walletByNetworks, + ton: null + }); + return; + } + + setTonAddress(userFriendlyAddress); + + setWalletByNetworks({ + ...walletByNetworks, + ton: 'ton' + }); + + // handleSetTonWallet({ + // tonWallet: + // wallet?.["appName"] || + // (wallet?.device?.appName?.toLowerCase() as TonWallet), + // }); + }, [userFriendlyAddress, wallet]); + + const handleDisconnectTon = async () => { + try { + if (tonConnectUI.connected) { + await tonConnectUI.disconnect(); + } + + if (tonAddress && walletByNetworks.ton) { + // && walletType === tonWallet + // handleSetTonAddress({ tonAddress: undefined }); + // handleSetTonWallet({ tonWallet: undefined }); + + setWalletByNetworks({ + ...walletByNetworks, + ton: null + }); + setTonAddress(undefined); + } + } catch (error) { + console.log('error disconnect TON :>>', error); + } + }; + + const handleConnectTon = () => { + try { + openConnect(); + } catch (error) { + console.log('error', error); + } + }; + + return { + handleConnectTon, + handleDisconnectTon + }; +}; + +export default useTonConnectAddress; diff --git a/src/layouts/App.tsx b/src/layouts/App.tsx index 263e88b43..de6340c54 100644 --- a/src/layouts/App.tsx +++ b/src/layouts/App.tsx @@ -26,6 +26,7 @@ import './index.scss'; import Menu from './Menu'; import { NoticeBanner } from './NoticeBanner'; import Sidebar from './Sidebar'; +import { TonProvider } from 'context/ton-provider'; const App = () => { const [address, setOraiAddress] = useConfigReducer('address'); @@ -231,15 +232,17 @@ const App = () => { return ( -
- - - {/* {(!bannerTime || Date.now() > bannerTime + 86_400_000) && } */} -
- -
{routes()}
+ +
+ + + {/* {(!bannerTime || Date.now() > bannerTime + 86_400_000) && } */} +
+ +
{routes()}
+
-
+ ); }; diff --git a/src/reducer/config.ts b/src/reducer/config.ts index 9928ffcb8..ba07d53a6 100644 --- a/src/reducer/config.ts +++ b/src/reducer/config.ts @@ -25,6 +25,7 @@ export interface ConfigState { metamaskAddress: string | null; tronAddress: string | null; btcAddress: string | null; + tonAddress: string | null; cosmosAddress: { [key: string]: string }; allPendingDeposits: { [key: string]: DepositInfo[] }; chainId: string; @@ -69,6 +70,7 @@ const initialState: ConfigState = { metamaskAddress: '', bannerTime: 0, btcAddress: '', + tonAddress: '', tronAddress: '', walletTypeStore: 'owallet', cosmosAddress: {}, diff --git a/src/reducer/wallet.ts b/src/reducer/wallet.ts index c060ffaf3..9a3902058 100644 --- a/src/reducer/wallet.ts +++ b/src/reducer/wallet.ts @@ -6,6 +6,7 @@ export type WalletsByNetwork = { evm: 'owallet' | 'metamask' | null; tron: 'owallet' | 'tronLink' | null; bitcoin: 'owallet' | null; + ton: 'ton' | null; }; export interface WalletState { @@ -17,7 +18,8 @@ const initialState: WalletState = { cosmos: null, evm: null, tron: null, - bitcoin: null + bitcoin: null, + ton: null } }; diff --git a/src/styles/_reboot.scss b/src/styles/_reboot.scss index 512ec48d8..cb0298b94 100644 --- a/src/styles/_reboot.scss +++ b/src/styles/_reboot.scss @@ -117,3 +117,8 @@ textarea { [type='number']::-webkit-outer-spin-button { -webkit-appearance: none; } + +#tc-widget-root { + position: absolute; + z-index: 1022; // set for zindex above react-modal (1021) +} diff --git a/yarn.lock b/yarn.lock index 43f45df26..36097e1ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5164,6 +5164,54 @@ dependencies: tippy.js "^6.3.1" +"@tonconnect/isomorphic-eventsource@^0.0.2": + version "0.0.2" + resolved "https://registry.yarnpkg.com/@tonconnect/isomorphic-eventsource/-/isomorphic-eventsource-0.0.2.tgz#e58c44cf9953e090f2c35da9a638946ddb614be5" + integrity sha512-B4UoIjPi0QkvIzZH5fV3BQLWrqSYABdrzZQSI9sJA9aA+iC0ohOzFwVVGXanlxeDAy1bcvPbb29f6sVUk0UnnQ== + dependencies: + eventsource "^2.0.2" + +"@tonconnect/isomorphic-fetch@^0.0.3": + version "0.0.3" + resolved "https://registry.yarnpkg.com/@tonconnect/isomorphic-fetch/-/isomorphic-fetch-0.0.3.tgz#31978e04ddc4428eff532c23d20229ed5ddb6417" + integrity sha512-jIg5nTrDwnite4fXao3dD83eCpTvInTjZon/rZZrIftIegh4XxyVb5G2mpMqXrVGk1e8SVXm3Kj5OtfMplQs0w== + dependencies: + node-fetch "^2.6.9" + +"@tonconnect/protocol@^2.2.6": + version "2.2.6" + resolved "https://registry.yarnpkg.com/@tonconnect/protocol/-/protocol-2.2.6.tgz#24b3fbcde6003e65fb5840a190072db5378699db" + integrity sha512-kyoDz5EqgsycYP+A+JbVsAUYHNT059BCrK+m0pqxykMODwpziuSAXfwAZmHcg8v7NB9VKYbdFY55xKeXOuEd0w== + dependencies: + tweetnacl "^1.0.3" + tweetnacl-util "^0.15.1" + +"@tonconnect/sdk@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@tonconnect/sdk/-/sdk-3.0.3.tgz#0cc6a570817194c648193f7a1db525419c570e3f" + integrity sha512-ElVre1DPixzQLgLtQIa8Wu5xS8nozlgblZTJhFFPrk82M2rZ+sawyF+LAVwt9wZRN7+htWnJrNz0+bBr4b3geA== + dependencies: + "@tonconnect/isomorphic-eventsource" "^0.0.2" + "@tonconnect/isomorphic-fetch" "^0.0.3" + "@tonconnect/protocol" "^2.2.6" + +"@tonconnect/ui-react@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@tonconnect/ui-react/-/ui-react-2.0.6.tgz#9adadda97da0c8ff2e40eee5dbaa1693aa6662b5" + integrity sha512-9VRYP2o/YW4ti+rOMSptIYaRO39V5UFmzdUl18AmDFDdynjacAIht/IInO+AGAKfrnF9bUk/J5NgLcbxVqvZww== + dependencies: + "@tonconnect/ui" "2.0.6" + +"@tonconnect/ui@2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@tonconnect/ui/-/ui-2.0.6.tgz#4cf092b3ff138238fa7ae7d4754d8bfed549d892" + integrity sha512-JMTSxgbnpDjpHi9g0s7w3tpAiLHa8BHUpaBrbSTDcKGQVEm7+NtqhN+gQkGkm8pV7NYRqiS/sKUpRQ1MyjtTBQ== + dependencies: + "@tonconnect/sdk" "3.0.3" + classnames "^2.3.2" + deepmerge "^4.2.2" + ua-parser-js "^1.0.35" + "@tootallnate/once@1": version "1.1.2" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" @@ -7953,7 +8001,7 @@ cjson@^0.3.1: dependencies: json-parse-helpfulerror "^1.0.3" -classnames@*, classnames@^2.2.6: +classnames@*, classnames@^2.2.6, classnames@^2.3.2: version "2.5.1" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== @@ -10317,6 +10365,11 @@ events@^3.2.0, events@^3.3.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== +eventsource@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-2.0.2.tgz#76dfcc02930fb2ff339520b6d290da573a9e8508" + integrity sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA== + evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" @@ -17646,7 +17699,7 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -17664,6 +17717,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -17743,7 +17805,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -17764,6 +17826,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -19517,7 +19586,7 @@ workbox-window@6.6.1: "@types/trusted-types" "^2.0.2" workbox-core "6.6.1" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -19544,6 +19613,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 0b6f8a313aaa42076aeffb2490c9045393da0a33 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Wed, 7 Aug 2024 17:50:44 +0700 Subject: [PATCH 02/21] feat: add ton bridge page --- package.json | 7 + .../WalletManagement/WalletManagement.tsx | 5 +- src/config/bridgeTokens.ts | 6 +- src/config/chainInfos.ts | 49 ++- src/config/networks.ts | 8 +- src/context/ton-provider.tsx | 5 +- src/helper/index.tsx | 5 +- src/hooks/useLoadTokens.ts | 102 ++++- src/index.tsx | 5 +- src/layouts/App.tsx | 28 +- src/pages/Balance/helpers.ts | 1 - src/pages/Balance/hooks/useGetFee.ts | 64 +++ src/pages/Balance/hooks/useGetStateData.ts | 27 ++ .../Balance/hooks/useTonBridgeHandler.ts | 377 ++++++++++++++++++ src/pages/Balance/index.tsx | 41 +- src/types/global.d.ts | 2 + yarn.lock | 187 ++++++++- 17 files changed, 875 insertions(+), 44 deletions(-) create mode 100644 src/pages/Balance/hooks/useGetFee.ts create mode 100644 src/pages/Balance/hooks/useGetStateData.ts create mode 100644 src/pages/Balance/hooks/useTonBridgeHandler.ts diff --git a/package.json b/package.json index 8e0e5c266..97e9201f9 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,18 @@ "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/oraidex-contracts-sdk": "^1.0.47", "@oraichain/oraidex-universal-swap": "1.0.96", + "@oraichain/ton-bridge-contracts": "^0.15.8", + "@oraichain/tonbridge-contracts-sdk": "^1.3.0", + "@orbs-network/ton-access": "^2.3.3", "@reduxjs/toolkit": "^1.9.3", "@sentry/react": "^7.47.0", "@tanstack/react-query": "^4.32.6", "@tharsis/proto": "^0.1.17", "@tippyjs/react": "^4.2.0", + "@ton/core": "^0.56.3", + "@ton/crypto": "^3.3.0", + "@ton/ton": "^14.0.0", + "@tonconnect/protocol": "^2.2.6", "@tonconnect/ui-react": "^2.0.6", "@walletconnect/browser-utils": "^1.8.0", "@walletconnect/ethereum-provider": "^1.7.8", diff --git a/src/components/WalletManagement/WalletManagement.tsx b/src/components/WalletManagement/WalletManagement.tsx index a3e3b8b67..69320fff2 100644 --- a/src/components/WalletManagement/WalletManagement.tsx +++ b/src/components/WalletManagement/WalletManagement.tsx @@ -22,6 +22,7 @@ export const WalletManagement: FC<{}> = () => { const [theme] = useConfigReducer('theme'); const [oraiAddress] = useConfigReducer('address'); const [tronAddress] = useConfigReducer('tronAddress'); + const [tonAddress] = useConfigReducer('tonAddress'); const [btcAddress] = useConfigReducer('btcAddress'); const [metamaskAddress] = useConfigReducer('metamaskAddress'); const [walletByNetworks] = useWalletReducer('walletsByNetwork'); @@ -88,7 +89,7 @@ export const WalletManagement: FC<{}> = () => { // load balance every time change address useEffect(() => { - const addresses = { oraiAddress, tronAddress, metamaskAddress, btcAddress }; + const addresses = { oraiAddress, tronAddress, metamaskAddress, btcAddress, tonAddress }; const filteredAddresses = {}; for (const key in addresses) { @@ -100,7 +101,7 @@ export const WalletManagement: FC<{}> = () => { loadTokenAmounts(filteredAddresses); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [oraiAddress, tronAddress, metamaskAddress, btcAddress]); + }, [oraiAddress, tronAddress, metamaskAddress, btcAddress, tonAddress]); // reset balance when disconnect useEffect(() => { diff --git a/src/config/bridgeTokens.ts b/src/config/bridgeTokens.ts index 3029afaf7..bb158d4f1 100644 --- a/src/config/bridgeTokens.ts +++ b/src/config/bridgeTokens.ts @@ -1,6 +1,6 @@ import flatten from 'lodash/flatten'; import uniqBy from 'lodash/uniqBy'; -import { chainInfos } from './chainInfos'; +import { chainInfos, oraichainNetwork } from './chainInfos'; import { CustomChainInfo, INJECTIVE_ORAICHAIN_DENOM, @@ -8,9 +8,9 @@ import { MILKYBSC_ORAICHAIN_DENOM, TokenItemType, KWT_BSC_CONTRACT, - MILKY_BSC_CONTRACT, + MILKY_BSC_CONTRACT // chainInfos, - oraichainNetwork + // oraichainNetwork } from '@oraichain/oraidex-common'; import { bitcoinChainId } from 'helper/constants'; diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index e229095d8..68ccde452 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -77,8 +77,10 @@ import { NEUTARO_ORAICHAIN_DENOM, OCH_CONTRACT, OCH_ETH_CONTRACT, - ORAIX_ETH_CONTRACT + ORAIX_ETH_CONTRACT, + TON_ORAICHAIN_DENOM } from '@oraichain/oraidex-common'; + import { BridgeAppCurrency, CustomChainInfo, defaultBech32Config } from '@oraichain/oraidex-common'; import { flatten } from 'lodash'; import { bitcoinChainId } from 'helper/constants'; @@ -86,6 +88,9 @@ import { OBTCContractAddress } from 'libs/nomic/models/ibc-chain'; import { listOsmosisToken } from './alphaNetwwork'; import { TON_SCAN, TonChainId } from 'context/ton-provider'; +export const TON_ZERO_ADDRESS = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'; +export const USDT_TON_CONTRACT = 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs'; + const [otherChainTokens, oraichainTokens] = tokens; type TokenIcon = Pick; type ChainIcon = Pick; @@ -138,20 +143,20 @@ export const bitcoinMainnet: CustomChainInfo = { } }; export const tonNetworkMainnet: CustomChainInfo = { - rest: 'https://blockstream.info/api', - rpc: 'https://blockstream.info/api', + rest: 'https://toncenter.com/api/v2/jsonRPC', + rpc: 'https://toncenter.com/api/v2/jsonRPC', chainId: TonChainId, chainName: 'Ton', bip44: { - coinType: 0 + coinType: 607 }, - coinType: 0, + coinType: 607, Icon: TonIcon, IconLight: TonIcon, stakeCurrency: { coinDenom: 'TON', coinMinimalDenom: 'ton', - coinDecimals: 8, + coinDecimals: 9, coinGeckoId: 'the-open-network', coinImageUrl: 'https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png' }, @@ -161,17 +166,30 @@ export const tonNetworkMainnet: CustomChainInfo = { { coinDenom: 'TON', coinMinimalDenom: 'ton', - coinDecimals: 8, + coinDecimals: 9, bridgeTo: ['Oraichain'], - prefixToken: 'ton', - Icon: BTCIcon, - coinGeckoId: 'ton', + prefixToken: 'ton20_', + contractAddress: TON_ZERO_ADDRESS, + denom: 'ton', + Icon: TonIcon, + coinGeckoId: 'the-open-network', coinImageUrl: 'https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png', gasPriceStep: { low: 0, average: 0, high: 0 } + }, + { + coinDenom: 'USDT', + coinMinimalDenom: 'ton20_usdt', + coinDecimals: 6, + Icon: UsdtIcon, + bridgeTo: ['Oraichain'], + contractAddress: USDT_TON_CONTRACT, + prefixToken: 'ton20_', + denom: 'ton20_usdt', + coinGeckoId: 'tether' } ], get feeCurrencies() { @@ -518,7 +536,7 @@ export const oraichainNetwork: CustomChainInfo = { coinMinimalDenom: 'usdt', type: 'cw20', contractAddress: USDT_CONTRACT, - bridgeTo: ['0x38', '0x2b6653dc', '0x01'], + bridgeTo: ['0x38', '0x2b6653dc', '0x01', TonChainId], coinDecimals: 6, Icon: UsdtIcon }, @@ -669,6 +687,14 @@ export const oraichainNetwork: CustomChainInfo = { Icon: BTCIcon, IconLight: BTCIcon, coinImageUrl: 'https://s2.coinmarketcap.com/static/img/coins/64x64/1.png' + }, + { + coinDenom: 'TON', + coinMinimalDenom: TON_ORAICHAIN_DENOM, + coinDecimals: 9, + bridgeTo: [TonChainId], + coinGeckoId: 'the-open-network', + coinImageUrl: 'https://assets.coingecko.com/coins/images/17980/standard/ton_symbol.png' } // { // coinDenom: 'ATOM-CW20', @@ -742,6 +768,7 @@ export const chainInfos: CustomChainInfo[] = [ // networks to add on keplr oraichainNetwork, bitcoinNetwork, + tonNetworkMainnet, { rpc: 'https://bridge-v2.rpc.orai.io', rest: 'https://bridge-v2.lcd.orai.io', diff --git a/src/config/networks.ts b/src/config/networks.ts index 5e6add1d4..8af30c58a 100644 --- a/src/config/networks.ts +++ b/src/config/networks.ts @@ -15,8 +15,10 @@ import { CW20_STAKING_CONTRACT, AMM_V3_CONTRACT } from '@oraichain/oraidex-common'; +import { CW_TON_BRIDGE, TOKEN_FACTORY } from 'context/ton-provider'; -export const network: CustomChainInfo & NetworkConfig & { pool_v3: string } = { +export const network: CustomChainInfo & + NetworkConfig & { pool_v3: string; CW_TON_BRIDGE: string; TOKEN_FACTORY: string } = { ...oraichainNetwork, prefix: oraichainNetwork.bech32Config.bech32PrefixAccAddr, denom: 'orai', @@ -34,5 +36,7 @@ export const network: CustomChainInfo & NetworkConfig & { pool_v3: string } = { staking_oraix: CW20_STAKING_CONTRACT, multicall: MULTICALL_CONTRACT, explorer: 'https://scan.orai.io', - pool_v3: AMM_V3_CONTRACT + pool_v3: AMM_V3_CONTRACT, + CW_TON_BRIDGE: CW_TON_BRIDGE, + TOKEN_FACTORY: TOKEN_FACTORY }; diff --git a/src/context/ton-provider.tsx b/src/context/ton-provider.tsx index 161ddfc12..13bc33dd4 100644 --- a/src/context/ton-provider.tsx +++ b/src/context/ton-provider.tsx @@ -1,6 +1,6 @@ import { TonConnectUIProvider } from '@tonconnect/ui-react'; -export const TonChainId = 'ton'; +export const TonChainId: any = 'ton'; export enum TonNetwork { Mainnet = 'mainnet', @@ -23,6 +23,9 @@ export const TonInteractionContract = { export const TON_SCAN = 'https://tonviewer.com'; export const MANIFEST_URL = `${window.location?.origin}/manifest.json`; +export const CW_TON_BRIDGE = 'orai159l8l9c5ckhqpuwdfgs9p4v599nqt3cjlfahalmtrhfuncnec2ms5mz60e'; +export const TOKEN_FACTORY = 'orai1wuvhex9xqs3r539mvc6mtm7n20fcj3qr2m0y9khx6n5vtlngfzes3k0rq9'; + export const TonProvider = (props: React.PropsWithChildren<{}>) => { return {props.children}; }; diff --git a/src/helper/index.tsx b/src/helper/index.tsx index c7600a5f5..85a75ecb7 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -30,6 +30,7 @@ import Keplr from 'libs/keplr'; import { WalletsByNetwork } from 'reducer/wallet'; import { evmChainInfos } from 'config/evmChainInfos'; import { TonChainId } from 'context/ton-provider'; +import { toUserFriendlyAddress } from '@tonconnect/ui-react'; export interface Tokens { denom?: string; @@ -403,7 +404,9 @@ export const getAddressTransferForEvm = async (walletByNetworks: WalletsByNetwor export const getAddressTransfer = async (network: CustomChainInfo, walletByNetworks: WalletsByNetwork) => { try { let address = ''; - if (network.networkType === 'evm') { + if (network.networkType === ('ton' as any)) { + address = toUserFriendlyAddress(window.Ton.account.address); + } else if (network.networkType === 'evm') { address = await getAddressTransferForEvm(walletByNetworks, network); } else if (isConnectSpecificNetwork(walletByNetworks.cosmos)) { address = await window.Keplr.getKeplrAddr(network.chainId); diff --git a/src/hooks/useLoadTokens.ts b/src/hooks/useLoadTokens.ts index cb2040ce5..92e5e8bf0 100644 --- a/src/hooks/useLoadTokens.ts +++ b/src/hooks/useLoadTokens.ts @@ -20,13 +20,16 @@ import { tronToEthAddress } from '@oraichain/oraidex-common'; import { isEvmNetworkNativeSwapSupported } from '@oraichain/oraidex-universal-swap'; -import { chainInfos, evmChains } from 'config/chainInfos'; +import { chainInfos, evmChains, TON_ZERO_ADDRESS, tonNetworkMainnet } from 'config/chainInfos'; import { network } from 'config/networks'; import { ethers } from 'ethers'; import axios from 'rest/request'; import { reduce } from 'lodash'; import { getUtxos } from 'pages/Balance/helpers'; import { bitcoinChainId } from 'helper/constants'; +import { getHttpEndpoint } from '@orbs-network/ton-access'; +import { Address, TonClient } from '@ton/ton'; +import { JettonMinter, JettonWallet } from '@oraichain/ton-bridge-contracts'; export type LoadTokenParams = { refresh?: boolean; @@ -34,6 +37,7 @@ export type LoadTokenParams = { oraiAddress?: string; tronAddress?: string; btcAddress?: string; + tonAddress?: string; }; async function loadNativeBalance(dispatch: Dispatch, address: string, tokenInfo: { chainId: string; rpc: string }) { @@ -65,7 +69,7 @@ const timer = {}; async function loadTokens( dispatch: Dispatch, - { oraiAddress, metamaskAddress, tronAddress, btcAddress }: LoadTokenParams + { oraiAddress, metamaskAddress, tronAddress, btcAddress, tonAddress }: LoadTokenParams ) { try { if (oraiAddress) { @@ -124,6 +128,13 @@ async function loadTokens( ); }, 2000); } + + if (tonAddress) { + clearTimeout(timer[btcAddress]); + timer[tonAddress] = setTimeout(() => { + loadAllBalanceTonToken(dispatch, tonAddress); + }, 2000); + } } catch (error) { console.log('error load balance: ', error); } @@ -334,6 +345,93 @@ async function loadKawaiiSubnetAmount(dispatch: Dispatch, kwtAddress: string) { dispatch(updateAmounts(amountDetails)); } +const loadBalanceByToken = async (dispatch: Dispatch, addressTon: string, addressToken?: string) => { + try { + // get the decentralized RPC endpoint + const endpoint = await getHttpEndpoint(); + const client = new TonClient({ + endpoint + }); + if (addressToken === TON_ZERO_ADDRESS) { + const balance = await client.getBalance(Address.parse(addressTon)); + + return { ton: balance || '0' }; + } + + const token = tonNetworkMainnet.currencies.find((e) => e.contractAddress === addressToken); + + const jettonMinter = JettonMinter.createFromAddress(Address.parse(addressToken)); + const jettonMinterContract = client.open(jettonMinter); + const jettonWalletAddress = await jettonMinterContract.getWalletAddress(Address.parse(addressTon)); + const jettonWallet = JettonWallet.createFromAddress(jettonWalletAddress); + const jettonWalletContract = client.open(jettonWallet); + const balance = await jettonWalletContract.getBalance(); + + dispatch(updateAmounts({ [token.coinMinimalDenom]: (balance.amount || '0').toString() })); + return { [token.coinMinimalDenom]: balance.amount || '0' }; + } catch (error) { + console.log('error load ton balance', error); + return {}; + } +}; + +const loadAllBalanceTonToken = async (dispatch: Dispatch, tonAddress: string, listToken?: string[]) => { + if (!tonAddress) return; + + const allTokens = !listToken?.length + ? tonNetworkMainnet.currencies + : tonNetworkMainnet.currencies.filter((e) => listToken.includes(e.contractAddress)); + + const endpoint = await getHttpEndpoint(); + const client = new TonClient({ + endpoint + }); + + const fullData = await Promise.all( + allTokens.map(async (item) => { + if (item.contractAddress === TON_ZERO_ADDRESS) { + // native token: TON + const balance = await client.getBalance(Address.parse(tonAddress)); + + return { + balance: balance, + jettonWalletAddress: '', + token: item + }; + } + const jettonMinter = JettonMinter.createFromAddress(Address.parse(item.contractAddress)); + + const jettonMinterContract = client.open(jettonMinter); + + const jettonWalletAddress = await jettonMinterContract.getWalletAddress(Address.parse(tonAddress)); + + const jettonWallet = JettonWallet.createFromAddress(jettonWalletAddress); + const jettonWalletContract = client.open(jettonWallet); + const balance = await jettonWalletContract.getBalance(); + + return { + balance: balance.amount, + jettonWalletAddress, + token: item + }; + }) + ); + + let amountDetail: AmountDetails = {}; + fullData?.map((data) => { + const token = tonNetworkMainnet.currencies.find((e) => e.contractAddress === data.token.contractAddress); + + amountDetail = { + ...amountDetail, + [token.coinMinimalDenom]: (data.balance || '0').toString() + }; + }); + + dispatch(updateAmounts(amountDetail)); + + return amountDetail; +}; + export default function useLoadTokens(): (params: LoadTokenParams) => Promise { const dispatch = useDispatch(); return loadTokens.bind(null, dispatch); diff --git a/src/index.tsx b/src/index.tsx index 3e93d5530..20a443044 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -21,6 +21,7 @@ import App from './layouts/App'; import ScrollToTop from './layouts/ScrollToTop'; import loadWasm from 'pages/Pool-V3/packages/wasm/oraiswap_v3_wasm'; import { Client, cacheExchange, fetchExchange, Provider as UrqlProvider } from 'urql'; +import { TonProvider } from 'context/ton-provider'; // const client = new Client({ // url: 'http://10.10.20.72:3000/', @@ -76,7 +77,9 @@ const initApp = async () => { - + + + diff --git a/src/layouts/App.tsx b/src/layouts/App.tsx index de6340c54..3c90cc904 100644 --- a/src/layouts/App.tsx +++ b/src/layouts/App.tsx @@ -26,15 +26,17 @@ import './index.scss'; import Menu from './Menu'; import { NoticeBanner } from './NoticeBanner'; import Sidebar from './Sidebar'; -import { TonProvider } from 'context/ton-provider'; +import { useTonConnectUI } from '@tonconnect/ui-react'; const App = () => { const [address, setOraiAddress] = useConfigReducer('address'); const [, setTronAddress] = useConfigReducer('tronAddress'); + const [, setTonAddress] = useConfigReducer('tonAddress'); const [, setMetamaskAddress] = useConfigReducer('metamaskAddress'); const [, setBtcAddress] = useConfigReducer('btcAddress'); const [, setStatusChangeAccount] = useConfigReducer('statusChangeAccount'); const loadTokenAmounts = useLoadTokens(); + const [tonConnectUI] = useTonConnectUI(); const [persistVersion, setPersistVersion] = useConfigReducer('persistVersion'); const [theme] = useConfigReducer('theme'); const [walletByNetworks] = useWalletReducer('walletsByNetwork'); @@ -47,6 +49,11 @@ const App = () => { useTronEventListener(); + // init TON + useEffect(() => { + window.Ton = tonConnectUI; + }, [tonConnectUI]); + // TODO: polyfill evm, tron, need refactor useEffect(() => { if (tron) { @@ -205,6 +212,7 @@ const App = () => { return tronAddress; }; + // TODO: owallet not support TON. need to update in next time const keplrHandler = async () => { try { polyfillForMobileMode(); @@ -232,17 +240,15 @@ const App = () => { return ( - -
- - - {/* {(!bannerTime || Date.now() > bannerTime + 86_400_000) && } */} -
- -
{routes()}
-
+
+ + + {/* {(!bannerTime || Date.now() > bannerTime + 86_400_000) && } */} +
+ +
{routes()}
- +
); }; diff --git a/src/pages/Balance/helpers.ts b/src/pages/Balance/helpers.ts index 60b8ec6e5..e9058f7c5 100644 --- a/src/pages/Balance/helpers.ts +++ b/src/pages/Balance/helpers.ts @@ -374,7 +374,6 @@ export const transferIbcCustom = async ( export const findDefaultToToken = (from: TokenItemType) => { if (!from.bridgeTo) return; - return flattenTokens.find( (t) => from.bridgeTo.includes(t.chainId) && from.name.includes(t.name) && from.chainId !== t.chainId ); diff --git a/src/pages/Balance/hooks/useGetFee.ts b/src/pages/Balance/hooks/useGetFee.ts new file mode 100644 index 000000000..69d19a337 --- /dev/null +++ b/src/pages/Balance/hooks/useGetFee.ts @@ -0,0 +1,64 @@ +import { BigDecimal, toDisplay, TokenItemType } from '@oraichain/oraidex-common'; +import { TonbridgeBridgeClient } from '@oraichain/tonbridge-contracts-sdk'; +import { tonNetworkMainnet } from 'config/chainInfos'; +import { network } from 'config/networks'; +import useConfigReducer from 'hooks/useConfigReducer'; +import { useEffect, useState } from 'react'; + +const useGetFee = ({ token }: { token: TokenItemType }) => { + const [oraiAddress] = useConfigReducer('address'); + const [bridgeFee, setBridgeFee] = useState(0); + const [tokenFee, setTokenFee] = useState(0); + + useEffect(() => { + (async () => { + try { + if (token) { + const tokenInTon = tonNetworkMainnet.currencies.find((tk) => tk.coinGeckoId === token.coinGeckoId); + if (!tokenInTon) { + return; + } + + const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); + + const tokenFeeConfig = await tonBridgeClient.tokenFee({ + remoteTokenDenom: tokenInTon?.contractAddress + }); + + if (tokenFeeConfig) { + const { nominator, denominator } = tokenFeeConfig; + const fee = new BigDecimal(nominator).div(denominator).toNumber(); + + setTokenFee(fee); + } + } + } catch (error) { + if (error.message.toString().includes('type: tonbridge_bridge::state::Ratio; key:')) { + setTokenFee(0); + } else { + console.log(error); + } + } + })(); + }, [token, oraiAddress]); + + useEffect(() => { + (async () => { + const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); + + const config = await tonBridgeClient.config(); + if (config) { + const { relayer_fee } = config; + + setBridgeFee(toDisplay(relayer_fee)); + } + })(); + }, []); + + return { + bridgeFee, + tokenFee + }; +}; + +export default useGetFee; diff --git a/src/pages/Balance/hooks/useGetStateData.ts b/src/pages/Balance/hooks/useGetStateData.ts new file mode 100644 index 000000000..f0b3b3186 --- /dev/null +++ b/src/pages/Balance/hooks/useGetStateData.ts @@ -0,0 +1,27 @@ +import { TonbridgeBridgeClient } from '@oraichain/tonbridge-contracts-sdk'; +import { network } from 'config/networks'; +import useConfigReducer from 'hooks/useConfigReducer'; +import { useEffect, useState } from 'react'; + +const useGetStateData = () => { + const [oraiAddress] = useConfigReducer('address'); + const [balances, setBalances] = useState([]); + + const getChanelStateData = async () => { + const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); + + const config = await tonBridgeClient.channelStateData(); + if (config) { + const { balances } = config; + setBalances(balances); + } + }; + + useEffect(() => { + getChanelStateData(); + }, []); + + return { balances, getChanelStateData }; +}; + +export default useGetStateData; diff --git a/src/pages/Balance/hooks/useTonBridgeHandler.ts b/src/pages/Balance/hooks/useTonBridgeHandler.ts new file mode 100644 index 000000000..b3d71984b --- /dev/null +++ b/src/pages/Balance/hooks/useTonBridgeHandler.ts @@ -0,0 +1,377 @@ +import { toBinary } from '@cosmjs/cosmwasm-stargate'; +import { fromBech32 } from '@cosmjs/encoding'; +import { + BigDecimal, + CW20_DECIMALS, + handleSentFunds, + toAmount, + toDisplay, + TokenItemType +} from '@oraichain/oraidex-common'; +import { BridgeAdapter, JettonMinter, JettonWallet } from '@oraichain/ton-bridge-contracts'; +import { TonbridgeBridgeClient } from '@oraichain/tonbridge-contracts-sdk'; +import { getHttpEndpoint } from '@orbs-network/ton-access'; +import { Address, beginCell, Cell, toNano } from '@ton/core'; +import { TonClient } from '@ton/ton'; +import { Base64 } from '@tonconnect/protocol'; +import { useTonConnectUI } from '@tonconnect/ui-react'; +import { displayToast, TToastType } from 'components/Toasts/Toast'; +import { oraichainTokens } from 'config/bridgeTokens'; +import { TON_ZERO_ADDRESS, tonNetworkMainnet } from 'config/chainInfos'; +import { network } from 'config/networks'; +import { TON_SCAN, TonChainId, TonInteractionContract, TonNetwork } from 'context/ton-provider'; +import { getTransactionUrl, handleErrorTransaction } from 'helper'; +import { useCoinGeckoPrices } from 'hooks/useCoingecko'; +import useConfigReducer from 'hooks/useConfigReducer'; +import { useEffect, useState } from 'react'; +import useGetStateData from './useGetStateData'; +import useLoadTokens from 'hooks/useLoadTokens'; + +const FWD_AMOUNT = toNano(0.15); +const TON_MESSAGE_VALID_UNTIL = 100000; +const BRIDGE_TON_TO_ORAI_MINIMUM_GAS = toNano(1); +const EXTERNAL_MESSAGE_FEE = toNano(0.01); +const MINIMUM_BRIDGE_PER_USD = 1; // 10; // TODO: update for product is 10 + +export { + BRIDGE_TON_TO_ORAI_MINIMUM_GAS, + EXTERNAL_MESSAGE_FEE, + FWD_AMOUNT, + MINIMUM_BRIDGE_PER_USD, + TON_MESSAGE_VALID_UNTIL +}; + +const handleCheckBalanceBridgeOfTonNetwork = async (token: TokenItemType) => { + try { + // get the decentralized RPC endpoint + const endpoint = await getHttpEndpoint(); + const client = new TonClient({ + endpoint + }); + const bridgeAdapter = TonInteractionContract[TonNetwork.Mainnet].bridgeAdapter; + + if (token.contractAddress === TON_ZERO_ADDRESS) { + const balance = await client.getBalance(Address.parse(bridgeAdapter)); + + return { + balance: balance + }; + } + + const jettonMinter = JettonMinter.createFromAddress(Address.parse(token.contractAddress)); + const jettonMinterContract = client.open(jettonMinter); + const jettonWalletAddress = await jettonMinterContract.getWalletAddress(Address.parse(bridgeAdapter)); + const jettonWallet = JettonWallet.createFromAddress(jettonWalletAddress); + const jettonWalletContract = client.open(jettonWallet); + const balance = await jettonWalletContract.getBalance(); + + return { + balance: balance.amount + }; + } catch (error) { + console.log('error :>> handleCheckBalanceBridgeOfTonNetwork', error); + } +}; + +const handleCheckBalanceBridgeOfOraichain = async (token: TokenItemType) => { + try { + if (token) { + if (!token.contractAddress) { + const data = await window.client.getBalance(network.CW_TON_BRIDGE, token.denom); + return { + balance: data.amount + }; + } + + const tx = await window.client.queryContractSmart(token.contractAddress, { + balance: { address: network.CW_TON_BRIDGE } + }); + + return { + balance: tx?.balance || 0 + }; + } + } catch (error) { + console.log('error :>> handleCheckBalanceBridgeOfOraichain', error); + } +}; + +const checkBalanceBridgeByNetwork = async (networkFrom: string, token: TokenItemType) => { + const handler = { + [network.chainId]: handleCheckBalanceBridgeOfTonNetwork, + [TonChainId]: handleCheckBalanceBridgeOfOraichain + }; + + const { balance } = handler[networkFrom] ? await handler[networkFrom](token) : { balance: 0 }; + + return toDisplay((balance || '0').toString(), token.decimals || CW20_DECIMALS); +}; + +const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { + const [tonAddress, setTonAddress] = useConfigReducer('tonAddress'); + const [oraiAddress, setOraiAddress] = useConfigReducer('address'); + + const { balances: sentBalance, getChanelStateData } = useGetStateData(); + const loadTokenAmounts = useLoadTokens(); + + const [tonConnectUI] = useTonConnectUI(); + const { data: prices } = useCoinGeckoPrices(); + const [tokenInfo, setTokenInfo] = useState({ + jettonWalletAddress: null + }); + const [deductNativeAmount, setDeductNativeAmount] = useState(0n); + + useEffect(() => { + if (token?.chainId === TonChainId && token?.contractAddress === TON_ZERO_ADDRESS) { + setDeductNativeAmount(BRIDGE_TON_TO_ORAI_MINIMUM_GAS); + return; + } + setDeductNativeAmount(0n); + }, [token]); + + // @dev: this function will changed based on token minter address (which is USDT, USDC, bla bla bla) + useEffect(() => { + try { + (async () => { + if (token?.chainId !== TonChainId) return; + + // get the decentralized RPC endpoint + const endpoint = await getHttpEndpoint(); + const client = new TonClient({ + endpoint + }); + if (token?.contractAddress === TON_ZERO_ADDRESS) { + setDeductNativeAmount(BRIDGE_TON_TO_ORAI_MINIMUM_GAS); + setTokenInfo({ + jettonWalletAddress: '' + }); + return; + } + + const jettonMinter = JettonMinter.createFromAddress(Address.parse(token.contractAddress)); + const jettonMinterContract = client.open(jettonMinter); + const jettonWalletAddress = await jettonMinterContract.getWalletAddress(Address.parse(tonAddress)); + + setTokenInfo({ + jettonWalletAddress + }); + setDeductNativeAmount(0n); + })(); + } catch (error) { + console.log('error :>>', error); + } + }, [token]); // toNetwork, tonAddress + + const validatePrice = (token: TokenItemType, amount: number) => { + const usdPrice = new BigDecimal(amount || 0).mul(prices?.[token?.coinGeckoId] || 0).toNumber(); + + const minimumAmount = Math.ceil((MINIMUM_BRIDGE_PER_USD * amount * 100) / usdPrice) / 100; + + if (amount < minimumAmount) { + throw Error(`Minimum bridge is ${minimumAmount} ${token.name}`); + } + }; + + const handleBridgeFromTon = async (amount: number | string) => { + try { + if (!oraiAddress) { + throw new Error('Please connect OWallet or Kelpr!'); + } + + if (!tonAddress) { + throw new Error('Please connect Ton Wallet'); + } + + if (!token || !amount) { + throw new Error('Not valid!'); + } + + validatePrice(token, Number(amount)); + + const tokenInOrai = oraichainTokens.find((tk) => tk.coinGeckoId === token.coinGeckoId); + const balanceMax = await checkBalanceBridgeByNetwork(TonChainId, tokenInOrai); + + if (Number(balanceMax) < Number(amount) && token.contractAddress !== TON_ZERO_ADDRESS) { + throw new Error( + `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${token.name}, have ${balanceMax} ${token.name}` + ); + } + + const bridgeAdapterAddress = Address.parse(TonInteractionContract[TonNetwork.Mainnet].bridgeAdapter); + const fmtAmount = new BigDecimal(10).pow(token.decimals).mul(amount); + const isNativeTon: boolean = token.contractAddress === TON_ZERO_ADDRESS; + const toAddress: string = isNativeTon + ? bridgeAdapterAddress.toString() + : tokenInfo.jettonWalletAddress?.toString(); + const oraiAddressBech32 = fromBech32(oraiAddress).data; + const gasAmount = isNativeTon + ? fmtAmount.add(BRIDGE_TON_TO_ORAI_MINIMUM_GAS).toString() + : BRIDGE_TON_TO_ORAI_MINIMUM_GAS.toString(); + const timeout = BigInt(Math.floor(new Date().getTime() / 1000) + 3600); + const memo = beginCell().endCell(); + + const getNativeBridgePayload = () => + BridgeAdapter.buildBridgeTonBody( + { + amount: BigInt(fmtAmount.toString()), + memo, + remoteReceiver: oraiAddress, + timeout + }, + oraiAddressBech32, + { + queryId: 0, + value: toNano(0) // don't care this + } + ).toBoc(); + + const getOtherBridgeTokenPayload = () => + JettonWallet.buildSendTransferPacket( + Address.parse(tonAddress), + { + fwdAmount: FWD_AMOUNT, + jettonAmount: BigInt(fmtAmount.toString()), + jettonMaster: Address.parse(token.contractAddress), + remoteReceiver: oraiAddress, + timeout, + memo, + toAddress: bridgeAdapterAddress + }, + 0 + ).toBoc(); + + const boc = isNativeTon ? getNativeBridgePayload() : getOtherBridgeTokenPayload(); + + const tx = await tonConnectUI.sendTransaction({ + validUntil: TON_MESSAGE_VALID_UNTIL, + messages: [ + { + address: toAddress, // dia chi token + amount: gasAmount, // gas + payload: Base64.encode(boc) + } + ] + }); + + const txHash = Cell.fromBoc(Buffer.from(tx.boc, 'base64'))[0].hash().toString('hex'); + + if (txHash) { + displayToast(TToastType.TX_SUCCESSFUL, { + customLink: `${TON_SCAN}/transaction/${txHash}` + }); + + loadTokenAmounts({ oraiAddress, tonAddress }); + getChanelStateData(); + + return txHash; + } + } catch (error) { + console.log('error Bridge from TON :>>', error); + + handleErrorTransaction(error, { + tokenName: token.name, + chainName: token.chainId + }); + } + }; + + const handleBridgeFromOraichain = async (amount: number | string) => { + try { + if (!oraiAddress) { + throw new Error('Please connect OWallet or Kelpr!'); + } + + if (!tonAddress) { + throw new Error('Please connect Ton Wallet'); + } + + if (!token || !amount) { + throw new Error('Not valid!'); + } + + validatePrice(token, Number(amount)); + + const tokenInTon = tonNetworkMainnet.currencies.find((tk) => tk.coinGeckoId === token.coinGeckoId); + + const balanceMax = (sentBalance || []).find((b) => b.native.denom === tokenInTon.contractAddress)?.native.amount; + + // const balanceMax = await checkBalanceBridgeByNetwork( + // NetworkList.oraichain.id, + // tokenInTon + // ); + + const displayBalance = toDisplay(balanceMax, tokenInTon?.coinDecimals || CW20_DECIMALS); + + if (displayBalance < Number(amount) && token.contractAddress !== null) { + throw new Error( + `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${token.name}, have ${displayBalance} ${token.name}` + ); + } + + const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); + + let tx; + + const timeout = Math.floor(new Date().getTime() / 1000) + 3600; + const msg = { + // crcSrc: ARG_BRIDGE_TO_TON.CRC_SRC, + denom: tonNetworkMainnet.currencies.find((tk) => tk.coinGeckoId === token.coinGeckoId).contractAddress, + timeout, + to: tonAddress + }; + + const funds = handleSentFunds({ + denom: token.denom, + amount: toAmount(amount, token.decimals).toString() + }); + + // native token + if (!token.contractAddress) { + tx = await tonBridgeClient.bridgeToTon(msg, 'auto', null, funds); + } + // cw20 token + else { + tx = await window.client.execute( + oraiAddress, + token.contractAddress, + { + send: { + contract: network.CW_TON_BRIDGE, + amount: toAmount(amount, token.decimals).toString(), + msg: toBinary({ + denom: msg.denom, + timeout, + to: msg.to + }) + } + }, + 'auto' + ); + } + + if (tx?.transactionHash) { + displayToast(TToastType.TX_SUCCESSFUL, { + customLink: getTransactionUrl(token.chainId as any, tx.transactionHash) + }); + + loadTokenAmounts({ oraiAddress, tonAddress }); + getChanelStateData(); + + return tx?.transactionHash; + } + } catch (error) { + console.log('error Bridge from Oraichain :>>', error); + handleErrorTransaction(error, { + tokenName: token.name, + chainName: token.chainId + }); + } + }; + + return { + handleBridgeFromOraichain, + handleBridgeFromTon + }; +}; + +export default useTonBridgeHandler; diff --git a/src/pages/Balance/index.tsx b/src/pages/Balance/index.tsx index 90a397b9f..c711081af 100644 --- a/src/pages/Balance/index.tsx +++ b/src/pages/Balance/index.tsx @@ -78,6 +78,8 @@ import StuckOraib from './StuckOraib'; import useGetOraiBridgeBalances from './StuckOraib/useGetOraiBridgeBalances'; import TokenItem, { TokenItemProps } from './TokenItem'; import { TokenItemBtc } from './TokenItem/TokenItemBtc'; +import { TonChainId } from 'context/ton-provider'; +import useTonBridgeHandler from './hooks/useTonBridgeHandler'; interface BalanceProps {} @@ -105,8 +107,10 @@ const Balance: React.FC = () => { const [metamaskAddress] = useConfigReducer('metamaskAddress'); const [filterNetworkUI, setFilterNetworkUI] = useConfigReducer('filterNetwork'); const [tronAddress] = useConfigReducer('tronAddress'); + const [tonAddress] = useConfigReducer('tonAddress'); const [btcAddress] = useConfigReducer('btcAddress'); const [addressRecovery, setAddressRecovery] = useState(''); + const { handleBridgeFromOraichain, handleBridgeFromTon } = useTonBridgeHandler({ token: from }); const ref = useRef(null); //@ts-ignore @@ -218,7 +222,7 @@ const Balance: React.FC = () => { try { if (loadingRefresh) return; setLoadingRefresh(true); - await loadTokenAmounts({ metamaskAddress, tronAddress, oraiAddress, btcAddress }); + await loadTokenAmounts({ metamaskAddress, tronAddress, oraiAddress, btcAddress, tonAddress }); } catch (err) { console.log({ err }); } finally { @@ -296,7 +300,7 @@ const Balance: React.FC = () => { customLink: `/bitcoin-dashboard?tab=pending_deposits` }); setTimeout(async () => { - await loadTokenAmounts({ metamaskAddress, tronAddress, oraiAddress, btcAddress: btcAddr }); + await loadTokenAmounts({ metamaskAddress, tronAddress, oraiAddress, btcAddress: btcAddr, tonAddress }); }, 5000); return; } @@ -356,6 +360,28 @@ const Balance: React.FC = () => { } }; + const checkTransferTon = async (fromAmount: number) => { + const isTontoOraichain = from.chainId === (TonChainId as any) && to.chainId === 'Oraichain'; + const isOraichainToTON = from.chainId === 'Oraichain' && to.chainId === TonChainId; + if (isTontoOraichain || isOraichainToTON) { + handleTransferTon({ + isTonToOraichain: isTontoOraichain, + transferAmount: fromAmount + }); + + return true; + } + }; + + const handleTransferTon = async ({ isTonToOraichain, transferAmount }) => { + const tonAddress = window.Ton.account?.address; + if (!tonAddress) throw Error('Not found your ton address!'); + if (isTonToOraichain) { + return await handleBridgeFromTon(transferAmount); + } + return await handleBridgeFromOraichain(transferAmount); + }; + const checkTransferBtc = async (fromAmount: number) => { const isBTCtoOraichain = from.chainId === bitcoinChainId && to.chainId === 'Oraichain'; const isOraichainToBTC = from.chainId === 'Oraichain' && to.chainId === bitcoinChainId; @@ -426,6 +452,12 @@ const Balance: React.FC = () => { displayToast(TToastType.TX_BROADCASTING); let result: DeliverTxResponse | string | any; + // check transfer TON <=> ORAICHAIN + const isTonBridge = await checkTransferTon(fromAmount); + if (isTonBridge) { + return; + } + // [(ERC20)KWT, (ERC20)MILKY] ==> ORAICHAIN if (from.chainId === 'kawaii_6886-1' && to.chainId === 'Oraichain') { await checkTransferKwt(fromAmount); @@ -452,6 +484,10 @@ const Balance: React.FC = () => { // hardcode case Neutaro-1 & Noble-1 if (from.chainId === 'Neutaro-1') return await handleTransferIBC(from, newToToken, fromAmount); + console.log('from', from, to); + if (to.chainId === TonChainId) { + } + // remaining tokens, we override from & to of onClickTransfer on index.tsx of Balance based on the user's token destination choice // to is Oraibridge tokens // or other token that have same coingeckoId that show in at least 2 chain. @@ -629,6 +665,7 @@ const Balance: React.FC = () => { const isBtcToken = t.chainId === bitcoinChainId && t?.coinGeckoId === 'bitcoin'; const TokenItemELement: React.FC = isBtcToken ? TokenItemBtc : TokenItem; + return (
{!isOwallet && !isMobile() && isBtcToken && ( diff --git a/src/types/global.d.ts b/src/types/global.d.ts index d80654b98..ffed8ba5b 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -10,6 +10,7 @@ import { Networks as _Networks } from 'libs/ethereum-multicall/enums'; import { DuckDb } from 'libs/duckdb'; import { Class } from '@oraichain/common-contracts-sdk/build/CwIcs721Bridge.types'; import Bitcoin, { IBitcoin } from 'libs/bitcoin'; +import { TonConnectUI } from '@tonconnect/ui-react'; declare global { type AmountDetails = { [denom: string]: string }; @@ -117,6 +118,7 @@ declare global { Wallet: Wallet; Keplr: Keplr; Bitcoin: Bitcoin; + Ton: TonConnectUI; tronWeb: _TronWeb; tronLink: TronLink; ethereum: MetaMaskEthereumProvider; diff --git a/yarn.lock b/yarn.lock index 36097e1ff..d1ee9145d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1896,6 +1896,19 @@ elliptic "^6.5.4" libsodium-wrappers-sumo "^0.7.11" +"@cosmjs/crypto@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.32.4.tgz#5d29633b661eaf092ddb3e7ea6299cfd6f4507a2" + integrity sha512-zicjGU051LF1V9v7bp8p7ovq+VyC91xlaHdsFOTo2oVry3KQikp8L/81RkXmUIT8FxMwdx1T7DmFwVQikcSDIw== + dependencies: + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + "@noble/hashes" "^1" + bn.js "^5.2.0" + elliptic "^6.5.4" + libsodium-wrappers-sumo "^0.7.11" + "@cosmjs/encoding@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.30.1.tgz#b5c4e0ef7ceb1f2753688eb96400ed70f35c6058" @@ -1932,6 +1945,15 @@ bech32 "^1.1.4" readonly-date "^1.0.0" +"@cosmjs/encoding@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.32.4.tgz#646e0e809f7f4f1414d8fa991fb0ffe6c633aede" + integrity sha512-tjvaEy6ZGxJchiizzTn7HVRiyTg1i4CObRRaTRPknm5EalE13SV+TCHq38gIDfyUeden4fCuaBVEdBR5+ti7Hw== + dependencies: + base64-js "^1.3.0" + bech32 "^1.1.4" + readonly-date "^1.0.0" + "@cosmjs/json-rpc@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.30.1.tgz#16f21305fc167598c8a23a45549b85106b2372bc" @@ -1956,6 +1978,14 @@ "@cosmjs/stream" "^0.32.3" xstream "^11.14.0" +"@cosmjs/json-rpc@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.32.4.tgz#be91eb89ea78bd5dc02d0a9fa184dd6790790f0b" + integrity sha512-/jt4mBl7nYzfJ2J/VJ+r19c92mUKF0Lt0JxM3MXEJl7wlwW5haHAWtzRujHkyYMXOwIR+gBqT2S0vntXVBRyhQ== + dependencies: + "@cosmjs/stream" "^0.32.4" + xstream "^11.14.0" + "@cosmjs/math@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.30.1.tgz#8b816ef4de5d3afa66cb9fdfb5df2357a7845b8a" @@ -1977,6 +2007,13 @@ dependencies: bn.js "^5.2.0" +"@cosmjs/math@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.32.4.tgz#87ac9eadc06696e30a30bdb562a495974bfd0a1a" + integrity sha512-++dqq2TJkoB8zsPVYCvrt88oJWsy1vMOuSOKcdlnXuOA/ASheTJuYy4+oZlTQ3Fr8eALDLGGPhJI02W2HyAQaw== + dependencies: + bn.js "^5.2.0" + "@cosmjs/proto-signing@0.31.3", "@cosmjs/proto-signing@^0.31.0", "@cosmjs/proto-signing@^0.31.3": version "0.31.3" resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.31.3.tgz#20440b7b96fb2cd924256a10e656fd8d4481cdcd" @@ -2045,6 +2082,16 @@ ws "^7" xstream "^11.14.0" +"@cosmjs/socket@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.32.4.tgz#86ab6adf3a442314774c0810b7a7cfcddf4f2082" + integrity sha512-davcyYziBhkzfXQTu1l5NrpDYv0K9GekZCC9apBRvL1dvMc9F/ygM7iemHjUA+z8tJkxKxrt/YPjJ6XNHzLrkw== + dependencies: + "@cosmjs/stream" "^0.32.4" + isomorphic-ws "^4.0.1" + ws "^7" + xstream "^11.14.0" + "@cosmjs/stargate@0.31.3", "@cosmjs/stargate@^0.31.0", "@cosmjs/stargate@^0.31.3": version "0.31.3" resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.31.3.tgz#a2b38e398097a00f897dbd8f02d4d347d8fed818" @@ -2118,6 +2165,13 @@ dependencies: xstream "^11.14.0" +"@cosmjs/stream@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.32.4.tgz#83e1f2285807467c56d9ea0e1113f79d9fa63802" + integrity sha512-Gih++NYHEiP+oyD4jNEUxU9antoC0pFSg+33Hpp0JlHwH0wXhtD3OOKnzSfDB7OIoEbrzLJUpEjOgpCp5Z+W3A== + dependencies: + xstream "^11.14.0" + "@cosmjs/tendermint-rpc@0.31.3", "@cosmjs/tendermint-rpc@^0.31.0", "@cosmjs/tendermint-rpc@^0.31.3": version "0.31.3" resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.31.3.tgz#d1a2bc5b3c98743631c9b55888589d352403c9b3" @@ -2166,6 +2220,22 @@ readonly-date "^1.0.0" xstream "^11.14.0" +"@cosmjs/tendermint-rpc@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.32.4.tgz#b36f9ec657498e42c97e21bb7368798ef6279752" + integrity sha512-MWvUUno+4bCb/LmlMIErLypXxy7ckUuzEmpufYYYd9wgbdCXaTaO08SZzyFM5PI8UJ/0S2AmUrgWhldlbxO8mw== + dependencies: + "@cosmjs/crypto" "^0.32.4" + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/json-rpc" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/socket" "^0.32.4" + "@cosmjs/stream" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + axios "^1.6.0" + readonly-date "^1.0.0" + xstream "^11.14.0" + "@cosmjs/utils@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.30.1.tgz#6d92582341be3c2ec8d82090253cfa4b7f959edb" @@ -2181,6 +2251,11 @@ resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.32.3.tgz#5dcaee6dd7cc846cdc073e9a7a7f63242f5f7e31" integrity sha512-WCZK4yksj2hBDz4w7xFZQTRZQ/RJhBX26uFHmmQFIcNUUVAihrLO+RerqJgk0dZqC42wstM9pEUQGtPmLcIYvg== +"@cosmjs/utils@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.32.4.tgz#a9a717c9fd7b1984d9cefdd0ef6c6f254060c671" + integrity sha512-D1Yc+Zy8oL/hkUkFUL/bwxvuDBzRGpc4cF7/SkdhxX4iHpSLgdOuTt1mhCh9+kl6NQREy9t7SYZ6xeW5gFe60w== + "@csstools/normalize.css@*": version "12.1.1" resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-12.1.1.tgz#f0ad221b7280f3fc814689786fd9ee092776ef8f" @@ -4409,11 +4484,35 @@ tronweb "5.3.2" ts-protoc-gen "^0.15.0" +"@oraichain/ton-bridge-contracts@^0.15.8": + version "0.15.8" + resolved "https://registry.yarnpkg.com/@oraichain/ton-bridge-contracts/-/ton-bridge-contracts-0.15.8.tgz#7e5842bbb8cec6ac70319db2df0c961416d0d18a" + integrity sha512-0ZPIygoo+1pz7jp1Rv74P8tYltnLaX4y6bPhGP3S/OHGN1LiIyPE+ch08Ng+AqgYkt54uycJoyMKDCLXzNacCw== + dependencies: + "@cosmjs/tendermint-rpc" "^0.32.4" + "@orbs-network/ton-access" "^2.3.3" + "@types/varstruct" "^6.1.3" + cosmjs-types "^0.9.0" + dotenv "^16.4.5" + varstruct "^6.1.3" + +"@oraichain/tonbridge-contracts-sdk@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@oraichain/tonbridge-contracts-sdk/-/tonbridge-contracts-sdk-1.3.0.tgz#b03f28005722604fe4d557dd8e58ef214ade5874" + integrity sha512-yTGlH5Oyq6s3cj63EJoBx+n4YxqhN6EcC8I0h9HmlOnGxzZgLY3AUkFjkFPgn5prH9dIfixhXnfh/TPXq0j9Pw== + "@oraichain/wasm-json-toolkit@^1.0.24": version "1.0.24" resolved "https://registry.yarnpkg.com/@oraichain/wasm-json-toolkit/-/wasm-json-toolkit-1.0.24.tgz#e9a431560e8e946fbb7ec257e5f13d9320ffd23a" integrity sha512-j+8gN3dE3rqaiEUVVblt0dfJrE6RIsSkfqF08ISxRvHkH9Pe9exIOgxpCyd2Qn3liHj27hwth6R0ELw7y3QcLg== +"@orbs-network/ton-access@^2.3.3": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@orbs-network/ton-access/-/ton-access-2.3.3.tgz#20292f83b52a75f451f185821180a7d9b829bcd3" + integrity sha512-b1miCPts7wBG9JKYgzXIRZQm/LMy5Uk1mNK8NzlcXHL3HRHJkkFbuYJGuj3IkWCiIicW3Ipp4sYnn3Fwo4oB0g== + dependencies: + isomorphic-fetch "^3.0.0" + "@peculiar/asn1-schema@^2.3.8": version "2.3.8" resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.8.tgz#04b38832a814e25731232dd5be883460a156da3b" @@ -5164,6 +5263,40 @@ dependencies: tippy.js "^6.3.1" +"@ton/core@^0.56.3": + version "0.56.3" + resolved "https://registry.yarnpkg.com/@ton/core/-/core-0.56.3.tgz#1162764573abb76032eba70f8497e5cb2ea532ee" + integrity sha512-HVkalfqw8zqLLPehtq0CNhu5KjVzc7IrbDwDHPjGoOSXmnqSobiWj8a5F+YuWnZnEbQKtrnMGNOOjVw4LG37rg== + dependencies: + symbol.inspect "1.0.1" + +"@ton/crypto-primitives@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@ton/crypto-primitives/-/crypto-primitives-2.1.0.tgz#8c9277c250b59aae3c819e0d6bd61e44d998e9ca" + integrity sha512-PQesoyPgqyI6vzYtCXw4/ZzevePc4VGcJtFwf08v10OevVJHVfW238KBdpj1kEDQkxWLeuNHEpTECNFKnP6tow== + dependencies: + jssha "3.2.0" + +"@ton/crypto@^3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@ton/crypto/-/crypto-3.3.0.tgz#019103df6540fbc1d8102979b4587bc85ff9779e" + integrity sha512-/A6CYGgA/H36OZ9BbTaGerKtzWp50rg67ZCH2oIjV1NcrBaCK9Z343M+CxedvM7Haf3f/Ee9EhxyeTp0GKMUpA== + dependencies: + "@ton/crypto-primitives" "2.1.0" + jssha "3.2.0" + tweetnacl "1.0.3" + +"@ton/ton@^14.0.0": + version "14.0.0" + resolved "https://registry.yarnpkg.com/@ton/ton/-/ton-14.0.0.tgz#a66fbbfb159200892557442039a0341cda71fc2d" + integrity sha512-xb2CY6U0AlHUKc7DV7xK/K4Gqn6YoR253yUrM2E7L5WegVFsDF0CQRUIfpYACCuj1oUywQc5J2oMolYNu/uGkA== + dependencies: + axios "^1.6.7" + dataloader "^2.0.0" + symbol.inspect "1.0.1" + teslabot "^1.3.0" + zod "^3.21.4" + "@tonconnect/isomorphic-eventsource@^0.0.2": version "0.0.2" resolved "https://registry.yarnpkg.com/@tonconnect/isomorphic-eventsource/-/isomorphic-eventsource-0.0.2.tgz#e58c44cf9953e090f2c35da9a638946ddb614be5" @@ -5829,6 +5962,13 @@ resolved "https://registry.yarnpkg.com/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz#b6725d5f4af24ace33b36fafd295136e75509f43" integrity sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA== +"@types/varstruct@^6.1.3": + version "6.1.3" + resolved "https://registry.yarnpkg.com/@types/varstruct/-/varstruct-6.1.3.tgz#dad39ad875eef0a9b9d63ae4e503cc3d5c456955" + integrity sha512-LgivtaEn0RHmVk+CHnIS95CtkV0xMAT6u1hPlr6qXNmYnDUU7ZhXM5fM7/byytaqXk7fNX8B/ibN1xpxe+X+hg== + dependencies: + "@types/node" "*" + "@types/ws@8.5.9": version "8.5.9" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.9.tgz#384c489f99c83225a53f01ebc3eddf3b8e202a8c" @@ -8967,7 +9107,7 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" -dataloader@^2.2.2: +dataloader@^2.0.0, dataloader@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.2.2.tgz#216dc509b5abe39d43a9b9d97e6e5e473dfbe3e0" integrity sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g== @@ -9367,7 +9507,7 @@ dotenv@^10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== -dotenv@^16.0.0, dotenv@^16.3.1: +dotenv@^16.0.0, dotenv@^16.3.1, dotenv@^16.4.5: version "16.4.5" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== @@ -11986,6 +12126,11 @@ install-artifact-from-github@^1.3.5: resolved "https://registry.yarnpkg.com/install-artifact-from-github/-/install-artifact-from-github-1.3.5.tgz#88c96fe40e5eb21d45586d564208c648a1dbf38d" integrity sha512-gZHC7f/cJgXz7MXlHFBxPVMsvIbev1OQN1uKQYKVJDydGNm9oYf9JstbU4Atnh/eSvk41WtEovoRm+8IF686xg== +int53@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/int53/-/int53-0.2.4.tgz#5ed8d7aad6c5c6567cae69aa7ffc4a109ee80f86" + integrity sha512-a5jlKftS7HUOhkUyYD7j2sJ/ZnvWiNlZS1ldR+g1ifQ+/UuZXIE+YTc/lK1qGj/GwAU5F8Z0e1eVq2t1J5Ob2g== + internal-slot@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.6.tgz#37e756098c4911c5e912b8edbf71ed3aa116f930" @@ -13360,6 +13505,11 @@ jsprim@^1.2.2: json-schema "0.4.0" verror "1.10.0" +jssha@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/jssha/-/jssha-3.2.0.tgz#88ec50b866dd1411deaddbe6b3e3692e4c710f16" + integrity sha512-QuruyBENDWdN4tZwJbQq7/eAK85FqrI4oDbXjy5IBhYD+2pTJyBUWZe8ctWaCkrV0gy6AaelgOZZBMeswEa/6Q== + "jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.3.5: version "3.3.5" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz#4766bd05a8e2a11af222becd19e15575e52a853a" @@ -18039,6 +18189,11 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== +symbol.inspect@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/symbol.inspect/-/symbol.inspect-1.0.1.tgz#e13125b8038c4996eb0dfa1567332ad4dcd0763f" + integrity sha512-YQSL4duoHmLhsTD1Pw8RW6TZ5MaTX5rXJnqacJottr2P2LZBF/Yvrc3ku4NUpMOm8aM0KOCqM+UAkMA5HWQCzQ== + table-layout@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-3.0.2.tgz#69c2be44388a5139b48c59cf21e73b488021769a" @@ -18173,6 +18328,11 @@ terser@^5.0.0, terser@^5.10.0, terser@^5.26.0: commander "^2.20.0" source-map-support "~0.5.20" +teslabot@^1.3.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/teslabot/-/teslabot-1.5.0.tgz#70f544516699ca5f696d8ae94f3d12cd495d5cd6" + integrity sha512-e2MmELhCgrgZEGo7PQu/6bmYG36IDH+YrBI1iGm6jovXkeDIGa3pZ2WSqRjzkuw2vt1EqfkZoV5GpXgqL8QJVg== + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -18519,16 +18679,16 @@ tweetnacl-util@^0.15.1: resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz#b80fcdb5c97bcc508be18c44a4be50f022eea00b" integrity sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw== +tweetnacl@1.0.3, tweetnacl@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== -tweetnacl@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" - integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -18998,6 +19158,14 @@ value-or-promise@^1.0.11, value-or-promise@^1.0.12: resolved "https://registry.yarnpkg.com/value-or-promise/-/value-or-promise-1.0.12.tgz#0e5abfeec70148c78460a849f6b003ea7986f15c" integrity sha512-Z6Uz+TYwEqE7ZN50gwn+1LCVo9ZVrpxRPOhOLnncYkY1ZzOYtrX8Fwf/rFktZ8R5mJms6EZf5TqNOMeZmnPq9Q== +varstruct@^6.1.3: + version "6.1.3" + resolved "https://registry.yarnpkg.com/varstruct/-/varstruct-6.1.3.tgz#45a8a073e41fb88adb10bc71158c945e20c57fbe" + integrity sha512-4l1Q7uxrVUBZXsMcb2cakrZL6gd4G+Ykn/m9cGnT4EY8iRBPkxOxKVDwOnL9AsIPKmREBx5BDqjfNMKKP6Zy2w== + dependencies: + int53 "^0.2.4" + safe-buffer "^5.1.1" + varuint-bitcoin@^1.0.4, varuint-bitcoin@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz#e76c138249d06138b480d4c5b40ef53693e24e92" @@ -19879,3 +20047,8 @@ zip-stream@^4.1.0: archiver-utils "^3.0.4" compress-commons "^4.1.2" readable-stream "^3.6.0" + +zod@^3.21.4: + version "3.23.8" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" + integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== From c6382f1ce8a41337dc5be9b53f45b2600196fa87 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Thu, 31 Oct 2024 18:07:18 +0700 Subject: [PATCH 03/21] fix: update theme bridge --- src/components/CheckBox.module.scss | 21 +++-- .../SelectTokenModal.module.scss | 18 ++-- .../SlippageModal/SlippageModal.module.scss | 25 +++-- src/config/chainInfos.ts | 21 ++--- src/config/iconInfos.ts | 6 ++ src/pages/Balance/Balance.module.scss | 33 ++++--- .../Balance/StuckOraib/style.module.scss | 86 ++++++++--------- src/pages/Balance/TokenItem/index.module.scss | 42 ++++++--- .../TransferConvertToken/index.module.scss | 93 ++++++++++++------- .../ConvertBitcoinV2/index.module.scss | 4 +- .../components/Header/Header.module.scss | 4 +- src/styles/_themes.scss | 6 +- yarn.lock | 91 +++++++++++++++--- 13 files changed, 288 insertions(+), 162 deletions(-) diff --git a/src/components/CheckBox.module.scss b/src/components/CheckBox.module.scss index 7fec28f6c..bb7a11d69 100644 --- a/src/components/CheckBox.module.scss +++ b/src/components/CheckBox.module.scss @@ -30,8 +30,11 @@ left: 0; height: 16px; width: 16px; - border: 1px solid $blue-color; transform: translateY(-50%); + + @include theme { + border: 1px solid theme-get('primary-surface-default-dark-3'); + } } .radioBox { @@ -40,14 +43,16 @@ /* On mouse-over, add a grey background color */ .container:hover input ~ .checkmark { - border-color: $blue-color; + @include theme { + border-color: theme-get('primary-surface-default-dark-3'); + } } /* When the checkbox is checked, add a blue background */ .container input:checked ~ .checkmark { - border-color: $blue-color; - @include theme() { - background-color: theme-get('bg-color'); + @include theme { + border-color: theme-get('primary-surface-default-dark-3'); + background-color: theme-get('neutral-6'); } } @@ -69,9 +74,11 @@ top: 1px; width: 5px; height: 10px; - border: solid $blue-color; - border-width: 0 2px 2px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); + @include theme { + border: solid theme-get('primary-surface-default-dark-3'); + border-width: 0 2px 2px 0; + } } diff --git a/src/components/Modals/SelectTokenModal/SelectTokenModal.module.scss b/src/components/Modals/SelectTokenModal/SelectTokenModal.module.scss index 4c6e1aa08..263019a4b 100644 --- a/src/components/Modals/SelectTokenModal/SelectTokenModal.module.scss +++ b/src/components/Modals/SelectTokenModal/SelectTokenModal.module.scss @@ -1,5 +1,5 @@ @import 'src/styles/themes'; -@import "src/styles/mixins"; +@import 'src/styles/mixins'; .select { background: #141416; @@ -28,7 +28,7 @@ /* aiRight/White */ &.light { - color: #6F767E; + color: #6f767e; } } @@ -42,11 +42,10 @@ .item { &.light { &.light { - color: #6F767E; - } + color: #6f767e; + } } - border-radius: 8px; display: flex; gap: 10px; @@ -69,12 +68,13 @@ &:hover { cursor: pointer; - background: #333642; + background: #232521; + opacity: 0.7; } &.light:hover { - background-color: $blue-color; - color: #fff; + background-color: #f7f7f7; + opacity: 0.7; } .logo { @@ -99,4 +99,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/components/Modals/SlippageModal/SlippageModal.module.scss b/src/components/Modals/SlippageModal/SlippageModal.module.scss index 45c67e4bb..3246454a6 100644 --- a/src/components/Modals/SlippageModal/SlippageModal.module.scss +++ b/src/components/Modals/SlippageModal/SlippageModal.module.scss @@ -1,9 +1,9 @@ -@import "src/styles/mixins"; +@import 'src/styles/mixins'; .setting { border-radius: 8px; padding: 20px 24px 24px; - border: 1px solid #A871DF; + border: 1px solid #a871df; .header { display: flex; @@ -21,7 +21,7 @@ line-height: 100%; /* identical to box height, or 18px */ text-align: center; - color: #F0B90B; + color: #f0b90b; img { margin-right: 10px; @@ -34,14 +34,13 @@ height: 18px; path { - fill: #777E91; + fill: #777e91; } } } - .subtitle { - color: #A871DF; + color: #a871df; font-size: 16px; font-style: normal; font-weight: 500; @@ -70,7 +69,7 @@ border-radius: 4px; padding: 6px 14px; margin: 0 4px; - color: #A871DF; + color: #a871df; .input { max-width: 40px; @@ -88,7 +87,7 @@ } .isChosen { - border: 1px solid #A871DF; + border: 1px solid #a871df; opacity: 1; } } @@ -115,22 +114,22 @@ } .light-modal { - background-color: #FCFCFC; + background-color: #fcfcfc; box-shadow: 0px 4px 24px rgba(0, 0, 0, 0.05); .options { .item { - background: #EEE7FF; + background: #eee7ff; } } } .dark-modal { - background-color: #2B2D3B; + background-color: #232521; .options { .item { - background: #423A56; + background: #423a56; } } -} \ No newline at end of file +} diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index 4d989740d..14b0fc8e0 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -211,17 +211,14 @@ export const OraiToken: BridgeAppCurrency = { export const oraichainNetwork: CustomChainInfo = { ...customOraichainNetwork, - currencies: [ - ...customOraichainNetwork.currencies - // { - // coinDenom: 'BTC V2', - // coinGeckoId: 'bitcoin', - // coinMinimalDenom: CWBitcoinFactoryDenom, - // bridgeTo: ['bitcoin'] as any, - // coinDecimals: 14 as any, - // coinImageUrl: 'https://s2.coinmarketcap.com/static/img/coins/64x64/1.png' - // } - ] + currencies: [...customOraichainNetwork.currencies].map((tk) => { + if (tk.coinGeckoId === 'the-open-network') { + const bridgeToken = { ...tk, bridgeTo: [TonChainId, 'osmosis-1'] }; + return bridgeToken; + } + + return tk; + }) }; export const OraiBTCBridgeNetwork = { @@ -278,7 +275,7 @@ export const OraiBTCBridgeNetwork = { } }; -export const chainInfosWithSdk = [...customChainInfos, bitcoinMainnet, oraibtcNetwork]; +export const chainInfosWithSdk = [...customChainInfos, bitcoinMainnet, oraibtcNetwork, tonNetworkMainnet]; export const chainInfos = mapListWithIcon(chainInfosWithSdk, chainIcons, 'chainId'); // exclude kawaiverse subnet and other special evm that has different cointype diff --git a/src/config/iconInfos.ts b/src/config/iconInfos.ts index 6de52b29f..cd0ab8be1 100644 --- a/src/config/iconInfos.ts +++ b/src/config/iconInfos.ts @@ -29,6 +29,7 @@ import CatIcon from 'assets/icons/icon-simoncat.svg?react'; import HmstrIcon from 'assets/icons/hmstr.svg?react'; import { CustomChainInfo, TokenItemType } from '@oraichain/oraidex-common'; import { bitcoinChainId } from 'helper/constants'; +import { TonChainId } from 'context/ton-provider'; export type TokenIcon = Pick; export type ChainIcon = Pick; @@ -236,6 +237,11 @@ export const chainIconsInfos: ChainIcon[] = [ chainId: 'celestia', Icon: CelestiaIcon, IconLight: CelestiaIcon + }, + { + chainId: TonChainId, + Icon: TonIcon, + IconLight: TonIcon } ]; diff --git a/src/pages/Balance/Balance.module.scss b/src/pages/Balance/Balance.module.scss index 642f89073..a15f7ad3f 100644 --- a/src/pages/Balance/Balance.module.scss +++ b/src/pages/Balance/Balance.module.scss @@ -94,10 +94,8 @@ width: 100%; } - background: #2b2d3b; - - &.light { - background-color: $light-bg-primary-box; + @include theme { + background: theme-get('neutral-surface-bg-btn-disabled'); } text-align: center; @@ -131,7 +129,7 @@ &_form { width: 420px; - background: #2b2d3b; + background: #232521; border-radius: 8px; padding: 12px; height: 56px; @@ -173,9 +171,9 @@ flex-direction: row; .tfBtn { + background-color: $primary-bg-btn; @include theme() { - background-color: theme-get('bg-btn-primary'); - box-shadow: theme-get('shadow-btn'); + color: theme-get('neutral-text-text-btn-default'); } border-radius: 8px; @@ -273,11 +271,11 @@ &_element { margin-bottom: 20px; - background-color: #191b21; + background-color: #232521; border-radius: 16px; &.light { - background-color: $light-bg-primary-box; + background-color: #f7f7f7; } } } @@ -285,11 +283,11 @@ .balances { display: flex; justify-content: center; - padding-top: 12px; + padding: 12px 8px 0 8px; width: 100%; - .light { - color: #a871df; + @include theme { + color: theme-get('colors-neutral-text-text-token-name'); } .box { @@ -320,7 +318,16 @@ } :hover { - color: #a871df; + text-decoration: underline; + filter: brightness(1.5); + } + + svg { + path { + @include theme { + fill: theme-get('primary-surface-default-dark-3'); + } + } } } } diff --git a/src/pages/Balance/StuckOraib/style.module.scss b/src/pages/Balance/StuckOraib/style.module.scss index 6afd0a774..d76284e25 100644 --- a/src/pages/Balance/StuckOraib/style.module.scss +++ b/src/pages/Balance/StuckOraib/style.module.scss @@ -1,56 +1,56 @@ @import 'src/styles/mixins'; -.icon{ - margin-right: 20px; +.icon { + margin-right: 20px; } .bridgeBalances { - padding: 9px 12px; - border-radius: 8px; - background-color: #2B2D3B; - display: flex; - align-items: center; - justify-content: space-between; - border: 1px solid transparent; - position: sticky; - top: 0; - float: right; - &:hover { - border-color: #A871DF; - } - - .stuckText { - margin: 0 10px; - cursor: pointer; + padding: 9px 12px; + border-radius: 8px; + background-color: #232521; + display: flex; + align-items: center; + justify-content: space-between; + border: 1px solid transparent; + position: sticky; + top: 0; + float: right; + + &:hover { + border-color: #a871df; + } + + .stuckText { + margin: 0 10px; + cursor: pointer; + } + + .loading { + @include desktop { + width: 50%; + height: 180px; } - - .loading { - @include desktop { - width: 50%; - height: 180px; - } - - @include flex(); - } + @include flex(); + } } .stuckToken { - display: flex; - justify-content: space-between; - align-items: center; - padding: 7px 10px; + display: flex; + justify-content: space-between; + align-items: center; + padding: 7px 10px; - &:hover { - background-color: #2B2D3B; - } + &:hover { + background-color: #232521; + } - &>div { - display: flex; - align-items: center; - } + & > div { + display: flex; + align-items: center; + } - .name { - margin-left: 10px; - } -} \ No newline at end of file + .name { + margin-left: 10px; + } +} diff --git a/src/pages/Balance/TokenItem/index.module.scss b/src/pages/Balance/TokenItem/index.module.scss index da2da0dbb..4a0523237 100644 --- a/src/pages/Balance/TokenItem/index.module.scss +++ b/src/pages/Balance/TokenItem/index.module.scss @@ -70,7 +70,9 @@ font-size: 14px; line-height: 150%; text-align: center; - color: #777e90; + @include theme() { + color: theme-get('neutral-8'); + } align-self: flex-start; margin: 8px 8px 8px 0; } @@ -87,13 +89,13 @@ } .tokenWrapper:hover { - background: #2b2d3b; + background: #232521a5; box-sizing: border-box; } .tokenWrapper.light:hover { background-color: #fcfcfc; - border: 1px solid $blue-color; + border: 1px solid $primary-surface-default-light; } .tokenWrapper { @@ -127,11 +129,11 @@ } &.active { - background: #191b21; + background: #131412; &.light { - background-color: #fcfcfc; + background-color: #f7f7f7; } - border: 1px solid #a871df; + border: 1px solid #2f5711; box-sizing: border-box; border-radius: 12px; @@ -187,7 +189,10 @@ font-weight: 600; font-size: 16px; line-height: 100%; - color: #777e90; + + @include theme { + color: theme-get('neutral-8'); + } &.token { align-self: flex-end; @@ -208,24 +213,39 @@ .balanceBtn { cursor: pointer; - background: #191b21; border-radius: 8px; padding: 8px; margin-left: 4px; margin-right: 4px; - color: #a871df; + + @include theme { + border: 1px solid transparent; + background: theme-get('primary-surface-default-subtle'); + color: theme-get('primary-surface-default-dark-3'); + } + + &:hover { + @include theme { + border: 1px solid theme-get('primary-surface-default-dark-3'); + } + } } } .amount { text-align: right; - background: #1e1e21; border-radius: 8px; height: 48px; width: 180px; padding: 12px; box-sizing: border-box; - color: #505665; + // background: #1e1e21; + // color: #505665; + + @include theme { + background: theme-get('neutral-surface-bg-box'); + color: theme-get('colors-neutral-text-text-token-name'); + } font-weight: 600; font-size: 24px; diff --git a/src/pages/Balance/TransferConvertToken/index.module.scss b/src/pages/Balance/TransferConvertToken/index.module.scss index 190bc933e..477301413 100644 --- a/src/pages/Balance/TransferConvertToken/index.module.scss +++ b/src/pages/Balance/TransferConvertToken/index.module.scss @@ -4,12 +4,6 @@ .fastMode { margin-top: 8px; - - .switch { - &::before { - background-color: #8363c9; - } - } } .transferTab { @@ -17,12 +11,11 @@ margin-top: 20px; .tfBtn { + background-color: $primary-bg-btn; @include theme() { - background-color: theme-get('bg-btn-primary'); - box-shadow: theme-get('shadow-btn'); + color: theme-get('neutral-text-text-btn-default'); } - color: $white-color; border-radius: 8px; padding: 16px; @include flex(); @@ -58,7 +51,9 @@ font-size: 14px; line-height: 150%; text-align: center; - color: #777e90; + @include theme() { + color: theme-get('neutral-8'); + } align-self: flex-start; margin: 8px 8px 8px 0; } @@ -96,7 +91,10 @@ font-weight: 600; font-size: 16px; line-height: 100%; - color: #777e90; + + @include theme { + color: theme-get('neutral-8'); + } &.token { align-self: flex-end; @@ -120,8 +118,19 @@ } .balanceBtn { + @include theme { + border: 1px solid transparent; + background: theme-get('primary-surface-default-subtle'); + color: theme-get('primary-surface-default-dark-3'); + } + + &:hover { + @include theme { + border: 1px solid theme-get('primary-surface-default-dark-3'); + } + } + cursor: pointer; - background: #191b21; border-radius: 8px; width: 66px; padding: 10px; @@ -137,26 +146,22 @@ margin-left: 8px; padding: 6px; } - - color: #a871df; } } .amount { text-align: left; - background: #2b2d3b; border-radius: 8px; height: 48px; width: 180px; padding: 12px; box-sizing: border-box; - color: #ebebeb; font-weight: 600; font-size: 24px; - &.light { - background: #efefef; - color: $light-text-color; + @include theme { + background: theme-get('neutral-surface-bg-btn-disabled'); + color: theme-get('colors-neutral-text-text-token-name'); } @include mobile { @@ -188,14 +193,21 @@ } .balanceBtn { - background: #2e283d; - font-weight: 500; - border-radius: 8px; + @include theme { + border: 1px solid transparent; + background: theme-get('primary-surface-default-subtle'); + color: theme-get('primary-surface-default-dark-3'); + } - &.light { - background-color: #efe6f8; + &:hover { + @include theme { + border: 1px solid theme-get('primary-surface-default-dark-3'); + } } + font-weight: 500; + border-radius: 8px; + @include desktop { width: 66px; font-size: 16px; @@ -207,7 +219,6 @@ } height: 48px; - color: #a871df; text-align: center; } @@ -218,8 +229,9 @@ display: flex; gap: 10px; - &.light { - background-color: $blue-color; + background-color: $primary-bg-btn; + @include theme() { + color: theme-get('neutral-text-text-btn-default'); } } } @@ -270,12 +282,15 @@ .address { margin-left: 10px; border-radius: 8px; - border: 1px solid #777e90; padding: 2px 8px; - color: #777e90; font-size: 13px; display: flex; justify-content: center; + + @include theme { + color: theme-get('neutral-8'); + border: 1px solid theme-get('neutral-8'); + } } } } @@ -286,13 +301,13 @@ cursor: pointer; &_filter { - background: #2b2d3b; text-align: center; border-radius: 8px; padding: 12px; - &.light { - background: #efefef; + @include theme { + background: theme-get('neutral-surface-bg-btn-disabled'); + color: theme-get('neutral-8'); } } @@ -356,8 +371,8 @@ .items { position: absolute; width: 100%; - background: #2b2d3b; - border: 1.5px solid #5a5270; + background: #232521; + box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.1); z-index: 1; &_chain { @@ -375,13 +390,19 @@ li { padding: 12px 24px 12px 24px; + border-radius: 8px; } li:hover { - background-color: #703cde; + @include theme { + background-color: theme-get('neutral-6'); + } + filter: brightness(1.25); div { - color: $white-color; + @include theme { + color: theme-get('neutral-8'); + } } } diff --git a/src/pages/BitcoinDashboardV2/components/ConvertBitcoinV2/index.module.scss b/src/pages/BitcoinDashboardV2/components/ConvertBitcoinV2/index.module.scss index 48ff95638..d3484e43f 100644 --- a/src/pages/BitcoinDashboardV2/components/ConvertBitcoinV2/index.module.scss +++ b/src/pages/BitcoinDashboardV2/components/ConvertBitcoinV2/index.module.scss @@ -37,7 +37,7 @@ .title { @include theme { - color: theme-get('neutral-9'); + color: theme-get('neutral-8'); } font-size: 14px; @@ -119,7 +119,7 @@ .usd { @include theme { - color: theme-get('neutral-9'); + color: theme-get('neutral-8'); } font-size: 14px; font-weight: 400; diff --git a/src/pages/BitcoinDashboardV2/components/Header/Header.module.scss b/src/pages/BitcoinDashboardV2/components/Header/Header.module.scss index af9b5d6b6..e12d94146 100644 --- a/src/pages/BitcoinDashboardV2/components/Header/Header.module.scss +++ b/src/pages/BitcoinDashboardV2/components/Header/Header.module.scss @@ -13,7 +13,6 @@ flex-wrap: wrap; margin-bottom: 16px; - &_text { display: flex; align-items: flex-end; @@ -28,7 +27,7 @@ .priceOrai { @include theme() { - color: theme-get('neutral-9'); + color: theme-get('neutral-8'); } font-size: 24px; font-weight: 500; @@ -118,7 +117,6 @@ flex-direction: column; flex: 1 0 0; - color: $neutron-text-body-light; font-size: 16px; font-weight: 500; diff --git a/src/styles/_themes.scss b/src/styles/_themes.scss index 8259cc75c..89ed6c368 100644 --- a/src/styles/_themes.scss +++ b/src/styles/_themes.scss @@ -159,7 +159,8 @@ $themes: ( 'neutral-text-btn-default': #152703, 'neutral-surface-bg-3': #f7f7f7, 'neutral-surface-bg-swap': #1b1d19, - 'neutral-surface-bg-strong': #131412 + 'neutral-surface-bg-strong': #131412, + 'neutral-surface-bg-box': #232521 ), light: ( 'warning-surface-default-subtle': #fffdeb, @@ -266,6 +267,7 @@ $themes: ( 'bg-overlay-section': rgba(255, 255, 255, 0.5), 'neutral-surface-bg-3': #181a17, 'neutral-surface-bg-swap': #fff, - 'neutral-surface-bg-strong': #f2f4f0 + 'neutral-surface-bg-strong': #f2f4f0, + 'neutral-surface-bg-box': #f2f4f0 ) ); diff --git a/yarn.lock b/yarn.lock index 063fe545d..f49f09640 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1109,6 +1109,19 @@ elliptic "^6.5.4" libsodium-wrappers-sumo "^0.7.11" +"@cosmjs/crypto@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.32.4.tgz#5d29633b661eaf092ddb3e7ea6299cfd6f4507a2" + integrity sha512-zicjGU051LF1V9v7bp8p7ovq+VyC91xlaHdsFOTo2oVry3KQikp8L/81RkXmUIT8FxMwdx1T7DmFwVQikcSDIw== + dependencies: + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + "@noble/hashes" "^1" + bn.js "^5.2.0" + elliptic "^6.5.4" + libsodium-wrappers-sumo "^0.7.11" + "@cosmjs/encoding@^0.20.0": version "0.20.1" resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.20.1.tgz#1d1162b3eca51b7244cd45102e313612cea77281" @@ -1196,6 +1209,14 @@ "@cosmjs/stream" "^0.32.3" xstream "^11.14.0" +"@cosmjs/json-rpc@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.32.4.tgz#be91eb89ea78bd5dc02d0a9fa184dd6790790f0b" + integrity sha512-/jt4mBl7nYzfJ2J/VJ+r19c92mUKF0Lt0JxM3MXEJl7wlwW5haHAWtzRujHkyYMXOwIR+gBqT2S0vntXVBRyhQ== + dependencies: + "@cosmjs/stream" "^0.32.4" + xstream "^11.14.0" + "@cosmjs/launchpad@^0.24.0-alpha.25", "@cosmjs/launchpad@^0.24.1": version "0.24.1" resolved "https://registry.yarnpkg.com/@cosmjs/launchpad/-/launchpad-0.24.1.tgz#fe7e80734dfd60ea093429a646d7a38634c70134" @@ -1465,6 +1486,22 @@ readonly-date "^1.0.0" xstream "^11.14.0" +"@cosmjs/tendermint-rpc@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.32.4.tgz#b36f9ec657498e42c97e21bb7368798ef6279752" + integrity sha512-MWvUUno+4bCb/LmlMIErLypXxy7ckUuzEmpufYYYd9wgbdCXaTaO08SZzyFM5PI8UJ/0S2AmUrgWhldlbxO8mw== + dependencies: + "@cosmjs/crypto" "^0.32.4" + "@cosmjs/encoding" "^0.32.4" + "@cosmjs/json-rpc" "^0.32.4" + "@cosmjs/math" "^0.32.4" + "@cosmjs/socket" "^0.32.4" + "@cosmjs/stream" "^0.32.4" + "@cosmjs/utils" "^0.32.4" + axios "^1.6.0" + readonly-date "^1.0.0" + xstream "^11.14.0" + "@cosmjs/utils@^0.20.0": version "0.20.1" resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.20.1.tgz#4d239b7d93c15523cdf109f225cbf61326fb69cd" @@ -1490,6 +1527,11 @@ resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.32.3.tgz#5dcaee6dd7cc846cdc073e9a7a7f63242f5f7e31" integrity sha512-WCZK4yksj2hBDz4w7xFZQTRZQ/RJhBX26uFHmmQFIcNUUVAihrLO+RerqJgk0dZqC42wstM9pEUQGtPmLcIYvg== +"@cosmjs/utils@^0.32.4": + version "0.32.4" + resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.32.4.tgz#a9a717c9fd7b1984d9cefdd0ef6c6f254060c671" + integrity sha512-D1Yc+Zy8oL/hkUkFUL/bwxvuDBzRGpc4cF7/SkdhxX4iHpSLgdOuTt1mhCh9+kl6NQREy9t7SYZ6xeW5gFe60w== + "@dabh/diagnostics@^2.0.2": version "2.0.3" resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a" @@ -3325,6 +3367,23 @@ "@cosmjs/crypto" "0.31.3" "@cosmjs/proto-signing" "0.31.3" +"@oraichain/ton-bridge-contracts@^0.15.8": + version "0.15.9" + resolved "https://registry.yarnpkg.com/@oraichain/ton-bridge-contracts/-/ton-bridge-contracts-0.15.9.tgz#279f78ac434d5df69ccf2e51c01e57484789e91e" + integrity sha512-M4ukzlCkPRS+3S+05g/P+82fXjBCe05kBqpJiaZkUDAN7UDbRQJH480AZWl8HotPiM1Ae2TKNl8GPivNmzmwRA== + dependencies: + "@cosmjs/tendermint-rpc" "^0.32.4" + "@orbs-network/ton-access" "^2.3.3" + "@types/varstruct" "^6.1.3" + cosmjs-types "^0.9.0" + dotenv "^16.4.5" + varstruct "^6.1.3" + +"@oraichain/tonbridge-contracts-sdk@^1.3.0": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@oraichain/tonbridge-contracts-sdk/-/tonbridge-contracts-sdk-1.3.6.tgz#1ee1309e6bb8e186eaa5d706c7d32276ef976402" + integrity sha512-k1DgzfYg3nQNPn2dLiXbkDHXd1WREQA9Dl0ezQ5kPtnlbNK9XjmxSco2gmaJwql0tE3cbBExUflfG0MaRF0dWw== + "@oraichain/wasm-json-toolkit@^1.0.24": version "1.0.24" resolved "https://registry.yarnpkg.com/@oraichain/wasm-json-toolkit/-/wasm-json-toolkit-1.0.24.tgz#e9a431560e8e946fbb7ec257e5f13d9320ffd23a" @@ -6500,7 +6559,7 @@ cjson@^0.3.1: dependencies: json-parse-helpfulerror "^1.0.3" -classnames@*, classnames@^2.2.6, classnames@^2.3.1: +classnames@*, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2: version "2.5.1" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.5.1.tgz#ba774c614be0f016da105c858e7159eae8e7687b" integrity sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow== @@ -7354,7 +7413,7 @@ deep-is@^0.1.3, deep-is@~0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -deepmerge@^4.3.1: +deepmerge@^4.2.2, deepmerge@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== @@ -7524,7 +7583,7 @@ dot-prop@^5.2.0: dependencies: is-obj "^2.0.0" -dotenv@^16.0.0, dotenv@^16.3.1: +dotenv@^16.0.0, dotenv@^16.3.1, dotenv@^16.4.5: version "16.4.5" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== @@ -9511,6 +9570,11 @@ install-artifact-from-github@^1.3.5: resolved "https://registry.yarnpkg.com/install-artifact-from-github/-/install-artifact-from-github-1.3.5.tgz#88c96fe40e5eb21d45586d564208c648a1dbf38d" integrity sha512-gZHC7f/cJgXz7MXlHFBxPVMsvIbev1OQN1uKQYKVJDydGNm9oYf9JstbU4Atnh/eSvk41WtEovoRm+8IF686xg== +int53@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/int53/-/int53-0.2.4.tgz#5ed8d7aad6c5c6567cae69aa7ffc4a109ee80f86" + integrity sha512-a5jlKftS7HUOhkUyYD7j2sJ/ZnvWiNlZS1ldR+g1ifQ+/UuZXIE+YTc/lK1qGj/GwAU5F8Z0e1eVq2t1J5Ob2g== + "internmap@1 - 2", internmap@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/internmap/-/internmap-2.0.3.tgz#6685f23755e43c524e251d29cbc97248e3061009" @@ -10249,6 +10313,11 @@ jsprim@^1.2.2: json-schema "0.4.0" verror "1.10.0" +jssha@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/jssha/-/jssha-3.2.0.tgz#88ec50b866dd1411deaddbe6b3e3692e4c710f16" + integrity sha512-QuruyBENDWdN4tZwJbQq7/eAK85FqrI4oDbXjy5IBhYD+2pTJyBUWZe8ctWaCkrV0gy6AaelgOZZBMeswEa/6Q== + jwa@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a" @@ -13506,7 +13575,7 @@ string-env-interpolation@^1.0.1: resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152" integrity sha512-78lwMoCcn0nNu8LszbP1UA7g55OeE4v7rCeWnM5B453rnNr4aq+5it3FEYtZrSEiMvHZOZ9Jlqb0OD0M2VInqg== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -13561,7 +13630,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -13786,6 +13855,11 @@ temp@^0.9.4: mkdirp "^0.5.1" rimraf "~2.6.2" +teslabot@^1.3.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/teslabot/-/teslabot-1.5.0.tgz#70f544516699ca5f696d8ae94f3d12cd495d5cd6" + integrity sha512-e2MmELhCgrgZEGo7PQu/6bmYG36IDH+YrBI1iGm6jovXkeDIGa3pZ2WSqRjzkuw2vt1EqfkZoV5GpXgqL8QJVg== + test-exclude@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-7.0.1.tgz#20b3ba4906ac20994e275bbcafd68d510264c2a2" @@ -14108,11 +14182,6 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== -tweetnacl@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" - integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== - type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -14785,7 +14854,7 @@ wordwrapjs@^5.1.0: resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-5.1.0.tgz#4c4d20446dcc670b14fa115ef4f8fd9947af2b3a" integrity sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== From 79eac13efbeb4d7363399896f0ef7f6bf5a498db Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Mon, 4 Nov 2024 09:51:35 +0700 Subject: [PATCH 04/21] fix: get fee --- package.json | 2 +- src/config/chainInfos.ts | 56 +- src/helper/index.tsx | 36 ++ src/hooks/useTokenFee.ts | 14 + src/layouts/App.tsx | 6 + .../Balance/TransferConvertToken/index.tsx | 33 +- src/pages/Balance/hooks/useGetFee.ts | 57 +- src/pages/Balance/hooks/useLoadWalletsTon.ts | 50 ++ .../Balance/hooks/useTonBridgeHandler.ts | 600 ++++++++++++++---- src/pages/Balance/index.tsx | 8 +- src/reducer/config.ts | 4 + yarn.lock | 2 +- 12 files changed, 721 insertions(+), 147 deletions(-) create mode 100644 src/pages/Balance/hooks/useLoadWalletsTon.ts diff --git a/package.json b/package.json index a0f1b2705..3bfead7b6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/ton-bridge-contracts": "^0.15.8", - "@oraichain/tonbridge-contracts-sdk": "^1.3.0", + "@oraichain/tonbridge-contracts-sdk": "^1.3.1", "@orbs-network/ton-access": "^2.3.3", "@oraichain/oraidex-contracts-sdk": "1.0.51-beta.3", "@oraichain/oraidex-universal-swap": "1.1.16", diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index 14b0fc8e0..9196fb0b0 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -5,7 +5,8 @@ import { ChainIdEnum, BridgeAppCurrency, CustomChainInfo, - defaultBech32Config + defaultBech32Config, + getTokensFromNetwork } from '@oraichain/oraidex-common'; import BitcoinIcon from 'assets/icons/bitcoin.svg?react'; import OraiIcon from 'assets/icons/oraichain.svg?react'; @@ -14,7 +15,7 @@ import OraiLightIcon from 'assets/icons/oraichain_light.svg?react'; import UsdtIcon from 'assets/icons/tether.svg'; import TonIcon from 'assets/icons/ton.svg'; import flatten from 'lodash/flatten'; -import { TON_SCAN, TonChainId } from 'context/ton-provider'; +import { TON_SCAN, TonChainId, TonNetwork } from 'context/ton-provider'; import { chainIconsInfos, tokensIconInfos, mapListWithIcon } from './iconInfos'; import { CWBitcoinFactoryDenom } from 'helper/constants'; @@ -41,7 +42,7 @@ export const tonNetworkMainnet: CustomChainInfo = { rest: 'https://toncenter.com/api/v2/jsonRPC', rpc: 'https://toncenter.com/api/v2/jsonRPC', chainId: TonChainId, - chainName: 'Ton' as any, + chainName: 'TON' as any, bip44: { coinType: 607 as any }, @@ -187,9 +188,9 @@ export const bitcoinMainnet: CustomChainInfo = { } }; -export const chainInfosWithIcon = mapListWithIcon([...customChainInfos, bitcoinMainnet], chainIcons, 'chainId'); export const oraichainTokensWithIcon = mapListWithIcon(oraichainTokens, tokensIcon, 'coinGeckoId'); export const otherTokensWithIcon = mapListWithIcon(otherChainTokens, tokensIcon, 'coinGeckoId'); +export const tonNetworkTokens = getTokensFromNetwork(tonNetworkMainnet); export const tokensWithIcon = [otherTokensWithIcon, oraichainTokensWithIcon]; export const flattenTokensWithIcon = flatten(tokensWithIcon); @@ -283,4 +284,51 @@ export const evmChains = chainInfos.filter( (c) => c.networkType === 'evm' && c.bip44.coinType === 60 && c.chainId !== '0x1ae6' ); +export const chainInfosWithIcon = mapListWithIcon(chainInfosWithSdk, chainIcons, 'chainId'); + export const btcChains = chainInfos.filter((c) => c.networkType === ('bitcoin' as any)); + +export type AlloyedPool = { + poolId: string; + alloyedToken: string; + sourceToken: string; +}; + +export const OsmosisAlloyedPools: AlloyedPool[] = [ + { + poolId: '2161', + alloyedToken: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON', + sourceToken: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98' + } +]; + +export const OsmosisTokenDenom = { + ton: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98', + allTon: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON' +}; + +export const OsmosisTokenList = [ + { + chainId: 'osmosis-1', + name: 'TON', + symbol: 'TON.orai', + Icon: TonIcon, + contractAddress: null, + denom: OsmosisTokenDenom.ton, + coinMinimalDenom: OsmosisTokenDenom.ton, + coinGeckoId: 'the-open-network', + decimal: 9 + }, + { + chainId: 'osmosis-1', + name: 'TON', + symbol: 'TON', + Icon: TonIcon, + contractAddress: null, + denom: OsmosisTokenDenom.allTon, + coinMinimalDenom: OsmosisTokenDenom.allTon, + coinGeckoId: 'the-open-network', + decimal: 9, + alloyedToken: true + } +]; diff --git a/src/helper/index.tsx b/src/helper/index.tsx index d6975a464..c5e6029ce 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -33,6 +33,8 @@ import { TonChainId } from 'context/ton-provider'; import { toUserFriendlyAddress } from '@tonconnect/ui-react'; import DefaultIcon from 'assets/icons/tokens.svg?react'; import { numberWithCommas } from './format'; +import { getHttpEndpoint } from '@orbs-network/ton-access'; +import { TonClient } from '@ton/ton'; export interface Tokens { denom?: string; @@ -666,3 +668,37 @@ export const getIconToken = ({ isLightTheme, denom, width = 18, height = 18 }) = return ; }; + +export const retryOrbs = async (fn, retryTimes = 30, delay = 2000) => { + try { + return await fn(); + } catch (error) { + let response = error?.response; + let message = response?.data?.error; + if (message?.includes('No working liteservers')) { + await sleep(delay * 2); + return await retryOrbs(fn, retryTimes, delay); + } + if (retryTimes > 0) { + await sleep(delay * 5); + return await retryOrbs(fn, retryTimes - 1, delay); + } + } +}; + +export const getTonClient = async () => { + try { + const endpoint = await getHttpEndpoint({ + network: 'mainnet' + }); + const client = new TonClient({ + endpoint + }); + return client; + } catch (err) { + return new TonClient({ + endpoint: + 'https://ton.access.orbs.network/55013c0ff5Bd3F8B62C092Ab4D238bEE463E5501/1/mainnet/toncenter-api-v2/jsonRPC' + }); + } +}; diff --git a/src/hooks/useTokenFee.ts b/src/hooks/useTokenFee.ts index 95b1a3e18..d6e2400cd 100644 --- a/src/hooks/useTokenFee.ts +++ b/src/hooks/useTokenFee.ts @@ -85,6 +85,14 @@ export const useRelayerFeeToken = (originalFromToken: TokenItemType, originalToT () => { const routerClient = new OraiswapRouterQueryClient(window.client, network.router); const oraiToken = oraichainTokens.find((token) => token.coinGeckoId === 'oraichain-token'); + + if (!oraiToken || !originalToToken) { + return { + displayAmount: 0, + amount: '0' + }; + } + return UniversalSwapHelper.handleSimulateSwap({ originalFromInfo: oraiToken, originalToInfo: originalToToken, @@ -146,6 +154,12 @@ export const useUsdtToBtc = (amount) => { const { data } = useQuery( ['convert-btc-to-usdt', originalFromToken, originalToToken], () => { + if (!originalToToken || !originalFromToken) { + return { + displayAmount: 0, + amount: '0' + }; + } return UniversalSwapHelper.handleSimulateSwap({ originalFromInfo: originalToToken, originalToInfo: originalFromToken, diff --git a/src/layouts/App.tsx b/src/layouts/App.tsx index 7fbf4cd56..6ad499779 100644 --- a/src/layouts/App.tsx +++ b/src/layouts/App.tsx @@ -29,6 +29,8 @@ import Sidebar from './Sidebar'; import { useTonConnectUI } from '@tonconnect/ui-react'; import SingletonOraiswapV3 from 'libs/contractSingleton'; import { getCosmWasmClient } from 'libs/cosmjs'; +import { useLoadWalletsTon } from 'pages/Balance/hooks/useLoadWalletsTon'; +import { TonNetwork } from 'context/ton-provider'; const App = () => { const [address, setOraiAddress] = useConfigReducer('address'); @@ -56,6 +58,10 @@ const App = () => { window.Ton = tonConnectUI; }, [tonConnectUI]); + useLoadWalletsTon({ + tonNetwork: TonNetwork.Mainnet + }); + useEffect(() => { (async () => { if (address) { diff --git a/src/pages/Balance/TransferConvertToken/index.tsx b/src/pages/Balance/TransferConvertToken/index.tsx index 0049cc8ae..1547ad0f7 100644 --- a/src/pages/Balance/TransferConvertToken/index.tsx +++ b/src/pages/Balance/TransferConvertToken/index.tsx @@ -38,6 +38,7 @@ import styles from './index.module.scss'; import { useGetContractConfig } from 'pages/BitcoinDashboardV2/hooks'; import ToggleSwitch from 'components/ToggleSwitch'; import { CWBitcoinFactoryDenom } from 'helper/constants'; +import useGetFee from '../hooks/useGetFee'; interface TransferConvertProps { token: TokenItemType; @@ -149,8 +150,14 @@ const TransferConvertToken: FC = ({ const remoteTokenDenomTo = getRemoteTokenDenom(to); // token fee - const fromTokenFee = useTokenFee(remoteTokenDenomFrom); - const toTokenFee = useTokenFee(remoteTokenDenomTo); + const fromTokenFee = useTokenFee(remoteTokenDenomFrom) || 0; + const toTokenFee = useTokenFee(remoteTokenDenomTo) || 0; + + const { bridgeFee: bridgeFeeTon, tokenFee: tonTokenFee } = useGetFee({ + token, + fromNetwork: token.chainId, + toNetwork: toNetworkChainId + }); // bridge fee & relayer fee let bridgeFee = fromTokenFee + toTokenFee; @@ -201,7 +208,27 @@ const TransferConvertToken: FC = ({ const renderBridgeFee = () => { return (
- Bridge fee: {bridgeFee}% + {bridgeFeeTon ? ( + <> + Bridge fee:{' '} + + {bridgeFeeTon} {token.name}{' '} + + + ) : ( + <> + Bridge fee: {bridgeFee}% + + )} + {tonTokenFee > 0 ? ( +
+ - Token fee:{' '} + + {' '} + {tonTokenFee} {token.name}{' '} + +
+ ) : null}{' '} {relayerFeeTokenFee > 0 ? (
- Relayer fee:{' '} diff --git a/src/pages/Balance/hooks/useGetFee.ts b/src/pages/Balance/hooks/useGetFee.ts index 69d19a337..36dfe4eb3 100644 --- a/src/pages/Balance/hooks/useGetFee.ts +++ b/src/pages/Balance/hooks/useGetFee.ts @@ -2,28 +2,48 @@ import { BigDecimal, toDisplay, TokenItemType } from '@oraichain/oraidex-common' import { TonbridgeBridgeClient } from '@oraichain/tonbridge-contracts-sdk'; import { tonNetworkMainnet } from 'config/chainInfos'; import { network } from 'config/networks'; +import { TonChainId } from 'context/ton-provider'; import useConfigReducer from 'hooks/useConfigReducer'; import { useEffect, useState } from 'react'; -const useGetFee = ({ token }: { token: TokenItemType }) => { +const useGetFee = ({ + token, + fromNetwork, + toNetwork +}: { + token: TokenItemType; + fromNetwork: string; + toNetwork: string; +}) => { const [oraiAddress] = useConfigReducer('address'); const [bridgeFee, setBridgeFee] = useState(0); const [tokenFee, setTokenFee] = useState(0); + const [walletsTon] = useConfigReducer('walletsTon'); useEffect(() => { (async () => { try { - if (token) { + if (![fromNetwork, toNetwork].includes(TonChainId)) { + return setTokenFee(0); + } + + if (token && fromNetwork && toNetwork) { const tokenInTon = tonNetworkMainnet.currencies.find((tk) => tk.coinGeckoId === token.coinGeckoId); if (!tokenInTon) { return; } + const walletTon = walletsTon[tokenInTon.coinMinimalDenom]; + + if (!walletTon) { + return; + } const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); const tokenFeeConfig = await tonBridgeClient.tokenFee({ - remoteTokenDenom: tokenInTon?.contractAddress + remoteTokenDenom: walletTon }); + console.log('tonBridgeClient', tonBridgeClient, walletTon, tokenFeeConfig); if (tokenFeeConfig) { const { nominator, denominator } = tokenFeeConfig; @@ -40,20 +60,37 @@ const useGetFee = ({ token }: { token: TokenItemType }) => { } } })(); - }, [token, oraiAddress]); + }, [token, oraiAddress, walletsTon, fromNetwork, toNetwork]); useEffect(() => { (async () => { - const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); + if (![fromNetwork, toNetwork].includes(TonChainId)) { + return setBridgeFee(0); + } + + if (token && fromNetwork && toNetwork) { + const tokenInTon = tonNetworkMainnet.currencies.find((tk) => tk.coinGeckoId === token.coinGeckoId); + if (!tokenInTon) { + return; + } + + const walletTon = walletsTon[tokenInTon.coinMinimalDenom]; + if (!walletTon) { + return; + } + + const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); - const config = await tonBridgeClient.config(); - if (config) { - const { relayer_fee } = config; + console.log('conf', tonBridgeClient, walletTon); + const config = await tonBridgeClient.pairMapping({ + key: walletTon + }); + const pairMapping = config.pair_mapping; - setBridgeFee(toDisplay(relayer_fee)); + setBridgeFee(parseInt(pairMapping.relayer_fee) / 10 ** pairMapping.remote_decimals); } })(); - }, []); + }, [token, oraiAddress, walletsTon, fromNetwork, toNetwork]); return { bridgeFee, diff --git a/src/pages/Balance/hooks/useLoadWalletsTon.ts b/src/pages/Balance/hooks/useLoadWalletsTon.ts new file mode 100644 index 000000000..23b24a33e --- /dev/null +++ b/src/pages/Balance/hooks/useLoadWalletsTon.ts @@ -0,0 +1,50 @@ +import { JettonMinter } from '@oraichain/ton-bridge-contracts'; +import { Address } from '@ton/ton'; +import { TON_ZERO_ADDRESS, tonNetworkMainnet } from 'config/chainInfos'; +import { TonInteractionContract, TonNetwork } from 'context/ton-provider'; +import useConfigReducer from 'hooks/useConfigReducer'; +import { useEffect } from 'react'; +import { getTonClient, retryOrbs } from './../../../helper/index'; + +// dev: use to load wallet jetton address of bridge adapter +export const useLoadWalletsTon = ({ tonNetwork = TonNetwork.Mainnet }: { tonNetwork?: TonNetwork }) => { + const [, handleSetWalletsTonCache] = useConfigReducer('walletsTon'); + + const loadWalletsTon = async () => { + let tokenOnTons = tonNetworkMainnet.currencies || []; + + let walletsTon = {}; + for (const tokenOnTon of tokenOnTons) { + if (tokenOnTon.contractAddress == TON_ZERO_ADDRESS) { + walletsTon = { + ...walletsTon, + [tokenOnTon.coinMinimalDenom]: TON_ZERO_ADDRESS + }; + continue; + } + + await retryOrbs(async () => { + const client = await getTonClient(); + + const jettonMinter = JettonMinter.createFromAddress(Address.parse(tokenOnTon.contractAddress)); + const jettonMinterContract = client.open(jettonMinter); + const jettonWalletAddress = await jettonMinterContract.getWalletAddress( + Address.parse(TonInteractionContract[tonNetwork].bridgeAdapter) + ); + walletsTon = { + ...walletsTon, + [tokenOnTon.coinMinimalDenom]: jettonWalletAddress.toString() + }; + }); + } + handleSetWalletsTonCache(walletsTon); + }; + + useEffect(() => { + loadWalletsTon(); + }, [tonNetwork]); + + return { + loadWalletsTon + }; +}; diff --git a/src/pages/Balance/hooks/useTonBridgeHandler.ts b/src/pages/Balance/hooks/useTonBridgeHandler.ts index b3d71984b..266de052d 100644 --- a/src/pages/Balance/hooks/useTonBridgeHandler.ts +++ b/src/pages/Balance/hooks/useTonBridgeHandler.ts @@ -1,13 +1,22 @@ -import { toBinary } from '@cosmjs/cosmwasm-stargate'; +import { ExecuteInstruction, toBinary } from '@cosmjs/cosmwasm-stargate'; import { fromBech32 } from '@cosmjs/encoding'; +import { coin, Coin, coins, GasPrice } from '@cosmjs/stargate'; import { BigDecimal, + calculateTimeoutTimestamp, + CosmosChainId, + cosmosChains, CW20_DECIMALS, + getCosmosGasPrice, + getEncodedExecuteContractMsgs, handleSentFunds, + IBC_WASM_CONTRACT, + OSMOSIS_ROUTER_CONTRACT, toAmount, toDisplay, TokenItemType } from '@oraichain/oraidex-common'; +import { buildUniversalSwapMemo, SwapAndAction, UniversalSwapHelper } from '@oraichain/oraidex-universal-swap'; import { BridgeAdapter, JettonMinter, JettonWallet } from '@oraichain/ton-bridge-contracts'; import { TonbridgeBridgeClient } from '@oraichain/tonbridge-contracts-sdk'; import { getHttpEndpoint } from '@orbs-network/ton-access'; @@ -16,16 +25,30 @@ import { TonClient } from '@ton/ton'; import { Base64 } from '@tonconnect/protocol'; import { useTonConnectUI } from '@tonconnect/ui-react'; import { displayToast, TToastType } from 'components/Toasts/Toast'; -import { oraichainTokens } from 'config/bridgeTokens'; -import { TON_ZERO_ADDRESS, tonNetworkMainnet } from 'config/chainInfos'; +import { + AlloyedPool, + chainInfos, + oraichainTokensWithIcon, + OsmosisAlloyedPools, + OsmosisTokenDenom, + OsmosisTokenList, + TON_ZERO_ADDRESS, + tonNetworkTokens +} from 'config/chainInfos'; import { network } from 'config/networks'; import { TON_SCAN, TonChainId, TonInteractionContract, TonNetwork } from 'context/ton-provider'; +import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx'; import { getTransactionUrl, handleErrorTransaction } from 'helper'; +import { numberWithCommas } from 'helper/format'; import { useCoinGeckoPrices } from 'hooks/useCoingecko'; import useConfigReducer from 'hooks/useConfigReducer'; +import useLoadTokens from 'hooks/useLoadTokens'; +import { getCosmWasmClient } from 'libs/cosmjs'; import { useEffect, useState } from 'react'; +import { useSelector } from 'react-redux'; +import { RootState } from 'store/configure'; +import useGetFee from './useGetFee'; import useGetStateData from './useGetStateData'; -import useLoadTokens from 'hooks/useLoadTokens'; const FWD_AMOUNT = toNano(0.15); const TON_MESSAGE_VALID_UNTIL = 100000; @@ -41,75 +64,19 @@ export { TON_MESSAGE_VALID_UNTIL }; -const handleCheckBalanceBridgeOfTonNetwork = async (token: TokenItemType) => { - try { - // get the decentralized RPC endpoint - const endpoint = await getHttpEndpoint(); - const client = new TonClient({ - endpoint - }); - const bridgeAdapter = TonInteractionContract[TonNetwork.Mainnet].bridgeAdapter; - - if (token.contractAddress === TON_ZERO_ADDRESS) { - const balance = await client.getBalance(Address.parse(bridgeAdapter)); - - return { - balance: balance - }; - } - - const jettonMinter = JettonMinter.createFromAddress(Address.parse(token.contractAddress)); - const jettonMinterContract = client.open(jettonMinter); - const jettonWalletAddress = await jettonMinterContract.getWalletAddress(Address.parse(bridgeAdapter)); - const jettonWallet = JettonWallet.createFromAddress(jettonWalletAddress); - const jettonWalletContract = client.open(jettonWallet); - const balance = await jettonWalletContract.getBalance(); - - return { - balance: balance.amount - }; - } catch (error) { - console.log('error :>> handleCheckBalanceBridgeOfTonNetwork', error); - } -}; - -const handleCheckBalanceBridgeOfOraichain = async (token: TokenItemType) => { - try { - if (token) { - if (!token.contractAddress) { - const data = await window.client.getBalance(network.CW_TON_BRIDGE, token.denom); - return { - balance: data.amount - }; - } - - const tx = await window.client.queryContractSmart(token.contractAddress, { - balance: { address: network.CW_TON_BRIDGE } - }); - - return { - balance: tx?.balance || 0 - }; - } - } catch (error) { - console.log('error :>> handleCheckBalanceBridgeOfOraichain', error); - } -}; - -const checkBalanceBridgeByNetwork = async (networkFrom: string, token: TokenItemType) => { - const handler = { - [network.chainId]: handleCheckBalanceBridgeOfTonNetwork, - [TonChainId]: handleCheckBalanceBridgeOfOraichain - }; - - const { balance } = handler[networkFrom] ? await handler[networkFrom](token) : { balance: 0 }; - - return toDisplay((balance || '0').toString(), token.decimals || CW20_DECIMALS); -}; - -const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { +const useTonBridgeHandler = ({ + token, + fromNetwork, + toNetwork +}: { + token: TokenItemType; + fromNetwork: string; + toNetwork: string; +}) => { const [tonAddress, setTonAddress] = useConfigReducer('tonAddress'); const [oraiAddress, setOraiAddress] = useConfigReducer('address'); + const [walletsTon] = useConfigReducer('walletsTon'); + const amounts = useSelector((state: RootState) => state.token.amounts); const { balances: sentBalance, getChanelStateData } = useGetStateData(); const loadTokenAmounts = useLoadTokens(); @@ -121,6 +88,12 @@ const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { }); const [deductNativeAmount, setDeductNativeAmount] = useState(0n); + const { bridgeFee, tokenFee } = useGetFee({ + token, + fromNetwork, + toNetwork + }); + useEffect(() => { if (token?.chainId === TonChainId && token?.contractAddress === TON_ZERO_ADDRESS) { setDeductNativeAmount(BRIDGE_TON_TO_ORAI_MINIMUM_GAS); @@ -162,54 +135,257 @@ const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { } }, [token]); // toNetwork, tonAddress - const validatePrice = (token: TokenItemType, amount: number) => { - const usdPrice = new BigDecimal(amount || 0).mul(prices?.[token?.coinGeckoId] || 0).toNumber(); + const handleCheckBalanceBridgeOfTonNetwork = async (token: TokenItemType) => { + try { + // get the decentralized RPC endpoint + const endpoint = await getHttpEndpoint(); + const client = new TonClient({ + endpoint + }); + const bridgeAdapter = TonInteractionContract[TonNetwork.Mainnet].bridgeAdapter; - const minimumAmount = Math.ceil((MINIMUM_BRIDGE_PER_USD * amount * 100) / usdPrice) / 100; + if (token.contractAddress === TON_ZERO_ADDRESS) { + const balance = await client.getBalance(Address.parse(bridgeAdapter)); - if (amount < minimumAmount) { - throw Error(`Minimum bridge is ${minimumAmount} ${token.name}`); + return { + balance: balance + }; + } + + const jettonWallet = JettonWallet.createFromAddress(Address.parse(walletsTon[token.denom])); + const jettonWalletContract = client.open(jettonWallet); + const balance = await jettonWalletContract.getBalance(); + console.log({ bridgeAdapter, jettonWallet, balance }); + return { + balance: balance.amount + }; + } catch (error) { + console.log('error :>> handleCheckBalanceBridgeOfTonNetwork', error); } }; - const handleBridgeFromTon = async (amount: number | string) => { + const handleCheckBalanceBridgeOfOraichain = async (token: TokenItemType) => { try { - if (!oraiAddress) { - throw new Error('Please connect OWallet or Kelpr!'); + if (token) { + if (!token.contractAddress) { + const data = await window.client.getBalance(network.CW_TON_BRIDGE, token.denom); + return { + balance: data.amount + }; + } + + const tx = await window.client.queryContractSmart(token.contractAddress, { + balance: { address: network.CW_TON_BRIDGE } + }); + + return { + balance: tx?.balance || 0 + }; + } + } catch (error) { + console.log('error :>> handleCheckBalanceBridgeOfOraichain', error); + } + }; + + const handleCheckBalanceBridgeOfOsmosis = async (token: TokenItemType, fromChainId: string) => { + try { + if (token) { + if (!token.contractAddress) { + const findCosmosChain = chainInfos.find((chain) => chain.chainId === fromChainId); + const { client } = await getCosmWasmClient( + { chainId: fromChainId, rpc: findCosmosChain.rpc }, + { + gasPrice: GasPrice.fromString( + `${getCosmosGasPrice(findCosmosChain.feeCurrencies[0].gasPriceStep)}${ + findCosmosChain.feeCurrencies[0].coinMinimalDenom + }` + ) + } + ); + const data = await client.getBalance(network.CW_TON_BRIDGE, token.denom); + return { + balance: data.amount + }; + } + } + } catch (error) { + console.log('error :>> handleCheckBalanceBridgeOfOsmosis', error); + } + }; + + const checkBalanceBridgeByNetwork = async (networkFrom: string, token: TokenItemType) => { + const handler = { + ['Oraichain']: handleCheckBalanceBridgeOfTonNetwork, + [TonChainId]: handleCheckBalanceBridgeOfOraichain, + ['osmosis-1']: handleCheckBalanceBridgeOfOsmosis + }; + + const { balance } = handler[networkFrom] ? await handler[networkFrom](token) : { balance: 0 }; + + return toDisplay(balance || 0, token.decimals || token.decimals || CW20_DECIMALS); + }; + + const validatePrice = (token: TokenItemType, amount: number) => { + let totalFee = + Number.parseFloat( + numberWithCommas(bridgeFee || 0, undefined, { + maximumFractionDigits: CW20_DECIMALS + }) + ) + + Number.parseFloat( + numberWithCommas(new BigDecimal(tokenFee).mul(amount || 0).toNumber(), undefined, { maximumFractionDigits: 6 }) + ); + + if (amount < totalFee) { + throw Error(`Minimum bridge is ${totalFee} ${token['coinDenom'] || token.name}`); + } + }; + + const buildOsorSwapMsg = ( + { user_swap, min_asset, timeout_timestamp, post_swap_action, affiliates }: SwapAndAction, + isInitial: boolean, + fromAddress?: string, + funds?: Coin[] + ) => { + const msg = { + msg: { + swap_and_action: { + user_swap, + min_asset, + timeout_timestamp, + post_swap_action, + affiliates + } } + }; - if (!tonAddress) { - throw new Error('Please connect Ton Wallet'); + if (isInitial) { + if (!fromAddress) { + throw new Error('Missing fromAddress'); } + return { + msgActionSwap: { + sender: fromAddress, + contractAddress: OSMOSIS_ROUTER_CONTRACT, + funds, + ...msg + } + }; + } - if (!token || !amount) { - throw new Error('Not valid!'); + return { + msgActionSwap: { + wasm: { + contract: OSMOSIS_ROUTER_CONTRACT, + ...msg + } } + }; + }; + + const handleBridgeFromTon = async (amount: number | string) => { + try { + if (!oraiAddress) throw 'Please connect OWallet or Kelpr!'; + + if (!tonAddress) throw 'Please connect Ton Wallet'; + + if (!token || !amount) throw 'Not valid!'; + + if (toDisplay(amounts?.[token.denom] || '0', token['coinDecimals'] || token.decimals) < Number(amount)) + throw 'Insufficient funds'; validatePrice(token, Number(amount)); - const tokenInOrai = oraichainTokens.find((tk) => tk.coinGeckoId === token.coinGeckoId); + // setLoading(true); + + const tokenInOrai = oraichainTokensWithIcon.find((tk) => tk.coinGeckoId === token.coinGeckoId); const balanceMax = await checkBalanceBridgeByNetwork(TonChainId, tokenInOrai); - if (Number(balanceMax) < Number(amount) && token.contractAddress !== TON_ZERO_ADDRESS) { - throw new Error( - `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${token.name}, have ${balanceMax} ${token.name}` - ); + if (!tokenInOrai?.mintBurn && Number(balanceMax) < Number(amount)) { + // setLoading(false); + throw `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${ + token['coinDenom'] || token.name + }, have ${balanceMax} ${token['coinDenom'] || token.name}`; } const bridgeAdapterAddress = Address.parse(TonInteractionContract[TonNetwork.Mainnet].bridgeAdapter); - const fmtAmount = new BigDecimal(10).pow(token.decimals).mul(amount); + const fmtAmount = new BigDecimal(10).pow(token.decimals || token['coinDecimals']).mul(amount); const isNativeTon: boolean = token.contractAddress === TON_ZERO_ADDRESS; const toAddress: string = isNativeTon ? bridgeAdapterAddress.toString() : tokenInfo.jettonWalletAddress?.toString(); + console.log('THIS IS TO ADDRESS:', { toAddress }, { walletsTon }); const oraiAddressBech32 = fromBech32(oraiAddress).data; const gasAmount = isNativeTon ? fmtAmount.add(BRIDGE_TON_TO_ORAI_MINIMUM_GAS).toString() : BRIDGE_TON_TO_ORAI_MINIMUM_GAS.toString(); const timeout = BigInt(Math.floor(new Date().getTime() / 1000) + 3600); - const memo = beginCell().endCell(); + let memo = beginCell().endCell(); + + if (toNetwork === 'osmosis-1') { + const osmosisAddress = await window.Keplr.getKeplrAddr(toNetwork); + let osmosisReceiver = osmosisAddress; + if (!osmosisAddress) throw 'Please connect OWallet or Kelpr!'; + + let osorRouterMemo = ''; + let hasAlloyedPool = canConvertToAlloyedToken(token.coinGeckoId); + if (hasAlloyedPool) { + osmosisReceiver = OSMOSIS_ROUTER_CONTRACT; + let { msgActionSwap } = buildOsorSwapMsg( + { + user_swap: { + swap_exact_asset_in: { + swap_venue_name: 'osmosis-poolmanager', + operations: [ + { + pool: hasAlloyedPool.poolId, + denom_in: hasAlloyedPool.sourceToken, + denom_out: hasAlloyedPool.alloyedToken + } + ] + } + }, + min_asset: { + native: { + denom: hasAlloyedPool.alloyedToken, + amount: '0' + } + }, // consider add minimum receive (Currently, alloy pool is swap 1-1, so no't need to add min_asset + timeout_timestamp: Number(calculateTimeoutTimestamp(3600)), + post_swap_action: { + transfer: { + to_address: osmosisAddress + } + }, + affiliates: [] + }, + false + ); + osorRouterMemo = JSON.stringify(msgActionSwap); + } + + const buildMemoSwap = buildUniversalSwapMemo( + { + minimumReceive: '0', + recoveryAddr: oraiAddress + }, + undefined, + undefined, + undefined, + { + sourceChannel: 'channel-13', + sourcePort: 'transfer', + receiver: osmosisReceiver, + memo: osorRouterMemo, + recoverAddress: oraiAddress + }, + undefined + ); + memo = beginCell().storeStringRefTail(buildMemoSwap).endCell(); + } + + console.log('contractAddress:', token.contractAddress); const getNativeBridgePayload = () => BridgeAdapter.buildBridgeTonBody( { @@ -262,50 +438,218 @@ const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { loadTokenAmounts({ oraiAddress, tonAddress }); getChanelStateData(); - - return txHash; } } catch (error) { console.log('error Bridge from TON :>>', error); handleErrorTransaction(error, { - tokenName: token.name, - chainName: token.chainId + tokenName: token['coindDenom'], + chainName: toNetwork }); } }; - const handleBridgeFromOraichain = async (amount: number | string) => { + const handleBridgeFromCosmos = async (amount: number | string) => { try { - if (!oraiAddress) { - throw new Error('Please connect OWallet or Kelpr!'); - } + if (!oraiAddress) throw 'Please connect OWallet or Kelpr!'; - if (!tonAddress) { - throw new Error('Please connect Ton Wallet'); - } + if (!tonAddress) throw 'Please connect Ton Wallet'; - if (!token || !amount) { - throw new Error('Not valid!'); - } + if (!token || !amount) throw 'Not valid!'; - validatePrice(token, Number(amount)); + // setLoading(true); + const isFromOsmosisToOraichain = fromNetwork === 'osmosis-1' && toNetwork === 'Oraichain'; + const isFromOraichainToOsmosis = fromNetwork === 'Oraichain' && toNetwork === 'osmosis-1'; + const isFromOsmosisToTon = fromNetwork === 'osmosis-1' && toNetwork === TonChainId; - const tokenInTon = tonNetworkMainnet.currencies.find((tk) => tk.coinGeckoId === token.coinGeckoId); + // Osmosis <-> Oraichain + // Oraichain <-> Osmosis + // Osmosis -> Ton + if (isFromOsmosisToOraichain || isFromOraichainToOsmosis || isFromOsmosisToTon) { + if (isFromOsmosisToTon) { + validatePrice(token, Number(amount)); + } + const timeout = Math.floor(new Date().getTime() / 1000) + 3600; + const fromChainId = fromNetwork as CosmosChainId; + const toChainId = isFromOsmosisToTon ? ('Oraichain' as CosmosChainId) : (toNetwork as CosmosChainId); + + let [fromAddress, toAddress] = await Promise.all([ + window.Keplr.getKeplrAddr(fromChainId), + window.Keplr.getKeplrAddr(toChainId) + ]); + + if (!fromAddress || !toAddress) throw 'Please connect OWallet or Kelpr!'; + + let memo = ''; + if (isFromOsmosisToTon) { + toAddress = IBC_WASM_CONTRACT; + + const memoUniversal = buildUniversalSwapMemo( + { minimumReceive: '0', recoveryAddr: oraiAddress }, + undefined, + undefined, + { + contractAddress: network.CW_TON_BRIDGE, + msg: toBinary({ + bridge_to_ton: { + to: tonAddress, + denom: tonNetworkTokens.find((tk) => tk.coinGeckoId === token.coinGeckoId).contractAddress, + timeout, + recovery_addr: oraiAddress + } + }) + }, + undefined, + undefined + ); + + memo = JSON.stringify({ + wasm: { + contract: IBC_WASM_CONTRACT, + msg: { + ibc_hooks_receive: { + func: 'universal_swap', + orai_receiver: oraiAddress, + args: memoUniversal + } + } + } + }); + } + if (isFromOraichainToOsmosis) { + let hasAlloyedPool = canConvertToAlloyedToken(token.coinGeckoId); + if (hasAlloyedPool) { + let { msgActionSwap } = buildOsorSwapMsg( + { + user_swap: { + swap_exact_asset_in: { + swap_venue_name: 'osmosis-poolmanager', + operations: [ + { + pool: hasAlloyedPool.poolId, + denom_in: hasAlloyedPool.sourceToken, + denom_out: hasAlloyedPool.alloyedToken + } + ] + } + }, + min_asset: { + native: { + denom: hasAlloyedPool.alloyedToken, + amount: '0' + } + }, // consider add minimum receive (Currently, alloy pool is swap 1-1, so no't need to add min_asset + timeout_timestamp: Number(calculateTimeoutTimestamp(3600)), + post_swap_action: { + transfer: { + to_address: toAddress + } + }, + affiliates: [] + }, + false + ); + memo = JSON.stringify(msgActionSwap); + toAddress = OSMOSIS_ROUTER_CONTRACT; + } + } - const balanceMax = (sentBalance || []).find((b) => b.native.denom === tokenInTon.contractAddress)?.native.amount; + const ibcInfo = UniversalSwapHelper.getIbcInfo(fromChainId, toChainId); + let executeMsg; + if (fromNetwork === 'osmosis-1' && token.denom === OsmosisTokenDenom.allTon) { + let hasAlloyedPool = canConvertToAlloyedToken(token.coinGeckoId); + if (!hasAlloyedPool) throw new Error('AlloyPool does not exist!'); + // need convert from alloyed first + let { msgActionSwap } = buildOsorSwapMsg( + { + user_swap: { + swap_exact_asset_in: { + swap_venue_name: 'osmosis-poolmanager', + operations: [ + { + pool: hasAlloyedPool.poolId, + denom_in: hasAlloyedPool.alloyedToken, + denom_out: hasAlloyedPool.sourceToken + } + ] + } + }, + min_asset: { + native: { + denom: hasAlloyedPool.sourceToken, + amount: '0' + } + }, // consider add minimum receive (Currently, alloy pool is swap 1-1, so no't need to add min_asset + timeout_timestamp: Number(calculateTimeoutTimestamp(3600)), + post_swap_action: { + ibc_transfer: { + ibc_info: { + source_channel: ibcInfo.channel, + receiver: toAddress, + memo, + recover_address: fromAddress + } + } + }, + affiliates: [] + }, + true, + fromAddress, + coins(toAmount(amount, token.decimals).toString(), token.denom) + ); + + executeMsg = getEncodedExecuteContractMsgs(fromAddress, [msgActionSwap as ExecuteInstruction]); + } else + executeMsg = [ + { + typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', + value: MsgTransfer.fromPartial({ + sourcePort: ibcInfo.source, + sourceChannel: ibcInfo.channel, + token: coin(toAmount(amount, token.decimals).toString(), token.denom), + sender: fromAddress, + receiver: toAddress, + memo, + timeoutTimestamp: calculateTimeoutTimestamp(ibcInfo.timeout) + }) + } + ]; - // const balanceMax = await checkBalanceBridgeByNetwork( - // NetworkList.oraichain.id, - // tokenInTon - // ); + const findCosmosChain = cosmosChains.find((chain) => chain.chainId === fromNetwork); - const displayBalance = toDisplay(balanceMax, tokenInTon?.coinDecimals || CW20_DECIMALS); + const { client } = await getCosmWasmClient( + { chainId: fromChainId, rpc: findCosmosChain.rpc }, + { + gasPrice: GasPrice.fromString( + `${getCosmosGasPrice(findCosmosChain.feeCurrencies[0].gasPriceStep)}${ + findCosmosChain.feeCurrencies[0].coinMinimalDenom + }` + ) + } + ); + const tx = await client.signAndBroadcast(fromAddress, executeMsg, 'auto'); + + if (tx?.transactionHash) { + displayToast(TToastType.TX_SUCCESSFUL, { + customLink: getTransactionUrl(fromNetwork as any, tx.transactionHash) + }); + loadTokenAmounts({ oraiAddress, tonAddress }); + } + return; + } + validatePrice(token, Number(amount)); + + const tokenInTon = tonNetworkTokens.find((tk) => tk.coinGeckoId === token.coinGeckoId); + const bridgeJettonWallet = walletsTon[tokenInTon.denom]; + if (!bridgeJettonWallet) throw 'Bridge wallet not found!'; + + const balanceMax = (sentBalance || []).find((b) => b.native.denom === bridgeJettonWallet)?.native.amount; + + const displayBalance = toDisplay(balanceMax, tokenInTon?.decimals || CW20_DECIMALS); if (displayBalance < Number(amount) && token.contractAddress !== null) { - throw new Error( - `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${token.name}, have ${displayBalance} ${token.name}` - ); + // setLoading(false); + throw `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${token.name}, have ${displayBalance} ${token.name}`; } const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); @@ -313,16 +657,17 @@ const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { let tx; const timeout = Math.floor(new Date().getTime() / 1000) + 3600; + const msg = { // crcSrc: ARG_BRIDGE_TO_TON.CRC_SRC, - denom: tonNetworkMainnet.currencies.find((tk) => tk.coinGeckoId === token.coinGeckoId).contractAddress, + denom: bridgeJettonWallet, timeout, to: tonAddress }; const funds = handleSentFunds({ denom: token.denom, - amount: toAmount(amount, token.decimals).toString() + amount: toAmount(amount, token.decimals || token['coinDecimals']).toString() }); // native token @@ -337,7 +682,7 @@ const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { { send: { contract: network.CW_TON_BRIDGE, - amount: toAmount(amount, token.decimals).toString(), + amount: toAmount(amount, token.decimals || token['coinDecimals']).toString(), msg: toBinary({ denom: msg.denom, timeout, @@ -351,27 +696,30 @@ const useTonBridgeHandler = ({ token }: { token: TokenItemType }) => { if (tx?.transactionHash) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: getTransactionUrl(token.chainId as any, tx.transactionHash) + customLink: getTransactionUrl(fromNetwork as any, tx.transactionHash) }); - loadTokenAmounts({ oraiAddress, tonAddress }); - getChanelStateData(); - - return tx?.transactionHash; } } catch (error) { console.log('error Bridge from Oraichain :>>', error); handleErrorTransaction(error, { - tokenName: token.name, - chainName: token.chainId + tokenName: token.name || token['coinDenom'], + chainName: toNetwork }); } }; return { - handleBridgeFromOraichain, + handleBridgeFromCosmos, handleBridgeFromTon }; }; export default useTonBridgeHandler; + +export const canConvertToAlloyedToken = (coinGeckoId: string): AlloyedPool | undefined => { + const hasAlloyed = OsmosisTokenList.find( + (token) => token.coinGeckoId == coinGeckoId && token.denom === OsmosisTokenDenom.allTon + ); + return hasAlloyed ? OsmosisAlloyedPools.find((pool) => pool.alloyedToken == hasAlloyed.denom) : undefined; +}; diff --git a/src/pages/Balance/index.tsx b/src/pages/Balance/index.tsx index 0cf769852..f89ef9e76 100644 --- a/src/pages/Balance/index.tsx +++ b/src/pages/Balance/index.tsx @@ -124,7 +124,11 @@ const Balance: React.FC = () => { const [tonAddress] = useConfigReducer('tonAddress'); const [btcAddress] = useConfigReducer('btcAddress'); const [addressRecovery, setAddressRecovery] = useState(''); - const { handleBridgeFromOraichain, handleBridgeFromTon } = useTonBridgeHandler({ token: from }); + const { handleBridgeFromCosmos, handleBridgeFromTon } = useTonBridgeHandler({ + token: from, + fromNetwork: from?.chainId, + toNetwork: to?.chainId + }); const [isFastMode, setIsFastMode] = useState(true); const depositV2Fee = useDepositFeesBitcoinV2(true); const withdrawV2Fee = useGetWithdrawlFeesBitcoinV2({ @@ -449,7 +453,7 @@ const Balance: React.FC = () => { if (isTonToOraichain) { return await handleBridgeFromTon(transferAmount); } - return await handleBridgeFromOraichain(transferAmount); + return await handleBridgeFromCosmos(transferAmount); }; const checkTransferBtc = () => { diff --git a/src/reducer/config.ts b/src/reducer/config.ts index 05f7ef3c2..8c12f55b1 100644 --- a/src/reducer/config.ts +++ b/src/reducer/config.ts @@ -20,12 +20,15 @@ export type RewardPoolType = { liquidity_token: string; }; +type WalletTonDetails = { [denom: string]: string }; + export interface ConfigState { address: string; metamaskAddress: string | null; tronAddress: string | null; btcAddress: string | null; tonAddress: string | null; + walletsTon: WalletTonDetails; // ton wallets for bridge adapter cosmosAddress: { [key: string]: string }; allPendingDeposits: { [key: string]: DepositInfo[] }; chainId: string; @@ -73,6 +76,7 @@ const initialState: ConfigState = { btcAddress: '', tonAddress: '', tronAddress: '', + walletsTon: {}, walletTypeStore: 'owallet', cosmosAddress: {}, allPendingDeposits: {}, diff --git a/yarn.lock b/yarn.lock index f49f09640..12a975da6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3379,7 +3379,7 @@ dotenv "^16.4.5" varstruct "^6.1.3" -"@oraichain/tonbridge-contracts-sdk@^1.3.0": +"@oraichain/tonbridge-contracts-sdk@^1.3.1": version "1.3.6" resolved "https://registry.yarnpkg.com/@oraichain/tonbridge-contracts-sdk/-/tonbridge-contracts-sdk-1.3.6.tgz#1ee1309e6bb8e186eaa5d706c7d32276ef976402" integrity sha512-k1DgzfYg3nQNPn2dLiXbkDHXd1WREQA9Dl0ezQ5kPtnlbNK9XjmxSco2gmaJwql0tE3cbBExUflfG0MaRF0dWw== From 9c9211c43da7b20a9609ed38e110c7cbdbcd4415 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Mon, 4 Nov 2024 11:15:20 +0700 Subject: [PATCH 05/21] fix: update check balacne and calc fee --- src/config/chainInfos.ts | 28 ++++++- src/context/ton-provider.tsx | 10 +-- .../Balance/TransferConvertToken/index.tsx | 73 ++++++++++++++++--- src/pages/Balance/hooks/useGetFee.ts | 2 - .../Balance/hooks/useTonBridgeHandler.ts | 2 + 5 files changed, 97 insertions(+), 18 deletions(-) diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index 9196fb0b0..d8291873e 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -8,12 +8,14 @@ import { defaultBech32Config, getTokensFromNetwork } from '@oraichain/oraidex-common'; +import HamsterIcon from 'assets/icons/hmstr.svg?react'; import BitcoinIcon from 'assets/icons/bitcoin.svg?react'; import OraiIcon from 'assets/icons/oraichain.svg?react'; import BTCIcon from 'assets/icons/btc-icon.svg?react'; import OraiLightIcon from 'assets/icons/oraichain_light.svg?react'; -import UsdtIcon from 'assets/icons/tether.svg'; -import TonIcon from 'assets/icons/ton.svg'; +import UsdtIcon from 'assets/icons/tether.svg?react'; +import UsdcIcon from 'assets/icons/usd_coin.svg?react'; +import TonIcon from 'assets/icons/ton.svg?react'; import flatten from 'lodash/flatten'; import { TON_SCAN, TonChainId, TonNetwork } from 'context/ton-provider'; @@ -25,6 +27,8 @@ export const chainIcons = chainIconsInfos; export const TON_ZERO_ADDRESS = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'; export const USDT_TON_CONTRACT = 'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs'; +export const jUSDC_TON_CONTRACT = 'EQB-MPwrd1G6WKNkLz_VnV6WqBDd142KMQv-g1O-8QUA3728'; +export const HMSTR_TON_CONTRACT = 'EQAJ8uWd7EBqsmpSWaRdf_I-8R8-XHwh3gsNKhy-UrdrPcUo'; const [otherChainTokens, oraichainTokens] = tokens; const OraiBTCToken: BridgeAppCurrency = { @@ -84,6 +88,26 @@ export const tonNetworkMainnet: CustomChainInfo = { contractAddress: USDT_TON_CONTRACT, prefixToken: 'ton20_', coinGeckoId: 'tether' + }, + { + coinDenom: 'HMSTR', + coinMinimalDenom: 'ton20_hamster_kombat', + coinDecimals: 9, + Icon: HamsterIcon, + bridgeTo: ['Oraichain'], + contractAddress: HMSTR_TON_CONTRACT, + prefixToken: 'ton20_', + coinGeckoId: 'hamster-kombat' + }, + { + coinDenom: 'jUSDC', + coinMinimalDenom: 'ton20_usdc', + coinDecimals: 6, + Icon: UsdcIcon, + bridgeTo: ['Oraichain'], + contractAddress: jUSDC_TON_CONTRACT, + prefixToken: 'ton20_', + coinGeckoId: 'usd-coin' } ], get feeCurrencies() { diff --git a/src/context/ton-provider.tsx b/src/context/ton-provider.tsx index 13bc33dd4..493aaa3fb 100644 --- a/src/context/ton-provider.tsx +++ b/src/context/ton-provider.tsx @@ -9,14 +9,14 @@ export enum TonNetwork { export const TonInteractionContract = { [TonNetwork.Mainnet]: { - lightClient: 'EQDt5RAUICxUeHaNicwspH8obI__z3X0UHy6vv1xhpi3AbfT', + lightClient: 'EQDzy_POlimFDyzrHd3OQsb9sZCngyG3O7Za4GRFzM-rrO93', whitelist: 'EQATDM6mfPZjPDMD9TVa6D9dlbmAKY5w6xOJiTXJ9Nqj_dsu', - bridgeAdapter: 'EQArWlaBgdGClwJrAkQjQP_8zxIK_bdgbH-6qdl4f5JEfo3r' + bridgeAdapter: 'EQC-aFP0rJXwTgKZQJPbPfTSpBFc8wxOgKHWD9cPvOl_DnaY' }, [TonNetwork.Testnet]: { - lightClient: '', - whitelist: 'EQD2xPIqdeggqtP3q852Y-7yD-RRHi12Zy7M4iUx4-7q0E1', - bridgeAdapter: 'EQDZfQX89gMo3HAiW1tSK9visb2gouUvDCt6PODo3qkXKeox' + lightClient: 'EQDzy_POlimFDyzrHd3OQsb9sZCngyG3O7Za4GRFzM-rrO93', + whitelist: 'EQAbJI3NZKGcVu-ec_z_LcmXca9ZOtzkgCW5H9glnWBDpaFg', + bridgeAdapter: 'EQA3ISho4fpW3wmCkKEwsyXulIw7vLf-2jxso40ul3QQJ_O7' } }; diff --git a/src/pages/Balance/TransferConvertToken/index.tsx b/src/pages/Balance/TransferConvertToken/index.tsx index 1547ad0f7..fb5daec17 100644 --- a/src/pages/Balance/TransferConvertToken/index.tsx +++ b/src/pages/Balance/TransferConvertToken/index.tsx @@ -1,5 +1,6 @@ import { BigDecimal, + getTokensFromNetwork, // flattenTokens NetworkChainId, toDisplay, @@ -16,7 +17,7 @@ import PowerByOBridge from 'components/PowerByOBridge'; import { displayToast, TToastType } from 'components/Toasts/Toast'; import TokenBalance from 'components/TokenBalance'; import { cosmosTokens, flattenTokens, tokenMap } from 'config/bridgeTokens'; -import { btcChains, evmChains } from 'config/chainInfos'; +import { btcChains, evmChains, OsmosisTokenList, tonNetworkMainnet } from 'config/chainInfos'; import copy from 'copy-to-clipboard'; import { filterChainBridge, getAddressTransfer, networks } from 'helper'; import { useCoinGeckoPrices } from 'hooks/useCoingecko'; @@ -39,6 +40,8 @@ import { useGetContractConfig } from 'pages/BitcoinDashboardV2/hooks'; import ToggleSwitch from 'components/ToggleSwitch'; import { CWBitcoinFactoryDenom } from 'helper/constants'; import useGetFee from '../hooks/useGetFee'; +import useTonBridgeHandler from '../hooks/useTonBridgeHandler'; +import { TonChainId } from 'context/ton-provider'; interface TransferConvertProps { token: TokenItemType; @@ -159,6 +162,12 @@ const TransferConvertToken: FC = ({ toNetwork: toNetworkChainId }); + const { deductNativeAmount, checkBalanceBridgeByNetwork } = useTonBridgeHandler({ + token, + fromNetwork: token.chainId, + toNetwork: toNetworkChainId + }); + // bridge fee & relayer fee let bridgeFee = fromTokenFee + toTokenFee; @@ -203,9 +212,26 @@ const TransferConvertToken: FC = ({ toDisplayBTCFee = new BigDecimal(withdrawalFeeBtc.withdrawal_fees ?? 0).div(1e14).toNumber(); } - let receivedAmount = convertAmount ? convertAmount * (1 - bridgeFee / 100) - relayerFeeTokenFee - toDisplayBTCFee : 0; + let receivedAmount = convertAmount + ? convertAmount * (1 - bridgeFee / 100) - relayerFeeTokenFee - toDisplayBTCFee - (bridgeFeeTon || 0) + : 0; const renderBridgeFee = () => { + const [balanceMax, setBalanceMax] = useState(0); + + useEffect(() => { + (async () => { + if (toNetworkChainId === TonChainId) { + const tokenOnTon = [...getTokensFromNetwork(tonNetworkMainnet)].find( + (tk) => tk.chainId === toNetworkChainId && tk.coinGeckoId === token.coinGeckoId + ); + + const maxBalance = await checkBalanceBridgeByNetwork(token.chainId, tokenOnTon); + setBalanceMax(maxBalance || 0); + } + })(); + }, [token, toNetworkChainId]); + return (
{bridgeFeeTon ? ( @@ -241,7 +267,7 @@ const TransferConvertToken: FC = ({ - Received amount: {' '} - {receivedAmount.toFixed(6)} {token.name} + {(receivedAmount > 0 ? receivedAmount : 0).toFixed(6)} {token.name} {!!toDisplayBTCFee && ( <> @@ -249,6 +275,14 @@ const TransferConvertToken: FC = ({ - BTC fee: {toDisplayBTCFee} BTC )} + {toNetworkChainId === TonChainId && ( +

+ Max Bridge Balances:{' '} + + {balanceMax.toFixed(6)} {token.name} + +

+ )}
); }; @@ -401,13 +435,21 @@ const TransferConvertToken: FC = ({ className={classNames(styles.balanceBtn, styles[theme])} onClick={(event) => { event.stopPropagation(); - const finalAmount = calcMaxAmount({ - maxAmount, - token, - coeff - }); + if (token.chainId === TonChainId && token.coinGeckoId === 'the-open-network') { + const finalAmount = new BigDecimal(maxAmount) + .sub(toDisplay(deductNativeAmount || 0n, token.decimals)) + .toNumber(); + + setConvertAmount([finalAmount * coeff, amountDetail.usd * coeff]); + } else { + const finalAmount = calcMaxAmount({ + maxAmount, + token, + coeff + }); - setConvertAmount([finalAmount * coeff, amountDetail.usd * coeff]); + setConvertAmount([finalAmount * coeff, amountDetail.usd * coeff]); + } }} > {text} @@ -430,6 +472,19 @@ const TransferConvertToken: FC = ({ />
)} + + {token.denom === CWBitcoinFactoryDenom && ( +
+ Fast Mode{' '} + setIsFastMode((fastMode) => !fastMode)} + /> +
+ )}
{(() => { diff --git a/src/pages/Balance/hooks/useGetFee.ts b/src/pages/Balance/hooks/useGetFee.ts index 36dfe4eb3..807538d2d 100644 --- a/src/pages/Balance/hooks/useGetFee.ts +++ b/src/pages/Balance/hooks/useGetFee.ts @@ -43,7 +43,6 @@ const useGetFee = ({ const tokenFeeConfig = await tonBridgeClient.tokenFee({ remoteTokenDenom: walletTon }); - console.log('tonBridgeClient', tonBridgeClient, walletTon, tokenFeeConfig); if (tokenFeeConfig) { const { nominator, denominator } = tokenFeeConfig; @@ -81,7 +80,6 @@ const useGetFee = ({ const tonBridgeClient = new TonbridgeBridgeClient(window.client, oraiAddress, network.CW_TON_BRIDGE); - console.log('conf', tonBridgeClient, walletTon); const config = await tonBridgeClient.pairMapping({ key: walletTon }); diff --git a/src/pages/Balance/hooks/useTonBridgeHandler.ts b/src/pages/Balance/hooks/useTonBridgeHandler.ts index 266de052d..bacadefd8 100644 --- a/src/pages/Balance/hooks/useTonBridgeHandler.ts +++ b/src/pages/Balance/hooks/useTonBridgeHandler.ts @@ -710,6 +710,8 @@ const useTonBridgeHandler = ({ }; return { + deductNativeAmount, + checkBalanceBridgeByNetwork, handleBridgeFromCosmos, handleBridgeFromTon }; From 495e41c19b5303b283aa4e045490e942072e0f49 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Mon, 4 Nov 2024 12:14:03 +0700 Subject: [PATCH 06/21] fix: list token --- src/config/chainInfos.ts | 180 +++++++++++++----- .../Balance/hooks/useTonBridgeHandler.ts | 5 +- 2 files changed, 134 insertions(+), 51 deletions(-) diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index d8291873e..90e061d5c 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -6,7 +6,9 @@ import { BridgeAppCurrency, CustomChainInfo, defaultBech32Config, - getTokensFromNetwork + getTokensFromNetwork, + TON_ORAICHAIN_DENOM, + HMSTR_ORAICHAIN_DENOM } from '@oraichain/oraidex-common'; import HamsterIcon from 'assets/icons/hmstr.svg?react'; import BitcoinIcon from 'assets/icons/bitcoin.svg?react'; @@ -42,6 +44,57 @@ const OraiBTCToken: BridgeAppCurrency = { } }; +export type AlloyedPool = { + poolId: string; + alloyedToken: string; + sourceToken: string; +}; + +export const OsmosisAlloyedPools: AlloyedPool[] = [ + { + poolId: '2161', + alloyedToken: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON', + sourceToken: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98' + } +]; + +export const OsmosisTokenDenom = { + ton: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98', + allTon: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON' +}; + +export const OsmosisTokenList = [ + { + chainId: 'osmosis-1', + bridgeTo: [TonChainId], + coinDenom: 'TON.orai', + name: 'TON', + symbol: 'TON.orai', + Icon: TonIcon, + contractAddress: null, + denom: OsmosisTokenDenom.ton, + coinMinimalDenom: OsmosisTokenDenom.ton, + coinGeckoId: 'the-open-network', + decimal: 9, + coinDecimals: 9 + }, + { + chainId: 'osmosis-1', + bridgeTo: [TonChainId], + coinDenom: 'TON', + name: 'TON', + symbol: 'TON', + Icon: TonIcon, + contractAddress: null, + denom: OsmosisTokenDenom.allTon, + coinMinimalDenom: OsmosisTokenDenom.allTon, + coinGeckoId: 'the-open-network', + decimal: 9, + coinDecimals: 9, + alloyedToken: true + } +]; + export const tonNetworkMainnet: CustomChainInfo = { rest: 'https://toncenter.com/api/v2/jsonRPC', rpc: 'https://toncenter.com/api/v2/jsonRPC', @@ -67,7 +120,7 @@ export const tonNetworkMainnet: CustomChainInfo = { coinDenom: 'TON', coinMinimalDenom: 'ton', coinDecimals: 9, - bridgeTo: ['Oraichain'], + bridgeTo: ['Oraichain', 'osmosis-1'], prefixToken: 'ton20_', contractAddress: TON_ZERO_ADDRESS, Icon: TonIcon, @@ -238,7 +291,7 @@ export const oraichainNetwork: CustomChainInfo = { ...customOraichainNetwork, currencies: [...customOraichainNetwork.currencies].map((tk) => { if (tk.coinGeckoId === 'the-open-network') { - const bridgeToken = { ...tk, bridgeTo: [TonChainId, 'osmosis-1'] }; + const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, 'osmosis-1', ...(tk.bridgeTo || [])])] }; return bridgeToken; } @@ -300,9 +353,83 @@ export const OraiBTCBridgeNetwork = { } }; -export const chainInfosWithSdk = [...customChainInfos, bitcoinMainnet, oraibtcNetwork, tonNetworkMainnet]; +export const chainInfosWithSdk = [ + ...customChainInfos.map((net) => { + if (net.chainId === 'osmosis-1') { + const newCurrencies = [ + ...net.currencies, + { + chainId: 'osmosis-1', + bridgeTo: [TonChainId], + coinDenom: 'TON.orai', + name: 'TON', + symbol: 'TON.orai', + Icon: TonIcon, + contractAddress: null, + denom: OsmosisTokenDenom.ton, + coinMinimalDenom: OsmosisTokenDenom.ton, + coinGeckoId: 'the-open-network', + decimal: 9, + coinDecimals: 9 + }, + { + chainId: 'osmosis-1', + bridgeTo: [TonChainId], + coinDenom: 'TON', + name: 'TON', + symbol: 'TON', + Icon: TonIcon, + contractAddress: null, + denom: OsmosisTokenDenom.allTon, + coinMinimalDenom: OsmosisTokenDenom.allTon, + coinGeckoId: 'the-open-network', + decimal: 9, + coinDecimals: 9, + alloyedToken: true + } + ]; + + const fmtOsmoChain = { + ...net, + currencies: newCurrencies + }; + + return fmtOsmoChain; + } else if (net.chainId === 'Oraichain') { + console.log('net', net, { + ...net, + currencies: [...net.currencies].map((tk) => { + if (['tether', 'usd-coin', 'the-open-network', 'hamster-kombat'].includes(tk.coinGeckoId)) { + const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, ...(tk.bridgeTo || [])])] }; + return bridgeToken; + } + + return tk; + }) + }); + return { + ...net, + currencies: [...net.currencies].map((tk) => { + if (['tether', 'usd-coin', 'the-open-network', 'hamster-kombat'].includes(tk.coinGeckoId)) { + const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, ...(tk.bridgeTo || [])])] }; + return bridgeToken; + } + + return tk; + }) + }; + } + + return net; + }), + bitcoinMainnet, + oraibtcNetwork, + tonNetworkMainnet +]; export const chainInfos = mapListWithIcon(chainInfosWithSdk, chainIcons, 'chainId'); +console.log('chainInfos', chainInfos); + // exclude kawaiverse subnet and other special evm that has different cointype export const evmChains = chainInfos.filter( (c) => c.networkType === 'evm' && c.bip44.coinType === 60 && c.chainId !== '0x1ae6' @@ -311,48 +438,3 @@ export const evmChains = chainInfos.filter( export const chainInfosWithIcon = mapListWithIcon(chainInfosWithSdk, chainIcons, 'chainId'); export const btcChains = chainInfos.filter((c) => c.networkType === ('bitcoin' as any)); - -export type AlloyedPool = { - poolId: string; - alloyedToken: string; - sourceToken: string; -}; - -export const OsmosisAlloyedPools: AlloyedPool[] = [ - { - poolId: '2161', - alloyedToken: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON', - sourceToken: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98' - } -]; - -export const OsmosisTokenDenom = { - ton: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98', - allTon: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON' -}; - -export const OsmosisTokenList = [ - { - chainId: 'osmosis-1', - name: 'TON', - symbol: 'TON.orai', - Icon: TonIcon, - contractAddress: null, - denom: OsmosisTokenDenom.ton, - coinMinimalDenom: OsmosisTokenDenom.ton, - coinGeckoId: 'the-open-network', - decimal: 9 - }, - { - chainId: 'osmosis-1', - name: 'TON', - symbol: 'TON', - Icon: TonIcon, - contractAddress: null, - denom: OsmosisTokenDenom.allTon, - coinMinimalDenom: OsmosisTokenDenom.allTon, - coinGeckoId: 'the-open-network', - decimal: 9, - alloyedToken: true - } -]; diff --git a/src/pages/Balance/hooks/useTonBridgeHandler.ts b/src/pages/Balance/hooks/useTonBridgeHandler.ts index bacadefd8..7f895c214 100644 --- a/src/pages/Balance/hooks/useTonBridgeHandler.ts +++ b/src/pages/Balance/hooks/useTonBridgeHandler.ts @@ -203,6 +203,7 @@ const useTonBridgeHandler = ({ } ); const data = await client.getBalance(network.CW_TON_BRIDGE, token.denom); + return { balance: data.amount }; @@ -217,10 +218,10 @@ const useTonBridgeHandler = ({ const handler = { ['Oraichain']: handleCheckBalanceBridgeOfTonNetwork, [TonChainId]: handleCheckBalanceBridgeOfOraichain, - ['osmosis-1']: handleCheckBalanceBridgeOfOsmosis + ['osmosis-1']: handleCheckBalanceBridgeOfTonNetwork }; - const { balance } = handler[networkFrom] ? await handler[networkFrom](token) : { balance: 0 }; + const { balance } = handler[networkFrom] ? (await handler[networkFrom](token)) || { balance: 0 } : { balance: 0 }; return toDisplay(balance || 0, token.decimals || token.decimals || CW20_DECIMALS); }; From 3df5141fbc2dff5b804d7d3b4dfd68108f96ed46 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Mon, 4 Nov 2024 18:18:04 +0700 Subject: [PATCH 07/21] fix: bridge native --- .../SelectTokenModal/SelectTokenModal.tsx | 125 ++++++++++-------- src/config/chainInfos.ts | 24 +--- src/helper/index.tsx | 7 +- src/pages/Balance/TokenItem/index.tsx | 5 +- .../Balance/TransferConvertToken/index.tsx | 79 ++++++----- src/pages/Balance/helpers.ts | 14 +- .../Balance/hooks/useTonBridgeHandler.ts | 31 ++++- src/pages/Balance/index.tsx | 47 ++++--- 8 files changed, 191 insertions(+), 141 deletions(-) diff --git a/src/components/Modals/SelectTokenModal/SelectTokenModal.tsx b/src/components/Modals/SelectTokenModal/SelectTokenModal.tsx index 48221efe9..7e0a8effd 100644 --- a/src/components/Modals/SelectTokenModal/SelectTokenModal.tsx +++ b/src/components/Modals/SelectTokenModal/SelectTokenModal.tsx @@ -45,63 +45,80 @@ export const SelectTokenModal: FC = ({
{type === 'token' ? 'Select a token' : 'Select a network'}
- {items?.map((item: TokenItemType | CustomChainInfo) => { - let key: string, title: string, balance: string; - let tokenAndChainIcons; - if (type === 'token') { - const token = item as TokenItemType; - key = token.denom; - title = token.name; - let sumAmountDetails: AmountDetails = {}; - // by default, we only display the amount that matches the token denom - sumAmountDetails[token.denom] = amounts[token.denom]; - let sumAmount: number = toSumDisplay(sumAmountDetails); - // if there are sub-denoms, we get sub amounts & calculate sum display of both sub & main amount - if (token.evmDenoms) { - const subAmounts = getSubAmountDetails(amounts, token); - sumAmountDetails = { ...sumAmountDetails, ...subAmounts }; - sumAmount = toSumDisplay(sumAmountDetails); + {items + ?.map((item: TokenItemType | CustomChainInfo) => { + let key: string, title: string, balance: string, rawBalance: string; + let tokenAndChainIcons; + if (type === 'token') { + const token = item as TokenItemType; + key = token.denom; + title = token.name; + let sumAmountDetails: AmountDetails = {}; + // by default, we only display the amount that matches the token denom + sumAmountDetails[token.denom] = amounts[token.denom]; + let sumAmount: number = toSumDisplay(sumAmountDetails); + // if there are sub-denoms, we get sub amounts & calculate sum display of both sub & main amount + if (token.evmDenoms) { + const subAmounts = getSubAmountDetails(amounts, token); + sumAmountDetails = { ...sumAmountDetails, ...subAmounts }; + sumAmount = toSumDisplay(sumAmountDetails); + } + tokenAndChainIcons = tokensIcon.find((tokenIcon) => tokenIcon.coinGeckoId === token.coinGeckoId); + balance = sumAmount > 0 ? sumAmount.toFixed(truncDecimals) : '0'; + rawBalance = balance; + } else { + const network = item as CustomChainInfo; + key = network.chainId.toString(); + title = network.chainName; + const subAmounts = Object.fromEntries( + Object.entries(amounts).filter( + ([denom]) => tokenMap[denom] && tokenMap[denom].chainId === network.chainId + ) + ); + const totalUsd = getTotalUsd(subAmounts, prices); + tokenAndChainIcons = chainIcons.find((chainIcon) => chainIcon.chainId === network.chainId); + rawBalance = totalUsd > 0 ? totalUsd.toFixed(2) : '0'; + balance = '$' + rawBalance; } - tokenAndChainIcons = tokensIcon.find((tokenIcon) => tokenIcon.coinGeckoId === token.coinGeckoId); - balance = sumAmount > 0 ? sumAmount.toFixed(truncDecimals) : '0'; - } else { - const network = item as CustomChainInfo; - key = network.chainId.toString(); - title = network.chainName; - const subAmounts = Object.fromEntries( - Object.entries(amounts).filter(([denom]) => tokenMap[denom] && tokenMap[denom].chainId === network.chainId) - ); - const totalUsd = getTotalUsd(subAmounts, prices); - tokenAndChainIcons = chainIcons.find((chainIcon) => chainIcon.chainId === network.chainId); - balance = '$' + (totalUsd > 0 ? totalUsd.toFixed(2) : '0'); - } - const icon = - tokenAndChainIcons && theme === 'light' ? ( - - ) : ( - - ); + const icon = + tokenAndChainIcons && theme === 'light' ? ( + + ) : ( + + ); - return ( -
{ - setToken(key, type === 'token' && (item as TokenItemType).contractAddress); - if (setSymbol) { - setSymbol(title); - } - close(); - }} - > - {icon} -
-
{title}
+ return { + ...item, + key, + title, + balance, + rawBalance, + icon + }; + }) + .sort((a, b) => Number(b.rawBalance || 0) - Number(a.rawBalance || 0)) + .map((item, idx) => { + const { key, title, balance, icon } = item; + return ( +
{ + setToken(key, type === 'token' && (item as TokenItemType).contractAddress); + if (setSymbol) { + setSymbol(title); + } + close(); + }} + > + {icon} +
+
{title}
+
+
{balance}
-
{balance}
-
- ); - })} + ); + })}
diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index 90e061d5c..c2536914d 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -290,8 +290,11 @@ export const OraiToken: BridgeAppCurrency = { export const oraichainNetwork: CustomChainInfo = { ...customOraichainNetwork, currencies: [...customOraichainNetwork.currencies].map((tk) => { - if (tk.coinGeckoId === 'the-open-network') { - const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, 'osmosis-1', ...(tk.bridgeTo || [])])] }; + if (['tether', 'usd-coin', 'the-open-network', 'hamster-kombat'].includes(tk.coinGeckoId)) { + const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, ...(tk.bridgeTo || [])])] }; + if (tk.coinGeckoId === 'the-open-network') { + bridgeToken.bridgeTo.push('osmosis-1'); + } return bridgeToken; } @@ -360,7 +363,7 @@ export const chainInfosWithSdk = [ ...net.currencies, { chainId: 'osmosis-1', - bridgeTo: [TonChainId], + bridgeTo: ['Oraichain', TonChainId], coinDenom: 'TON.orai', name: 'TON', symbol: 'TON.orai', @@ -374,7 +377,7 @@ export const chainInfosWithSdk = [ }, { chainId: 'osmosis-1', - bridgeTo: [TonChainId], + bridgeTo: ['Oraichain', TonChainId], coinDenom: 'TON', name: 'TON', symbol: 'TON', @@ -396,17 +399,6 @@ export const chainInfosWithSdk = [ return fmtOsmoChain; } else if (net.chainId === 'Oraichain') { - console.log('net', net, { - ...net, - currencies: [...net.currencies].map((tk) => { - if (['tether', 'usd-coin', 'the-open-network', 'hamster-kombat'].includes(tk.coinGeckoId)) { - const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, ...(tk.bridgeTo || [])])] }; - return bridgeToken; - } - - return tk; - }) - }); return { ...net, currencies: [...net.currencies].map((tk) => { @@ -428,8 +420,6 @@ export const chainInfosWithSdk = [ ]; export const chainInfos = mapListWithIcon(chainInfosWithSdk, chainIcons, 'chainId'); -console.log('chainInfos', chainInfos); - // exclude kawaiverse subnet and other special evm that has different cointype export const evmChains = chainInfos.filter( (c) => c.networkType === 'evm' && c.bip44.coinType === 60 && c.chainId !== '0x1ae6' diff --git a/src/helper/index.tsx b/src/helper/index.tsx index c5e6029ce..65988633d 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -11,7 +11,8 @@ import { MULTIPLIER, TRON_SCAN, EVM_CHAIN_ID_COMMON, - WalletType as WalletCosmosType + WalletType as WalletCosmosType, + oraichainNetwork } from '@oraichain/oraidex-common'; import { network } from 'config/networks'; import { serializeError } from 'serialize-error'; @@ -80,6 +81,10 @@ export const filterChainBridge = (token: Tokens, item: CustomChainInfo) => { return tokenCanBridgeTo.includes(item.chainId); }; +export const findChainByChainId = (chainId: string) => { + return networks.find((n) => n.chainId === chainId) || oraichainNetwork; +}; + export const getDenomEvm = (): EvmDenom => { switch (Number(window.ethereumDapp?.chainId)) { case Networks.bsc: diff --git a/src/pages/Balance/TokenItem/index.tsx b/src/pages/Balance/TokenItem/index.tsx index fccc579df..3f464086d 100644 --- a/src/pages/Balance/TokenItem/index.tsx +++ b/src/pages/Balance/TokenItem/index.tsx @@ -22,6 +22,7 @@ export interface TokenItemProps { isBtcToken?: boolean; isFastMode?: boolean; setIsFastMode?: Function; + setToNetworkChainId: Function; } const TokenItem: React.FC = ({ @@ -37,7 +38,8 @@ const TokenItem: React.FC = ({ isBtcOfOwallet, isBtcToken, isFastMode, - setIsFastMode + setIsFastMode, + setToNetworkChainId }) => { const tokenIcon = tokensIcon.find((tok) => tok.coinGeckoId === token.coinGeckoId); const isActive = isBtcToken ? isBtcOfOwallet && active : active; @@ -85,6 +87,7 @@ const TokenItem: React.FC = ({ convertKwt={convertKwt} isFastMode={isFastMode} setIsFastMode={setIsFastMode} + setToNetwork={setToNetworkChainId} /> )}
diff --git a/src/pages/Balance/TransferConvertToken/index.tsx b/src/pages/Balance/TransferConvertToken/index.tsx index fb5daec17..fb68e8ff1 100644 --- a/src/pages/Balance/TransferConvertToken/index.tsx +++ b/src/pages/Balance/TransferConvertToken/index.tsx @@ -19,7 +19,7 @@ import TokenBalance from 'components/TokenBalance'; import { cosmosTokens, flattenTokens, tokenMap } from 'config/bridgeTokens'; import { btcChains, evmChains, OsmosisTokenList, tonNetworkMainnet } from 'config/chainInfos'; import copy from 'copy-to-clipboard'; -import { filterChainBridge, getAddressTransfer, networks } from 'helper'; +import { filterChainBridge, findChainByChainId, getAddressTransfer, networks } from 'helper'; import { useCoinGeckoPrices } from 'hooks/useCoingecko'; import useConfigReducer from 'hooks/useConfigReducer'; import useTokenFee, { useRelayerFeeToken } from 'hooks/useTokenFee'; @@ -40,7 +40,7 @@ import { useGetContractConfig } from 'pages/BitcoinDashboardV2/hooks'; import ToggleSwitch from 'components/ToggleSwitch'; import { CWBitcoinFactoryDenom } from 'helper/constants'; import useGetFee from '../hooks/useGetFee'; -import useTonBridgeHandler from '../hooks/useTonBridgeHandler'; +import useTonBridgeHandler, { EXTERNAL_MESSAGE_FEE } from '../hooks/useTonBridgeHandler'; import { TonChainId } from 'context/ton-provider'; interface TransferConvertProps { @@ -51,6 +51,7 @@ interface TransferConvertProps { subAmounts?: object; isFastMode?: boolean; setIsFastMode?: Function; + setToNetwork: Function; } const TransferConvertToken: FC = ({ @@ -60,9 +61,14 @@ const TransferConvertToken: FC = ({ onClickTransfer, subAmounts, isFastMode, - setIsFastMode + setIsFastMode, + setToNetwork }) => { - const bridgeNetworks = networks.filter((item) => filterChainBridge(token, item)); + // const bridgeNetworks = networks.filter((item) => filterChainBridge(token, item)); + const bridgeNetworks = [...(token?.bridgeTo || ['Oraichain'])].map((chainId) => { + const net = findChainByChainId(chainId); + return net; + }); const [[convertAmount, convertUsd], setConvertAmount] = useState([undefined, 0]); const [transferLoading, setTransferLoading] = useState(false); const [copied, setCopied] = useState(false); @@ -87,6 +93,7 @@ const TransferConvertToken: FC = ({ const address = await getAddressTransfer(findNetwork, walletByNetworks); setAddressTransfer(address); setToNetworkChainId(defaultToChainId); + setToNetwork(defaultToChainId); } })(); }, [token.chainId]); @@ -277,7 +284,7 @@ const TransferConvertToken: FC = ({ )} {toNetworkChainId === TonChainId && (

- Max Bridge Balances:{' '} + Available amount:{' '} {balanceMax.toFixed(6)} {token.name} @@ -372,31 +379,31 @@ const TransferConvertToken: FC = ({ {isOpen && (

    - {networks - .filter((item) => filterChainBridge(token, item)) - .map((net) => { - return ( -
  • { - e.stopPropagation(); - const address = await getAddressTransfer(net, walletByNetworks); - setAddressTransfer(address); - setToNetworkChainId(net.chainId); - setIsOpen(false); - }} - > - {net && ( -
    -
    - -
    -
    {net.chainName}
    + {[...(token?.bridgeTo || ['Oraichain'])].map((chainId) => { + const net = findChainByChainId(chainId); + return ( +
  • { + e.stopPropagation(); + const address = await getAddressTransfer(net, walletByNetworks); + setAddressTransfer(address); + setToNetworkChainId(net.chainId); + setToNetwork(net.chainId); + setIsOpen(false); + }} + > + {net && ( +
    +
    +
    - )} -
  • - ); - })} +
    {net.chainName}
    +
+ )} + + ); + })}
)} @@ -438,6 +445,7 @@ const TransferConvertToken: FC = ({ if (token.chainId === TonChainId && token.coinGeckoId === 'the-open-network') { const finalAmount = new BigDecimal(maxAmount) .sub(toDisplay(deductNativeAmount || 0n, token.decimals)) + .sub(deductNativeAmount > 0n ? EXTERNAL_MESSAGE_FEE : 0) .toNumber(); setConvertAmount([finalAmount * coeff, amountDetail.usd * coeff]); @@ -472,19 +480,6 @@ const TransferConvertToken: FC = ({ />
)} - - {token.denom === CWBitcoinFactoryDenom && ( -
- Fast Mode{' '} - setIsFastMode((fastMode) => !fastMode)} - /> -
- )}
{(() => { diff --git a/src/pages/Balance/helpers.ts b/src/pages/Balance/helpers.ts index eb8c29947..4d5c342cc 100644 --- a/src/pages/Balance/helpers.ts +++ b/src/pages/Balance/helpers.ts @@ -380,9 +380,17 @@ export const transferIbcCustom = async ( export const findDefaultToToken = (from: TokenItemType) => { if (!from.bridgeTo) return; - return flattenTokens.find( - (t) => from.bridgeTo.includes(t.chainId) && from.name.includes(t.name) && from.chainId !== t.chainId - ); + + const defaultToken = flattenTokens.find((t) => { + const defaultChain = from.bridgeTo[0]; + return defaultChain === t.chainId && from.coinGeckoId === t.coinGeckoId && from.chainId !== t.chainId; + }); + + return defaultToken; + + // return flattenTokens.find( + // (t) => from.bridgeTo.includes(t.chainId) && from.name.includes(t.name) && from.chainId !== t.chainId + // ); }; export const convertKwt = async (transferAmount: number, fromToken: TokenItemType): Promise => { diff --git a/src/pages/Balance/hooks/useTonBridgeHandler.ts b/src/pages/Balance/hooks/useTonBridgeHandler.ts index 7f895c214..7e112fa4e 100644 --- a/src/pages/Balance/hooks/useTonBridgeHandler.ts +++ b/src/pages/Balance/hooks/useTonBridgeHandler.ts @@ -53,7 +53,7 @@ import useGetStateData from './useGetStateData'; const FWD_AMOUNT = toNano(0.15); const TON_MESSAGE_VALID_UNTIL = 100000; const BRIDGE_TON_TO_ORAI_MINIMUM_GAS = toNano(1); -const EXTERNAL_MESSAGE_FEE = toNano(0.01); +const EXTERNAL_MESSAGE_FEE = 0.01; const MINIMUM_BRIDGE_PER_USD = 1; // 10; // TODO: update for product is 10 export { @@ -155,7 +155,6 @@ const useTonBridgeHandler = ({ const jettonWallet = JettonWallet.createFromAddress(Address.parse(walletsTon[token.denom])); const jettonWalletContract = client.open(jettonWallet); const balance = await jettonWalletContract.getBalance(); - console.log({ bridgeAdapter, jettonWallet, balance }); return { balance: balance.amount }; @@ -169,6 +168,7 @@ const useTonBridgeHandler = ({ if (token) { if (!token.contractAddress) { const data = await window.client.getBalance(network.CW_TON_BRIDGE, token.denom); + return { balance: data.amount }; @@ -302,13 +302,14 @@ const useTonBridgeHandler = ({ const tokenInOrai = oraichainTokensWithIcon.find((tk) => tk.coinGeckoId === token.coinGeckoId); const balanceMax = await checkBalanceBridgeByNetwork(TonChainId, tokenInOrai); - if (!tokenInOrai?.mintBurn && Number(balanceMax) < Number(amount)) { + const isMintBurn = ['hamster-kombat', 'the-open-network'].includes(tokenInOrai?.coinGeckoId); + + if (!isMintBurn && Number(balanceMax) < Number(amount)) { // setLoading(false); throw `The bridge contract does not have enough balance to process this bridge transaction. Wanted ${amount} ${ token['coinDenom'] || token.name }, have ${balanceMax} ${token['coinDenom'] || token.name}`; } - const bridgeAdapterAddress = Address.parse(TonInteractionContract[TonNetwork.Mainnet].bridgeAdapter); const fmtAmount = new BigDecimal(10).pow(token.decimals || token['coinDecimals']).mul(amount); const isNativeTon: boolean = token.contractAddress === TON_ZERO_ADDRESS; @@ -386,7 +387,6 @@ const useTonBridgeHandler = ({ memo = beginCell().storeStringRefTail(buildMemoSwap).endCell(); } - console.log('contractAddress:', token.contractAddress); const getNativeBridgePayload = () => BridgeAdapter.buildBridgeTonBody( { @@ -402,6 +402,20 @@ const useTonBridgeHandler = ({ } ).toBoc(); + console.log('first', { + data: { + amount: BigInt(fmtAmount.toString()), + memo, + remoteReceiver: oraiAddress, + timeout + }, + oraiAddressBech32, + ops: { + queryId: 0, + value: toNano(0) // don't care this + } + }); + const getOtherBridgeTokenPayload = () => JettonWallet.buildSendTransferPacket( Address.parse(tonAddress), @@ -419,6 +433,12 @@ const useTonBridgeHandler = ({ const boc = isNativeTon ? getNativeBridgePayload() : getOtherBridgeTokenPayload(); + console.log('Debug', { + address: toAddress, // dia chi token + amount: gasAmount, // gas + payload: Base64.encode(boc) + }); + const tx = await tonConnectUI.sendTransaction({ validUntil: TON_MESSAGE_VALID_UNTIL, messages: [ @@ -468,6 +488,7 @@ const useTonBridgeHandler = ({ // Osmosis -> Ton if (isFromOsmosisToOraichain || isFromOraichainToOsmosis || isFromOsmosisToTon) { if (isFromOsmosisToTon) { + console.log('470', token, amount, bridgeFee, token, fromNetwork, toNetwork); validatePrice(token, Number(amount)); } const timeout = Math.floor(new Date().getTime() / 1000) + 3600; diff --git a/src/pages/Balance/index.tsx b/src/pages/Balance/index.tsx index f89ef9e76..1fd1dc653 100644 --- a/src/pages/Balance/index.tsx +++ b/src/pages/Balance/index.tsx @@ -112,6 +112,7 @@ const Balance: React.FC = () => { const [isDepositBtcModal, setIsDepositBtcModal] = useState(false); const [, setTxHash] = useState(''); const [[from, to], setTokenBridge] = useState([]); + const [toNetworkChainId, setToNetworkChainId] = useState(); const [[otherChainTokens, oraichainTokens], setTokens] = useState([[], []]); const [walletByNetworks] = useWalletReducer('walletsByNetwork'); @@ -127,7 +128,7 @@ const Balance: React.FC = () => { const { handleBridgeFromCosmos, handleBridgeFromTon } = useTonBridgeHandler({ token: from, fromNetwork: from?.chainId, - toNetwork: to?.chainId + toNetwork: toNetworkChainId }); const [isFastMode, setIsFastMode] = useState(true); const depositV2Fee = useDepositFeesBitcoinV2(true); @@ -162,6 +163,7 @@ const Balance: React.FC = () => { getAddress(); } }, [oraiAddress, isOwallet]); + useOnClickOutside(ref, () => { setTokenBridge([undefined, undefined]); }); @@ -434,23 +436,30 @@ const Balance: React.FC = () => { } }; - const checkTransferTon = async (fromAmount: number) => { - const isTontoOraichain = from.chainId === (TonChainId as any) && to.chainId === 'Oraichain'; - const isOraichainToTON = from.chainId === 'Oraichain' && to.chainId === TonChainId; - if (isTontoOraichain || isOraichainToTON) { - handleTransferTon({ - isTonToOraichain: isTontoOraichain, - transferAmount: fromAmount - }); + const checkTransferTon = async () => { + const isFromTon = from.chainId === (TonChainId as any) && !!to.chainId; + const isFromCosmosToTON = !!from.chainId && to.chainId === TonChainId; + const isBridgeWithOraiAndOsmo = + [from.chainId, to.chainId].includes('Oraichain') && [from.chainId, to.chainId].includes('osmosis-1'); + + const isFromCosmos = isFromCosmosToTON || isBridgeWithOraiAndOsmo; - return true; + if (isFromCosmos || isFromTon) { + return { + isTonBridge: true, + isFromTon + }; } + return { + isTonBridge: false, + isFromTon + }; }; - const handleTransferTon = async ({ isTonToOraichain, transferAmount }) => { + const handleTransferTon = async ({ isTonToCosmos, transferAmount }) => { const tonAddress = window.Ton.account?.address; if (!tonAddress) throw Error('Not found your ton address!'); - if (isTonToOraichain) { + if (isTonToCosmos) { return await handleBridgeFromTon(transferAmount); } return await handleBridgeFromCosmos(transferAmount); @@ -507,7 +516,6 @@ const Balance: React.FC = () => { try { await handleCheckWallet(); - console.log(from, to); assert(from && to, 'Please choose both from and to tokens'); // get & check balance @@ -525,8 +533,14 @@ const Balance: React.FC = () => { let result: DeliverTxResponse | string | any; // check transfer TON <=> ORAICHAIN - const isTonBridge = await checkTransferTon(fromAmount); + const { isTonBridge, isFromTon } = await checkTransferTon(); + if (isTonBridge) { + await handleTransferTon({ + isTonToCosmos: isFromTon, + transferAmount: fromAmount + }); + return; } @@ -563,10 +577,6 @@ const Balance: React.FC = () => { // hardcode case Neutaro-1 & Noble-1 if (from.chainId === 'Neutaro-1') return await handleTransferIBC(from, newToToken, fromAmount); - console.log('from', from, to); - if (to.chainId === TonChainId) { - } - // remaining tokens, we override from & to of onClickTransfer on index.tsx of Balance based on the user's token destination choice // to is Oraibridge tokens // or other token that have same coingeckoId that show in at least 2 chain. @@ -809,6 +819,7 @@ const Balance: React.FC = () => { }} isFastMode={isFastMode} setIsFastMode={setIsFastMode} + setToNetworkChainId={setToNetworkChainId} />
); From 23a55c87751f81ef3cc363ebd8165c42a84f7db0 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Tue, 5 Nov 2024 17:51:24 +0700 Subject: [PATCH 08/21] fix: update build vite --- src/libs/duckdb.ts | 29 +++++++++++++++++++++++------ vite.config.ts | 5 +++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/libs/duckdb.ts b/src/libs/duckdb.ts index 21a248dbc..8e36515d7 100644 --- a/src/libs/duckdb.ts +++ b/src/libs/duckdb.ts @@ -1,7 +1,24 @@ import { NetworkChainId } from '@oraichain/oraidex-common'; import * as duckdb from '@duckdb/duckdb-wasm'; +import duckdb_wasm from '@duckdb/duckdb-wasm/dist/duckdb-mvp.wasm?url'; +import mvp_worker from '@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js?url'; +import duckdb_wasm_next from '@duckdb/duckdb-wasm/dist/duckdb-eh.wasm?url'; +import eh_worker from '@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js?url'; import { get, set } from 'idb-keyval'; -import eh_worker from '@duckdb/duckdb-wasm/dist/duckdb-eh.wasm?url'; + +const MANUAL_BUNDLES = { + mvp: { + mainModule: duckdb_wasm, + mainWorker: mvp_worker + }, + eh: { + mainModule: duckdb_wasm_next, + // mainWorker: new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', import.meta.url).toString(), + mainWorker: eh_worker + } +}; +// Select a bundle based on browser checks +const bundle = await duckdb.selectBundle(MANUAL_BUNDLES); export type TransactionHistory = { initialTxHash: string; @@ -48,6 +65,9 @@ const decompress = async (buf: Uint8Array) => { } }; +const worker = new Worker(bundle.mainWorker); +const logger = import.meta.env.NODE_ENV === 'development' ? new duckdb.ConsoleLogger() : new duckdb.VoidLogger(); + export class DuckDb { static instance: DuckDb; @@ -57,11 +77,8 @@ export class DuckDb { if (!DuckDb.instance) { // Select a bundle based on browser checks // Instantiate the asynchronus version of DuckDB-Wasm - const db = new duckdb.AsyncDuckDB( - import.meta.env.NODE_ENV === 'development' ? new duckdb.ConsoleLogger() : new duckdb.VoidLogger(), - new Worker(new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', import.meta.url).toString()) - ); - await db.instantiate(eh_worker); + const db = new duckdb.AsyncDuckDB(logger, worker); + await db.instantiate(bundle.mainModule, bundle.pthreadWorker); const conn = await db.connect(); DuckDb.instance = new DuckDb(conn, db); } diff --git a/vite.config.ts b/vite.config.ts index 510f52d48..655f94288 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -37,5 +37,10 @@ export default defineConfig({ commonjsOptions: { transformMixedEsModules: true }, outDir: path.resolve(__dirname, 'build'), rollupOptions: {} + }, + esbuild: { + supported: { + 'top-level-await': true //browsers can handle top-level-await features + } } }); From 0c0b8ef429f1cb254d820cb69f3fc0f557f81ea4 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Tue, 5 Nov 2024 17:57:37 +0700 Subject: [PATCH 09/21] fix: update build vite --- vite.config.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 655f94288..c9f359467 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -37,10 +37,10 @@ export default defineConfig({ commonjsOptions: { transformMixedEsModules: true }, outDir: path.resolve(__dirname, 'build'), rollupOptions: {} - }, - esbuild: { - supported: { - 'top-level-await': true //browsers can handle top-level-await features - } } + // esbuild: { + // supported: { + // 'top-level-await': true //browsers can handle top-level-await features + // } + // } }); From 711f19b19ec96a530da0977545974923184493df Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Wed, 6 Nov 2024 10:39:23 +0700 Subject: [PATCH 10/21] fix: update build --- package.json | 12 +- src/libs/duckdb.ts | 29 +-- vite.config.ts | 5 +- yarn.lock | 552 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 555 insertions(+), 43 deletions(-) diff --git a/package.json b/package.json index 3bfead7b6..9fa365ea1 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "@oraichain/kawaiiverse-txs": "^0.0.3", "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common-ui": "1.0.11", + "@oraichain/oraidex-contracts-sdk": "1.0.51-beta.3", + "@oraichain/oraidex-universal-swap": "1.1.16", "@oraichain/ton-bridge-contracts": "^0.15.8", "@oraichain/tonbridge-contracts-sdk": "^1.3.1", "@orbs-network/ton-access": "^2.3.3", - "@oraichain/oraidex-contracts-sdk": "1.0.51-beta.3", - "@oraichain/oraidex-universal-swap": "1.1.16", "@react-spring/web": "^9.7.5", "@reduxjs/toolkit": "^1.9.3", "@sentry/react": "7.99.0", @@ -40,12 +40,12 @@ "@ton/ton": "^14.0.0", "@tonconnect/protocol": "^2.2.6", "@tonconnect/ui-react": "^2.0.6", - "@vitejs/plugin-react": "^4.3.1", "@visx/curve": "^2.17.0", "@visx/gradient": "^3.3.0", "@visx/responsive": "^2.17.0", "@visx/scale": "^2.18.0", "@visx/xychart": "^3.11.0", + "@vitejs/plugin-react": "^4.3.1", "@walletconnect/browser-utils": "^1.8.0", "@walletconnect/ethereum-provider": "^1.7.8", "axios": "^0.26.1", @@ -119,15 +119,17 @@ "ts-jest": "^29.1.1", "typed-scss-modules": "^7.1.4", "typescript": "^5.1.6", - "vite-plugin-node-polyfills": "^0.22.0", "vite": "^5.4.10", + "vite-plugin-commonjs": "^0.10.3", + "vite-plugin-node-polyfills": "^0.22.0", + "vite-plugin-require": "^1.2.14", "vite-plugin-wasm": "^3.3.0", "vitest": "2.0.2" }, "scripts": { "analyze": "source-map-explorer 'build/static/js/*.js'", "start": "vite", - "build": "vite build", + "build": "NODE_OPTIONS='--max-old-space-size=12288' vite build", "serve": "vite serve", "ts-check": "tsc --noEmit", "postinstall": "patch-package", diff --git a/src/libs/duckdb.ts b/src/libs/duckdb.ts index 8e36515d7..21a248dbc 100644 --- a/src/libs/duckdb.ts +++ b/src/libs/duckdb.ts @@ -1,24 +1,7 @@ import { NetworkChainId } from '@oraichain/oraidex-common'; import * as duckdb from '@duckdb/duckdb-wasm'; -import duckdb_wasm from '@duckdb/duckdb-wasm/dist/duckdb-mvp.wasm?url'; -import mvp_worker from '@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js?url'; -import duckdb_wasm_next from '@duckdb/duckdb-wasm/dist/duckdb-eh.wasm?url'; -import eh_worker from '@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js?url'; import { get, set } from 'idb-keyval'; - -const MANUAL_BUNDLES = { - mvp: { - mainModule: duckdb_wasm, - mainWorker: mvp_worker - }, - eh: { - mainModule: duckdb_wasm_next, - // mainWorker: new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', import.meta.url).toString(), - mainWorker: eh_worker - } -}; -// Select a bundle based on browser checks -const bundle = await duckdb.selectBundle(MANUAL_BUNDLES); +import eh_worker from '@duckdb/duckdb-wasm/dist/duckdb-eh.wasm?url'; export type TransactionHistory = { initialTxHash: string; @@ -65,9 +48,6 @@ const decompress = async (buf: Uint8Array) => { } }; -const worker = new Worker(bundle.mainWorker); -const logger = import.meta.env.NODE_ENV === 'development' ? new duckdb.ConsoleLogger() : new duckdb.VoidLogger(); - export class DuckDb { static instance: DuckDb; @@ -77,8 +57,11 @@ export class DuckDb { if (!DuckDb.instance) { // Select a bundle based on browser checks // Instantiate the asynchronus version of DuckDB-Wasm - const db = new duckdb.AsyncDuckDB(logger, worker); - await db.instantiate(bundle.mainModule, bundle.pthreadWorker); + const db = new duckdb.AsyncDuckDB( + import.meta.env.NODE_ENV === 'development' ? new duckdb.ConsoleLogger() : new duckdb.VoidLogger(), + new Worker(new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', import.meta.url).toString()) + ); + await db.instantiate(eh_worker); const conn = await db.connect(); DuckDb.instance = new DuckDb(conn, db); } diff --git a/vite.config.ts b/vite.config.ts index c9f359467..e40f85b76 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,10 +5,12 @@ import svgr from 'vite-plugin-svgr'; import wasm from 'vite-plugin-wasm'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; import path from 'path'; +import vitePluginRequire from 'vite-plugin-require'; +import commonjs from 'vite-plugin-commonjs'; export default defineConfig({ base: '', - plugins: [react(), wasm(), viteTsconfigPaths(), svgr(), nodePolyfills()], + plugins: [react(), commonjs(), wasm(), viteTsconfigPaths(), svgr(), nodePolyfills()], server: { open: true, port: 3000 @@ -34,6 +36,7 @@ export default defineConfig({ } }, build: { + minify: false, commonjsOptions: { transformMixedEsModules: true }, outDir: path.resolve(__dirname, 'build'), rollupOptions: {} diff --git a/yarn.lock b/yarn.lock index 12a975da6..718f1181d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -120,6 +120,15 @@ "@babel/highlight" "^7.24.7" picocolors "^1.0.0" +"@babel/code-frame@^7.25.9": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" + integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== + dependencies: + "@babel/helper-validator-identifier" "^7.25.9" + js-tokens "^4.0.0" + picocolors "^1.0.0" + "@babel/compat-data@^7.20.5", "@babel/compat-data@^7.25.2": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.2.tgz#e41928bd33475305c586f6acbbb7e3ade7a6f7f5" @@ -197,6 +206,17 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.24.5", "@babel/generator@^7.25.9": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.2.tgz#87b75813bec87916210e5e01939a4c823d6bb74f" + integrity sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw== + dependencies: + "@babel/parser" "^7.26.2" + "@babel/types" "^7.26.0" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + "@babel/generator@^7.24.8": version "7.24.10" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.10.tgz#a4ab681ec2a78bbb9ba22a3941195e28a81d8e76" @@ -471,6 +491,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz#d50e8d37b1176207b4fe9acedec386c565a44a54" integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g== +"@babel/helper-string-parser@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" + integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== + "@babel/helper-validator-identifier@^7.22.20": version "7.22.20" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" @@ -486,6 +511,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5" integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg== +"@babel/helper-validator-identifier@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" + integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== + "@babel/helper-validator-option@^7.23.5": version "7.23.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" @@ -549,6 +579,13 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.0.tgz#26a3d1ff49031c53a97d03b604375f028746a9ac" integrity sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg== +"@babel/parser@^7.24.5", "@babel/parser@^7.25.9", "@babel/parser@^7.26.2": + version "7.26.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.2.tgz#fd7b6f487cfea09889557ef5d4eeb9ff9a5abd11" + integrity sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ== + dependencies: + "@babel/types" "^7.26.0" + "@babel/parser@^7.24.7", "@babel/parser@^7.24.8": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.8.tgz#58a4dbbcad7eb1d48930524a3fd93d93e9084c6f" @@ -861,6 +898,15 @@ "@babel/parser" "^7.24.7" "@babel/types" "^7.24.7" +"@babel/template@^7.25.9": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" + integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/types" "^7.25.9" + "@babel/traverse@^7.14.0", "@babel/traverse@^7.16.8", "@babel/traverse@^7.24.8", "@babel/traverse@^7.25.0", "@babel/traverse@^7.25.1", "@babel/traverse@^7.25.2": version "7.25.3" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" @@ -890,6 +936,19 @@ debug "^4.3.1" globals "^11.1.0" +"@babel/traverse@^7.24.5": + version "7.25.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84" + integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw== + dependencies: + "@babel/code-frame" "^7.25.9" + "@babel/generator" "^7.25.9" + "@babel/parser" "^7.25.9" + "@babel/template" "^7.25.9" + "@babel/types" "^7.25.9" + debug "^4.3.1" + globals "^11.1.0" + "@babel/traverse@^7.24.7": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.8.tgz#6c14ed5232b7549df3371d820fbd9abfcd7dfab7" @@ -933,6 +992,14 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" +"@babel/types@^7.24.5", "@babel/types@^7.25.9", "@babel/types@^7.26.0": + version "7.26.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.0.tgz#deabd08d6b753bc8e0f198f8709fb575e31774ff" + integrity sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.24.9": version "7.24.9" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.9.tgz#228ce953d7b0d16646e755acf204f4cf3d08cc73" @@ -2887,6 +2954,14 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== +"@jridgewell/source-map@^0.3.3": + version "0.3.6" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.6.tgz#9d71ca886e32502eb9362c9a74a46787c36df81a" + integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" @@ -2905,7 +2980,7 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": +"@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== @@ -4324,6 +4399,27 @@ dependencies: "@types/node" "*" +"@types/eslint-scope@^3.7.7": + version "3.7.7" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" + integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== + dependencies: + "@types/eslint" "*" + "@types/estree" "*" + +"@types/eslint@*": + version "9.6.1" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.1.tgz#d5795ad732ce81715f27f75da913004a56751584" + integrity sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*", "@types/estree@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" + integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== + "@types/estree@1.0.5", "@types/estree@^1.0.0": version "1.0.5" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" @@ -4397,7 +4493,7 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" integrity sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg== -"@types/json-schema@^7.0.6": +"@types/json-schema@*", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.8": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -5015,6 +5111,53 @@ resolved "https://registry.yarnpkg.com/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.4.tgz#d3537432c6db6444680a596271dff8ea407343b3" integrity sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug== +"@vue/compiler-core@3.5.12": + version "3.5.12" + resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.5.12.tgz#bd70b7dabd12b0b6f31bc53418ba3da77994c437" + integrity sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw== + dependencies: + "@babel/parser" "^7.25.3" + "@vue/shared" "3.5.12" + entities "^4.5.0" + estree-walker "^2.0.2" + source-map-js "^1.2.0" + +"@vue/compiler-dom@3.5.12": + version "3.5.12" + resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.5.12.tgz#456d631d11102535b7ee6fd954cf2c93158d0354" + integrity sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg== + dependencies: + "@vue/compiler-core" "3.5.12" + "@vue/shared" "3.5.12" + +"@vue/compiler-sfc@^3.4.27": + version "3.5.12" + resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.5.12.tgz#6688120d905fcf22f7e44d3cb90f8dabc4dd3cc8" + integrity sha512-2k973OGo2JuAa5+ZlekuQJtitI5CgLMOwgl94BzMCsKZCX/xiqzJYzapl4opFogKHqwJk34vfsaKpfEhd1k5nw== + dependencies: + "@babel/parser" "^7.25.3" + "@vue/compiler-core" "3.5.12" + "@vue/compiler-dom" "3.5.12" + "@vue/compiler-ssr" "3.5.12" + "@vue/shared" "3.5.12" + estree-walker "^2.0.2" + magic-string "^0.30.11" + postcss "^8.4.47" + source-map-js "^1.2.0" + +"@vue/compiler-ssr@3.5.12": + version "3.5.12" + resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.5.12.tgz#5f1a3fbd5c44b79a6dbe88729f7801d9c9218bde" + integrity sha512-eLwc7v6bfGBSM7wZOGPmRavSWzNFF6+PdRhE+VFJhNCgHiF8AM7ccoqcv5kBXA2eWUfigD7byekvf/JsOfKvPA== + dependencies: + "@vue/compiler-dom" "3.5.12" + "@vue/shared" "3.5.12" + +"@vue/shared@3.5.12": + version "3.5.12" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.5.12.tgz#f9e45b7f63f2c3f40d84237b1194b7f67de192e3" + integrity sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg== + "@walletconnect/browser-utils@^1.8.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@walletconnect/browser-utils/-/browser-utils-1.8.0.tgz#33c10e777aa6be86c713095b5206d63d32df0951" @@ -5229,6 +5372,127 @@ dependencies: "@walletconnect/window-getters" "^1.0.0" +"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.12.1.tgz#bb16a0e8b1914f979f45864c23819cc3e3f0d4bb" + integrity sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg== + dependencies: + "@webassemblyjs/helper-numbers" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + +"@webassemblyjs/floating-point-hex-parser@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz#dacbcb95aff135c8260f77fa3b4c5fea600a6431" + integrity sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw== + +"@webassemblyjs/helper-api-error@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz#6132f68c4acd59dcd141c44b18cbebbd9f2fa768" + integrity sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q== + +"@webassemblyjs/helper-buffer@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz#6df20d272ea5439bf20ab3492b7fb70e9bfcb3f6" + integrity sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw== + +"@webassemblyjs/helper-numbers@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz#cbce5e7e0c1bd32cf4905ae444ef64cea919f1b5" + integrity sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g== + dependencies: + "@webassemblyjs/floating-point-hex-parser" "1.11.6" + "@webassemblyjs/helper-api-error" "1.11.6" + "@xtuc/long" "4.2.2" + +"@webassemblyjs/helper-wasm-bytecode@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz#bb2ebdb3b83aa26d9baad4c46d4315283acd51e9" + integrity sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA== + +"@webassemblyjs/helper-wasm-section@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz#3da623233ae1a60409b509a52ade9bc22a37f7bf" + integrity sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/wasm-gen" "1.12.1" + +"@webassemblyjs/ieee754@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz#bb665c91d0b14fffceb0e38298c329af043c6e3a" + integrity sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg== + dependencies: + "@xtuc/ieee754" "^1.2.0" + +"@webassemblyjs/leb128@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.6.tgz#70e60e5e82f9ac81118bc25381a0b283893240d7" + integrity sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ== + dependencies: + "@xtuc/long" "4.2.2" + +"@webassemblyjs/utf8@1.11.6": + version "1.11.6" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.6.tgz#90f8bc34c561595fe156603be7253cdbcd0fab5a" + integrity sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA== + +"@webassemblyjs/wasm-edit@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz#9f9f3ff52a14c980939be0ef9d5df9ebc678ae3b" + integrity sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/helper-wasm-section" "1.12.1" + "@webassemblyjs/wasm-gen" "1.12.1" + "@webassemblyjs/wasm-opt" "1.12.1" + "@webassemblyjs/wasm-parser" "1.12.1" + "@webassemblyjs/wast-printer" "1.12.1" + +"@webassemblyjs/wasm-gen@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz#a6520601da1b5700448273666a71ad0a45d78547" + integrity sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/ieee754" "1.11.6" + "@webassemblyjs/leb128" "1.11.6" + "@webassemblyjs/utf8" "1.11.6" + +"@webassemblyjs/wasm-opt@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz#9e6e81475dfcfb62dab574ac2dda38226c232bc5" + integrity sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-buffer" "1.12.1" + "@webassemblyjs/wasm-gen" "1.12.1" + "@webassemblyjs/wasm-parser" "1.12.1" + +"@webassemblyjs/wasm-parser@1.12.1", "@webassemblyjs/wasm-parser@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz#c47acb90e6f083391e3fa61d113650eea1e95937" + integrity sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@webassemblyjs/helper-api-error" "1.11.6" + "@webassemblyjs/helper-wasm-bytecode" "1.11.6" + "@webassemblyjs/ieee754" "1.11.6" + "@webassemblyjs/leb128" "1.11.6" + "@webassemblyjs/utf8" "1.11.6" + +"@webassemblyjs/wast-printer@1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz#bcecf661d7d1abdaf989d8341a4833e33e2b31ac" + integrity sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA== + dependencies: + "@webassemblyjs/ast" "1.12.1" + "@xtuc/long" "4.2.2" + "@whatwg-node/events@^0.0.3": version "0.0.3" resolved "https://registry.yarnpkg.com/@whatwg-node/events/-/events-0.0.3.tgz#13a65dd4f5893f55280f766e29ae48074927acad" @@ -5314,6 +5578,16 @@ resolved "https://registry.yarnpkg.com/@xobotyi/scrollbar-width/-/scrollbar-width-1.9.5.tgz#80224a6919272f405b87913ca13b92929bdf3c4d" integrity sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ== +"@xtuc/ieee754@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" + integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== + +"@xtuc/long@4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" + integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== + "@yarnpkg/lockfile@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" @@ -5354,6 +5628,11 @@ acorn@7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== +acorn@^8.12.1, acorn@^8.14.0, acorn@^8.8.2: + version "8.14.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== + acorn@^8.7.0, acorn@^8.8.1, acorn@^8.9.0: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" @@ -5403,7 +5682,12 @@ ajv-formats@^2.1.0: dependencies: ajv "^8.0.0" -ajv@^6.12.3, ajv@^6.12.6: +ajv-keywords@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" + integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== + +ajv@^6.12.3, ajv@^6.12.5, ajv@^6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -6153,6 +6437,16 @@ browserslist@^4.23.1: node-releases "^2.0.14" update-browserslist-db "^1.1.0" +browserslist@^4.24.0: + version "4.24.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.2.tgz#f5845bc91069dbd55ee89faf9822e1d885d16580" + integrity sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg== + dependencies: + caniuse-lite "^1.0.30001669" + electron-to-chromium "^1.5.41" + node-releases "^2.0.18" + update-browserslist-db "^1.1.1" + bs-logger@0.x: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -6216,7 +6510,7 @@ buffer-fill@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== -buffer-from@^1.1.1: +buffer-from@^1.0.0, buffer-from@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== @@ -6370,6 +6664,11 @@ caniuse-lite@^1.0.30001640: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz#9c004caef315de9452ab970c3da71085f8241dbd" integrity sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg== +caniuse-lite@^1.0.30001669: + version "1.0.30001677" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz#27c2e2c637e007cfa864a16f7dfe7cde66b38b5f" + integrity sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog== + capital-case@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/capital-case/-/capital-case-1.0.4.tgz#9d130292353c9249f6b00fa5852bee38a717e669" @@ -6534,6 +6833,11 @@ chownr@^2.0.0: resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== +chrome-trace-event@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" + integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== + ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -6751,6 +7055,11 @@ commander@^10.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + commander@^4.0.1: version "4.1.1" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" @@ -7690,6 +7999,11 @@ electron-to-chromium@^1.4.820: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.1.tgz#24640bd4dcfaccb6d82bb4c3f4c7311503241581" integrity sha512-FKbOCOQ5QRB3VlIbl1LZQefWIYwszlBloaXcY2rbfpu9ioJnNh3TK03YtIDKDo3WKBi8u+YV4+Fn2CkEozgf4w== +electron-to-chromium@^1.5.41: + version "1.5.52" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.52.tgz#2bed832c95a56a195504f918150e548474687da8" + integrity sha512-xtoijJTZ+qeucLBDNztDOuQBE1ksqjvNjvqFoST3nGC7fSpqJ+X6BdTBaY5BHG+IhWWmpc6b/KfpeuEDupEPOQ== + elliptic@6.5.4, elliptic@^6.4.1, elliptic@^6.5.2, elliptic@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" @@ -7760,6 +8074,14 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" +enhanced-resolve@^5.17.1: + version "5.17.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + entities@^4.4.0, entities@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" @@ -7806,6 +8128,11 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== +es-module-lexer@^1.2.1, es-module-lexer@^1.5.4: + version "1.5.4" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" + integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== + es6-promise@4.2.8: version "4.2.8" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" @@ -7977,6 +8304,11 @@ escalade@^3.1.2: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== +escalade@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== + escape-goat@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/escape-goat/-/escape-goat-2.1.1.tgz#1b2dc77003676c457ec760b2dc68edb648188675" @@ -8009,6 +8341,14 @@ escodegen@^1.13.0, escodegen@^1.8.1: optionalDependencies: source-map "~0.6.1" +eslint-scope@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + eslint-visitor-keys@^3.4.1: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" @@ -8028,12 +8368,19 @@ esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -estraverse@^4.2.0: +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1, estraverse@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.1.0: +estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -8241,7 +8588,7 @@ events-listener@^1.1.0: resolved "https://registry.yarnpkg.com/events-listener/-/events-listener-1.1.0.tgz#dd49b4628480eba58fde31b870ee346b3990b349" integrity sha512-Kd3EgYfODHueq6GzVfs/VUolh2EgJsS8hkO3KpnDrxVjU3eq63eXM2ujXkhPP+OkeUOhL8CxdfZbQXzryb5C4g== -events@^3.0.0, events@^3.3.0: +events@^3.0.0, events@^3.2.0, events@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== @@ -8411,7 +8758,7 @@ fast-deep-equal@3.1.3, fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.2.9: +fast-glob@^3.2.9, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -8919,6 +9266,11 @@ glob-slasher@^1.0.1: lodash.isobject "^2.4.1" toxic "^1.0.0" +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + glob@9.3.2: version "9.3.2" resolved "https://registry.yarnpkg.com/glob/-/glob-9.3.2.tgz#8528522e003819e63d11c979b30896e0eaf52eda" @@ -9121,7 +9473,7 @@ graceful-fs@4.2.10: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -10024,6 +10376,15 @@ jest-util@^29.0.0, jest-util@^29.7.0: graceful-fs "^4.2.9" picomatch "^2.2.3" +jest-worker@^27.4.5: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^8.0.0" + jiti@^1.17.1, jiti@^1.18.2: version "1.21.6" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.6.tgz#6c7f7398dd4b3142767f9a168af2f317a428d268" @@ -10204,6 +10565,11 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +jsesc@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" + integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== + json-bigint@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" @@ -10216,7 +10582,7 @@ json-bignum@^0.0.3: resolved "https://registry.yarnpkg.com/json-bignum/-/json-bignum-0.0.3.tgz#41163b50436c773d82424dbc20ed70db7604b8d7" integrity sha512-2WHyXj3OfHSgNyuzDbSxI1w2jgw5gkWSWhS7Qg4bWXx1nLk3jnbwfUeS0PSba3IzpTUWdHxBieELUzXRjQB2zg== -json-parse-even-better-errors@^2.3.0: +json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== @@ -10483,6 +10849,11 @@ load-tsconfig@^0.2.0: resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz#453b8cd8961bfb912dea77eb6c168fe8cca3d3a1" integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg== +loader-runner@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" + integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -10731,7 +11102,7 @@ magic-string@0.27.0: dependencies: "@jridgewell/sourcemap-codec" "^1.4.13" -magic-string@^0.30.10: +magic-string@^0.30.10, magic-string@^0.30.11: version "0.30.12" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.12.tgz#9eb11c9d072b9bcb4940a5b2c2e1a217e4ee1a60" integrity sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw== @@ -10922,7 +11293,7 @@ mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.35, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.35, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -11208,6 +11579,11 @@ negotiator@0.6.3, negotiator@^0.6.3: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== +neo-async@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + netmask@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" @@ -11316,6 +11692,11 @@ node-releases@^2.0.14: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== +node-releases@^2.0.18: + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== + node-stdlib-browser@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/node-stdlib-browser/-/node-stdlib-browser-1.2.1.tgz#888fa104914af94143ca4d8a8980fe0ed242d2d1" @@ -11954,7 +12335,7 @@ postcss@^6.0.1: source-map "^0.6.1" supports-color "^5.4.0" -postcss@^8.4.43: +postcss@^8.4.43, postcss@^8.4.47: version "8.4.47" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365" integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== @@ -12985,6 +13366,15 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" +schema-utils@^3.1.1, schema-utils@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== + dependencies: + "@types/json-schema" "^7.0.8" + ajv "^6.12.5" + ajv-keywords "^3.5.2" + screenfull@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.2.0.tgz#6533d524d30621fc1283b9692146f3f13a93d1ba" @@ -13127,6 +13517,13 @@ serialize-error@^8.1.0: dependencies: type-fest "^0.20.2" +serialize-javascript@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" + integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== + dependencies: + randombytes "^2.1.0" + serve-static@1.15.0: version "1.15.0" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" @@ -13390,6 +13787,14 @@ source-map-js@^1.2.0, source-map-js@^1.2.1: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map@0.5.6: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" @@ -13400,7 +13805,7 @@ source-map@^0.5.6: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== -source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -13758,6 +14163,13 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-hyperlinks@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" @@ -13816,6 +14228,11 @@ table-layout@^3.0.0: typical "^7.1.1" wordwrapjs "^5.1.0" +tapable@^2.1.1, tapable@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + tar-stream@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" @@ -13855,6 +14272,27 @@ temp@^0.9.4: mkdirp "^0.5.1" rimraf "~2.6.2" +terser-webpack-plugin@^5.3.10: + version "5.3.10" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz#904f4c9193c6fd2a03f693a2150c62a92f40d199" + integrity sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.20" + jest-worker "^27.4.5" + schema-utils "^3.1.1" + serialize-javascript "^6.0.1" + terser "^5.26.0" + +terser@^5.26.0: + version "5.36.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.36.0.tgz#8b0dbed459ac40ff7b4c9fd5a3a2029de105180e" + integrity sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w== + dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" + commander "^2.20.0" + source-map-support "~0.5.20" + teslabot@^1.3.0: version "1.5.0" resolved "https://registry.yarnpkg.com/teslabot/-/teslabot-1.5.0.tgz#70f544516699ca5f696d8ae94f3d12cd495d5cd6" @@ -14390,6 +14828,14 @@ update-browserslist-db@^1.1.0: escalade "^3.1.2" picocolors "^1.0.1" +update-browserslist-db@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5" + integrity sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A== + dependencies: + escalade "^3.2.0" + picocolors "^1.1.0" + update-notifier-cjs@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/update-notifier-cjs/-/update-notifier-cjs-5.1.6.tgz#6e3aff745d1551b55bb0a0a5939b7e636d95877d" @@ -14573,6 +15019,25 @@ vite-node@2.0.2: tinyrainbow "^1.2.0" vite "^5.0.0" +vite-plugin-commonjs@^0.10.3: + version "0.10.3" + resolved "https://registry.yarnpkg.com/vite-plugin-commonjs/-/vite-plugin-commonjs-0.10.3.tgz#e75abb1586464be9d216c829fc250df23a8542e7" + integrity sha512-trtH4dfAqrbqwiUhSKcqrfjnlXnqLHdIbYuUy943y34JnDjIX8qlpExP0nFN+kE2s6/BS6r9d1cAHS0KtiF4yQ== + dependencies: + acorn "^8.12.1" + magic-string "^0.30.11" + vite-plugin-dynamic-import "^1.6.0" + +vite-plugin-dynamic-import@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.6.0.tgz#c9680b2093fc897721fe535202acc8af77537ae4" + integrity sha512-TM0sz70wfzTIo9YCxVFwS8OA9lNREsh+0vMHGSkWDTZ7bgd1Yjs5RV8EgB634l/91IsXJReg0xtmuQqP0mf+rg== + dependencies: + acorn "^8.12.1" + es-module-lexer "^1.5.4" + fast-glob "^3.3.2" + magic-string "^0.30.11" + vite-plugin-node-polyfills@^0.22.0: version "0.22.0" resolved "https://registry.yarnpkg.com/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.22.0.tgz#d0afcf82eb985fc02244620d7cec1ddd1c6e0864" @@ -14581,6 +15046,19 @@ vite-plugin-node-polyfills@^0.22.0: "@rollup/plugin-inject" "^5.0.5" node-stdlib-browser "^1.2.0" +vite-plugin-require@^1.2.14: + version "1.2.14" + resolved "https://registry.yarnpkg.com/vite-plugin-require/-/vite-plugin-require-1.2.14.tgz#6c2861cac74fcb23f20bd3c0d3a61d823f05f774" + integrity sha512-i52DfITgYKtOZyh9kOjyy4ENTQBVHG0ozTKHQdFkGAHYqZwM3Dn2c5gsA5rR7IrHQ/PQET3SMz6HkNzZ2fXCyA== + dependencies: + "@babel/generator" "^7.24.5" + "@babel/parser" "^7.24.5" + "@babel/traverse" "^7.24.5" + "@babel/types" "^7.24.5" + "@vue/compiler-sfc" "^3.4.27" + vue-loader "^17.4.2" + webpack "^4.46.0 || ^5.0.0" + vite-plugin-svgr@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/vite-plugin-svgr/-/vite-plugin-svgr-4.2.0.tgz#9f3bf5206b0ec510287e56d16f1915e729bb4e6b" @@ -14664,6 +15142,15 @@ vm2@^3.9.17: acorn "^8.7.0" acorn-walk "^8.2.0" +vue-loader@^17.4.2: + version "17.4.2" + resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-17.4.2.tgz#f87f0d8adfcbbe8623de9eba1979d41ba223c6da" + integrity sha512-yTKOA4R/VN4jqjw4y5HrynFL8AK0Z3/Jt7eOJXEitsm0GMRHDBjCfCiuTiLP7OESvsZYo2pATCWhDqxC5ZrM6w== + dependencies: + chalk "^4.1.0" + hash-sum "^2.0.0" + watchpack "^2.4.0" + w3c-xmlserializer@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz#f925ba26855158594d907313cedd1476c5967f6c" @@ -14678,6 +15165,14 @@ warning@^4.0.3: dependencies: loose-envify "^1.0.0" +watchpack@^2.4.0, watchpack@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" + integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -14721,6 +15216,35 @@ webpack-virtual-modules@^0.5.0: resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz#362f14738a56dae107937ab98ea7062e8bdd3b6c" integrity sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw== +"webpack@^4.46.0 || ^5.0.0": + version "5.96.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.96.1.tgz#3676d1626d8312b6b10d0c18cc049fba7ac01f0c" + integrity sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA== + dependencies: + "@types/eslint-scope" "^3.7.7" + "@types/estree" "^1.0.6" + "@webassemblyjs/ast" "^1.12.1" + "@webassemblyjs/wasm-edit" "^1.12.1" + "@webassemblyjs/wasm-parser" "^1.12.1" + acorn "^8.14.0" + browserslist "^4.24.0" + chrome-trace-event "^1.0.2" + enhanced-resolve "^5.17.1" + es-module-lexer "^1.2.1" + eslint-scope "5.1.1" + events "^3.2.0" + glob-to-regexp "^0.4.1" + graceful-fs "^4.2.11" + json-parse-even-better-errors "^2.3.1" + loader-runner "^4.2.0" + mime-types "^2.1.27" + neo-async "^2.6.2" + schema-utils "^3.2.0" + tapable "^2.1.1" + terser-webpack-plugin "^5.3.10" + watchpack "^2.4.1" + webpack-sources "^3.2.3" + whatwg-encoding@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz#d0f4ef769905d426e1688f3e34381a99b60b76e5" From ec07a54fda1d05f1b7e8076b96fda3496f2f1537 Mon Sep 17 00:00:00 2001 From: quangdz1704 Date: Wed, 6 Nov 2024 11:36:26 +0700 Subject: [PATCH 11/21] fix: build vite --- index.html | 1 + package.json | 2 - src/libs/duckdb.ts | 29 ++- vite.config.ts | 15 +- yarn.lock | 552 ++------------------------------------------- 5 files changed, 44 insertions(+), 555 deletions(-) diff --git a/index.html b/index.html index e6b1cc0a6..2a070db6e 100644 --- a/index.html +++ b/index.html @@ -38,6 +38,7 @@ diff --git a/package.json b/package.json index 9fa365ea1..a849eb1d8 100644 --- a/package.json +++ b/package.json @@ -120,9 +120,7 @@ "typed-scss-modules": "^7.1.4", "typescript": "^5.1.6", "vite": "^5.4.10", - "vite-plugin-commonjs": "^0.10.3", "vite-plugin-node-polyfills": "^0.22.0", - "vite-plugin-require": "^1.2.14", "vite-plugin-wasm": "^3.3.0", "vitest": "2.0.2" }, diff --git a/src/libs/duckdb.ts b/src/libs/duckdb.ts index 21a248dbc..8e36515d7 100644 --- a/src/libs/duckdb.ts +++ b/src/libs/duckdb.ts @@ -1,7 +1,24 @@ import { NetworkChainId } from '@oraichain/oraidex-common'; import * as duckdb from '@duckdb/duckdb-wasm'; +import duckdb_wasm from '@duckdb/duckdb-wasm/dist/duckdb-mvp.wasm?url'; +import mvp_worker from '@duckdb/duckdb-wasm/dist/duckdb-browser-mvp.worker.js?url'; +import duckdb_wasm_next from '@duckdb/duckdb-wasm/dist/duckdb-eh.wasm?url'; +import eh_worker from '@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js?url'; import { get, set } from 'idb-keyval'; -import eh_worker from '@duckdb/duckdb-wasm/dist/duckdb-eh.wasm?url'; + +const MANUAL_BUNDLES = { + mvp: { + mainModule: duckdb_wasm, + mainWorker: mvp_worker + }, + eh: { + mainModule: duckdb_wasm_next, + // mainWorker: new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', import.meta.url).toString(), + mainWorker: eh_worker + } +}; +// Select a bundle based on browser checks +const bundle = await duckdb.selectBundle(MANUAL_BUNDLES); export type TransactionHistory = { initialTxHash: string; @@ -48,6 +65,9 @@ const decompress = async (buf: Uint8Array) => { } }; +const worker = new Worker(bundle.mainWorker); +const logger = import.meta.env.NODE_ENV === 'development' ? new duckdb.ConsoleLogger() : new duckdb.VoidLogger(); + export class DuckDb { static instance: DuckDb; @@ -57,11 +77,8 @@ export class DuckDb { if (!DuckDb.instance) { // Select a bundle based on browser checks // Instantiate the asynchronus version of DuckDB-Wasm - const db = new duckdb.AsyncDuckDB( - import.meta.env.NODE_ENV === 'development' ? new duckdb.ConsoleLogger() : new duckdb.VoidLogger(), - new Worker(new URL('@duckdb/duckdb-wasm/dist/duckdb-browser-eh.worker.js', import.meta.url).toString()) - ); - await db.instantiate(eh_worker); + const db = new duckdb.AsyncDuckDB(logger, worker); + await db.instantiate(bundle.mainModule, bundle.pthreadWorker); const conn = await db.connect(); DuckDb.instance = new DuckDb(conn, db); } diff --git a/vite.config.ts b/vite.config.ts index e40f85b76..655f94288 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,12 +5,10 @@ import svgr from 'vite-plugin-svgr'; import wasm from 'vite-plugin-wasm'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; import path from 'path'; -import vitePluginRequire from 'vite-plugin-require'; -import commonjs from 'vite-plugin-commonjs'; export default defineConfig({ base: '', - plugins: [react(), commonjs(), wasm(), viteTsconfigPaths(), svgr(), nodePolyfills()], + plugins: [react(), wasm(), viteTsconfigPaths(), svgr(), nodePolyfills()], server: { open: true, port: 3000 @@ -36,14 +34,13 @@ export default defineConfig({ } }, build: { - minify: false, commonjsOptions: { transformMixedEsModules: true }, outDir: path.resolve(__dirname, 'build'), rollupOptions: {} + }, + esbuild: { + supported: { + 'top-level-await': true //browsers can handle top-level-await features + } } - // esbuild: { - // supported: { - // 'top-level-await': true //browsers can handle top-level-await features - // } - // } }); diff --git a/yarn.lock b/yarn.lock index 718f1181d..12a975da6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -120,15 +120,6 @@ "@babel/highlight" "^7.24.7" picocolors "^1.0.0" -"@babel/code-frame@^7.25.9": - version "7.26.2" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" - integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== - dependencies: - "@babel/helper-validator-identifier" "^7.25.9" - js-tokens "^4.0.0" - picocolors "^1.0.0" - "@babel/compat-data@^7.20.5", "@babel/compat-data@^7.25.2": version "7.25.2" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.2.tgz#e41928bd33475305c586f6acbbb7e3ade7a6f7f5" @@ -206,17 +197,6 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" -"@babel/generator@^7.24.5", "@babel/generator@^7.25.9": - version "7.26.2" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.2.tgz#87b75813bec87916210e5e01939a4c823d6bb74f" - integrity sha512-zevQbhbau95nkoxSq3f/DC/SC+EEOUZd3DYqfSkMhY2/wfSeaHV1Ew4vk8e+x8lja31IbyuUa2uQ3JONqKbysw== - dependencies: - "@babel/parser" "^7.26.2" - "@babel/types" "^7.26.0" - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.25" - jsesc "^3.0.2" - "@babel/generator@^7.24.8": version "7.24.10" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.10.tgz#a4ab681ec2a78bbb9ba22a3941195e28a81d8e76" @@ -491,11 +471,6 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz#d50e8d37b1176207b4fe9acedec386c565a44a54" integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g== -"@babel/helper-string-parser@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" - integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== - "@babel/helper-validator-identifier@^7.22.20": version "7.22.20" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" @@ -511,11 +486,6 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5" integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg== -"@babel/helper-validator-identifier@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" - integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== - "@babel/helper-validator-option@^7.23.5": version "7.23.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" @@ -579,13 +549,6 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.0.tgz#26a3d1ff49031c53a97d03b604375f028746a9ac" integrity sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg== -"@babel/parser@^7.24.5", "@babel/parser@^7.25.9", "@babel/parser@^7.26.2": - version "7.26.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.2.tgz#fd7b6f487cfea09889557ef5d4eeb9ff9a5abd11" - integrity sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ== - dependencies: - "@babel/types" "^7.26.0" - "@babel/parser@^7.24.7", "@babel/parser@^7.24.8": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.8.tgz#58a4dbbcad7eb1d48930524a3fd93d93e9084c6f" @@ -898,15 +861,6 @@ "@babel/parser" "^7.24.7" "@babel/types" "^7.24.7" -"@babel/template@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" - integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== - dependencies: - "@babel/code-frame" "^7.25.9" - "@babel/parser" "^7.25.9" - "@babel/types" "^7.25.9" - "@babel/traverse@^7.14.0", "@babel/traverse@^7.16.8", "@babel/traverse@^7.24.8", "@babel/traverse@^7.25.0", "@babel/traverse@^7.25.1", "@babel/traverse@^7.25.2": version "7.25.3" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" @@ -936,19 +890,6 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/traverse@^7.24.5": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84" - integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw== - dependencies: - "@babel/code-frame" "^7.25.9" - "@babel/generator" "^7.25.9" - "@babel/parser" "^7.25.9" - "@babel/template" "^7.25.9" - "@babel/types" "^7.25.9" - debug "^4.3.1" - globals "^11.1.0" - "@babel/traverse@^7.24.7": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.8.tgz#6c14ed5232b7549df3371d820fbd9abfcd7dfab7" @@ -992,14 +933,6 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" -"@babel/types@^7.24.5", "@babel/types@^7.25.9", "@babel/types@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.0.tgz#deabd08d6b753bc8e0f198f8709fb575e31774ff" - integrity sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA== - dependencies: - "@babel/helper-string-parser" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" - "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.24.9": version "7.24.9" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.9.tgz#228ce953d7b0d16646e755acf204f4cf3d08cc73" @@ -2954,14 +2887,6 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== -"@jridgewell/source-map@^0.3.3": - version "0.3.6" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.6.tgz#9d71ca886e32502eb9362c9a74a46787c36df81a" - integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.25" - "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" @@ -2980,7 +2905,7 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@jridgewell/trace-mapping@^0.3.20", "@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": +"@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== @@ -4399,27 +4324,6 @@ dependencies: "@types/node" "*" -"@types/eslint-scope@^3.7.7": - version "3.7.7" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" - -"@types/eslint@*": - version "9.6.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.1.tgz#d5795ad732ce81715f27f75da913004a56751584" - integrity sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*", "@types/estree@^1.0.6": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" - integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== - "@types/estree@1.0.5", "@types/estree@^1.0.0": version "1.0.5" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" @@ -4493,7 +4397,7 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" integrity sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg== -"@types/json-schema@*", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.8": +"@types/json-schema@^7.0.6": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -5111,53 +5015,6 @@ resolved "https://registry.yarnpkg.com/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.4.tgz#d3537432c6db6444680a596271dff8ea407343b3" integrity sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug== -"@vue/compiler-core@3.5.12": - version "3.5.12" - resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.5.12.tgz#bd70b7dabd12b0b6f31bc53418ba3da77994c437" - integrity sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw== - dependencies: - "@babel/parser" "^7.25.3" - "@vue/shared" "3.5.12" - entities "^4.5.0" - estree-walker "^2.0.2" - source-map-js "^1.2.0" - -"@vue/compiler-dom@3.5.12": - version "3.5.12" - resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.5.12.tgz#456d631d11102535b7ee6fd954cf2c93158d0354" - integrity sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg== - dependencies: - "@vue/compiler-core" "3.5.12" - "@vue/shared" "3.5.12" - -"@vue/compiler-sfc@^3.4.27": - version "3.5.12" - resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.5.12.tgz#6688120d905fcf22f7e44d3cb90f8dabc4dd3cc8" - integrity sha512-2k973OGo2JuAa5+ZlekuQJtitI5CgLMOwgl94BzMCsKZCX/xiqzJYzapl4opFogKHqwJk34vfsaKpfEhd1k5nw== - dependencies: - "@babel/parser" "^7.25.3" - "@vue/compiler-core" "3.5.12" - "@vue/compiler-dom" "3.5.12" - "@vue/compiler-ssr" "3.5.12" - "@vue/shared" "3.5.12" - estree-walker "^2.0.2" - magic-string "^0.30.11" - postcss "^8.4.47" - source-map-js "^1.2.0" - -"@vue/compiler-ssr@3.5.12": - version "3.5.12" - resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.5.12.tgz#5f1a3fbd5c44b79a6dbe88729f7801d9c9218bde" - integrity sha512-eLwc7v6bfGBSM7wZOGPmRavSWzNFF6+PdRhE+VFJhNCgHiF8AM7ccoqcv5kBXA2eWUfigD7byekvf/JsOfKvPA== - dependencies: - "@vue/compiler-dom" "3.5.12" - "@vue/shared" "3.5.12" - -"@vue/shared@3.5.12": - version "3.5.12" - resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.5.12.tgz#f9e45b7f63f2c3f40d84237b1194b7f67de192e3" - integrity sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg== - "@walletconnect/browser-utils@^1.8.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@walletconnect/browser-utils/-/browser-utils-1.8.0.tgz#33c10e777aa6be86c713095b5206d63d32df0951" @@ -5372,127 +5229,6 @@ dependencies: "@walletconnect/window-getters" "^1.0.0" -"@webassemblyjs/ast@1.12.1", "@webassemblyjs/ast@^1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.12.1.tgz#bb16a0e8b1914f979f45864c23819cc3e3f0d4bb" - integrity sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg== - dependencies: - "@webassemblyjs/helper-numbers" "1.11.6" - "@webassemblyjs/helper-wasm-bytecode" "1.11.6" - -"@webassemblyjs/floating-point-hex-parser@1.11.6": - version "1.11.6" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz#dacbcb95aff135c8260f77fa3b4c5fea600a6431" - integrity sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw== - -"@webassemblyjs/helper-api-error@1.11.6": - version "1.11.6" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz#6132f68c4acd59dcd141c44b18cbebbd9f2fa768" - integrity sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q== - -"@webassemblyjs/helper-buffer@1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.12.1.tgz#6df20d272ea5439bf20ab3492b7fb70e9bfcb3f6" - integrity sha512-nzJwQw99DNDKr9BVCOZcLuJJUlqkJh+kVzVl6Fmq/tI5ZtEyWT1KZMyOXltXLZJmDtvLCDgwsyrkohEtopTXCw== - -"@webassemblyjs/helper-numbers@1.11.6": - version "1.11.6" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz#cbce5e7e0c1bd32cf4905ae444ef64cea919f1b5" - integrity sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g== - dependencies: - "@webassemblyjs/floating-point-hex-parser" "1.11.6" - "@webassemblyjs/helper-api-error" "1.11.6" - "@xtuc/long" "4.2.2" - -"@webassemblyjs/helper-wasm-bytecode@1.11.6": - version "1.11.6" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz#bb2ebdb3b83aa26d9baad4c46d4315283acd51e9" - integrity sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA== - -"@webassemblyjs/helper-wasm-section@1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.12.1.tgz#3da623233ae1a60409b509a52ade9bc22a37f7bf" - integrity sha512-Jif4vfB6FJlUlSbgEMHUyk1j234GTNG9dBJ4XJdOySoj518Xj0oGsNi59cUQF4RRMS9ouBUxDDdyBVfPTypa5g== - dependencies: - "@webassemblyjs/ast" "1.12.1" - "@webassemblyjs/helper-buffer" "1.12.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.6" - "@webassemblyjs/wasm-gen" "1.12.1" - -"@webassemblyjs/ieee754@1.11.6": - version "1.11.6" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz#bb665c91d0b14fffceb0e38298c329af043c6e3a" - integrity sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg== - dependencies: - "@xtuc/ieee754" "^1.2.0" - -"@webassemblyjs/leb128@1.11.6": - version "1.11.6" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.6.tgz#70e60e5e82f9ac81118bc25381a0b283893240d7" - integrity sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ== - dependencies: - "@xtuc/long" "4.2.2" - -"@webassemblyjs/utf8@1.11.6": - version "1.11.6" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.6.tgz#90f8bc34c561595fe156603be7253cdbcd0fab5a" - integrity sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA== - -"@webassemblyjs/wasm-edit@^1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.12.1.tgz#9f9f3ff52a14c980939be0ef9d5df9ebc678ae3b" - integrity sha512-1DuwbVvADvS5mGnXbE+c9NfA8QRcZ6iKquqjjmR10k6o+zzsRVesil54DKexiowcFCPdr/Q0qaMgB01+SQ1u6g== - dependencies: - "@webassemblyjs/ast" "1.12.1" - "@webassemblyjs/helper-buffer" "1.12.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.6" - "@webassemblyjs/helper-wasm-section" "1.12.1" - "@webassemblyjs/wasm-gen" "1.12.1" - "@webassemblyjs/wasm-opt" "1.12.1" - "@webassemblyjs/wasm-parser" "1.12.1" - "@webassemblyjs/wast-printer" "1.12.1" - -"@webassemblyjs/wasm-gen@1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.12.1.tgz#a6520601da1b5700448273666a71ad0a45d78547" - integrity sha512-TDq4Ojh9fcohAw6OIMXqiIcTq5KUXTGRkVxbSo1hQnSy6lAM5GSdfwWeSxpAo0YzgsgF182E/U0mDNhuA0tW7w== - dependencies: - "@webassemblyjs/ast" "1.12.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.6" - "@webassemblyjs/ieee754" "1.11.6" - "@webassemblyjs/leb128" "1.11.6" - "@webassemblyjs/utf8" "1.11.6" - -"@webassemblyjs/wasm-opt@1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.12.1.tgz#9e6e81475dfcfb62dab574ac2dda38226c232bc5" - integrity sha512-Jg99j/2gG2iaz3hijw857AVYekZe2SAskcqlWIZXjji5WStnOpVoat3gQfT/Q5tb2djnCjBtMocY/Su1GfxPBg== - dependencies: - "@webassemblyjs/ast" "1.12.1" - "@webassemblyjs/helper-buffer" "1.12.1" - "@webassemblyjs/wasm-gen" "1.12.1" - "@webassemblyjs/wasm-parser" "1.12.1" - -"@webassemblyjs/wasm-parser@1.12.1", "@webassemblyjs/wasm-parser@^1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.12.1.tgz#c47acb90e6f083391e3fa61d113650eea1e95937" - integrity sha512-xikIi7c2FHXysxXe3COrVUPSheuBtpcfhbpFj4gmu7KRLYOzANztwUU0IbsqvMqzuNK2+glRGWCEqZo1WCLyAQ== - dependencies: - "@webassemblyjs/ast" "1.12.1" - "@webassemblyjs/helper-api-error" "1.11.6" - "@webassemblyjs/helper-wasm-bytecode" "1.11.6" - "@webassemblyjs/ieee754" "1.11.6" - "@webassemblyjs/leb128" "1.11.6" - "@webassemblyjs/utf8" "1.11.6" - -"@webassemblyjs/wast-printer@1.12.1": - version "1.12.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.12.1.tgz#bcecf661d7d1abdaf989d8341a4833e33e2b31ac" - integrity sha512-+X4WAlOisVWQMikjbcvY2e0rwPsKQ9F688lksZhBcPycBBuii3O7m8FACbDMWDojpAqvjIncrG8J0XHKyQfVeA== - dependencies: - "@webassemblyjs/ast" "1.12.1" - "@xtuc/long" "4.2.2" - "@whatwg-node/events@^0.0.3": version "0.0.3" resolved "https://registry.yarnpkg.com/@whatwg-node/events/-/events-0.0.3.tgz#13a65dd4f5893f55280f766e29ae48074927acad" @@ -5578,16 +5314,6 @@ resolved "https://registry.yarnpkg.com/@xobotyi/scrollbar-width/-/scrollbar-width-1.9.5.tgz#80224a6919272f405b87913ca13b92929bdf3c4d" integrity sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ== -"@xtuc/ieee754@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" - integrity sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA== - -"@xtuc/long@4.2.2": - version "4.2.2" - resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" - integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== - "@yarnpkg/lockfile@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" @@ -5628,11 +5354,6 @@ acorn@7.1.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf" integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg== -acorn@^8.12.1, acorn@^8.14.0, acorn@^8.8.2: - version "8.14.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" - integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== - acorn@^8.7.0, acorn@^8.8.1, acorn@^8.9.0: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" @@ -5682,12 +5403,7 @@ ajv-formats@^2.1.0: dependencies: ajv "^8.0.0" -ajv-keywords@^3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" - integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== - -ajv@^6.12.3, ajv@^6.12.5, ajv@^6.12.6: +ajv@^6.12.3, ajv@^6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -6437,16 +6153,6 @@ browserslist@^4.23.1: node-releases "^2.0.14" update-browserslist-db "^1.1.0" -browserslist@^4.24.0: - version "4.24.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.2.tgz#f5845bc91069dbd55ee89faf9822e1d885d16580" - integrity sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg== - dependencies: - caniuse-lite "^1.0.30001669" - electron-to-chromium "^1.5.41" - node-releases "^2.0.18" - update-browserslist-db "^1.1.1" - bs-logger@0.x: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -6510,7 +6216,7 @@ buffer-fill@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== -buffer-from@^1.0.0, buffer-from@^1.1.1: +buffer-from@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== @@ -6664,11 +6370,6 @@ caniuse-lite@^1.0.30001640: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz#9c004caef315de9452ab970c3da71085f8241dbd" integrity sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg== -caniuse-lite@^1.0.30001669: - version "1.0.30001677" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz#27c2e2c637e007cfa864a16f7dfe7cde66b38b5f" - integrity sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog== - capital-case@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/capital-case/-/capital-case-1.0.4.tgz#9d130292353c9249f6b00fa5852bee38a717e669" @@ -6833,11 +6534,6 @@ chownr@^2.0.0: resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== -chrome-trace-event@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b" - integrity sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ== - ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -7055,11 +6751,6 @@ commander@^10.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== -commander@^2.20.0: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - commander@^4.0.1: version "4.1.1" resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" @@ -7999,11 +7690,6 @@ electron-to-chromium@^1.4.820: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.1.tgz#24640bd4dcfaccb6d82bb4c3f4c7311503241581" integrity sha512-FKbOCOQ5QRB3VlIbl1LZQefWIYwszlBloaXcY2rbfpu9ioJnNh3TK03YtIDKDo3WKBi8u+YV4+Fn2CkEozgf4w== -electron-to-chromium@^1.5.41: - version "1.5.52" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.52.tgz#2bed832c95a56a195504f918150e548474687da8" - integrity sha512-xtoijJTZ+qeucLBDNztDOuQBE1ksqjvNjvqFoST3nGC7fSpqJ+X6BdTBaY5BHG+IhWWmpc6b/KfpeuEDupEPOQ== - elliptic@6.5.4, elliptic@^6.4.1, elliptic@^6.5.2, elliptic@^6.5.3: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" @@ -8074,14 +7760,6 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" -enhanced-resolve@^5.17.1: - version "5.17.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" - integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== - dependencies: - graceful-fs "^4.2.4" - tapable "^2.2.0" - entities@^4.4.0, entities@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" @@ -8128,11 +7806,6 @@ es-errors@^1.3.0: resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== -es-module-lexer@^1.2.1, es-module-lexer@^1.5.4: - version "1.5.4" - resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.5.4.tgz#a8efec3a3da991e60efa6b633a7cad6ab8d26b78" - integrity sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== - es6-promise@4.2.8: version "4.2.8" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" @@ -8304,11 +7977,6 @@ escalade@^3.1.2: resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== -escalade@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" - integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== - escape-goat@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/escape-goat/-/escape-goat-2.1.1.tgz#1b2dc77003676c457ec760b2dc68edb648188675" @@ -8341,14 +8009,6 @@ escodegen@^1.13.0, escodegen@^1.8.1: optionalDependencies: source-map "~0.6.1" -eslint-scope@5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" - integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== - dependencies: - esrecurse "^4.3.0" - estraverse "^4.1.1" - eslint-visitor-keys@^3.4.1: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" @@ -8368,19 +8028,12 @@ esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.1.0, estraverse@^5.2.0: +estraverse@^5.1.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -8588,7 +8241,7 @@ events-listener@^1.1.0: resolved "https://registry.yarnpkg.com/events-listener/-/events-listener-1.1.0.tgz#dd49b4628480eba58fde31b870ee346b3990b349" integrity sha512-Kd3EgYfODHueq6GzVfs/VUolh2EgJsS8hkO3KpnDrxVjU3eq63eXM2ujXkhPP+OkeUOhL8CxdfZbQXzryb5C4g== -events@^3.0.0, events@^3.2.0, events@^3.3.0: +events@^3.0.0, events@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== @@ -8758,7 +8411,7 @@ fast-deep-equal@3.1.3, fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.2.9, fast-glob@^3.3.2: +fast-glob@^3.2.9: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -9266,11 +8919,6 @@ glob-slasher@^1.0.1: lodash.isobject "^2.4.1" toxic "^1.0.0" -glob-to-regexp@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" - integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== - glob@9.3.2: version "9.3.2" resolved "https://registry.yarnpkg.com/glob/-/glob-9.3.2.tgz#8528522e003819e63d11c979b30896e0eaf52eda" @@ -9473,7 +9121,7 @@ graceful-fs@4.2.10: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -10376,15 +10024,6 @@ jest-util@^29.0.0, jest-util@^29.7.0: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-worker@^27.4.5: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" - integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^8.0.0" - jiti@^1.17.1, jiti@^1.18.2: version "1.21.6" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.6.tgz#6c7f7398dd4b3142767f9a168af2f317a428d268" @@ -10565,11 +10204,6 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== -jsesc@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" - integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== - json-bigint@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" @@ -10582,7 +10216,7 @@ json-bignum@^0.0.3: resolved "https://registry.yarnpkg.com/json-bignum/-/json-bignum-0.0.3.tgz#41163b50436c773d82424dbc20ed70db7604b8d7" integrity sha512-2WHyXj3OfHSgNyuzDbSxI1w2jgw5gkWSWhS7Qg4bWXx1nLk3jnbwfUeS0PSba3IzpTUWdHxBieELUzXRjQB2zg== -json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: +json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== @@ -10849,11 +10483,6 @@ load-tsconfig@^0.2.0: resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz#453b8cd8961bfb912dea77eb6c168fe8cca3d3a1" integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg== -loader-runner@^4.2.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" - integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg== - locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -11102,7 +10731,7 @@ magic-string@0.27.0: dependencies: "@jridgewell/sourcemap-codec" "^1.4.13" -magic-string@^0.30.10, magic-string@^0.30.11: +magic-string@^0.30.10: version "0.30.12" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.12.tgz#9eb11c9d072b9bcb4940a5b2c2e1a217e4ee1a60" integrity sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw== @@ -11293,7 +10922,7 @@ mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.35, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12, mime-types@^2.1.35, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -11579,11 +11208,6 @@ negotiator@0.6.3, negotiator@^0.6.3: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== -neo-async@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" - integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== - netmask@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" @@ -11692,11 +11316,6 @@ node-releases@^2.0.14: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== -node-releases@^2.0.18: - version "2.0.18" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" - integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== - node-stdlib-browser@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/node-stdlib-browser/-/node-stdlib-browser-1.2.1.tgz#888fa104914af94143ca4d8a8980fe0ed242d2d1" @@ -12335,7 +11954,7 @@ postcss@^6.0.1: source-map "^0.6.1" supports-color "^5.4.0" -postcss@^8.4.43, postcss@^8.4.47: +postcss@^8.4.43: version "8.4.47" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365" integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== @@ -13366,15 +12985,6 @@ scheduler@^0.23.0: dependencies: loose-envify "^1.1.0" -schema-utils@^3.1.1, schema-utils@^3.2.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" - integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== - dependencies: - "@types/json-schema" "^7.0.8" - ajv "^6.12.5" - ajv-keywords "^3.5.2" - screenfull@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.2.0.tgz#6533d524d30621fc1283b9692146f3f13a93d1ba" @@ -13517,13 +13127,6 @@ serialize-error@^8.1.0: dependencies: type-fest "^0.20.2" -serialize-javascript@^6.0.1: - version "6.0.2" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" - integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== - dependencies: - randombytes "^2.1.0" - serve-static@1.15.0: version "1.15.0" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" @@ -13787,14 +13390,6 @@ source-map-js@^1.2.0, source-map-js@^1.2.1: resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== -source-map-support@~0.5.20: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map@0.5.6: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" @@ -13805,7 +13400,7 @@ source-map@^0.5.6: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -14163,13 +13758,6 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^8.0.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - supports-hyperlinks@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" @@ -14228,11 +13816,6 @@ table-layout@^3.0.0: typical "^7.1.1" wordwrapjs "^5.1.0" -tapable@^2.1.1, tapable@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" - integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== - tar-stream@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" @@ -14272,27 +13855,6 @@ temp@^0.9.4: mkdirp "^0.5.1" rimraf "~2.6.2" -terser-webpack-plugin@^5.3.10: - version "5.3.10" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz#904f4c9193c6fd2a03f693a2150c62a92f40d199" - integrity sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w== - dependencies: - "@jridgewell/trace-mapping" "^0.3.20" - jest-worker "^27.4.5" - schema-utils "^3.1.1" - serialize-javascript "^6.0.1" - terser "^5.26.0" - -terser@^5.26.0: - version "5.36.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.36.0.tgz#8b0dbed459ac40ff7b4c9fd5a3a2029de105180e" - integrity sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w== - dependencies: - "@jridgewell/source-map" "^0.3.3" - acorn "^8.8.2" - commander "^2.20.0" - source-map-support "~0.5.20" - teslabot@^1.3.0: version "1.5.0" resolved "https://registry.yarnpkg.com/teslabot/-/teslabot-1.5.0.tgz#70f544516699ca5f696d8ae94f3d12cd495d5cd6" @@ -14828,14 +14390,6 @@ update-browserslist-db@^1.1.0: escalade "^3.1.2" picocolors "^1.0.1" -update-browserslist-db@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5" - integrity sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A== - dependencies: - escalade "^3.2.0" - picocolors "^1.1.0" - update-notifier-cjs@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/update-notifier-cjs/-/update-notifier-cjs-5.1.6.tgz#6e3aff745d1551b55bb0a0a5939b7e636d95877d" @@ -15019,25 +14573,6 @@ vite-node@2.0.2: tinyrainbow "^1.2.0" vite "^5.0.0" -vite-plugin-commonjs@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/vite-plugin-commonjs/-/vite-plugin-commonjs-0.10.3.tgz#e75abb1586464be9d216c829fc250df23a8542e7" - integrity sha512-trtH4dfAqrbqwiUhSKcqrfjnlXnqLHdIbYuUy943y34JnDjIX8qlpExP0nFN+kE2s6/BS6r9d1cAHS0KtiF4yQ== - dependencies: - acorn "^8.12.1" - magic-string "^0.30.11" - vite-plugin-dynamic-import "^1.6.0" - -vite-plugin-dynamic-import@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.6.0.tgz#c9680b2093fc897721fe535202acc8af77537ae4" - integrity sha512-TM0sz70wfzTIo9YCxVFwS8OA9lNREsh+0vMHGSkWDTZ7bgd1Yjs5RV8EgB634l/91IsXJReg0xtmuQqP0mf+rg== - dependencies: - acorn "^8.12.1" - es-module-lexer "^1.5.4" - fast-glob "^3.3.2" - magic-string "^0.30.11" - vite-plugin-node-polyfills@^0.22.0: version "0.22.0" resolved "https://registry.yarnpkg.com/vite-plugin-node-polyfills/-/vite-plugin-node-polyfills-0.22.0.tgz#d0afcf82eb985fc02244620d7cec1ddd1c6e0864" @@ -15046,19 +14581,6 @@ vite-plugin-node-polyfills@^0.22.0: "@rollup/plugin-inject" "^5.0.5" node-stdlib-browser "^1.2.0" -vite-plugin-require@^1.2.14: - version "1.2.14" - resolved "https://registry.yarnpkg.com/vite-plugin-require/-/vite-plugin-require-1.2.14.tgz#6c2861cac74fcb23f20bd3c0d3a61d823f05f774" - integrity sha512-i52DfITgYKtOZyh9kOjyy4ENTQBVHG0ozTKHQdFkGAHYqZwM3Dn2c5gsA5rR7IrHQ/PQET3SMz6HkNzZ2fXCyA== - dependencies: - "@babel/generator" "^7.24.5" - "@babel/parser" "^7.24.5" - "@babel/traverse" "^7.24.5" - "@babel/types" "^7.24.5" - "@vue/compiler-sfc" "^3.4.27" - vue-loader "^17.4.2" - webpack "^4.46.0 || ^5.0.0" - vite-plugin-svgr@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/vite-plugin-svgr/-/vite-plugin-svgr-4.2.0.tgz#9f3bf5206b0ec510287e56d16f1915e729bb4e6b" @@ -15142,15 +14664,6 @@ vm2@^3.9.17: acorn "^8.7.0" acorn-walk "^8.2.0" -vue-loader@^17.4.2: - version "17.4.2" - resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-17.4.2.tgz#f87f0d8adfcbbe8623de9eba1979d41ba223c6da" - integrity sha512-yTKOA4R/VN4jqjw4y5HrynFL8AK0Z3/Jt7eOJXEitsm0GMRHDBjCfCiuTiLP7OESvsZYo2pATCWhDqxC5ZrM6w== - dependencies: - chalk "^4.1.0" - hash-sum "^2.0.0" - watchpack "^2.4.0" - w3c-xmlserializer@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz#f925ba26855158594d907313cedd1476c5967f6c" @@ -15165,14 +14678,6 @@ warning@^4.0.3: dependencies: loose-envify "^1.0.0" -watchpack@^2.4.0, watchpack@^2.4.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.2.tgz#2feeaed67412e7c33184e5a79ca738fbd38564da" - integrity sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw== - dependencies: - glob-to-regexp "^0.4.1" - graceful-fs "^4.1.2" - wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" @@ -15216,35 +14721,6 @@ webpack-virtual-modules@^0.5.0: resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz#362f14738a56dae107937ab98ea7062e8bdd3b6c" integrity sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw== -"webpack@^4.46.0 || ^5.0.0": - version "5.96.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.96.1.tgz#3676d1626d8312b6b10d0c18cc049fba7ac01f0c" - integrity sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA== - dependencies: - "@types/eslint-scope" "^3.7.7" - "@types/estree" "^1.0.6" - "@webassemblyjs/ast" "^1.12.1" - "@webassemblyjs/wasm-edit" "^1.12.1" - "@webassemblyjs/wasm-parser" "^1.12.1" - acorn "^8.14.0" - browserslist "^4.24.0" - chrome-trace-event "^1.0.2" - enhanced-resolve "^5.17.1" - es-module-lexer "^1.2.1" - eslint-scope "5.1.1" - events "^3.2.0" - glob-to-regexp "^0.4.1" - graceful-fs "^4.2.11" - json-parse-even-better-errors "^2.3.1" - loader-runner "^4.2.0" - mime-types "^2.1.27" - neo-async "^2.6.2" - schema-utils "^3.2.0" - tapable "^2.1.1" - terser-webpack-plugin "^5.3.10" - watchpack "^2.4.1" - webpack-sources "^3.2.3" - whatwg-encoding@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz#d0f4ef769905d426e1688f3e34381a99b60b76e5" From f70d0cc6a87a8249c0aadfdbbf6532813b71267b Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Mon, 18 Nov 2024 16:37:15 +0700 Subject: [PATCH 12/21] pumb sdk --- package.json | 2 +- src/pages/UniversalSwap/Swap/hooks/useSimulate.ts | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 51574ebda..bd03affda 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/oraidex-contracts-sdk": "1.0.55", - "@oraichain/oraidex-universal-swap": "1.1.20", + "@oraichain/oraidex-universal-swap": "1.1.21", "@react-spring/web": "^9.7.5", "@reduxjs/toolkit": "^1.9.3", "@sentry/react": "7.99.0", diff --git a/src/pages/UniversalSwap/Swap/hooks/useSimulate.ts b/src/pages/UniversalSwap/Swap/hooks/useSimulate.ts index a61dcc6ed..71716a1da 100644 --- a/src/pages/UniversalSwap/Swap/hooks/useSimulate.ts +++ b/src/pages/UniversalSwap/Swap/hooks/useSimulate.ts @@ -16,7 +16,7 @@ export const getRouterConfig = (options?: { ignoreFee?: boolean; }) => { return { - url: 'https://osor.oraidex.io', + url: 'https://osor-staging.oraidex.io', path: options?.path ?? '/smart-router/alpha-router', protocols: options?.protocols ?? ['Oraidex', 'OraidexV3'], dontAllowSwapAfter: options?.dontAllowSwapAfter ?? ['Oraidex', 'OraidexV3'], diff --git a/yarn.lock b/yarn.lock index e9c2e9b3d..c5a004711 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3383,10 +3383,10 @@ resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.45.tgz#42dae0fdd9e005f920ba305b987009f791acc365" integrity sha512-/nYztdxEX5LQM4DMJQmi9HvZrBVoY3nLAmYqSKZGZ0U1h1SxU7O/o22R3/pQwB+sAJdcibaI8ygC0ov7jC8paA== -"@oraichain/oraidex-universal-swap@1.1.20": - version "1.1.20" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.20.tgz#62d305a7789bd39df638c062ef8b99c151956ae5" - integrity sha512-kkzvD9LHJDOAG8bueQAkM8XhyqadhSmiiSXaCGGhPgHxDA2o5420br2nAo63MFrsNRruYIrVkjeFYfPh97um5w== +"@oraichain/oraidex-universal-swap@1.1.21": + version "1.1.21" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.21.tgz#9de36e17eac9b8bb663566898a73b9f4e12dca2e" + integrity sha512-CrHCfl37kQlmRq8xP2MTIHRaIMv4W8VQsL2hb2BUC784BeOmCzwDSLTqlDzs+/0s6O9BPS+lhZO5Vh83uxj/vQ== dependencies: "@oraichain/common" "^1.0.3" "@oraichain/oraidex-common" "^1.1.27" From 6cdfc9fbeba76939b375f11131123b9ffa814ab6 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Fri, 22 Nov 2024 17:10:21 +0700 Subject: [PATCH 13/21] pumb sdk --- package.json | 2 +- src/config/chainInfos.ts | 85 ++++-------------------------- src/config/iconInfos.ts | 5 -- src/pages/UniversalSwap/helpers.ts | 2 +- yarn.lock | 8 +-- 5 files changed, 16 insertions(+), 86 deletions(-) diff --git a/package.json b/package.json index 56a423a73..440126a64 100644 --- a/package.json +++ b/package.json @@ -159,7 +159,7 @@ "bitcoinjs-lib": "5.2.0", "axios": "0.26.1", "@sentry/react": "7.99.0", - "@oraichain/oraidex-common": "1.1.32-beta.4" + "@oraichain/oraidex-common": "1.1.32-beta.5" }, "engines": { "node": "^18 || ^20" diff --git a/src/config/chainInfos.ts b/src/config/chainInfos.ts index b492a8f96..0a36d51ee 100644 --- a/src/config/chainInfos.ts +++ b/src/config/chainInfos.ts @@ -8,7 +8,9 @@ import { defaultBech32Config, getTokensFromNetwork, TON_ORAICHAIN_DENOM, - HMSTR_ORAICHAIN_DENOM + HMSTR_ORAICHAIN_DENOM, + TON_ALL_OSMOSIS_CONTRACT, + TON_OSMOSIS_CONTRACT } from '@oraichain/oraidex-common'; import HamsterIcon from 'assets/icons/hmstr.svg?react'; import BitcoinIcon from 'assets/icons/bitcoin.svg?react'; @@ -53,14 +55,14 @@ export type AlloyedPool = { export const OsmosisAlloyedPools: AlloyedPool[] = [ { poolId: '2161', - alloyedToken: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON', - sourceToken: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98' + alloyedToken: TON_ALL_OSMOSIS_CONTRACT, + sourceToken: TON_OSMOSIS_CONTRACT } ]; export const OsmosisTokenDenom = { - ton: 'ibc/905889A7F0B94F1CE1506D9BADF13AE9141E4CBDBCD565E1DFC7AE418B3E3E98', - allTon: 'factory/osmo12lnwf54yd30p6amzaged2atln8k0l32n7ncxf04ctg7u7ymnsy7qkqgsw4/alloyed/allTON' + allTon: TON_ALL_OSMOSIS_CONTRACT, + ton: TON_OSMOSIS_CONTRACT }; export const OsmosisTokenList = [ @@ -288,18 +290,7 @@ export const OraiToken: BridgeAppCurrency = { }; export const oraichainNetwork: CustomChainInfo = { - ...customOraichainNetwork, - currencies: [...customOraichainNetwork.currencies].map((tk) => { - if (['tether', 'usd-coin', 'the-open-network', 'hamster-kombat'].includes(tk.coinGeckoId)) { - const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, ...(tk.bridgeTo || [])])] }; - if (tk.coinGeckoId === 'the-open-network') { - bridgeToken.bridgeTo.push('osmosis-1'); - } - return bridgeToken; - } - - return tk; - }) + ...customOraichainNetwork }; export const OraiBTCBridgeNetwork = { @@ -357,63 +348,7 @@ export const OraiBTCBridgeNetwork = { }; export const chainInfosWithSdk = [ - ...customChainInfos.map((net) => { - if (net.chainId === 'osmosis-1') { - const newCurrencies = [ - ...net.currencies, - { - chainId: 'osmosis-1', - bridgeTo: ['Oraichain', TonChainId], - coinDenom: 'TON.orai', - name: 'TON', - symbol: 'TON.orai', - Icon: TonIcon, - contractAddress: null, - denom: OsmosisTokenDenom.ton, - coinMinimalDenom: OsmosisTokenDenom.ton, - coinGeckoId: 'the-open-network', - decimal: 9, - coinDecimals: 9 - }, - { - chainId: 'osmosis-1', - bridgeTo: ['Oraichain', TonChainId], - coinDenom: 'TON', - name: 'TON', - symbol: 'TON', - Icon: TonIcon, - contractAddress: null, - denom: OsmosisTokenDenom.allTon, - coinMinimalDenom: OsmosisTokenDenom.allTon, - coinGeckoId: 'the-open-network', - decimal: 9, - coinDecimals: 9, - alloyedToken: true - } - ]; - - const fmtOsmoChain = { - ...net, - currencies: newCurrencies - }; - - return fmtOsmoChain; - } else if (net.chainId === 'Oraichain') { - return { - ...net, - currencies: [...net.currencies].map((tk) => { - if (['tether', 'usd-coin', 'the-open-network', 'hamster-kombat'].includes(tk.coinGeckoId)) { - const bridgeToken = { ...tk, bridgeTo: [...new Set([TonChainId, ...(tk.bridgeTo || [])])] }; - return bridgeToken; - } - - return tk; - }) - }; - } - - return net; - }), + ...customChainInfos, bitcoinMainnet, oraibtcNetwork // tonNetworkMainnet @@ -427,4 +362,4 @@ export const evmChains = chainInfos.filter( export const chainInfosWithIcon = mapListWithIcon(chainInfosWithSdk, chainIcons, 'chainId'); -export const btcChains = chainInfos.filter((c) => c.networkType === ('bitcoin' as any)); +export const btcChains = chainInfos.filter((c) => c.networkType === 'bitcoin'); diff --git a/src/config/iconInfos.ts b/src/config/iconInfos.ts index f61d5b9a4..8c002a4ca 100644 --- a/src/config/iconInfos.ts +++ b/src/config/iconInfos.ts @@ -248,11 +248,6 @@ export const chainIconsInfos: ChainIcon[] = [ chainId: TonChainId, Icon: TonIcon, IconLight: TonIcon - }, - { - chainId: 'Ton' as any, - Icon: TonIcon, - IconLight: TonIcon } ]; diff --git a/src/pages/UniversalSwap/helpers.ts b/src/pages/UniversalSwap/helpers.ts index a3648c048..2bc236d5b 100644 --- a/src/pages/UniversalSwap/helpers.ts +++ b/src/pages/UniversalSwap/helpers.ts @@ -379,7 +379,7 @@ export const getProtocolsSmartRoute = ( ) => { const protocols = ['Oraidex', 'OraidexV3']; if (useIbcWasm && !useAlphaIbcWasm) return protocols; - if (fromToken.chainId === 'noble-1' || toToken.chainId === 'noble-1') return protocols; + if (fromToken?.chainId === 'noble-1' || toToken?.chainId === 'noble-1') return protocols; const allowOsmosisProtocols = ['injective-1', 'Neutaro-1', 'noble-1', 'osmosis-1', 'cosmoshub-4', 'celestia']; const isAllowOsmosisProtocol = diff --git a/yarn.lock b/yarn.lock index f8ca0311b..7f331af54 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3341,10 +3341,10 @@ react-use "^17.4.0" react-use-websocket "^4.5.0" -"@oraichain/oraidex-common@1.1.32-beta.4", "@oraichain/oraidex-common@^1.1.27", "@oraichain/oraidex-common@^1.1.3", "@oraichain/oraidex-common@^1.1.32": - version "1.1.32-beta.4" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.32-beta.4.tgz#5b437fc1111292a6ea29d3acb892ed12ec3ee515" - integrity sha512-G4B00g9q4kd+pBYMGC0ihVK1aFrl/uJY7+3cVsFFvzeliTqvQgttEZUe+pIysxWkj/dUouaZWvR08xCw4PkWQw== +"@oraichain/oraidex-common@1.1.32-beta.5", "@oraichain/oraidex-common@^1.1.27", "@oraichain/oraidex-common@^1.1.3", "@oraichain/oraidex-common@^1.1.32": + version "1.1.32-beta.5" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.32-beta.5.tgz#3e8c5ede7209701bee710e34dd6bd529f64cabfa" + integrity sha512-WLFJo1h0VGLFDj+p0WdT2bUDFW4P6hqI+gBAk0nHaQ93QdFoyynlIQnlMBhnQuNBPNkdtC97wZsI1O/zIDRRAA== dependencies: "@cosmjs/amino" "^0.32.4" "@cosmjs/cosmwasm-stargate" "^0.32.4" From 9387e0d8894496765df223346eb2fe9537ce0163 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Mon, 25 Nov 2024 23:56:32 +0700 Subject: [PATCH 14/21] fix universal swap ton --- .../WalletByNetwork/WalletByNetwork.tsx | 1 + .../WalletManagement/WalletManagement.tsx | 5 ++-- .../WalletManagement/useResetBalance.ts | 12 +++++++-- src/helper/index.tsx | 8 ++++-- src/hooks/useTonConnectAddress.ts | 4 --- src/layouts/App.tsx | 5 ++-- src/pages/Balance/helpers.ts | 20 ++++++++------ src/pages/UniversalSwap/Swap/index.tsx | 13 +++++++--- yarn.lock | 26 ++++++++++++------- 9 files changed, 60 insertions(+), 34 deletions(-) diff --git a/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx b/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx index d0444cc7c..b3ca5d1ae 100644 --- a/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx +++ b/src/components/WalletManagement/ModalChooseWallet/WalletByNetwork/WalletByNetwork.tsx @@ -178,6 +178,7 @@ export const WalletByNetwork = ({ walletProvider }: { walletProvider: WalletProv setBtcAddress(undefined); break; case 'ton': + setTonAddress(undefined); handleDisconnectTon(); break; default: diff --git a/src/components/WalletManagement/WalletManagement.tsx b/src/components/WalletManagement/WalletManagement.tsx index 69320fff2..5b555abbe 100644 --- a/src/components/WalletManagement/WalletManagement.tsx +++ b/src/components/WalletManagement/WalletManagement.tsx @@ -105,16 +105,17 @@ export const WalletManagement: FC<{}> = () => { // reset balance when disconnect useEffect(() => { - if (!metamaskAddress || !tronAddress || !oraiAddress || !btcAddress) { + if (!metamaskAddress || !tronAddress || !oraiAddress || !btcAddress || !tonAddress) { let arrResetBalance: WalletResetType[] = []; if (!metamaskAddress) arrResetBalance.push('metamask'); if (!tronAddress) arrResetBalance.push('tron'); if (!oraiAddress) arrResetBalance.push('keplr'); if (!btcAddress) arrResetBalance.push('bitcoin'); + if (!tonAddress) arrResetBalance.push('ton'); arrResetBalance.length && handleResetBalance(arrResetBalance); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [oraiAddress, tronAddress, metamaskAddress, btcAddress]); + }, [oraiAddress, tronAddress, metamaskAddress, btcAddress, tonAddress]); const isAnyWalletConnected = Object.values(walletByNetworks).some((wallet) => wallet !== null); useEffect(() => { diff --git a/src/components/WalletManagement/useResetBalance.ts b/src/components/WalletManagement/useResetBalance.ts index 12cedf18f..b80873e28 100644 --- a/src/components/WalletManagement/useResetBalance.ts +++ b/src/components/WalletManagement/useResetBalance.ts @@ -1,9 +1,9 @@ -import { EVM_CHAIN_ID_COMMON, WalletType, cosmosTokens, flattenTokens } from '@oraichain/oraidex-common'; +import { EVM_CHAIN_ID_COMMON, WalletType, cosmosTokens, flattenTokens, TonChainId } from '@oraichain/oraidex-common'; import { btcTokens } from 'config/bridgeTokens'; import { useDispatch } from 'react-redux'; import { updateAmounts } from 'reducer/token'; -export type Wallet = WalletType | 'metamask' | 'tron' | 'bitcoin'; +export type Wallet = WalletType | 'metamask' | 'tron' | 'bitcoin' | 'ton'; export const useResetBalance = () => { const dispatch = useDispatch(); @@ -36,6 +36,9 @@ export const useResetBalance = () => { case 'tron': updatedAmounts = resetBalanceTron(); break; + case 'ton': + updatedAmounts = resetBalanceTon(); + break; default: break; } @@ -63,5 +66,10 @@ export const useResetBalance = () => { return Object.fromEntries(tronTokens.map((t) => [t.denom, '0'])); }; + const resetBalanceTon = () => { + const tronTokens = flattenTokens.filter((token) => token.chainId === 'ton'); + return Object.fromEntries(tronTokens.map((t) => [t.denom, '0'])); + }; + return { handleResetBalance }; }; diff --git a/src/helper/index.tsx b/src/helper/index.tsx index 92ac036b0..c6e0faf08 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -31,7 +31,7 @@ import Keplr from 'libs/keplr'; import { WalletsByNetwork } from 'reducer/wallet'; import { evmChainInfos } from 'config/evmChainInfos'; import { TonChainId } from 'context/ton-provider'; -import { toUserFriendlyAddress } from '@tonconnect/ui-react'; +import { useTonAddress } from '@tonconnect/ui-react'; import DefaultIcon from 'assets/icons/tokens.svg?react'; import { numberWithCommas } from './format'; import { getHttpEndpoint } from '@orbs-network/ton-access'; @@ -108,6 +108,10 @@ export const getSpecialCoingecko = (fromCoingecko: string, toCoingecko: string) }; export const getTransactionUrl = (chainId: NetworkChainId, transactionHash: string) => { + if (chainId === 'ton') { + return `https://tonscan.org/address/${transactionHash}`; + } + switch (Number(chainId)) { case Networks.bsc: return `${BSC_SCAN}/tx/${transactionHash}`; @@ -414,7 +418,7 @@ export const getAddressTransfer = async (network: CustomChainInfo, walletByNetwo try { let address = ''; if (network.networkType === 'ton') { - address = toUserFriendlyAddress(window.Ton?.account?.address); + address = useTonAddress(); } else if (network.networkType === 'evm') { address = await getAddressTransferForEvm(walletByNetworks, network); } else if (isConnectSpecificNetwork(walletByNetworks.cosmos)) { diff --git a/src/hooks/useTonConnectAddress.ts b/src/hooks/useTonConnectAddress.ts index bdaae186f..4cc2103ac 100644 --- a/src/hooks/useTonConnectAddress.ts +++ b/src/hooks/useTonConnectAddress.ts @@ -46,10 +46,6 @@ const useTonConnectAddress = () => { // handleSetTonAddress({ tonAddress: undefined }); // handleSetTonWallet({ tonWallet: undefined }); - setWalletByNetworks({ - ...walletByNetworks, - ton: null - }); setTonAddress(undefined); } } catch (error) { diff --git a/src/layouts/App.tsx b/src/layouts/App.tsx index 6ad499779..1f735ddba 100644 --- a/src/layouts/App.tsx +++ b/src/layouts/App.tsx @@ -35,7 +35,7 @@ import { TonNetwork } from 'context/ton-provider'; const App = () => { const [address, setOraiAddress] = useConfigReducer('address'); const [, setTronAddress] = useConfigReducer('tronAddress'); - const [, setTonAddress] = useConfigReducer('tonAddress'); + const [tonAddress] = useConfigReducer('tonAddress'); const [, setMetamaskAddress] = useConfigReducer('metamaskAddress'); const [, setBtcAddress] = useConfigReducer('btcAddress'); const [, setStatusChangeAccount] = useConfigReducer('statusChangeAccount'); @@ -275,7 +275,8 @@ const App = () => { oraiAddress, metamaskAddress, tronAddress, - btcAddress + btcAddress, + tonAddress }); } catch (error) { console.log('Error: ', error.message); diff --git a/src/pages/Balance/helpers.ts b/src/pages/Balance/helpers.ts index 4d5c342cc..bd9386ea0 100644 --- a/src/pages/Balance/helpers.ts +++ b/src/pages/Balance/helpers.ts @@ -29,7 +29,6 @@ import { cosmosNetworks, feeEstimate, getNetworkGasPrice } from 'helper'; import { CwIcs20LatestClient } from '@oraichain/common-contracts-sdk'; import { TransferBackMsg } from '@oraichain/common-contracts-sdk/build/CwIcs20Latest.types'; import { OraiswapRouterQueryClient, OraiswapTokenClient } from '@oraichain/oraidex-contracts-sdk'; -import { Long } from 'cosmjs-types/helpers'; import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx'; import CosmJs, { collectWallet, connectWithSigner, getCosmWasmClient } from 'libs/cosmjs'; import KawaiiverseJs from 'libs/kawaiiversejs'; @@ -71,7 +70,7 @@ export const transferIBC = async (data: { sender: fromAddress, receiver: toAddress, memo, - timeoutTimestamp: Long.fromString(calculateTimeoutTimestamp(ibcInfo.timeout)), + timeoutTimestamp: BigInt(calculateTimeoutTimestamp(ibcInfo.timeout)), timeoutHeight: undefined }; let feeDenom = fromToken.denom; @@ -189,10 +188,15 @@ export const transferIBCMultiple = async ( })); const offlineSigner = await collectWallet(fromChainId); // Initialize the gaia api with the offline signer that is injected by Keplr extension. - const client = await connectWithSigner(rpc, offlineSigner, fromChainId === 'injective-1' ? 'injective' : 'cosmwasm', { - gasPrice: GasPrice.fromString(`${await getNetworkGasPrice(fromChainId)}${feeDenom}`), - broadcastPollIntervalMs: 600 - }); + const client = await connectWithSigner( + rpc, + offlineSigner as any, + fromChainId === 'injective-1' ? 'injective' : 'cosmwasm', + { + gasPrice: GasPrice.fromString(`${await getNetworkGasPrice(fromChainId)}${feeDenom}`), + broadcastPollIntervalMs: 600 + } + ); // hardcode fix bug osmosis let fee: 'auto' | number = 'auto'; if (fromChainId === 'osmosis-1') fee = 3; @@ -234,7 +238,7 @@ export const transferTokenErc20Cw20Map = async ({ sender: fromAddress, receiver: toAddress, memo: ibcMemo, - timeoutTimestamp: calculateTimeoutTimestamp(ibcInfo.timeout) + timeoutTimestamp: BigInt(calculateTimeoutTimestamp(ibcInfo.timeout)) }) }; @@ -494,9 +498,9 @@ export const calcMaxAmount = ({ if (!token) return maxAmount; let finalAmount = maxAmount; + if (token.chainId === 'ton') return finalAmount; const feeCurrencyOfToken = token.feeCurrencies?.find((e) => e.coinMinimalDenom === token.denom); - if (feeCurrencyOfToken) { const useFeeEstimate = feeEstimate(token, gas); diff --git a/src/pages/UniversalSwap/Swap/index.tsx b/src/pages/UniversalSwap/Swap/index.tsx index 6478354c3..93f19d5f1 100644 --- a/src/pages/UniversalSwap/Swap/index.tsx +++ b/src/pages/UniversalSwap/Swap/index.tsx @@ -328,13 +328,13 @@ const SwapComponent: React.FC<{ }, tonConnector: window?.Ton as any }); - + const tonAddress = tonWallet?.sender?.address?.toString(); const swapData = { sender: { cosmos: cosmosAddress, evm: checksumMetamaskAddress, tron: tronAddress, - ton: tonWallet?.sender?.address?.toString() + ton: tonAddress }, originalFromToken, originalToToken, @@ -363,12 +363,17 @@ const SwapComponent: React.FC<{ } }); - const { transactionHash } = await univeralSwapHandler.processUniversalSwap(); + const result = await univeralSwapHandler.processUniversalSwap(); + // @ts-ignore + let transactionHash = result?.transactionHash; + if (transactionHash) { + if (originalFromToken.chainId === 'ton') transactionHash = tonAddress; + displayToast(TToastType.TX_SUCCESSFUL, { customLink: getTransactionUrl(originalFromToken.chainId, transactionHash) }); - loadTokenAmounts({ oraiAddress, metamaskAddress, tronAddress }); + loadTokenAmounts({ oraiAddress, metamaskAddress, tronAddress, tonAddress }); setSwapLoading(false); // save to duckdb diff --git a/yarn.lock b/yarn.lock index 7f331af54..e4a11b8c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3025,6 +3025,13 @@ long "^4.0.0" secretjs "^0.17.0" +"@keplr-wallet/types@0.12.141": + version "0.12.141" + resolved "https://registry.yarnpkg.com/@keplr-wallet/types/-/types-0.12.141.tgz#341cc45882a86a39701d726edc8febdc42cafcb3" + integrity sha512-och1uUeqL6bUgWGLBSlV87rwXUDZMDUOJaARue65mRzfD6ohp9WBVFZfFgpyxU3M6S6UnzQQ6HuKUnWh4WuDjw== + dependencies: + long "^4.0.0" + "@keplr-wallet/types@^0.11.38": version "0.11.64" resolved "https://registry.yarnpkg.com/@keplr-wallet/types/-/types-0.11.64.tgz#5a308c8c019b4e18f894e0f35f0904b60134d605" @@ -3217,12 +3224,11 @@ integrity sha512-s8H20RXy5gCnu3DnM7L5ClQyj2mdQpbSBpZrXCpIAX9qY0LKsDdZG3sYaDQ8+VN333jz9Pp/qGWdFSYD+6PBsg== "@oraichain/common@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@oraichain/common/-/common-1.0.3.tgz#c6746473deed39622a1368a8f8f733a13f628a7e" - integrity sha512-4Rwwl8DF3bMNh5XSlP44LjUIKCOglDc/R1bUCeVFifZlrTGaz6Zo7Fdw6xwych7b4doxcuQBBh2gr7AZE6jQyQ== + version "1.2.0" + resolved "https://registry.yarnpkg.com/@oraichain/common/-/common-1.2.0.tgz#201dddcff7bbb0dd90a04cacf82dc3f6b9480788" + integrity sha512-gMTBSkLtHOMUfC5d3VJmEUtN17z5wL2YUrHLXCTcE6VA/K8nZ4jRt8yoO4JU/Lzy8LhZecQ2vM8r6kgLUpg8lw== dependencies: - "@cosmjs/cosmwasm-stargate" "0.31.3" - "@cosmjs/tendermint-rpc" "^0.31.3" + "@keplr-wallet/types" "0.12.141" axios "0.21.4" axios-extensions "3.1.6" bech32 "^1.1.4" @@ -3341,7 +3347,7 @@ react-use "^17.4.0" react-use-websocket "^4.5.0" -"@oraichain/oraidex-common@1.1.32-beta.5", "@oraichain/oraidex-common@^1.1.27", "@oraichain/oraidex-common@^1.1.3", "@oraichain/oraidex-common@^1.1.32": +"@oraichain/oraidex-common@1.1.32-beta.5", "@oraichain/oraidex-common@^1.1.27", "@oraichain/oraidex-common@^1.1.32", "@oraichain/oraidex-common@^1.1.6": version "1.1.32-beta.5" resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.32-beta.5.tgz#3e8c5ede7209701bee710e34dd6bd529f64cabfa" integrity sha512-WLFJo1h0VGLFDj+p0WdT2bUDFW4P6hqI+gBAk0nHaQ93QdFoyynlIQnlMBhnQuNBPNkdtC97wZsI1O/zIDRRAA== @@ -3439,12 +3445,12 @@ integrity sha512-k1DgzfYg3nQNPn2dLiXbkDHXd1WREQA9Dl0ezQ5kPtnlbNK9XjmxSco2gmaJwql0tE3cbBExUflfG0MaRF0dWw== "@oraichain/tonbridge-sdk@^1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@oraichain/tonbridge-sdk/-/tonbridge-sdk-1.3.6.tgz#3f4e77be926f90cd06cf57675c01c46ac65ce3d3" - integrity sha512-hcdw4R8xsOaw7Nz6M2UkKOkiUbTf+o0+KS3oI5pFUkBJWFi90uVgzbU7EwXI+6RwHmeNPXZSaFXhUiRgK7afJw== + version "1.4.2" + resolved "https://registry.yarnpkg.com/@oraichain/tonbridge-sdk/-/tonbridge-sdk-1.4.2.tgz#05722298dfd0bdbc4feaa45eb652d98361619638" + integrity sha512-pMj/y76S87b/GT4cNjp0oZ+J86tb/vPE0Kcm9vfi9SIMMYeWsk/H5AVlzoYevPrZflkzIA6l/vx+oHkMxpoVyQ== dependencies: "@oraichain/common-contracts-sdk" "^1.0.31" - "@oraichain/oraidex-common" "^1.1.3" + "@oraichain/oraidex-common" "^1.1.6" "@oraichain/ton-bridge-contracts" "^0.15.8" "@oraichain/tonbridge-contracts-sdk" "^1.3.6" "@orbs-network/ton-access" "^2.3.3" From d8682312cabb66ffe97e2715991ee3e88933938b Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Wed, 27 Nov 2024 16:20:05 +0700 Subject: [PATCH 15/21] update ton bridge --- package.json | 4 ++-- src/helper/index.tsx | 6 ++++-- .../UniversalSwap/Component/HistoryTab.tsx | 2 -- .../Swap/hooks/useHandleEffectTokenChange.ts | 20 +++++++++++-------- src/pages/UniversalSwap/Swap/index.tsx | 2 -- src/pages/UniversalSwap/helpers.ts | 2 ++ yarn.lock | 18 ++++++++--------- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 440126a64..23846c189 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/oraidex-contracts-sdk": "1.0.51-beta.3", - "@oraichain/oraidex-universal-swap": "1.1.22-beta.3", + "@oraichain/oraidex-universal-swap": "1.1.22-beta.6", "@oraichain/ton-bridge-contracts": "^0.15.8", "@oraichain/tonbridge-contracts-sdk": "^1.3.1", "@oraichain/tonbridge-sdk": "^1.3.6", @@ -159,7 +159,7 @@ "bitcoinjs-lib": "5.2.0", "axios": "0.26.1", "@sentry/react": "7.99.0", - "@oraichain/oraidex-common": "1.1.32-beta.5" + "@oraichain/oraidex-common": "1.1.32-beta.7" }, "engines": { "node": "^18 || ^20" diff --git a/src/helper/index.tsx b/src/helper/index.tsx index c6e0faf08..707807833 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -31,7 +31,7 @@ import Keplr from 'libs/keplr'; import { WalletsByNetwork } from 'reducer/wallet'; import { evmChainInfos } from 'config/evmChainInfos'; import { TonChainId } from 'context/ton-provider'; -import { useTonAddress } from '@tonconnect/ui-react'; +import { toUserFriendlyAddress, useTonAddress } from '@tonconnect/ui-react'; import DefaultIcon from 'assets/icons/tokens.svg?react'; import { numberWithCommas } from './format'; import { getHttpEndpoint } from '@orbs-network/ton-access'; @@ -418,7 +418,9 @@ export const getAddressTransfer = async (network: CustomChainInfo, walletByNetwo try { let address = ''; if (network.networkType === 'ton') { - address = useTonAddress(); + address = JSON.parse(JSON.parse(localStorage.getItem('persist:root'))?.config)?.tonAddress; + // address = useTonAddress(); + // address = toUserFriendlyAddress(window.Ton?.account?.address); } else if (network.networkType === 'evm') { address = await getAddressTransferForEvm(walletByNetworks, network); } else if (isConnectSpecificNetwork(walletByNetworks.cosmos)) { diff --git a/src/pages/UniversalSwap/Component/HistoryTab.tsx b/src/pages/UniversalSwap/Component/HistoryTab.tsx index f1cc34913..0fa7c64a3 100644 --- a/src/pages/UniversalSwap/Component/HistoryTab.tsx +++ b/src/pages/UniversalSwap/Component/HistoryTab.tsx @@ -115,8 +115,6 @@ export const HistoryTab: React.FC<{ }> = ({ networkFilter }) => { const { transHistory } = useGetTransHistory(); const [selectedData, setSelectedData] = useState(null); - console.log({ selectedData }); - const headers: TableHeaderProps = { assets: { name: '', diff --git a/src/pages/UniversalSwap/Swap/hooks/useHandleEffectTokenChange.ts b/src/pages/UniversalSwap/Swap/hooks/useHandleEffectTokenChange.ts index c2e434465..a0994fdbb 100644 --- a/src/pages/UniversalSwap/Swap/hooks/useHandleEffectTokenChange.ts +++ b/src/pages/UniversalSwap/Swap/hooks/useHandleEffectTokenChange.ts @@ -54,19 +54,23 @@ const useHandleEffectTokenChange = ({ fromTokenDenomSwap, toTokenDenomSwap }) => useEffect(() => { (async () => { if (!isMobile()) { - if (!walletByNetworks.evm && !walletByNetworks.cosmos && !walletByNetworks.tron && !walletByNetworks.cosmos) { - return setAddressTransfer(''); - } + const isNetworkSupported = + walletByNetworks.evm || walletByNetworks.cosmos || walletByNetworks.tron || walletByNetworks.ton; - if (originalToToken.cosmosBased && !walletByNetworks.cosmos) { + if (!isNetworkSupported) { return setAddressTransfer(''); } - if (!originalToToken.cosmosBased && originalToToken.chainId === '0x2b6653dc' && !walletByNetworks.tron) { - return setAddressTransfer(''); - } + const isCosmosBased = originalToToken.cosmosBased; + const chainId = originalToToken.chainId; - if (!originalToToken.cosmosBased && !walletByNetworks.evm) { + if ( + (isCosmosBased && !walletByNetworks.cosmos) || + (!isCosmosBased && + ((chainId === '0x2b6653dc' && !walletByNetworks.tron) || + (chainId === 'ton' && !walletByNetworks.ton) || + (['0x01', '0x38'].includes(chainId) && !walletByNetworks.evm))) + ) { return setAddressTransfer(''); } } diff --git a/src/pages/UniversalSwap/Swap/index.tsx b/src/pages/UniversalSwap/Swap/index.tsx index 93f19d5f1..31c26c691 100644 --- a/src/pages/UniversalSwap/Swap/index.tsx +++ b/src/pages/UniversalSwap/Swap/index.tsx @@ -368,8 +368,6 @@ const SwapComponent: React.FC<{ let transactionHash = result?.transactionHash; if (transactionHash) { - if (originalFromToken.chainId === 'ton') transactionHash = tonAddress; - displayToast(TToastType.TX_SUCCESSFUL, { customLink: getTransactionUrl(originalFromToken.chainId, transactionHash) }); diff --git a/src/pages/UniversalSwap/helpers.ts b/src/pages/UniversalSwap/helpers.ts index 2bc236d5b..b4f218a6b 100644 --- a/src/pages/UniversalSwap/helpers.ts +++ b/src/pages/UniversalSwap/helpers.ts @@ -193,6 +193,8 @@ export const getExplorerScan = (chainId: NetworkChainId) => { return 'https://scan.kawaii.global/tx'; case 'noble-1': return 'https://www.mintscan.io/noble/tx'; + case 'ton': + return 'https://tonscan.org/address'; default: return 'https://scan.orai.io/txs'; } diff --git a/yarn.lock b/yarn.lock index e4a11b8c1..33b41a182 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3347,10 +3347,10 @@ react-use "^17.4.0" react-use-websocket "^4.5.0" -"@oraichain/oraidex-common@1.1.32-beta.5", "@oraichain/oraidex-common@^1.1.27", "@oraichain/oraidex-common@^1.1.32", "@oraichain/oraidex-common@^1.1.6": - version "1.1.32-beta.5" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.32-beta.5.tgz#3e8c5ede7209701bee710e34dd6bd529f64cabfa" - integrity sha512-WLFJo1h0VGLFDj+p0WdT2bUDFW4P6hqI+gBAk0nHaQ93QdFoyynlIQnlMBhnQuNBPNkdtC97wZsI1O/zIDRRAA== +"@oraichain/oraidex-common@1.1.32-beta.7", "@oraichain/oraidex-common@^1.1.32", "@oraichain/oraidex-common@^1.1.32-beta.5", "@oraichain/oraidex-common@^1.1.6": + version "1.1.32-beta.7" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.32-beta.7.tgz#acc48b8fe003d639e7550edc8a3b9e4a6c3ee743" + integrity sha512-73sKbCZUO6pn+/g14V5A9FaGmcl7QkrysFz1A7EiluZajMOFYMNqc1GHDHWpHCepwkfS8Qi+hgAPu8pJtJUYgA== dependencies: "@cosmjs/amino" "^0.32.4" "@cosmjs/cosmwasm-stargate" "^0.32.4" @@ -3394,13 +3394,13 @@ resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.45.tgz#42dae0fdd9e005f920ba305b987009f791acc365" integrity sha512-/nYztdxEX5LQM4DMJQmi9HvZrBVoY3nLAmYqSKZGZ0U1h1SxU7O/o22R3/pQwB+sAJdcibaI8ygC0ov7jC8paA== -"@oraichain/oraidex-universal-swap@1.1.22-beta.3": - version "1.1.22-beta.3" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.22-beta.3.tgz#9681502f156489330a7ef6494756b55ff76a1af6" - integrity sha512-6pTZAJ3CSUOFLeTpm+SLl+lp/tJitRluYN3jvN3R1SzhKmP5sx8H4UhWmlY9AtMTnEk8PwotBca0iFk2mBbM+A== +"@oraichain/oraidex-universal-swap@1.1.22-beta.6": + version "1.1.22-beta.6" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.22-beta.6.tgz#080c5bb5c6704a76cd929482397990e1c5a45b1b" + integrity sha512-o4sRlPZWIoxt/TLSJirt6fHmYvcoAPzWklvSCv7nMFdb7VywyTa7NMVJerM7wSLXJrfE1pfjv+81Kr1hO4FJsA== dependencies: "@oraichain/common" "^1.0.3" - "@oraichain/oraidex-common" "^1.1.27" + "@oraichain/oraidex-common" "^1.1.32-beta.5" "@oraichain/oraidex-contracts-sdk" "^1.0.49" "@oraichain/osor-api-contracts-sdk" "^1.0.2" bech32 "1.1.4" From 74c1eca5f082394ff97b0d77f9a8fb3eed61d929 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Wed, 27 Nov 2024 17:53:08 +0700 Subject: [PATCH 16/21] update load balance ton bridge --- src/pages/UniversalSwap/Swap/index.tsx | 3 ++- src/pages/UniversalSwap/helpers.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/UniversalSwap/Swap/index.tsx b/src/pages/UniversalSwap/Swap/index.tsx index 31c26c691..9b5b7c252 100644 --- a/src/pages/UniversalSwap/Swap/index.tsx +++ b/src/pages/UniversalSwap/Swap/index.tsx @@ -98,6 +98,7 @@ const SwapComponent: React.FC<{ const [metamaskAddress] = useConfigReducer('metamaskAddress'); const [tronAddress] = useConfigReducer('tronAddress'); const [oraiAddress] = useConfigReducer('address'); + const [tonAddress] = useConfigReducer('tonAddress'); const [walletByNetworks] = useWalletReducer('walletsByNetwork'); const [theme] = useConfigReducer('theme'); const isLightMode = theme === 'light'; @@ -686,7 +687,7 @@ const SwapComponent: React.FC<{ loadingRefresh, setLoadingRefresh, // TODO: need add bitcoinAddress when universal swap support bitcoin - { metamaskAddress, tronAddress, oraiAddress }, + { metamaskAddress, tronAddress, oraiAddress, tonAddress }, loadTokenAmounts ) } diff --git a/src/pages/UniversalSwap/helpers.ts b/src/pages/UniversalSwap/helpers.ts index b4f218a6b..86aea9990 100644 --- a/src/pages/UniversalSwap/helpers.ts +++ b/src/pages/UniversalSwap/helpers.ts @@ -281,13 +281,13 @@ export const getTokenIcon = (token: TokenItemType, theme: string) => { export const refreshBalances = async ( loadingRefresh: boolean, setLoadingRefresh: (boolean) => void, - { metamaskAddress, tronAddress, oraiAddress }, + { metamaskAddress, tronAddress, oraiAddress, tonAddress }, callback ) => { try { if (loadingRefresh) return; setLoadingRefresh(true); - await callback({ metamaskAddress, tronAddress, oraiAddress }); + await callback({ metamaskAddress, tronAddress, oraiAddress, tonAddress }); } catch (err) { console.log({ err }); } finally { From 77bdcdc986b98425952625f957c37be139301960 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Thu, 28 Nov 2024 12:02:18 +0700 Subject: [PATCH 17/21] fix bridge ton --- .../Balance/hooks/useTonBridgeHandler.ts | 2 +- src/pages/Balance/index.tsx | 153 +++++------------- 2 files changed, 41 insertions(+), 114 deletions(-) diff --git a/src/pages/Balance/hooks/useTonBridgeHandler.ts b/src/pages/Balance/hooks/useTonBridgeHandler.ts index 4d59370ae..941c1823a 100644 --- a/src/pages/Balance/hooks/useTonBridgeHandler.ts +++ b/src/pages/Balance/hooks/useTonBridgeHandler.ts @@ -618,7 +618,7 @@ const useTonBridgeHandler = ({ sender: fromAddress, receiver: toAddress, memo, - timeoutTimestamp: calculateTimeoutTimestamp(ibcInfo.timeout) + timeoutTimestamp: BigInt(calculateTimeoutTimestamp(ibcInfo.timeout)) }) } ]; diff --git a/src/pages/Balance/index.tsx b/src/pages/Balance/index.tsx index 33d6dc54f..f41992a78 100644 --- a/src/pages/Balance/index.tsx +++ b/src/pages/Balance/index.tsx @@ -92,23 +92,25 @@ import useTonBridgeHandler from './hooks/useTonBridgeHandler'; import DepositBtcModalV2 from './DepositBtcModalV2'; import { CwBitcoinContext } from 'context/cw-bitcoin-context'; import { AppBitcoinClient } from '@oraichain/bitcoin-bridge-contracts-sdk'; -import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx'; -import { MsgTransfer as MsgTransferInjective } from '@injectivelabs/sdk-ts/node_modules/cosmjs-types/ibc/applications/transfer/v1/tx'; -import { collectWallet, connectWithSigner, getCosmWasmClient } from 'libs/cosmjs'; interface BalanceProps {} export const isMaintainBridge = false; const Balance: React.FC = () => { + //@ts-ignore + const isOwallet = window.owallet?.isOwallet; + // hook const [searchParams] = useSearchParams(); - const tokenUrl = searchParams.get('token'); + const ref = useRef(null); const navigate = useNavigate(); + const tokenUrl = searchParams.get('token'); const amounts = useSelector((state: RootState) => state.token.amounts); const feeConfig = useSelector((state: RootState) => state.token.feeConfigs); const nomic = useContext(NomicContext); const cwBitcoinContext = useContext(CwBitcoinContext); + const [walletByNetworks] = useWalletReducer('walletsByNetwork'); // state internal const [loadingRefresh, setLoadingRefresh] = useState(false); @@ -118,32 +120,30 @@ const Balance: React.FC = () => { const [[from, to], setTokenBridge] = useState([]); const [toNetworkChainId, setToNetworkChainId] = useState(); const [[otherChainTokens, oraichainTokens], setTokens] = useState([[], []]); - const [walletByNetworks] = useWalletReducer('walletsByNetwork'); + const [addressRecovery, setAddressRecovery] = useState(''); + const [isFastMode, setIsFastMode] = useState(true); const [theme] = useConfigReducer('theme'); - const [oraiAddress] = useConfigReducer('address'); + + const [filterNetworkUI, setFilterNetworkUI] = useConfigReducer('filterNetwork'); const [hideOtherSmallAmount, setHideOtherSmallAmount] = useConfigReducer('hideOtherSmallAmount'); + const [metamaskAddress] = useConfigReducer('metamaskAddress'); - const [filterNetworkUI, setFilterNetworkUI] = useConfigReducer('filterNetwork'); + const [oraiAddress] = useConfigReducer('address'); const [tronAddress] = useConfigReducer('tronAddress'); const [tonAddress] = useConfigReducer('tonAddress'); const [btcAddress] = useConfigReducer('btcAddress'); - const [addressRecovery, setAddressRecovery] = useState(''); const { handleBridgeFromCosmos, handleBridgeFromTon } = useTonBridgeHandler({ token: from, fromNetwork: from?.chainId, toNetwork: toNetworkChainId }); - const [isFastMode, setIsFastMode] = useState(true); const depositV2Fee = useDepositFeesBitcoinV2(true); const withdrawV2Fee = useGetWithdrawlFeesBitcoinV2({ enabled: true, bitcoinAddress: btcAddress }); - const ref = useRef(null); - //@ts-ignore - const isOwallet = window.owallet?.isOwallet; const getAddress = async () => { try { await nomic.generateAddress(); @@ -257,30 +257,6 @@ const Balance: React.FC = () => { [otherChainTokens, oraichainTokens, from, to] ); - const refreshBalances = async () => { - try { - if (loadingRefresh) return; - setLoadingRefresh(true); - await loadTokenAmounts({ metamaskAddress, tronAddress, oraiAddress, btcAddress, tonAddress }); - } catch (err) { - console.log({ err }); - } finally { - setTimeout(() => { - setLoadingRefresh(false); - }, 2000); - } - }; - - const handleTransferIBC = async (fromToken: TokenItemType, toToken: TokenItemType, transferAmount: number) => { - let transferAddress = metamaskAddress; - // check tron network and convert address - if (toToken.prefix === ORAI_BRIDGE_EVM_TRON_DENOM_PREFIX) { - transferAddress = tronToEthAddress(tronAddress); - } - const result = await transferIbcCustom(fromToken, toToken, transferAmount, amounts, transferAddress); - processTxResult(fromToken.rpc, result); - }; - const handleTransferBTCToOraichain = async (fromToken: TokenItemType, transferAmount: number, btcAddr: string) => { const isV2 = fromToken.name === 'BTC'; const utxos = await getUtxos(btcAddr, fromToken.rpc); @@ -440,9 +416,9 @@ const Balance: React.FC = () => { } }; - const checkTransferTon = async () => { - const isFromTon = from.chainId === (TonChainId as any) && !!to.chainId; - const isFromCosmosToTON = !!from.chainId && to.chainId === TonChainId; + const checkTransferTon = async (toNetworkChainId: string) => { + const isFromTon = from.chainId === TonChainId && !!toNetworkChainId; + const isFromCosmosToTON = !!from.chainId && toNetworkChainId === TonChainId; const isBridgeWithOraiAndOsmo = [from.chainId, to.chainId].includes('Oraichain') && [from.chainId, to.chainId].includes('osmosis-1'); @@ -487,14 +463,6 @@ const Balance: React.FC = () => { return handleTransferOraichainToBTC(fromToken, transferAmount, btcAddr); }; - const checkTransferKwt = async (fromAmount: number) => { - let result: DeliverTxResponse | string | any; - // convert erc20 to native ==> ORAICHAIN - if (from.contractAddress) result = await convertTransferIBCErc20Kwt(from, to, fromAmount); - else result = await transferIBCKwt(from, to, fromAmount, amounts); - processTxResult(from.rpc, result, `${KWT_SCAN}/tx/${result.transactionHash}`); - }; - const getLatestEvmAddress = async (toNetworkChainId: NetworkChainId) => { const isFromEvmNotTron = from.chainId !== '0x2b6653dc' && EVM_CHAIN_ID.includes(from.chainId); const isToNetworkEvmNotTron = toNetworkChainId !== '0x2b6653dc' && EVM_CHAIN_ID.includes(toNetworkChainId); @@ -519,7 +487,6 @@ const Balance: React.FC = () => { ) => { try { await handleCheckWallet(); - assert(from && to, 'Please choose both from and to tokens'); // get & check balance @@ -536,24 +503,6 @@ const Balance: React.FC = () => { displayToast(TToastType.TX_BROADCASTING); let result: DeliverTxResponse | string | any; - // check transfer TON <=> ORAICHAIN - const { isTonBridge, isFromTon } = await checkTransferTon(); - - if (isTonBridge) { - await handleTransferTon({ - isTonToCosmos: isFromTon, - transferAmount: fromAmount - }); - - return; - } - - // [(ERC20)KWT, (ERC20)MILKY] ==> ORAICHAIN - if (from.chainId === 'kawaii_6886-1' && to.chainId === 'Oraichain') { - await checkTransferKwt(fromAmount); - return; - } - // [BTC Native] <==> ORAICHAIN let [isBTCToOraichain, isBtcBridge] = checkTransferBtc(); if (isBtcBridge) { @@ -573,6 +522,15 @@ const Balance: React.FC = () => { assert(newToToken, 'Cannot find newToToken token that matches from token to bridge!'); } + // check transfer TON <=> ORAICHAIN + const { isTonBridge, isFromTon } = await checkTransferTon(toNetworkChainId); + if (isTonBridge) { + return await handleTransferTon({ + isTonToCosmos: isFromTon, + transferAmount: fromAmount + }); + } + assert( newToToken.coinGeckoId === from.coinGeckoId, `From token ${from.coinGeckoId} is different from to token ${newToToken.coinGeckoId}` @@ -627,52 +585,6 @@ const Balance: React.FC = () => { ); if (findRelayerFee) relayerFee.relayerAmount = findRelayerFee.amount; - - //------------------------------------------------------- - // FIXME: need remove after fix ibc hooks - if (from.cosmosBased && from.chainId !== 'noble-1' && to.chainId === 'Oraichain') { - const ibcInfo = UniversalSwapHelper.getIbcInfo(from.chainId as CosmosChainId, to.chainId); - if (!ibcInfo) - throw generateError(`Could not find the ibc info given the from token with coingecko id ${from.coinGeckoId}`); - - const offlineSigner = await collectWallet(from.chainId); - const client = await connectWithSigner( - from.rpc, - offlineSigner as any, - from.chainId === 'injective-1' ? 'injective' : 'cosmwasm', - { - gasPrice: GasPrice.fromString( - `${getCosmosGasPrice(from.gasPriceStep)}${from.feeCurrencies[0].coinMinimalDenom}` - ), - broadcastPollIntervalMs: 600 - } - ); - - const receiver = await handleCheckAddress(to.chainId); - const msgTransferObj = { - sourcePort: ibcInfo.source, - receiver, - sourceChannel: ibcInfo.channel, - token: coin(toAmount(fromAmount, from.decimals).toString(), from.denom), - sender: cosmosAddress, - memo: '', - timeoutTimestamp: calculateTimeoutTimestamp(ibcInfo.timeout) - }; - let msgTransfer: any = MsgTransfer.fromPartial(msgTransferObj as any); - if (from.chainId === 'injective-1') { - msgTransfer = MsgTransferInjective.fromPartial(msgTransferObj); - } - - const msgTransferEncodeObj = { - typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', - value: msgTransfer - }; - - result = await client.signAndBroadcast(cosmosAddress, [msgTransferEncodeObj], 'auto'); - return processTxResult(from.rpc, result, getTransactionUrl(from.chainId, result.transactionHash)); - } - //------------------------------------------------------- - const universalSwapHandler = new UniversalSwapHandler( { sender: { cosmos: cosmosAddress, evm: latestEvmAddress, tron: tronAddress }, @@ -793,7 +705,22 @@ const Balance: React.FC = () => {
-
+
{ + try { + if (loadingRefresh) return; + setLoadingRefresh(true); + await loadTokenAmounts({ metamaskAddress, tronAddress, oraiAddress, btcAddress, tonAddress }); + } catch (err) { + console.log({ err }); + } finally { + setTimeout(() => { + setLoadingRefresh(false); + }, 2000); + } + }} + > Refresh balances
From 82db98c2481c2c9299247ac23b2cd80a268eeea1 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Fri, 29 Nov 2024 11:08:06 +0700 Subject: [PATCH 18/21] check wallet ton before init wallet --- src/pages/UniversalSwap/Swap/index.tsx | 20 +++++++++++--------- yarn.lock | 13 ++++--------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/pages/UniversalSwap/Swap/index.tsx b/src/pages/UniversalSwap/Swap/index.tsx index f43abd3d9..2792a9032 100644 --- a/src/pages/UniversalSwap/Swap/index.tsx +++ b/src/pages/UniversalSwap/Swap/index.tsx @@ -322,13 +322,17 @@ const SwapComponent: React.FC<{ const isCustomRecipient = validAddress.isValid && addressTransfer !== initAddressTransfer; const alphaSmartRoutes = simulateData?.routes; - const tonWallet = await TonWallet.create('mainnet', { - mnemonicData: { - mnemonic: undefined, - tonWalletVersion: 'V4' - }, - tonConnector: window?.Ton as any - }); + let tonWallet = undefined; + if ([originalFromToken.chainId, originalToToken.chainId].includes('ton') && !!walletByNetworks.ton) { + tonWallet = await TonWallet.create('mainnet', { + mnemonicData: { + mnemonic: undefined, + tonWalletVersion: 'V4' + }, + tonConnector: window?.Ton as any + }); + } + const tonAddress = tonWallet?.sender?.address?.toString(); const swapData = { sender: { @@ -350,7 +354,6 @@ const SwapComponent: React.FC<{ alphaSmartRoutes }; - // @ts-ignore const univeralSwapHandler = new UniversalSwapHandler(swapData, { cosmosWallet: window.Keplr, evmWallet: new Metamask(window.tronWebDapp), @@ -365,7 +368,6 @@ const SwapComponent: React.FC<{ }); const result = await univeralSwapHandler.processUniversalSwap(); - // @ts-ignore let transactionHash = result?.transactionHash; if (transactionHash) { diff --git a/yarn.lock b/yarn.lock index 8cc930690..0770eceb8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3374,21 +3374,16 @@ resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-build/-/oraidex-contracts-build-1.0.22.tgz#70b765dd8ea3b500a77cc37e6a45ea9d75f0c5c4" integrity sha512-eJniKkXlOghPhgSYeH59szYjT3aWaE4K04HZaTPhi435sm9kaTfESj68pr0AsGepf4YeAcoQ9ZwUMbIeSmZtYw== -"@oraichain/oraidex-contracts-sdk@1.0.51-beta.3": - version "1.0.51-beta.3" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.51-beta.3.tgz#cb7c369081bcb036cc78d91a35a51ff4fb2b42d0" - integrity sha512-r1g0Ikzi21TAVIrB4I3MVF6rVTPdSHeBiQnwZTZuv0tw/muciuZHsiGSF5O2M5rcyMVHWjck9cQ3VVbAN+gFLg== +"@oraichain/oraidex-contracts-sdk@1.0.55", "@oraichain/oraidex-contracts-sdk@^1.0.54": + version "1.0.55" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.55.tgz#a9c8aadd5bfae4e2d2b71b4804ce3eadd35a0185" + integrity sha512-MlASHfRDnNwhM172PlFlqarCMUhcqFHYsDIrh1aP6Rzh7/xI0L444WXlzMkANb0JHgz0qAvcJ+3Q834bUKhwag== "@oraichain/oraidex-contracts-sdk@^1.0.49": version "1.0.49" resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.49.tgz#093221564552e92901c73f6043ce4dc72208d857" integrity sha512-J15JR0+wueYMLMFjz/Omg5ADSKOmmTvsBstVf76NQjrvYpekzdlIGvoTIUCGjyf+DOdzu8MevOk5HDAnOrj3Fw== -"@oraichain/oraidex-contracts-sdk@^1.0.54": - version "1.0.55" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.55.tgz#a9c8aadd5bfae4e2d2b71b4804ce3eadd35a0185" - integrity sha512-MlASHfRDnNwhM172PlFlqarCMUhcqFHYsDIrh1aP6Rzh7/xI0L444WXlzMkANb0JHgz0qAvcJ+3Q834bUKhwag== - "@oraichain/oraidex-contracts-sdk@latest": version "1.0.45" resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.45.tgz#42dae0fdd9e005f920ba305b987009f791acc365" From 52020fa9b67dd0e5bbfe781005f1c012c00d2078 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Fri, 29 Nov 2024 16:04:46 +0700 Subject: [PATCH 19/21] fix tonbridge --- package.json | 2 +- src/pages/UniversalSwap/helpers.ts | 11 +---------- yarn.lock | 12 ++++++------ 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 827663bb1..41ace2eca 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/oraidex-contracts-sdk": "1.0.55", - "@oraichain/oraidex-universal-swap": "1.1.22-beta.6", + "@oraichain/oraidex-universal-swap": "1.1.22-beta.9", "@oraichain/ton-bridge-contracts": "^0.15.8", "@oraichain/tonbridge-contracts-sdk": "^1.3.1", "@oraichain/tonbridge-sdk": "^1.3.6", diff --git a/src/pages/UniversalSwap/helpers.ts b/src/pages/UniversalSwap/helpers.ts index 86aea9990..c91e1e6ee 100644 --- a/src/pages/UniversalSwap/helpers.ts +++ b/src/pages/UniversalSwap/helpers.ts @@ -340,11 +340,6 @@ export const getDisableSwap = ({ simulateData, isLoadingSimulate }) => { - const mobileMode = isMobile(); - const canSwapToCosmos = !mobileMode && originalToToken.cosmosBased && !walletByNetworks.cosmos; - const canSwapToEvm = !mobileMode && !originalToToken.cosmosBased && !walletByNetworks.evm; - const canSwapToTron = !mobileMode && originalToToken.chainId === '0x2b6653dc' && !walletByNetworks.tron; - const canSwapTo = canSwapToCosmos || canSwapToEvm || canSwapToTron; const disabledSwapBtn = swapLoading || !fromAmountToken || @@ -352,15 +347,11 @@ export const getDisableSwap = ({ fromAmountTokenBalance > fromTokenBalance || // insufficent fund !addressTransfer || !validAddress.isValid || - isLoadingSimulate || - canSwapTo; + isLoadingSimulate; let disableMsg: string; if (!validAddress.isValid) disableMsg = `Recipient address not found`; if (!addressTransfer) disableMsg = `Recipient address not found`; - if (canSwapToCosmos) disableMsg = `Please connect cosmos wallet`; - if (canSwapToEvm) disableMsg = `Please connect evm wallet`; - if (canSwapToTron) disableMsg = `Please connect tron wallet`; if (!simulateData || simulateData.displayAmount <= 0) disableMsg = 'Enter an amount'; if (fromAmountTokenBalance > fromTokenBalance) disableMsg = `Insufficient funds`; if (isLoadingSimulate) disableMsg = `Swap`; diff --git a/yarn.lock b/yarn.lock index 0770eceb8..72c06965f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3347,7 +3347,7 @@ react-use "^17.4.0" react-use-websocket "^4.5.0" -"@oraichain/oraidex-common@1.1.32-beta.7", "@oraichain/oraidex-common@^1.1.32", "@oraichain/oraidex-common@^1.1.32-beta.5", "@oraichain/oraidex-common@^1.1.6": +"@oraichain/oraidex-common@1.1.32-beta.7", "@oraichain/oraidex-common@^1.1.32", "@oraichain/oraidex-common@^1.1.32-beta.7", "@oraichain/oraidex-common@^1.1.6": version "1.1.32-beta.7" resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.32-beta.7.tgz#acc48b8fe003d639e7550edc8a3b9e4a6c3ee743" integrity sha512-73sKbCZUO6pn+/g14V5A9FaGmcl7QkrysFz1A7EiluZajMOFYMNqc1GHDHWpHCepwkfS8Qi+hgAPu8pJtJUYgA== @@ -3389,13 +3389,13 @@ resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.45.tgz#42dae0fdd9e005f920ba305b987009f791acc365" integrity sha512-/nYztdxEX5LQM4DMJQmi9HvZrBVoY3nLAmYqSKZGZ0U1h1SxU7O/o22R3/pQwB+sAJdcibaI8ygC0ov7jC8paA== -"@oraichain/oraidex-universal-swap@1.1.22-beta.6": - version "1.1.22-beta.6" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.22-beta.6.tgz#080c5bb5c6704a76cd929482397990e1c5a45b1b" - integrity sha512-o4sRlPZWIoxt/TLSJirt6fHmYvcoAPzWklvSCv7nMFdb7VywyTa7NMVJerM7wSLXJrfE1pfjv+81Kr1hO4FJsA== +"@oraichain/oraidex-universal-swap@1.1.22-beta.9": + version "1.1.22-beta.9" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.22-beta.9.tgz#442b41e94e056ad30d90c23dfcb12c9811d03d32" + integrity sha512-I6hlUQ6LkTgA1ZAUmSqmkis1kHf3OxWepPwuYdN7xvMIvxihfxCfLYRzcZA3VXHfGbGS7Tp4y2rNqpds2F2+pw== dependencies: "@oraichain/common" "^1.0.3" - "@oraichain/oraidex-common" "^1.1.32-beta.5" + "@oraichain/oraidex-common" "^1.1.32-beta.7" "@oraichain/oraidex-contracts-sdk" "^1.0.49" "@oraichain/osor-api-contracts-sdk" "^1.0.2" bech32 "1.1.4" From 1971370bbf4a5ce6973eb2d5fcda25d40df725a6 Mon Sep 17 00:00:00 2001 From: trung2891 Date: Sat, 30 Nov 2024 13:21:16 +0700 Subject: [PATCH 20/21] chore: add solana --- package.json | 2 +- src/assets/icons/solana.svg | 1 + src/config/iconInfos.ts | 6 +++ src/hooks/useLoadTokens.ts | 1 + src/pages/Balance/index.tsx | 2 +- .../UniversalSwap/Component/AssetsTab.tsx | 12 +++--- yarn.lock | 39 +++++++++++++++---- 7 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 src/assets/icons/solana.svg diff --git a/package.json b/package.json index b13061eb8..bd0470a2d 100644 --- a/package.json +++ b/package.json @@ -150,7 +150,7 @@ "bitcoinjs-lib": "5.2.0", "axios": "0.26.1", "@sentry/react": "7.99.0", - "@oraichain/oraidex-common": "1.1.32" + "@oraichain/oraidex-common": "1.1.33" }, "engines": { "node": "^18 || ^20" diff --git a/src/assets/icons/solana.svg b/src/assets/icons/solana.svg new file mode 100644 index 000000000..7cb4588eb --- /dev/null +++ b/src/assets/icons/solana.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/config/iconInfos.ts b/src/config/iconInfos.ts index 4e6fa11fe..d47cbc70f 100644 --- a/src/config/iconInfos.ts +++ b/src/config/iconInfos.ts @@ -28,6 +28,7 @@ import PepeIcon from 'assets/icons/pepe.svg?react'; import CatIcon from 'assets/icons/icon-simoncat.svg?react'; import HmstrIcon from 'assets/icons/hmstr.svg?react'; import DogecoinIcon from 'assets/icons/dogecoin.svg?react'; +import SolanaIcon from 'assets/icons/solana.svg?react'; import { CustomChainInfo, TokenItemType } from '@oraichain/oraidex-common'; import { bitcoinChainId } from 'helper/constants'; @@ -169,6 +170,11 @@ export const tokensIconInfos: TokenIcon[] = [ coinGeckoId: 'dogecoin', Icon: DogecoinIcon, IconLight: DogecoinIcon + }, + { + coinGeckoId: 'solana', + Icon: SolanaIcon, + IconLight: SolanaIcon } ]; diff --git a/src/hooks/useLoadTokens.ts b/src/hooks/useLoadTokens.ts index 590d81931..09321829d 100644 --- a/src/hooks/useLoadTokens.ts +++ b/src/hooks/useLoadTokens.ts @@ -313,6 +313,7 @@ async function loadBtcEntries( } async function loadEvmAmounts(dispatch: Dispatch, evmAddress: string, chains: CustomChainInfo[]) { + console.log('---', chains); const amountDetails = Object.fromEntries( flatten(await Promise.all(chains.map((chain) => loadEvmEntries(evmAddress, chain)))) ); diff --git a/src/pages/Balance/index.tsx b/src/pages/Balance/index.tsx index a87ad96e2..b23cad06c 100644 --- a/src/pages/Balance/index.tsx +++ b/src/pages/Balance/index.tsx @@ -94,7 +94,7 @@ import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx'; import { MsgTransfer as MsgTransferInjective } from '@injectivelabs/sdk-ts/node_modules/cosmjs-types/ibc/applications/transfer/v1/tx'; import { collectWallet, connectWithSigner, getCosmWasmClient } from 'libs/cosmjs'; -interface BalanceProps {} +interface BalanceProps { } export const isMaintainBridge = false; diff --git a/src/pages/UniversalSwap/Component/AssetsTab.tsx b/src/pages/UniversalSwap/Component/AssetsTab.tsx index 8c929c7f2..cd0be5110 100644 --- a/src/pages/UniversalSwap/Component/AssetsTab.tsx +++ b/src/pages/UniversalSwap/Component/AssetsTab.tsx @@ -56,12 +56,12 @@ export const AssetsTab: FC<{ networkFilter: string }> = ({ networkFilter }) => { label?: string; balance?: number | string; }[] = [ - { - src: WalletIcon, - label: 'Total balance', - balance: formatDisplayUsdt(totalUsd) - } - ]; + { + src: WalletIcon, + label: 'Total balance', + balance: formatDisplayUsdt(totalUsd) + } + ]; if (!networkFilter || networkFilter === 'Oraichain') { listAsset = [ diff --git a/yarn.lock b/yarn.lock index f7a851a9c..3d0857d1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3341,10 +3341,10 @@ react-use "^17.4.0" react-use-websocket "^4.5.0" -"@oraichain/oraidex-common@1.1.32", "@oraichain/oraidex-common@^1.1.27", "@oraichain/oraidex-common@^1.1.32": - version "1.1.32" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.32.tgz#c787dc3451584ffccd63a20bb230a5dd0a2e383f" - integrity sha512-8DbfumZ26fKFN1yhiQbJOSoXdqHuoU3i2JvVLpSOtveYUd1Z5rBDs3XVS7odNcUAgF0osqzq5sg9+4yUzruZ8Q== +"@oraichain/oraidex-common@1.1.33", "@oraichain/oraidex-common@^1.1.27", "@oraichain/oraidex-common@^1.1.32": + version "1.1.33" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.33.tgz#0b0658e51411513e5fbca40682de7e94a5c96382" + integrity sha512-KVblYQTtD5npw0YpZZMQa4FIcoXzVWxaltFxiUYNIr0QZDzH56jBFwlbtc9sF4EwZV847QRgH8zGN5rrtjlYjA== dependencies: "@cosmjs/amino" "^0.32.4" "@cosmjs/cosmwasm-stargate" "^0.32.4" @@ -13496,7 +13496,7 @@ string-env-interpolation@^1.0.1: resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152" integrity sha512-78lwMoCcn0nNu8LszbP1UA7g55OeE4v7rCeWnM5B453rnNr4aq+5it3FEYtZrSEiMvHZOZ9Jlqb0OD0M2VInqg== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -13514,6 +13514,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -13542,7 +13551,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -13563,6 +13572,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -14741,7 +14757,7 @@ wordwrapjs@^5.1.0: resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-5.1.0.tgz#4c4d20446dcc670b14fa115ef4f8fd9947af2b3a" integrity sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -14768,6 +14784,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From e329a6e534f2b924bceaa317ce2f7a1397694dd1 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Sat, 30 Nov 2024 17:09:20 +0700 Subject: [PATCH 21/21] fix img --- src/assets/icons/solana.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/icons/solana.svg b/src/assets/icons/solana.svg index 7cb4588eb..5224f85ee 100644 --- a/src/assets/icons/solana.svg +++ b/src/assets/icons/solana.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file