diff --git a/Makefile b/Makefile index c785a18..315f0be 100644 --- a/Makefile +++ b/Makefile @@ -106,4 +106,7 @@ query_endpoints_full_tests_staging: cd tests/query_endpoints && make query_endpoints_full_tests_staging query_endpoints_full_tests_testnet: - cd tests/query_endpoints && make query_endpoints_full_tests_testnet \ No newline at end of file + cd tests/query_endpoints && make query_endpoints_full_tests_testnet + +query_endpoints_full_tests_mainnet: + cd tests/query_endpoints && make query_endpoints_full_tests_mainnet \ No newline at end of file diff --git a/src/query/handlers/index/indexProvidersActiveHandler.ts b/src/query/handlers/index/indexProvidersActiveHandler.ts index 208b978..0697c10 100644 --- a/src/query/handlers/index/indexProvidersActiveHandler.ts +++ b/src/query/handlers/index/indexProvidersActiveHandler.ts @@ -131,7 +131,7 @@ class IndexProvidersActiveData extends RequestHandlerBase { - const data = await QueryGetJsinfoReadDbInstance() + const data1 = QueryGetJsinfoReadDbInstance() .select({ provider: JsinfoSchema.providerStakes.provider, }) @@ -154,10 +154,15 @@ class IndexProvidersActiveData extends RequestHandlerBase`MAX(${JsinfoProviderAgrSchema.aggDailyRelayPayments.dateday})`, sql`NOW() - INTERVAL '30 day'`), - gt(sql`COALESCE(SUM(${JsinfoProviderAgrSchema.aggDailyRelayPayments.relaySum}), 0)`, 100) + gt(sql`COALESCE(SUM(${JsinfoProviderAgrSchema.aggDailyRelayPayments.relaySum}), 0)`, 1) ) ) + console.log("data1.toSQL()", data1.toSQL()) + + const data = await data1; + console.log("getActiveProviderAddresses", data) + return data.map(item => item.provider).filter((provider): provider is string => provider !== null); } @@ -193,13 +198,15 @@ class IndexProvidersActiveData extends RequestHandlerBase`COUNT(DISTINCT ${JsinfoSchema.providerStakes.provider})`, }) .from(JsinfoSchema.providerStakes) - .where(inArray(JsinfoSchema.providers.address, activeProviders)) + .where(inArray(JsinfoSchema.providerStakes.provider, activeProviders)) + console.log("res1", res1.toSQL()) + const res = await res1; return res[0].count || 0; }