Rename file for check balance hook
This commit is contained in:
parent
840df4b90c
commit
cec75f9175
@ -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;
|
||||
|
@ -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') {
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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 = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user