Skip to content

Commit

Permalink
Save Mon Dec 4 04:06:55 PM -03 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Arregui committed Dec 4, 2023
1 parent 63b9155 commit 78a3a2c
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import { ETHEREUM_NETWORK } from 'config'
import { requestManager } from './provider'

export async function getEthereumNetworkFromProvider(): Promise<ETHEREUM_NETWORK> {
const web3Network = await requestManager.net_version()
const chainId = parseInt(web3Network, 10)
const web3net = chainId === 1 ? ETHEREUM_NETWORK.MAINNET : ETHEREUM_NETWORK.SEPOLIA
return web3net
try {
const web3Network = await requestManager.net_version()
const chainId = parseInt(web3Network, 10)
const web3net = chainId === 1 ? ETHEREUM_NETWORK.MAINNET : ETHEREUM_NETWORK.SEPOLIA
return web3net
} catch (err) {
return ETHEREUM_NETWORK.MAINNET
}
}

0 comments on commit 78a3a2c

Please sign in to comment.