@human-protocol/sdk 5.0.0 → 5.2.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.
Files changed (56) hide show
  1. package/dist/base.d.ts +1 -10
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +0 -21
  4. package/dist/constants.d.ts +0 -1
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/constants.js +7 -22
  7. package/dist/encryption.js +1 -1
  8. package/dist/enums.d.ts +0 -1
  9. package/dist/enums.d.ts.map +1 -1
  10. package/dist/enums.js +0 -1
  11. package/dist/error.d.ts +8 -0
  12. package/dist/error.d.ts.map +1 -1
  13. package/dist/error.js +9 -1
  14. package/dist/escrow.d.ts +14 -17
  15. package/dist/escrow.d.ts.map +1 -1
  16. package/dist/escrow.js +34 -33
  17. package/dist/interfaces.d.ts +14 -0
  18. package/dist/interfaces.d.ts.map +1 -1
  19. package/dist/kvstore.d.ts +9 -5
  20. package/dist/kvstore.d.ts.map +1 -1
  21. package/dist/kvstore.js +15 -15
  22. package/dist/operator.d.ts +9 -5
  23. package/dist/operator.d.ts.map +1 -1
  24. package/dist/operator.js +16 -16
  25. package/dist/staking.d.ts +6 -3
  26. package/dist/staking.d.ts.map +1 -1
  27. package/dist/staking.js +13 -15
  28. package/dist/statistics.d.ts +13 -7
  29. package/dist/statistics.d.ts.map +1 -1
  30. package/dist/statistics.js +24 -22
  31. package/dist/storage.js +4 -4
  32. package/dist/transaction.d.ts +5 -3
  33. package/dist/transaction.d.ts.map +1 -1
  34. package/dist/transaction.js +8 -11
  35. package/dist/utils.d.ts +7 -0
  36. package/dist/utils.d.ts.map +1 -1
  37. package/dist/utils.js +66 -1
  38. package/dist/worker.d.ts +5 -3
  39. package/dist/worker.d.ts.map +1 -1
  40. package/dist/worker.js +8 -10
  41. package/package.json +8 -5
  42. package/src/base.ts +1 -23
  43. package/src/constants.ts +6 -24
  44. package/src/encryption.ts +1 -1
  45. package/src/enums.ts +0 -1
  46. package/src/error.ts +14 -0
  47. package/src/escrow.ts +70 -64
  48. package/src/interfaces.ts +15 -0
  49. package/src/kvstore.ts +26 -24
  50. package/src/operator.ts +54 -26
  51. package/src/staking.ts +28 -27
  52. package/src/statistics.ts +87 -47
  53. package/src/storage.ts +4 -4
  54. package/src/transaction.ts +39 -26
  55. package/src/utils.ts +81 -0
  56. package/src/worker.ts +32 -17
@@ -1,12 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.TransactionUtils = void 0;
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
4
  const ethers_1 = require("ethers");
9
- const graphql_request_1 = __importDefault(require("graphql-request"));
10
5
  const constants_1 = require("./constants");
11
6
  const enums_1 = require("./enums");
12
7
  const error_1 = require("./error");
