fix: after update master
This commit is contained in:
parent
921abd3890
commit
06a10a4025
|
@ -25,8 +25,8 @@ import { processMetaplexAccounts } from './processMetaplexAccounts';
|
|||
import { processMetaData } from './processMetaData';
|
||||
import { processVaultData } from './processVaultData';
|
||||
import { ParsedAccount } from '../accounts/types';
|
||||
import { getMultipleAccounts } from '../accounts';
|
||||
import { getEmptyMetaState } from './getEmptyMetaState';
|
||||
import { getMultipleAccounts } from '../accounts/getMultipleAccounts';
|
||||
|
||||
async function getProgramAccounts(
|
||||
connection: Connection,
|
||||
|
@ -93,35 +93,9 @@ export const loadAccounts = async (connection: Connection, all: boolean) => {
|
|||
}
|
||||
};
|
||||
|
||||
const additionalPromises: Promise<void>[] = [];
|
||||
|
||||
const IS_BIG_STORE =
|
||||
process.env.NEXT_PUBLIC_BIG_STORE?.toLowerCase() === 'true';
|
||||
console.log(`Is big store: ${IS_BIG_STORE}`);
|
||||
|
||||
const promises = [
|
||||
getProgramAccounts(connection, VAULT_ID).then(forEach(processVaultData)),
|
||||
getProgramAccounts(connection, AUCTION_ID).then(forEach(processAuctions)),
|
||||
getProgramAccounts(connection, METAPLEX_ID).then(
|
||||
forEach(processMetaplexAccounts),
|
||||
),
|
||||
IS_BIG_STORE
|
||||
? getProgramAccounts(connection, METADATA_PROGRAM_ID).then(
|
||||
forEach(processMetaData),
|
||||
)
|
||||
: undefined,
|
||||
getProgramAccounts(connection, METAPLEX_ID, {
|
||||
filters: [
|
||||
{
|
||||
dataSize: MAX_WHITELISTED_CREATOR_SIZE,
|
||||
},
|
||||
],
|
||||
}).then(async creators => {
|
||||
const result = await forEach(processMetaplexAccounts)(creators);
|
||||
|
||||
if (IS_BIG_STORE) {
|
||||
return result;
|
||||
}
|
||||
let isSelectivePullMetadata = false;
|
||||
const pullMetadata = async (creators: AccountAndPubkey[]) => {
|
||||
await forEach(processMetaplexAccounts)(creators);
|
||||
|
||||
const whitelistedCreators = Object.values(
|
||||
tempCache.whitelistedCreatorsByCreator,
|
||||
|
@ -136,6 +110,7 @@ export const loadAccounts = async (connection: Connection, all: boolean) => {
|
|||
);
|
||||
} else {
|
||||
console.log('pulling optimized nfts');
|
||||
isSelectivePullMetadata = true;
|
||||
|
||||
for (let i = 0; i < MAX_CREATOR_LIMIT; i++) {
|
||||
for (let j = 0; j < whitelistedCreators.length; j++) {
|
||||
|
@ -167,15 +142,9 @@ export const loadAccounts = async (connection: Connection, all: boolean) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
];
|
||||
await Promise.all(promises);
|
||||
await Promise.all(additionalPromises);
|
||||
};
|
||||
|
||||
await postProcessMetadata(tempCache, all);
|
||||
console.log('Metadata size', tempCache.metadata.length);
|
||||
|
||||
if (additionalPromises.length > 0) {
|
||||
const pullEditions = async () => {
|
||||
console.log('Pulling editions for optimized metadata');
|
||||
let setOf100MetadataEditionKeys: string[] = [];
|
||||
const editionPromises: Promise<{
|
||||
|
@ -241,6 +210,39 @@ export const loadAccounts = async (connection: Connection, all: boolean) => {
|
|||
Object.keys(tempCache.editions).length,
|
||||
Object.keys(tempCache.masterEditions).length,
|
||||
);
|
||||
};
|
||||
|
||||
const IS_BIG_STORE =
|
||||
all || process.env.NEXT_PUBLIC_BIG_STORE?.toLowerCase() === 'true';
|
||||
console.log(`Is big store: ${IS_BIG_STORE}`);
|
||||
|
||||
const additionalPromises: Promise<void>[] = [];
|
||||
const basePromises = [
|
||||
getProgramAccounts(connection, VAULT_ID).then(forEach(processVaultData)),
|
||||
getProgramAccounts(connection, AUCTION_ID).then(forEach(processAuctions)),
|
||||
getProgramAccounts(connection, METAPLEX_ID).then(
|
||||
forEach(processMetaplexAccounts),
|
||||
),
|
||||
IS_BIG_STORE
|
||||
? getProgramAccounts(connection, METADATA_PROGRAM_ID).then(
|
||||
forEach(processMetaData),
|
||||
)
|
||||
: getProgramAccounts(connection, METAPLEX_ID, {
|
||||
filters: [
|
||||
{
|
||||
dataSize: MAX_WHITELISTED_CREATOR_SIZE,
|
||||
},
|
||||
],
|
||||
}).then(pullMetadata),
|
||||
];
|
||||
await Promise.all(basePromises);
|
||||
await Promise.all(additionalPromises);
|
||||
|
||||
await postProcessMetadata(tempCache, all);
|
||||
console.log('Metadata size', tempCache.metadata.length);
|
||||
|
||||
if (isSelectivePullMetadata) {
|
||||
await pullEditions();
|
||||
}
|
||||
|
||||
return tempCache;
|
||||
|
@ -272,6 +274,7 @@ export const metadataByMintUpdater = async (
|
|||
) => {
|
||||
const key = metadata.info.mint;
|
||||
if (
|
||||
all ||
|
||||
isMetadataPartOfStore(
|
||||
metadata,
|
||||
state.store,
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
import { WhitelistedCreator } from '@oyster/common/dist/lib/models';
|
||||
import names from '../config/userNames.json';
|
||||
|
||||
export const extendCreatorName = (creator: WhitelistedCreator) => {
|
||||
const nameInfo = (names as any)[creator.address.toBase58()];
|
||||
|
||||
return { ...creator, ...nameInfo };
|
||||
};
|
Loading…
Reference in New Issue