Skip to content

Commit

Permalink
Merge pull request #259 from EveripediaNetwork/revert-257-feat/add-cl…
Browse files Browse the repository at this point in the history
…aim-check

Revert "Add claim check"
  • Loading branch information
kesar authored May 4, 2024
2 parents 1b8353c + 61918a8 commit 1c74fbc
Show file tree
Hide file tree
Showing 28 changed files with 353 additions and 2,515 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@metamask/detect-provider": "^1.2.0",
"@reduxjs/toolkit": "^1.8.3",
"@rtk-query/graphql-request-base-query": "^2.1.0",
"@tanstack/react-query": "^5.32.0",
"@types/gtag.js": "^0.0.12",
"@types/uuid": "^8.3.4",
"@zag-js/react": "^0.1.9",
Expand Down Expand Up @@ -75,8 +74,8 @@
"ual-reactjs-renderer": "^0.3.1",
"universal-authenticator-library": "^0.3.0",
"uuid": "^8.3.2",
"viem": "2.x",
"wagmi": "^2.7.0"
"viem": "^1.2.5",
"wagmi": "^1.3.3"
},
"devDependencies": {
"@babel/core": "^7.21.3",
Expand Down
31 changes: 17 additions & 14 deletions src/components/client/AppProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { ChakraProvider, createStandaloneToast } from '@chakra-ui/react'
import { Provider as ReduxProviderClass } from 'react-redux'
import { Dict } from '@chakra-ui/utils'
import Fonts from '@/theme/Fonts'
import { wagmiConfig } from '@/config/wagmi'
import { WagmiProvider } from 'wagmi'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { createConfig, WagmiConfig } from 'wagmi'
import { connectors, publicClient, webSocketPublicClient } from '@/config/wagmi'
import { store } from '@/store/store'
import { UALProviderSwitch, WalletProvider } from '@/context/eosWalletContext'
import { DashboardLayout } from '@/components/dashboard/layout'
Expand All @@ -16,24 +15,28 @@ import chakraTheme from '@/theme'

const { ToastContainer } = createStandaloneToast()
const ReduxProvider = ReduxProviderClass as (props: Dict) => JSX.Element
const queryClient = new QueryClient()

const client = createConfig({
autoConnect: true,
connectors,
publicClient,
webSocketPublicClient,
})

const AppProviders = ({ children }: { children: React.ReactNode }) => {
return (
<>
<ReduxProvider store={store}>
<ChakraProvider resetCSS theme={chakraTheme}>
<Fonts />
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={queryClient}>
<GoogleAnalyticsScripts />
<UALProviderSwitch>
<WalletProvider>
<DashboardLayout>{children}</DashboardLayout>
</WalletProvider>
</UALProviderSwitch>
</QueryClientProvider>
</WagmiProvider>
<WagmiConfig config={client}>
<GoogleAnalyticsScripts />
<UALProviderSwitch>
<WalletProvider>
<DashboardLayout>{children}</DashboardLayout>
</WalletProvider>
</UALProviderSwitch>
</WagmiConfig>
</ChakraProvider>
</ReduxProvider>
<ToastContainer />
Expand Down
8 changes: 4 additions & 4 deletions src/components/client/BridgePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
useRef,
useState,
} from 'react'
import { useAccount, useSwitchChain } from 'wagmi'
import { useAccount, useNetwork, useSwitchNetwork } from 'wagmi'
import { UALContext } from 'ual-reactjs-renderer'
import { convertTokensTx, getUserTokenBalance } from '@/utils/eos.util'
import { useBridge } from '@/hooks/useBridge'
Expand Down Expand Up @@ -52,8 +52,8 @@ const BridgePage = () => {
const [isTransferring, setIsTransferring] = useState(false)
const { showToast } = useReusableToast()
const { address, isConnected, isDisconnected } = useAccount()
const { chains, switchChain, isSuccess } = useSwitchChain()
const { chain } = useAccount()
const { switchNetwork, isSuccess } = useSwitchNetwork()
const { chain } = useNetwork()
const chainId = parseInt(config.chainId)
const { data } = useGetIqPriceQuery('IQ')
const exchangeRate = data?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0
Expand Down Expand Up @@ -215,7 +215,7 @@ const BridgePage = () => {
}

const handleNetworkSwitch = () => {
if (switchChain) switchChain({ chainId: chains[0].id as 73571 | 1 })
if (switchNetwork) switchNetwork(chainId)
}

const handleSetInputAddressOrAccount = (value: string) => {
Expand Down
18 changes: 8 additions & 10 deletions src/components/client/StakePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { useLockOverview } from '@/hooks/useLockOverview'
import * as Humanize from 'humanize-plus'
import { useLock } from '@/hooks/useLock'
import { useReward } from '@/hooks/useReward'
import { useWaitForTransactionReceipt, useAccount, useSwitchChain } from 'wagmi'
import { useWaitForTransaction, useNetwork, useSwitchNetwork } from 'wagmi'
import NetworkErrorNotification from '@/components/lock/NetworkErrorNotification'
import config from '@/config'
import StakeIQ from '@/components/lock/StakeIQ'
Expand All @@ -48,13 +48,11 @@ const StakePage = () => {
const { checkPoint } = useReward()
const [isProcessingUnlock, setIsProcessingUnlock] = useState(false)
const [trxHash, setTrxHash] = useState<`0x${string}`>()
const { data, isSuccess: txnSuccess } = useWaitForTransactionReceipt({
hash: trxHash,
})
const { data } = useWaitForTransaction({ hash: trxHash })
const [openErrorNetwork, setOpenErrorNetwork] = useState(false)
const { chain } = useAccount()
const { chain } = useNetwork()
const chainId = parseInt(config.chainId)
const { chains, switchChain, isSuccess } = useSwitchChain()
const { switchNetwork, isSuccess } = useSwitchNetwork()
const { data: iqData } = useGetIqPriceQuery('IQ')
const exchangeRate = iqData?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0
const resetValues = () => {
Expand All @@ -66,7 +64,7 @@ const StakePage = () => {

useEffect(() => {
if (trxHash && data) {
if (txnSuccess) {
if (data.status) {
showToast('Transaction successfully performed', 'success')
checkPoint()
resetValues()
Expand All @@ -91,7 +89,7 @@ const StakePage = () => {
showToast('Transaction failed', 'error')
setIsProcessingUnlock(false)
}
setTrxHash(result)
setTrxHash(result.hash)
return
} catch (err) {
const errorObject = err as Dict
Expand Down Expand Up @@ -125,8 +123,8 @@ const StakePage = () => {
}, [chain, handleChainChanged, isSuccess, chainId])

const handleNetworkSwitch = () => {
if (switchChain) {
switchChain({ chainId: chains[0].id as 73571 | 1 })
if (switchNetwork) {
switchNetwork(chainId)
}
}

Expand Down
76 changes: 0 additions & 76 deletions src/components/lock/ClaimWarningModal.tsx

This file was deleted.

8 changes: 4 additions & 4 deletions src/components/lock/IncreaseLockTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IconButton } from '@chakra-ui/react'
import { RiArrowDownLine } from 'react-icons/ri'
import { useLockOverview } from '@/hooks/useLockOverview'
import { useReward } from '@/hooks/useReward'
import { useAccount, useWaitForTransactionReceipt } from 'wagmi'
import { useAccount, useWaitForTransaction } from 'wagmi'
import { calculateReturn } from '@/utils/LockOverviewUtils'
import { Dict } from '@chakra-ui/utils'
import { logEvent } from '@/utils/googleAnalytics'
Expand All @@ -24,7 +24,7 @@ const IncreaseLockTime = () => {
const [receivedAmount, setReceivedAmount] = useState(0)
const [lockValue, setLockValue] = useState(0)
const { checkPoint } = useReward()
const { data, isSuccess } = useWaitForTransactionReceipt({ hash: trxHash })
const { data } = useWaitForTransaction({ hash: trxHash })
const { address } = useAccount()

const resetValues = () => {
Expand All @@ -36,7 +36,7 @@ const IncreaseLockTime = () => {

useEffect(() => {
if (trxHash && data) {
if (isSuccess) {
if (data.status) {
showToast('IQ successfully locked', 'success')
checkPoint()
resetValues()
Expand Down Expand Up @@ -104,7 +104,7 @@ const IncreaseLockTime = () => {
value: 1,
category: 'increase_stake_period_success',
})
setTrxHash(result)
setTrxHash(result.hash)
} catch (err) {
const errorObject = err as Dict
if (errorObject?.code === 'ACTION_REJECTED') {
Expand Down
4 changes: 2 additions & 2 deletions src/components/lock/LockFormCommon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Button, Flex, Icon, Text } from '@chakra-ui/react'
import { RiQuestionLine } from 'react-icons/ri'
import { useAccount } from 'wagmi'
import { useNetwork, useAccount } from 'wagmi'
import config from '@/config'
import { useReusableToast } from '@/hooks/useToast'
import { useLockEnd } from '@/hooks/useLockEnd'
Expand All @@ -25,7 +25,7 @@ const LockFormCommon = ({
isDisabled?: boolean
}) => {
const { showToast } = useReusableToast()
const { chain } = useAccount()
const { chain } = useNetwork()
const { isConnected } = useAccount()
const { lockEndDate } = useLockEnd()
const handleLockButton = () => {
Expand Down
5 changes: 2 additions & 3 deletions src/components/lock/LockOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import StakeCard from '../cards/StakeCard'
import StakeOverviewWrapper from '../elements/stakeCommon/StakeOverviewWrapper'
import { calculateEstimatedYieldPerWeek } from '@/data/LockConstants'
import { useGetIqPriceQuery } from '@/services/iqPrice'
import { numFormatter } from '@/utils/dashboard-utils'

const LockOverview = () => {
const { totalHiiqSupply, userTotalIQLocked } = useLockOverview()
Expand Down Expand Up @@ -55,12 +54,12 @@ const LockOverview = () => {
/>
<StakeCard
title="Total HiIQ"
value={numFormatter(totalHiiqSupply)}
value={`${Humanize.formatNumber(totalHiiqSupply, 2)}`}
{...bStyles}
/>
<StakeCard
title="Total Volume Locked"
value={`${numFormatter(+tvl)} IQ`}
value={`${Humanize.formatNumber(tvl, 2)} IQ`}
borderLeft={{ base: 'none', md: 'solid 1px' }}
borderColor={{ md: 'divider2' }}
hasPopUp
Expand Down
Loading

0 comments on commit 1c74fbc

Please sign in to comment.