@@ -46,6 +41,7 @@ class TransactionUtils {
46
41
  *
47
42
  * @param {ChainId} chainId The chain ID.
48
43
  * @param {string} hash The transaction hash.
44
+ * @param {SubgraphOptions} options Optional configuration for subgraph requests.
49
45
  * @returns {Promise<ITransaction | null>} - Returns the transaction details or null if not found.
50
46
  *
51
47
  * **Code example**
@@ -56,7 +52,7 @@ class TransactionUtils {
56
52
  * const transaction = await TransactionUtils.getTransaction(ChainId.POLYGON, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
57
53
  * ```
58
54
  */
59
- static async getTransaction(chainId, hash) {
55
+ static async getTransaction(chainId, hash, options) {
60
56
  if (!ethers_1.ethers.isHexString(hash)) {
61
57
  throw error_1.ErrorInvalidHashProvided;
62
58
  }
@@ -64,9 +60,9 @@ class TransactionUtils {
64
60
  if (!networkData) {
65
61
  throw error_1.ErrorUnsupportedChainID;
66
62
  }
67
- const { transaction } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), transaction_1.GET_TRANSACTION_QUERY, {
63
+ const { transaction } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), transaction_1.GET_TRANSACTION_QUERY, {
68
64
  hash: hash.toLowerCase(),
69
- });
65
+ }, options);
70
66
  if (!transaction)
71
67
  return null;
72
68
  return mapTransaction(transaction);
@@ -125,6 +121,7 @@ class TransactionUtils {
125
121
  * ```
126
122
  *
127
123
  * @param {ITransactionsFilter} filter Filter for the transactions.
124
+ * @param {SubgraphOptions} options Optional configuration for subgraph requests.
128
125
  * @returns {Promise<ITransaction[]>} Returns an array with all the transaction details.
129
126
  *
130
127
  * **Code example**
@@ -143,7 +140,7 @@ class TransactionUtils {
143
140
  * const transactions = await TransactionUtils.getTransactions(filter);
144
141
  * ```
145
142
  */
146
- static async getTransactions(filter) {
143
+ static async getTransactions(filter, options) {
147
144
  if ((!!filter.startDate || !!filter.endDate) &&
148
145
  (!!filter.startBlock || !!filter.endBlock)) {
149
146
  throw error_1.ErrorCannotUseDateAndBlockSimultaneously;
@@ -155,7 +152,7 @@ class TransactionUtils {
155
152
  if (!networkData) {
156
153
  throw error_1.ErrorUnsupportedChainID;
157
154
  }
158
- const { transactions } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, transaction_1.GET_TRANSACTIONS_QUERY)(filter), {
155
+ const { transactions } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, transaction_1.GET_TRANSACTIONS_QUERY)(filter), {
159
156
  fromAddress: filter?.fromAddress,
160
157
  toAddress: filter?.toAddress,
161
158
  startDate: filter?.startDate
@@ -170,7 +167,7 @@ class TransactionUtils {
170
167
  orderDirection: orderDirection,
171
168
  first: first,
172
169
  skip: skip,
173
- });
170
+ }, options);
174
171
  if (!transactions) {
175
172
  return [];
176
173
  }
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { NetworkData } from './types';
2
+ import { SubgraphOptions } from './interfaces';
2
3
  /**
3
4
  * **Handle and throw the error.*
4
5
  *
@@ -34,4 +35,10 @@ export declare const getSubgraphUrl: (networkData: NetworkData) => string;
34
35
  * @returns {number}
35
36
  */
36
37
  export declare const getUnixTimestamp: (date: Date) => number;
38
+ export declare const isIndexerError: (error: any) => boolean;
39
+ /**
40
+ * Execute a GraphQL request with automatic retry logic for bad indexer errors.
41
+ * Only retries if options is provided.
42
+ */
43
+ export declare const customGqlFetch: <T = any>(url: string, query: any, variables?: any, options?: SubgraphOptions) => Promise<T>;
37
44
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;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"}
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;;;;;GAKG;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;;;GAGG;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
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUnixTimestamp = exports.getSubgraphUrl = exports.isValidJson = exports.isValidUrl = exports.throwError = void 0;
6
+ exports.customGqlFetch = exports.isIndexerError = exports.getUnixTimestamp = exports.getSubgraphUrl = exports.isValidJson = exports.isValidUrl = exports.throwError = void 0;
4
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
8
  const ethers_1 = require("ethers");
9
+ const graphql_request_1 = __importDefault(require("graphql-request"));
6
10
  const validator_1 = require("validator");
7
11
  const constants_1 = require("./constants");
8
12
  const enums_1 = require("./enums");
@@ -95,3 +99,64 @@ const getUnixTimestamp = (date) => {
95
99
  return Math.floor(date.getTime() / 1000);
96
100
  };
97
101
  exports.getUnixTimestamp = getUnixTimestamp;
102
+ const isIndexerError = (error) => {
103
+ if (!error)
104
+ return false;
105
+ const errorMessage = error.response?.errors?.[0]?.message ||
106
+ error.message ||
107
+ error.toString() ||
108
+ '';
109
+ return errorMessage.toLowerCase().includes('bad indexers');
110
+ };
111
+ exports.isIndexerError = isIndexerError;
112
+ const sleep = (ms) => {
113
+ return new Promise((resolve) => setTimeout(resolve, ms));
114
+ };
115
+ const buildIndexerUrl = (baseUrl, indexerId) => {
116
+ if (!indexerId) {
117
+ return baseUrl;
118
+ }
119
+ return `${baseUrl}/indexers/id/${indexerId}`;
120
+ };
121
+ /**
122
+ * Execute a GraphQL request with automatic retry logic for bad indexer errors.
123
+ * Only retries if options is provided.
124
+ */
125
+ const customGqlFetch = async (url, query, variables, options) => {
126
+ const apiKey = process.env.SUBGRAPH_API_KEY;
127
+ const headers = apiKey
128
+ ? {
129
+ Authorization: `Bearer ${apiKey}`,
130
+ }
131
+ : undefined;
132
+ if (!options) {
133
+ return await (0, graphql_request_1.default)(url, query, variables, headers);
134
+ }
135
+ const hasMaxRetries = options.maxRetries !== undefined;
136
+ const hasBaseDelay = options.baseDelay !== undefined;
137
+ if (hasMaxRetries !== hasBaseDelay) {
138
+ throw error_1.ErrorRetryParametersMissing;
139
+ }
140
+ if (options.indexerId && !headers) {
141
+ throw error_1.ErrorRoutingRequestsToIndexerRequiresApiKey;
142
+ }
143
+ const targetUrl = buildIndexerUrl(url, options.indexerId);
144
+ const maxRetries = hasMaxRetries ? options.maxRetries : 0;
145
+ const baseDelay = hasBaseDelay ? options.baseDelay : 0;
146
+ let lastError;
147
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
148
+ try {
149
+ return await (0, graphql_request_1.default)(targetUrl, query, variables, headers);
150
+ }
151
+ catch (error) {
152
+ lastError = error;
153
+ if (attempt === maxRetries || !(0, exports.isIndexerError)(error)) {
154
+ throw error;
155
+ }
156
+ const delay = baseDelay * attempt;
157
+ await sleep(delay);
158
+ }
159
+ }
160
+ throw lastError;
161
+ };
162
+ exports.customGqlFetch = customGqlFetch;
package/dist/worker.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { ChainId } from './enums';
2
- import { IWorker, IWorkersFilter } from './interfaces';
2
+ import { IWorker, IWorkersFilter, SubgraphOptions } from './interfaces';
3
3
  export declare class WorkerUtils {
4
4
  /**
5
5
  * This function returns the worker data for the given address.
6
6
  *
7
7
  * @param {ChainId} chainId The chain ID.
8
8
  * @param {string} address The worker address.
9
+ * @param {SubgraphOptions} options Optional configuration for subgraph requests.
9
10
  * @returns {Promise<IWorker | null>} - Returns the worker details or null if not found.
10
11
  *
11
12
  * **Code example**
@@ -16,7 +17,7 @@ export declare class WorkerUtils {
16
17
  * const worker = await WorkerUtils.getWorker(ChainId.POLYGON, '0x1234567890abcdef1234567890abcdef12345678');
17
18
  * ```
18
19
  */
19
- static getWorker(chainId: ChainId, address: string): Promise<IWorker | null>;
20
+ static getWorker(chainId: ChainId, address: string, options?: SubgraphOptions): Promise<IWorker | null>;
20
21
  /**
21
22
  * This function returns all worker details based on the provided filter.
22
23
  *
@@ -43,6 +44,7 @@ export declare class WorkerUtils {
43
44
  * ```
44
45
  *
45
46
  * @param {IWorkersFilter} filter Filter for the workers.
47
+ * @param {SubgraphOptions} options Optional configuration for subgraph requests.
46
48
  * @returns {Promise<IWorker[]>} Returns an array with all the worker details.
47
49
  *
48
50
  * **Code example**
@@ -58,6 +60,6 @@ export declare class WorkerUtils {
58
60
  * const workers = await WorkerUtils.getWorkers(filter);
59
61
  * ```
60
62
  */
61
- static getWorkers(filter: IWorkersFilter): Promise<IWorker[]>;
63
+ static getWorkers(filter: IWorkersFilter, options?: SubgraphOptions): Promise<IWorker[]>;
62
64
  }
63
65
  //# sourceMappingURL=worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGvD,qBAAa,WAAW;IACtB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAqB1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;WACiB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CA+B3E"}
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;;;;;;;;;;;;;;;OAeG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IA0B1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;WACiB,UAAU,CAC5B,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,EAAE,CAAC;CAoCtB"}
package/dist/worker.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.WorkerUtils = void 0;
7
4
  const ethers_1 = require("ethers");
8
- const graphql_request_1 = __importDefault(require("graphql-request"));
9
5
  const constants_1 = require("./constants");
10
6
  const enums_1 = require("./enums");
11
7
  const error_1 = require("./error");
@@ -17,6 +13,7 @@ class WorkerUtils {
17
13
  *
18
14
  * @param {ChainId} chainId The chain ID.
19
15
  * @param {string} address The worker address.
16
+ * @param {SubgraphOptions} options Optional configuration for subgraph requests.
20
17
  * @returns {Promise<IWorker | null>} - Returns the worker details or null if not found.
21
18
  *
22
19
  * **Code example**
@@ -27,7 +24,7 @@ class WorkerUtils {
27
24
  * const worker = await WorkerUtils.getWorker(ChainId.POLYGON, '0x1234567890abcdef1234567890abcdef12345678');
28
25
  * ```
29
26
  */
30
- static async getWorker(chainId, address) {
27
+ static async getWorker(chainId, address, options) {
31
28
  const networkData = constants_1.NETWORKS[chainId];
32
29
  if (!networkData) {
33
30
  throw error_1.ErrorUnsupportedChainID;
@@ -35,9 +32,9 @@ class WorkerUtils {
35
32
  if (!ethers_1.ethers.isAddress(address)) {
36
33
  throw error_1.ErrorInvalidAddress;
37
34
  }
38
- const { worker } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), worker_1.GET_WORKER_QUERY, {
35
+ const { worker } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), worker_1.GET_WORKER_QUERY, {
39
36
  address: address.toLowerCase(),
40
- });
37
+ }, options);
41
38
  if (!worker)
42
39
  return null;
43
40
  return mapWorker(worker);
@@ -68,6 +65,7 @@ class WorkerUtils {
68
65
  * ```
69
66
  *
70
67
  * @param {IWorkersFilter} filter Filter for the workers.
68
+ * @param {SubgraphOptions} options Optional configuration for subgraph requests.
71
69
  * @returns {Promise<IWorker[]>} Returns an array with all the worker details.
72
70
  *
73
71
  * **Code example**
@@ -83,7 +81,7 @@ class WorkerUtils {
83
81
  * const workers = await WorkerUtils.getWorkers(filter);
84
82
  * ```
85
83
  */
86
- static async getWorkers(filter) {
84
+ static async getWorkers(filter, options) {
87
85
  const first = filter.first !== undefined ? Math.min(filter.first, 1000) : 10;
88
86
  const skip = filter.skip || 0;
89
87
  const orderBy = filter.orderBy || 'payoutCount';
@@ -95,13 +93,13 @@ class WorkerUtils {
95
93
  if (filter.address && !ethers_1.ethers.isAddress(filter.address)) {
96
94
  throw error_1.ErrorInvalidAddress;
97
95
  }
98
- const { workers } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, worker_1.GET_WORKERS_QUERY)(filter), {
96
+ const { workers } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, worker_1.GET_WORKERS_QUERY)(filter), {
99
97
  address: filter?.address?.toLowerCase(),
100
98
  first: first,
101
99
  skip: skip,
102
100
  orderBy: orderBy,
103
101
  orderDirection: orderDirection,
104
- });
102
+ }, options);
105
103
  if (!workers) {
106
104
  return [];
107
105
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@human-protocol/sdk",
3
3
  "description": "Human Protocol SDK",
4
- "version": "5.0.0",
4
+ "version": "5.2.0",
5
5
  "files": [
6
6
  "src",
7
7
  "dist"
@@ -38,20 +38,23 @@
38
38
  ]
39
39
  },
40
40
  "dependencies": {
41
- "@human-protocol/core": "5.0.0",
41
+ "@human-protocol/core": "5.0.1",
42
42
  "axios": "^1.4.0",
43
43
  "ethers": "~6.15.0",
44
44
  "graphql": "^16.8.1",
45
- "graphql-request": "^6.1.0",
45
+ "graphql-request": "^7.3.4",
46
46
  "graphql-tag": "^2.12.6",
47
47
  "minio": "7.1.3",
48
- "openpgp": "^5.11.2",
48
+ "openpgp": "^6.2.2",
49
49
  "secp256k1": "^5.0.1",
50
50
  "validator": "^13.12.0",
51
51
  "vitest": "^3.0.9"
52
52
  },
53
53
  "devDependencies": {
54
- "eslint": "^8.55.0",
54
+ "@types/validator": "^13.15.4",
55
+ "eslint": "^9.39.1",
56
+ "eslint-plugin-jest": "^28.9.0",
57
+ "eslint-plugin-prettier": "^5.2.1",
55
58
  "prettier": "^3.4.2",
56
59
  "ts-node": "^10.9.2",
57
60
  "typedoc": "^0.28.7",
package/src/base.ts CHANGED
@@ -1,7 +1,5 @@
1
- import { ContractRunner, Overrides } from 'ethers';
1
+ import { ContractRunner } from 'ethers';
2
2
  import { NetworkData } from './types';
3
- import { ChainId } from './enums';
4
- import { DEFAULT_AURORA_GAS_PRICE } from './constants';
5
3
 
6
4
  /**
7
5
  * ## Introduction
@@ -23,24 +21,4 @@ export abstract class BaseEthersClient {
23
21
  this.networkData = networkData;
24
22
  this.runner = runner;
25
23
  }
26
-
27
- /**
28
- * Internal helper to enrich transaction overrides with network specific defaults.
29
- *
30
- * Aurora networks use a fixed gas price. We always override any user provided
31
- * gasPrice with the canonical DEFAULT_AURORA_GAS_PRICE to avoid mismatches
32
- * or tx failures due to an unexpected value. For other networks the user
33
- * supplied fee parameters are left untouched.
34
- */
35
- protected applyTxDefaults(txOptions: Overrides = {}): Overrides {
36
- if (this.networkData.chainId === ChainId.AURORA_TESTNET) {
37
- return {
38
- ...txOptions,
39
- gasPrice: DEFAULT_AURORA_GAS_PRICE,
40
- maxFeePerGas: undefined,
41
- maxPriorityFeePerGas: undefined,
42
- } as Overrides;
43
- }
44
- return txOptions;
45
- }
46
24
  }
package/src/constants.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ethers } from 'ethers';
2
1
  import { ChainId } from './enums';
3
2
  import { NetworkData } from './types';
4
3
 
@@ -12,8 +11,6 @@ export const DEFAULT_PORT = 9000;
12
11
 
13
12
  export const DEFAULT_USE_SSL = false;
14
13
 
15
- export const DEFAULT_AURORA_GAS_PRICE = ethers.parseUnits('0.07', 'gwei');
16
-
17
14
  export enum HttpStatus {
18
15
  OK = 200,
19
16
  CREATED = 201,
@@ -39,7 +36,7 @@ export const NETWORKS: {
39
36
  subgraphUrl:
40
37
  'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
41
38
  subgraphUrlApiKey:
42
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmXGmcjEtwwEgB83KE2ECjjYY38kLMqzaq4ip8GWY7A6zz',
39
+ 'https://gateway.thegraph.com/api/deployments/id/QmXGmcjEtwwEgB83KE2ECjjYY38kLMqzaq4ip8GWY7A6zz',
43
40
  oldSubgraphUrl: '',
44
41
  oldFactoryAddress: '',
45
42
  },
@@ -54,7 +51,7 @@ export const NETWORKS: {
54
51
  subgraphUrl:
55
52
  'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
56
53
  subgraphUrlApiKey:
57
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT4xNvZh8ymarrk1zdytjLhCW59iuTavsd4JgHS4LbCVB',
54
+ 'https://gateway.thegraph.com/api/deployments/id/QmT4xNvZh8ymarrk1zdytjLhCW59iuTavsd4JgHS4LbCVB',
58
55
  oldSubgraphUrl: '',
59
56
  oldFactoryAddress: '',
60
57
  },
@@ -69,7 +66,7 @@ export const NETWORKS: {
69
66
  subgraphUrl:
70
67
  'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
71
68
  subgraphUrlApiKey:
72
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmdVdpm9NnFz5B8QyzhW1bW1nNfRWemTiFn2MrhYZGTSQD',
69
+ 'https://gateway.thegraph.com/api/deployments/id/QmdVdpm9NnFz5B8QyzhW1bW1nNfRWemTiFn2MrhYZGTSQD',
73
70
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
74
71
  oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
75
72
  },
@@ -84,7 +81,7 @@ export const NETWORKS: {
84
81
  subgraphUrl:
85
82
  'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
86
83
  subgraphUrlApiKey:
87
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZjYMktZe8RAz7W7qL33VZBV6AC57xsLyE1cEfv6NABdZ',
84
+ 'https://gateway.thegraph.com/api/deployments/id/QmZjYMktZe8RAz7W7qL33VZBV6AC57xsLyE1cEfv6NABdZ',
88
85
  oldSubgraphUrl:
89
86
  'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
90
87
  oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
@@ -100,7 +97,7 @@ export const NETWORKS: {
100
97
  subgraphUrl:
101
98
  'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
102
99
  subgraphUrlApiKey:
103
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmUt9mmfNjtC5ZnQNiWHRbFG3k5zfngMuoTyky9jhXYqG2',
100
+ 'https://gateway.thegraph.com/api/deployments/id/QmUt9mmfNjtC5ZnQNiWHRbFG3k5zfngMuoTyky9jhXYqG2',
104
101
  oldSubgraphUrl:
105
102
  'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
106
103
  oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
@@ -116,22 +113,7 @@ export const NETWORKS: {
116
113
  subgraphUrl:
117
114
  'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
118
115
  subgraphUrlApiKey:
119
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmWRUFWpWoRRUh7Ec1HUJEwxc84DkP4iFTfLLsoVngJAPa',
120
- oldSubgraphUrl: '',
121
- oldFactoryAddress: '',
122
- },
123
- [ChainId.AURORA_TESTNET]: {
124
- chainId: ChainId.AURORA_TESTNET,
125
- title: 'Aurora Testnet',
126
- scanUrl: 'https://explorer.testnet.aurora.dev/',
127
- factoryAddress: '0xbA537fEF2442cD48f60686FE1Bbbe40F964a7940',
128
- hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
129
- stakingAddress: '0x7457d26a3C70Bd71F7557C773b303c1dB82BBB68',
130
- kvstoreAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
131
- subgraphUrl:
132
- 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
133
- subgraphUrlApiKey:
134
- 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmVHYvjbsgAroR9EMgqqGTQ7aKPRFMVekY6evU6mFPUU7J',
116
+ 'https://gateway.thegraph.com/api/deployments/id/QmWRUFWpWoRRUh7Ec1HUJEwxc84DkP4iFTfLLsoVngJAPa',
135
117
  oldSubgraphUrl: '',
136
118
  oldFactoryAddress: '',
137
119
  },
package/src/encryption.ts CHANGED
@@ -387,7 +387,7 @@ export class EncryptionUtils {
387
387
  const { privateKey, publicKey, revocationCertificate } =
388
388
  await openpgp.generateKey({
389
389
  type: 'ecc',
390
- curve: 'ed25519',
390
+ curve: 'ed25519Legacy',
391
391
  userIDs: [{ name: name, email: email }],
392
392
  passphrase: passphrase,
393
393
  format: 'armored',
package/src/enums.ts CHANGED
@@ -6,7 +6,6 @@ export enum ChainId {
6
6
  BSC_TESTNET = 97,
7
7
  POLYGON = 137,
8
8
  POLYGON_AMOY = 80002,
9
- AURORA_TESTNET = 1313161555,
10
9
  LOCALHOST = 1338,
11
10
  }
12
11
 
package/src/error.ts CHANGED
@@ -306,6 +306,20 @@ export const ErrorBulkPayOutVersion = new Error(
306
306
  'Invalid bulkPayOut parameters for the contract version of the specified escrow address'
307
307
  );
308
308
 
309
+ /**
310
+ * @constant {Error} - Retry configuration is missing required parameters.
311
+ */
312
+ export const ErrorRetryParametersMissing = new Error(
313
+ 'Retry configuration must include both maxRetries and baseDelay'
314
+ );
315
+
316
+ /**
317
+ * @constant {Error} - Retry configuration is missing required parameters.
318
+ */
319
+ export const ErrorRoutingRequestsToIndexerRequiresApiKey = new Error(
320
+ 'Routing requests to a specific indexer requires SUBGRAPH_API_KEY to be set'
321
+ );
322
+
309
323
  /**
310
324
  * @constant {Warning} - Possible version mismatch.
311
325
  */