From d9aa23a569f86cd985e66a40b31a28910f6d0b64 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Wed, 29 May 2024 12:37:26 +0200 Subject: [PATCH 1/2] Removal of unnecessary condition for `ethAccount` The `ethAccount` is no longer necessary for deposit flow. --- .../ActiveStakingStep/DepositBTCModal.tsx | 12 ++---------- dapp/src/hooks/useDepositTelemetry.ts | 7 +------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/dapp/src/components/TransactionModal/ActiveStakingStep/DepositBTCModal.tsx b/dapp/src/components/TransactionModal/ActiveStakingStep/DepositBTCModal.tsx index 0ba32ac49..2598c8d99 100644 --- a/dapp/src/components/TransactionModal/ActiveStakingStep/DepositBTCModal.tsx +++ b/dapp/src/components/TransactionModal/ActiveStakingStep/DepositBTCModal.tsx @@ -7,7 +7,6 @@ import { useExecuteFunction, useStakeFlowContext, useToast, - useWalletContext, } from "#/hooks" import { logPromiseFailure } from "#/utils" import { PROCESS_STATUSES } from "#/types" @@ -24,7 +23,6 @@ const TOAST_ID = TOAST_IDS.DEPOSIT_TRANSACTION_ERROR const TOAST = TOASTS[TOAST_ID] export default function DepositBTCModal() { - const { ethAccount } = useWalletContext() const tokenAmount = useActionFlowTokenAmount() const { btcAddress, depositReceipt, stake } = useStakeFlowContext() const depositTelemetry = useDepositTelemetry() @@ -68,14 +66,9 @@ export default function DepositBTCModal() { ) const handledDepositBTC = useCallback(async () => { - if (!tokenAmount?.amount || !btcAddress || !depositReceipt || !ethAccount) - return + if (!tokenAmount?.amount || !btcAddress || !depositReceipt) return - const response = await depositTelemetry( - depositReceipt, - btcAddress, - ethAccount, - ) + const response = await depositTelemetry(depositReceipt, btcAddress) if (response.verificationStatus === "valid") { logPromiseFailure(sendBitcoinTransaction(tokenAmount?.amount, btcAddress)) @@ -86,7 +79,6 @@ export default function DepositBTCModal() { btcAddress, depositReceipt, depositTelemetry, - ethAccount, sendBitcoinTransaction, showError, tokenAmount?.amount, diff --git a/dapp/src/hooks/useDepositTelemetry.ts b/dapp/src/hooks/useDepositTelemetry.ts index bcf5d09d3..839b9d791 100644 --- a/dapp/src/hooks/useDepositTelemetry.ts +++ b/dapp/src/hooks/useDepositTelemetry.ts @@ -8,11 +8,7 @@ export function useDepositTelemetry() { const captureMessage = useCaptureMessage() return useCallback( - async ( - deposit: DepositReceipt, - depositAddress: string, - ethAddress: string, - ) => { + async (deposit: DepositReceipt, depositAddress: string) => { const { status, response } = await verifyDepositAddress( deposit, depositAddress, @@ -43,7 +39,6 @@ export function useDepositTelemetry() { verificationResponse: response, }, { - ethAddress, ...verificationStatus, }, ) From f4f38a6c15402fb4e5f5d0fe05172be06c7b6620 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Wed, 29 May 2024 12:42:48 +0200 Subject: [PATCH 2/2] Removal of the unneeded code The `ethAccount` is no longer needed for SDK and in the deposit flow. --- dapp/src/hooks/useWallet.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/dapp/src/hooks/useWallet.ts b/dapp/src/hooks/useWallet.ts index f97cec66d..c18829764 100644 --- a/dapp/src/hooks/useWallet.ts +++ b/dapp/src/hooks/useWallet.ts @@ -1,10 +1,9 @@ import { useMemo } from "react" -import { ZeroAddress } from "ethers" import { useWalletContext } from "./useWalletContext" import { useRequestBitcoinAccount } from "./useRequestBitcoinAccount" export function useWallet() { - const { btcAccount, ethAccount, setEthAccount } = useWalletContext() + const { btcAccount, ethAccount } = useWalletContext() const { requestAccount: requestBitcoinAccount } = useRequestBitcoinAccount() return useMemo( @@ -13,13 +12,10 @@ export function useWallet() { account: btcAccount, requestAccount: async () => { await requestBitcoinAccount() - // 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) }, }, ethereum: { account: ethAccount }, }), - [btcAccount, requestBitcoinAccount, ethAccount, setEthAccount], + [btcAccount, ethAccount, requestBitcoinAccount], ) }