Skip to content

Commit

Permalink
Hotfix for Holesky network
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrotkk committed Feb 26, 2024
1 parent c9f6f77 commit ec0b311
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/MetaportProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ReactElement, useEffect } from 'react'

import { RainbowKitProvider, darkTheme, lightTheme } from '@rainbow-me/rainbowkit'
import { configureChains, createConfig, WagmiConfig } from 'wagmi'
import { mainnet, goerli } from 'wagmi/chains'
import { mainnet, goerli, holesky } from 'wagmi/chains'
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc'
import { connectorsForWallets } from '@rainbow-me/rainbowkit'
import { PaletteMode } from '@mui/material'
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function MetaportProvider(props: {
constructWagmiChain(props.config.skaleNetwork, chain)
)
const { chains, webSocketPublicClient } = configureChains(
[mainnet, goerli, ...skaleChains],
[mainnet, goerli, holesky, ...skaleChains],
[
jsonRpcProvider({
rpc: (chain) => ({
Expand Down
6 changes: 5 additions & 1 deletion src/core/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { JsonRpcProvider } from 'ethers'

import { WalletClient } from 'viem'
import { Chain } from '@wagmi/core'
import { holesky } from '@wagmi/core/chains'

import proxyEndpoints from '../metadata/proxy.json'
import { MAINNET_CHAIN_NAME, DEFAULT_ITERATIONS, DEFAULT_SLEEP } from './constants'
Expand Down Expand Up @@ -164,9 +165,12 @@ export async function enforceNetwork(
)
if (currentChainId !== Number(chainId)) {
log(`Switching network to ${chainId}...`)
if (chainId !== 1n && chainId !== 5n) {
if (chainId !== 1n && chainId !== 5n && chainId !== 17000n) {
await _walletClient.addChain({ chain: constructWagmiChain(skaleNetwork, chainName) })
}
if (chainId === 17000n) {
await _walletClient.addChain({ chain: holesky })
}
try {
// tmp fix for coinbase wallet
_networkSwitch(chainId, currentChainId, switchNetwork)
Expand Down

0 comments on commit ec0b311

Please sign in to comment.