From fe673bd0f87d2cc56c8ace630901b456c38c9f39 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Wed, 29 Dec 2021 22:00:41 -0300 Subject: [PATCH] Small fixes --- src/transaction/NavButton.tsx | 4 ++-- src/useErigonHooks.ts | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/transaction/NavButton.tsx b/src/transaction/NavButton.tsx index 8eb9e16..04d421c 100644 --- a/src/transaction/NavButton.tsx +++ b/src/transaction/NavButton.tsx @@ -3,7 +3,7 @@ import { transactionURL } from "../url"; // TODO: extract common component with block/NavButton type NavButtonProps = { - txHash: string | undefined; + txHash: string | null | undefined; disabled?: boolean; }; @@ -12,7 +12,7 @@ const NavButton: React.FC = ({ disabled, children, }) => { - if (disabled || txHash === undefined) { + if (disabled || txHash === null || txHash === undefined) { return ( {children} diff --git a/src/useErigonHooks.ts b/src/useErigonHooks.ts index 2a38e09..dbf9e8f 100644 --- a/src/useErigonHooks.ts +++ b/src/useErigonHooks.ts @@ -530,7 +530,7 @@ const getTransactionBySenderAndNonceFetcher = async ({ provider, sender, nonce, -}: TransactionBySenderAndNonceKey): Promise => { +}: TransactionBySenderAndNonceKey): Promise => { if (nonce < 0) { return undefined; } @@ -541,10 +541,6 @@ const getTransactionBySenderAndNonceFetcher = async ({ ])) as string; // Empty or success - if (result === "0x") { - return undefined; - } - return result; }; @@ -564,9 +560,9 @@ export const useTransactionBySenderAndNonce = ( provider: JsonRpcProvider | undefined, sender: ChecksummedAddress | undefined, nonce: number | undefined -): string | undefined => { +): string | null | undefined => { const { data, error } = useSWR< - string | undefined, + string | null | undefined, any, TransactionBySenderAndNonceKey | null >(