From 3b7ecc1dda2d9f04ffad422c69df78aa8ca9eace Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 29 Aug 2023 17:17:38 +0700 Subject: [PATCH 1/4] feat: integrate wallets (#2177) --- package.json | 12 +- src/assets/wallets-connect/bocto.svg | 18 + src/assets/wallets-connect/krystal.svg | 7 + src/assets/wallets-connect/rabby.svg | 36 ++ src/assets/wallets-connect/safe.svg | 15 + src/components/FeeSelector/index.tsx | 4 +- .../Header/web3/NetworkModal/Networks.tsx | 26 +- src/components/Header/web3/SelectNetwork.tsx | 11 +- .../Header/web3/WalletModal/index.tsx | 4 +- .../SwapForm/SlippageSettingGroup.tsx | 8 +- .../SwapForm/SwapActionButton/index.tsx | 6 +- .../TransactionConfirmationModal/index.tsx | 2 +- src/components/Web3ReactManager/index.tsx | 8 +- src/constants/connectors/evm.ts | 17 +- src/constants/connectors/utils.ts | 58 +- src/constants/networks.ts | 10 +- src/constants/wallets.ts | 117 +++- src/hooks/index.ts | 11 +- src/hooks/web3/useChangeNetwork.ts | 120 +++- src/hooks/web3/useEagerConnect.ts | 25 +- .../web3/useSyncNetworkParamWithStore.ts | 9 +- src/hooks/web3/useWalletSupportedChains.ts | 14 +- src/index.tsx | 1 + .../BridgeTransferHistory/RouteCell.tsx | 3 +- .../TransferHistoryTable/Mobile.tsx | 3 +- .../TransfersHistory/HistoryTable/Mobile.tsx | 3 +- src/pages/RemoveLiquidity/TokenPair.tsx | 2 +- src/react-app-env.d.ts | 3 + src/state/transactions/updater.tsx | 3 +- src/types/array.d.ts | 8 + src/types/object.d.ts | 7 + src/utils/array.ts | 8 - src/utils/errorMessage.ts | 3 +- src/utils/index.ts | 62 +- yarn.lock | 529 ++++++++---------- 35 files changed, 730 insertions(+), 443 deletions(-) create mode 100644 src/assets/wallets-connect/bocto.svg create mode 100644 src/assets/wallets-connect/krystal.svg create mode 100644 src/assets/wallets-connect/rabby.svg create mode 100644 src/assets/wallets-connect/safe.svg create mode 100644 src/types/array.d.ts create mode 100644 src/types/object.d.ts diff --git a/package.json b/package.json index 128a6ce039..89cc78c8cd 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,9 @@ "dependencies": { "@0xsquid/sdk": "^1.4.1", "@apollo/client": "^3.7.1", + "@blocto/web3-react-connector": "^1.0.0", "@datadog/browser-rum": "^4.23.3", + "@coinbase/wallet-sdk": "^3.0.4", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@kybernetwork/oauth2": "1.0.0", "@kyberswap/ks-sdk-classic": "^1.0.3", @@ -69,12 +71,12 @@ "@solana/wallet-adapter-wallets": "^0.19.5", "@solana/web3.js": "^1.66.2", "@use-gesture/react": "^10.2.27", - "@web3-react/coinbase-wallet": "^8.2.0", - "@web3-react/core": "^8.2.0", + "@web3-react/coinbase-wallet": "8.2.0", + "@web3-react/core": "8.2.0", + "@web3-react/gnosis-safe": "8.2.0", "@web3-react/metamask": "^8.2.1", - "@web3-react/types": "^8.2.0", + "@web3-react/types": "8.2.0", "@web3-react/walletconnect-v2": "^8.3.3", - "@web3-react/walletlink-connector": "^6.2.14", "aos": "^2.3.4", "axios": "1.2.1", "base64-js": "^1.5.1", @@ -204,4 +206,4 @@ "@lingui/core": "3.14.0", "@lingui/conf": "3.16.0" } -} +} \ No newline at end of file diff --git a/src/assets/wallets-connect/bocto.svg b/src/assets/wallets-connect/bocto.svg new file mode 100644 index 0000000000..9100b0026a --- /dev/null +++ b/src/assets/wallets-connect/bocto.svg @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/src/assets/wallets-connect/krystal.svg b/src/assets/wallets-connect/krystal.svg new file mode 100644 index 0000000000..3548af080d --- /dev/null +++ b/src/assets/wallets-connect/krystal.svg @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/src/assets/wallets-connect/rabby.svg b/src/assets/wallets-connect/rabby.svg new file mode 100644 index 0000000000..6a28dda508 --- /dev/null +++ b/src/assets/wallets-connect/rabby.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/wallets-connect/safe.svg b/src/assets/wallets-connect/safe.svg new file mode 100644 index 0000000000..6041861eac --- /dev/null +++ b/src/assets/wallets-connect/safe.svg @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/src/components/FeeSelector/index.tsx b/src/components/FeeSelector/index.tsx index 15136a5c29..b8c6a7205b 100644 --- a/src/components/FeeSelector/index.tsx +++ b/src/components/FeeSelector/index.tsx @@ -220,7 +220,7 @@ function FeeSelector({ (acc, cur, index) => ({ ...acc, [cur]: poolAddresses[index] }), {} as { [key in FeeAmount]: string }, ) - const tiersThatHasFarmV1 = FEE_AMOUNTS.filter((_fee, i) => { + const tiersThatHasFarmV1: FeeAmount[] = FEE_AMOUNTS.filter((_fee, i) => { const poolAddress = poolAddresses[i].toLowerCase() return farmingPoolAddress.includes(poolAddress) }) @@ -249,7 +249,7 @@ function FeeSelector({ - {(tiersThatHasFarmV1.includes(feeAmount) || + {(tiersThatHasFarmV1.includes(feeAmount as any) || activeFarmV2s?.find(item => item.poolAddress === poolByFeeAmount[feeAmount].toLowerCase())) && ( )} diff --git a/src/components/Header/web3/NetworkModal/Networks.tsx b/src/components/Header/web3/NetworkModal/Networks.tsx index bf18992af7..1d549d3239 100644 --- a/src/components/Header/web3/NetworkModal/Networks.tsx +++ b/src/components/Header/web3/NetworkModal/Networks.tsx @@ -123,13 +123,12 @@ const Networks = ({ customToggleModal?: () => void disabledMsg?: string }) => { - const { chainId: currentChainId, isWrongNetwork } = useActiveWeb3React() + const { chainId: currentChainId, isWrongNetwork, walletEVM, walletSolana } = useActiveWeb3React() const { changeNetwork } = useChangeNetwork() const qs = useParsedQueryString() const navigate = useNavigate() const isDarkMode = useIsDarkMode() const theme = useTheme() - const { walletEVM, walletSolana } = useActiveWeb3React() const onSelect = (chainId: ChainId) => { customToggleModal?.() if (customOnSelectNetwork) { @@ -160,20 +159,29 @@ const Networks = ({ return ( - {MAINNET_NETWORKS.map((key: ChainId, i: number) => { - const { iconDark, icon, name } = NETWORKS_INFO[key] - const disabled = !isAcceptedTerm || (activeChainIds ? !activeChainIds?.includes(key) : false) - const selected = selectedId === key && !isWrongNetwork + {MAINNET_NETWORKS.map((itemChainId: ChainId, i: number) => { + const { iconDark, icon, name } = NETWORKS_INFO[itemChainId] + const disabled = !isAcceptedTerm || (activeChainIds ? !activeChainIds?.includes(itemChainId) : false) + const selected = selectedId === itemChainId && !isWrongNetwork const imgSrc = (isDarkMode ? iconDark : icon) || icon const walletKey = - key === ChainId.SOLANA ? walletSolana.walletKey : walletEVM.chainId === key ? walletEVM.walletKey : null + itemChainId === ChainId.SOLANA + ? walletSolana.walletKey + : walletEVM.chainId === itemChainId + ? walletEVM.walletKey + : null return ( - + !selected && onSelect(key)} + onClick={() => !selected && onSelect(itemChainId)} data-testid="network-button" disabled={disabled} > diff --git a/src/components/Header/web3/SelectNetwork.tsx b/src/components/Header/web3/SelectNetwork.tsx index f3ecfd7ee1..cee6ad5043 100644 --- a/src/components/Header/web3/SelectNetwork.tsx +++ b/src/components/Header/web3/SelectNetwork.tsx @@ -7,6 +7,7 @@ import { ReactComponent as DropdownSvg } from 'assets/svg/down.svg' import Card from 'components/Card' import NetworkModal from 'components/Header/web3/NetworkModal' import Row from 'components/Row' +import { MouseoverTooltip } from 'components/Tooltip' import { TutorialIds } from 'components/Tutorial/TutorialSwap/constant' import { NativeCurrencies } from 'constants/tokens' import { useActiveWeb3React } from 'hooks' @@ -82,10 +83,11 @@ function SelectNetwork(): JSX.Element | null { return `${balanceFixed} ${NativeCurrencies[chainId].symbol}` }, [userEthBalance, chainId, networkInfo]) const walletSupportsChain = useWalletSupportedChains() + const disableSelectNetwork = walletSupportsChain.length <= 1 - return ( + const button = ( toggleNetworkModal()} + onClick={() => (disableSelectNetwork ? null : toggleNetworkModal())} role="button" id={TutorialIds.SELECT_NETWORK} data-testid="select-network" @@ -108,6 +110,11 @@ function SelectNetwork(): JSX.Element | null { /> ) + if (disableSelectNetwork) + return ( + {button} + ) + return button } export default SelectNetwork diff --git a/src/components/Header/web3/WalletModal/index.tsx b/src/components/Header/web3/WalletModal/index.tsx index f7045d15b5..b2597d2a5e 100644 --- a/src/components/Header/web3/WalletModal/index.tsx +++ b/src/components/Header/web3/WalletModal/index.tsx @@ -437,8 +437,8 @@ export default function WalletModal() { minHeight={false} maxHeight={90} maxWidth={600} - bypassScrollLock={walletView === WALLET_VIEWS.PENDING && pendingWalletKey === 'WALLET_CONNECT'} - bypassFocusLock={walletView === WALLET_VIEWS.PENDING && pendingWalletKey === 'WALLET_CONNECT'} + bypassScrollLock={walletView === WALLET_VIEWS.PENDING && ['WALLET_CONNECT'].includes(pendingWalletKey)} + bypassFocusLock={walletView === WALLET_VIEWS.PENDING && ['WALLET_CONNECT', 'BLOCTO'].includes(pendingWalletKey)} > {getModalContent()} diff --git a/src/components/SwapForm/SlippageSettingGroup.tsx b/src/components/SwapForm/SlippageSettingGroup.tsx index dbefc5045d..c110b4dc4f 100644 --- a/src/components/SwapForm/SlippageSettingGroup.tsx +++ b/src/components/SwapForm/SlippageSettingGroup.tsx @@ -53,11 +53,9 @@ export default function SlippageSettingGroup({ chainId === ChainId.MAINNET && walletEVM.isConnected ? ( - {upToXXSmall ? null : ( - - Add MEV Protection - - )} + + {upToXXSmall ? MEV Protection : Add MEV Protection} + ) : null diff --git a/src/components/SwapForm/SwapActionButton/index.tsx b/src/components/SwapForm/SwapActionButton/index.tsx index 4a69dfc999..bd418a4a99 100644 --- a/src/components/SwapForm/SwapActionButton/index.tsx +++ b/src/components/SwapForm/SwapActionButton/index.tsx @@ -136,10 +136,10 @@ const SwapActionButton: React.FC = ({ const toggleApprovalModal = useToggleModal(ApplicationModal.SWAP_APPROVAL) const handleApproveClick = () => { - if (walletKey && ['METAMASK', 'TRUST_WALLET'].includes(walletKey?.toString())) { - approveCallback() - } else { + if (['COIN98', 'BRAVE', 'COINBASE'].includes(walletKey)) { toggleApprovalModal() + } else { + approveCallback() } } diff --git a/src/components/TransactionConfirmationModal/index.tsx b/src/components/TransactionConfirmationModal/index.tsx index cf6ccc8e87..5b3a9aad75 100644 --- a/src/components/TransactionConfirmationModal/index.tsx +++ b/src/components/TransactionConfirmationModal/index.tsx @@ -260,7 +260,7 @@ export function TransactionErrorContent({ confirmText?: string }) { const theme = useTheme() - const [showDetail, setShowDetail] = useState(true) + const [showDetail, setShowDetail] = useState(false) return ( diff --git a/src/components/Web3ReactManager/index.tsx b/src/components/Web3ReactManager/index.tsx index 8b66d41e37..fecea0a448 100644 --- a/src/components/Web3ReactManager/index.tsx +++ b/src/components/Web3ReactManager/index.tsx @@ -17,19 +17,19 @@ export default function Web3ReactManager({ children }: { children: JSX.Element } const triedEager = useEagerConnect() // when there's no account connected, react to logins (broadly speaking) on the injected provider, if it exists - useInactiveListener(!triedEager) + useInactiveListener(!triedEager.current) const dispatch = useDispatch() /** On user change network from wallet, update chainId in store, only work on EVM wallet */ useEffect(() => { - if (triedEager && chainIdEVM && chainIdState !== chainIdEVM && active && isEVM) { + if (triedEager.current && chainIdEVM && chainIdState !== chainIdEVM && active && isEVM) { dispatch(updateChainId(chainIdEVM)) } // Only run on change network from wallet // eslint-disable-next-line react-hooks/exhaustive-deps - }, [chainIdEVM, triedEager, active]) + }, [chainIdEVM, triedEager.current, active]) // on page load, do nothing until we've tried to connect to the injected connector - if (isEVM && !triedEager) { + if (isEVM && !triedEager.current) { return } diff --git a/src/constants/connectors/evm.ts b/src/constants/connectors/evm.ts index 5a5e40c31c..707ecef9d8 100644 --- a/src/constants/connectors/evm.ts +++ b/src/constants/connectors/evm.ts @@ -1,7 +1,9 @@ +import { BloctoConnector } from '@blocto/web3-react-connector' import { ChainId } from '@kyberswap/ks-sdk-core' import { OPTIONAL_EVENTS } from '@walletconnect/ethereum-provider' import { CoinbaseWallet } from '@web3-react/coinbase-wallet' import { initializeConnector } from '@web3-react/core' +import { GnosisSafe } from '@web3-react/gnosis-safe' import { MetaMask } from '@web3-react/metamask' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' @@ -16,10 +18,21 @@ import { } from 'constants/networks' export const [injected, injectedHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [rabby, rabbyHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [krystal, krystalHooks] = initializeConnector(actions => new MetaMask({ actions })) export const [metaMask, metamaskHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [gnosisSafe, gnosisSafeHooks] = initializeConnector(actions => new GnosisSafe({ actions })) export const [coin98, coin98Hooks] = initializeConnector(actions => new MetaMask({ actions })) export const [brave, braveHooks] = initializeConnector(actions => new MetaMask({ actions })) -export const [trustWallet, trustWalletHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [trust, trustHooks] = initializeConnector(actions => new MetaMask({ actions })) +export const [blocto, bloctoHooks] = initializeConnector( + actions => + new BloctoConnector({ + actions, + options: { chainId: ChainId.MATIC, rpc: NETWORKS_INFO[ChainId.MATIC].defaultRpcUrl }, + }), +) +export const [bloctoInject, bloctoInjectHooks] = initializeConnector(actions => new MetaMask({ actions })) const darkmode = Boolean(window.matchMedia('(prefers-color-scheme: dark)')) export const [walletConnectV2, walletConnectV2Hooks] = initializeConnector( @@ -50,7 +63,7 @@ export const [walletConnectV2, walletConnectV2Hooks] = initializeConnector { + console.log('capturing Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) + captureMessage('Injected window.ethereum', { level: 'info', extra: { 'window.ethereum': window.ethereum } }) + }, 2000) +} + export const getIsInjected = () => Boolean(window.ethereum) const allNonMetamaskFlags = [ @@ -9,20 +20,29 @@ const allNonMetamaskFlags = [ 'isTrustWallet', 'isLedgerConnect', 'isCoin98', + 'isKrystal', 'isKrystalWallet', + 'isPhantom', + 'isBlocto', ] as const - export const getIsMetaMaskWallet = () => Boolean(window.ethereum?.isMetaMask && !allNonMetamaskFlags.some(flag => window.ethereum?.[flag])) +export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) + +export const getIsKrystalWallet = () => + Boolean((window.ethereum?.isKrystalWallet || window.ethereum?.isKrystal) && !getIsTrustWallet()) + export const getIsCoinbaseWallet = () => Boolean( (window.ethereum?.isCoinbaseWallet || window.ethereum?.providers?.some(p => p?.isCoinbaseWallet)) && - !window.ethereum?.isKrystalWallet, + !getIsTrustWallet(), ) export const getIsBraveWallet = () => Boolean(checkForBraveBrowser() && window.ethereum?.isBraveWallet) +export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) + export const getIsC98Wallet = () => Boolean(window.ethereum?.isCoin98 && window.coin98) export const getIsTrustWallet = () => Boolean(window.ethereum?.isTrustWallet || window.ethereum?.isTrust) @@ -33,6 +53,9 @@ export const getIsGenericInjector = () => !getIsCoinbaseWallet() && !getIsBraveWallet() && !getIsC98Wallet() && + !getIsRabbyWallet() && + !getIsBloctoWallet() && + !getIsKrystalWallet() && !getIsTrustWallet() // https://eips.ethereum.org/EIPS/eip-1193#provider-errors @@ -55,17 +78,30 @@ export enum ErrorCode { ALPHA_WALLET_REJECTED = 'Request rejected', } -const rejectedPhrases: string[] = ['user rejected transaction', 'user denied transaction', 'you must accept'] +const rejectedPhrases: readonly string[] = [ + 'user rejected transaction', + 'User declined to send the transaction', + 'user denied transaction', + 'you must accept', +].map(phrase => phrase.toLowerCase()) export function didUserReject(error: any): boolean { + const message = String( + typeof error === 'string' ? error : error?.message || error?.code || error?.errorMessage || '', + ).toLowerCase() return ( - error?.code === ErrorCode.USER_REJECTED_REQUEST || - error?.code === ErrorCode.ACTION_REJECTED || - error?.code === ErrorCode.ALPHA_WALLET_REJECTED_CODE || - error?.message === ErrorCode.ALPHA_WALLET_REJECTED || - error?.message === ErrorCode.WALLETCONNECT_MODAL_CLOSED || - error?.message === ErrorCode.WALLETCONNECT_CANCELED || - error?.message === ErrorCode.WALLETCONNECT_MODAL_CLOSED || - rejectedPhrases.some(phrase => error?.message?.toLowerCase?.()?.includes?.(phrase.toLowerCase())) + [ErrorCode.USER_REJECTED_REQUEST, ErrorCode.ACTION_REJECTED, ErrorCode.ALPHA_WALLET_REJECTED_CODE] + .map(String) + .includes(error?.code?.toString?.()) || + ( + [ + ErrorCode.USER_REJECTED_REQUEST, + ErrorCode.ALPHA_WALLET_REJECTED, + ErrorCode.WALLETCONNECT_MODAL_CLOSED, + ErrorCode.WALLETCONNECT_CANCELED, + ErrorCode.WALLETCONNECT_MODAL_CLOSED, + ].map(String) as ErrorCode[] + ).includes(message) || + rejectedPhrases.some(phrase => message?.includes?.(phrase)) ) } diff --git a/src/constants/networks.ts b/src/constants/networks.ts index a6786a3e9e..ed4678ac7d 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -70,7 +70,7 @@ export const NETWORKS_INFO = new Proxy(NETWORKS_INFO_CONFIG, { // temporary disable Solana // todo: either enable back or completely remove Solana from codebase -export const SUPPORTED_NETWORKS = Object.keys(NETWORKS_INFO).map(Number).filter(isEVM) as ChainId[] +export const SUPPORTED_NETWORKS = Object.keys(NETWORKS_INFO).map(Number).filter(isEVM) export const MAINNET_NETWORKS = [ ChainId.MAINNET, @@ -226,6 +226,14 @@ export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS_CLASSIC: ChainId[] = [ ChainId.AURORA, ChainId.OASIS, ] +export const BLOCTO_SUPPORTED_NETWORKS: ChainId[] = [ + ChainId.MAINNET, + ChainId.ARBITRUM, + ChainId.OPTIMISM, + ChainId.MATIC, + ChainId.BSCMAINNET, + ChainId.AVAXMAINNET, +] export const ELASTIC_NOT_SUPPORTED: { [key: string]: string } = { [ChainId.AURORA]: t`Elastic is not supported on Aurora. Please switch to other chains`, diff --git a/src/constants/wallets.ts b/src/constants/wallets.ts index 9c7b9d3c54..539017d106 100644 --- a/src/constants/wallets.ts +++ b/src/constants/wallets.ts @@ -1,13 +1,18 @@ +import SafeAppsSDK from '@safe-global/safe-apps-sdk' import { BaseMessageSignerWalletAdapter, WalletReadyState } from '@solana/wallet-adapter-base' import { Web3ReactHooks } from '@web3-react/core' import { Connector } from '@web3-react/types' import { isMobile } from 'react-device-detect' +import BLOCTO from 'assets/wallets-connect/bocto.svg' import BRAVE from 'assets/wallets-connect/brave.svg' import COIN98 from 'assets/wallets-connect/coin98.svg' import COINBASE from 'assets/wallets-connect/coinbase.svg' +import KRYSTAL from 'assets/wallets-connect/krystal.svg' import METAMASK from 'assets/wallets-connect/metamask.svg' import PHANTOM from 'assets/wallets-connect/phantom.svg' +import RABBY from 'assets/wallets-connect/rabby.svg' +import SAFE from 'assets/wallets-connect/safe.svg' import SLOPE from 'assets/wallets-connect/slope.svg' import SOLFLARE from 'assets/wallets-connect/solflare.svg' import TRUSTWALLET from 'assets/wallets-connect/trust-wallet.svg' @@ -15,18 +20,28 @@ import WALLETCONNECT from 'assets/wallets-connect/wallet-connect.svg' import INJECTED_DARK_ICON from 'assets/wallets/browser-wallet-dark.svg' import INJECTED_LIGHT_ICON from 'assets/wallets/browser-wallet-light.svg' import { + blocto, + bloctoHooks, + bloctoInject, + bloctoInjectHooks, brave, braveHooks, coin98, coin98Hooks, coinbaseWallet, coinbaseWalletHooks, + gnosisSafe, + gnosisSafeHooks, injected, injectedHooks, + krystal, + krystalHooks, metaMask, metamaskHooks, - trustWallet, - trustWalletHooks, + rabby, + rabbyHooks, + trust, + trustHooks, walletConnectV2, walletConnectV2Hooks, } from 'constants/connectors/evm' @@ -39,11 +54,14 @@ import { solflareAdapter, } from 'constants/connectors/solana' import { + getIsBloctoWallet, getIsBraveWallet, getIsC98Wallet, getIsCoinbaseWallet, getIsGenericInjector, + getIsKrystalWallet, getIsMetaMaskWallet, + getIsRabbyWallet, getIsTrustWallet, } from 'constants/connectors/utils' @@ -58,6 +76,38 @@ const detectMetamask = (): WalletReadyState => { return WalletReadyState.NotDetected } +const detectBlocto = (): WalletReadyState => { + if (getIsBloctoWallet()) return WalletReadyState.NotDetected + return WalletReadyState.Installed +} + +const detectBloctoInjected = (): WalletReadyState => { + if (getIsBloctoWallet()) return WalletReadyState.Installed + return WalletReadyState.Unsupported +} + +let isSafe = false +const appsSdk = new SafeAppsSDK({}) +;(async () => { + try { + const result = await appsSdk.safe.getEnvironmentInfo() + if (result) isSafe = true + } catch (error) {} +})() +const detectSafe = (): WalletReadyState => { + return isSafe ? WalletReadyState.Installed : WalletReadyState.NotDetected +} + +const detectRabby = (): WalletReadyState => { + if (getIsRabbyWallet()) return WalletReadyState.Installed + return WalletReadyState.NotDetected +} + +const detectKrystal = (): WalletReadyState => { + if (getIsKrystalWallet()) return WalletReadyState.Installed + return WalletReadyState.NotDetected +} + const detectBrave = (): WalletReadyState => { //todo known issue: fail connect on mobile solana if (getIsBraveWallet()) return WalletReadyState.Installed @@ -129,6 +179,51 @@ export const SUPPORTED_WALLETS = { installLink: 'https://metamask.io/download', readyState: detectMetamask, } as EVMWalletInfo, + BLOCTO: { + connector: blocto, + hooks: bloctoHooks, + name: 'Blocto', + icon: BLOCTO, + iconLight: BLOCTO, + installLink: 'https://www.blocto.io/download', + readyState: detectBlocto, + } as EVMWalletInfo, + BLOCTO_INJECTED: { + connector: bloctoInject, + hooks: bloctoInjectHooks, + name: 'Blocto', + icon: BLOCTO, + iconLight: BLOCTO, + installLink: 'https://www.blocto.io/download', + readyState: detectBloctoInjected, + } as EVMWalletInfo, + SAFE: { + connector: gnosisSafe, + hooks: gnosisSafeHooks, + name: 'Safe', + icon: SAFE, + iconLight: SAFE, + installLink: 'https://safe.global/wallet', + readyState: detectSafe, + } as EVMWalletInfo, + RABBY: { + connector: rabby, + hooks: rabbyHooks, + name: 'Rabby', + icon: RABBY, + iconLight: RABBY, + installLink: 'https://rabby.io', + readyState: detectRabby, + } as EVMWalletInfo, + KRYSTAL: { + connector: krystal, + hooks: krystalHooks, + name: 'Krystal', + icon: KRYSTAL, + iconLight: KRYSTAL, + installLink: 'https://wallet.krystal.app', + readyState: detectKrystal, + } as EVMWalletInfo, BRAVE: { connector: brave, hooks: braveHooks, @@ -197,8 +292,8 @@ export const SUPPORTED_WALLETS = { readyStateSolana: () => (isMobile ? WalletReadyState.Unsupported : slopeAdapter.readyState), } as SolanaWalletInfo, TRUST_WALLET: { - connector: trustWallet, - hooks: trustWalletHooks, + connector: trust, + hooks: trustHooks, name: 'Trust Wallet', icon: TRUSTWALLET, iconLight: TRUSTWALLET, @@ -206,10 +301,20 @@ export const SUPPORTED_WALLETS = { readyState: detectTrustWallet, } as EVMWalletInfo, } as const +export type SUPPORTED_WALLET = keyof typeof SUPPORTED_WALLETS export const connections = Object.values(SUPPORTED_WALLETS).filter(wallet => 'connector' in wallet) as EVMWalletInfo[] -export type SUPPORTED_WALLET = keyof typeof SUPPORTED_WALLETS - export const LOCALSTORAGE_LAST_WALLETKEY_EVM = 'last-wallet-key-evm' export const LOCALSTORAGE_LAST_WALLETKEY_SOLANA = 'last-wallet-key-solana' +export const INJECTED_KEYS = [ + 'COIN98', + 'BRAVE', + 'METAMASK', + 'COINBASE', + 'TRUST_WALLET', + 'KRYSTAL', + 'RABBY', + 'INJECTED', +] as const +export type INJECTED_KEY = typeof INJECTED_KEYS[number] diff --git a/src/hooks/index.ts b/src/hooks/index.ts index c3c8cfeb08..059a00291a 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -7,7 +7,7 @@ import { useEffect, useMemo } from 'react' import { useSelector } from 'react-redux' import { useSearchParams } from 'react-router-dom' -import { metaMask, walletConnectV2 } from 'constants/connectors/evm' +import { blocto, gnosisSafe, metaMask, walletConnectV2 } from 'constants/connectors/evm' import { MOCK_ACCOUNT_EVM, MOCK_ACCOUNT_SOLANA } from 'constants/env' import { NETWORKS_INFO, isSupportedChainId } from 'constants/networks' import { NetworkInfo } from 'constants/networks/type' @@ -57,10 +57,17 @@ export function useActiveWeb3React(): { const walletKeyEVM = useMemo(() => { if (!isConnectedEVM) return undefined - const detectedWallet = detectInjectedType() if (connectedConnectorEVM === walletConnectV2) { return 'WALLET_CONNECT' } + if (connectedConnectorEVM === gnosisSafe) { + return 'SAFE' + } + if (connectedConnectorEVM === blocto) { + return 'BLOCTO' + } + const detectedWallet = detectInjectedType() + return ( detectedWallet ?? (Object.keys(SUPPORTED_WALLETS) as SUPPORTED_WALLET[]).find(walletKey => { diff --git a/src/hooks/web3/useChangeNetwork.ts b/src/hooks/web3/useChangeNetwork.ts index 3039ecb17f..f9f8437e99 100644 --- a/src/hooks/web3/useChangeNetwork.ts +++ b/src/hooks/web3/useChangeNetwork.ts @@ -11,6 +11,7 @@ import { useActiveWeb3React, useWeb3React } from 'hooks' import { useNotify } from 'state/application/hooks' import { useAppDispatch } from 'state/hooks' import { updateChainId } from 'state/user/actions' +import { friendlyError } from 'utils/errorMessage' import { wait } from 'utils/retry' import { useLazyKyberswapConfig } from '../useKyberSwapConfig' @@ -36,7 +37,7 @@ export function useChangeNetwork() { const successCallback = useCallback( async (desiredChainId: ChainId, waitUtilUpdatedChainId: boolean, customSuccessCallback?: () => void) => { const initialChainId = latestChainId - /** although change chain successfully, but it take 1-2s for chainId has a new value + /** although change chain successfully, but it take 1-2s for chainId has a new value | update: or never change chain but still return success, e.g: safe, phantom evm * => this option will wait util chainId has actually update to new value to prevent some edge case */ while (waitUtilUpdatedChainId) { @@ -84,9 +85,8 @@ export function useChangeNetwork() { message = t`Your wallet not support chain ${NETWORKS_INFO[desiredChainId].name}` } else { message = error?.message || message - const e = new Error(`[Wallet] ${error.message}`) - e.name = 'Activate chain fail' - e.stack = '' + const e = new Error(`[Activate chain] ${walletEVM.walletKey} ${message}`) + e.name = 'Activate chain error' captureException(e, { level: 'warning', extra: { error, wallet: walletEVM.walletKey, chainId, desiredChainId, message }, @@ -116,8 +116,9 @@ export function useChangeNetwork() { customFailureCallback?: (error: Error) => void, waitUtilUpdatedChainId = false, ) => { - const wrappedSuccessCallback = () => + const wrappedSuccessCallback = () => { successCallback(desiredChainId, waitUtilUpdatedChainId, customSuccessCallback) + } const { rpc } = customRpc ? { rpc: customRpc } : await fetchKyberswapConfig(desiredChainId) const addChainParameter = { @@ -131,31 +132,95 @@ export function useChangeNetwork() { }, blockExplorerUrls: [NETWORKS_INFO[desiredChainId].etherscanUrl], } - console.info('Add new network', { addChainParameter }) - const activeProvider = library?.provider ?? window.ethereum - if (activeProvider && activeProvider.request) { + + enum Solution { + web3_react = 'web3_react', + provider_request = 'provider_request', + } + const solutions = { + [Solution.web3_react]: async () => await connector.activate(addChainParameter), + [Solution.provider_request]: async () => { + const activeProvider = library?.provider ?? window.ethereum + if (activeProvider?.request) { + await activeProvider.request({ + method: 'wallet_addEthereumChain', + params: [addChainParameter], + }) + } else { + throw new Error('empty request function') + } + }, + } + + const solutionPrefer: readonly Solution[] = (() => { + if (walletEVM.walletKey === 'KRYSTAL') { + // Krystal break when call by web3-react .activate + return [Solution.provider_request] + } else if (walletEVM.walletKey === 'BLOCTO') { + // Blocto break when call by provider.request + return [Solution.web3_react] + } + return [Solution.provider_request, Solution.web3_react] + })() + + const errors: Error[] = [] + for (let i = 0; i < solutionPrefer.length; i++) { try { - await activeProvider.request({ - method: 'wallet_addEthereumChain', - params: [addChainParameter], + console.info('[Add network] start:', { + wallet: walletEVM.walletKey, + solution: solutionPrefer[i], + addChainParameter, + }) + await solutions[solutionPrefer[i]]() + console.info('[Add network] success:', { + wallet: walletEVM.walletKey, + solution: solutionPrefer[i], + addChainParameter, }) wrappedSuccessCallback() + return } catch (error) { - console.error('Add new network failed', { addChainParameter, error }) - failureCallback(desiredChainId, error, customFailureCallback, customTexts) - if (!didUserReject(error)) { - const e = new Error(`[Wallet] ${error.message}`) - e.name = 'Add new network Error' - e.stack = '' - captureException(e, { - level: 'warning', - extra: { error, wallet: walletEVM.walletKey, chainId, addChainParameter }, - }) + console.error( + '[Add network] error:', + JSON.stringify( + { + wallet: walletEVM.walletKey, + desiredChainId, + solution: solutionPrefer[i], + message: friendlyError(error), + error, + addChainParameter, + didUserReject: didUserReject(error), + }, + null, + 2, + ), + ) + + if (didUserReject(error)) { + failureCallback(desiredChainId, error, customFailureCallback, customTexts) + return } + errors.push(error) } } + + failureCallback(desiredChainId, errors.at(-1), customFailureCallback, customTexts) + const e = new Error(`[Add network] ${walletEVM.walletKey} ${friendlyError(errors.at(-1) || '')}`) + e.name = 'Add new network Error' + e.stack = '' + captureException(e, { + level: 'error', + extra: { + wallet: walletEVM.walletKey, + desiredChainId, + addChainParameter, + friendlyMessages: errors.map(friendlyError), + errors, + }, + }) }, - [library?.provider, chainId, failureCallback, fetchKyberswapConfig, successCallback, walletEVM.walletKey], + [library?.provider, failureCallback, fetchKyberswapConfig, successCallback, walletEVM.walletKey, connector], ) const changeNetwork = useCallback( @@ -163,7 +228,7 @@ export function useChangeNetwork() { desiredChainId: ChainId, customSuccessCallback?: () => void, customFailureCallback?: (error: Error) => void, - waitUtilUpdatedChainId = false, + waitUtilUpdatedChainId = false, //todo: force all to true isAddNetworkIfPossible = true, ) => { const wrappedSuccessCallback = () => @@ -185,12 +250,15 @@ export function useChangeNetwork() { if (isEVM(desiredChainId)) { try { - console.info('Switch network', { desiredChainId }) + console.info('[Switch network] start:', { desiredChainId }) await connector.activate(desiredChainId) - console.info('Switch network success', { desiredChainId }) + console.info('[Switch network] success:', { desiredChainId }) changeNetworkHandler(desiredChainId, wrappedSuccessCallback) } catch (error) { - console.error('Switch network failed', { desiredChainId, error }) + console.error( + '[Switch network] error:', + JSON.stringify({ desiredChainId, error, didUserReject: didUserReject(error) }, null, 2), + ) // walletconnect v2 not support add network, so halt execution here if (didUserReject(error) || connector === walletConnectV2) { diff --git a/src/hooks/web3/useEagerConnect.ts b/src/hooks/web3/useEagerConnect.ts index ed6e35f592..7cd3bef043 100644 --- a/src/hooks/web3/useEagerConnect.ts +++ b/src/hooks/web3/useEagerConnect.ts @@ -10,7 +10,7 @@ import useDisconnectWallet from './useDisconnectWallet' // make sure this hook will be ran only once globally let trying = false -let tried = false +const tried = { current: false } // global ref export function useEagerConnect() { const { active } = useWeb3React() const disconnect = useDisconnectWallet() @@ -19,7 +19,10 @@ export function useEagerConnect() { const { tryActivation } = useActivationWallet() const setTried = () => { - tried = true + try { + tried.current = true + Object.freeze(tried) + } catch {} reRender({}) } @@ -32,26 +35,34 @@ export function useEagerConnect() { return } try { - if (trying || tried) return + if (trying || tried.current) return trying = true - let activated = false + let activatedSuccess = false + // must retrieve this before activate safe, or will be overriden to SAFE const lastWalletKeyEVM = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_EVM) const lastWalletKeySolana = localStorage.getItem(LOCALSTORAGE_LAST_WALLETKEY_SOLANA) + + try { + await tryActivation('SAFE', true) + activatedSuccess = true + setTried() + } catch {} + await Promise.all([ (async () => { if (lastWalletKeyEVM) { await tryActivation(lastWalletKeyEVM, true) - activated = true + activatedSuccess = true } })(), (async () => { if (lastWalletKeySolana) { await tryActivation(lastWalletKeySolana) - activated = true + activatedSuccess = true } })(), ]) - if (!activated) { + if (!activatedSuccess) { if (isMobile && window.ethereum) { await tryActivation('INJECTED', true) } diff --git a/src/hooks/web3/useSyncNetworkParamWithStore.ts b/src/hooks/web3/useSyncNetworkParamWithStore.ts index 78d52492b1..1b24eb12ec 100644 --- a/src/hooks/web3/useSyncNetworkParamWithStore.ts +++ b/src/hooks/web3/useSyncNetworkParamWithStore.ts @@ -18,13 +18,14 @@ export function useSyncNetworkParamWithStore() { const location = useLocation() const [requestingNetwork, setRequestingNetwork] = useState() const triedSync = useRef(false) + const tried = triedEager.current useEffect(() => { if (!paramChainId) { triedSync.current = true return } - if (!triedEager) { + if (!tried) { return } @@ -46,7 +47,7 @@ export function useSyncNetworkParamWithStore() { } }) })() - }, [changeNetwork, location, navigate, networkInfo.route, networkParam, paramChainId, triedEager]) + }, [changeNetwork, location, navigate, networkInfo.route, networkParam, paramChainId, tried]) useEffect(() => { if (NETWORKS_INFO[chainId].route === requestingNetwork) setRequestingNetwork(undefined) @@ -61,12 +62,12 @@ export function useSyncNetworkParamWithStore() { networkParam && networkInfo.route !== networkParam && triedSync.current && - triedEager + tried ) { navigate( { ...location, pathname: location.pathname.replace(encodeURIComponent(networkParam), networkInfo.route) }, { replace: true }, ) } - }, [location, networkInfo.route, navigate, triedEager, networkParam, requestingNetwork]) + }, [location, networkInfo.route, navigate, tried, networkParam, requestingNetwork]) } diff --git a/src/hooks/web3/useWalletSupportedChains.ts b/src/hooks/web3/useWalletSupportedChains.ts index 946bb0acf8..5817060ff2 100644 --- a/src/hooks/web3/useWalletSupportedChains.ts +++ b/src/hooks/web3/useWalletSupportedChains.ts @@ -1,8 +1,8 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2' -import { walletConnectV2 } from 'constants/connectors/evm' -import { SUPPORTED_NETWORKS } from 'constants/networks' +import { blocto, bloctoInject, gnosisSafe, walletConnectV2 } from 'constants/connectors/evm' +import { BLOCTO_SUPPORTED_NETWORKS, SUPPORTED_NETWORKS } from 'constants/networks' import { useWeb3React } from 'hooks' function getChainsFromEIP155Accounts(accounts?: string[]): ChainId[] { @@ -15,15 +15,19 @@ function getChainsFromEIP155Accounts(accounts?: string[]): ChainId[] { .filter(x => x !== undefined) as ChainId[] } -export function useWalletSupportedChains() { - const { connector } = useWeb3React() +export function useWalletSupportedChains(): ChainId[] { + const { connector, chainId } = useWeb3React() switch (connector) { case walletConnectV2: return [ ...getChainsFromEIP155Accounts((connector as WalletConnectV2).provider?.session?.namespaces?.eip155?.accounts), - // ChainId.SOLANA, ] + case gnosisSafe: + return chainId ? [chainId] : SUPPORTED_NETWORKS + case blocto: + case bloctoInject: + return BLOCTO_SUPPORTED_NETWORKS default: return SUPPORTED_NETWORKS } diff --git a/src/index.tsx b/src/index.tsx index b52945aefd..83d858d17d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -70,6 +70,7 @@ if (ENV_LEVEL > ENV_TYPE.LOCAL) { ignoreErrors: ['AbortError'], integrations: [new BrowserTracing()], tracesSampleRate: 0.1, + normalizeDepth: 5, }) Sentry.configureScope(scope => { scope.setTag('request_id', sentryRequestId) diff --git a/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx b/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx index 192bccca34..17a4a61647 100644 --- a/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx +++ b/src/pages/Bridge/BridgeTransferHistory/RouteCell.tsx @@ -6,7 +6,6 @@ import { useTheme } from 'styled-components' import QuestionHelper from 'components/QuestionHelper' import { NETWORKS_INFO, SUPPORTED_NETWORKS } from 'constants/networks' import { useIsDarkMode } from 'state/user/hooks' -import { includes } from 'utils/array' type Props = { fromChainID: number @@ -17,7 +16,7 @@ const RouteCell: React.FC = ({ fromChainID, toChainID }) => { const theme = useTheme() const renderChainIcon = (chainId: number) => { - if (includes(SUPPORTED_NETWORKS, chainId)) { + if (SUPPORTED_NETWORKS.includes(chainId)) { const chainInfo = NETWORKS_INFO[chainId] const src = isDark && chainInfo.iconDark ? chainInfo.iconDark : chainInfo.icon return {chainInfo.name} diff --git a/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx b/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx index 1375d8a27b..fe404d0ad2 100644 --- a/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx +++ b/src/pages/Bridge/BridgeTransferHistory/TransferHistoryTable/Mobile.tsx @@ -11,7 +11,6 @@ import ActionCell from 'pages/Bridge/BridgeTransferHistory/ActionCell' import StatusBadge from 'pages/Bridge/BridgeTransferHistory/StatusBadge' import TimeStatusCell from 'pages/Bridge/BridgeTransferHistory/TimeStatusCell' import TokenReceiveCell from 'pages/Bridge/BridgeTransferHistory/TokenReceiveCell' -import { includes } from 'utils/array' import { Props } from './index' @@ -59,7 +58,7 @@ const ChainWrapper = styled.div` color: ${({ theme }) => theme.subText}; ` const ChainDisplay: React.FC<{ chainId: number }> = ({ chainId }) => { - if (includes(SUPPORTED_NETWORKS, chainId)) { + if (SUPPORTED_NETWORKS.includes(chainId)) { const chainInfo = NETWORKS_INFO[chainId] return ( diff --git a/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx b/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx index 3fdaeacaa9..dc8a558427 100644 --- a/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx +++ b/src/pages/CrossChain/TransfersHistory/HistoryTable/Mobile.tsx @@ -16,7 +16,6 @@ import ActionButtons from 'pages/CrossChain/TransfersHistory/HistoryTable/Action import { DetailTransaction } from 'pages/CrossChain/TransfersHistory/HistoryTable/DetailTransaction' import { useGetTransactionStatus } from 'pages/CrossChain/TransfersHistory/HistoryTable/TransactionItem' import { CrossChainTransfer } from 'pages/CrossChain/useTransferHistory' -import { includes } from 'utils/array' import TokenReceiveCell from './TokenReceiveCell' import { Props } from './index' @@ -65,7 +64,7 @@ const ChainWrapper = styled.div` color: ${({ theme }) => theme.subText}; ` const ChainDisplay: React.FC<{ chainId: number }> = ({ chainId }) => { - if (includes(SUPPORTED_NETWORKS, chainId)) { + if (SUPPORTED_NETWORKS.includes(chainId)) { const chainInfo = NETWORKS_INFO[chainId] return ( diff --git a/src/pages/RemoveLiquidity/TokenPair.tsx b/src/pages/RemoveLiquidity/TokenPair.tsx index a1cf53837a..9e0b968a48 100644 --- a/src/pages/RemoveLiquidity/TokenPair.tsx +++ b/src/pages/RemoveLiquidity/TokenPair.tsx @@ -582,7 +582,7 @@ export default function TokenPair({ ) : ( void removeListener?: (...args: any[]) => void diff --git a/src/state/transactions/updater.tsx b/src/state/transactions/updater.tsx index a8119e4871..4813dd3cfa 100644 --- a/src/state/transactions/updater.tsx +++ b/src/state/transactions/updater.tsx @@ -13,7 +13,6 @@ import { useSetClaimingCampaignRewardId } from 'state/campaigns/hooks' import { AppDispatch, AppState } from 'state/index' import { revokePermit } from 'state/user/actions' import { findTx } from 'utils' -import { includes } from 'utils/array' import { checkedTransaction, finalizeTransaction, removeTx, replaceTx } from './actions' import { SerializableTransactionReceipt, TRANSACTION_TYPE, TransactionDetails } from './type' @@ -134,7 +133,7 @@ export default function Updater(): null { blockHash: receipt.blockHash, status: receipt.status, }, - needCheckSubgraph: includes(NEED_CHECK_SUBGRAPH_TRANSACTION_TYPES, transaction.type), + needCheckSubgraph: NEED_CHECK_SUBGRAPH_TRANSACTION_TYPES.includes(transaction.type), }), ) diff --git a/src/types/array.d.ts b/src/types/array.d.ts new file mode 100644 index 0000000000..8d250a1fb8 --- /dev/null +++ b/src/types/array.d.ts @@ -0,0 +1,8 @@ +interface Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: any, fromIndex?: number): searchElement is T +} diff --git a/src/types/object.d.ts b/src/types/object.d.ts new file mode 100644 index 0000000000..2bb60cea06 --- /dev/null +++ b/src/types/object.d.ts @@ -0,0 +1,7 @@ +interface ObjectConstructor { + /** + * Returns the names of the enumerable string properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: { [keys in T]: unknown }): T[] +} diff --git a/src/utils/array.ts b/src/utils/array.ts index bdaa63450f..2a348bbb9f 100644 --- a/src/utils/array.ts +++ b/src/utils/array.ts @@ -7,14 +7,6 @@ export const chunk = (arr: readonly T[], chunkSize: number): T[][] => { return result } -export const includes = ( - srcStr: readonly T[] | T[], - searchElement: any, - fromIndex?: number | undefined, -): searchElement is T => { - return (srcStr as any[]).includes(searchElement, fromIndex) -} - export const uniqueArray = (array: T[], keySelector = (item: T): U => item as any): T[] => { const set = new Set() const result: T[] = [] diff --git a/src/utils/errorMessage.ts b/src/utils/errorMessage.ts index 99246bcdd1..d6a5876a59 100644 --- a/src/utils/errorMessage.ts +++ b/src/utils/errorMessage.ts @@ -8,7 +8,7 @@ function capitalizeFirstLetter(string: string) { function parseKnownPattern(text: string): string | undefined { const error = text?.toLowerCase?.() || '' - console.info('parseError:', { text, error }) + if (!error || error.includes('router: expired')) return 'An error occurred. Refresh the page and try again ' if ( @@ -44,6 +44,7 @@ const patterns: { pattern: RegExp; getMessage: (match: RegExpExecArray) => strin getMessage: match => match[1], }, { pattern: /^([\w ]*\w+) \(.+?\)$/, getMessage: match => match[1] }, + { pattern: /"message": ?"[^"]+?"/, getMessage: match => match[1] }, ] function parseKnownRegexPattern(text: string): string | undefined { const pattern = patterns.find(pattern => pattern.pattern.exec(text)) diff --git a/src/utils/index.ts b/src/utils/index.ts index 269eaddb63..5893723007 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,6 +1,7 @@ import { ApolloClient, NormalizedCacheObject } from '@apollo/client' import { BigNumber } from '@ethersproject/bignumber' import { ChainId, Currency, CurrencyAmount, Percent, Token, WETH } from '@kyberswap/ks-sdk-core' +import { WalletReadyState } from '@solana/wallet-adapter-base' import { PublicKey } from '@solana/web3.js' import dayjs from 'dayjs' import JSBI from 'jsbi' @@ -12,11 +13,18 @@ import { ENV_KEY } from 'constants/env' import { DEFAULT_GAS_LIMIT_MARGIN, ZERO_ADDRESS } from 'constants/index' import { NETWORKS_INFO, SUPPORTED_NETWORKS, isEVM } from 'constants/networks' import { KNCL_ADDRESS, KNC_ADDRESS } from 'constants/tokens' -import { EVMWalletInfo, SUPPORTED_WALLET, SolanaWalletInfo, WalletInfo } from 'constants/wallets' +import { + EVMWalletInfo, + INJECTED_KEY, + INJECTED_KEYS, + SUPPORTED_WALLET, + SUPPORTED_WALLETS, + SolanaWalletInfo, + WalletInfo, +} from 'constants/wallets' import store from 'state' import { GroupedTxsByHash, TransactionDetails } from 'state/transactions/type' import { chunk } from 'utils/array' -import checkForBraveBrowser from 'utils/checkForBraveBrowser' export const isWalletAddressSolana = async (addr: string) => { try { @@ -422,54 +430,26 @@ export const deleteUnique = (array: T[] | undefined, element: T): T[] => { export const isEVMWallet = (wallet?: WalletInfo): wallet is EVMWalletInfo => !!wallet && 'connector' in wallet export const isSolanaWallet = (wallet?: WalletInfo): wallet is SolanaWalletInfo => !!wallet && 'adapter' in wallet -enum WALLET_KEYS { - COIN98 = 'COIN98', - BRAVE = 'BRAVE', - METAMASK = 'METAMASK', - COINBASE = 'COINBASE', - TRUST_WALLET = 'TRUST_WALLET', - WALLET_CONNECT = 'WALLET_CONNECT', -} - // https://docs.metamask.io/guide/ethereum-provider.html#basic-usage // https://docs.cloud.coinbase.com/wallet-sdk/docs/injected-provider#properties // Coin98 and Brave wallet is overriding Metamask. So at a time, there is only 1 exists -export const detectInjectedType = (): WALLET_KEYS | null => { - const { ethereum } = window - // When Coinbase wallet connected will inject selectedProvider property and some others props - if (ethereum?.selectedProvider) { - if (ethereum?.selectedProvider?.isMetaMask) return WALLET_KEYS.METAMASK - if (ethereum?.selectedProvider?.isCoinbaseWallet) return WALLET_KEYS.COINBASE - } - - if (ethereum?.isCoinbaseWallet) return WALLET_KEYS.COINBASE - - if (ethereum?.isTrustWallet) return WALLET_KEYS.TRUST_WALLET - - if (checkForBraveBrowser() && ethereum?.isBraveWallet) return WALLET_KEYS.BRAVE - - if (ethereum?.isMetaMask) { - if (ethereum?.isCoin98) { - return WALLET_KEYS.COIN98 - } - return WALLET_KEYS.METAMASK - } - if (JSON.parse(localStorage.walletconnect || '{}').connected) { - return WALLET_KEYS.WALLET_CONNECT - } - return null +export const detectInjectedType = (): INJECTED_KEY | undefined => { + return INJECTED_KEYS.find(walletKey => { + const wallet = SUPPORTED_WALLETS[walletKey] + return wallet.readyState() === WalletReadyState.Installed + }) } export const isOverriddenWallet = (wallet: SUPPORTED_WALLET) => { const injectedType = detectInjectedType() return ( - (wallet === WALLET_KEYS.COIN98 && injectedType === WALLET_KEYS.METAMASK) || - (wallet === WALLET_KEYS.METAMASK && injectedType === WALLET_KEYS.COIN98) || - (wallet === WALLET_KEYS.BRAVE && injectedType === WALLET_KEYS.COIN98) || - (wallet === WALLET_KEYS.COIN98 && injectedType === WALLET_KEYS.BRAVE) || - (wallet === WALLET_KEYS.COINBASE && injectedType === WALLET_KEYS.COIN98) || + (wallet === 'COIN98' && injectedType === 'METAMASK') || + (wallet === 'METAMASK' && injectedType === 'COIN98') || + (wallet === 'BRAVE' && injectedType === 'COIN98') || + (wallet === 'COIN98' && injectedType === 'BRAVE') || + (wallet === 'COINBASE' && injectedType === 'COIN98') || // Coin98 turned off override MetaMask in setting - (wallet === WALLET_KEYS.COIN98 && window.coin98 && !window.ethereum?.isCoin98) + (wallet === 'COIN98' && window.coin98 && !window.ethereum?.isCoin98) ) } diff --git a/yarn.lock b/yarn.lock index cd50cc9c0e..9c24a7f778 100644 --- a/yarn.lock +++ b/yarn.lock @@ -63,7 +63,7 @@ dependencies: "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.22.0": +"@babel/compat-data@^7.22.0": version "7.22.3" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.3.tgz#cd502a6a0b6e37d7ad72ce7e71a7160a3ae36f7e" integrity sha512-aNtko9OPOwVESUFp3MZfD8Uzxl7JzSeJpd7npIoxCasU37PFbAQRpKglkaKwlHOyeJdrREpo8TW8ldrkYWwvIQ== @@ -161,18 +161,6 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" "@babel/helper-split-export-declaration" "^7.18.6" -"@babel/helper-define-polyfill-provider@^0.3.3": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz#8612e55be5d51f0cd1f36b4a5a83924e89884b7a" - integrity sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww== - dependencies: - "@babel/helper-compilation-targets" "^7.17.7" - "@babel/helper-plugin-utils" "^7.16.7" - debug "^4.1.1" - lodash.debounce "^4.0.8" - resolve "^1.14.2" - semver "^6.1.2" - "@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.18.9", "@babel/helper-environment-visitor@^7.22.1": version "7.22.1" resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.1.tgz#ac3a56dbada59ed969d712cf527bd8271fe3eba8" @@ -228,7 +216,7 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.20.2": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.20.2": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56" integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg== @@ -389,18 +377,6 @@ "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-runtime@^7.5.5": - version "7.19.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.19.6.tgz#9d2a9dbf4e12644d6f46e5e75bfbf02b5d6e9194" - integrity sha512-PRH37lz4JU156lYFW1p8OxE5i7d6Sl/zV58ooyr+q1J1lnQPyg5tIiXlIwNVhJaY4W3TmOtdc8jqdXQcB1v5Yw== - dependencies: - "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.19.0" - babel-plugin-polyfill-corejs2 "^0.3.3" - babel-plugin-polyfill-corejs3 "^0.6.0" - babel-plugin-polyfill-regenerator "^0.4.1" - semver "^6.3.0" - "@babel/plugin-transform-typescript@^7.21.3": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.21.3.tgz#316c5be579856ea890a57ebc5116c5d064658f2b" @@ -449,6 +425,13 @@ dependencies: regenerator-runtime "^0.13.11" +"@babel/runtime@^7.22.6": + version "7.22.10" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.10.tgz#ae3e9631fd947cb7e3610d3e9d8fef5f76696682" + integrity sha512-21t/fkKLMZI4pqP2wlmsQAWnYW1PDyKyyUV4vCi+B25ydmdaYTKXPwCj0BzSUnZf4seIiYvSA3jcZ3gdsMFkLQ== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/template@^7.16.7", "@babel/template@^7.20.7", "@babel/template@^7.21.9": version "7.21.9" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.21.9.tgz#bf8dad2859130ae46088a99c1f265394877446fb" @@ -517,6 +500,24 @@ eip1193-provider "^1.0.1" js-sha3 "^0.8.0" +"@blocto/sdk@^0.5.5": + version "0.5.5" + resolved "https://registry.yarnpkg.com/@blocto/sdk/-/sdk-0.5.5.tgz#807b9eaeee924c3eb0c5517c6b32891025f1f6b0" + integrity sha512-u7bbAYmYDCf0QWvXleVOTeGFRbo8evT3uacsLJ6dv01HspmLDKZWjFyu7i3ARebJTpenHvwM78XHV7KTvBqTRg== + dependencies: + bs58 "^5.0.0" + buffer "^6.0.3" + eip1193-provider "^1.0.1" + js-sha3 "^0.8.0" + +"@blocto/web3-react-connector@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@blocto/web3-react-connector/-/web3-react-connector-1.0.0.tgz#22c62918c260fe2df5a8fbe1f79deef685998689" + integrity sha512-p3lo7K4Y86P50d6LxbxbSiN4ungg1wNmU85F0OEYDUK8NW8l/opG2EeeodFYSOo+MB7BgiaGMN9m+vPzrn+4pQ== + dependencies: + "@blocto/sdk" "^0.5.5" + "@web3-react/types" "^8.1.2-beta.0" + "@censo-custody/solana-wallet-adapter@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@censo-custody/solana-wallet-adapter/-/solana-wallet-adapter-0.1.0.tgz#064adae9f216dc4b726c1cc45b6b24cf0c734f07" @@ -528,18 +529,18 @@ uuid "^8.3.2" "@coinbase/wallet-sdk@^3.0.4": - version "3.6.2" - resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.6.2.tgz#e8633001136e0236a746f6462c0dff2f881db343" - integrity sha512-HzxajB+qS+G9//c+th5uJ8KSt+jQ6/U+cgL9Sv89Wx6Mif+Lg5HxGtc6JQcIdHuYk9AFX+nXNSXtTGRdpHkdDg== + version "3.7.1" + resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.7.1.tgz#44b3b7a925ff5cc974e4cbf7a44199ffdcf03541" + integrity sha512-LjyoDCB+7p0waQXfK+fUgcAs3Ezk6S6e+LYaoFjpJ6c9VTop3NyZF40Pi7df4z7QJohCwzuIDjz0Rhtig6Y7Pg== dependencies: "@metamask/safe-event-emitter" "2.0.0" - "@solana/web3.js" "1.52.0" + "@solana/web3.js" "^1.70.1" bind-decorator "^1.0.11" bn.js "^5.1.1" buffer "^6.0.3" clsx "^1.1.0" - eth-block-tracker "4.4.3" - eth-json-rpc-filters "4.2.2" + eth-block-tracker "6.1.0" + eth-json-rpc-filters "5.1.0" eth-rpc-errors "4.0.2" json-rpc-engine "6.1.0" keccak "^3.0.1" @@ -1169,7 +1170,7 @@ "@ethersproject/bytes" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.5.0", "@ethersproject/sha2@^5.7.0": +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== @@ -2302,6 +2303,16 @@ resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" integrity sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q== +"@metamask/utils@^3.0.1": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.6.0.tgz#b218b969a05ca7a8093b5d1670f6625061de707d" + integrity sha512-9cIRrfkWvHblSiNDVXsjivqa9Ak0RYo/1H6tqTqTbAx+oBK2Sva0lWDHxGchOqA7bySGUJKAWSNJvH6gdHZ0gQ== + dependencies: + "@types/debug" "^4.1.7" + debug "^4.3.4" + semver "^7.3.8" + superstruct "^1.0.3" + "@motionone/animation@^10.15.1": version "10.15.1" resolved "https://registry.yarnpkg.com/@motionone/animation/-/animation-10.15.1.tgz#4a85596c31cbc5100ae8eb8b34c459fb0ccf6807" @@ -2396,6 +2407,13 @@ dependencies: "@noble/hashes" "1.3.0" +"@noble/curves@^1.0.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" + integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== + dependencies: + "@noble/hashes" "1.3.1" + "@noble/ed25519@^1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.1.tgz#6899660f6fbb97798a6fbd227227c4589a454724" @@ -2411,6 +2429,11 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== +"@noble/hashes@1.3.1", "@noble/hashes@^1.3.1": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" + integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== + "@noble/secp256k1@1.7.1", "@noble/secp256k1@^1.6.3": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -2790,6 +2813,37 @@ estree-walker "^2.0.2" picomatch "^2.3.1" +"@safe-global/safe-apps-provider@^0.16.0": + version "0.16.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.16.0.tgz#55cb8ef168900fa13d4f4508a99ef00b565bf55d" + integrity sha512-oeRlvU+2hjFx/7EbskGq30kkwL2hyfdseZZZYf6na/xD85mZ59zKO81lBxZcWnvofJFqjqtScz84PAKth9Sq2g== + dependencies: + "@safe-global/safe-apps-sdk" "7.10.0" + events "^3.3.0" + +"@safe-global/safe-apps-sdk@7.10.0": + version "7.10.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-sdk/-/safe-apps-sdk-7.10.0.tgz#e75fc581126f27c52ec2601da51bca5eb99b61f4" + integrity sha512-is0QAHVoGkP06YfOPcp4X3/YUEA3wRdgFUyKZ4rT47uOEnzxA9Sm8BFJrIZqZOjjqC+aJXRMF0cE2qucS953rg== + dependencies: + "@safe-global/safe-gateway-typescript-sdk" "^3.5.3" + ethers "^5.7.2" + +"@safe-global/safe-apps-sdk@^7.10.0": + version "7.11.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-sdk/-/safe-apps-sdk-7.11.0.tgz#2cbc164fb70141cdf4d3331ff222cd98a2529316" + integrity sha512-RDamzPM1Lhhiiz0O+Dn6FkFqIh47jmZX+HCV/BBnBBOSKfBJE//IGD3+02zMgojXHTikQAburdPes9qmH1SA1A== + dependencies: + "@safe-global/safe-gateway-typescript-sdk" "^3.5.3" + ethers "^5.7.2" + +"@safe-global/safe-gateway-typescript-sdk@^3.5.3": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@safe-global/safe-gateway-typescript-sdk/-/safe-gateway-typescript-sdk-3.9.0.tgz#5aa36c05b865f6fe754d1d460f83bc9bf3a0145e" + integrity sha512-DxRM/sBBQhv955dPtdo0z2Bf2fXxrzoRUnGyTa3+4Z0RAhcyiqnffRP1Bt3tyuvlyfZnFL0RsvkqDcAIKzq3RQ== + dependencies: + cross-fetch "^3.1.5" + "@scure/base@~1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938" @@ -3351,13 +3405,15 @@ dependencies: "@solana/wallet-adapter-base" "^0.9.19" -"@solana/web3.js@1.52.0": - version "1.52.0" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.52.0.tgz#71bd5c322a31e3e2fa8cda2261c594846810b8ea" - integrity sha512-oG1+BX4nVYZ0OBzmk6DRrY8oBYMsbXVQEf9N9JOfKm+wXSmjxVEEo8v3IPV8mKwR0JvUWuE8lOn3IUDiMlRLgg== +"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.44.3", "@solana/web3.js@^1.66.2": + version "1.70.1" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.70.1.tgz#4a2df47cc32a0f67be5161e772b2ceb6512281fa" + integrity sha512-AnaqCF1cJ3w7d0yhvLGAKAcRI+n5o+ursQihhoTe4cUh8/9d4gbT73SoHYElS7e67OtAgLmSfbcC5hcOAgdvnQ== dependencies: "@babel/runtime" "^7.12.5" - "@ethersproject/sha2" "^5.5.0" + "@noble/ed25519" "^1.7.0" + "@noble/hashes" "^1.1.2" + "@noble/secp256k1" "^1.6.3" "@solana/buffer-layout" "^4.0.0" bigint-buffer "^1.1.5" bn.js "^5.0.0" @@ -3366,33 +3422,29 @@ buffer "6.0.1" fast-stable-stringify "^1.0.0" jayson "^3.4.4" - js-sha3 "^0.8.0" node-fetch "2" - react-native-url-polyfill "^1.3.0" rpc-websockets "^7.5.0" - secp256k1 "^4.0.2" superstruct "^0.14.2" - tweetnacl "^1.0.3" -"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.44.3", "@solana/web3.js@^1.66.2": - version "1.70.1" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.70.1.tgz#4a2df47cc32a0f67be5161e772b2ceb6512281fa" - integrity sha512-AnaqCF1cJ3w7d0yhvLGAKAcRI+n5o+ursQihhoTe4cUh8/9d4gbT73SoHYElS7e67OtAgLmSfbcC5hcOAgdvnQ== +"@solana/web3.js@^1.70.1": + version "1.78.4" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.78.4.tgz#e8ca9abe4ec2af5fc540c1d272efee24aaffedb3" + integrity sha512-up5VG1dK+GPhykmuMIozJZBbVqpm77vbOG6/r5dS7NBGZonwHfTLdBbsYc3rjmaQ4DpCXUa3tUc4RZHRORvZrw== dependencies: - "@babel/runtime" "^7.12.5" - "@noble/ed25519" "^1.7.0" - "@noble/hashes" "^1.1.2" - "@noble/secp256k1" "^1.6.3" + "@babel/runtime" "^7.22.6" + "@noble/curves" "^1.0.0" + "@noble/hashes" "^1.3.1" "@solana/buffer-layout" "^4.0.0" + agentkeepalive "^4.3.0" bigint-buffer "^1.1.5" - bn.js "^5.0.0" + bn.js "^5.2.1" borsh "^0.7.0" bs58 "^4.0.1" - buffer "6.0.1" + buffer "6.0.3" fast-stable-stringify "^1.0.0" - jayson "^3.4.4" - node-fetch "2" - rpc-websockets "^7.5.0" + jayson "^4.1.0" + node-fetch "^2.6.12" + rpc-websockets "^7.5.1" superstruct "^0.14.2" "@solflare-wallet/sdk@^1.1.0": @@ -4013,13 +4065,6 @@ resolved "https://registry.yarnpkg.com/@types/big.js/-/big.js-6.1.6.tgz#3d417e758483d55345a03a087f7e0c87137ca444" integrity sha512-0r9J+Zz9rYm2hOTwiMAVkm3XFQ4u5uTK37xrQMhc9bysn/sf/okzovWMYYIBMFTn/yrEZ11pusgLEaoarTlQbA== -"@types/bn.js@^4.11.3": - version "4.11.6" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" - integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== - dependencies: - "@types/node" "*" - "@types/bn.js@^5.1.0": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.1.tgz#b51e1b55920a4ca26e9285ff79936bbdec910682" @@ -4327,6 +4372,13 @@ "@types/d3-transition" "*" "@types/d3-zoom" "*" +"@types/debug@^4.1.7": + version "4.1.8" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.8.tgz#cef723a5d0a90990313faec2d1e22aee5eecb317" + integrity sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ== + dependencies: + "@types/ms" "*" + "@types/estree@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" @@ -4467,6 +4519,11 @@ resolved "https://registry.yarnpkg.com/@types/mixpanel-browser/-/mixpanel-browser-2.38.0.tgz#b3e28e1ba06c10a9f88510b88f1ac9d1b2adfc42" integrity sha512-TR8rvsILnqXA7oiiGOxuMGXwvDeCoQDonXJB5UR+TYvEAFpiK8ReFj5LhZT+Xhm3NpI9aPoju30jB2ssorSUww== +"@types/ms@*": + version "0.7.31" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" + integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + "@types/multicodec@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@types/multicodec/-/multicodec-1.0.0.tgz#9c9c2df84ea5006c65a048873600f71c4565a397" @@ -5512,21 +5569,14 @@ "@walletconnect/window-getters" "^1.0.1" tslib "1.14.1" -"@web3-react/abstract-connector@^6.0.7": - version "6.0.7" - resolved "https://registry.yarnpkg.com/@web3-react/abstract-connector/-/abstract-connector-6.0.7.tgz#401b3c045f1e0fab04256311be49d5144e9badc6" - integrity sha512-RhQasA4Ox8CxUC0OENc1AJJm8UTybu/oOCM61Zjg6y0iF7Z0sqv1Ai1VdhC33hrQpA8qSBgoXN9PaP8jKmtdqg== - dependencies: - "@web3-react/types" "^6.0.7" - -"@web3-react/coinbase-wallet@^8.2.0": +"@web3-react/coinbase-wallet@8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/coinbase-wallet/-/coinbase-wallet-8.2.0.tgz#038bb9e915834046320621aa49db5ba79130e488" integrity sha512-SFPrsRbyw1gECyKJmE/TAB3iMhHAqh9DTa8X2FKPMgPyNPVPcha4+G0SuWy55rysh0MO6TJbj9pofX3HvXaYpw== dependencies: "@web3-react/types" "^8.2.0" -"@web3-react/core@^8.2.0": +"@web3-react/core@8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/core/-/core-8.2.0.tgz#95fb615bb283be520e6f61b5e48cfb0047943808" integrity sha512-r7dmK2E8Jrpvm/DF93hGMB+8lECHSI3Oo0NrHbhxkisK6in6rdgAXeYFhZtM48LBAm9py6fQvLzjCM6Qx9q0oQ== @@ -5537,6 +5587,15 @@ optionalDependencies: "@ethersproject/providers" "^5" +"@web3-react/gnosis-safe@8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@web3-react/gnosis-safe/-/gnosis-safe-8.2.0.tgz#003e7f5b335751b6699152be301256c989631b51" + integrity sha512-52Z1uHcnIVsyfEPjj2C+cDF21wNCMrCT6kr1JTFXkvLMfZ3LvfWOX1j+C9lOBGUyZRBe5ZtkjiLiogGqRqZYmA== + dependencies: + "@safe-global/safe-apps-provider" "^0.16.0" + "@safe-global/safe-apps-sdk" "^7.10.0" + "@web3-react/types" "^8.2.0" + "@web3-react/metamask@^8.2.1": version "8.2.1" resolved "https://registry.yarnpkg.com/@web3-react/metamask/-/metamask-8.2.1.tgz#7ffac16e2a55ff8f1195e2831a9f9f99fa0bfba9" @@ -5554,12 +5613,7 @@ "@web3-react/types" "^8.2.0" zustand "^4.3.5" -"@web3-react/types@^6.0.7": - version "6.0.7" - resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-6.0.7.tgz#34a6204224467eedc6123abaf55fbb6baeb2809f" - integrity sha512-ofGmfDhxmNT1/P/MgVa8IKSkCStFiyvXe+U5tyZurKdrtTDFU+wJ/LxClPDtFerWpczNFPUSrKcuhfPX1sI6+A== - -"@web3-react/types@^8.2.0": +"@web3-react/types@8.2.0", "@web3-react/types@^8.1.2-beta.0", "@web3-react/types@^8.2.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-8.2.0.tgz#195464ebb94cb417e6dc3c16951573f9b6b3832a" integrity sha512-TBYTFlqJZaEpVbuAAKRJFX5PZc3lI1TqDZzY94zwCrCh4GBepwwK7+PxmRAppMFuNa5x0vFX/ghLEC44e6TCFg== @@ -5576,15 +5630,6 @@ "@web3-react/types" "^8.2.0" eventemitter3 "^4.0.7" -"@web3-react/walletlink-connector@^6.2.14": - version "6.2.14" - resolved "https://registry.yarnpkg.com/@web3-react/walletlink-connector/-/walletlink-connector-6.2.14.tgz#4adf7b94de5d7018a9fc9e3b6009e78cd33d6e15" - integrity sha512-F2v1Uu7Nhptt7AaUEJpz69+NVUJxyUfDEA5B/Vr1HkqAL1aJM5gv6B1m4M/VdXKLpmjZ9Kg6X0+VUEyAx1eQ4w== - dependencies: - "@coinbase/wallet-sdk" "^3.0.4" - "@web3-react/abstract-connector" "^6.0.7" - "@web3-react/types" "^6.0.7" - "@web3modal/core@2.4.7": version "2.4.7" resolved "https://registry.yarnpkg.com/@web3modal/core/-/core-2.4.7.tgz#e128be449bc5f6f23f6fb32f12021c096b5e7a07" @@ -5707,6 +5752,13 @@ agent-base@6, agent-base@^6.0.0, agent-base@^6.0.2: dependencies: debug "4" +agentkeepalive@^4.3.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== + dependencies: + humanize-ms "^1.2.1" + aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -6239,30 +6291,6 @@ babel-plugin-macros@^3.0.1, babel-plugin-macros@^3.1.0: cosmiconfig "^7.0.0" resolve "^1.19.0" -babel-plugin-polyfill-corejs2@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz#5d1bd3836d0a19e1b84bbf2d9640ccb6f951c122" - integrity sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q== - dependencies: - "@babel/compat-data" "^7.17.7" - "@babel/helper-define-polyfill-provider" "^0.3.3" - semver "^6.1.1" - -babel-plugin-polyfill-corejs3@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz#56ad88237137eade485a71b52f72dbed57c6230a" - integrity sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.3" - core-js-compat "^3.25.1" - -babel-plugin-polyfill-regenerator@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz#390f91c38d90473592ed43351e801a9d3e0fd747" - integrity sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.3" - babel-plugin-react-generate-property@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/babel-plugin-react-generate-property/-/babel-plugin-react-generate-property-1.1.2.tgz#2f861e2661795a242b80284af32573bb2c6cdf3b" @@ -6500,7 +6528,7 @@ bmp-js@^0.1.0: resolved "https://registry.yarnpkg.com/bmp-js/-/bmp-js-0.1.0.tgz#e05a63f796a6c1ff25f4771ec7adadc148c07233" integrity sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== @@ -6652,7 +6680,7 @@ browserify-sign@^4.0.0: readable-stream "^3.6.0" safe-buffer "^5.2.0" -browserslist@^4.21.3, browserslist@^4.21.4: +browserslist@^4.21.3: version "4.21.4" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987" integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw== @@ -6685,11 +6713,6 @@ bs58check@^2.1.2: create-hash "^1.1.0" safe-buffer "^5.1.2" -btoa@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/btoa/-/btoa-1.2.1.tgz#01a9909f8b2c93f6bf680ba26131eb30f7fa3d73" - integrity sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g== - buffer-alloc-unsafe@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" @@ -7153,11 +7176,6 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== -clone@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== - clsx@^1.1.0, clsx@^1.1.1, clsx@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" @@ -7508,13 +7526,6 @@ copy-to-clipboard@^3.2.0, copy-to-clipboard@^3.3.1: dependencies: toggle-selection "^1.0.6" -core-js-compat@^3.25.1: - version "3.26.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.26.1.tgz#0e710b09ebf689d719545ac36e49041850f943df" - integrity sha512-622/KzTudvXCDLRw70iHW4KKs1aGpcRcowGWyYJr2DEBfRrd6hNJybxSWJFuZYD4ma86xhrwDDHxmDaIq4EA8A== - dependencies: - browserslist "^4.21.4" - core-js-pure@^3.30.2: version "3.30.2" resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.30.2.tgz#005a82551f4af3250dcfb46ed360fad32ced114e" @@ -9194,48 +9205,28 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== -eth-block-tracker@4.4.3: - version "4.4.3" - resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-4.4.3.tgz#766a0a0eb4a52c867a28328e9ae21353812cf626" - integrity sha512-A8tG4Z4iNg4mw5tP1Vung9N9IjgMNqpiMoJ/FouSFwNCGHv2X0mmOYwtQOJzki6XN7r7Tyo01S29p7b224I4jw== +eth-block-tracker@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-6.1.0.tgz#0481f97bbb88a100b9d45806fe7e37af741cbefc" + integrity sha512-K9SY8+/xMBi4M5HHTDdxnpEqEEGjbNpzHFqvxyjMZej8InV/B+CkFRKM6W+uvrFJ7m8Zd1E0qUkseU3vdIDFYQ== dependencies: - "@babel/plugin-transform-runtime" "^7.5.5" - "@babel/runtime" "^7.5.5" - eth-query "^2.1.0" + "@metamask/safe-event-emitter" "^2.0.0" + "@metamask/utils" "^3.0.1" json-rpc-random-id "^1.0.1" pify "^3.0.0" - safe-event-emitter "^1.0.1" -eth-json-rpc-filters@4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz#eb35e1dfe9357ace8a8908e7daee80b2cd60a10d" - integrity sha512-DGtqpLU7bBg63wPMWg1sCpkKCf57dJ+hj/k3zF26anXMzkmtSBDExL8IhUu7LUd34f0Zsce3PYNO2vV2GaTzaw== +eth-json-rpc-filters@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-5.1.0.tgz#f0c2aeaec2a45e2dc6ca1b9843d8e85447821427" + integrity sha512-fos+9xmoa1A2Ytsc9eYof17r81BjdJOUcGcgZn4K/tKdCCTb+a8ytEtwlu1op5qsXFDlgGmstTELFrDEc89qEQ== dependencies: "@metamask/safe-event-emitter" "^2.0.0" async-mutex "^0.2.6" - eth-json-rpc-middleware "^6.0.0" eth-query "^2.1.2" json-rpc-engine "^6.1.0" pify "^5.0.0" -eth-json-rpc-middleware@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-6.0.0.tgz#4fe16928b34231a2537856f08a5ebbc3d0c31175" - integrity sha512-qqBfLU2Uq1Ou15Wox1s+NX05S9OcAEL4JZ04VZox2NS0U+RtCMjSxzXhLFWekdShUPZ+P8ax3zCO2xcPrp6XJQ== - dependencies: - btoa "^1.2.1" - clone "^2.1.1" - eth-query "^2.1.2" - eth-rpc-errors "^3.0.0" - eth-sig-util "^1.4.2" - ethereumjs-util "^5.1.2" - json-rpc-engine "^5.3.0" - json-stable-stringify "^1.0.1" - node-fetch "^2.6.1" - pify "^3.0.0" - safe-event-emitter "^1.0.1" - -eth-query@^2.1.0, eth-query@^2.1.2: +eth-query@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/eth-query/-/eth-query-2.1.2.tgz#d6741d9000106b51510c72db92d6365456a6da5e" integrity sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA== @@ -9250,13 +9241,6 @@ eth-rpc-errors@4.0.2: dependencies: fast-safe-stringify "^2.0.6" -eth-rpc-errors@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-3.0.0.tgz#d7b22653c70dbf9defd4ef490fd08fe70608ca10" - integrity sha512-iPPNHPrLwUlR9xCSYm7HHQjWBasor3+KZfRvwEWxMz3ca0yqnlBeJrnyphkGIXZ4J7AMAaOLmwy4AWhnxOiLxg== - dependencies: - fast-safe-stringify "^2.0.6" - eth-rpc-errors@^4.0.2, eth-rpc-errors@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" @@ -9264,14 +9248,6 @@ eth-rpc-errors@^4.0.2, eth-rpc-errors@^4.0.3: dependencies: fast-safe-stringify "^2.0.6" -eth-sig-util@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-1.4.2.tgz#8d958202c7edbaae839707fba6f09ff327606210" - integrity sha512-iNZ576iTOGcfllftB73cPB5AN+XUQAT/T8xzsILsghXC1o8gJUqe3RHlcDqagu+biFpYQ61KQrZZJza8eRSYqw== - dependencies: - ethereumjs-abi "git+https://github.com/ethereumjs/ethereumjs-abi.git" - ethereumjs-util "^5.1.1" - ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -9293,39 +9269,6 @@ ethereum-cryptography@^0.1.3: secp256k1 "^4.0.1" setimmediate "^1.0.5" -"ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": - version "0.6.8" - resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0" - dependencies: - bn.js "^4.11.8" - ethereumjs-util "^6.0.0" - -ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2: - version "5.2.1" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" - integrity sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ== - dependencies: - bn.js "^4.11.0" - create-hash "^1.1.2" - elliptic "^6.5.2" - ethereum-cryptography "^0.1.3" - ethjs-util "^0.1.3" - rlp "^2.0.0" - safe-buffer "^5.1.1" - -ethereumjs-util@^6.0.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz#fcb4e4dd5ceacb9d2305426ab1a5cd93e3163b69" - integrity sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw== - dependencies: - "@types/bn.js" "^4.11.3" - bn.js "^4.11.0" - create-hash "^1.1.2" - elliptic "^6.5.2" - ethereum-cryptography "^0.1.3" - ethjs-util "0.1.6" - rlp "^2.2.3" - ethereumjs-util@^7.1.5: version "7.1.5" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" @@ -9337,7 +9280,7 @@ ethereumjs-util@^7.1.5: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -ethers@^5.4.6, ethers@^5.6.9, ethers@^5.7.1: +ethers@^5.4.6, ethers@^5.6.9, ethers@^5.7.1, ethers@^5.7.2: version "5.7.2" resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== @@ -9395,14 +9338,6 @@ etherscan-api@^10.3.0: gh-pages "4.0.0" querystring "0.2.1" -ethjs-util@0.1.6, ethjs-util@^0.1.3: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" - integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== - dependencies: - is-hex-prefixed "1.0.0" - strip-hex-prefix "1.0.0" - event-stream@=3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" @@ -9426,7 +9361,7 @@ eventemitter3@^4.0.0, eventemitter3@^4.0.1, eventemitter3@^4.0.4, eventemitter3@ resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== -events@^3.0.0, events@^3.3.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== @@ -10886,6 +10821,13 @@ human-signals@^4.3.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + hyphenate-style-name@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d" @@ -11251,11 +11193,6 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" -is-hex-prefixed@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" - integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== - is-inside-container@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" @@ -11673,6 +11610,24 @@ jayson@^3.4.4: uuid "^8.3.2" ws "^7.4.5" +jayson@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.1.0.tgz#60dc946a85197317f2b1439d672a8b0a99cea2f9" + integrity sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A== + dependencies: + "@types/connect" "^3.4.33" + "@types/node" "^12.12.54" + "@types/ws" "^7.4.4" + JSONStream "^1.3.5" + commander "^2.20.3" + delay "^5.0.0" + es6-promisify "^5.0.0" + eyes "^0.1.8" + isomorphic-ws "^4.0.1" + json-stringify-safe "^5.0.1" + uuid "^8.3.2" + ws "^7.4.5" + jest-diff@^25.2.1: version "25.5.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.5.0.tgz#1dd26ed64f96667c068cef026b677dfa01afcfa9" @@ -11814,14 +11769,6 @@ json-rpc-engine@6.1.0, json-rpc-engine@^6.1.0: "@metamask/safe-event-emitter" "^2.0.0" eth-rpc-errors "^4.0.2" -json-rpc-engine@^5.3.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-5.4.0.tgz#75758609d849e1dba1e09021ae473f3ab63161e5" - integrity sha512-rAffKbPoNDjuRnXkecTjnsE3xLLrb00rEkdgalINhaYVYIxDwWtvYBr9UFbhTvPB1B2qUOLoFd/cV6f4Q7mh7g== - dependencies: - eth-rpc-errors "^3.0.0" - safe-event-emitter "^1.0.1" - json-rpc-random-id@^1.0.0, json-rpc-random-id@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-rpc-random-id/-/json-rpc-random-id-1.0.1.tgz#ba49d96aded1444dbb8da3d203748acbbcdec8c8" @@ -11920,7 +11867,7 @@ jsqr@^1.2.0: array-includes "^3.1.5" object.assign "^4.1.3" -keccak@^3.0.0, keccak@^3.0.1, keccak@^3.0.2: +keccak@^3.0.0, keccak@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== @@ -11929,6 +11876,15 @@ keccak@^3.0.0, keccak@^3.0.1, keccak@^3.0.2: node-gyp-build "^4.2.0" readable-stream "^3.6.0" +keccak@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.3.tgz#4bc35ad917be1ef54ff246f904c2bbbf9ac61276" + integrity sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + keyv@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.0.0.tgz#44923ba39e68b12a7cec7df6c3268c031f2ef373" @@ -12671,7 +12627,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3, ms@^2.1.1: +ms@2.1.3, ms@^2.0.0, ms@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -12843,6 +12799,13 @@ node-fetch@3.3.1: fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" +node-fetch@^2.6.12: + version "2.6.13" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.13.tgz#a20acbbec73c2e09f9007de5cda17104122e0010" + integrity sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA== + dependencies: + whatwg-url "^5.0.0" + node-fetch@^2.6.7: version "2.6.11" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.11.tgz#cde7fc71deef3131ef80a738919f999e6edfff25" @@ -13904,9 +13867,9 @@ preact@10.4.1: integrity sha512-WKrRpCSwL2t3tpOOGhf2WfTpcmbpxaWtDbdJdKdjd0aEiTkvOmS4NBkG6kzlaAHI9AkQ3iVqbFWM3Ei7mZ4o1Q== preact@^10.5.9: - version "10.11.3" - resolved "https://registry.yarnpkg.com/preact/-/preact-10.11.3.tgz#8a7e4ba19d3992c488b0785afcc0f8aa13c78d19" - integrity sha512-eY93IVpod/zG3uMF22Unl8h9KkrcKIRs2EGar8hwLZZDU1lkjph303V9HZBwufh2s736U6VXuhD109LYqPoffg== + version "10.17.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.17.1.tgz#0a1b3c658c019e759326b9648c62912cf5c2dde1" + integrity sha512-X9BODrvQ4Ekwv9GURm9AKAGaomqXmip7NQTZgY7gcNmr7XE83adOMJvd3N42id1tMFU7ojiynRsYnY6/BRFxLA== prelude-ls@^1.2.1: version "1.2.1" @@ -14215,13 +14178,20 @@ qrcode@1.5.3: pngjs "^5.0.0" yargs "^15.3.1" -qs@6.11.0, qs@^6.10.3: +qs@6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== dependencies: side-channel "^1.0.4" +qs@^6.10.3: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" + qs@~6.10.3: version "6.10.5" resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.5.tgz#974715920a80ff6a262264acd2c7e6c2a53282b4" @@ -14535,13 +14505,6 @@ react-modal@^3.12.1: react-lifecycles-compat "^3.0.0" warning "^4.0.3" -react-native-url-polyfill@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/react-native-url-polyfill/-/react-native-url-polyfill-1.3.0.tgz#c1763de0f2a8c22cc3e959b654c8790622b6ef6a" - integrity sha512-w9JfSkvpqqlix9UjDvJjm1EjSt652zVQ6iwCIj1cVVkwXf4jQhQgTNXY6EVTwuAmUjg6BC6k9RHCBynoLFo3IQ== - dependencies: - whatwg-url-without-unicode "8.0.0-3" - react-popper@^2.2.3: version "2.3.0" resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-2.3.0.tgz#17891c620e1320dce318bad9fede46a5f71c70ba" @@ -14949,6 +14912,11 @@ regenerator-runtime@^0.13.11, regenerator-runtime@^0.13.3: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== + regexp.prototype.flags@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" @@ -15112,7 +15080,7 @@ resolve@^1.1.6, resolve@^1.10.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -resolve@^1.12.0, resolve@^1.14.2, resolve@^1.19.0: +resolve@^1.12.0, resolve@^1.19.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== @@ -15202,7 +15170,7 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rlp@^2.0.0, rlp@^2.2.3, rlp@^2.2.4: +rlp@^2.2.4: version "2.2.7" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== @@ -15234,6 +15202,19 @@ rpc-websockets@^7.5.0: bufferutil "^4.0.1" utf-8-validate "^5.0.2" +rpc-websockets@^7.5.1: + version "7.6.0" + resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.6.0.tgz#d3f4c0dac108ca35566b0e31552c32e58928cd04" + integrity sha512-Jgcs8q6t8Go98dEulww1x7RysgTkzpCMelVxZW4hvuyFtOGpeUz9prpr2KjUa/usqxgFCd9Tu3+yhHEP9GVmiQ== + dependencies: + "@babel/runtime" "^7.17.2" + eventemitter3 "^4.0.7" + uuid "^8.3.2" + ws "^8.5.0" + optionalDependencies: + bufferutil "^4.0.1" + utf-8-validate "^5.0.2" + rtcpeerconnection-shim@^1.2.15: version "1.2.15" resolved "https://registry.yarnpkg.com/rtcpeerconnection-shim/-/rtcpeerconnection-shim-1.2.15.tgz#e7cc189a81b435324c4949aa3dfb51888684b243" @@ -15306,13 +15287,6 @@ safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-event-emitter@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/safe-event-emitter/-/safe-event-emitter-1.0.1.tgz#5b692ef22329ed8f69fdce607e50ca734f6f20af" - integrity sha512-e1wFe99A91XYYxoQbcq2ZJUWurxEyP8vfz7A7vuUe1s95q8r5ebraVaA1BukYJcpM6V16ugWoD9vngi8Ccu5fg== - dependencies: - events "^3.0.0" - safe-json-utils@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/safe-json-utils/-/safe-json-utils-1.1.1.tgz#0e883874467d95ab914c3f511096b89bfb3e63b1" @@ -15404,7 +15378,7 @@ secp256k1@^3.8.0: nan "^2.14.0" safe-buffer "^5.1.2" -secp256k1@^4.0.1, secp256k1@^4.0.2: +secp256k1@^4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== @@ -15458,7 +15432,7 @@ semver@7.5.0, semver@^7.3.4: dependencies: lru-cache "^6.0.0" -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: +semver@^6.0.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -15477,6 +15451,13 @@ semver@^7.3.7: dependencies: lru-cache "^6.0.0" +semver@^7.3.8: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -16145,13 +16126,6 @@ strip-final-newline@^3.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== -strip-hex-prefix@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" - integrity sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A== - dependencies: - is-hex-prefixed "1.0.0" - strip-indent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" @@ -16226,6 +16200,11 @@ superstruct@^0.15.4: resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.15.5.tgz#0f0a8d3ce31313f0d84c6096cd4fa1bfdedc9dab" integrity sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ== +superstruct@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" + integrity sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg== + supports-color@^5.3.0, supports-color@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -16612,11 +16591,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.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" @@ -16700,16 +16674,11 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@4.8.4: +typescript@4.8.4, typescript@^4.6.2: version "4.8.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== -typescript@^4.6.2: - version "4.9.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78" - integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg== - ua-parser-js@^0.7.24: version "0.7.35" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.35.tgz#8bda4827be4f0b1dda91699a29499575a1f1d307" @@ -17230,11 +17199,6 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -webidl-conversions@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" - integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== - webpack-dev-middleware@^5.3.1: version "5.3.3" resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz#efae67c2793908e7311f1d9b06f2a08dcc97e51f" @@ -17312,15 +17276,6 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== -whatwg-url-without-unicode@8.0.0-3: - version "8.0.0-3" - resolved "https://registry.yarnpkg.com/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-3.tgz#ab6df4bf6caaa6c85a59f6e82c026151d4bb376b" - integrity sha512-HoKuzZrUlgpz35YO27XgD28uh/WJH4B0+3ttFqRo//lmq+9T/mIOJ6kqmINI9HpUpz1imRC/nR/lxKpJiv0uig== - dependencies: - buffer "^5.4.3" - punycode "^2.1.1" - webidl-conversions "^5.0.0" - whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" From fecd98ed35cdf034c35c3143995e93f44b65e62f Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 29 Aug 2023 19:01:02 +0700 Subject: [PATCH 2/4] fix Krystal (#2198) --- src/constants/connectors/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants/connectors/utils.ts b/src/constants/connectors/utils.ts index 0dc819fea1..ddd73223c3 100644 --- a/src/constants/connectors/utils.ts +++ b/src/constants/connectors/utils.ts @@ -30,8 +30,7 @@ export const getIsMetaMaskWallet = () => export const getIsRabbyWallet = () => Boolean(window.ethereum?.isRabby) -export const getIsKrystalWallet = () => - Boolean((window.ethereum?.isKrystalWallet || window.ethereum?.isKrystal) && !getIsTrustWallet()) +export const getIsKrystalWallet = () => Boolean(window.ethereum?.isKrystalWallet || window.ethereum?.isKrystal) export const getIsCoinbaseWallet = () => Boolean( @@ -45,7 +44,8 @@ export const getIsBloctoWallet = () => Boolean(window.ethereum?.isBlocto) export const getIsC98Wallet = () => Boolean(window.ethereum?.isCoin98 && window.coin98) -export const getIsTrustWallet = () => Boolean(window.ethereum?.isTrustWallet || window.ethereum?.isTrust) +export const getIsTrustWallet = () => + Boolean((window.ethereum?.isTrustWallet || window.ethereum?.isTrust) && !getIsKrystalWallet()) export const getIsGenericInjector = () => getIsInjected() && From cb6bbaeec113012196a7ac0eadf54da75ac17837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Ho=C3=A0i=20Danh?= <33005392+nguyenhoaidanh@users.noreply.github.com> Date: Tue, 29 Aug 2023 19:46:41 +0700 Subject: [PATCH 3/4] fix: truesight footer position (#2197) - fix: truesight footer position - update limit order size - move tab button to components folder to reuse in other PRs --- src/components/TabButton.tsx | 58 ++++++++++++++++++ .../LimitOrder/ListOrder/TableHeader.tsx | 2 +- src/pages/App.tsx | 1 - .../components/TruesightFooter.tsx | 2 +- src/pages/TrueSightV2/components/index.tsx | 59 +------------------ 5 files changed, 62 insertions(+), 60 deletions(-) create mode 100644 src/components/TabButton.tsx diff --git a/src/components/TabButton.tsx b/src/components/TabButton.tsx new file mode 100644 index 0000000000..4dd003618f --- /dev/null +++ b/src/components/TabButton.tsx @@ -0,0 +1,58 @@ +import { forwardRef } from 'react' +import styled, { CSSProperties, css } from 'styled-components' + +const ButtonWrapper = styled.div<{ active?: boolean; separator?: boolean }>` + font-size: 12px; + line-height: 16px; + transition: all 0.2s ease; + display: flex; + align-items: center; + justify-content: center; + height: 40px; + flex: 1; + box-sizing: border-box; + cursor: pointer; + user-select: none; + ${({ theme, separator, active }) => + separator && + !active && + css` + position: relative; + &::before { + content: ''; + position: absolute; + left: 0; + height: 16px; + border: 1px solid ${theme.border}; + } + `} + ${({ theme, active }) => + active + ? css` + color: ${theme.primary}; + background-color: ${theme.primary + '40'}; + box-shadow: inset 0 -2px 0 0 ${theme.primary}; + ` + : css` + color: ${theme.subText}; + background-color: ${theme.background}; + `} + + :hover { + filter: brightness(1.2); + } +` + +type Props = { text?: string; active?: boolean; onClick?: () => void; style?: CSSProperties; separator?: boolean } +const TabButton = forwardRef(function TabButton( + { text, active, onClick, style, separator }, + ref, +) { + return ( + + {text} + + ) +}) + +export default TabButton diff --git a/src/components/swapv2/LimitOrder/ListOrder/TableHeader.tsx b/src/components/swapv2/LimitOrder/ListOrder/TableHeader.tsx index 1224fdf6c3..790d9ecd3b 100644 --- a/src/components/swapv2/LimitOrder/ListOrder/TableHeader.tsx +++ b/src/components/swapv2/LimitOrder/ListOrder/TableHeader.tsx @@ -19,7 +19,7 @@ const Header = styled(ItemWrapper)` border-radius: 0px; padding-left: 30px; margin-left: -30px; - width: 110vw; + width: calc(100vw + 14px); `}; ` diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 5996d55fb6..49d1f5d94c 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -82,7 +82,6 @@ const AppWrapper = styled.div` display: flex; flex-flow: column; align-items: flex-start; - overflow-x: hidden; ` const HeaderWrapper = styled.div` diff --git a/src/pages/TrueSightV2/components/TruesightFooter.tsx b/src/pages/TrueSightV2/components/TruesightFooter.tsx index 363ece40f3..8557d9b152 100644 --- a/src/pages/TrueSightV2/components/TruesightFooter.tsx +++ b/src/pages/TrueSightV2/components/TruesightFooter.tsx @@ -22,7 +22,7 @@ const slideInFromBottom = keyframes` const Wrapper = styled(Row)` background-color: ${({ theme }) => theme.background}; height: 44px; - position: fixed; + position: sticky; bottom: 0; left: 0; right: 0; diff --git a/src/pages/TrueSightV2/components/index.tsx b/src/pages/TrueSightV2/components/index.tsx index fbfe9068b5..9433823bba 100644 --- a/src/pages/TrueSightV2/components/index.tsx +++ b/src/pages/TrueSightV2/components/index.tsx @@ -1,5 +1,5 @@ import { Trans } from '@lingui/macro' -import React, { CSSProperties, ReactNode, useLayoutEffect, useRef, useState } from 'react' +import React, { ReactNode, useLayoutEffect, useRef, useState } from 'react' import { isMobile } from 'react-device-detect' import { useParams } from 'react-router' import { useMedia } from 'react-use' @@ -10,6 +10,7 @@ import Column from 'components/Column' import Icon from 'components/Icons/Icon' import Modal from 'components/Modal' import Row, { RowBetween, RowFit } from 'components/Row' +import TabButton from 'components/TabButton' import { MouseoverTooltip } from 'components/Tooltip' import { MIXPANEL_TYPE, useMixpanelKyberAI } from 'hooks/useMixpanel' import useTheme from 'hooks/useTheme' @@ -419,59 +420,3 @@ export const SectionWrapper = ({ ) } - -const StyledMobileTabButton = styled.div<{ active?: boolean }>` - font-size: 12px; - line-height: 16px; - transition: all 0.2s ease; - display: flex; - align-items: center; - justify-content: center; - height: 40px; - flex: 1; - box-sizing: border-box; - cursor: pointer; - ${({ theme, active }) => - active - ? css` - color: ${theme.primary}; - background-color: ${theme.primary + '40'}; - box-shadow: inset 0 -2px 0 0 ${theme.primary}; - ` - : css` - color: ${theme.subText}; - background-color: ${theme.background}; - `} - - :hover { - filter: brightness(1.2); - } -` - -export const TabButton = ({ - text, - active, - onClick, - style, -}: { - text?: string - active?: boolean - onClick?: () => void - style?: CSSProperties -}) => { - const above768 = useMedia(`(min-width: ${MEDIA_WIDTHS.upToSmall}px)`) - - return ( - <> - {above768 ? ( - - {text} - - ) : ( - - {text} - - )} - - ) -} From b24aad274a844a0dfa00a83ba68ffbffe0c16175 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Wed, 30 Aug 2023 09:53:22 +0700 Subject: [PATCH 4/4] fix crash (#2201) --- src/utils/errorMessage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/errorMessage.ts b/src/utils/errorMessage.ts index d6a5876a59..91eb790c42 100644 --- a/src/utils/errorMessage.ts +++ b/src/utils/errorMessage.ts @@ -2,7 +2,8 @@ import { t } from '@lingui/macro' import { didUserReject } from 'constants/connectors/utils' -function capitalizeFirstLetter(string: string) { +function capitalizeFirstLetter(str?: string) { + const string = str || '' return string.charAt(0).toUpperCase() + string.slice(1) }