From 5b467ce8f505cbe80114bba07a556ad4250eda72 Mon Sep 17 00:00:00 2001 From: Kien Ngo Date: Sun, 4 Aug 2024 18:46:40 -0400 Subject: [PATCH] update --- .../tabs/tokens/components/mint-button.tsx | 25 +++++++++++-------- .../src/contract-ui/tabs/tokens/page.tsx | 8 ++++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/apps/dashboard/src/contract-ui/tabs/tokens/components/mint-button.tsx b/apps/dashboard/src/contract-ui/tabs/tokens/components/mint-button.tsx index 7e4d7b1201c..0dba71774b0 100644 --- a/apps/dashboard/src/contract-ui/tabs/tokens/components/mint-button.tsx +++ b/apps/dashboard/src/contract-ui/tabs/tokens/components/mint-button.tsx @@ -1,8 +1,11 @@ import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only"; import { Icon, useDisclosure } from "@chakra-ui/react"; -import type { TokenContract, useContract } from "@thirdweb-dev/react"; +import type { useContract } from "@thirdweb-dev/react"; import { detectFeatures } from "components/contract-components/utils"; +import { thirdwebClient } from "lib/thirdweb-client"; +import { defineDashboardChain } from "lib/v5-adapter"; import { FiPlus } from "react-icons/fi"; +import { getContract } from "thirdweb"; import { Button, Drawer } from "tw-components"; import { TokenMintForm } from "./mint-form"; @@ -15,17 +18,19 @@ export const TokenMintButton: React.FC = ({ ...restButtonProps }) => { const { isOpen, onOpen, onClose } = useDisclosure(); - const isERC20Mintable = detectFeatures( - contractQuery.contract, - ["ERC20Mintable"], - ); - - if (!isERC20Mintable || !contractQuery.contract) { + const contractV4 = contractQuery.contract; + const contract = contractV4 + ? getContract({ + address: contractV4.getAddress(), + chain: defineDashboardChain(contractV4.chainId), + client: thirdwebClient, + }) + : null; + if (!contract || !contractV4) { return null; } - return ( - + = ({ onClose={onClose} isOpen={isOpen} > - +