import React from 'react' import ReactDOM from 'react-dom' import { formatEther } from '@ethersproject/units' import { Mainnet, DAppProvider, useEtherBalance, useEthers, Config, Goerli } from '@usedapp/core' import { getDefaultProvider } from 'ethers' import { AccountIcon } from './components/AccountIcon' const config: Config = { readOnlyChainId: Mainnet.chainId, readOnlyUrls: { [Mainnet.chainId]: getDefaultProvider('mainnet'), [Goerli.chainId]: getDefaultProvider('goerli'), }, } ReactDOM.render( , document.getElementById('root') ) const STAKING_CONTRACT = '0x00000000219ab540356cBB839Cbe05303d7705Fa' export function App() { const { account, activateBrowserWallet, deactivate, chainId } = useEthers() const userBalance = useEtherBalance(account) const stakingBalance = useEtherBalance(STAKING_CONTRACT) if (!config.readOnlyUrls[chainId]) { return

Please use either Mainnet or Goerli testnet.

} const ConnectButton = () => (

Connect to wallet to interact with the example.

) const MetamaskConnect = () => (
{account && (
 
{account}

)} {!account && } {account && }
) return (
{userBalance && (

Ether balance:

{formatEther(userBalance)} ETH

)} {stakingBalance && (
ETH2 staking balance:

{formatEther(stakingBalance)} ETH

)}
) }