Skip to content

Commit e718e4b

Browse files
committed
updated mintable to use the extensions
1 parent 6dab6b8 commit e718e4b

File tree

2 files changed

+8
-12
lines changed
  • apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components
  • packages/thirdweb/src/extensions/modules/MintableERC1155

2 files changed

+8
-12
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/Mintable.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@ import { useTxNotifications } from "hooks/useTxNotifications";
2727
import { CircleAlertIcon } from "lucide-react";
2828
import { useCallback } from "react";
2929
import { useForm } from "react-hook-form";
30-
import {
31-
type PreparedTransaction,
32-
prepareContractCall,
33-
sendAndConfirmTransaction,
34-
} from "thirdweb";
30+
import { type PreparedTransaction, sendAndConfirmTransaction } from "thirdweb";
3531
import { MintableERC721, MintableERC1155 } from "thirdweb/modules";
32+
import { grantRoles, hasAllRoles } from "thirdweb/modules";
3633
import { useReadContract } from "thirdweb/react";
3734
import type { NFTMetadataInputLimited } from "types/modified-types";
3835
import { 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({

packages/thirdweb/src/extensions/modules/MintableERC1155/mintWithRole.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export function mintWithRole(
5555
}
5656

5757
const tokenId = options.tokenId ?? maxUint256;
58-
console.log("tokenId: ", tokenId);
5958
return {
6059
to: getAddress(options.to),
6160
tokenId,

0 commit comments

Comments
 (0)