Skip to content

Commit 451e663

Browse files
committed
[TOOL-4867] Fix Coin asset page crashing on maxUint256 as maxClaimableSupply
1 parent 9d6739e commit 451e663

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/_components/supply-claimed-progress.stories.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/nextjs";
2-
import { maxUint256 } from "thirdweb/utils";
3-
import { BadgeContainer } from "../../../../../../../../@/storybook/utils";
2+
import { BadgeContainer } from "@/storybook/utils";
43
import { SupplyClaimedProgress } from "./supply-claimed-progress";
54

65
const meta = {
@@ -19,7 +18,7 @@ function StoryVariants() {
1918
return (
2019
<div className="container max-w-md space-y-10 py-10">
2120
<BadgeContainer label="10 / Unlimited Supply">
22-
<SupplyClaimedProgress claimedSupply={10n} totalSupply={maxUint256} />
21+
<SupplyClaimedProgress claimedSupply={10n} totalSupply="unlimited" />
2322
</BadgeContainer>
2423

2524
<BadgeContainer label="500/1000 Supply">

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/_components/supply-claimed-progress.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { InfinityIcon } from "lucide-react";
2-
import { maxUint256 } from "thirdweb/utils";
32
import { Progress } from "@/components/ui/progress";
43
import { supplyFormatter } from "../nft/format";
54

65
export function SupplyClaimedProgress(props: {
76
claimedSupply: bigint;
8-
totalSupply: bigint;
7+
totalSupply: bigint | "unlimited";
98
}) {
109
// if total supply is unlimited
11-
if (props.totalSupply === maxUint256) {
10+
if (props.totalSupply === "unlimited") {
1211
return (
1312
<p className="flex items-center justify-between gap-2">
1413
<span className="font-medium text-sm">Claimed Supply </span>

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/claim-tokens/claim-tokens-ui.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
getApprovalForTransaction,
2727
} from "thirdweb/extensions/erc20";
2828
import { useActiveAccount, useSendTransaction } from "thirdweb/react";
29-
import { getClaimParams } from "thirdweb/utils";
29+
import { getClaimParams, maxUint256 } from "thirdweb/utils";
3030
import {
3131
reportAssetBuyFailed,
3232
reportAssetBuySuccessful,
@@ -328,9 +328,16 @@ export function TokenDropClaim(props: {
328328
claimedSupply={BigInt(
329329
toTokens(props.claimCondition.supplyClaimed, props.decimals),
330330
)}
331-
totalSupply={BigInt(
332-
toTokens(props.claimCondition.maxClaimableSupply, props.decimals),
333-
)}
331+
totalSupply={
332+
props.claimCondition.maxClaimableSupply === maxUint256
333+
? "unlimited"
334+
: BigInt(
335+
toTokens(
336+
props.claimCondition.maxClaimableSupply,
337+
props.decimals,
338+
),
339+
)
340+
}
334341
/>
335342

336343
<div className="h-4" />

0 commit comments

Comments
 (0)