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
type NavButtonProps = {
txHash: string | undefined;
txHash: string | null | undefined;
disabled?: boolean;
};
@ -12,7 +12,7 @@ const NavButton: React.FC<NavButtonProps> = ({
disabled,
children,
}) => {
if (disabled || txHash === undefined) {
if (disabled || txHash === null || txHash === undefined) {
return (
<span className="bg-link-blue bg-opacity-10 text-gray-300 rounded px-2 py-1 text-xs">
{children}

View File

@ -530,7 +530,7 @@ const getTransactionBySenderAndNonceFetcher = async ({
provider,
sender,
nonce,
}: TransactionBySenderAndNonceKey): Promise<string | undefined> => {
}: TransactionBySenderAndNonceKey): Promise<string | null | undefined> => {
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
>(