dynamic gas price from EVM; fix executed transactions hook in the history list item

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-11-21 20:47:51 +03:00
parent fc043af3e5
commit a78b583be3
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
3 changed files with 32 additions and 8 deletions

View File

@ -1,7 +1,7 @@
{
"name": "ghost-dao-interface",
"private": true,
"version": "0.8.26",
"version": "0.8.27",
"type": "module",
"scripts": {
"dev": "vite",

View File

@ -1,6 +1,6 @@
import useSWR from "swr";
import { useMemo, useState, useCallback } from "react";
import { useGasPrice } from 'wagmi';
import { useMemo, useState, useCallback, useEffect } from "react";
import { getGasPrice } from "@wagmi/core";
import { keccak256, hexToBytes, getAddress, toHex } from 'viem';
import {
@ -62,10 +62,32 @@ const Exodus = ({ chainId, address, config }) => {
const isSemiSmallScreen = useMediaQuery("(max-width: 850px)");
const isVerySmallScreen = useMediaQuery("(max-width: 379px)");
const [gasPrice, setGasPrice] = useState(0n);
const [dkgHistory, setDkgHistory] = useState([]);
const [searchOpen, setSearchOpen] = useState(false);
const [verifiedItem, setVerifiedItem] = useState(null);
useEffect(() => {
let isMounted = true;
const fetchBlock = async () => {
try {
const evmGasPrice = await getGasPrice(config, { chainId });
if (isMounted) setGasPrice(evmGasPrice);
} catch (err) {
console.error('Error fetching EVM gas price:', err);
}
};
fetchBlock();
const intervalId = setInterval(fetchBlock, 5000);
return () => {
isMounted = false;
clearInterval(intervalId);
};
}, [chainId, config]);
const { casperApi, client } = useUnstableProvider();
const nativeMetadata = useMemo(() => {
@ -77,11 +99,9 @@ const Exodus = ({ chainId, address, config }) => {
}
}, [config]);
const { data: gasPrice } = useGasPrice(chainId);
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
const ftsoPrice = useFtsoPrice(chainId);
const reservePrice = useReservePrice(chainId);
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
const { currentGasPrice, maxGasPrice } = useCurrentGasPrice(chainId);
const { pairAddress } = useUniswapV2Pair(

View File

@ -42,13 +42,17 @@ const ExodusItem = ({
isTransactionExecuted,
isTransactionExecutedLoading,
refetchTransactionExecuted
} = useIsTransactionExecuted(item.exodusContext.network_id, item.exodusContext.session);
} = useIsTransactionExecuted(Number(item.exodusContext.network_id), Number(item.exodusContext.session));
const chipStatus = useMemo(() => {
const width = isVerySmallScreen ? "21px" : "100px";
if (isTransactionExecuted && !isTransactionExecutedLoading) {
return <Chip sx={{ width: width }} label={isVerySmallScreen ? "" : "Executed"} template={"gray"} />
return <Chip
sx={{ width: width }}
template={"gray"}
label={isVerySmallScreen ? "" : isTransactionExecutedLoading ? "Checking..." : "Executed"}
/>
}
return <Chip sx={{ width: width }} label={isVerySmallScreen ? "" : "Ready"} template={"success"} />