Skip to content

Commit 4baefa5

Browse files
committed
Dashboard: transfer tab disabled for owner of nft (#6827)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR enhances the `useNFTDrawerTabs` function by improving the owner address comparison for NFTs. It now uses the `checksumAddress` utility to ensure that both the NFT owner and the account address are valid checksummed addresses before comparing them. ### Detailed summary - Added import for `checksumAddress` from `thirdweb/utils`. - Updated the owner address comparison in the `useNFTDrawerTabs` function to use `checksumAddress`. - Ensured that both `accountAddress` and `nft.owner` are checked for validity before comparison. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent b2e56f8 commit 4baefa5

File tree

1 file changed

+6
-1
lines changed
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]

1 file changed

+6
-1
lines changed

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/useNftDrawerTabs.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { ThirdwebContract } from "thirdweb";
66
import * as ERC721Ext from "thirdweb/extensions/erc721";
77
import * as ERC1155Ext from "thirdweb/extensions/erc1155";
88
import { useReadContract } from "thirdweb/react";
9+
import { checksumAddress } from "thirdweb/utils";
910
import type { NFTDrawerTab } from "./types";
1011

1112
type UseNFTDrawerTabsParams = {
@@ -108,7 +109,11 @@ export function useNFTDrawerTabs({
108109
return true;
109110
}
110111
if (isERC721) {
111-
return nft?.owner === accountAddress;
112+
return (
113+
accountAddress &&
114+
nft?.owner &&
115+
checksumAddress(nft.owner) === checksumAddress(accountAddress)
116+
);
112117
}
113118
return false;
114119
})();

0 commit comments

Comments
 (0)