Commit b2eebb1b authored by lianahus's avatar lianahus Committed by Aniket

adding block.basefee only if there us baseFeePerGas available

parent 4631d6e5
......@@ -5,7 +5,6 @@ import { BN } from 'ethereumjs-util'
export const GlobalVariables = ({ block, receipt, tx }) => {
// see https://docs.soliditylang.org/en/latest/units-and-global-variables.html#block-and-transaction-properties
const globals = {
'block.basefee': (new BN(block.baseFeePerGas.replace('0x', ''), 'hex')).toString(10) + ` Wei (${block.baseFeePerGas})`,
'block.chainid': tx.chainId,
'block.coinbase': block.miner,
'block.difficulty': block.difficulty,
......@@ -17,6 +16,9 @@ export const GlobalVariables = ({ block, receipt, tx }) => {
'msg.value': tx.value + ' Wei',
'tx.origin': tx.from
}
if (block.baseFeePerGas)
globals['block.basefee'] = (new BN(block.baseFeePerGas.replace('0x', ''), 'hex')).toString(10) + ` Wei (${block.baseFeePerGas})`
return (
<div id='globalvariable' data-id='globalvariable'>
<DropdownPanel hexHighlight={false} bodyStyle={{ fontFamily: 'monospace' }} dropdownName='Global Variables' calldata={globals || {}} />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment