@@ -27,12 +27,9 @@ import { useTxNotifications } from "hooks/useTxNotifications";
2727import { CircleAlertIcon } from "lucide-react" ;
2828import { useCallback } from "react" ;
2929import { useForm } from "react-hook-form" ;
30- import {
31- type PreparedTransaction ,
32- prepareContractCall ,
33- sendAndConfirmTransaction ,
34- } from "thirdweb" ;
30+ import { type PreparedTransaction , sendAndConfirmTransaction } from "thirdweb" ;
3531import { MintableERC721 , MintableERC1155 } from "thirdweb/modules" ;
32+ import { grantRoles , hasAllRoles } from "thirdweb/modules" ;
3633import { useReadContract } from "thirdweb/react" ;
3734import type { NFTMetadataInputLimited } from "types/modified-types" ;
3835import { parseAttributes } from "utils/parseAttributes" ;
@@ -79,10 +76,10 @@ function MintableModule(props: ModuleInstanceProps) {
7976 contract : contract ,
8077 } ,
8178 ) ;
82- const hasMinterRole = useReadContract ( {
79+ const hasMinterRole = useReadContract ( hasAllRoles , {
8380 contract : contract ,
84- method : "function hasAllRoles( address user, uint256 roles) returns (bool) ",
85- params : [ ownerAccount ?. address || "" , MINTER_ROLE ] ,
81+ user : ownerAccount ?. address || " ",
82+ roles : MINTER_ROLE ,
8683 } ) ;
8784
8885 const isBatchMetadataInstalled = ! ! props . allModuleContractInfo . find (
@@ -97,10 +94,10 @@ function MintableModule(props: ModuleInstanceProps) {
9794 }
9895
9996 if ( ! hasMinterRole . data ) {
100- const grantRoleTx = prepareContractCall ( {
97+ const grantRoleTx = grantRoles ( {
10198 contract,
102- method : "function grantRoles( address user, uint256 roles)" ,
103- params : [ ownerAccount . address , MINTER_ROLE ] ,
99+ user : ownerAccount . address ,
100+ roles : MINTER_ROLE ,
104101 } ) ;
105102
106103 await sendAndConfirmTransaction ( {
0 commit comments