Skip to content

Commit

Permalink
Merge pull request #812 from divaprotocol/fix/807-markets-preview-mode
Browse files Browse the repository at this point in the history
fix markets preview mode
  • Loading branch information
Walodja1987 authored Jul 26, 2023
2 parents 06468e4 + 4cb66a7 commit 32b090d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/diva-app/src/component/ConnectionProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useDispatch } from 'react-redux'
import { setChainId, setUserAddress } from '../Redux/appSlice'
import WalletConnectProvider from '@walletconnect/web3-provider'
import Web3 from 'web3'
import { MARKETS_PREVIEW_CHAIN_ID } from '../constants'

type MetamaskProvider = ExternalProvider &
BaseProvider & {
Expand Down Expand Up @@ -209,7 +210,7 @@ export const ConnectionProvider = ({ children }) => {
useEffect(() => {
const timeout = setTimeout(() => {
if (state.chainId == null) {
setState((_state) => ({ ..._state, chainId: 5 }))
setState((_state) => ({ ..._state, chainId: MARKETS_PREVIEW_CHAIN_ID }))
}
}, 3000)
return () => clearTimeout(timeout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function ReviewAndSubmit({
)
// QUESTION Why not use hook that will also handle null values?
const diva = new ethers.Contract(
config[chainId!].divaAddress, //Goerli
config[chainId!].divaAddress,
DIVA_ABI,
provider.getSigner()
)
Expand Down
2 changes: 1 addition & 1 deletion packages/diva-app/src/component/Markets/Markets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export default function Markets() {
}, 300)

return () => clearTimeout(timeout)
}, [createdBy, dispatch, history, page])
}, [createdBy, dispatch, history, page, chainId])

useEffect(() => {
const timeout = setTimeout(() => {
Expand Down
2 changes: 2 additions & 0 deletions packages/diva-app/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ export const DEFAULT_THRESHOLD = 100

export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'

export const MARKETS_PREVIEW_CHAIN_ID = 137

export const ICONS_URL = {
diva: divaLogo,
divaSidebarLogo: divaSidebarLogo,
Expand Down

0 comments on commit 32b090d

Please sign in to comment.