chore: hide non NFTs

This commit is contained in:
bartosz-lipinski 2021-06-27 00:26:22 -05:00
parent be7f709b78
commit c185cad93d
2 changed files with 35 additions and 2 deletions

View File

@ -471,7 +471,7 @@ const queryExtendedMetadata = async (
MintParser,
false,
) as ParsedAccount<MintInfo>;
if (mint.info.supply.gt(new BN(1)) || mint.info.decimals !== 0) {
if (!mint.info.supply.eqn(1) || mint.info.decimals !== 0) {
// naive not NFT check
delete mintToMetadata[key];
} else {

View File

@ -5,7 +5,7 @@ import { useArt, useExtendedArt } from './../../hooks';
import './index.less';
import { ArtContent } from '../../components/ArtContent';
import { shortenAddress, useConnection, useWallet } from '@oyster/common';
import { shortenAddress, TokenAccount, useConnection, useUserAccounts, useWallet } from '@oyster/common';
import { MetaAvatar } from '../../components/MetaAvatar';
import { sendSignMetadata } from '../../actions/sendSignMetadata';
import { PublicKey } from '@solana/web3.js';
@ -15,10 +15,18 @@ const { Content } = Layout;
export const ArtView = () => {
const { id } = useParams<{ id: string }>();
const { wallet } = useWallet();
const connection = useConnection();
const art = useArt(id);
const { ref, data } = useExtendedArt(id);
// const { userAccounts } = useUserAccounts();
// const accountByMint = userAccounts.reduce((prev, acc) => {
// prev.set(acc.info.mint.toBase58(), acc);
// return prev;
// }, new Map<string, TokenAccount>());
const description = data?.description;
const pubkey = wallet?.publicKey?.toBase58() || '';
@ -79,6 +87,31 @@ export const ArtView = () => {
<span className="creator-name">
{creator.name || shortenAddress(creator.address || '')}
</span>
{/* <Button
onClick={async () => {
if(!art.mint) {
return;
}
const mint = new PublicKey(art.mint);
const account = accountByMint.get(art.mint);
if(!account) {
return;
}
const owner = wallet?.publicKey;
if(!owner) {
return;
}
const instructions: any[] = [];
await updateMetadata(undefined, undefined, true, mint, owner, instructions)
sendTransaction(connection, wallet, instructions, [], true);
}}
>
Mark as Sold
</Button> */}
<div style={{ marginLeft: 10 }}>
{!creator.verified &&
(creator.address === pubkey ? (