Rename file for check balance hook

This commit is contained in:
IshaVenikar 2025-02-11 14:22:51 +05:30
parent 840df4b90c
commit cec75f9175
6 changed files with 12 additions and 9 deletions

View File

@ -27,7 +27,7 @@ import {
VITE_LACONICD_CHAIN_ID,
VITE_WALLET_IFRAME_URL,
} from 'utils/constants';
import useCheckBalance from '../../../hooks/useFetchBalance';
import useCheckBalance from '../../../hooks/useCheckBalance';
type ConfigureDeploymentFormValues = {
option: string;

View File

@ -23,7 +23,10 @@ const IFrameModal = ({
if (event.data.type === 'WALLET_ACCOUNTS_DATA') {
setIsDataReceived(true);
if (event.data.data.length === 0) return;
if (event.data.data.length === 0) {
console.error(`Accounts not present for chainId: ${VITE_LACONICD_CHAIN_ID}`);
return;
}
setAccount(event.data.data[0].address);
} else if (event.data.type === 'ERROR') {

View File

@ -19,7 +19,7 @@ const axiosInstance = axios.create({
const AutoSignInIFrameModal = () => {
const navigate = useNavigate();
const [address, setAddress] = useState();
const [accountAddress, setAccountAddress] = useState();
useEffect(() => {
const handleSignInResponse = async (event: MessageEvent) => {
@ -52,7 +52,7 @@ const AutoSignInIFrameModal = () => {
useEffect(() => {
const initiateAutoSignIn = async () => {
if (!address) return;
if (!accountAddress) return;
const iframe = document.getElementById(
'autoSignInFrame',
@ -68,7 +68,7 @@ const AutoSignInIFrameModal = () => {
domain: window.location.host,
uri: window.location.origin,
chainId: 1,
address,
address: accountAddress,
nonce: generateNonce(),
// Human-readable ASCII assertion that the user will sign, and it must not contain `\n`.
statement: 'Sign in With Ethereum.',
@ -85,14 +85,14 @@ const AutoSignInIFrameModal = () => {
};
initiateAutoSignIn();
}, [address]);
}, [accountAddress]);
useEffect(() => {
const handleAccountsDataResponse = async (event: MessageEvent) => {
if (event.origin !== VITE_WALLET_IFRAME_URL) return;
if (event.data.type === 'WALLET_ACCOUNTS_DATA') {
setAddress(event.data.data[0].address);
setAccountAddress(event.data.data[0].address);
}
};

View File

@ -4,7 +4,7 @@ import { useMediaQuery } from 'usehooks-ts';
import { Button } from 'components/shared';
import CheckBalanceIframe from 'components/projects/create/CheckBalanceIframe';
import useCheckBalance from '../hooks/useFetchBalance';
import useCheckBalance from '../hooks/useCheckBalance';
const BuyPrepaidService = () => {
const navigate = useNavigate();

View File

@ -6,7 +6,7 @@ import { Heading, Badge, Button } from 'components/shared';
import { PlusIcon } from 'components/shared/CustomIcon';
import { useGQLClient } from 'context/GQLClientContext';
import { Project } from 'gql-client';
import useCheckBalance from '../../hooks/useFetchBalance';
import useCheckBalance from '../../hooks/useCheckBalance';
import CheckBalanceIframe from 'components/projects/create/CheckBalanceIframe';
const Projects = () => {