From 235c3410d90833d8fba3a673776d5952dd35ef76 Mon Sep 17 00:00:00 2001 From: Yohan Tancrez Date: Thu, 4 Apr 2024 01:48:41 +0200 Subject: [PATCH] added error potential logs --- .../_hooks/useEthereumCollectionApproval.tsx | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/web/src/app/(routes)/bridge/_hooks/useEthereumCollectionApproval.tsx b/apps/web/src/app/(routes)/bridge/_hooks/useEthereumCollectionApproval.tsx index 5f4b5b22..478c0248 100644 --- a/apps/web/src/app/(routes)/bridge/_hooks/useEthereumCollectionApproval.tsx +++ b/apps/web/src/app/(routes)/bridge/_hooks/useEthereumCollectionApproval.tsx @@ -32,17 +32,28 @@ export default function useEthereumCollectionApproval() { const { data: approveHash, + error, + failureReason, isLoading: isSigning, writeContract: writeContractApprove, } = useWriteContract(); + console.error("error: ", error); + console.error("failureReason: ", failureReason); function approveForAll() { - writeContractApprove({ - abi: erc721Abi, - address: selectedCollectionAddress as `0x${string}`, - args: [process.env.NEXT_PUBLIC_L1_BRIDGE_ADDRESS as `0x${string}`, true], - functionName: "setApprovalForAll", - }); + try { + writeContractApprove({ + abi: erc721Abi, + address: selectedCollectionAddress as `0x${string}`, + args: [ + process.env.NEXT_PUBLIC_L1_BRIDGE_ADDRESS as `0x${string}`, + true, + ], + functionName: "setApprovalForAll", + }); + } catch (e) { + console.error(e); + } } const { isLoading: isApproveLoading } = useWaitForTransactionReceipt({