From f6e750f420f53372291a01e9d159c80dc5668ebb Mon Sep 17 00:00:00 2001 From: prathamesh0 <42446521+prathamesh0@users.noreply.github.com> Date: Wed, 5 Oct 2022 19:16:11 +0530 Subject: [PATCH] Avoid filtering singular entities using mainnet addresses in demo mode (#371) --- packages/uni-info-watcher/src/resolvers.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/uni-info-watcher/src/resolvers.ts b/packages/uni-info-watcher/src/resolvers.ts index 1b4835ea..898c45c5 100644 --- a/packages/uni-info-watcher/src/resolvers.ts +++ b/packages/uni-info-watcher/src/resolvers.ts @@ -79,7 +79,13 @@ export const createResolvers = async (indexer: Indexer, eventWatcher: EventWatch gqlTotalQueryCount.inc(1); gqlQueryCount.labels('bundles').inc(1); - return indexer.getEntities(Bundle, block, { id: BUNDLE_ID }, { limit: first }); + let where = {}; + if (!indexer._isDemo) { + // Filter using address deployed on mainnet if not in demo mode + where = { id: BUNDLE_ID }; + } + + return indexer.getEntities(Bundle, block, where, { limit: first }); }, burns: async ( @@ -110,7 +116,13 @@ export const createResolvers = async (indexer: Indexer, eventWatcher: EventWatch gqlTotalQueryCount.inc(1); gqlQueryCount.labels('factories').inc(1); - return indexer.getEntities(Factory, block, { id: FACTORY_ADDRESS }, { limit: first }); + let where = {}; + if (!indexer._isDemo) { + // Filter using address deployed on mainnet if not in demo mode + where = { id: FACTORY_ADDRESS }; + } + + return indexer.getEntities(Factory, block, where, { limit: first }); }, mints: async (