Small fixes

This commit is contained in:
Willian Mitsuda 2021-12-29 22:00:41 -03:00
parent 7d87345e98
commit fe673bd0f8
2 changed files with 5 additions and 9 deletions

View File

@ -3,7 +3,7 @@ import { transactionURL } from "../url";
// TODO: extract common component with block/NavButton // TODO: extract common component with block/NavButton
type NavButtonProps = { type NavButtonProps = {
txHash: string | undefined; txHash: string | null | undefined;
disabled?: boolean; disabled?: boolean;
}; };
@ -12,7 +12,7 @@ const NavButton: React.FC<NavButtonProps> = ({
disabled, disabled,
children, children,
}) => { }) => {
if (disabled || txHash === undefined) { if (disabled || txHash === null || txHash === undefined) {
return ( return (
<span className="bg-link-blue bg-opacity-10 text-gray-300 rounded px-2 py-1 text-xs"> <span className="bg-link-blue bg-opacity-10 text-gray-300 rounded px-2 py-1 text-xs">
{children} {children}

View File

@ -530,7 +530,7 @@ const getTransactionBySenderAndNonceFetcher = async ({
provider, provider,
sender, sender,
nonce, nonce,
}: TransactionBySenderAndNonceKey): Promise<string | undefined> => { }: TransactionBySenderAndNonceKey): Promise<string | null | undefined> => {
if (nonce < 0) { if (nonce < 0) {
return undefined; return undefined;
} }
@ -541,10 +541,6 @@ const getTransactionBySenderAndNonceFetcher = async ({
])) as string; ])) as string;
// Empty or success // Empty or success
if (result === "0x") {
return undefined;
}
return result; return result;
}; };
@ -564,9 +560,9 @@ export const useTransactionBySenderAndNonce = (
provider: JsonRpcProvider | undefined, provider: JsonRpcProvider | undefined,
sender: ChecksummedAddress | undefined, sender: ChecksummedAddress | undefined,
nonce: number | undefined nonce: number | undefined
): string | undefined => { ): string | null | undefined => {
const { data, error } = useSWR< const { data, error } = useSWR<
string | undefined, string | null | undefined,
any, any,
TransactionBySenderAndNonceKey | null TransactionBySenderAndNonceKey | null
>( >(