Skip to content

Commit

Permalink
fix queryJob
Browse files Browse the repository at this point in the history
  • Loading branch information
defi-dev committed Sep 25, 2024
1 parent c73bcd3 commit 577ea5c
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions app/dataSources/SubquerySource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { SubgraphSource } from './SubgraphSource.js';
import { Network } from '../Network.js';
import { IAgent } from '../Types.js';

export const QUERY_ALL_JOBS = `{
jobs(first: 1000) {
nodes {
const jobFields = `
id
active
jobAddress
Expand All @@ -31,7 +29,13 @@ export const QUERY_ALL_JOBS = `{
jobNextKeeperId
jobReservedSlasherId
jobSlashingPossibleAfter
}
`;

export const QUERY_ALL_JOBS = `{
jobs(first: 1000) {
nodes {
${jobFields}
}
}
}`;

Expand Down Expand Up @@ -74,4 +78,15 @@ export class SubquerySource extends SubgraphSource {
async queryJobOwners() {
return this.query(this.subgraphUrl, QUERY_JOB_OWNERS).then(res => res.jobOwners.nodes);
}

async queryJob(jobKey) {
return this.query(
this.subgraphUrl,
`{
job(id: "${jobKey}") {
${jobFields}
}
}`,
).then(res => res.job);
}
}

0 comments on commit 577ea5c

Please sign in to comment.