File tree Expand file tree Collapse file tree 3 files changed +19
-7
lines changed
apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -58,14 +58,15 @@ export type MintFormValues = NFTMetadataInputLimited & {
5858function MintableModule ( props : ModuleInstanceProps ) {
5959 const { contract, ownerAccount } = props ;
6060
61+ const isErc721 = props . contractInfo . name === "MintableERC721" ;
62+
6163 const primarySaleRecipientQuery = useReadContract (
62- MintableERC721 . getSaleConfig ,
64+ isErc721 ? MintableERC721 . getSaleConfig : MintableERC1155 . getSaleConfig ,
6365 {
6466 contract : contract ,
6567 } ,
6668 ) ;
6769
68- const isErc721 = props . contractInfo . name === "MintableERC721" ;
6970 const isBatchMetadataInstalled = ! ! props . allModuleContractInfo . find (
7071 ( module ) => module . name . includes ( "BatchMetadata" ) ,
7172 ) ;
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ import { CircleAlertIcon } from "lucide-react";
2424import { useCallback } from "react" ;
2525import { useForm } from "react-hook-form" ;
2626import { sendAndConfirmTransaction } from "thirdweb" ;
27- import { RoyaltyERC721 } from "thirdweb/modules" ;
27+ import { RoyaltyERC721 , RoyaltyERC1155 } from "thirdweb/modules" ;
2828import { useReadContract } from "thirdweb/react" ;
2929import { z } from "zod" ;
3030import { addressSchema } from "../zod-schemas" ;
@@ -34,14 +34,20 @@ import type { ModuleInstanceProps } from "./module-instance";
3434function RoyaltyModule ( props : ModuleInstanceProps ) {
3535 const { contract, ownerAccount } = props ;
3636
37+ const isErc721 = props . contractInfo . name === "RoyaltyERC721" ;
38+
3739 const defaultRoyaltyInfoQuery = useReadContract (
38- RoyaltyERC721 . getDefaultRoyaltyInfo ,
40+ isErc721
41+ ? RoyaltyERC721 . getDefaultRoyaltyInfo
42+ : RoyaltyERC1155 . getDefaultRoyaltyInfo ,
3943 {
4044 contract : contract ,
4145 } ,
4246 ) ;
4347 const transferValidatorQuery = useReadContract (
44- RoyaltyERC721 . getTransferValidator ,
48+ isErc721
49+ ? RoyaltyERC721 . getTransferValidator
50+ : RoyaltyERC1155 . getTransferValidator ,
4551 {
4652 contract : contract ,
4753 } ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import { useCallback } from "react";
2222import { useFieldArray , useForm } from "react-hook-form" ;
2323import { toast } from "sonner" ;
2424import { sendAndConfirmTransaction } from "thirdweb" ;
25- import { TransferableERC721 } from "thirdweb/modules" ;
25+ import { TransferableERC721 , TransferableERC1155 } from "thirdweb/modules" ;
2626import { useReadContract } from "thirdweb/react" ;
2727import { z } from "zod" ;
2828import { addressSchema } from "../zod-schemas" ;
@@ -42,8 +42,13 @@ export type TransferableModuleFormValues = z.infer<typeof formSchema>;
4242
4343function TransferableModule ( props : ModuleInstanceProps ) {
4444 const { contract, ownerAccount } = props ;
45+
46+ const isErc721 = props . contractInfo . name === "TransferableERC721" ;
47+
4548 const isTransferEnabledQuery = useReadContract (
46- TransferableERC721 . isTransferEnabled ,
49+ isErc721
50+ ? TransferableERC721 . isTransferEnabled
51+ : TransferableERC1155 . isTransferEnabled ,
4752 {
4853 contract,
4954 } ,
You can’t perform that action at this time.
0 commit comments