diff --git a/packages/indexer-agent/src/syncing-server.ts b/packages/indexer-agent/src/syncing-server.ts index abda6c5d7..4be36ef10 100644 --- a/packages/indexer-agent/src/syncing-server.ts +++ b/packages/indexer-agent/src/syncing-server.ts @@ -82,7 +82,7 @@ export const createSyncingServer = async ({ let result try { - result = await networkSubgraph.query(parsedQuery, variables) + result = await networkSubgraph.checkedQuery(parsedQuery, variables) } catch (err) { logger.error(err) return res.status(400).send({ error: err.message }) diff --git a/packages/indexer-common/src/indexer-management/monitor.ts b/packages/indexer-common/src/indexer-management/monitor.ts index 255a14320..332173063 100644 --- a/packages/indexer-common/src/indexer-management/monitor.ts +++ b/packages/indexer-common/src/indexer-management/monitor.ts @@ -60,7 +60,7 @@ export class NetworkMonitor { } async allocation(allocationID: string): Promise { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query allocation($allocation: String!) { allocation(id: $allocation) { @@ -100,7 +100,7 @@ export class NetworkMonitor { async allocations(status: AllocationStatus): Promise { try { this.logger.debug(`Fetch ${status} allocations`) - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query allocations($indexer: String!, $status: AllocationStatus!) { allocations( @@ -161,7 +161,7 @@ export class NetworkMonitor { async epochs(epochNumbers: number[]): Promise { try { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query epochs($epochs: [Int!]!) { epoches(where: { id_in: $epochs }, first: 1000) { @@ -201,7 +201,7 @@ export class NetworkMonitor { ): Promise { try { this.logger.debug('Fetch recently closed allocations') - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query allocations($indexer: String!, $closedAtEpochThreshold: Int!) { allocations( @@ -264,7 +264,7 @@ export class NetworkMonitor { subgraphDeploymentId: SubgraphDeploymentID, ): Promise { try { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query allocations($indexer: String!, $subgraphDeploymentId: String!) { allocations( @@ -350,7 +350,7 @@ export class NetworkMonitor { subgraphIds: ids, }) try { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query subgraphs($first: Int!, $lastCreatedAt: Int!, $subgraphs: [String!]!) { subgraphs( @@ -436,7 +436,7 @@ export class NetworkMonitor { async subgraphDeployment(ipfsHash: string): Promise { try { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query subgraphDeployments($ipfsHash: String!) { subgraphDeployments(where: { ipfsHash: $ipfsHash }) { @@ -494,7 +494,7 @@ export class NetworkMonitor { async transferredDeployments(): Promise { this.logger.debug('Querying the Network for transferred subgraph deployments') try { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( // TODO: Consider querying for the same time range as the Agent's evaluation, limiting // results to recent transfers. gql` @@ -592,7 +592,7 @@ export class NetworkMonitor { queryProgress: queryProgress, }) try { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query subgraphDeployments($first: Int!, $lastCreatedAt: Int!) { subgraphDeployments( @@ -670,7 +670,7 @@ export class NetworkMonitor { const queryEpochSubgraph = async () => { // We know it is non-null because of the check above for a null case that will end execution of fn if true // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const result = await this.epochSubgraph!.query( + const result = await this.epochSubgraph!.checkedQuery( gql` query network($networkID: String!) { network(id: $networkID) { @@ -935,7 +935,7 @@ Please submit an issue at https://github.com/graphprotocol/block-oracle/issues/n .reduce(async (currentlyPaused) => { try { logger.debug('Query network subgraph isPaused state') - const result = await networkSubgraph.query( + const result = await networkSubgraph.checkedQuery( gql` { graphNetworks { @@ -1013,7 +1013,7 @@ Please submit an issue at https://github.com/graphprotocol/block-oracle/issues/n closedAtEpoch_lte: disputableEpoch, queryFeesCollected_gte: this.indexerOptions.rebateClaimThreshold.toString(), }) - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query allocations( $indexer: String! @@ -1127,7 +1127,7 @@ Please submit an issue at https://github.com/graphprotocol/block-oracle/issues/n const disputableEpoch = currentEpoch - this.indexerOptions.poiDisputableEpochs let lastCreatedAt = 0 while (dataRemaining) { - const result = await this.networkSubgraph.query( + const result = await this.networkSubgraph.checkedQuery( gql` query allocations( $deployments: [String!]! diff --git a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts index 2a852b4a5..81520f12a 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts @@ -241,7 +241,10 @@ async function queryAllocations( ) } - const result = await networkSubgraph.query(ALLOCATION_QUERIES[filterType], filterVars) + const result = await networkSubgraph.checkedQuery( + ALLOCATION_QUERIES[filterType], + filterVars, + ) if (result.data.allocations.length == 0) { logger.info(`No 'Claimable' allocations found`) diff --git a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts b/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts index 6b4d83a1d..3564fe605 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts @@ -124,7 +124,7 @@ export default { const address = network.specification.indexerOptions.address try { - const result = await network.networkSubgraph.query( + const result = await network.networkSubgraph.checkedQuery( gql` query allocations($indexer: String!) { allocations( diff --git a/packages/indexer-common/src/transactions.ts b/packages/indexer-common/src/transactions.ts index 1b0477f68..db08b8621 100644 --- a/packages/indexer-common/src/transactions.ts +++ b/packages/indexer-common/src/transactions.ts @@ -326,7 +326,7 @@ export class TransactionManager { return timer(60_000) .reduce(async (currentlyPaused) => { try { - const result = await networkSubgraph.query( + const result = await networkSubgraph.checkedQuery( gql` { graphNetworks { diff --git a/packages/indexer-service/src/allocations.ts b/packages/indexer-service/src/allocations.ts index 87b238334..22aee525a 100644 --- a/packages/indexer-service/src/allocations.ts +++ b/packages/indexer-service/src/allocations.ts @@ -38,7 +38,7 @@ export const monitorEligibleAllocations = ({ logger.debug('Refresh eligible allocations') try { - const currentEpochResult = await networkSubgraph.query( + const currentEpochResult = await networkSubgraph.checkedQuery( gql` query { graphNetwork(id: "1") { @@ -61,7 +61,7 @@ export const monitorEligibleAllocations = ({ const currentEpoch = currentEpochResult.data.graphNetwork.currentEpoch - const result = await networkSubgraph.query( + const result = await networkSubgraph.checkedQuery( gql` query allocations($indexer: String!, $closedAtEpochThreshold: Int!) { indexer(id: $indexer) {