Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/olive-waves-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/sdk": patch
---

[SDK] Improve concurrent requests on NFT-related code
6 changes: 4 additions & 2 deletions packages/sdk/src/evm/common/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ export async function fetchTokenMetadataForContract(
ERC165MetadataAbi,
provider,
) as IERC165;
const isERC721 = await erc165.supportsInterface(InterfaceId_IERC721);
const isERC1155 = await erc165.supportsInterface(InterfaceId_IERC1155);
const [isERC721, isERC1155] = await Promise.all([
erc165.supportsInterface(InterfaceId_IERC721),
erc165.supportsInterface(InterfaceId_IERC1155),
]);
if (isERC721) {
const erc721 = new Contract(
contractAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ export class NFTDrop extends StandardErc721<PrebuiltNFTDrop> {
* Get the total count NFTs in this drop contract, both claimed and unclaimed
*/
override async totalSupply() {
const claimed = await this.totalClaimedSupply();
const unclaimed = await this.totalUnclaimedSupply();
const [claimed, unclaimed] = await Promise.all([
this.totalClaimedSupply(),
this.totalUnclaimedSupply(),
]);
return claimed.add(unclaimed);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ export class SignatureDrop extends StandardErc721<SignatureDropContract> {
* Get the total count NFTs in this drop contract, both claimed and unclaimed
*/
override async totalSupply() {
const claimed = await this.totalClaimedSupply();
const unclaimed = await this.totalUnclaimedSupply();
const [claimed, unclaimed] = await Promise.all([
this.totalClaimedSupply(),
this.totalUnclaimedSupply(),
]);
return claimed.add(unclaimed);
}

Expand Down