fix: remove duplicate metdata caused by searching all whitelisted creators for the store

This commit is contained in:
Kyle Espinola 2021-09-27 17:23:55 -07:00
parent 301e832f27
commit fc94a8a2af
3 changed files with 10 additions and 1 deletions

1
js/.tool-versions Normal file
View File

@ -0,0 +1 @@
nodejs 14.17.1

View File

@ -19,6 +19,7 @@ import {
decodeMetadata,
getAuctionExtended,
} from '../../actions';
import { uniqWith } from 'lodash';
import { WhitelistedCreator } from '../../models/metaplex';
import { Connection, PublicKey } from '@solana/web3.js';
import {
@ -304,7 +305,11 @@ export const loadAccounts = async (connection: Connection) => {
await Promise.all(loading);
console.log('Metadata size', state.metadata.length);
state.metadata = uniqWith(
state.metadata,
(a: ParsedAccount<Metadata>, b: ParsedAccount<Metadata>) =>
a.pubkey === b.pubkey,
);
return state;
};

View File

@ -1,3 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.