Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandersazonof committed Feb 22, 2024
1 parent 25f1bcf commit 5d7ca02
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 52 deletions.
23 changes: 0 additions & 23 deletions scripts/graphql/all-user-balance-from-block.ts

This file was deleted.

30 changes: 1 addition & 29 deletions scripts/graphql/graph-service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { UserBalanceHistoryEntity, UserEntity } from '../../generated/gql';
import { UserEntity } from '../../generated/gql';
import { ApolloClient, createHttpLink, InMemoryCache } from '@apollo/client/core';
import { getAllUserBlockFromBlockQuery } from './all-user-balance-from-block';
import { getAllUsersOnBlockQuery } from './all-users-on-block';

function getSubgraphUrl() {
Expand Down Expand Up @@ -41,31 +40,4 @@ export async function getAllUsersOnBlock(block: number): Promise<UserEntity[]> {
}

return allUsers;
}

export async function getAllUserBalanceByBlock(startBlock: number): Promise<UserBalanceHistoryEntity[]> {
let allData: UserBalanceHistoryEntity[] = [];
let lastBlockNumber = startBlock;
let fetchMore = true;

while (fetchMore) {
const { data } = await client.query({
variables: { lastBlockNumber },
query: getAllUserBlockFromBlockQuery(),
});

const entries = data.userBalanceHistoryEntities;
if (entries.length === 0) {
fetchMore = false;
} else {
allData = [...allData, ...entries];
if (entries.length === 1000) {
lastBlockNumber = entries[entries.length - 1].blockNumber;
} else {
lastBlockNumber = entries[entries.length - 1].blockNumber - 1;
}
}
}

return allData;
}

0 comments on commit 5d7ca02

Please sign in to comment.