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_LACONICD_CHAIN_ID,
|
||||||
VITE_WALLET_IFRAME_URL,
|
VITE_WALLET_IFRAME_URL,
|
||||||
} from 'utils/constants';
|
} from 'utils/constants';
|
||||||
import useCheckBalance from '../../../hooks/useFetchBalance';
|
import useCheckBalance from '../../../hooks/useCheckBalance';
|
||||||
|
|
||||||
type ConfigureDeploymentFormValues = {
|
type ConfigureDeploymentFormValues = {
|
||||||
option: string;
|
option: string;
|
||||||
|
@ -23,7 +23,10 @@ const IFrameModal = ({
|
|||||||
if (event.data.type === 'WALLET_ACCOUNTS_DATA') {
|
if (event.data.type === 'WALLET_ACCOUNTS_DATA') {
|
||||||
setIsDataReceived(true);
|
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);
|
setAccount(event.data.data[0].address);
|
||||||
} else if (event.data.type === 'ERROR') {
|
} else if (event.data.type === 'ERROR') {
|
||||||
|
@ -19,7 +19,7 @@ const axiosInstance = axios.create({
|
|||||||
const AutoSignInIFrameModal = () => {
|
const AutoSignInIFrameModal = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [address, setAddress] = useState();
|
const [accountAddress, setAccountAddress] = useState();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleSignInResponse = async (event: MessageEvent) => {
|
const handleSignInResponse = async (event: MessageEvent) => {
|
||||||
@ -52,7 +52,7 @@ const AutoSignInIFrameModal = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initiateAutoSignIn = async () => {
|
const initiateAutoSignIn = async () => {
|
||||||
if (!address) return;
|
if (!accountAddress) return;
|
||||||
|
|
||||||
const iframe = document.getElementById(
|
const iframe = document.getElementById(
|
||||||
'autoSignInFrame',
|
'autoSignInFrame',
|
||||||
@ -68,7 +68,7 @@ const AutoSignInIFrameModal = () => {
|
|||||||
domain: window.location.host,
|
domain: window.location.host,
|
||||||
uri: window.location.origin,
|
uri: window.location.origin,
|
||||||
chainId: 1,
|
chainId: 1,
|
||||||
address,
|
address: accountAddress,
|
||||||
nonce: generateNonce(),
|
nonce: generateNonce(),
|
||||||
// Human-readable ASCII assertion that the user will sign, and it must not contain `\n`.
|
// Human-readable ASCII assertion that the user will sign, and it must not contain `\n`.
|
||||||
statement: 'Sign in With Ethereum.',
|
statement: 'Sign in With Ethereum.',
|
||||||
@ -85,14 +85,14 @@ const AutoSignInIFrameModal = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
initiateAutoSignIn();
|
initiateAutoSignIn();
|
||||||
}, [address]);
|
}, [accountAddress]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleAccountsDataResponse = async (event: MessageEvent) => {
|
const handleAccountsDataResponse = async (event: MessageEvent) => {
|
||||||
if (event.origin !== VITE_WALLET_IFRAME_URL) return;
|
if (event.origin !== VITE_WALLET_IFRAME_URL) return;
|
||||||
|
|
||||||
if (event.data.type === 'WALLET_ACCOUNTS_DATA') {
|
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 { Button } from 'components/shared';
|
||||||
import CheckBalanceIframe from 'components/projects/create/CheckBalanceIframe';
|
import CheckBalanceIframe from 'components/projects/create/CheckBalanceIframe';
|
||||||
import useCheckBalance from '../hooks/useFetchBalance';
|
import useCheckBalance from '../hooks/useCheckBalance';
|
||||||
|
|
||||||
const BuyPrepaidService = () => {
|
const BuyPrepaidService = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
@ -6,7 +6,7 @@ import { Heading, Badge, Button } from 'components/shared';
|
|||||||
import { PlusIcon } from 'components/shared/CustomIcon';
|
import { PlusIcon } from 'components/shared/CustomIcon';
|
||||||
import { useGQLClient } from 'context/GQLClientContext';
|
import { useGQLClient } from 'context/GQLClientContext';
|
||||||
import { Project } from 'gql-client';
|
import { Project } from 'gql-client';
|
||||||
import useCheckBalance from '../../hooks/useFetchBalance';
|
import useCheckBalance from '../../hooks/useCheckBalance';
|
||||||
import CheckBalanceIframe from 'components/projects/create/CheckBalanceIframe';
|
import CheckBalanceIframe from 'components/projects/create/CheckBalanceIframe';
|
||||||
|
|
||||||
const Projects = () => {
|
const Projects = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user