Commit fd4414b
committed
[BLD-71] SDK, Dashboard: Fix Supplies shown in ERC721 contract (#7803)
<!--
## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"
If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):
## Notes for the reviewer
Anything important to call out? Be sure to also clarify these in your comments.
## How to test
Unit tests, playground, etc.
-->
<!-- start pr-codex -->
---
## PR-Codex overview
This PR updates the `getTotalClaimedSupply` and `getTotalUnclaimedSupply` functions in the ERC721 extensions to account for `startTokenId`, improving the accuracy of token supply calculations.
### Detailed summary
- Modified `getTotalClaimedSupply` to subtract `startTokenId` from `nextTokenIdToClaim`.
- Updated `getTotalUnclaimedSupply` to subtract `startTokenId` and `totalClaimedSupply` from `nextTokenIdToMint`.
- Changed imports in `supply-cards.tsx` to use the new supply functions.
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **Refactor**
* Improved supply calculations in NFT dashboards by directly using contract data instead of manual computations.
* Adjusted logic to accurately account for token ID offsets when displaying claimed and unclaimed NFT supply.
* **Bug Fixes**
* Resolved inconsistencies in claimed and unclaimed NFT supply values when contracts use a custom starting token ID.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent d10436d commit fd4414b
File tree
4 files changed
+35
-29
lines changed- .changeset
- apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components
- packages/thirdweb/src/extensions/erc721/read
4 files changed
+35
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 14 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
| 20 | + | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
36 | 27 | | |
37 | 28 | | |
38 | 29 | | |
39 | 30 | | |
40 | | - | |
| 31 | + | |
41 | 32 | | |
42 | | - | |
| 33 | + | |
43 | 34 | | |
44 | 35 | | |
45 | | - | |
| 36 | + | |
46 | 37 | | |
47 | | - | |
| 38 | + | |
48 | 39 | | |
49 | 40 | | |
50 | | - | |
| 41 | + | |
51 | 42 | | |
52 | | - | |
| 43 | + | |
53 | 44 | | |
54 | 45 | | |
55 | 46 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
Lines changed: 9 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
0 commit comments