@human-protocol/sdk 3.0.3 → 3.0.4

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 +1 @@
1
- {"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/statistics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAqDrD,eAAO,MAAM,4BAA4B,gCAOxC,CAAC;AAEF,eAAO,MAAM,2BAA2B,gCAOvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAAY,iBAAiB,mCA6BjE,CAAC"}
1
+ {"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/statistics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAuDrD,eAAO,MAAM,4BAA4B,gCAOxC,CAAC;AAIF,eAAO,MAAM,2BAA2B,gCAOvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAAY,iBAAiB,mCA6BjE,CAAC"}
@@ -53,17 +53,19 @@ const EVENT_DAY_DATA_FRAGMENT = (0, graphql_tag_1.default) `
53
53
  dailyUniqueReceivers
54
54
  }
55
55
  `;
56
+ const hmtStatisticsId = Buffer.from('hmt-statistics-id').toString('hex');
56
57
  exports.GET_HMTOKEN_STATISTICS_QUERY = (0, graphql_tag_1.default) `
57
58
  query GetHMTokenStatistics {
58
- hmtokenStatistics(id: "hmt-statistics-id") {
59
+ hmtokenStatistics(id: "${hmtStatisticsId}") {
59
60
  ...HMTokenStatisticsFields
60
61
  }
61
62
  }
62
63
  ${HMTOKEN_STATISTICS_FRAGMENT}
63
64
  `;
65
+ const escrowStatisticsId = Buffer.from('escrow-statistics-id').toString('hex');
64
66
  exports.GET_ESCROW_STATISTICS_QUERY = (0, graphql_tag_1.default) `
65
67
  query GetEscrowStatistics {
66
- escrowStatistics(id: "escrow-statistics-id") {
68
+ escrowStatistics(id: "${escrowStatisticsId}") {
67
69
  ...EscrowStatisticsFields
68
70
  }
69
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EAEP,cAAc,EACd,SAAS,EAET,OAAO,EACR,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,qBAAa,aAAa;IACxB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;IAkCnB;;;;;;;;;;;;;;;;;OAiBG;WACiB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAsC1E;;;;;;;;;;;;;OAaG;WACiB,6BAA6B,CAC/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC;IA6BvB;;;;;;;;;;;;;;OAcG;WACiB,UAAU,CAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,EAAE,CAAC;CAuBtB"}
1
+ {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EAEP,cAAc,EACd,SAAS,EAET,OAAO,EACR,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,qBAAa,aAAa;IACxB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;IAkCnB;;;;;;;;;;;;;;;;;OAiBG;WACiB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAsC1E;;;;;;;;;;;;;OAaG;WACiB,6BAA6B,CAC/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC;IA+BvB;;;;;;;;;;;;;;OAcG;WACiB,UAAU,CAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,EAAE,CAAC;CAyBtB"}
package/dist/operator.js CHANGED
@@ -122,6 +122,8 @@ class OperatorUtils {
122
122
  address: address.toLowerCase(),
123
123
  role: role,
124
124
  });
125
+ if (!reputationNetwork)
126
+ return [];
125
127
  return reputationNetwork.operators.map((operator) => {
126
128
  let jobTypes = [];
127
129
  if (typeof operator.jobTypes === 'string') {
@@ -162,6 +164,8 @@ class OperatorUtils {
162
164
  const { rewardAddedEvents } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), reward_1.GET_REWARD_ADDED_EVENTS_QUERY, {
163
165
  slasherAddress: slasherAddress.toLowerCase(),
164
166
  });
167
+ if (!rewardAddedEvents)
168
+ return [];
165
169
  return rewardAddedEvents.map((reward) => {
166
170
  return {
167
171
  escrowAddress: reward.escrow,
@@ -39,7 +39,7 @@ class TransactionUtils {
39
39
  const { transaction } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), transaction_1.GET_TRANSACTION_QUERY, {
40
40
  hash: hash.toLowerCase(),
41
41
  });
42
- return transaction;
42
+ return transaction || null;
43
43
  }
44
44
  /**
45
45
  * This function returns all transaction details based on the provided filter.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@human-protocol/sdk",
3
3
  "description": "Human Protocol SDK",
4
- "version": "3.0.3",
4
+ "version": "3.0.4",
5
5
  "files": [
6
6
  "src",
7
7
  "dist"
@@ -40,7 +40,6 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@human-protocol/core": "*",
43
- "aws-sdk": "^2.1528.0",
44
43
  "axios": "^1.4.0",
45
44
  "graphql": "^16.8.1",
46
45
  "graphql-request": "^6.1.0",
@@ -48,8 +47,7 @@
48
47
  "minio": "7.1.3",
49
48
  "openpgp": "^5.11.1",
50
49
  "secp256k1": "^4.0.3",
51
- "vitest": "^1.6.0",
52
- "winston": "^3.13.0"
50
+ "vitest": "^1.6.0"
53
51
  },
54
52
  "devDependencies": {
55
53
  "typedoc": "^0.26.5",
@@ -52,18 +52,22 @@ const EVENT_DAY_DATA_FRAGMENT = gql`
52
52
  }
53
53
  `;
54
54
 
55
+ const hmtStatisticsId = Buffer.from('hmt-statistics-id').toString('hex');
56
+
55
57
  export const GET_HMTOKEN_STATISTICS_QUERY = gql`
56
58
  query GetHMTokenStatistics {
57
- hmtokenStatistics(id: "hmt-statistics-id") {
59
+ hmtokenStatistics(id: "${hmtStatisticsId}") {
58
60
  ...HMTokenStatisticsFields
59
61
  }
60
62
  }
61
63
  ${HMTOKEN_STATISTICS_FRAGMENT}
62
64
  `;
63
65
 
66
+ const escrowStatisticsId = Buffer.from('escrow-statistics-id').toString('hex');
67
+
64
68
  export const GET_ESCROW_STATISTICS_QUERY = gql`
65
69
  query GetEscrowStatistics {
66
- escrowStatistics(id: "escrow-statistics-id") {
70
+ escrowStatistics(id: "${escrowStatisticsId}") {
67
71
  ...EscrowStatisticsFields
68
72
  }
69
73
  }
package/src/operator.ts CHANGED
@@ -165,6 +165,8 @@ export class OperatorUtils {
165
165
  role: role,
166
166
  });
167
167
 
168
+ if (!reputationNetwork) return [];
169
+
168
170
  return reputationNetwork.operators.map((operator) => {
169
171
  let jobTypes: string[] = [];
170
172
 
@@ -215,6 +217,8 @@ export class OperatorUtils {
215
217
  slasherAddress: slasherAddress.toLowerCase(),
216
218
  });
217
219
 
220
+ if (!rewardAddedEvents) return [];
221
+
218
222
  return rewardAddedEvents.map((reward: any) => {
219
223
  return {
220
224
  escrowAddress: reward.escrow,
@@ -50,7 +50,7 @@ export class TransactionUtils {
50
50
  hash: hash.toLowerCase(),
51
51
  });
52
52
 
53
- return transaction;
53
+ return transaction || null;
54
54
  }
55
55
 
56
56
  /**