diff --git a/src/Block.tsx b/src/Block.tsx index 87da28d..3064c99 100644 --- a/src/Block.tsx +++ b/src/Block.tsx @@ -67,8 +67,12 @@ const Block: React.FC = () => { const _block = provider.formatter.block(_rawBlock); const extBlock: ExtendedBlock = { - blockReward: provider.formatter.bigNumber(_rawIssuance.blockReward), - unclesReward: provider.formatter.bigNumber(_rawIssuance.uncleReward), + blockReward: provider.formatter.bigNumber( + _rawIssuance.blockReward ?? 0 + ), + unclesReward: provider.formatter.bigNumber( + _rawIssuance.uncleReward ?? 0 + ), feeReward: fees, size: provider.formatter.number(_rawBlock.size), sha3Uncles: _rawBlock.sha3Uncles, diff --git a/src/Title.tsx b/src/Title.tsx index c64fdbd..46e1e5c 100644 --- a/src/Title.tsx +++ b/src/Title.tsx @@ -1,9 +1,11 @@ -import React, { useState, useRef } from "react"; +import React, { useState, useRef, useContext } from "react"; import { Link, useHistory } from "react-router-dom"; import useKeyboardShortcut from "use-keyboard-shortcut"; import PriceBox from "./PriceBox"; +import { RuntimeContext } from "./useRuntime"; const Title: React.FC = () => { + const { provider } = useContext(RuntimeContext); const [search, setSearch] = useState(); const [canSubmit, setCanSubmit] = useState(false); const history = useHistory(); @@ -43,7 +45,7 @@ const Title: React.FC = () => {
- + {provider?.network.chainId === 1 && }
{ - const provider = new ethers.providers.JsonRpcProvider( - erigonURL, - "mainnet" - ); + const provider = new ethers.providers.JsonRpcProvider(erigonURL); // Check if it is at least a regular ETH node let blockNumber: number = 0;