Small fixes for rounding errors on london dashboard
This commit is contained in:
parent
977783b0bc
commit
6e52bf5627
|
@ -1,5 +1,5 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { ethers } from "ethers";
|
import { ethers, FixedNumber } from "ethers";
|
||||||
import BlockLink from "../../components/BlockLink";
|
import BlockLink from "../../components/BlockLink";
|
||||||
import TimestampAge from "../../components/TimestampAge";
|
import TimestampAge from "../../components/TimestampAge";
|
||||||
import { ExtendedBlock } from "../../useErigonHooks";
|
import { ExtendedBlock } from "../../useErigonHooks";
|
||||||
|
@ -41,7 +41,13 @@ const BlockRow: React.FC<BlockRowProps> = ({ now, block, baseFeeDelta }) => {
|
||||||
</div>
|
</div>
|
||||||
<div className="text-right">
|
<div className="text-right">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<span>{block.baseFeePerGas?.div(1e9).toString()} Gwei</span>
|
<span>
|
||||||
|
{FixedNumber.from(block.baseFeePerGas)
|
||||||
|
.divUnsafe(FixedNumber.from(1e9))
|
||||||
|
.round(0)
|
||||||
|
.toUnsafeFloat()}{" "}
|
||||||
|
Gwei
|
||||||
|
</span>
|
||||||
<Blip value={baseFeeDelta} />
|
<Blip value={baseFeeDelta} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import React, {
|
||||||
useMemo,
|
useMemo,
|
||||||
useCallback,
|
useCallback,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { ethers } from "ethers";
|
import { ethers, FixedNumber } from "ethers";
|
||||||
import { Line } from "react-chartjs-2";
|
import { Line } from "react-chartjs-2";
|
||||||
import { Transition } from "@headlessui/react";
|
import { Transition } from "@headlessui/react";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
@ -176,10 +176,15 @@ const Blocks: React.FC<BlocksProps> = ({ latestBlock, targetBlockNumber }) => {
|
||||||
block={b}
|
block={b}
|
||||||
baseFeeDelta={
|
baseFeeDelta={
|
||||||
i < all.length - 1
|
i < all.length - 1
|
||||||
? b
|
? FixedNumber.from(b.baseFeePerGas!)
|
||||||
.baseFeePerGas!.sub(all[i + 1].baseFeePerGas!)
|
.divUnsafe(FixedNumber.from(1e9))
|
||||||
.div(1e9)
|
.round(0)
|
||||||
.toNumber()
|
.subUnsafe(
|
||||||
|
FixedNumber.from(all[i + 1].baseFeePerGas!)
|
||||||
|
.divUnsafe(FixedNumber.from(1e9))
|
||||||
|
.round(0)
|
||||||
|
)
|
||||||
|
.toUnsafeFloat()
|
||||||
: 0
|
: 0
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue