diff --git a/src/pages/SignWithCosmos.tsx b/src/pages/SignWithCosmos.tsx index a73b986..cc45f35 100644 --- a/src/pages/SignWithCosmos.tsx +++ b/src/pages/SignWithCosmos.tsx @@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useMemo, useState } from "react"; import { useParams, useLocation, useNavigate } from "react-router-dom"; import { SnackbarProvider, enqueueSnackbar } from "notistack"; -import { Box, Card, CardContent, Typography } from "@mui/material"; +import { Box, Button, Card, CardContent, Grid, Typography } from "@mui/material"; import LoadingButton from "@mui/lab/LoadingButton/LoadingButton"; import { MsgOnboardParticipantEncodeObject, @@ -41,6 +41,29 @@ const SignWithCosmos = () => { }; }, [cosmosAddress, innerMessage, ethSignature]); + const handleTokenRequest = async () => { + try { + const response = await fetch('http://localhost:3000/faucet', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + address: cosmosAddress, + }), + }); + + if (!response.ok) { + throw new Error('Failed to send request'); + } + + getBalances(); + console.log('Request successful'); + } catch (error) { + console.error('Error:', error); + } + }; + const sendTransaction = async ( transactionMessage: MsgOnboardParticipantEncodeObject ) => { @@ -103,8 +126,18 @@ const SignWithCosmos = () => { Cosmos Account: - Address: {cosmosAddress} - Balance: {balance} {process.env.REACT_APP_LACONICD_DENOM} + + + Address: {cosmosAddress} + Balance: {balance} {process.env.REACT_APP_LACONICD_DENOM} + + + + + @@ -129,6 +162,7 @@ const SignWithCosmos = () => { await sendTransaction(onboardParticipantMsg); }} loading={isLoading} + disabled={balance === '0'} > Send transaction