Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

refactor: simplify transaction lifecycle handling by removing logEvent calls

yoginth.com 944b0b87 79fd63ab

verified
+12 -15
+12 -15
apps/web/src/hooks/useTransactionLifecycle.tsx
··· 8 8 import type { ApolloClientError } from "@hey/types/errors"; 9 9 import { sendEip712Transaction, sendTransaction } from "viem/zksync"; 10 10 import { useWalletClient } from "wagmi"; 11 - import logEvent from "@/helpers/logEvent"; 12 11 import useHandleWrongNetwork from "./useHandleWrongNetwork"; 13 12 14 13 type AnyTransactionRequestFragment = ··· 35 34 } 36 35 await handleWrongNetwork(); 37 36 if (!data) return; 38 - void logEvent("Viem pending: SponsoredTransactionRequest"); 39 - const txHash = await sendEip712Transaction(data, { 40 - account: data.account, 41 - ...getTransactionData(transactionData.raw, { sponsored: true }) 42 - }); 43 - void logEvent("Viem onSuccess: SponsoredTransactionRequest"); 44 - return onCompleted(txHash); 37 + return onCompleted( 38 + await sendEip712Transaction(data, { 39 + account: data.account, 40 + ...getTransactionData(transactionData.raw, { sponsored: true }) 41 + }) 42 + ); 45 43 }; 46 44 47 45 const handleSelfFundedTransaction = async ( ··· 57 55 } 58 56 await handleWrongNetwork(); 59 57 if (!data) return; 60 - void logEvent("Viem pending: SelfFundedTransactionRequest"); 61 - const txHash = await sendTransaction(data, { 62 - account: data.account, 63 - ...getTransactionData(transactionData.raw) 64 - }); 65 - void logEvent("Viem onSuccess: SelfFundedTransactionRequest"); 66 - return onCompleted(txHash); 58 + return onCompleted( 59 + await sendTransaction(data, { 60 + account: data.account, 61 + ...getTransactionData(transactionData.raw) 62 + }) 63 + ); 67 64 }; 68 65 69 66 const handleTransactionLifecycle = async ({