sdk-triggerx 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  import { TriggerXClient } from '../client';
2
- import { JobDataAPI } from '../types';
3
- export declare const getJobDataById: (client: TriggerXClient, jobId: string) => Promise<JobDataAPI>;
2
+ import { JobDataWithTasks } from '../types';
3
+ export declare const getJobDataById: (client: TriggerXClient, jobId: string) => Promise<JobDataWithTasks>;
@@ -5,16 +5,29 @@ exports.getJobDataById = void 0;
5
5
  const getJobDataById = async (client, jobId) => {
6
6
  const apiKey = client.getApiKey(); // Assuming you have a method to get the API key
7
7
  try {
8
- const response = await client.get(`/api/jobs/${jobId}`, {
8
+ // First, fetch the job data
9
+ const jobResponse = await client.get(`/api/jobs/${jobId}`, {
9
10
  headers: {
10
11
  'Content-Type': 'application/json',
11
12
  'X-API-KEY': apiKey,
12
13
  },
13
14
  });
14
- return response; // Assuming the response data matches the JobDataAPI interface
15
+ // Then, fetch the task data (logs) for this job
16
+ const taskResponse = await client.get(`/api/tasks/job/${jobId}`, {
17
+ headers: {
18
+ 'Content-Type': 'application/json',
19
+ 'X-API-KEY': apiKey,
20
+ },
21
+ });
22
+ // Combine both responses
23
+ const combinedResponse = {
24
+ jobData: jobResponse,
25
+ taskData: taskResponse
26
+ };
27
+ return combinedResponse;
15
28
  }
16
29
  catch (error) {
17
- console.error('Error fetching job data by ID:', error);
30
+ console.error('Error fetching job data and task data by ID:', error);
18
31
  throw error; // Rethrow the error for handling in the calling function
19
32
  }
20
33
  };
package/dist/api/jobs.js CHANGED
@@ -14,7 +14,7 @@ const topupTg_1 = require("./topupTg");
14
14
  const checkTgBalance_1 = require("./checkTgBalance");
15
15
  const JOB_ID = '300949528249665590178224313442040528409305273634097553067152835846309150732';
16
16
  const DYNAMIC_ARGS_URL = 'https://teal-random-koala-993.mypinata.cloud/ipfs/bafkreif426p7t7takzhw3g6we2h6wsvf27p5jxj3gaiynqf22p3jvhx4la';
17
- const JOB_REGISTRY_ADDRESS = '0xdB66c11221234C6B19cCBd29868310c31494C21C'; // Set your fixed contract address here
17
+ const JOB_REGISTRY_ADDRESS = '0x476ACc7949a95e31144cC84b8F6BC7abF0967E4b'; // Set your fixed contract address here
18
18
  function toCreateJobDataFromTime(input, balances, userAddress, jobCostPrediction) {
19
19
  return {
20
20
  job_id: JOB_ID,
package/dist/types.d.ts CHANGED
@@ -230,3 +230,19 @@ export interface UserData {
230
230
  last_updated_at: Date;
231
231
  email: string;
232
232
  }
233
+ export interface TaskData {
234
+ task_id: number;
235
+ task_number: number;
236
+ task_opx_cost: number;
237
+ execution_timestamp: Date;
238
+ execution_tx_hash: string;
239
+ task_performer_id: number;
240
+ task_attester_ids: number[];
241
+ is_accepted: boolean;
242
+ tx_url: string;
243
+ task_status: string;
244
+ }
245
+ export interface JobDataWithTasks {
246
+ jobData: JobDataAPI;
247
+ taskData: TaskData[];
248
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdk-triggerx",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "SDK for interacting with the TriggerX backend and smart contracts.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",