@human-protocol/sdk 5.2.0 → 6.0.0
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/base.d.ts +4 -5
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +4 -5
- package/dist/constants.js +6 -6
- package/dist/encryption.d.ts +68 -203
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +66 -202
- package/dist/error.d.ts +0 -24
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +2 -26
- package/dist/escrow.d.ts +427 -780
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +314 -684
- package/dist/graphql/queries/operator.d.ts.map +1 -1
- package/dist/graphql/queries/operator.js +3 -1
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/kvstore.d.ts +119 -181
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +119 -182
- package/dist/operator.d.ts +59 -30
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +59 -30
- package/dist/staking.d.ts +135 -134
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +135 -134
- package/dist/statistics.d.ts +104 -134
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +119 -144
- package/dist/transaction.d.ts +36 -15
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +36 -15
- package/dist/types.d.ts +0 -54
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +31 -17
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +31 -17
- package/dist/worker.d.ts +35 -14
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +35 -14
- package/package.json +7 -24
- package/src/base.ts +4 -5
- package/src/constants.ts +6 -6
- package/src/encryption.ts +69 -203
- package/src/error.ts +0 -36
- package/src/escrow.ts +425 -780
- package/src/graphql/queries/operator.ts +3 -1
- package/src/graphql/types.ts +4 -2
- package/src/index.ts +4 -5
- package/src/kvstore.ts +120 -183
- package/src/operator.ts +59 -30
- package/src/staking.ts +135 -134
- package/src/statistics.ts +125 -146
- package/src/transaction.ts +36 -15
- package/src/types.ts +0 -57
- package/src/utils.ts +31 -17
- package/src/worker.ts +35 -14
- package/dist/storage.d.ts +0 -186
- package/dist/storage.d.ts.map +0 -1
- package/dist/storage.js +0 -319
- package/src/storage.ts +0 -313
package/dist/utils.d.ts
CHANGED
|
@@ -1,44 +1,58 @@
|
|
|
1
1
|
import { NetworkData } from './types';
|
|
2
2
|
import { SubgraphOptions } from './interfaces';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Handles and throws appropriate error types based on the Ethereum error.
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @
|
|
6
|
+
* @param e - The error to handle
|
|
7
|
+
* @throws {InvalidArgumentError} If the error is an invalid argument error
|
|
8
|
+
* @throws {ContractExecutionError} If the error is a contract execution error
|
|
9
|
+
* @throws {TransactionReplaced} If the transaction was replaced
|
|
10
|
+
* @throws {ReplacementUnderpriced} If the replacement transaction was underpriced
|
|
11
|
+
* @throws {NumericFault} If there's a numeric fault
|
|
12
|
+
* @throws {NonceExpired} If the nonce has expired
|
|
13
|
+
* @throws {EthereumError} For any other Ethereum-related error
|
|
8
14
|
*/
|
|
9
15
|
export declare const throwError: (e: any) => never;
|
|
10
16
|
/**
|
|
11
|
-
*
|
|
17
|
+
* Validates if a string is a valid URL.
|
|
12
18
|
*
|
|
13
|
-
* @param
|
|
14
|
-
* @returns
|
|
19
|
+
* @param url - The URL string to validate
|
|
20
|
+
* @returns True if the URL is valid, false otherwise
|
|
15
21
|
*/
|
|
16
22
|
export declare const isValidUrl: (url: string) => boolean;
|
|
17
23
|
/**
|
|
18
|
-
*
|
|
24
|
+
* Checks if a string is valid JSON.
|
|
19
25
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @returns
|
|
26
|
+
* @param input - The string to check
|
|
27
|
+
* @returns True if the string is valid JSON, false otherwise
|
|
22
28
|
*/
|
|
23
29
|
export declare const isValidJson: (input: string) => boolean;
|
|
24
30
|
/**
|
|
25
|
-
*
|
|
31
|
+
* Gets the subgraph URL for the given network, using API key if available.
|
|
26
32
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @returns
|
|
33
|
+
* @param networkData - The network data containing subgraph URLs
|
|
34
|
+
* @returns The subgraph URL with API key if available
|
|
29
35
|
*/
|
|
30
36
|
export declare const getSubgraphUrl: (networkData: NetworkData) => string;
|
|
31
37
|
/**
|
|
32
|
-
*
|
|
38
|
+
* Converts a Date object to Unix timestamp (seconds since epoch).
|
|
33
39
|
*
|
|
34
|
-
* @param
|
|
35
|
-
* @returns
|
|
40
|
+
* @param date - The date to convert
|
|
41
|
+
* @returns Unix timestamp in seconds
|
|
36
42
|
*/
|
|
37
43
|
export declare const getUnixTimestamp: (date: Date) => number;
|
|
38
44
|
export declare const isIndexerError: (error: any) => boolean;
|
|
39
45
|
/**
|
|
40
|
-
*
|
|
41
|
-
* Only retries if options is provided.
|
|
46
|
+
* Executes a GraphQL request with automatic retry logic for bad indexer errors.
|
|
47
|
+
* Only retries if options is provided with maxRetries and baseDelay.
|
|
48
|
+
*
|
|
49
|
+
* @param url - The GraphQL endpoint URL
|
|
50
|
+
* @param query - The GraphQL query to execute
|
|
51
|
+
* @param variables - Variables for the GraphQL query (optional)
|
|
52
|
+
* @param options - Optional configuration for subgraph requests including retry logic
|
|
53
|
+
* @returns The response data from the GraphQL query
|
|
54
|
+
* @throws ErrorRetryParametersMissing If only one of maxRetries or baseDelay is provided
|
|
55
|
+
* @throws ErrorRoutingRequestsToIndexerRequiresApiKey If indexerId is provided without API key
|
|
42
56
|
*/
|
|
43
57
|
export declare const customGqlFetch: <T = any>(url: string, query: any, variables?: any, options?: SubgraphOptions) => Promise<T>;
|
|
44
58
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,GAAG,UAgBhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,OAMxC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,OAO3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,aAAa,WAAW,WAatD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,IAAI,KAAG,MAE7C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,GAAG,KAAG,OAS3C,CAAC;AAaF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAAU,CAAC,GAAG,GAAG,EAC1C,KAAK,MAAM,EACX,OAAO,GAAG,EACV,YAAY,GAAG,EACf,UAAU,eAAe,KACxB,OAAO,CAAC,CAAC,CA4CX,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -12,10 +12,16 @@ const constants_1 = require("./constants");
|
|
|
12
12
|
const enums_1 = require("./enums");
|
|
13
13
|
const error_1 = require("./error");
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Handles and throws appropriate error types based on the Ethereum error.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @
|
|
17
|
+
* @param e - The error to handle
|
|
18
|
+
* @throws {InvalidArgumentError} If the error is an invalid argument error
|
|
19
|
+
* @throws {ContractExecutionError} If the error is a contract execution error
|
|
20
|
+
* @throws {TransactionReplaced} If the transaction was replaced
|
|
21
|
+
* @throws {ReplacementUnderpriced} If the replacement transaction was underpriced
|
|
22
|
+
* @throws {NumericFault} If there's a numeric fault
|
|
23
|
+
* @throws {NonceExpired} If the nonce has expired
|
|
24
|
+
* @throws {EthereumError} For any other Ethereum-related error
|
|
19
25
|
*/
|
|
20
26
|
const throwError = (e) => {
|
|
21
27
|
if (ethers_1.ethers.isError(e, 'INVALID_ARGUMENT')) {
|
|
@@ -42,10 +48,10 @@ const throwError = (e) => {
|
|
|
42
48
|
};
|
|
43
49
|
exports.throwError = throwError;
|
|
44
50
|
/**
|
|
45
|
-
*
|
|
51
|
+
* Validates if a string is a valid URL.
|
|
46
52
|
*
|
|
47
|
-
* @param
|
|
48
|
-
* @returns
|
|
53
|
+
* @param url - The URL string to validate
|
|
54
|
+
* @returns True if the URL is valid, false otherwise
|
|
49
55
|
*/
|
|
50
56
|
const isValidUrl = (url) => {
|
|
51
57
|
return (0, validator_1.isURL)(url, {
|
|
@@ -56,10 +62,10 @@ const isValidUrl = (url) => {
|
|
|
56
62
|
};
|
|
57
63
|
exports.isValidUrl = isValidUrl;
|
|
58
64
|
/**
|
|
59
|
-
*
|
|
65
|
+
* Checks if a string is valid JSON.
|
|
60
66
|
*
|
|
61
|
-
* @param
|
|
62
|
-
* @returns
|
|
67
|
+
* @param input - The string to check
|
|
68
|
+
* @returns True if the string is valid JSON, false otherwise
|
|
63
69
|
*/
|
|
64
70
|
const isValidJson = (input) => {
|
|
65
71
|
try {
|
|
@@ -72,10 +78,10 @@ const isValidJson = (input) => {
|
|
|
72
78
|
};
|
|
73
79
|
exports.isValidJson = isValidJson;
|
|
74
80
|
/**
|
|
75
|
-
*
|
|
81
|
+
* Gets the subgraph URL for the given network, using API key if available.
|
|
76
82
|
*
|
|
77
|
-
* @param
|
|
78
|
-
* @returns
|
|
83
|
+
* @param networkData - The network data containing subgraph URLs
|
|
84
|
+
* @returns The subgraph URL with API key if available
|
|
79
85
|
*/
|
|
80
86
|
const getSubgraphUrl = (networkData) => {
|
|
81
87
|
let subgraphUrl = networkData.subgraphUrl;
|
|
@@ -90,10 +96,10 @@ const getSubgraphUrl = (networkData) => {
|
|
|
90
96
|
};
|
|
91
97
|
exports.getSubgraphUrl = getSubgraphUrl;
|
|
92
98
|
/**
|
|
93
|
-
*
|
|
99
|
+
* Converts a Date object to Unix timestamp (seconds since epoch).
|
|
94
100
|
*
|
|
95
|
-
* @param
|
|
96
|
-
* @returns
|
|
101
|
+
* @param date - The date to convert
|
|
102
|
+
* @returns Unix timestamp in seconds
|
|
97
103
|
*/
|
|
98
104
|
const getUnixTimestamp = (date) => {
|
|
99
105
|
return Math.floor(date.getTime() / 1000);
|
|
@@ -119,8 +125,16 @@ const buildIndexerUrl = (baseUrl, indexerId) => {
|
|
|
119
125
|
return `${baseUrl}/indexers/id/${indexerId}`;
|
|
120
126
|
};
|
|
121
127
|
/**
|
|
122
|
-
*
|
|
123
|
-
* Only retries if options is provided.
|
|
128
|
+
* Executes a GraphQL request with automatic retry logic for bad indexer errors.
|
|
129
|
+
* Only retries if options is provided with maxRetries and baseDelay.
|
|
130
|
+
*
|
|
131
|
+
* @param url - The GraphQL endpoint URL
|
|
132
|
+
* @param query - The GraphQL query to execute
|
|
133
|
+
* @param variables - Variables for the GraphQL query (optional)
|
|
134
|
+
* @param options - Optional configuration for subgraph requests including retry logic
|
|
135
|
+
* @returns The response data from the GraphQL query
|
|
136
|
+
* @throws ErrorRetryParametersMissing If only one of maxRetries or baseDelay is provided
|
|
137
|
+
* @throws ErrorRoutingRequestsToIndexerRequiresApiKey If indexerId is provided without API key
|
|
124
138
|
*/
|
|
125
139
|
const customGqlFetch = async (url, query, variables, options) => {
|
|
126
140
|
const apiKey = process.env.SUBGRAPH_API_KEY;
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,20 +1,39 @@
|
|
|
1
1
|
import { ChainId } from './enums';
|
|
2
2
|
import { IWorker, IWorkersFilter, SubgraphOptions } from './interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Utility class for worker-related operations.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { WorkerUtils, ChainId } from '@human-protocol/sdk';
|
|
9
|
+
*
|
|
10
|
+
* const worker = await WorkerUtils.getWorker(
|
|
11
|
+
* ChainId.POLYGON_AMOY,
|
|
12
|
+
* '0x1234567890abcdef1234567890abcdef12345678'
|
|
13
|
+
* );
|
|
14
|
+
* console.log('Worker:', worker);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
3
17
|
export declare class WorkerUtils {
|
|
4
18
|
/**
|
|
5
19
|
* This function returns the worker data for the given address.
|
|
6
20
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
11
|
-
*
|
|
12
|
-
*
|
|
21
|
+
* @param chainId - The chain ID.
|
|
22
|
+
* @param address - The worker address.
|
|
23
|
+
* @param options - Optional configuration for subgraph requests.
|
|
24
|
+
* @returns Returns the worker details or null if not found.
|
|
25
|
+
* @throws ErrorUnsupportedChainID If the chain ID is not supported
|
|
26
|
+
* @throws ErrorInvalidAddress If the address is invalid
|
|
13
27
|
*
|
|
28
|
+
* @example
|
|
14
29
|
* ```ts
|
|
15
30
|
* import { WorkerUtils, ChainId } from '@human-protocol/sdk';
|
|
16
31
|
*
|
|
17
|
-
* const worker = await WorkerUtils.getWorker(
|
|
32
|
+
* const worker = await WorkerUtils.getWorker(
|
|
33
|
+
* ChainId.POLYGON_AMOY,
|
|
34
|
+
* '0x1234567890abcdef1234567890abcdef12345678'
|
|
35
|
+
* );
|
|
36
|
+
* console.log('Worker:', worker);
|
|
18
37
|
* ```
|
|
19
38
|
*/
|
|
20
39
|
static getWorker(chainId: ChainId, address: string, options?: SubgraphOptions): Promise<IWorker | null>;
|
|
@@ -43,21 +62,23 @@ export declare class WorkerUtils {
|
|
|
43
62
|
* };
|
|
44
63
|
* ```
|
|
45
64
|
*
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @returns
|
|
49
|
-
*
|
|
50
|
-
*
|
|
65
|
+
* @param filter - Filter for the workers.
|
|
66
|
+
* @param options - Optional configuration for subgraph requests.
|
|
67
|
+
* @returns Returns an array with all the worker details.
|
|
68
|
+
* @throws ErrorUnsupportedChainID If the chain ID is not supported
|
|
69
|
+
* @throws ErrorInvalidAddress If the filter address is invalid
|
|
51
70
|
*
|
|
71
|
+
* @example
|
|
52
72
|
* ```ts
|
|
53
73
|
* import { WorkerUtils, ChainId } from '@human-protocol/sdk';
|
|
54
74
|
*
|
|
55
|
-
* const filter
|
|
56
|
-
* chainId: ChainId.
|
|
75
|
+
* const filter = {
|
|
76
|
+
* chainId: ChainId.POLYGON_AMOY,
|
|
57
77
|
* first: 10,
|
|
58
78
|
* skip: 0,
|
|
59
79
|
* };
|
|
60
80
|
* const workers = await WorkerUtils.getWorkers(filter);
|
|
81
|
+
* console.log('Workers:', workers.length);
|
|
61
82
|
* ```
|
|
62
83
|
*/
|
|
63
84
|
static getWorkers(filter: IWorkersFilter, options?: SubgraphOptions): Promise<IWorker[]>;
|
package/dist/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxE,qBAAa,WAAW;IACtB
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxE;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAW;IACtB;;;;;;;;;;;;;;;;;;;;OAoBG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IA0B1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;WACiB,UAAU,CAC5B,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,EAAE,CAAC;CAoCtB"}
|
package/dist/worker.js
CHANGED
|
@@ -7,21 +7,40 @@ const enums_1 = require("./enums");
|
|
|
7
7
|
const error_1 = require("./error");
|
|
8
8
|
const worker_1 = require("./graphql/queries/worker");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
|
+
/**
|
|
11
|
+
* Utility class for worker-related operations.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { WorkerUtils, ChainId } from '@human-protocol/sdk';
|
|
16
|
+
*
|
|
17
|
+
* const worker = await WorkerUtils.getWorker(
|
|
18
|
+
* ChainId.POLYGON_AMOY,
|
|
19
|
+
* '0x1234567890abcdef1234567890abcdef12345678'
|
|
20
|
+
* );
|
|
21
|
+
* console.log('Worker:', worker);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
10
24
|
class WorkerUtils {
|
|
11
25
|
/**
|
|
12
26
|
* This function returns the worker data for the given address.
|
|
13
27
|
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @returns
|
|
18
|
-
*
|
|
19
|
-
*
|
|
28
|
+
* @param chainId - The chain ID.
|
|
29
|
+
* @param address - The worker address.
|
|
30
|
+
* @param options - Optional configuration for subgraph requests.
|
|
31
|
+
* @returns Returns the worker details or null if not found.
|
|
32
|
+
* @throws ErrorUnsupportedChainID If the chain ID is not supported
|
|
33
|
+
* @throws ErrorInvalidAddress If the address is invalid
|
|
20
34
|
*
|
|
35
|
+
* @example
|
|
21
36
|
* ```ts
|
|
22
37
|
* import { WorkerUtils, ChainId } from '@human-protocol/sdk';
|
|
23
38
|
*
|
|
24
|
-
* const worker = await WorkerUtils.getWorker(
|
|
39
|
+
* const worker = await WorkerUtils.getWorker(
|
|
40
|
+
* ChainId.POLYGON_AMOY,
|
|
41
|
+
* '0x1234567890abcdef1234567890abcdef12345678'
|
|
42
|
+
* );
|
|
43
|
+
* console.log('Worker:', worker);
|
|
25
44
|
* ```
|
|
26
45
|
*/
|
|
27
46
|
static async getWorker(chainId, address, options) {
|
|
@@ -64,21 +83,23 @@ class WorkerUtils {
|
|
|
64
83
|
* };
|
|
65
84
|
* ```
|
|
66
85
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @returns
|
|
70
|
-
*
|
|
71
|
-
*
|
|
86
|
+
* @param filter - Filter for the workers.
|
|
87
|
+
* @param options - Optional configuration for subgraph requests.
|
|
88
|
+
* @returns Returns an array with all the worker details.
|
|
89
|
+
* @throws ErrorUnsupportedChainID If the chain ID is not supported
|
|
90
|
+
* @throws ErrorInvalidAddress If the filter address is invalid
|
|
72
91
|
*
|
|
92
|
+
* @example
|
|
73
93
|
* ```ts
|
|
74
94
|
* import { WorkerUtils, ChainId } from '@human-protocol/sdk';
|
|
75
95
|
*
|
|
76
|
-
* const filter
|
|
77
|
-
* chainId: ChainId.
|
|
96
|
+
* const filter = {
|
|
97
|
+
* chainId: ChainId.POLYGON_AMOY,
|
|
78
98
|
* first: 10,
|
|
79
99
|
* skip: 0,
|
|
80
100
|
* };
|
|
81
101
|
* const workers = await WorkerUtils.getWorkers(filter);
|
|
102
|
+
* console.log('Workers:', workers.length);
|
|
82
103
|
* ```
|
|
83
104
|
*/
|
|
84
105
|
static async getWorkers(filter, options) {
|
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
|
+
"version": "6.0.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
7
7
|
"dist"
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"scripts": {
|
|
12
12
|
"clean": "tsc --build --clean && rm -rf ./dist",
|
|
13
|
-
"clean:doc": "rm -rf ../../../../docs/sdk/typescript/",
|
|
14
13
|
"build": "yarn clean && tsc --build",
|
|
15
|
-
"
|
|
14
|
+
"docs:post": "ts-node scripts/postprocess-docs.ts",
|
|
15
|
+
"build:doc": "typedoc && yarn docs:post",
|
|
16
16
|
"test": "vitest -u",
|
|
17
17
|
"lint": "eslint .",
|
|
18
18
|
"lint:fix": "eslint . --fix",
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"graphql": "^16.8.1",
|
|
45
45
|
"graphql-request": "^7.3.4",
|
|
46
46
|
"graphql-tag": "^2.12.6",
|
|
47
|
-
"minio": "7.1.3",
|
|
48
47
|
"openpgp": "^6.2.2",
|
|
49
48
|
"secp256k1": "^5.0.1",
|
|
50
49
|
"validator": "^13.12.0",
|
|
@@ -55,27 +54,11 @@
|
|
|
55
54
|
"eslint": "^9.39.1",
|
|
56
55
|
"eslint-plugin-jest": "^28.9.0",
|
|
57
56
|
"eslint-plugin-prettier": "^5.2.1",
|
|
58
|
-
"
|
|
57
|
+
"glob": "^13.0.0",
|
|
58
|
+
"prettier": "^3.7.4",
|
|
59
59
|
"ts-node": "^10.9.2",
|
|
60
|
-
"typedoc": "^0.28.
|
|
61
|
-
"typedoc-plugin-markdown": "^4.
|
|
60
|
+
"typedoc": "^0.28.15",
|
|
61
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
62
62
|
"typescript": "^5.8.3"
|
|
63
|
-
},
|
|
64
|
-
"typedocOptions": {
|
|
65
|
-
"entryPoints": [
|
|
66
|
-
"./src/base.ts",
|
|
67
|
-
"./src/encryption.ts",
|
|
68
|
-
"./src/escrow.ts",
|
|
69
|
-
"./src/kvstore.ts",
|
|
70
|
-
"./src/operator.ts",
|
|
71
|
-
"./src/staking.ts",
|
|
72
|
-
"./src/storage.ts",
|
|
73
|
-
"./src/statistics.ts",
|
|
74
|
-
"./src/transaction.ts",
|
|
75
|
-
"./src/enums.ts",
|
|
76
|
-
"./src/graphql/types.ts",
|
|
77
|
-
"./src/interfaces.ts",
|
|
78
|
-
"./src/types.ts"
|
|
79
|
-
]
|
|
80
63
|
}
|
|
81
64
|
}
|
package/src/base.ts
CHANGED
|
@@ -2,10 +2,9 @@ import { ContractRunner } from 'ethers';
|
|
|
2
2
|
import { NetworkData } from './types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* This class is used as a base class for other clients making on-chain calls.
|
|
5
|
+
* Base class for clients making on-chain calls.
|
|
8
6
|
*
|
|
7
|
+
* This class provides common functionality for interacting with Ethereum contracts.
|
|
9
8
|
*/
|
|
10
9
|
export abstract class BaseEthersClient {
|
|
11
10
|
protected runner: ContractRunner;
|
|
@@ -14,8 +13,8 @@ export abstract class BaseEthersClient {
|
|
|
14
13
|
/**
|
|
15
14
|
* **BaseClient constructor**
|
|
16
15
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
16
|
+
* @param runner - The Signer or Provider object to interact with the Ethereum network
|
|
17
|
+
* @param networkData - The network information required to connect to the contracts
|
|
19
18
|
*/
|
|
20
19
|
constructor(runner: ContractRunner, networkData: NetworkData) {
|
|
21
20
|
this.networkData = networkData;
|
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.thegraph.com/api/deployments/id/
|
|
39
|
+
'https://gateway.thegraph.com/api/deployments/id/QmeCB3KX49nRAkzgqancc3yL3VMJvt65YtL1zrLCFgr2n5',
|
|
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.thegraph.com/api/deployments/id/
|
|
54
|
+
'https://gateway.thegraph.com/api/deployments/id/QmcMntqZSTh8wJddxgp2hYcdw78wZFU86LHTHzJ1bTVUDc',
|
|
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.thegraph.com/api/deployments/id/
|
|
69
|
+
'https://gateway.thegraph.com/api/deployments/id/QmRexbu8eLZ1iE7ZLMtKxAr9GJnQ1JVrXhybKq6JkJ9XLE',
|
|
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.thegraph.com/api/deployments/id/
|
|
84
|
+
'https://gateway.thegraph.com/api/deployments/id/QmfFBXsAP7nbckFx34XYcNq2hRnfoVNrfqCvuk7hmAtYJT',
|
|
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.thegraph.com/api/deployments/id/
|
|
100
|
+
'https://gateway.thegraph.com/api/deployments/id/QmUwHMDjnDHDB5cowGqd96SRJ1sZegoAPanjxBWUyLZghv',
|
|
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.thegraph.com/api/deployments/id/
|
|
116
|
+
'https://gateway.thegraph.com/api/deployments/id/QmTJfcvVVmw8fe5CwRP6tZD5FzE2ESrm3ryygS1YZMYhM7',
|
|
117
117
|
oldSubgraphUrl: '',
|
|
118
118
|
oldFactoryAddress: '',
|
|
119
119
|
},
|