Compare commits
6 Commits
175d964b9f
...
5c7546b0d9
Author | SHA1 | Date | |
---|---|---|---|
5c7546b0d9 | |||
46ef25613c | |||
37c447ece5 | |||
c3dbe0666f | |||
e8342708c4 | |||
13a05bf0dd |
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.2.4",
|
"version": "0.2.10",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
@ -12,7 +12,7 @@ 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 { ReactElement, useState } from "react";
|
import { ReactElement, useState, useEffect } from "react";
|
||||||
import { useNavigate, createSearchParams } from "react-router-dom";
|
import { useNavigate, createSearchParams } from "react-router-dom";
|
||||||
|
|
||||||
import GhostStyledIcon from "../../Icon/GhostIcon";
|
import GhostStyledIcon from "../../Icon/GhostIcon";
|
||||||
@ -105,7 +105,7 @@ const WalletTotalValue = ({ address, tokens }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function InitialWalletView({ address, chainId, onClose }) {
|
function InitialWalletView({ isWalletOpen, address, chainId, onClose }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const tokens = useWallet(chainId, address);
|
const tokens = useWallet(chainId, address);
|
||||||
@ -122,6 +122,12 @@ function InitialWalletView({ address, chainId, onClose }) {
|
|||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isWalletOpen) {
|
||||||
|
Object.values(tokens ?? {}).forEach(token => token.refetch());
|
||||||
|
}
|
||||||
|
}, [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" }}>
|
||||||
|
@ -192,6 +192,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
price: daiPrice,
|
price: daiPrice,
|
||||||
icons: ["GDAI"],
|
icons: ["GDAI"],
|
||||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/gDAI.svg",
|
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/gDAI.svg",
|
||||||
|
refetch: daiRefetch,
|
||||||
},
|
},
|
||||||
ftso: {
|
ftso: {
|
||||||
symbol: ftsoSymbol,
|
symbol: ftsoSymbol,
|
||||||
@ -200,6 +201,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
price: ftsoPrice,
|
price: ftsoPrice,
|
||||||
icons: ["FTSO"],
|
icons: ["FTSO"],
|
||||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/eGHST.svg",
|
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/eGHST.svg",
|
||||||
|
refetch: ftsoRefetch,
|
||||||
},
|
},
|
||||||
stnk: {
|
stnk: {
|
||||||
symbol: stnkSymbol,
|
symbol: stnkSymbol,
|
||||||
@ -208,6 +210,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
price: stnkPrice,
|
price: stnkPrice,
|
||||||
icons: ["STNK"],
|
icons: ["STNK"],
|
||||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/sGHST.svg",
|
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/sGHST.svg",
|
||||||
|
refetch: stnkRefetch,
|
||||||
},
|
},
|
||||||
ghst: {
|
ghst: {
|
||||||
symbol: ghstSymbol,
|
symbol: ghstSymbol,
|
||||||
@ -216,6 +219,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
price: ghstPrice,
|
price: ghstPrice,
|
||||||
icons: ["GHST"],
|
icons: ["GHST"],
|
||||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/GHST.svg",
|
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/GHST.svg",
|
||||||
|
refetch: ghstRefetch,
|
||||||
},
|
},
|
||||||
daiFtso: {
|
daiFtso: {
|
||||||
isPool: true,
|
isPool: true,
|
||||||
@ -225,6 +229,7 @@ export const useWallet = (chainId, userAddress) => {
|
|||||||
price: lpDaiFtsoPrice,
|
price: lpDaiFtsoPrice,
|
||||||
icons: ["GDAI", "FTSO"],
|
icons: ["GDAI", "FTSO"],
|
||||||
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg",
|
externalUrl: "https://ghostchain.io/wp-content/uploads/2025/03/uni-v2.svg",
|
||||||
|
refetch: lpDaiFtsoRefetch,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ export function Wallet({ address, chainId, connect }) {
|
|||||||
onOpen={openWallet}
|
onOpen={openWallet}
|
||||||
onClose={closeWallet}
|
onClose={closeWallet}
|
||||||
>
|
>
|
||||||
<InitialWalletView address={address} chainId={chainId} onClose={closeWallet} />
|
<InitialWalletView isWalletOpen={isWalletOpen} address={address} chainId={chainId} onClose={closeWallet} />
|
||||||
</StyledSwipeableDrawer>
|
</StyledSwipeableDrawer>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -34,6 +34,7 @@ const BondConfirmModal = ({
|
|||||||
spendAmountValue,
|
spendAmountValue,
|
||||||
spendAmount,
|
spendAmount,
|
||||||
receiveAmount,
|
receiveAmount,
|
||||||
|
sender,
|
||||||
handleSettingsOpen,
|
handleSettingsOpen,
|
||||||
isOpen,
|
isOpen,
|
||||||
handleConfirmClose
|
handleConfirmClose
|
||||||
@ -58,6 +59,7 @@ const BondConfirmModal = ({
|
|||||||
spendAmountValue._value.toBigInt(),
|
spendAmountValue._value.toBigInt(),
|
||||||
maxPrice,
|
maxPrice,
|
||||||
recipientAddress,
|
recipientAddress,
|
||||||
|
sender,
|
||||||
referral
|
referral
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import DataRow from "../../../components/DataRow/DataRow";
|
|||||||
import Paper from "../../../components/Paper/Paper";
|
import Paper from "../../../components/Paper/Paper";
|
||||||
|
|
||||||
import { useCurrentIndex } from "../../../hooks/staking";
|
import { useCurrentIndex } from "../../../hooks/staking";
|
||||||
import { useBalance } from "../../../hooks/tokens";
|
import { useBalance, useTokenSymbol } from "../../../hooks/tokens";
|
||||||
|
|
||||||
const BondInputArea = ({
|
const BondInputArea = ({
|
||||||
bond,
|
bond,
|
||||||
@ -35,7 +35,7 @@ const BondInputArea = ({
|
|||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
const { currentIndex } = useCurrentIndex(chainId);
|
const { currentIndex } = useCurrentIndex(chainId);
|
||||||
const { balance } = useBalance(chainId, bond.quoteToken.quoteTokenAddress, address);
|
const { balance, refetch } = useBalance(chainId, bond.quoteToken.quoteTokenAddress, address);
|
||||||
|
|
||||||
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
const { symbol: ftsoSymbol } = useTokenSymbol(chainId, "FTSO");
|
||||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||||
@ -60,6 +60,7 @@ const BondInputArea = ({
|
|||||||
const handleConfirmClose = () => {
|
const handleConfirmClose = () => {
|
||||||
setAmount("");
|
setAmount("");
|
||||||
setConfirmOpen(false);
|
setConfirmOpen(false);
|
||||||
|
refetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
const setMax = () => {
|
const setMax = () => {
|
||||||
@ -220,6 +221,7 @@ const BondInputArea = ({
|
|||||||
receiveAmount={formatNumber(amountInBaseToken, formatDecimals)}
|
receiveAmount={formatNumber(amountInBaseToken, formatDecimals)}
|
||||||
handleSettingsOpen={handleSettingsOpen}
|
handleSettingsOpen={handleSettingsOpen}
|
||||||
isOpen={confirmOpen}
|
isOpen={confirmOpen}
|
||||||
|
sender={address}
|
||||||
handleConfirmClose={() => handleConfirmClose()}
|
handleConfirmClose={() => handleConfirmClose()}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -59,7 +59,7 @@ export const ClaimBonds = ({ chainId, address, secondsTo }) => {
|
|||||||
|
|
||||||
const onSubmit = async (indexes) => {
|
const onSubmit = async (indexes) => {
|
||||||
const isFundsInWarmup = warmupInfo.deposit._value > 0n;
|
const isFundsInWarmup = warmupInfo.deposit._value > 0n;
|
||||||
if ((warmupExists && isFundsInWarmup) || !isPreClaimConfirmed) {
|
if (warmupExists && isFundsInWarmup && !isPreClaimConfirmed) {
|
||||||
setIsWapmup(true);
|
setIsWapmup(true);
|
||||||
} else {
|
} else {
|
||||||
setIsPending(true);
|
setIsPending(true);
|
||||||
@ -69,6 +69,7 @@ export const ClaimBonds = ({ chainId, address, secondsTo }) => {
|
|||||||
isPayoutGhst,
|
isPayoutGhst,
|
||||||
indexes
|
indexes
|
||||||
);
|
);
|
||||||
|
await notesRefetch();
|
||||||
setIsPending(false);
|
setIsPending(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,7 +118,7 @@ export const ClaimBonds = ({ chainId, address, secondsTo }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
disabled={totalClaimableBalance._value === 0n}
|
disabled={isPending || totalClaimableBalance._value === 0n}
|
||||||
fullWidth
|
fullWidth
|
||||||
className=""
|
className=""
|
||||||
onClick={() => onSubmit(notes.filter((note) => secondsTo > note.matured).map(note => note.id))}
|
onClick={() => onSubmit(notes.filter((note) => secondsTo > note.matured).map(note => note.id))}
|
||||||
@ -166,7 +167,7 @@ export const ClaimBonds = ({ chainId, address, secondsTo }) => {
|
|||||||
<Box mt="16px">
|
<Box mt="16px">
|
||||||
<TertiaryButton
|
<TertiaryButton
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={secondsTo < note.matured}
|
disabled={isPending || secondsTo < note.matured}
|
||||||
onClick={() => onSubmit([note.id])}
|
onClick={() => onSubmit([note.id])}
|
||||||
>
|
>
|
||||||
Claim
|
Claim
|
||||||
@ -222,7 +223,7 @@ export const ClaimBonds = ({ chainId, address, secondsTo }) => {
|
|||||||
<TableCell style={{ padding: "8px 0" }}>
|
<TableCell style={{ padding: "8px 0" }}>
|
||||||
<TertiaryButton
|
<TertiaryButton
|
||||||
fullWidth
|
fullWidth
|
||||||
disabled={secondsTo < note.matured}
|
disabled={isPending || secondsTo < note.matured}
|
||||||
onClick={() => onSubmit([note.id])}
|
onClick={() => onSubmit([note.id])}
|
||||||
>
|
>
|
||||||
Claim
|
Claim
|
||||||
|
@ -84,7 +84,7 @@ const StakeConfirmationModal = (props) => {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "UNSTAKE":
|
case "UNSTAKE":
|
||||||
isRebase = props.upperToken === stnkSymbol;
|
isRebase = props.upperToken === props.stnkSymbol;
|
||||||
await unstake(
|
await unstake(
|
||||||
props.chainId,
|
props.chainId,
|
||||||
props.address,
|
props.address,
|
||||||
|
@ -152,13 +152,13 @@ export const useLiveBonds = (chainId) => {
|
|||||||
discount,
|
discount,
|
||||||
displayName: getBondNameDisplayName(chainId, bondName, quoteTokenAddress),
|
displayName: getBondNameDisplayName(chainId, bondName, quoteTokenAddress),
|
||||||
baseToken: {
|
baseToken: {
|
||||||
name: quoteTokenSymbol,
|
name: baseTokenSymbol,
|
||||||
purchaseUrl: getTokenPurchaseLink(chainId, ""),
|
purchaseUrl: getTokenPurchaseLink(chainId, ""),
|
||||||
icons: ["FTSO"],
|
icons: ["FTSO"],
|
||||||
tokenAddress: getTokenAddress(chainId, "FTSO")
|
tokenAddress: getTokenAddress(chainId, "FTSO")
|
||||||
},
|
},
|
||||||
quoteToken: {
|
quoteToken: {
|
||||||
name: quoteTokenName,
|
name: quoteTokenSymbol,
|
||||||
purchaseUrl: getTokenPurchaseLink(chainId, quoteTokenAddress),
|
purchaseUrl: getTokenPurchaseLink(chainId, quoteTokenAddress),
|
||||||
icons: getTokenIcons(chainId, quoteTokenAddress),
|
icons: getTokenIcons(chainId, quoteTokenAddress),
|
||||||
decimals: quoteTokenDecimals,
|
decimals: quoteTokenDecimals,
|
||||||
@ -258,10 +258,10 @@ export const useNotes = (chainId, address) => {
|
|||||||
}
|
}
|
||||||
}) : [];
|
}) : [];
|
||||||
|
|
||||||
return { notes };
|
return { notes, refetch };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const purchaseBond = async (chainId, bondId, amount, maxPrice, user, referral) => {
|
export const purchaseBond = async (chainId, bondId, amount, maxPrice, user, sender, referral) => {
|
||||||
const args = [
|
const args = [
|
||||||
bondId,
|
bondId,
|
||||||
amount,
|
amount,
|
||||||
@ -278,7 +278,7 @@ export const purchaseBond = async (chainId, bondId, amount, maxPrice, user, refe
|
|||||||
chainId,
|
chainId,
|
||||||
"deposit",
|
"deposit",
|
||||||
args,
|
args,
|
||||||
user,
|
sender,
|
||||||
messages
|
messages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user