Skip to content

Commit

Permalink
fix switch network error and improve use of constants
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner committed Feb 23, 2024
1 parent 0986a80 commit 6c590d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions web-app/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useAccountModal, useConnectModal } from '@rainbow-me/rainbowkit'
import Link from 'next/link'
import React, { useEffect, useState } from 'react'
import { useAccount, useEnsName, useNetwork, useSwitchNetwork } from 'wagmi'
import { nova } from '../constants/networks'

interface LayoutProps {
children: React.ReactNode
Expand All @@ -22,7 +23,7 @@ export const ConnectWallet: React.FC = () => {
}, [])

useEffect(() => {
if (isConnected && chain && chain.id !== 1002 && switchNetwork) switchNetwork(1002)
if (isConnected && chain && chain.id !== nova.id && switchNetwork) switchNetwork(nova.id)
}, [isConnected, chain, switchNetwork])

if (!clientSide) return null
Expand Down Expand Up @@ -56,7 +57,7 @@ export const Header: React.FC = () => {
<Heading size={['md', 'lg', 'xl']} whiteSpace='nowrap'>
Faucet
</Heading>
<Text fontWeight={[400, 500, 600]}>Gemini 3h Nova - Subspace Testnet</Text>
<Text fontWeight={[400, 500, 600]}>{nova.name}</Text>
<Spacer />
<ConnectWallet />
<Spacer />
Expand Down
2 changes: 1 addition & 1 deletion web-app/src/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Chain, hardhat, mainnet } from 'wagmi/chains'

export const nova: Chain = {
id: 490000,
name: 'Nova - Testnet Subspace',
name: 'Gemini 3h Nova - Subspace Testnet',
network: 'nova',
nativeCurrency: {
decimals: 18,
Expand Down

0 comments on commit 6c590d7

Please sign in to comment.