Skip to content

Commit

Permalink
fix: check if tier id is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
aramalipoor committed Sep 30, 2022
1 parent 52dfcb3 commit 5dc359d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { BigNumber, BigNumberish } from 'ethers';
import { useCallback, useEffect, useMemo, useState } from 'react';

import { PredefinedReadContractConfig, useContractRead } from '../../../common';
import { Tier } from '../types';
import { useSaleTierConfig } from './useSaleTierConfig';
import { useTieredSalesTotalMinted } from './useTieredSalesTotalMinted';

Expand Down Expand Up @@ -54,13 +53,13 @@ export const useTieredSalesRemainingSupply = ({
setError(undefined);

const remainingSupply = await hook.call(
tierId ? { args: [tierId] } : undefined,
tierId !== undefined ? { args: [tierId] } : undefined,
);
const tierInfo = await getTierInfo(
tierId ? { args: [tierId] } : undefined,
tierId !== undefined ? { args: [tierId] } : undefined,
);
const tierMinted = await getTierTotalMinted(
tierId ? { args: [tierId] } : undefined,
tierId !== undefined ? { args: [tierId] } : undefined,
);

if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { TransactionResponse } from '@ethersproject/abstract-provider';
import { TransactionReceipt } from '@ethersproject/providers';
import { Environment, ZERO_ADDRESS } from '@flair-sdk/common';
import { Environment } from '@flair-sdk/common';
import { BigNumber, BigNumberish, BytesLike } from 'ethers';
import * as React from 'react';
import { ReactNode, useCallback, useEffect, useMemo, useState } from 'react';
import { ReactNode, useCallback, useEffect, useState } from 'react';
import { useAccount } from 'wagmi';

import { useTieredSalesMinter as useTieredSalesMinter } from '../hooks';
Expand Down Expand Up @@ -107,7 +107,7 @@ export const TieredSalesProvider = ({

const { data: account } = useAccount();
const [currentTierId, setCurrentTierId] = useState<BigNumberish | undefined>(
tierId ? Number(tierId.toString()) : undefined,
tierId !== undefined ? Number(tierId.toString()) : undefined,
);
const [maxSupply, setMaxSupply] = useState<BigNumberish>(Infinity);
const [autoDetectedTierId, setAutoDetectedTierId] = useState<BigNumberish>();
Expand Down

0 comments on commit 5dc359d

Please sign in to comment.