diff --git a/src/client/src/views/fedimints/AddMint.tsx b/src/client/src/views/fedimints/AddMint.tsx index f814f652..366ea13f 100644 --- a/src/client/src/views/fedimints/AddMint.tsx +++ b/src/client/src/views/fedimints/AddMint.tsx @@ -13,13 +13,21 @@ import { import { ColorButton } from '../../components/buttons/colorButton/ColorButton'; import { gatewayApi } from '../../api/GatewayApi'; import { useGatewayDispatch } from '../../context/GatewayContext'; +import { useNodeInfo } from '../../hooks/UseNodeInfo'; export const AddMint = () => { const gatewayDispatch = useGatewayDispatch(); const [isAdding, setIsAdding] = useState(false); const [inviteCode, setInviteCode] = useState(''); + const { syncedToChain } = useNodeInfo(); const handleEnter = () => { + if (!syncedToChain) { + toast.error( + 'Node not synced to chain yet, cannot connect to federation.' + ); + return; + } gatewayApi.connectFederation(inviteCode).then(() => { gatewayApi .fetchInfo() diff --git a/src/client/src/views/home/account/gateway/FedimintGatewayCard.tsx b/src/client/src/views/home/account/gateway/FedimintGatewayCard.tsx index 2927f8e4..f8da0b58 100644 --- a/src/client/src/views/home/account/gateway/FedimintGatewayCard.tsx +++ b/src/client/src/views/home/account/gateway/FedimintGatewayCard.tsx @@ -17,6 +17,7 @@ import { useGatewayDispatch } from '../../../../context/GatewayContext'; import { gatewayApi } from '../../../../api/GatewayApi'; import { GatewayInfo } from '../../../../api/types'; import { useGatewayEcashTotalSats } from '../../../../hooks/UseGatewayEcashTotal'; +import { useNodeInfo } from '../../../../hooks/UseNodeInfo'; interface FedimintGatewayCardProps { gatewayInfo: GatewayInfo; @@ -30,8 +31,16 @@ export const FedimintGatewayCard = ({ const gatewayDispath = useGatewayDispatch(); const [inviteCode, setInviteCode] = useState(''); const totalFedimintEcash = useGatewayEcashTotalSats(); + const { syncedToChain } = useNodeInfo(); const handleEnter = () => { + if (!syncedToChain) { + toast.error( + 'Node not synced to chain yet, cannot connect to federation.' + ); + return; + } + gatewayApi.connectFederation(inviteCode).then(() => { gatewayApi .fetchInfo()