Skip to content

Commit

Permalink
fix: remove GEN_X_NETWORK references
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzkirstein committed Feb 7, 2024
1 parent 18905aa commit d0dec56
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/@utils/onboarding.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GEN_X_NETWORK_ID } from '../../chains.config'
import { getSupportedChainIds } from '../../chains.config'

interface IErrorParams {
accountId: string
Expand All @@ -14,7 +14,7 @@ const getErrorMessage = ({
if (!accountId || !web3Provider) {
return 'Looks like your account is not connected to the portal, please go back to the "Connect" step.'
}
if (networkId !== GEN_X_NETWORK_ID) {
if (!getSupportedChainIds().includes(networkId)) {
return 'Looks like you are not connected to the GEN-X Testnet, please go back to the "Network" step.'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import StepBody from '../StepBody'
import StepHeader from '../StepHeader'
import content from '../../../../../content/onboarding/steps/importCustomTokens.json'
import { useAccount, useNetwork, useProvider } from 'wagmi'
import { GEN_X_NETWORK_ID } from 'chains.config'
import { addTokenToWallet } from '@utils/wallet'
import { getErrorMessage } from '@utils/onboarding'
import { tokenLogos } from '@components/Header/Wallet/AddTokenList'
import { useMarketMetadata } from '@context/MarketMetadata'
import { getSupportedChainIds } from '../../../../../chains.config'

export default function ImportCustomTokens(): ReactElement {
const { title, subtitle, body, image }: OnboardingStep = content
Expand All @@ -31,7 +31,7 @@ export default function ImportCustomTokens(): ReactElement {
) => {
setLoading(true)
try {
if (chain?.id !== GEN_X_NETWORK_ID) throw new Error()
if (!getSupportedChainIds().includes(chain?.id)) throw new Error()

await addTokenToWallet(
tokenAddress,
Expand Down
8 changes: 6 additions & 2 deletions src/components/@shared/Onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import Ready from './Steps/Ready'
import { useAccount, useNetwork, useProvider } from 'wagmi'
import { useUserPreferences } from '@context/UserPreferences'
import useBalance from '@hooks/useBalance'
import { GEN_X_NETWORK_ID } from 'chains.config'
import ImportWallet from './Steps/ImportWallet'
import AutomationWalletState from './Steps/AutomationWalletState'
import { getSupportedChainIds } from '../../../../chains.config'

export interface OnboardingStep {
title: string
Expand Down Expand Up @@ -55,7 +55,11 @@ export default function OnboardingSection(): ReactElement {
}, [onboardingStep, setOnboardingStep])

useEffect(() => {
if (accountId && web3Provider && chain?.id === GEN_X_NETWORK_ID) {
if (
accountId &&
web3Provider &&
getSupportedChainIds().includes(chain?.id)
) {
setOnboardingCompleted(true)
}
}, [accountId, balance, chain?.id, web3Provider])
Expand Down

0 comments on commit d0dec56

Please sign in to comment.