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