@human-protocol/sdk 4.0.2 → 4.0.3

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.
package/dist/constants.js CHANGED
@@ -28,7 +28,7 @@ exports.NETWORKS = {
28
28
  stakingAddress: '0xEf6Da3aB52c33925Be3F84038193a7e1331F51E6',
29
29
  kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
30
30
  subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
31
- subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmc8ikCj9y2uvYGTeELkM9wybPdcD2PgpW4tjJMwnogLrq',
31
+ subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmawHPbwEhAvmWgHQUH9Qgx5AqrXmq1uhfj69CGv9LLzNb',
32
32
  oldSubgraphUrl: '',
33
33
  oldFactoryAddress: '',
34
34
  },
@@ -41,7 +41,7 @@ exports.NETWORKS = {
41
41
  stakingAddress: '0x2163e3A40032Af1C359ac731deaB48258b317890',
42
42
  kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
43
43
  subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
44
- subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmfB1oqYCMTKZB2vcYJzQmGGvVS8cMCHohpYbjKFWoFo8z',
44
+ subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYx4iD24iBTBgxhK95WV4u4o4QSFQFJxuvSNwwSEvCMsE',
45
45
  oldSubgraphUrl: '',
46
46
  oldFactoryAddress: '',
47
47
  },
@@ -54,7 +54,7 @@ exports.NETWORKS = {
54
54
  stakingAddress: '0xE24e5C08E28331D24758b69A5E9f383D2bDD1c98',
55
55
  kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
56
56
  subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
57
- subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmPEaCSuzbVHDrGEWTS7T4N8U7kBMMMfkj4b4ZeqheVuMc',
57
+ subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmai26kHVvYnn59QzGyBAfVWTQ98utfA2bJxQTMV2NeU8K',
58
58
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
59
59
  oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
60
60
  },
@@ -67,7 +67,7 @@ exports.NETWORKS = {
67
67
  stakingAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
68
68
  kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
69
69
  subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
70
- subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmbp8jzcYurrKdk1Mg5ycJ8jcxwou3wWsmNcRdAc16aQEt',
70
+ subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmbPzZWJMqCzdc6ZJir1Z2Va5mpLo8haGxAkfMySwfGxqs',
71
71
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
72
72
  oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
73
73
  },
@@ -80,7 +80,7 @@ exports.NETWORKS = {
80
80
  stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
81
81
  kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
82
82
  subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
83
- subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeSoEuFieiKXtqzDY3WUBz5gKFWwYVPP7iaebpBpJyo7Y',
83
+ subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmSyLqu2injQHCrMg68Wvp6n39J5piCDQkwHGWhKBqxhvV',
84
84
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
85
85
  oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
86
86
  },
@@ -93,7 +93,7 @@ exports.NETWORKS = {
93
93
  stakingAddress: '0xffE496683F842a923110415b7278ded3F265f2C5',
94
94
  kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
95
95
  subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
96
- subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQUUv8SK2skarDrJpB8LXXqMwjzxg3Z42dx12uEL5Pmeq',
96
+ subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYtZEaay5cX5XwGmoN8NpwfpFMbyqiKvtA1ub4GvavH2P',
97
97
  oldSubgraphUrl: '',
98
98
  oldFactoryAddress: '',
99
99
  },
package/dist/enums.d.ts CHANGED
@@ -12,7 +12,7 @@ export declare enum OrderDirection {
12
12
  ASC = "asc",
13
13
  DESC = "desc"
14
14
  }
