Compare commits
No commits in common. "4b84a6246764293cf1d0919c1d9c3d16943b0bf2" and "d3d1144985523a8adafc20e6947dabd560fd3564" have entirely different histories.
4b84a62467
...
d3d1144985
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.7.48",
|
||||
"version": "0.7.44",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -17,6 +17,7 @@ import {
|
||||
import { styled } from "@mui/material/styles";
|
||||
import { NavLink } from "react-router-dom";
|
||||
import { useSwitchChain } from "wagmi";
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
import GitHubIcon from '@mui/icons-material/GitHub';
|
||||
@ -86,6 +87,10 @@ const NavContent = ({ chainId, addressChainId }) => {
|
||||
return `(${number}, ${number})`;
|
||||
}, [chainId]);
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: "/sidebar" });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Paper className="dapp-sidebar">
|
||||
<Box className="dapp-sidebar-inner" display="flex" justifyContent="space-between" flexDirection="column">
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { useMemo } from "react";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@ -13,9 +12,8 @@ import {
|
||||
import { styled } from '@mui/material/styles';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
import LoopIcon from '@mui/icons-material/Loop';
|
||||
import ReactGA from "react-ga4";
|
||||
import { ReactElement, useState, useEffect } from "react";
|
||||
import { useNavigate, useLocation, createSearchParams } from "react-router-dom";
|
||||
import { useNavigate, createSearchParams } from "react-router-dom";
|
||||
|
||||
import GhostStyledIcon from "../../Icon/GhostIcon";
|
||||
import { Tokens, useWallet } from "./Token";
|
||||
@ -110,14 +108,9 @@ const WalletTotalValue = ({ address, tokens }) => {
|
||||
function InitialWalletView({ isWalletOpen, address, chainId, onClose }) {
|
||||
const theme = useTheme();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const tokens = useWallet(chainId, address);
|
||||
const { chains } = useSwitchChain();
|
||||
|
||||
const chainName = useMemo(() => {
|
||||
return chains.find(chain => chain.id === chainId).name.toLowerCase();
|
||||
}, [chains, chainId])
|
||||
|
||||
const onBtnClick = (dexName, from, to) => {
|
||||
navigate({
|
||||
pathname: `${chains.find(chain => chain.id === chainId).name.toLowerCase()}/dex/` + dexName,
|
||||
@ -130,20 +123,12 @@ function InitialWalletView({ isWalletOpen, address, chainId, onClose }) {
|
||||
onClose();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (isWalletOpen) {
|
||||
console.log(`/${chainName.toLowerCase()}/sidebar`)
|
||||
ReactGA.send({ hitType: "pageview", page: `/${chainName.toLowerCase()}/sidebar` });
|
||||
}
|
||||
}, [isWalletOpen, chainName])
|
||||
|
||||
useEffect(() => {
|
||||
if (isWalletOpen) {
|
||||
Object.values(tokens ?? {}).forEach(token => token.refetch());
|
||||
}
|
||||
}, [isWalletOpen, tokens])
|
||||
|
||||
|
||||
return (
|
||||
<Paper>
|
||||
<Box sx={{ padding: theme.spacing(0, 3), display: "flex", flexDirection: "column", minHeight: "100vh" }}>
|
||||
|
||||
@ -49,7 +49,7 @@ export const BondModal = ({ bond, chainId, address, config, connect }) => {
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: pathname });
|
||||
}, [pathname])
|
||||
}, [])
|
||||
|
||||
const setRecipientAddress = useCallback((value) => {
|
||||
setRecipientAddressInner(value);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Box, Tab, Tabs, Typography, Container, useMediaQuery } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams, useLocation } from "react-router-dom";
|
||||
import { useParams } from "react-router-dom";
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import Paper from "../../components/Paper/Paper";
|
||||
@ -20,9 +20,7 @@ import { useFtsoPrice } from "../../hooks/prices";
|
||||
import { useTokenSymbol } from "../../hooks/tokens";
|
||||
|
||||
const Bonds = ({ chainId, address, connect }) => {
|
||||
const location = useLocation();
|
||||
const { network } = useParams();
|
||||
|
||||
const [isZoomed] = useState(false);
|
||||
const [secondsTo, setSecondsTo] = useState(0);
|
||||
|
||||
@ -30,8 +28,8 @@ const Bonds = ({ chainId, address, connect }) => {
|
||||
const isVerySmallScreen = useMediaQuery("(max-width: 379px)");
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location]);
|
||||
ReactGA.send({ hitType: "pageview", page: "/bonds" });
|
||||
}, []);
|
||||
|
||||
const { liveBonds } = useLiveBonds(chainId, network);
|
||||
const totalReserves = useTotalReserves(chainId);
|
||||
|
||||
@ -248,7 +248,6 @@ const WelcomeView = ({
|
||||
defaultFunction,
|
||||
closeModal
|
||||
}) => {
|
||||
const [refreshNeeded, setRefreshNeeded] = useState(false);
|
||||
const [isPending, setIsPending] = useState(false);
|
||||
|
||||
const { epoch } = useEpoch(chainId);
|
||||
@ -257,10 +256,9 @@ const WelcomeView = ({
|
||||
|
||||
const { isExtensionMissing } = useUnstableProvider();
|
||||
|
||||
const refreshPage = () => window.location.reload();
|
||||
const getConnect = () => {
|
||||
setRefreshNeeded(true)
|
||||
window.open(GHOST_CONNECT, '_blank', 'noopener,noreferrer');
|
||||
closeModal();
|
||||
}
|
||||
|
||||
const callDefaultFunction = useCallback(async () => {
|
||||
@ -273,7 +271,7 @@ const WelcomeView = ({
|
||||
return (
|
||||
<>
|
||||
<Typography>{warmupPeriod <= 0
|
||||
? `You have succesfully warmed-up your ${isStakingOpened ? " " : "bonded "}${ftsoSymbol} ${isStakingOpened ? "(3, 3)" : "(1, 1)"} Staked at:`
|
||||
? `You've succesfully warmed-up your ${isStakingOpened ? " " : "bonded "}${ftsoSymbol} ${isStakingOpened ? "(3, 3)" : "(1, 1)"} Staked at:`
|
||||
: `${isStakingOpened ? "Stake" : "Bond"} is in warm-up${isStakingOpened ? "" : ", which extends with each purchase"}. Your ${ftsoSymbol} ${isStakingOpened ? "(3, 3)" : "(1, 1)"} is Staked at:`
|
||||
}</Typography>
|
||||
|
||||
@ -310,15 +308,10 @@ const WelcomeView = ({
|
||||
|
||||
<PrimaryButton
|
||||
disabled={isPending || gatekeeperAddress === EMPTY_ADDRESS}
|
||||
onClick={isExtensionMissing
|
||||
? (refreshNeeded ? refreshPage : getConnect)
|
||||
: goNext
|
||||
}
|
||||
onClick={isExtensionMissing ? getConnect : goNext}
|
||||
fullWidth
|
||||
>
|
||||
{isExtensionMissing
|
||||
? (refreshNeeded ? "Refresh Page" : "Get GHOST Connect")
|
||||
: `Start ${bridgeNumbers} ${"Stake\u00B2"}`}
|
||||
{isExtensionMissing ? "Get GHOST Connect" : `Start ${bridgeNumbers} ${"Stake\u00B2"}`}
|
||||
</PrimaryButton>
|
||||
</>
|
||||
)
|
||||
@ -378,7 +371,7 @@ const ConfirmStep = ({
|
||||
amount: estimatedAmount._value.toString(),
|
||||
sessionIndex: expectedSessionIndex,
|
||||
transactionHash: txHash,
|
||||
blockNumber: Number(blockNumber),
|
||||
blockNumber: blockNumber,
|
||||
chainId: chainId,
|
||||
bridgeStability: 69, // TODO: avoid stability
|
||||
timestamp: Date.now()
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { useEffect, useState, useMemo, useCallback } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import {
|
||||
@ -57,8 +56,6 @@ import { BridgeHeader } from "./BridgeHeader";
|
||||
import { BridgeCardAction, BridgeCardHistory } from "./BridgeCard";
|
||||
|
||||
const Bridge = ({ chainId, address, config, connect }) => {
|
||||
const location = useLocation();
|
||||
|
||||
const isBigScreen = useMediaQuery("(max-width: 980px)")
|
||||
const isSmallScreen = useMediaQuery("(max-width: 650px)");
|
||||
const isSemiSmallScreen = useMediaQuery("(max-width: 540px)");
|
||||
@ -161,8 +158,8 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location]);
|
||||
ReactGA.send({ hitType: "pageview", page: "/bridge" });
|
||||
}, []);
|
||||
|
||||
const chainExplorerUrl = useMemo(() => {
|
||||
const client = config?.getClient();
|
||||
|
||||
@ -2,7 +2,6 @@ import { useState, useEffect, useMemo } from "react";
|
||||
import { Box, Container, Typography, useMediaQuery } from "@mui/material";
|
||||
import { useConfig, useBalance } from "wagmi";
|
||||
import { Helmet } from "react-helmet";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import PageTitle from "../../components/PageTitle/PageTitle";
|
||||
@ -27,8 +26,6 @@ import {
|
||||
} from "../../hooks/tokens";
|
||||
|
||||
const Faucet = ({ chainId, address, config, connect }) => {
|
||||
const location = useLocation();
|
||||
|
||||
const isSmallScreen = useMediaQuery("(max-width: 650px)");
|
||||
const isSemiSmallScreen = useMediaQuery("(max-width: 480px)");
|
||||
const isVerySmallScreen = useMediaQuery("(max-width: 379px)");
|
||||
@ -57,8 +54,8 @@ const Faucet = ({ chainId, address, config, connect }) => {
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location])
|
||||
ReactGA.send({ hitType: "pageview", page: "/faucet" });
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const value = nativeBalance ? nativeBalance.value : 0n;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useEffect } from "react";
|
||||
import ReactGA from "react-ga4";
|
||||
import { useNavigate, useParams, useLocation } from "react-router-dom";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
|
||||
import { Box, Container, Grid, Divider, Typography, useMediaQuery } from "@mui/material";
|
||||
|
||||
@ -15,19 +15,17 @@ import { ProposalsCount, MinQuorumPercentage, ProposalThreshold } from "./compon
|
||||
import { useTokenSymbol } from "../../hooks/tokens";
|
||||
|
||||
const Governance = ({ connect, config, address, chainId }) => {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const { network } = useParams();
|
||||
|
||||
const isSemiSmallScreen = useMediaQuery("(max-width: 745px)");
|
||||
const isSmallScreen = useMediaQuery("(max-width: 650px)");
|
||||
const isVerySmallScreen = useMediaQuery("(max-width: 379px)");
|
||||
const navigate = useNavigate();
|
||||
const { network } = useParams();
|
||||
|
||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location]);
|
||||
ReactGA.send({ hitType: "pageview", page: "/governance" });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Box>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { useState, useMemo, useCallback, useEffect } from "react";
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import {
|
||||
@ -39,8 +38,6 @@ import { parseFunctionCalldata } from "./components/functions/index";
|
||||
import { MY_PROPOSALS_PREFIX } from "./helpers";
|
||||
|
||||
const NewProposal = ({ config, address, connect, chainId }) => {
|
||||
const location = useLocation();
|
||||
|
||||
const isSemiSmallScreen = useMediaQuery("(max-width: 745px)");
|
||||
const isSmallScreen = useMediaQuery("(max-width: 650px)");
|
||||
const isVerySmallScreen = useMediaQuery("(max-width: 379px)");
|
||||
@ -70,8 +67,8 @@ const NewProposal = ({ config, address, connect, chainId }) => {
|
||||
}, [chainId, address]);
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location]);
|
||||
ReactGA.send({ hitType: "pageview", page: "/governance/create" });
|
||||
}, []);
|
||||
|
||||
const addCalldata = (calldata) => setProposalFunctions(prev => [...prev, calldata]);
|
||||
const removeCalldata = (index) => setProposalFunctions(prev => prev.filter((_, i) => i !== index));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useEffect, useState, useMemo, useCallback } from "react";
|
||||
import ReactGA from "react-ga4";
|
||||
import { useParams, useLocation } from 'react-router-dom';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useBlock, useBlockNumber } from "wagmi";
|
||||
|
||||
@ -77,7 +77,6 @@ import RepeatIcon from '@mui/icons-material/Repeat';
|
||||
const HUNDRED = new DecimalBigNumber(100n, 0);
|
||||
|
||||
const ProposalDetails = ({ chainId, address, connect, config }) => {
|
||||
const location = useLocation();
|
||||
const { id } = useParams();
|
||||
const proposalId = BigInt(id);
|
||||
|
||||
@ -110,10 +109,8 @@ const ProposalDetails = ({ chainId, address, connect, config }) => {
|
||||
const { pastTotalSupply: totalSupply } = usePastTotalSupply(chainId, "GHST", proposalSnapshot);
|
||||
const { pastVotes } = usePastVotes(chainId, "GHST", proposalSnapshot, address);
|
||||
|
||||
console.log(location.pathname)
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: `${chainId}/governance/${id}` });
|
||||
ReactGA.send({ hitType: "pageview", page: `/governance/${id}` });
|
||||
}, []);
|
||||
|
||||
const quorumPercentage = useMemo(() => {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Dispatch, SetStateAction, useState, useEffect } from "react";
|
||||
import { Box, Container, Grid, Divider, Typography, useMediaQuery, useTheme } from "@mui/material";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import Paper from "../../components/Paper/Paper";
|
||||
@ -20,7 +19,6 @@ import { useEpoch } from "../../hooks/staking";
|
||||
import { useTokenSymbol } from "../../hooks/tokens";
|
||||
|
||||
export const StakeContainer = ({ chainId, address, connect }) => {
|
||||
const location = useLocation();
|
||||
const [isModalOpened, handleModal] = useState(false);
|
||||
|
||||
const isSemiSmallScreen = useMediaQuery("(max-width: 745px)");
|
||||
@ -33,8 +31,8 @@ export const StakeContainer = ({ chainId, address, connect }) => {
|
||||
const { epoch, refetch: refetchEpoch } = useEpoch(chainId);
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location])
|
||||
ReactGA.send({ hitType: "pageview", page: "/stake" });
|
||||
}, [])
|
||||
|
||||
if (isModalOpened) {
|
||||
return (
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Box, Container, Grid, useMediaQuery, useTheme } from "@mui/material";
|
||||
import { memo, useEffect, useMemo, useState } from "react";
|
||||
import { Outlet, Route, Routes, useSearchParams, useLocation } from "react-router-dom";
|
||||
import { Outlet, Route, Routes, useSearchParams } from "react-router-dom";
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import {
|
||||
@ -74,11 +74,9 @@ const TreasuryDashboard = ({ chainId }) => {
|
||||
const isSmallScreen = useMediaQuery("(max-width: 650px)");
|
||||
const isVerySmallScreen = useMediaQuery("(max-width: 379px)");
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location]);
|
||||
ReactGA.send({ hitType: "pageview", page: "/dashboard" });
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -2,7 +2,6 @@ import { useState, useEffect, useMemo } from "react";
|
||||
import { Box, Container, Typography, useMediaQuery } from "@mui/material";
|
||||
import { useConfig, useBalance } from "wagmi";
|
||||
import { Helmet } from "react-helmet";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import ReactGA from "react-ga4";
|
||||
|
||||
import PageTitle from "../../components/PageTitle/PageTitle";
|
||||
@ -31,8 +30,6 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
const isSemiSmallScreen = useMediaQuery("(max-width: 480px)");
|
||||
const isVerySmallScreen = useMediaQuery("(max-width: 379px)");
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
const [chainName, setChainName] = useState("");
|
||||
const [isMint, setIsMint] = useState(true);
|
||||
const [isPending, setIsPending] = useState(false);
|
||||
@ -53,8 +50,8 @@ const WethWrapper = ({ chainId, address, config, connect }) => {
|
||||
const { symbol: reserveSymbol } = useTokenSymbol(chainId, "RESERVE");
|
||||
|
||||
useEffect(() => {
|
||||
ReactGA.send({ hitType: "pageview", page: location.pathname });
|
||||
}, [location])
|
||||
ReactGA.send({ hitType: "pageview", page: "/wrapper" });
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const value = nativeBalance ? nativeBalance.value : 0n;
|
||||
|
||||
@ -9,6 +9,7 @@ import {
|
||||
FTSO_DAI_LP_ADDRESSES,
|
||||
WETH_ADDRESSES,
|
||||
} from "../constants/addresses";
|
||||
import { isNetworkLegacyType } from "../constants";
|
||||
import { config } from "../config";
|
||||
|
||||
import { tokenNameConverter } from "../helpers/tokenConverter";
|
||||
@ -206,6 +207,17 @@ export const getTokenPurchaseLink = (chainId, tokenAddress, chainName) => {
|
||||
return purchaseUrl;
|
||||
}
|
||||
|
||||
const sanitizeTransactionRequest = (request, isLegacy) => {
|
||||
const finalRequest = { ...request };
|
||||
if (isLegacy) {
|
||||
delete finalRequest.maxFeePerGas;
|
||||
delete finalRequest.maxPriorityFeePerGas;
|
||||
} else {
|
||||
delete finalRequest.gasPrice;
|
||||
}
|
||||
return finalRequest;
|
||||
}
|
||||
|
||||
export const executeOnChainTransaction = async ({
|
||||
chainId,
|
||||
abi,
|
||||
@ -217,6 +229,7 @@ export const executeOnChainTransaction = async ({
|
||||
value
|
||||
}) => {
|
||||
try {
|
||||
const isLegacy = isNetworkLegacyType(chainId);
|
||||
const { request } = await simulateContract(config, {
|
||||
abi,
|
||||
address,
|
||||
@ -225,9 +238,11 @@ export const executeOnChainTransaction = async ({
|
||||
account,
|
||||
chainId,
|
||||
value,
|
||||
type: isLegacy ? 'legacy' : 'eip1559',
|
||||
});
|
||||
|
||||
const txHash = await writeContract(config, request);
|
||||
const finalRequest = sanitizeTransactionRequest(request, isLegacy);
|
||||
const txHash = await writeContract(config, { ...finalRequest });
|
||||
await waitForTransactionReceipt(config, {
|
||||
hash: txHash,
|
||||
onReplaced: () => toast(messages.replacedMsg),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user