From 0387e39b20253c4b6aa5134846c8c0f40956b2d3 Mon Sep 17 00:00:00 2001 From: Vinay Singh <122733374+vnaysngh-mudrex@users.noreply.github.com> Date: Fri, 8 Mar 2024 19:11:40 +0530 Subject: [PATCH] cleanup (#276) * strk rewards new design implemented * hardcode bug resolved * button state handling and some iterations * added allocation dependencies to numbers * apr updated * reward pair name fixes * api url update for rewards * added loader * double currency logo handled * commented code revert * code revert --- src/components/WalletModal/index.tsx | 18 ++++++++--------- src/components/Web3Status/index.tsx | 30 ++++++++++++++-------------- src/context/StarknetProvider.tsx | 2 +- src/pages/App.tsx | 20 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/components/WalletModal/index.tsx b/src/components/WalletModal/index.tsx index 5f6852ed..e1a19bbb 100644 --- a/src/components/WalletModal/index.tsx +++ b/src/components/WalletModal/index.tsx @@ -150,15 +150,15 @@ export default function WalletModal({ const previousAccount = usePrevious(account) useEffect(() => { - // if (status === 'connected' && chainId) { - // if ( - // (isProductionEnvironment() && !isProductionChainId(chainId)) || - // (isTestnetEnvironment() && !isTestnetChainId(chainId)) || - // !Object.values(ChainId).includes(chainId) - // ) { - // setChainError(true) - // } - // } + if (status === 'connected' && chainId) { + if ( + (isProductionEnvironment() && !isProductionChainId(chainId)) || + (isTestnetEnvironment() && !isTestnetChainId(chainId)) || + !Object.values(ChainId).includes(chainId) + ) { + setChainError(true) + } + } }, [status]) useEffect(() => { diff --git a/src/components/Web3Status/index.tsx b/src/components/Web3Status/index.tsx index 253f2c2a..ff5c5e26 100644 --- a/src/components/Web3Status/index.tsx +++ b/src/components/Web3Status/index.tsx @@ -249,21 +249,21 @@ export default function Web3Status() { const [domain, setDomain] = useState('') - // useEffect(() => { - // const url = domainURL(chainId as ChainId) - // if (!address) { - // return - // } - // setDomain('') - // fetch(url + num.hexToDecimalString(address ?? '')) - // .then(response => response.json()) - // .then((data: DomainToAddrData) => { - // setDomain(data.domain) - // }) - // .catch(error => { - // console.error(error) - // }) - // }, [address, chainId]) + useEffect(() => { + const url = domainURL(chainId as ChainId) + if (!address) { + return + } + setDomain('') + fetch(url + num.hexToDecimalString(address ?? '')) + .then(response => response.json()) + .then((data: DomainToAddrData) => { + setDomain(data.domain) + }) + .catch(error => { + console.error(error) + }) + }, [address, chainId]) const allTransactions = useAllTransactions() diff --git a/src/context/StarknetProvider.tsx b/src/context/StarknetProvider.tsx index f2ded14a..0d9900ee 100644 --- a/src/context/StarknetProvider.tsx +++ b/src/context/StarknetProvider.tsx @@ -4,7 +4,7 @@ import React, { useMemo } from 'react' import { goerli, mainnet, sepolia } from '@starknet-react/chains' -import { StarknetConfig, publicProvider } from '@starknet-react/core' +import { StarknetConfig } from '@starknet-react/core' import { WebWalletConnector } from 'starknetkit/webwallet' import { InjectedConnector } from 'starknetkit/injected' import rpcProvider from '../utils/getLibrary' diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 5dc88a04..cbb177f5 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -83,16 +83,16 @@ export default function App() { }, [fetchAllPairs]) useEffect(() => { - //Ensure that environment and chainId are compatible with one another. - // if (status === 'connected' && chainId) { - // if ( - // (isProductionEnvironment() && !isProductionChainId(chainId)) || - // (isTestnetEnvironment() && !isTestnetChainId(chainId)) || - // !Object.values(ChainId).includes(chainId) - // ) { - // disconnect() - // } - // } + // Ensure that environment and chainId are compatible with one another. + if (status === 'connected' && chainId) { + if ( + (isProductionEnvironment() && !isProductionChainId(chainId)) || + (isTestnetEnvironment() && !isTestnetChainId(chainId)) || + !Object.values(ChainId).includes(chainId) + ) { + disconnect() + } + } }, [status]) return (