From 91df6791585be404ba4ac9794ba86cc36cdd11a6 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Thu, 16 May 2024 11:52:52 +0200 Subject: [PATCH] Quick fix for transaction window pop-up When we connected the account from the landing page the etherum account was not set up. Therefore, the deposit transaction window did not run because the eth account is still required in several places in the code.This is a quick fix to solve the issue but it is not a solution to the problem. --- dapp/src/hooks/useTransactionModal.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dapp/src/hooks/useTransactionModal.ts b/dapp/src/hooks/useTransactionModal.ts index 47e4be0c4..de54a5fc0 100644 --- a/dapp/src/hooks/useTransactionModal.ts +++ b/dapp/src/hooks/useTransactionModal.ts @@ -1,12 +1,13 @@ import { ActionFlowType, MODAL_TYPES } from "#/types" import { useCallback, useEffect } from "react" import { logPromiseFailure } from "#/utils" +import { ZeroAddress } from "ethers" import { useModal } from "./useModal" import { useWalletContext } from "./useWalletContext" import { useRequestBitcoinAccount } from "./useRequestBitcoinAccount" export function useTransactionModal(type: ActionFlowType) { - const { btcAccount } = useWalletContext() + const { btcAccount, setEthAccount } = useWalletContext() const { account, requestAccount } = useRequestBitcoinAccount() const { openModal } = useModal() @@ -24,11 +25,18 @@ export function useTransactionModal(type: ActionFlowType) { } }, [account, handleOpenModal]) + const handleRequestAccount = useCallback(async () => { + await requestAccount() + // TODO: Temporary solution - we do not need the eth account and we + // want to create the Acre SDK w/o passing the Ethereum Account. + setEthAccount(ZeroAddress) + }, [requestAccount, setEthAccount]) + return useCallback(() => { if (btcAccount) { handleOpenModal() } else { - logPromiseFailure(requestAccount()) + logPromiseFailure(handleRequestAccount()) } - }, [btcAccount, handleOpenModal, requestAccount]) + }, [btcAccount, handleOpenModal, handleRequestAccount]) }