@human-protocol/sdk 2.1.1 → 2.1.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.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +27 -1
- package/dist/enums.d.ts +2 -0
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +2 -0
- package/dist/escrow.d.ts +5 -3
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +6 -4
- package/dist/graphql/queries/operator.d.ts.map +1 -1
- package/dist/graphql/queries/operator.js +4 -1
- package/dist/interfaces.d.ts +12 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/operator.d.ts +3 -3
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +16 -7
- package/dist/statistics.d.ts +5 -5
- package/dist/statistics.js +5 -5
- package/package.json +2 -2
- package/src/constants.ts +29 -1
- package/src/enums.ts +2 -0
- package/src/escrow.ts +6 -4
- package/src/graphql/queries/operator.ts +4 -1
- package/src/interfaces.ts +16 -0
- package/src/kvstore.ts +1 -1
- package/src/operator.ts +23 -11
- package/src/statistics.ts +5 -5
package/dist/constants.d.ts
CHANGED
|
@@ -49,9 +49,9 @@ export declare const KVStoreKeys: {
|
|
|
49
49
|
publicKey: string;
|
|
50
50
|
webhookUrl: string;
|
|
51
51
|
url: string;
|
|
52
|
+
jobTypes: string;
|
|
52
53
|
};
|
|
53
54
|
export declare const Role: {
|
|
54
|
-
Validator: string;
|
|
55
55
|
JobLauncher: string;
|
|
56
56
|
ExchangeOracle: string;
|
|
57
57
|
ReputationOracle: string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WA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MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CAmPnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -83,6 +83,19 @@ exports.NETWORKS = {
|
|
|
83
83
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli',
|
|
84
84
|
oldFactoryAddress: '0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F',
|
|
85
85
|
},
|
|
86
|
+
[enums_1.ChainId.SEPOLIA]: {
|
|
87
|
+
chainId: enums_1.ChainId.SEPOLIA,
|
|
88
|
+
title: 'Ethereum Sepolia',
|
|
89
|
+
scanUrl: 'https://sepolia.etherscan.io/',
|
|
90
|
+
factoryAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
91
|
+
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
92
|
+
stakingAddress: '0x2B9C5EC6220BA8Ad08CB51A60FFdbC6a6235B203',
|
|
93
|
+
rewardPoolAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
94
|
+
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
95
|
+
subgraphUrl: 'https://subgraph.satsuma-prod.com/8d51f9873a51/team--2543/humanprotocol-sepolia/api',
|
|
96
|
+
oldSubgraphUrl: '',
|
|
97
|
+
oldFactoryAddress: '',
|
|
98
|
+
},
|
|
86
99
|
[enums_1.ChainId.BSC_MAINNET]: {
|
|
87
100
|
chainId: enums_1.ChainId.BSC_MAINNET,
|
|
88
101
|
title: 'Binance Smart Chain',
|
|
@@ -135,6 +148,19 @@ exports.NETWORKS = {
|
|
|
135
148
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai',
|
|
136
149
|
oldFactoryAddress: '0x558cd800f9F0B02f3B149667bDe003284c867E94',
|
|
137
150
|
},
|
|
151
|
+
[enums_1.ChainId.POLYGON_AMOY]: {
|
|
152
|
+
chainId: enums_1.ChainId.POLYGON_AMOY,
|
|
153
|
+
title: 'Polygon Amoy',
|
|
154
|
+
scanUrl: 'https://www.oklink.com/amoy',
|
|
155
|
+
factoryAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
156
|
+
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
157
|
+
stakingAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
158
|
+
rewardPoolAddress: '0xd866bCEFf6D0F77E1c3EAE28230AE6C79b03fDa7',
|
|
159
|
+
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
160
|
+
subgraphUrl: 'https://subgraph.satsuma-prod.com/8d51f9873a51/team--2543/humanprotocol-amoy/api',
|
|
161
|
+
oldSubgraphUrl: '',
|
|
162
|
+
oldFactoryAddress: '',
|
|
163
|
+
},
|
|
138
164
|
[enums_1.ChainId.MOONBEAM]: {
|
|
139
165
|
chainId: enums_1.ChainId.MOONBEAM,
|
|
140
166
|
title: 'Moonbeam',
|
|
@@ -246,9 +272,9 @@ exports.KVStoreKeys = {
|
|
|
246
272
|
publicKey: 'public_key',
|
|
247
273
|
webhookUrl: 'webhook_url',
|
|
248
274
|
url: 'url',
|
|
275
|
+
jobTypes: 'job_types',
|
|
249
276
|
};
|
|
250
277
|
exports.Role = {
|
|
251
|
-
Validator: 'Validator',
|
|
252
278
|
JobLauncher: 'Job Launcher',
|
|
253
279
|
ExchangeOracle: 'Exchange Oracle',
|
|
254
280
|
ReputationOracle: 'Reputation Oracle',
|
package/dist/enums.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ export declare enum ChainId {
|
|
|
3
3
|
MAINNET = 1,
|
|
4
4
|
RINKEBY = 4,
|
|
5
5
|
GOERLI = 5,
|
|
6
|
+
SEPOLIA = 11155111,
|
|
6
7
|
BSC_MAINNET = 56,
|
|
7
8
|
BSC_TESTNET = 97,
|
|
8
9
|
POLYGON = 137,
|
|
9
10
|
POLYGON_MUMBAI = 80001,
|
|
11
|
+
POLYGON_AMOY = 80002,
|
|
10
12
|
MOONBEAM = 1284,
|
|
11
13
|
MOONBASE_ALPHA = 1287,
|
|
12
14
|
AVALANCHE_TESTNET = 43113,
|
package/dist/enums.d.ts.map
CHANGED
|
@@ -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,IAAI;IACX,MAAM,IAAI;IACV,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,cAAc,QAAQ;IACtB,QAAQ,OAAO;IACf,cAAc,OAAO;IACrB,iBAAiB,QAAQ;IACzB,SAAS,QAAQ;IACjB,KAAK,aAAa;IAClB,IAAI,QAAQ;IACZ,cAAc,QAAQ;IACtB,SAAS,OAAO;CACjB"}
|
|
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,IAAI;IACX,MAAM,IAAI;IACV,OAAO,WAAW;IAClB,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,cAAc,QAAQ;IACtB,YAAY,QAAQ;IACpB,QAAQ,OAAO;IACf,cAAc,OAAO;IACrB,iBAAiB,QAAQ;IACzB,SAAS,QAAQ;IACjB,KAAK,aAAa;IAClB,IAAI,QAAQ;IACZ,cAAc,QAAQ;IACtB,SAAS,OAAO;CACjB"}
|
package/dist/enums.js
CHANGED
|
@@ -7,10 +7,12 @@ var ChainId;
|
|
|
7
7
|
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
|
|
8
8
|
ChainId[ChainId["RINKEBY"] = 4] = "RINKEBY";
|
|
9
9
|
ChainId[ChainId["GOERLI"] = 5] = "GOERLI";
|
|
10
|
+
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
10
11
|
ChainId[ChainId["BSC_MAINNET"] = 56] = "BSC_MAINNET";
|
|
11
12
|
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET";
|
|
12
13
|
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
|
|
13
14
|
ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI";
|
|
15
|
+
ChainId[ChainId["POLYGON_AMOY"] = 80002] = "POLYGON_AMOY";
|
|
14
16
|
ChainId[ChainId["MOONBEAM"] = 1284] = "MOONBEAM";
|
|
15
17
|
ChainId[ChainId["MOONBASE_ALPHA"] = 1287] = "MOONBASE_ALPHA";
|
|
16
18
|
ChainId[ChainId["AVALANCHE_TESTNET"] = 43113] = "AVALANCHE_TESTNET";
|
package/dist/escrow.d.ts
CHANGED
|
@@ -693,7 +693,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
693
693
|
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
694
694
|
*
|
|
695
695
|
* const escrowAddresses = new EscrowUtils.getEscrows({
|
|
696
|
-
* networks: [ChainId.
|
|
696
|
+
* networks: [ChainId.POLYGON_AMOY]
|
|
697
697
|
* });
|
|
698
698
|
* ```
|
|
699
699
|
*/
|
|
@@ -728,6 +728,7 @@ export declare class EscrowUtils {
|
|
|
728
728
|
* BSC_TESTNET = 97,
|
|
729
729
|
* POLYGON = 137,
|
|
730
730
|
* POLYGON_MUMBAI = 80001,
|
|
731
|
+
* POLYGON_AMOY=80002,
|
|
731
732
|
* MOONBEAM = 1284,
|
|
732
733
|
* MOONBASE_ALPHA = 1287,
|
|
733
734
|
* AVALANCHE = 43114,
|
|
@@ -790,7 +791,7 @@ export declare class EscrowUtils {
|
|
|
790
791
|
* status: EscrowStatus.Pending,
|
|
791
792
|
* from: new Date(2023, 4, 8),
|
|
792
793
|
* to: new Date(2023, 5, 8),
|
|
793
|
-
* networks: [ChainId.
|
|
794
|
+
* networks: [ChainId.POLYGON_AMOY]
|
|
794
795
|
* };
|
|
795
796
|
* const escrowDatas = await EscrowUtils.getEscrows(filters);
|
|
796
797
|
* ```
|
|
@@ -813,6 +814,7 @@ export declare class EscrowUtils {
|
|
|
813
814
|
* BSC_TESTNET = 97,
|
|
814
815
|
* POLYGON = 137,
|
|
815
816
|
* POLYGON_MUMBAI = 80001,
|
|
817
|
+
* POLYGON_AMOY = 80002,
|
|
816
818
|
* MOONBEAM = 1284,
|
|
817
819
|
* MOONBASE_ALPHA = 1287,
|
|
818
820
|
* AVALANCHE = 43114,
|
|
@@ -861,7 +863,7 @@ export declare class EscrowUtils {
|
|
|
861
863
|
* ```ts
|
|
862
864
|
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
863
865
|
*
|
|
864
|
-
* const escrowData = new EscrowUtils.getEscrow(ChainId.
|
|
866
|
+
* const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
865
867
|
* ```
|
|
866
868
|
*/
|
|
867
869
|
static getEscrow(chainId: ChainId, escrowAddress: string): Promise<EscrowData>;
|
package/dist/escrow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAU,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAyBlC,OAAO,EACL,UAAU,EAGX,MAAM,WAAW,CAAC;AAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiGG;WACiB,UAAU,CAC5B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,UAAU,EAAE,CAAC;IA0DxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoEG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,UAAU,CAAC;CAuBvB"}
|
package/dist/escrow.js
CHANGED
|
@@ -362,7 +362,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
362
362
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
363
363
|
const tokenAddress = await escrowContract.token();
|
|
364
364
|
const tokenContract = typechain_types_1.HMToken__factory.connect(tokenAddress, this.runner);
|
|
365
|
-
await (await tokenContract.transfer(escrowAddress, amount, txOptions)).wait;
|
|
365
|
+
await (await tokenContract.transfer(escrowAddress, amount, txOptions)).wait();
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
368
368
|
catch (e) {
|
|
@@ -1215,7 +1215,7 @@ exports.EscrowClient = EscrowClient;
|
|
|
1215
1215
|
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
1216
1216
|
*
|
|
1217
1217
|
* const escrowAddresses = new EscrowUtils.getEscrows({
|
|
1218
|
-
* networks: [ChainId.
|
|
1218
|
+
* networks: [ChainId.POLYGON_AMOY]
|
|
1219
1219
|
* });
|
|
1220
1220
|
* ```
|
|
1221
1221
|
*/
|
|
@@ -1250,6 +1250,7 @@ class EscrowUtils {
|
|
|
1250
1250
|
* BSC_TESTNET = 97,
|
|
1251
1251
|
* POLYGON = 137,
|
|
1252
1252
|
* POLYGON_MUMBAI = 80001,
|
|
1253
|
+
* POLYGON_AMOY=80002,
|
|
1253
1254
|
* MOONBEAM = 1284,
|
|
1254
1255
|
* MOONBASE_ALPHA = 1287,
|
|
1255
1256
|
* AVALANCHE = 43114,
|
|
@@ -1312,7 +1313,7 @@ class EscrowUtils {
|
|
|
1312
1313
|
* status: EscrowStatus.Pending,
|
|
1313
1314
|
* from: new Date(2023, 4, 8),
|
|
1314
1315
|
* to: new Date(2023, 5, 8),
|
|
1315
|
-
* networks: [ChainId.
|
|
1316
|
+
* networks: [ChainId.POLYGON_AMOY]
|
|
1316
1317
|
* };
|
|
1317
1318
|
* const escrowDatas = await EscrowUtils.getEscrows(filters);
|
|
1318
1319
|
* ```
|
|
@@ -1379,6 +1380,7 @@ class EscrowUtils {
|
|
|
1379
1380
|
* BSC_TESTNET = 97,
|
|
1380
1381
|
* POLYGON = 137,
|
|
1381
1382
|
* POLYGON_MUMBAI = 80001,
|
|
1383
|
+
* POLYGON_AMOY = 80002,
|
|
1382
1384
|
* MOONBEAM = 1284,
|
|
1383
1385
|
* MOONBASE_ALPHA = 1287,
|
|
1384
1386
|
* AVALANCHE = 43114,
|
|
@@ -1427,7 +1429,7 @@ class EscrowUtils {
|
|
|
1427
1429
|
* ```ts
|
|
1428
1430
|
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
1429
1431
|
*
|
|
1430
|
-
* const escrowData = new EscrowUtils.getEscrow(ChainId.
|
|
1432
|
+
* const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1431
1433
|
* ```
|
|
1432
1434
|
*/
|
|
1433
1435
|
static async getEscrow(chainId, escrowAddress) {
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAwBhD,eAAO,MAAM,iBAAiB,WAAY,cAAc,mCAuBvD,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAAW,MAAM,mCAwBzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
|
|
@@ -23,6 +23,7 @@ const LEADER_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
23
23
|
publicKey
|
|
24
24
|
webhookUrl
|
|
25
25
|
url
|
|
26
|
+
jobTypes
|
|
26
27
|
}
|
|
27
28
|
`;
|
|
28
29
|
const GET_LEADERS_QUERY = (filter) => {
|
|
@@ -64,7 +65,9 @@ const GET_REPUTATION_NETWORK_QUERY = (role) => {
|
|
|
64
65
|
${WHERE_CLAUSE}
|
|
65
66
|
) {
|
|
66
67
|
address,
|
|
67
|
-
role
|
|
68
|
+
role,
|
|
69
|
+
url,
|
|
70
|
+
jobTypes
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -29,6 +29,10 @@ export interface ILeader {
|
|
|
29
29
|
publicKey?: string;
|
|
30
30
|
webhookUrl?: string;
|
|
31
31
|
url?: string;
|
|
32
|
+
jobTypes?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface ILeaderSubgraph extends Omit<ILeader, 'jobTypes'> {
|
|
35
|
+
jobTypes?: string;
|
|
32
36
|
}
|
|
33
37
|
export interface ILeadersFilter {
|
|
34
38
|
networks: ChainId[];
|
|
@@ -39,9 +43,17 @@ export interface IReputationNetwork {
|
|
|
39
43
|
address: string;
|
|
40
44
|
operators: IOperator[];
|
|
41
45
|
}
|
|
46
|
+
export interface IReputationNetworkSubgraph extends Omit<IReputationNetwork, 'operators'> {
|
|
47
|
+
operators: IOperatorSubgraph[];
|
|
48
|
+
}
|
|
42
49
|
export interface IOperator {
|
|
43
50
|
address: string;
|
|
44
51
|
role?: string;
|
|
52
|
+
url?: string;
|
|
53
|
+
jobTypes?: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes'> {
|
|
56
|
+
jobTypes?: string;
|
|
45
57
|
}
|
|
46
58
|
export interface IEscrowsFilter {
|
|
47
59
|
launcher?: string;
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -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,MAAM,SAAS,CAAC;AAElC,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,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,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRo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,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;CACX"}
|
package/dist/kvstore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kvstore.d.ts","sourceRoot":"","sources":["../src/kvstore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAa1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"kvstore.d.ts","sourceRoot":"","sources":["../src/kvstore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAa1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,qBAAa,aAAc,SAAQ,gBAAgB;IACjD,OAAO,CAAC,QAAQ,CAAU;IAE1B;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;IAS5D;;;;;;;;OAQG;WACiB,KAAK,CAAC,MAAM,EAAE,cAAc;IAiBhD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IAEU,GAAG,CACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,SAAc,GACxB,OAAO,CAAC,IAAI,CAAC;IAShB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IAEU,OAAO,CAClB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,GAAE,SAAc,GACxB,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IAEU,iBAAiB,CAC5B,GAAG,EAAE,MAAM,EACX,MAAM,SAAQ,EACd,SAAS,GAAE,SAAc,GACxB,OAAO,CAAC,IAAI,CAAC;IAwBhB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAa/D;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACU,uBAAuB,CAClC,OAAO,EAAE,MAAM,EACf,MAAM,SAAQ,GACb,OAAO,CAAC,MAAM,CAAC;IAkClB;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAc5D"}
|
package/dist/operator.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class OperatorUtils {
|
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
15
15
|
*
|
|
16
|
-
* const leader = await OperatorUtils.getLeader(ChainId.
|
|
16
|
+
* const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
static getLeader(chainId: ChainId, address: string): Promise<ILeader>;
|
|
@@ -44,7 +44,7 @@ export declare class OperatorUtils {
|
|
|
44
44
|
* ```typescript
|
|
45
45
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
46
46
|
*
|
|
47
|
-
* const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.
|
|
47
|
+
* const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
static getReputationNetworkOperators(chainId: ChainId, address: string, role?: string): Promise<IOperator[]>;
|
|
@@ -60,7 +60,7 @@ export declare class OperatorUtils {
|
|
|
60
60
|
* ```ts
|
|
61
61
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
62
62
|
*
|
|
63
|
-
* const rewards = await OperatorUtils.getRewards(ChainId.
|
|
63
|
+
* const rewards = await OperatorUtils.getRewards(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
66
|
static getRewards(chainId: ChainId, slasherAddress: string): Promise<IReward[]>;
|
package/dist/operator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,
|
|
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;IA0BnB;;;;;;;;;;;;;;OAcG;WACiB,UAAU,CAC5B,MAAM,GAAE,cAAqD,GAC5D,OAAO,CAAC,OAAO,EAAE,CAAC;IA4BrB;;;;;;;;;;;;;OAaG;WACiB,6BAA6B,CAC/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC;IAuBvB;;;;;;;;;;;;;;OAcG;WACiB,UAAU,CAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,EAAE,CAAC;CA2BtB"}
|
package/dist/operator.js
CHANGED
|
@@ -26,7 +26,7 @@ class OperatorUtils {
|
|
|
26
26
|
* ```ts
|
|
27
27
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
28
28
|
*
|
|
29
|
-
* const leader = await OperatorUtils.getLeader(ChainId.
|
|
29
|
+
* const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
static async getLeader(chainId, address) {
|
|
@@ -41,7 +41,10 @@ class OperatorUtils {
|
|
|
41
41
|
const { leader } = await (0, graphql_request_1.default)(networkData.subgraphUrl, operator_1.GET_LEADER_QUERY, {
|
|
42
42
|
address: address.toLowerCase(),
|
|
43
43
|
});
|
|
44
|
-
return
|
|
44
|
+
return {
|
|
45
|
+
...leader,
|
|
46
|
+
jobTypes: leader.jobTypes?.split(','),
|
|
47
|
+
};
|
|
45
48
|
}
|
|
46
49
|
catch (e) {
|
|
47
50
|
return (0, utils_1.throwError)(e);
|
|
@@ -62,7 +65,7 @@ class OperatorUtils {
|
|
|
62
65
|
* const leaders = await OperatorUtils.getLeaders();
|
|
63
66
|
* ```
|
|
64
67
|
*/
|
|
65
|
-
static async getLeaders(filter = { networks: [enums_1.ChainId.
|
|
68
|
+
static async getLeaders(filter = { networks: [enums_1.ChainId.POLYGON_AMOY] }) {
|
|
66
69
|
try {
|
|
67
70
|
let leaders_data = [];
|
|
68
71
|
for (const chainId of filter.networks) {
|
|
@@ -73,7 +76,10 @@ class OperatorUtils {
|
|
|
73
76
|
const { leaders } = await (0, graphql_request_1.default)(networkData.subgraphUrl, (0, operator_1.GET_LEADERS_QUERY)(filter), {
|
|
74
77
|
role: filter.role,
|
|
75
78
|
});
|
|
76
|
-
leaders_data = leaders_data.concat(leaders)
|
|
79
|
+
leaders_data = leaders_data.concat(leaders.map((leader) => ({
|
|
80
|
+
...leader,
|
|
81
|
+
jobTypes: leader.jobTypes?.split(','),
|
|
82
|
+
})));
|
|
77
83
|
}
|
|
78
84
|
return leaders_data;
|
|
79
85
|
}
|
|
@@ -92,7 +98,7 @@ class OperatorUtils {
|
|
|
92
98
|
* ```typescript
|
|
93
99
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
94
100
|
*
|
|
95
|
-
* const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.
|
|
101
|
+
* const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
96
102
|
* ```
|
|
97
103
|
*/
|
|
98
104
|
static async getReputationNetworkOperators(chainId, address, role) {
|
|
@@ -105,7 +111,10 @@ class OperatorUtils {
|
|
|
105
111
|
address: address.toLowerCase(),
|
|
106
112
|
role: role,
|
|
107
113
|
});
|
|
108
|
-
return reputationNetwork.operators
|
|
114
|
+
return reputationNetwork.operators.map((operator) => ({
|
|
115
|
+
...operator,
|
|
116
|
+
jobTypes: operator.jobTypes?.split(','),
|
|
117
|
+
}));
|
|
109
118
|
}
|
|
110
119
|
catch (e) {
|
|
111
120
|
return (0, utils_1.throwError)(e);
|
|
@@ -123,7 +132,7 @@ class OperatorUtils {
|
|
|
123
132
|
* ```ts
|
|
124
133
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
125
134
|
*
|
|
126
|
-
* const rewards = await OperatorUtils.getRewards(ChainId.
|
|
135
|
+
* const rewards = await OperatorUtils.getRewards(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
127
136
|
* ```
|
|
128
137
|
*/
|
|
129
138
|
static async getRewards(chainId, slasherAddress) {
|
package/dist/statistics.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ import { NetworkData } from './types';
|
|
|
35
35
|
* ```ts
|
|
36
36
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
37
37
|
*
|
|
38
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
38
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
export declare class StatisticsClient {
|
|
@@ -86,7 +86,7 @@ export declare class StatisticsClient {
|
|
|
86
86
|
* ```ts
|
|
87
87
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
88
88
|
*
|
|
89
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
89
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
90
90
|
*
|
|
91
91
|
* const escrowStatistics = await statisticsClient.getEscrowStatistics();
|
|
92
92
|
* const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({
|
|
@@ -131,7 +131,7 @@ export declare class StatisticsClient {
|
|
|
131
131
|
* ```ts
|
|
132
132
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
133
133
|
*
|
|
134
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
134
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
135
135
|
*
|
|
136
136
|
* const workerStatistics = await statisticsClient.getWorkerStatistics();
|
|
137
137
|
* const workerStatisticsApril = await statisticsClient.getWorkerStatistics({
|
|
@@ -178,7 +178,7 @@ export declare class StatisticsClient {
|
|
|
178
178
|
* ```ts
|
|
179
179
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
180
180
|
*
|
|
181
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
181
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
182
182
|
*
|
|
183
183
|
* console.log(
|
|
184
184
|
* 'Payment statistics:',
|
|
@@ -254,7 +254,7 @@ export declare class StatisticsClient {
|
|
|
254
254
|
* ```ts
|
|
255
255
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
256
256
|
*
|
|
257
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
257
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
258
258
|
*
|
|
259
259
|
* const hmtStatistics = await statisticsClient.getHMTStatistics();
|
|
260
260
|
*
|
package/dist/statistics.js
CHANGED
|
@@ -43,7 +43,7 @@ const utils_1 = require("./utils");
|
|
|
43
43
|
* ```ts
|
|
44
44
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
45
45
|
*
|
|
46
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
46
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
class StatisticsClient {
|
|
@@ -95,7 +95,7 @@ class StatisticsClient {
|
|
|
95
95
|
* ```ts
|
|
96
96
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
97
97
|
*
|
|
98
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
98
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
99
99
|
*
|
|
100
100
|
* const escrowStatistics = await statisticsClient.getEscrowStatistics();
|
|
101
101
|
* const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({
|
|
@@ -162,7 +162,7 @@ class StatisticsClient {
|
|
|
162
162
|
* ```ts
|
|
163
163
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
164
164
|
*
|
|
165
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
165
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
166
166
|
*
|
|
167
167
|
* const workerStatistics = await statisticsClient.getWorkerStatistics();
|
|
168
168
|
* const workerStatisticsApril = await statisticsClient.getWorkerStatistics({
|
|
@@ -225,7 +225,7 @@ class StatisticsClient {
|
|
|
225
225
|
* ```ts
|
|
226
226
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
227
227
|
*
|
|
228
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
228
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
229
229
|
*
|
|
230
230
|
* console.log(
|
|
231
231
|
* 'Payment statistics:',
|
|
@@ -322,7 +322,7 @@ class StatisticsClient {
|
|
|
322
322
|
* ```ts
|
|
323
323
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
324
324
|
*
|
|
325
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
325
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
326
326
|
*
|
|
327
327
|
* const hmtStatistics = await statisticsClient.getHMTStatistics();
|
|
328
328
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@human-protocol/sdk",
|
|
3
3
|
"description": "Human Protocol SDK",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.3",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
7
7
|
"dist"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"graphql-request": "^6.1.0",
|
|
47
47
|
"graphql-tag": "^2.12.6",
|
|
48
48
|
"minio": "^7.0.32",
|
|
49
|
-
"openpgp": "^5.
|
|
49
|
+
"openpgp": "^5.11.1",
|
|
50
50
|
"secp256k1": "^4.0.3",
|
|
51
51
|
"vitest": "^0.30.1",
|
|
52
52
|
"winston": "^3.13.0"
|
package/src/constants.ts
CHANGED
|
@@ -93,6 +93,20 @@ export const NETWORKS: {
|
|
|
93
93
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli',
|
|
94
94
|
oldFactoryAddress: '0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F',
|
|
95
95
|
},
|
|
96
|
+
[ChainId.SEPOLIA]: {
|
|
97
|
+
chainId: ChainId.SEPOLIA,
|
|
98
|
+
title: 'Ethereum Sepolia',
|
|
99
|
+
scanUrl: 'https://sepolia.etherscan.io/',
|
|
100
|
+
factoryAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
101
|
+
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
102
|
+
stakingAddress: '0x2B9C5EC6220BA8Ad08CB51A60FFdbC6a6235B203',
|
|
103
|
+
rewardPoolAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
104
|
+
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
105
|
+
subgraphUrl:
|
|
106
|
+
'https://subgraph.satsuma-prod.com/8d51f9873a51/team--2543/humanprotocol-sepolia/api',
|
|
107
|
+
oldSubgraphUrl: '',
|
|
108
|
+
oldFactoryAddress: '',
|
|
109
|
+
},
|
|
96
110
|
[ChainId.BSC_MAINNET]: {
|
|
97
111
|
chainId: ChainId.BSC_MAINNET,
|
|
98
112
|
title: 'Binance Smart Chain',
|
|
@@ -151,6 +165,20 @@ export const NETWORKS: {
|
|
|
151
165
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai',
|
|
152
166
|
oldFactoryAddress: '0x558cd800f9F0B02f3B149667bDe003284c867E94',
|
|
153
167
|
},
|
|
168
|
+
[ChainId.POLYGON_AMOY]: {
|
|
169
|
+
chainId: ChainId.POLYGON_AMOY,
|
|
170
|
+
title: 'Polygon Amoy',
|
|
171
|
+
scanUrl: 'https://www.oklink.com/amoy',
|
|
172
|
+
factoryAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
173
|
+
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
174
|
+
stakingAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
175
|
+
rewardPoolAddress: '0xd866bCEFf6D0F77E1c3EAE28230AE6C79b03fDa7',
|
|
176
|
+
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
177
|
+
subgraphUrl:
|
|
178
|
+
'https://subgraph.satsuma-prod.com/8d51f9873a51/team--2543/humanprotocol-amoy/api',
|
|
179
|
+
oldSubgraphUrl: '',
|
|
180
|
+
oldFactoryAddress: '',
|
|
181
|
+
},
|
|
154
182
|
[ChainId.MOONBEAM]: {
|
|
155
183
|
chainId: ChainId.MOONBEAM,
|
|
156
184
|
title: 'Moonbeam',
|
|
@@ -272,10 +300,10 @@ export const KVStoreKeys = {
|
|
|
272
300
|
publicKey: 'public_key',
|
|
273
301
|
webhookUrl: 'webhook_url',
|
|
274
302
|
url: 'url',
|
|
303
|
+
jobTypes: 'job_types',
|
|
275
304
|
};
|
|
276
305
|
|
|
277
306
|
export const Role = {
|
|
278
|
-
Validator: 'Validator',
|
|
279
307
|
JobLauncher: 'Job Launcher',
|
|
280
308
|
ExchangeOracle: 'Exchange Oracle',
|
|
281
309
|
ReputationOracle: 'Reputation Oracle',
|
package/src/enums.ts
CHANGED
|
@@ -3,10 +3,12 @@ export enum ChainId {
|
|
|
3
3
|
MAINNET = 1,
|
|
4
4
|
RINKEBY = 4,
|
|
5
5
|
GOERLI = 5,
|
|
6
|
+
SEPOLIA = 11155111,
|
|
6
7
|
BSC_MAINNET = 56,
|
|
7
8
|
BSC_TESTNET = 97,
|
|
8
9
|
POLYGON = 137,
|
|
9
10
|
POLYGON_MUMBAI = 80001,
|
|
11
|
+
POLYGON_AMOY = 80002,
|
|
10
12
|
MOONBEAM = 1284,
|
|
11
13
|
MOONBASE_ALPHA = 1287,
|
|
12
14
|
AVALANCHE_TESTNET = 43113,
|
package/src/escrow.ts
CHANGED
|
@@ -486,7 +486,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
486
486
|
);
|
|
487
487
|
await (
|
|
488
488
|
await tokenContract.transfer(escrowAddress, amount, txOptions)
|
|
489
|
-
).wait;
|
|
489
|
+
).wait();
|
|
490
490
|
|
|
491
491
|
return;
|
|
492
492
|
} catch (e) {
|
|
@@ -1399,7 +1399,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
1399
1399
|
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
1400
1400
|
*
|
|
1401
1401
|
* const escrowAddresses = new EscrowUtils.getEscrows({
|
|
1402
|
-
* networks: [ChainId.
|
|
1402
|
+
* networks: [ChainId.POLYGON_AMOY]
|
|
1403
1403
|
* });
|
|
1404
1404
|
* ```
|
|
1405
1405
|
*/
|
|
@@ -1434,6 +1434,7 @@ export class EscrowUtils {
|
|
|
1434
1434
|
* BSC_TESTNET = 97,
|
|
1435
1435
|
* POLYGON = 137,
|
|
1436
1436
|
* POLYGON_MUMBAI = 80001,
|
|
1437
|
+
* POLYGON_AMOY=80002,
|
|
1437
1438
|
* MOONBEAM = 1284,
|
|
1438
1439
|
* MOONBASE_ALPHA = 1287,
|
|
1439
1440
|
* AVALANCHE = 43114,
|
|
@@ -1496,7 +1497,7 @@ export class EscrowUtils {
|
|
|
1496
1497
|
* status: EscrowStatus.Pending,
|
|
1497
1498
|
* from: new Date(2023, 4, 8),
|
|
1498
1499
|
* to: new Date(2023, 5, 8),
|
|
1499
|
-
* networks: [ChainId.
|
|
1500
|
+
* networks: [ChainId.POLYGON_AMOY]
|
|
1500
1501
|
* };
|
|
1501
1502
|
* const escrowDatas = await EscrowUtils.getEscrows(filters);
|
|
1502
1503
|
* ```
|
|
@@ -1578,6 +1579,7 @@ export class EscrowUtils {
|
|
|
1578
1579
|
* BSC_TESTNET = 97,
|
|
1579
1580
|
* POLYGON = 137,
|
|
1580
1581
|
* POLYGON_MUMBAI = 80001,
|
|
1582
|
+
* POLYGON_AMOY = 80002,
|
|
1581
1583
|
* MOONBEAM = 1284,
|
|
1582
1584
|
* MOONBASE_ALPHA = 1287,
|
|
1583
1585
|
* AVALANCHE = 43114,
|
|
@@ -1626,7 +1628,7 @@ export class EscrowUtils {
|
|
|
1626
1628
|
* ```ts
|
|
1627
1629
|
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
1628
1630
|
*
|
|
1629
|
-
* const escrowData = new EscrowUtils.getEscrow(ChainId.
|
|
1631
|
+
* const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1630
1632
|
* ```
|
|
1631
1633
|
*/
|
|
1632
1634
|
public static async getEscrow(
|
|
@@ -19,6 +19,7 @@ const LEADER_FRAGMENT = gql`
|
|
|
19
19
|
publicKey
|
|
20
20
|
webhookUrl
|
|
21
21
|
url
|
|
22
|
+
jobTypes
|
|
22
23
|
}
|
|
23
24
|
`;
|
|
24
25
|
|
|
@@ -64,7 +65,9 @@ export const GET_REPUTATION_NETWORK_QUERY = (role?: string) => {
|
|
|
64
65
|
${WHERE_CLAUSE}
|
|
65
66
|
) {
|
|
66
67
|
address,
|
|
67
|
-
role
|
|
68
|
+
role,
|
|
69
|
+
url,
|
|
70
|
+
jobTypes
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
}
|
package/src/interfaces.ts
CHANGED
|
@@ -32,6 +32,11 @@ export interface ILeader {
|
|
|
32
32
|
publicKey?: string;
|
|
33
33
|
webhookUrl?: string;
|
|
34
34
|
url?: string;
|
|
35
|
+
jobTypes?: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ILeaderSubgraph extends Omit<ILeader, 'jobTypes'> {
|
|
39
|
+
jobTypes?: string;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
export interface ILeadersFilter {
|
|
@@ -45,9 +50,20 @@ export interface IReputationNetwork {
|
|
|
45
50
|
operators: IOperator[];
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
export interface IReputationNetworkSubgraph
|
|
54
|
+
extends Omit<IReputationNetwork, 'operators'> {
|
|
55
|
+
operators: IOperatorSubgraph[];
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
export interface IOperator {
|
|
49
59
|
address: string;
|
|
50
60
|
role?: string;
|
|
61
|
+
url?: string;
|
|
62
|
+
jobTypes?: string[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes'> {
|
|
66
|
+
jobTypes?: string;
|
|
51
67
|
}
|
|
52
68
|
|
|
53
69
|
export interface IEscrowsFilter {
|
package/src/kvstore.ts
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
} from './error';
|
|
19
19
|
import { NetworkData } from './types';
|
|
20
20
|
import { isValidUrl } from './utils';
|
|
21
|
-
|
|
22
21
|
/**
|
|
23
22
|
* ## Introduction
|
|
24
23
|
*
|
|
@@ -88,6 +87,7 @@ import { isValidUrl } from './utils';
|
|
|
88
87
|
* const kvstoreClient = await KVStoreClient.build(signer);
|
|
89
88
|
* ```
|
|
90
89
|
*/
|
|
90
|
+
|
|
91
91
|
export class KVStoreClient extends BaseEthersClient {
|
|
92
92
|
private contract: KVStore;
|
|
93
93
|
|
package/src/operator.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import gqlFetch from 'graphql-request';
|
|
3
3
|
import {
|
|
4
4
|
ILeader,
|
|
5
|
+
ILeaderSubgraph,
|
|
5
6
|
ILeadersFilter,
|
|
6
7
|
IOperator,
|
|
7
|
-
|
|
8
|
+
IReputationNetworkSubgraph,
|
|
8
9
|
IReward,
|
|
9
10
|
} from './interfaces';
|
|
10
11
|
import { GET_REWARD_ADDED_EVENTS_QUERY } from './graphql/queries/reward';
|
|
@@ -37,7 +38,7 @@ export class OperatorUtils {
|
|
|
37
38
|
* ```ts
|
|
38
39
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
39
40
|
*
|
|
40
|
-
* const leader = await OperatorUtils.getLeader(ChainId.
|
|
41
|
+
* const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
43
44
|
public static async getLeader(
|
|
@@ -55,12 +56,15 @@ export class OperatorUtils {
|
|
|
55
56
|
|
|
56
57
|
try {
|
|
57
58
|
const { leader } = await gqlFetch<{
|
|
58
|
-
leader:
|
|
59
|
+
leader: ILeaderSubgraph;
|
|
59
60
|
}>(networkData.subgraphUrl, GET_LEADER_QUERY, {
|
|
60
61
|
address: address.toLowerCase(),
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
return
|
|
64
|
+
return {
|
|
65
|
+
...leader,
|
|
66
|
+
jobTypes: leader.jobTypes?.split(','),
|
|
67
|
+
};
|
|
64
68
|
} catch (e) {
|
|
65
69
|
return throwError(e);
|
|
66
70
|
}
|
|
@@ -82,7 +86,7 @@ export class OperatorUtils {
|
|
|
82
86
|
* ```
|
|
83
87
|
*/
|
|
84
88
|
public static async getLeaders(
|
|
85
|
-
filter: ILeadersFilter = { networks: [ChainId.
|
|
89
|
+
filter: ILeadersFilter = { networks: [ChainId.POLYGON_AMOY] }
|
|
86
90
|
): Promise<ILeader[]> {
|
|
87
91
|
try {
|
|
88
92
|
let leaders_data: ILeader[] = [];
|
|
@@ -93,11 +97,16 @@ export class OperatorUtils {
|
|
|
93
97
|
throw ErrorUnsupportedChainID;
|
|
94
98
|
}
|
|
95
99
|
const { leaders } = await gqlFetch<{
|
|
96
|
-
leaders:
|
|
100
|
+
leaders: ILeaderSubgraph[];
|
|
97
101
|
}>(networkData.subgraphUrl, GET_LEADERS_QUERY(filter), {
|
|
98
102
|
role: filter.role,
|
|
99
103
|
});
|
|
100
|
-
leaders_data = leaders_data.concat(
|
|
104
|
+
leaders_data = leaders_data.concat(
|
|
105
|
+
leaders.map((leader) => ({
|
|
106
|
+
...leader,
|
|
107
|
+
jobTypes: leader.jobTypes?.split(','),
|
|
108
|
+
}))
|
|
109
|
+
);
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
return leaders_data;
|
|
@@ -117,7 +126,7 @@ export class OperatorUtils {
|
|
|
117
126
|
* ```typescript
|
|
118
127
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
119
128
|
*
|
|
120
|
-
* const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.
|
|
129
|
+
* const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
121
130
|
* ```
|
|
122
131
|
*/
|
|
123
132
|
public static async getReputationNetworkOperators(
|
|
@@ -132,13 +141,16 @@ export class OperatorUtils {
|
|
|
132
141
|
}
|
|
133
142
|
try {
|
|
134
143
|
const { reputationNetwork } = await gqlFetch<{
|
|
135
|
-
reputationNetwork:
|
|
144
|
+
reputationNetwork: IReputationNetworkSubgraph;
|
|
136
145
|
}>(networkData.subgraphUrl, GET_REPUTATION_NETWORK_QUERY(role), {
|
|
137
146
|
address: address.toLowerCase(),
|
|
138
147
|
role: role,
|
|
139
148
|
});
|
|
140
149
|
|
|
141
|
-
return reputationNetwork.operators
|
|
150
|
+
return reputationNetwork.operators.map((operator) => ({
|
|
151
|
+
...operator,
|
|
152
|
+
jobTypes: operator.jobTypes?.split(','),
|
|
153
|
+
}));
|
|
142
154
|
} catch (e) {
|
|
143
155
|
return throwError(e);
|
|
144
156
|
}
|
|
@@ -156,7 +168,7 @@ export class OperatorUtils {
|
|
|
156
168
|
* ```ts
|
|
157
169
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
158
170
|
*
|
|
159
|
-
* const rewards = await OperatorUtils.getRewards(ChainId.
|
|
171
|
+
* const rewards = await OperatorUtils.getRewards(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
160
172
|
* ```
|
|
161
173
|
*/
|
|
162
174
|
public static async getRewards(
|
package/src/statistics.ts
CHANGED
|
@@ -54,7 +54,7 @@ import { throwError } from './utils';
|
|
|
54
54
|
* ```ts
|
|
55
55
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
56
56
|
*
|
|
57
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
57
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
export class StatisticsClient {
|
|
@@ -109,7 +109,7 @@ export class StatisticsClient {
|
|
|
109
109
|
* ```ts
|
|
110
110
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
111
111
|
*
|
|
112
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
112
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
113
113
|
*
|
|
114
114
|
* const escrowStatistics = await statisticsClient.getEscrowStatistics();
|
|
115
115
|
* const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({
|
|
@@ -184,7 +184,7 @@ export class StatisticsClient {
|
|
|
184
184
|
* ```ts
|
|
185
185
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
186
186
|
*
|
|
187
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
187
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
188
188
|
*
|
|
189
189
|
* const workerStatistics = await statisticsClient.getWorkerStatistics();
|
|
190
190
|
* const workerStatisticsApril = await statisticsClient.getWorkerStatistics({
|
|
@@ -252,7 +252,7 @@ export class StatisticsClient {
|
|
|
252
252
|
* ```ts
|
|
253
253
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
254
254
|
*
|
|
255
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
255
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
256
256
|
*
|
|
257
257
|
* console.log(
|
|
258
258
|
* 'Payment statistics:',
|
|
@@ -355,7 +355,7 @@ export class StatisticsClient {
|
|
|
355
355
|
* ```ts
|
|
356
356
|
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
357
357
|
*
|
|
358
|
-
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.
|
|
358
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
359
359
|
*
|
|
360
360
|
* const hmtStatistics = await statisticsClient.getHMTStatistics();
|
|
361
361
|
*
|