15
- export declare enum LeaderCategory {
15
+ export declare enum OperatorCategory {
16
16
  MACHINE_LEARNING = "machine_learning",
17
17
  MARKET_MAKING = "market_making"
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,KAAK;IACR,OAAO,IAAI;IACX,OAAO,WAAW;IAClB,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,YAAY,QAAQ;IACpB,SAAS,OAAO;CACjB;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,oBAAY,cAAc;IACxB,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;CAChC"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,KAAK;IACR,OAAO,IAAI;IACX,OAAO,WAAW;IAClB,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,YAAY,QAAQ;IACpB,SAAS,OAAO;CACjB;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,oBAAY,gBAAgB;IAC1B,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;CAChC"}
package/dist/enums.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LeaderCategory = exports.OrderDirection = exports.ChainId = void 0;
3
+ exports.OperatorCategory = exports.OrderDirection = exports.ChainId = void 0;
4
4
  var ChainId;
5
5
  (function (ChainId) {
6
6
  ChainId[ChainId["ALL"] = -1] = "ALL";
@@ -17,8 +17,8 @@ var OrderDirection;
17
17
  OrderDirection["ASC"] = "asc";
18
18
  OrderDirection["DESC"] = "desc";
19
19
  })(OrderDirection || (exports.OrderDirection = OrderDirection = {}));
20
- var LeaderCategory;
21
- (function (LeaderCategory) {
22
- LeaderCategory["MACHINE_LEARNING"] = "machine_learning";
23
- LeaderCategory["MARKET_MAKING"] = "market_making";
24
- })(LeaderCategory || (exports.LeaderCategory = LeaderCategory = {}));
20
+ var OperatorCategory;
21
+ (function (OperatorCategory) {
22
+ OperatorCategory["MACHINE_LEARNING"] = "machine_learning";
23
+ OperatorCategory["MARKET_MAKING"] = "market_making";
24
+ })(OperatorCategory || (exports.OperatorCategory = OperatorCategory = {}));
@@ -1,5 +1,5 @@
1
- import { ILeadersFilter } from 'src/interfaces';
2
- export declare const GET_LEADERS_QUERY: (filter: ILeadersFilter) => import("graphql").DocumentNode;
1
+ import { IOperatorsFilter } from 'src/interfaces';
2
+ export declare const GET_LEADERS_QUERY: (filter: IOperatorsFilter) => import("graphql").DocumentNode;
3
3
  export declare const GET_REPUTATION_NETWORK_QUERY: (role?: string) => import("graphql").DocumentNode;
4
4
  export declare const GET_LEADER_QUERY: import("graphql").DocumentNode;
5
5
  //# sourceMappingURL=operator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA4BhD,eAAO,MAAM,iBAAiB,WAAY,cAAc,mCA+BvD,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAAW,MAAM,mCA0BzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
1
+ {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA4BlD,eAAO,MAAM,iBAAiB,WAAY,gBAAgB,mCA+BzD,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAAW,MAAM,mCAsBzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.GET_LEADER_QUERY = exports.GET_REPUTATION_NETWORK_QUERY = exports.GET_LEADERS_QUERY = void 0;
7
7
  const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
8
  const LEADER_FRAGMENT = (0, graphql_tag_1.default) `
9
- fragment LeaderFields on Leader {
9
+ fragment OperatorFields on Operator {
10
10
  id
11
11
  address
12
12
  amountStaked
@@ -39,7 +39,7 @@ const GET_LEADERS_QUERY = (filter) => {
39
39
  }
40
40
  `;
41
41
  return (0, graphql_tag_1.default) `
42
- query getLeaders(
42
+ query getOperators(
43
43
  $minAmountStaked: Int,
44
44
  $roles: [String!]
45
45
  $first: Int
@@ -47,14 +47,14 @@ const GET_LEADERS_QUERY = (filter) => {
47
47
  $orderBy: String
48
48
  $orderDirection: String
49
49
  ) {
50
- leaders(
50
+ operators(
51
51
  ${WHERE_CLAUSE}
52
52
  first: $first
53
53
  skip: $skip
54
54
  orderBy: $orderBy
55
55
  orderDirection: $orderDirection
56
56
  ) {
57
- ...LeaderFields
57
+ ...OperatorFields
58
58
  }
59
59
  }
60
60
  ${LEADER_FRAGMENT}
@@ -76,22 +76,18 @@ const GET_REPUTATION_NETWORK_QUERY = (role) => {
76
76
  operators(
77
77
  ${WHERE_CLAUSE}
78
78
  ) {
79
- address,
80
- role,
81
- url,
82
- jobTypes,
83
- registrationNeeded,
84
- registrationInstructions
79
+ ...OperatorFields
85
80
  }
86
81
  }
87
82
  }
83
+ ${LEADER_FRAGMENT}
88
84
  `;
89
85
  };
90
86
  exports.GET_REPUTATION_NETWORK_QUERY = GET_REPUTATION_NETWORK_QUERY;
91
87
  exports.GET_LEADER_QUERY = (0, graphql_tag_1.default) `
92
- query getLeader($address: String!) {
93
- leader(id: $address) {
94
- ...LeaderFields
88
+ query getOperator($address: String!) {
89
+ operator(id: $address) {
90
+ ...OperatorFields
95
91
  }
96
92
  }
97
93
  ${LEADER_FRAGMENT}
@@ -4,7 +4,7 @@ export interface IReward {
4
4
  escrowAddress: string;
5
5
  amount: bigint;
6
6
  }
7
- export interface ILeader {
7
+ export interface IOperator {
8
8
  id: string;
9
9
  chainId: ChainId;
10
10
  address: string;
@@ -28,13 +28,13 @@ export interface ILeader {
28
28
  name?: string;
29
29
  category?: string;
30
30
  }
31
- export interface ILeaderSubgraph extends Omit<ILeader, 'jobTypes' | 'reputationNetworks' | 'chainId'> {
31
+ export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes' | 'reputationNetworks' | 'chainId'> {
32
32
  jobTypes?: string;
33
33
  reputationNetworks?: {
34
34
  address: string;
35
35
  }[];
36
36
  }
37
- export interface ILeadersFilter extends IPagination {
37
+ export interface IOperatorsFilter extends IPagination {
38
38
  chainId: ChainId;
39
39
  roles?: string[];
40
40
  minAmountStaked?: number;
@@ -56,9 +56,6 @@ export interface IOperator {
56
56
  registrationNeeded?: boolean;
57
57
  registrationInstructions?: string;
58
58
  }
59
- export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes'> {
60
- jobTypes?: string;
61
- }
62
59
  export interface IEscrowsFilter extends IPagination {
63
60
  launcher?: string;
64
61
  reputationOracle?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,WAAW,OAAO;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,G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YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
@@ -1,40 +1,40 @@
1
- import { ILeader, ILeadersFilter, IOperator, IReward } from './interfaces';
1
+ import { IOperator, IOperatorsFilter, IReward } from './interfaces';
2
2
  import { ChainId } from './enums';
3
3
  export declare class OperatorUtils {
4
4
  /**
5
- * This function returns the leader data for the given address.
5
+ * This function returns the operator data for the given address.
6
6
  *
7
- * @param {ChainId} chainId Network in which the leader is deployed
8
- * @param {string} address Leader address.
9
- * @returns {Promise<ILeader>} Returns the leader details.
7
+ * @param {ChainId} chainId Network in which the operator is deployed
8
+ * @param {string} address Operator address.
9
+ * @returns {Promise<IOperator>} Returns the operator details.
10
10
  *
11
11
  * **Code example**
12
12
  *
13
13
  * ```ts
14
14
  * import { OperatorUtils, ChainId } from '@human-protocol/sdk';
15
15
  *
16
- * const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
16
+ * const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
17
17
  * ```
18
18
  */
19
- static getLeader(chainId: ChainId, address: string): Promise<ILeader>;
19
+ static getOperator(chainId: ChainId, address: string): Promise<IOperator>;
20
20
  /**
21
- * This function returns all the leader details of the protocol.
21
+ * This function returns all the operator details of the protocol.
22
22
  *
23
- * @param {ILeadersFilter} filter Filter for the leaders.
24
- * @returns {Promise<ILeader[]>} Returns an array with all the leader details.
23
+ * @param {IOperatorsFilter} filter Filter for the operators.
24
+ * @returns {Promise<IOperator[]>} Returns an array with all the operator details.
25
25
  *
26
26
  * **Code example**
27
27
  *
28
28
  * ```ts
29
29
  * import { OperatorUtils, ChainId } from '@human-protocol/sdk';
30
30
  *
31
- * const filter: ILeadersFilter = {
31
+ * const filter: IOperatorsFilter = {
32
32
  * chainId: ChainId.POLYGON
33
33
  * };
34
- * const leaders = await OperatorUtils.getLeaders(filter);
34
+ * const operators = await OperatorUtils.getOperators(filter);
35
35
  * ```
36
36
  */
37
- static getLeaders(filter: ILeadersFilter): Promise<ILeader[]>;
37
+ static getOperators(filter: IOperatorsFilter): Promise<IOperator[]>;
38
38
  /**
39
39
  * Retrieves the reputation network operators of the specified address.
40
40
  *
@@ -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;A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C5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,EAAE,CAAC;CAyBtB"}
package/dist/operator.js CHANGED
@@ -15,21 +15,21 @@ const enums_1 = require("./enums");
15
15
  const constants_1 = require("./constants");
16
16
  class OperatorUtils {
17
17
  /**
18
- * This function returns the leader data for the given address.
18
+ * This function returns the operator data for the given address.
19
19
  *
20
- * @param {ChainId} chainId Network in which the leader is deployed
21
- * @param {string} address Leader address.
22
- * @returns {Promise<ILeader>} Returns the leader details.
20
+ * @param {ChainId} chainId Network in which the operator is deployed
21
+ * @param {string} address Operator address.
22
+ * @returns {Promise<IOperator>} Returns the operator details.
23
23
  *
24
24
  * **Code example**
25
25
  *
26
26
  * ```ts
27
27
  * import { OperatorUtils, ChainId } from '@human-protocol/sdk';
28
28
  *
29
- * const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
29
+ * const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
30
30
  * ```
31
31
  */
32
- static async getLeader(chainId, address) {
32
+ static async getOperator(chainId, address) {
33
33
  if (!ethers_1.ethers.isAddress(address)) {
34
34
  throw error_1.ErrorInvalidStakerAddressProvided;
35
35
  }
@@ -37,49 +37,50 @@ class OperatorUtils {
37
37
  if (!networkData) {
38
38
  throw error_1.ErrorUnsupportedChainID;
39
39
  }
40
- const { leader } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), operator_1.GET_LEADER_QUERY, {
40
+ const { operator } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), operator_1.GET_LEADER_QUERY, {
41
41
  address: address.toLowerCase(),
42
42
  });
43
- if (!leader) {
44
- return leader || null;
43
+ if (!operator) {
44
+ return operator || null;
45
45
  }
46
46
  let jobTypes = [];
47
47
  let reputationNetworks = [];
48
- if (typeof leader.jobTypes === 'string') {
49
- jobTypes = leader.jobTypes.split(',');
48
+ if (typeof operator.jobTypes === 'string') {
49
+ jobTypes = operator.jobTypes.split(',');
50
50
  }
51
- else if (Array.isArray(leader.jobTypes)) {
52
- jobTypes = leader.jobTypes;
51
+ else if (Array.isArray(operator.jobTypes)) {
52
+ jobTypes = operator.jobTypes;
53
53
  }
54
- if (leader.reputationNetworks && Array.isArray(leader.reputationNetworks)) {
55
- reputationNetworks = leader.reputationNetworks.map((network) => network.address);
54
+ if (operator.reputationNetworks &&
55
+ Array.isArray(operator.reputationNetworks)) {
56
+ reputationNetworks = operator.reputationNetworks.map((network) => network.address);
56
57
  }
57
58
  return {
58
- ...leader,
59
+ ...operator,
59
60
  jobTypes,
60
61
  reputationNetworks,
61
62
  chainId,
62
63
  };
63
64
  }
64
65
  /**
65
- * This function returns all the leader details of the protocol.
66
+ * This function returns all the operator details of the protocol.
66
67
  *
67
- * @param {ILeadersFilter} filter Filter for the leaders.
68
- * @returns {Promise<ILeader[]>} Returns an array with all the leader details.
68
+ * @param {IOperatorsFilter} filter Filter for the operators.
69
+ * @returns {Promise<IOperator[]>} Returns an array with all the operator details.
69
70
  *
70
71
  * **Code example**
71
72
  *
72
73
  * ```ts
73
74
  * import { OperatorUtils, ChainId } from '@human-protocol/sdk';
74
75
  *
75
- * const filter: ILeadersFilter = {
76
+ * const filter: IOperatorsFilter = {
76
77
  * chainId: ChainId.POLYGON
77
78
  * };
78
- * const leaders = await OperatorUtils.getLeaders(filter);
79
+ * const operators = await OperatorUtils.getOperators(filter);
79
80
  * ```
80
81
  */
81
- static async getLeaders(filter) {
82
- let leaders_data = [];
82
+ static async getOperators(filter) {
83
+ let operators_data = [];
83
84
  const first = filter.first !== undefined && filter.first > 0
84
85
  ? Math.min(filter.first, 1000)
85
86
  : 10;
@@ -89,7 +90,7 @@ class OperatorUtils {
89
90
  if (!networkData) {
90
91
  throw error_1.ErrorUnsupportedChainID;
91
92
  }
92
- const { leaders } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, operator_1.GET_LEADERS_QUERY)(filter), {
93
+ const { operators } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, operator_1.GET_LEADERS_QUERY)(filter), {
93
94
  minAmountStaked: filter?.minAmountStaked,
94
95
  roles: filter?.roles,
95
96
  orderBy: filter?.orderBy,
@@ -97,30 +98,30 @@ class OperatorUtils {
97
98
  first: first,
98
99
  skip: skip,
99
100
  });
100
- if (!leaders) {
101
+ if (!operators) {
101
102
  return [];
102
103
  }
103
- leaders_data = leaders_data.concat(leaders.map((leader) => {
104
+ operators_data = operators_data.concat(operators.map((operator) => {
104
105
  let jobTypes = [];
105
106
  let reputationNetworks = [];
106
- if (typeof leader.jobTypes === 'string') {
107
- jobTypes = leader.jobTypes.split(',');
107
+ if (typeof operator.jobTypes === 'string') {
108
+ jobTypes = operator.jobTypes.split(',');
108
109
  }
109
- else if (Array.isArray(leader.jobTypes)) {
110
- jobTypes = leader.jobTypes;
110
+ else if (Array.isArray(operator.jobTypes)) {
111
+ jobTypes = operator.jobTypes;
111
112
  }
112
- if (leader.reputationNetworks &&
113
- Array.isArray(leader.reputationNetworks)) {
114
- reputationNetworks = leader.reputationNetworks.map((network) => network.address);
113
+ if (operator.reputationNetworks &&
114
+ Array.isArray(operator.reputationNetworks)) {
115
+ reputationNetworks = operator.reputationNetworks.map((network) => network.address);
115
116
  }
116
117
  return {
117
- ...leader,
118
+ ...operator,
118
119
  jobTypes,
119
120
  reputationNetworks,
120
121
  chainId: filter.chainId,
121
122
  };
122
123
  }));
123
- return leaders_data;
124
+ return operators_data;
124
125
  }
125
126
  /**
126
127
  * Retrieves the reputation network operators of the specified address.
@@ -158,8 +159,10 @@ class OperatorUtils {
158
159
  jobTypes = operator.jobTypes;
159
160
  }
160
161
  return {
162
+ chainId,
161
163
  ...operator,
162
164
  jobTypes,
165
+ reputationNetworks: operator.reputationNetworks?.map((network) => network.address),
163
166
  };
164
167
  });
165
168
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@human-protocol/sdk",
3
3
  "description": "Human Protocol SDK",
4
- "version": "4.0.2",
4
+ "version": "4.0.3",
5
5
  "files": [
6
6
  "src",
7
7
  "dist"
package/src/constants.ts CHANGED
@@ -36,7 +36,7 @@ export const NETWORKS: {
36
36
  subgraphUrl:
37
37
  'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
38
38
  subgraphUrlApiKey:
39
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmc8ikCj9y2uvYGTeELkM9wybPdcD2PgpW4tjJMwnogLrq',
39
+ 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmawHPbwEhAvmWgHQUH9Qgx5AqrXmq1uhfj69CGv9LLzNb',
40
40
  oldSubgraphUrl: '',
41
41
  oldFactoryAddress: '',
42
42
  },
@@ -51,7 +51,7 @@ export const NETWORKS: {
51
51
  subgraphUrl:
52
52
  'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
53
53
  subgraphUrlApiKey:
54
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmfB1oqYCMTKZB2vcYJzQmGGvVS8cMCHohpYbjKFWoFo8z',
54
+ 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYx4iD24iBTBgxhK95WV4u4o4QSFQFJxuvSNwwSEvCMsE',
55
55
  oldSubgraphUrl: '',
56
56
  oldFactoryAddress: '',
57
57
  },
@@ -66,7 +66,7 @@ export const NETWORKS: {
66
66
  subgraphUrl:
67
67
  'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
68
68
  subgraphUrlApiKey:
69
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmPEaCSuzbVHDrGEWTS7T4N8U7kBMMMfkj4b4ZeqheVuMc',
69
+ 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmai26kHVvYnn59QzGyBAfVWTQ98utfA2bJxQTMV2NeU8K',
70
70
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
71
71
  oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
72
72
  },
@@ -81,7 +81,7 @@ export const NETWORKS: {
81
81
  subgraphUrl:
82
82
  'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
83
83
  subgraphUrlApiKey:
84
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmbp8jzcYurrKdk1Mg5ycJ8jcxwou3wWsmNcRdAc16aQEt',
84
+ 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmbPzZWJMqCzdc6ZJir1Z2Va5mpLo8haGxAkfMySwfGxqs',
85
85
  oldSubgraphUrl:
86
86
  'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
87
87
  oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
@@ -97,7 +97,7 @@ export const NETWORKS: {
97
97
  subgraphUrl:
98
98
  'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
99
99
  subgraphUrlApiKey:
100
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeSoEuFieiKXtqzDY3WUBz5gKFWwYVPP7iaebpBpJyo7Y',
100
+ 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmSyLqu2injQHCrMg68Wvp6n39J5piCDQkwHGWhKBqxhvV',
101
101
  oldSubgraphUrl:
102
102
  'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
103
103
  oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
@@ -113,7 +113,7 @@ export const NETWORKS: {
113
113
  subgraphUrl:
114
114
  'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
115
115
  subgraphUrlApiKey:
116
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQUUv8SK2skarDrJpB8LXXqMwjzxg3Z42dx12uEL5Pmeq',
116
+ 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYtZEaay5cX5XwGmoN8NpwfpFMbyqiKvtA1ub4GvavH2P',
117
117
  oldSubgraphUrl: '',
118
118
  oldFactoryAddress: '',
119
119
  },
package/src/enums.ts CHANGED
@@ -14,7 +14,7 @@ export enum OrderDirection {
14
14
  DESC = 'desc',
15
15
  }
16
16
 
17
- export enum LeaderCategory {
17
+ export enum OperatorCategory {
18
18
  MACHINE_LEARNING = 'machine_learning',
19
19
  MARKET_MAKING = 'market_making',
20
20
  }
@@ -1,8 +1,8 @@
1
1
  import gql from 'graphql-tag';
2
- import { ILeadersFilter } from 'src/interfaces';
2
+ import { IOperatorsFilter } from 'src/interfaces';
3
3
 
4
4
  const LEADER_FRAGMENT = gql`
5
- fragment LeaderFields on Leader {
5
+ fragment OperatorFields on Operator {
6
6
  id
7
7
  address
8
8
  amountStaked
@@ -27,7 +27,7 @@ const LEADER_FRAGMENT = gql`
27
27
  }
28
28
  `;
29
29
 
30
- export const GET_LEADERS_QUERY = (filter: ILeadersFilter) => {
30
+ export const GET_LEADERS_QUERY = (filter: IOperatorsFilter) => {
31
31
  const { roles, minAmountStaked } = filter;
32
32
 
33
33
  const WHERE_CLAUSE = `
@@ -38,7 +38,7 @@ export const GET_LEADERS_QUERY = (filter: ILeadersFilter) => {
38
38
  `;
39
39
 
40
40
  return gql`
41
- query getLeaders(
41
+ query getOperators(
42
42
  $minAmountStaked: Int,
43
43
  $roles: [String!]
44
44
  $first: Int
@@ -46,14 +46,14 @@ export const GET_LEADERS_QUERY = (filter: ILeadersFilter) => {
46
46
  $orderBy: String
47
47
  $orderDirection: String
48
48
  ) {
49
- leaders(
49
+ operators(
50
50
  ${WHERE_CLAUSE}
51
51
  first: $first
52
52
  skip: $skip
53
53
  orderBy: $orderBy
54
54
  orderDirection: $orderDirection
55
55
  ) {
56
- ...LeaderFields
56
+ ...OperatorFields
57
57
  }
58
58
  }
59
59
  ${LEADER_FRAGMENT}
@@ -76,22 +76,18 @@ export const GET_REPUTATION_NETWORK_QUERY = (role?: string) => {
76
76
  operators(
77
77
  ${WHERE_CLAUSE}
78
78
  ) {
79
- address,
80
- role,
81
- url,
82
- jobTypes,
83
- registrationNeeded,
84
- registrationInstructions
79
+ ...OperatorFields
85
80
  }
86
81
  }
87
82
  }
83
+ ${LEADER_FRAGMENT}
88
84
  `;
89
85
  };
90
86
 
91
87
  export const GET_LEADER_QUERY = gql`
92
- query getLeader($address: String!) {
93
- leader(id: $address) {
94
- ...LeaderFields
88
+ query getOperator($address: String!) {
89
+ operator(id: $address) {
90
+ ...OperatorFields
95
91
  }
96
92
  }
97
93
  ${LEADER_FRAGMENT}
package/src/interfaces.ts CHANGED
@@ -6,7 +6,7 @@ export interface IReward {
6
6
  amount: bigint;
7
7
  }
8
8
 
9
- export interface ILeader {
9
+ export interface IOperator {
10
10
  id: string;
11
11
  chainId: ChainId;
12
12
  address: string;
@@ -31,13 +31,13 @@ export interface ILeader {
31
31
  category?: string;
32
32
  }
33
33
 
34
- export interface ILeaderSubgraph
35
- extends Omit<ILeader, 'jobTypes' | 'reputationNetworks' | 'chainId'> {
34
+ export interface IOperatorSubgraph
35
+ extends Omit<IOperator, 'jobTypes' | 'reputationNetworks' | 'chainId'> {
36
36
  jobTypes?: string;
37
37
  reputationNetworks?: { address: string }[];
38
38
  }
39
39
 
40
- export interface ILeadersFilter extends IPagination {
40
+ export interface IOperatorsFilter extends IPagination {
41
41
  chainId: ChainId;
42
42
  roles?: string[];
43
43
  minAmountStaked?: number;
@@ -64,10 +64,6 @@ export interface IOperator {
64
64
  registrationInstructions?: string;
65
65
  }
66
66
 
67
- export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes'> {
68
- jobTypes?: string;
69
- }
70
-
71
67
  export interface IEscrowsFilter extends IPagination {
72
68
  launcher?: string;
73
69
  reputationOracle?: string;
package/src/operator.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import gqlFetch from 'graphql-request';
3
3
  import {
4
- ILeader,
5
- ILeaderSubgraph,
6
- ILeadersFilter,
7
4
  IOperator,
5
+ IOperatorSubgraph,
6
+ IOperatorsFilter,
8
7
  IReputationNetworkSubgraph,
9
8
  IReward,
10
9
  } from './interfaces';
@@ -27,24 +26,24 @@ import { NETWORKS } from './constants';
27
26
 
28
27
  export class OperatorUtils {
29
28
  /**
30
- * This function returns the leader data for the given address.
29
+ * This function returns the operator data for the given address.
31
30
  *
32
- * @param {ChainId} chainId Network in which the leader is deployed
33
- * @param {string} address Leader address.
34
- * @returns {Promise<ILeader>} Returns the leader details.
31
+ * @param {ChainId} chainId Network in which the operator is deployed
32
+ * @param {string} address Operator address.
33
+ * @returns {Promise<IOperator>} Returns the operator details.
35
34
  *
36
35
  * **Code example**
37
36
  *
38
37
  * ```ts
39
38
  * import { OperatorUtils, ChainId } from '@human-protocol/sdk';
40
39
  *
41
- * const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
40
+ * const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
42
41
  * ```
43
42
  */
44
- public static async getLeader(
43
+ public static async getOperator(
45
44
  chainId: ChainId,
46
45
  address: string
47
- ): Promise<ILeader> {
46
+ ): Promise<IOperator> {
48
47
  if (!ethers.isAddress(address)) {
49
48
  throw ErrorInvalidStakerAddressProvided;
50
49
  }
@@ -54,33 +53,36 @@ export class OperatorUtils {
54
53
  throw ErrorUnsupportedChainID;
55
54
  }
56
55
 
57
- const { leader } = await gqlFetch<{
58
- leader: ILeaderSubgraph;
56
+ const { operator } = await gqlFetch<{
57
+ operator: IOperatorSubgraph;
59
58
  }>(getSubgraphUrl(networkData), GET_LEADER_QUERY, {
60
59
  address: address.toLowerCase(),
61
60
  });
62
61
 
63
- if (!leader) {
64
- return (leader as ILeader) || null;
62
+ if (!operator) {
63
+ return (operator as IOperator) || null;
65
64
  }
66
65
 
67
66
  let jobTypes: string[] = [];
68
67
  let reputationNetworks: string[] = [];
69
68
 
70
- if (typeof leader.jobTypes === 'string') {
71
- jobTypes = leader.jobTypes.split(',');
72
- } else if (Array.isArray(leader.jobTypes)) {
73
- jobTypes = leader.jobTypes;
69
+ if (typeof operator.jobTypes === 'string') {
70
+ jobTypes = operator.jobTypes.split(',');
71
+ } else if (Array.isArray(operator.jobTypes)) {
72
+ jobTypes = operator.jobTypes;
74
73
  }
75
74
 
76
- if (leader.reputationNetworks && Array.isArray(leader.reputationNetworks)) {
77
- reputationNetworks = leader.reputationNetworks.map(
75
+ if (
76
+ operator.reputationNetworks &&
77
+ Array.isArray(operator.reputationNetworks)
78
+ ) {
79
+ reputationNetworks = operator.reputationNetworks.map(
78
80
  (network) => network.address
79
81
  );
80
82
  }
81
83
 
82
84
  return {
83
- ...leader,
85
+ ...operator,
84
86
  jobTypes,
85
87
  reputationNetworks,
86
88
  chainId,
@@ -88,24 +90,26 @@ export class OperatorUtils {
88
90
  }
89
91
 
90
92
  /**
91
- * This function returns all the leader details of the protocol.
93
+ * This function returns all the operator details of the protocol.
92
94
  *
93
- * @param {ILeadersFilter} filter Filter for the leaders.
94
- * @returns {Promise<ILeader[]>} Returns an array with all the leader details.
95
+ * @param {IOperatorsFilter} filter Filter for the operators.
96
+ * @returns {Promise<IOperator[]>} Returns an array with all the operator details.
95
97
  *
96
98
  * **Code example**
97
99
  *
98
100
  * ```ts
99
101
  * import { OperatorUtils, ChainId } from '@human-protocol/sdk';
100
102
  *
101
- * const filter: ILeadersFilter = {
103
+ * const filter: IOperatorsFilter = {
102
104
  * chainId: ChainId.POLYGON
103
105
  * };
104
- * const leaders = await OperatorUtils.getLeaders(filter);
106
+ * const operators = await OperatorUtils.getOperators(filter);
105
107
  * ```
106
108
  */
107
- public static async getLeaders(filter: ILeadersFilter): Promise<ILeader[]> {
108
- let leaders_data: ILeader[] = [];
109
+ public static async getOperators(
110
+ filter: IOperatorsFilter
111
+ ): Promise<IOperator[]> {
112
+ let operators_data: IOperator[] = [];
109
113
 
110
114
  const first =
111
115
  filter.first !== undefined && filter.first > 0
@@ -121,8 +125,8 @@ export class OperatorUtils {
121
125
  throw ErrorUnsupportedChainID;
122
126
  }
123
127
 
124
- const { leaders } = await gqlFetch<{
125
- leaders: ILeaderSubgraph[];
128
+ const { operators } = await gqlFetch<{
129
+ operators: IOperatorSubgraph[];
126
130
  }>(getSubgraphUrl(networkData), GET_LEADERS_QUERY(filter), {
127
131
  minAmountStaked: filter?.minAmountStaked,
128
132
  roles: filter?.roles,
@@ -132,39 +136,39 @@ export class OperatorUtils {
132
136
  skip: skip,
133
137
  });
134
138
 
135
- if (!leaders) {
139
+ if (!operators) {
136
140
  return [];
137
141
  }
138
142
 
139
- leaders_data = leaders_data.concat(
140
- leaders.map((leader) => {
143
+ operators_data = operators_data.concat(
144
+ operators.map((operator) => {
141
145
  let jobTypes: string[] = [];
142
146
  let reputationNetworks: string[] = [];
143
147
 
144
- if (typeof leader.jobTypes === 'string') {
145
- jobTypes = leader.jobTypes.split(',');
146
- } else if (Array.isArray(leader.jobTypes)) {
147
- jobTypes = leader.jobTypes;
148
+ if (typeof operator.jobTypes === 'string') {
149
+ jobTypes = operator.jobTypes.split(',');
150
+ } else if (Array.isArray(operator.jobTypes)) {
151
+ jobTypes = operator.jobTypes;
148
152
  }
149
153
 
150
154
  if (
151
- leader.reputationNetworks &&
152
- Array.isArray(leader.reputationNetworks)
155
+ operator.reputationNetworks &&
156
+ Array.isArray(operator.reputationNetworks)
153
157
  ) {
154
- reputationNetworks = leader.reputationNetworks.map(
158
+ reputationNetworks = operator.reputationNetworks.map(
155
159
  (network) => network.address
156
160
  );
157
161
  }
158
162
 
159
163
  return {
160
- ...leader,
164
+ ...operator,
161
165
  jobTypes,
162
166
  reputationNetworks,
163
167
  chainId: filter.chainId,
164
168
  };
165
169
  })
166
170
  );
167
- return leaders_data;
171
+ return operators_data;
168
172
  }
169
173
 
170
174
  /**
@@ -212,8 +216,12 @@ export class OperatorUtils {
212
216
  }
213
217
 
214
218
  return {
219
+ chainId,
215
220
  ...operator,
216
221
  jobTypes,
222
+ reputationNetworks: operator.reputationNetworks?.map(
223
+ (network) => network.address
224
+ ),
217
225
  };
218
226
  });
219
227
  }