Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show current gas price on NS summary card #56

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions web/src/pages/NodeSetPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import WalletChip from "../components/WalletChip";
import NodeSetIcon from "../components/NodeSetIcon";
import CurrencyValue from "../components/CurrencyValue";
import { ethers } from "ethers";
import { etherscanUrl, shortenAddress } from "../utils";
import { etherscanUrl, shortenAddress, trimValue } from "../utils";
import { ExpandLess, ExpandMore } from "@mui/icons-material";
import { useTransaction, useBalance } from "wagmi";
import moment from "moment";
import { useState } from "react";
import contracts from "../contracts";
import useBlock from "../hooks/useBlock";
import useGasPrice from "../hooks/useGasPrice";
import { Link } from "react-router-dom";
import useRplEthPrice from "../hooks/useRplEthPrice";
import useNodeDetails from "../hooks/useNodeDetails";
Expand Down Expand Up @@ -504,6 +505,7 @@ function NodeSetWalletChip({ walletAddress }) {
const oneEth = ethers.utils.parseEther("1");
function NodeSetMiniPoolsColumn() {
let [isShowingAll, setShowingAll] = useState(false);
let gasPrice = useGasPrice();
let rplEthPrice = useRplEthPrice(ethers.utils.parseEther(".004")); // default until loaded
const { data: superNodeDetails } = useNodeDetails({
nodeAddress: contracts.SuperNodeAccount.address,
Expand Down Expand Up @@ -760,6 +762,7 @@ function NodeSetMiniPoolsColumn() {
<Stack
sx={{
mt: 0.5,
pr: 1,
borderRadius: "20px",
...(moreMinipoolCount < 1 || isLoading
? {}
Expand All @@ -776,9 +779,27 @@ function NodeSetMiniPoolsColumn() {
size="small"
label={isLoading ? "…" : Math.max(0, moreMinipoolCount)}
/>
<Typography variant={"caption"} color={"text.secondary"}>
<Typography
sx={{ flex: 1 }}
variant={"caption"}
color={"text.secondary"}
>
more from available deposits
</Typography>
<Typography variant="caption" color="text.disabled">
gas @
<Typography
sx={{ pl: 1, pr: 0.5 }}
variant="inherit"
component="span"
color="text.primary"
>
{trimValue(ethers.utils.formatUnits(gasPrice, "gwei"), {
maxDecimals: 0,
})}
</Typography>
gwei
</Typography>
</Stack>
<Grid container sx={{ pt: 1 }}>
<Grid item xs={6}>
Expand Down
Loading