@human-protocol/sdk 6.1.0 → 7.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/CHANGELOG.md +21 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +26 -14
- package/dist/encryption/encryption.d.ts +84 -0
- package/dist/encryption/encryption.d.ts.map +1 -0
- package/dist/{encryption.js → encryption/encryption.js} +3 -161
- package/dist/encryption/encryption_utils.d.ts +101 -0
- package/dist/encryption/encryption_utils.d.ts.map +1 -0
- package/dist/encryption/encryption_utils.js +191 -0
- package/dist/encryption/index.d.ts +4 -0
- package/dist/encryption/index.d.ts.map +1 -0
- package/dist/encryption/index.js +7 -0
- package/dist/encryption/types.d.ts +9 -0
- package/dist/encryption/types.d.ts.map +1 -0
- package/dist/encryption/types.js +9 -0
- package/dist/error.d.ts +6 -10
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +12 -14
- package/dist/{escrow.d.ts → escrow/escrow_client.d.ts} +4 -184
- package/dist/{escrow.d.ts.map → escrow/escrow_client.d.ts.map} +1 -1
- package/dist/{escrow.js → escrow/escrow_client.js} +35 -411
- package/dist/escrow/escrow_utils.d.ts +172 -0
- package/dist/escrow/escrow_utils.d.ts.map +1 -0
- package/dist/escrow/escrow_utils.js +388 -0
- package/dist/escrow/index.d.ts +3 -0
- package/dist/escrow/index.d.ts.map +1 -0
- package/dist/escrow/index.js +7 -0
- package/dist/graphql/queries/statistics.d.ts +1 -0
- package/dist/graphql/queries/statistics.d.ts.map +1 -1
- package/dist/graphql/queries/statistics.js +36 -2
- package/dist/graphql/types.d.ts +3 -1
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -22
- package/dist/interfaces.d.ts +0 -5
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore/index.d.ts +3 -0
- package/dist/kvstore/index.d.ts.map +1 -0
- package/dist/kvstore/index.js +7 -0
- package/dist/{kvstore.d.ts → kvstore/kvstore_client.d.ts} +3 -108
- package/dist/kvstore/kvstore_client.d.ts.map +1 -0
- package/dist/{kvstore.js → kvstore/kvstore_client.js} +22 -184
- package/dist/kvstore/kvstore_utils.d.ts +105 -0
- package/dist/kvstore/kvstore_utils.d.ts.map +1 -0
- package/dist/kvstore/kvstore_utils.js +184 -0
- package/dist/operator/index.d.ts +2 -0
- package/dist/operator/index.d.ts.map +1 -0
- package/dist/operator/index.js +5 -0
- package/dist/{operator.d.ts → operator/operator_utils.d.ts} +3 -3
- package/dist/operator/operator_utils.d.ts.map +1 -0
- package/dist/{operator.js → operator/operator_utils.js} +6 -6
- package/dist/staking/index.d.ts +3 -0
- package/dist/staking/index.d.ts.map +1 -0
- package/dist/staking/index.js +7 -0
- package/dist/{staking.d.ts → staking/staking_client.d.ts} +4 -65
- package/dist/staking/staking_client.d.ts.map +1 -0
- package/dist/{staking.js → staking/staking_client.js} +6 -136
- package/dist/staking/staking_utils.d.ts +63 -0
- package/dist/staking/staking_utils.d.ts.map +1 -0
- package/dist/staking/staking_utils.js +137 -0
- package/dist/statistics/index.d.ts +2 -0
- package/dist/statistics/index.d.ts.map +1 -0
- package/dist/statistics/index.js +5 -0
- package/dist/{statistics.d.ts → statistics/statistics_utils.d.ts} +4 -13
- package/dist/statistics/statistics_utils.d.ts.map +1 -0
- package/dist/{statistics.js → statistics/statistics_utils.js} +8 -22
- package/dist/transaction/index.d.ts +2 -0
- package/dist/transaction/index.d.ts.map +1 -0
- package/dist/transaction/index.js +5 -0
- package/dist/{transaction.d.ts → transaction/transaction_utils.d.ts} +3 -3
- package/dist/transaction/transaction_utils.d.ts.map +1 -0
- package/dist/{transaction.js → transaction/transaction_utils.js} +5 -5
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +15 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +71 -4
- package/dist/worker/index.d.ts +2 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +5 -0
- package/dist/{worker.d.ts → worker/worker_utils.d.ts} +3 -3
- package/dist/worker/worker_utils.d.ts.map +1 -0
- package/dist/{worker.js → worker/worker_utils.js} +5 -5
- package/package.json +4 -4
- package/src/constants.ts +38 -14
- package/src/{encryption.ts → encryption/encryption.ts} +1 -193
- package/src/encryption/encryption_utils.ts +179 -0
- package/src/encryption/index.ts +3 -0
- package/src/encryption/types.ts +15 -0
- package/src/error.ts +11 -17
- package/src/{escrow.ts → escrow/escrow_client.ts} +36 -556
- package/src/escrow/escrow_utils.ts +510 -0
- package/src/escrow/index.ts +2 -0
- package/src/graphql/queries/statistics.ts +37 -1
- package/src/graphql/types.ts +4 -1
- package/src/index.ts +11 -25
- package/src/interfaces.ts +0 -5
- package/src/kvstore/index.ts +2 -0
- package/src/{kvstore.ts → kvstore/kvstore_client.ts} +27 -241
- package/src/kvstore/kvstore_utils.ts +244 -0
- package/src/operator/index.ts +1 -0
- package/src/{operator.ts → operator/operator_utils.ts} +8 -8
- package/src/staking/index.ts +2 -0
- package/src/{staking.ts → staking/staking_client.ts} +8 -174
- package/src/staking/staking_utils.ts +170 -0
- package/src/statistics/index.ts +1 -0
- package/src/{statistics.ts → statistics/statistics_utils.ts} +14 -26
- package/src/transaction/index.ts +1 -0
- package/src/{transaction.ts → transaction/transaction_utils.ts} +7 -7
- package/src/types.ts +8 -0
- package/src/utils.ts +80 -3
- package/src/worker/index.ts +1 -0
- package/src/{worker.ts → worker/worker_utils.ts} +7 -7
- package/dist/encryption.d.ts +0 -189
- package/dist/encryption.d.ts.map +0 -1
- package/dist/kvstore.d.ts.map +0 -1
- package/dist/operator.d.ts.map +0 -1
- package/dist/staking.d.ts.map +0 -1
- package/dist/statistics.d.ts.map +0 -1
- package/dist/transaction.d.ts.map +0 -1
- package/dist/worker.d.ts.map +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StakingUtils = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const enums_1 = require("../enums");
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
const staking_1 = require("../graphql/queries/staking");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
/**
|
|
11
|
+
* Utility helpers for Staking-related queries.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { StakingUtils, ChainId } from '@human-protocol/sdk';
|
|
16
|
+
*
|
|
17
|
+
* const staker = await StakingUtils.getStaker(
|
|
18
|
+
* ChainId.POLYGON_AMOY,
|
|
19
|
+
* '0xYourStakerAddress'
|
|
20
|
+
* );
|
|
21
|
+
* console.log('Staked amount:', staker.stakedAmount);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
class StakingUtils {
|
|
25
|
+
/**
|
|
26
|
+
* Gets staking info for a staker from the subgraph.
|
|
27
|
+
*
|
|
28
|
+
* @param chainId - Network in which the staking contract is deployed
|
|
29
|
+
* @param stakerAddress - Address of the staker
|
|
30
|
+
* @param options - Optional configuration for subgraph requests.
|
|
31
|
+
* @returns Staker info from subgraph
|
|
32
|
+
* @throws ErrorInvalidStakerAddressProvided If the staker address is invalid
|
|
33
|
+
* @throws ErrorUnsupportedChainID If the chain ID is not supported
|
|
34
|
+
* @throws ErrorStakerNotFound If the staker is not found
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { StakingUtils, ChainId } from '@human-protocol/sdk';
|
|
39
|
+
*
|
|
40
|
+
* const staker = await StakingUtils.getStaker(
|
|
41
|
+
* ChainId.POLYGON_AMOY,
|
|
42
|
+
* '0xYourStakerAddress'
|
|
43
|
+
* );
|
|
44
|
+
* console.log('Staked amount:', staker.stakedAmount);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
static async getStaker(chainId, stakerAddress, options) {
|
|
48
|
+
if (!ethers_1.ethers.isAddress(stakerAddress)) {
|
|
49
|
+
throw error_1.ErrorInvalidStakerAddressProvided;
|
|
50
|
+
}
|
|
51
|
+
const networkData = constants_1.NETWORKS[chainId];
|
|
52
|
+
if (!networkData) {
|
|
53
|
+
throw error_1.ErrorUnsupportedChainID;
|
|
54
|
+
}
|
|
55
|
+
const { staker } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), staking_1.GET_STAKER_BY_ADDRESS_QUERY, { id: stakerAddress.toLowerCase() }, options);
|
|
56
|
+
if (!staker) {
|
|
57
|
+
throw error_1.ErrorStakerNotFound;
|
|
58
|
+
}
|
|
59
|
+
return mapStaker(staker);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Gets all stakers from the subgraph with filters, pagination and ordering.
|
|
63
|
+
*
|
|
64
|
+
* @param filter - Stakers filter with pagination and ordering
|
|
65
|
+
* @param options - Optional configuration for subgraph requests.
|
|
66
|
+
* @returns Array of stakers
|
|
67
|
+
* @throws ErrorUnsupportedChainID If the chain ID is not supported
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { ChainId } from '@human-protocol/sdk';
|
|
72
|
+
*
|
|
73
|
+
* const filter = {
|
|
74
|
+
* chainId: ChainId.POLYGON_AMOY,
|
|
75
|
+
* minStakedAmount: '1000000000000000000', // 1 token in WEI
|
|
76
|
+
* };
|
|
77
|
+
* const stakers = await StakingUtils.getStakers(filter);
|
|
78
|
+
* console.log('Stakers:', stakers.length);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
static async getStakers(filter, options) {
|
|
82
|
+
const first = filter.first !== undefined ? Math.min(filter.first, 1000) : 10;
|
|
83
|
+
const skip = filter.skip || 0;
|
|
84
|
+
const orderDirection = filter.orderDirection || enums_1.OrderDirection.DESC;
|
|
85
|
+
const orderBy = filter.orderBy || 'lastDepositTimestamp';
|
|
86
|
+
const networkData = constants_1.NETWORKS[filter.chainId];
|
|
87
|
+
if (!networkData) {
|
|
88
|
+
throw error_1.ErrorUnsupportedChainID;
|
|
89
|
+
}
|
|
90
|
+
const { stakers } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, staking_1.GET_STAKERS_QUERY)(filter), {
|
|
91
|
+
minStakedAmount: filter.minStakedAmount
|
|
92
|
+
? filter.minStakedAmount
|
|
93
|
+
: undefined,
|
|
94
|
+
maxStakedAmount: filter.maxStakedAmount
|
|
95
|
+
? filter.maxStakedAmount
|
|
96
|
+
: undefined,
|
|
97
|
+
minLockedAmount: filter.minLockedAmount
|
|
98
|
+
? filter.minLockedAmount
|
|
99
|
+
: undefined,
|
|
100
|
+
maxLockedAmount: filter.maxLockedAmount
|
|
101
|
+
? filter.maxLockedAmount
|
|
102
|
+
: undefined,
|
|
103
|
+
minWithdrawnAmount: filter.minWithdrawnAmount
|
|
104
|
+
? filter.minWithdrawnAmount
|
|
105
|
+
: undefined,
|
|
106
|
+
maxWithdrawnAmount: filter.maxWithdrawnAmount
|
|
107
|
+
? filter.maxWithdrawnAmount
|
|
108
|
+
: undefined,
|
|
109
|
+
minSlashedAmount: filter.minSlashedAmount
|
|
110
|
+
? filter.minSlashedAmount
|
|
111
|
+
: undefined,
|
|
112
|
+
maxSlashedAmount: filter.maxSlashedAmount
|
|
113
|
+
? filter.maxSlashedAmount
|
|
114
|
+
: undefined,
|
|
115
|
+
orderBy: orderBy,
|
|
116
|
+
orderDirection: orderDirection,
|
|
117
|
+
first: first,
|
|
118
|
+
skip: skip,
|
|
119
|
+
}, options);
|
|
120
|
+
if (!stakers) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
return stakers.map((s) => mapStaker(s));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.StakingUtils = StakingUtils;
|
|
127
|
+
function mapStaker(s) {
|
|
128
|
+
return {
|
|
129
|
+
address: s.address,
|
|
130
|
+
stakedAmount: BigInt(s.stakedAmount),
|
|
131
|
+
lockedAmount: BigInt(s.lockedAmount),
|
|
132
|
+
withdrawableAmount: BigInt(s.withdrawnAmount),
|
|
133
|
+
slashedAmount: BigInt(s.slashedAmount),
|
|
134
|
+
lockedUntil: Number(s.lockedUntilTimestamp) * 1000,
|
|
135
|
+
lastDepositTimestamp: Number(s.lastDepositTimestamp) * 1000,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/statistics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatisticsUtils = void 0;
|
|
4
|
+
var statistics_utils_1 = require("./statistics_utils");
|
|
5
|
+
Object.defineProperty(exports, "StatisticsUtils", { enumerable: true, get: function () { return statistics_utils_1.StatisticsUtils; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDailyHMT, IEscrowStatistics, IHMTHolder, IHMTHoldersParams, IHMTStatistics, IPaymentStatistics, IStatisticsFilter, IWorkerStatistics, SubgraphOptions } from '
|
|
2
|
-
import { NetworkData } from '
|
|
1
|
+
import { IDailyHMT, IEscrowStatistics, IHMTHolder, IHMTHoldersParams, IHMTStatistics, IPaymentStatistics, IStatisticsFilter, IWorkerStatistics, SubgraphOptions } from '../interfaces';
|
|
2
|
+
import { NetworkData } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Utility class for statistics-related queries.
|
|
5
5
|
*
|
|
@@ -139,9 +139,7 @@ export declare class StatisticsUtils {
|
|
|
139
139
|
* ```ts
|
|
140
140
|
* interface IDailyPayment {
|
|
141
141
|
* timestamp: number;
|
|
142
|
-
* totalAmountPaid: bigint;
|
|
143
142
|
* totalCount: number;
|
|
144
|
-
* averageAmountPerWorker: bigint;
|
|
145
143
|
* };
|
|
146
144
|
*
|
|
147
145
|
* interface IPaymentStatistics {
|
|
@@ -160,14 +158,7 @@ export declare class StatisticsUtils {
|
|
|
160
158
|
*
|
|
161
159
|
* const networkData = NETWORKS[ChainId.POLYGON_AMOY];
|
|
162
160
|
* const paymentStats = await StatisticsUtils.getPaymentStatistics(networkData);
|
|
163
|
-
* console.log(
|
|
164
|
-
* 'Payment statistics:',
|
|
165
|
-
* paymentStats.dailyPaymentsData.map((p) => ({
|
|
166
|
-
* ...p,
|
|
167
|
-
* totalAmountPaid: p.totalAmountPaid.toString(),
|
|
168
|
-
* averageAmountPerWorker: p.averageAmountPerWorker.toString(),
|
|
169
|
-
* }))
|
|
170
|
-
* );
|
|
161
|
+
* console.log('Payment statistics:', paymentStats.dailyPaymentsData);
|
|
171
162
|
*
|
|
172
163
|
* const paymentStatsRange = await StatisticsUtils.getPaymentStatistics(
|
|
173
164
|
* networkData,
|
|
@@ -281,4 +272,4 @@ export declare class StatisticsUtils {
|
|
|
281
272
|
*/
|
|
282
273
|
static getHMTDailyData(networkData: NetworkData, filter?: IStatisticsFilter, options?: SubgraphOptions): Promise<IDailyHMT[]>;
|
|
283
274
|
}
|
|
284
|
-
//# sourceMappingURL=
|
|
275
|
+
//# sourceMappingURL=statistics_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statistics_utils.d.ts","sourceRoot":"","sources":["../../src/statistics/statistics_utils.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AASvC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,eAAe;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;WACU,mBAAmB,CAC9B,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,iBAAsB,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,iBAAiB,CAAC;IA6C7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;WACU,mBAAmB,CAC9B,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,iBAAsB,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,iBAAiB,CAAC;IAkC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;WACU,oBAAoB,CAC/B,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,iBAAsB,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,kBAAkB,CAAC;IAkC9B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;WACU,gBAAgB,CAC3B,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC;IAiB1B;;;;;;;;;;;;;;;;;;;;;OAqBG;WACU,aAAa,CACxB,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,iBAAsB,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,UAAU,EAAE,CAAC;IA0BxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CG;WACU,eAAe,CAC1B,WAAW,EAAE,WAAW,EACxB,MAAM,GAAE,iBAAsB,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,SAAS,EAAE,CAAC;CAkCxB"}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatisticsUtils = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
const enums_1 = require("
|
|
6
|
-
const graphql_1 = require("
|
|
7
|
-
const utils_1 = require("
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
const graphql_1 = require("../graphql");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
8
|
/**
|
|
9
9
|
* Utility class for statistics-related queries.
|
|
10
10
|
*
|
|
@@ -198,9 +198,7 @@ class StatisticsUtils {
|
|
|
198
198
|
* ```ts
|
|
199
199
|
* interface IDailyPayment {
|
|
200
200
|
* timestamp: number;
|
|
201
|
-
* totalAmountPaid: bigint;
|
|
202
201
|
* totalCount: number;
|
|
203
|
-
* averageAmountPerWorker: bigint;
|
|
204
202
|
* };
|
|
205
203
|
*
|
|
206
204
|
* interface IPaymentStatistics {
|
|
@@ -219,14 +217,7 @@ class StatisticsUtils {
|
|
|
219
217
|
*
|
|
220
218
|
* const networkData = NETWORKS[ChainId.POLYGON_AMOY];
|
|
221
219
|
* const paymentStats = await StatisticsUtils.getPaymentStatistics(networkData);
|
|
222
|
-
* console.log(
|
|
223
|
-
* 'Payment statistics:',
|
|
224
|
-
* paymentStats.dailyPaymentsData.map((p) => ({
|
|
225
|
-
* ...p,
|
|
226
|
-
* totalAmountPaid: p.totalAmountPaid.toString(),
|
|
227
|
-
* averageAmountPerWorker: p.averageAmountPerWorker.toString(),
|
|
228
|
-
* }))
|
|
229
|
-
* );
|
|
220
|
+
* console.log('Payment statistics:', paymentStats.dailyPaymentsData);
|
|
230
221
|
*
|
|
231
222
|
* const paymentStatsRange = await StatisticsUtils.getPaymentStatistics(
|
|
232
223
|
* networkData,
|
|
@@ -254,12 +245,7 @@ class StatisticsUtils {
|
|
|
254
245
|
return {
|
|
255
246
|
dailyPaymentsData: eventDayDatas.map((eventDayData) => ({
|
|
256
247
|
timestamp: +eventDayData.timestamp * 1000,
|
|
257
|
-
totalAmountPaid: BigInt(eventDayData.dailyHMTPayoutAmount),
|
|
258
248
|
totalCount: +eventDayData.dailyPayoutCount,
|
|
259
|
-
averageAmountPerWorker: eventDayData.dailyWorkerCount === '0'
|
|
260
|
-
? BigInt(0)
|
|
261
|
-
: BigInt(eventDayData.dailyHMTPayoutAmount) /
|
|
262
|
-
BigInt(eventDayData.dailyWorkerCount),
|
|
263
249
|
})),
|
|
264
250
|
};
|
|
265
251
|
}
|
|
@@ -296,7 +282,7 @@ class StatisticsUtils {
|
|
|
296
282
|
*/
|
|
297
283
|
static async getHMTStatistics(networkData, options) {
|
|
298
284
|
try {
|
|
299
|
-
const subgraphUrl = (0, utils_1.
|
|
285
|
+
const subgraphUrl = (0, utils_1.getHMTSubgraphUrl)(networkData);
|
|
300
286
|
const { hmtokenStatistics } = await (0, utils_1.customGqlFetch)(subgraphUrl, graphql_1.GET_HMTOKEN_STATISTICS_QUERY, options);
|
|
301
287
|
return {
|
|
302
288
|
totalTransferAmount: BigInt(hmtokenStatistics.totalValueTransfered),
|
|
@@ -332,7 +318,7 @@ class StatisticsUtils {
|
|
|
332
318
|
*/
|
|
333
319
|
static async getHMTHolders(networkData, params = {}, options) {
|
|
334
320
|
try {
|
|
335
|
-
const subgraphUrl = (0, utils_1.
|
|
321
|
+
const subgraphUrl = (0, utils_1.getHMTSubgraphUrl)(networkData);
|
|
336
322
|
const { address, orderDirection } = params;
|
|
337
323
|
const query = (0, graphql_1.GET_HOLDERS_QUERY)(address);
|
|
338
324
|
const { holders } = await (0, utils_1.customGqlFetch)(subgraphUrl, query, {
|
|
@@ -399,11 +385,11 @@ class StatisticsUtils {
|
|
|
399
385
|
*/
|
|
400
386
|
static async getHMTDailyData(networkData, filter = {}, options) {
|
|
401
387
|
try {
|
|
402
|
-
const subgraphUrl = (0, utils_1.
|
|
388
|
+
const subgraphUrl = (0, utils_1.getHMTSubgraphUrl)(networkData);
|
|
403
389
|
const first = filter.first !== undefined ? Math.min(filter.first, 1000) : 10;
|
|
404
390
|
const skip = filter.skip || 0;
|
|
405
391
|
const orderDirection = filter.orderDirection || enums_1.OrderDirection.ASC;
|
|
406
|
-
const { eventDayDatas } = await (0, utils_1.customGqlFetch)(subgraphUrl, (0, graphql_1.
|
|
392
|
+
const { eventDayDatas } = await (0, utils_1.customGqlFetch)(subgraphUrl, (0, graphql_1.GET_HMT_EVENT_DAY_DATA_QUERY)(filter), {
|
|
407
393
|
from: filter.from ? (0, utils_1.getUnixTimestamp)(filter.from) : undefined,
|
|
408
394
|
to: filter.to ? (0, utils_1.getUnixTimestamp)(filter.to) : undefined,
|
|
409
395
|
orderDirection: orderDirection,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionUtils = void 0;
|
|
4
|
+
var transaction_utils_1 = require("./transaction_utils");
|
|
5
|
+
Object.defineProperty(exports, "TransactionUtils", { enumerable: true, get: function () { return transaction_utils_1.TransactionUtils; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChainId } from '
|
|
2
|
-
import { ITransaction, ITransactionsFilter, SubgraphOptions } from '
|
|
1
|
+
import { ChainId } from '../enums';
|
|
2
|
+
import { ITransaction, ITransactionsFilter, SubgraphOptions } from '../interfaces';
|
|
3
3
|
/**
|
|
4
4
|
* Utility class for transaction-related queries.
|
|
5
5
|
*
|
|
@@ -142,4 +142,4 @@ export declare class TransactionUtils {
|
|
|
142
142
|
*/
|
|
143
143
|
static getTransactions(filter: ITransactionsFilter, options?: SubgraphOptions): Promise<ITransaction[]>;
|
|
144
144
|
}
|
|
145
|
-
//# sourceMappingURL=
|
|
145
|
+
//# sourceMappingURL=transaction_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction_utils.d.ts","sourceRoot":"","sources":["../../src/transaction/transaction_utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AAWnD,OAAO,EAEL,YAAY,EACZ,mBAAmB,EACnB,eAAe,EAChB,MAAM,eAAe,CAAC;AAGvB;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;WACiB,cAAc,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAyB/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0EG;WACiB,eAAe,CACjC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,YAAY,EAAE,CAAC;CAgD3B"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransactionUtils = void 0;
|
|
4
4
|
const ethers_1 = require("ethers");
|
|
5
|
-
const constants_1 = require("
|
|
6
|
-
const enums_1 = require("
|
|
7
|
-
const error_1 = require("
|
|
8
|
-
const transaction_1 = require("
|
|
9
|
-
const utils_1 = require("
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const enums_1 = require("../enums");
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
const transaction_1 = require("../graphql/queries/transaction");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
10
|
/**
|
|
11
11
|
* Utility class for transaction-related queries.
|
|
12
12
|
*
|
package/dist/types.d.ts
CHANGED
|
@@ -74,6 +74,14 @@ export type NetworkData = {
|
|
|
74
74
|
* Subgraph URL API key
|
|
75
75
|
*/
|
|
76
76
|
subgraphUrlApiKey: string;
|
|
77
|
+
/**
|
|
78
|
+
* HMT statistics subgraph URL
|
|
79
|
+
*/
|
|
80
|
+
hmtSubgraphUrl?: string;
|
|
81
|
+
/**
|
|
82
|
+
* HMT statistics subgraph URL API key
|
|
83
|
+
*/
|
|
84
|
+
hmtSubgraphUrlApiKey?: string;
|
|
77
85
|
/**
|
|
78
86
|
* Old subgraph URL
|
|
79
87
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEpD;;;;GAIG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,QAAQ,IAAA;IACR;;OAEG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,IAAI,IAAA;IACJ;;OAEG;IACH,QAAQ,IAAA;IACR;;OAEG;IACH,SAAS,IAAA;IACT;;OAEG;IACH,QAAQ,IAAA;CACT;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,WAAW,CAAC;AAE3D,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEpD;;;;GAIG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,QAAQ,IAAA;IACR;;OAEG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,IAAI,IAAA;IACJ;;OAEG;IACH,QAAQ,IAAA;IACR;;OAEG;IACH,SAAS,IAAA;IACT;;OAEG;IACH,QAAQ,IAAA;CACT;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,WAAW,CAAC;AAE3D,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ export declare const isValidUrl: (url: string) => boolean;
|
|
|
27
27
|
* @returns True if the string is valid JSON, false otherwise
|
|
28
28
|
*/
|
|
29
29
|
export declare const isValidJson: (input: string) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts a readable message from unknown error values.
|
|
32
|
+
*
|
|
33
|
+
* @param error - Unknown error value
|
|
34
|
+
* @returns Human-readable error message
|
|
35
|
+
*/
|
|
36
|
+
export declare const getErrorMessage: (error: unknown) => string;
|
|
30
37
|
/**
|
|
31
38
|
* Gets the subgraph URL for the given network, using API key if available.
|
|
32
39
|
*
|
|
@@ -34,6 +41,14 @@ export declare const isValidJson: (input: string) => boolean;
|
|
|
34
41
|
* @returns The subgraph URL with API key if available
|
|
35
42
|
*/
|
|
36
43
|
export declare const getSubgraphUrl: (networkData: NetworkData) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the HMT statistics subgraph URL for the given network.
|
|
46
|
+
* Falls back to the default subgraph URL when a dedicated HMT endpoint is not configured.
|
|
47
|
+
*
|
|
48
|
+
* @param networkData - The network data containing subgraph URLs
|
|
49
|
+
* @returns The HMT statistics subgraph URL with API key if available
|
|
50
|
+
*/
|
|
51
|
+
export declare const getHMTSubgraphUrl: (networkData: NetworkData) => string;
|
|
37
52
|
/**
|
|
38
53
|
* Converts a Date object to Unix timestamp (seconds since epoch).
|
|
39
54
|
*
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;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,eAAe,GAAI,OAAO,OAAO,KAAG,MAUhD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,aAAa,WAAW,WAUtD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,WAAW,WAWzD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,IAAI,KAAG,MAE7C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,GAAG,KAAG,OAS3C,CAAC;AA6CF;;;;;;;;;;;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,CAiDX,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.customGqlFetch = exports.isIndexerError = exports.getUnixTimestamp = exports.getSubgraphUrl = exports.isValidJson = exports.isValidUrl = exports.throwError = void 0;
|
|
6
|
+
exports.customGqlFetch = exports.isIndexerError = exports.getUnixTimestamp = exports.getHMTSubgraphUrl = exports.getSubgraphUrl = exports.getErrorMessage = exports.isValidJson = exports.isValidUrl = exports.throwError = void 0;
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
8
|
const ethers_1 = require("ethers");
|
|
9
9
|
const graphql_request_1 = __importDefault(require("graphql-request"));
|
|
@@ -76,6 +76,24 @@ const isValidJson = (input) => {
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
exports.isValidJson = isValidJson;
|
|
79
|
+
/**
|
|
80
|
+
* Extracts a readable message from unknown error values.
|
|
81
|
+
*
|
|
82
|
+
* @param error - Unknown error value
|
|
83
|
+
* @returns Human-readable error message
|
|
84
|
+
*/
|
|
85
|
+
const getErrorMessage = (error) => {
|
|
86
|
+
if (error instanceof Error) {
|
|
87
|
+
return error.message;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
return JSON.stringify(error);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return String(error);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.getErrorMessage = getErrorMessage;
|
|
79
97
|
/**
|
|
80
98
|
* Gets the subgraph URL for the given network, using API key if available.
|
|
81
99
|
*
|
|
@@ -94,6 +112,26 @@ const getSubgraphUrl = (networkData) => {
|
|
|
94
112
|
return subgraphUrl;
|
|
95
113
|
};
|
|
96
114
|
exports.getSubgraphUrl = getSubgraphUrl;
|
|
115
|
+
/**
|
|
116
|
+
* Gets the HMT statistics subgraph URL for the given network.
|
|
117
|
+
* Falls back to the default subgraph URL when a dedicated HMT endpoint is not configured.
|
|
118
|
+
*
|
|
119
|
+
* @param networkData - The network data containing subgraph URLs
|
|
120
|
+
* @returns The HMT statistics subgraph URL with API key if available
|
|
121
|
+
*/
|
|
122
|
+
const getHMTSubgraphUrl = (networkData) => {
|
|
123
|
+
let subgraphUrl = networkData.hmtSubgraphUrl || networkData.subgraphUrl;
|
|
124
|
+
if (process.env.SUBGRAPH_API_KEY) {
|
|
125
|
+
subgraphUrl =
|
|
126
|
+
networkData.hmtSubgraphUrlApiKey || networkData.subgraphUrlApiKey;
|
|
127
|
+
}
|
|
128
|
+
else if (networkData.chainId !== enums_1.ChainId.LOCALHOST) {
|
|
129
|
+
// eslint-disable-next-line no-console
|
|
130
|
+
console.warn(error_1.WarnSubgraphApiKeyNotProvided);
|
|
131
|
+
}
|
|
132
|
+
return subgraphUrl;
|
|
133
|
+
};
|
|
134
|
+
exports.getHMTSubgraphUrl = getHMTSubgraphUrl;
|
|
97
135
|
/**
|
|
98
136
|
* Converts a Date object to Unix timestamp (seconds since epoch).
|
|
99
137
|
*
|
|
@@ -114,6 +152,29 @@ const isIndexerError = (error) => {
|
|
|
114
152
|
return errorMessage.toLowerCase().includes('bad indexers');
|
|
115
153
|
};
|
|
116
154
|
exports.isIndexerError = isIndexerError;
|
|
155
|
+
const getSubgraphErrorMessage = (error) => {
|
|
156
|
+
return (error?.response?.errors?.[0]?.message ||
|
|
157
|
+
error?.message ||
|
|
158
|
+
error?.toString?.() ||
|
|
159
|
+
'Subgraph request failed');
|
|
160
|
+
};
|
|
161
|
+
const getSubgraphStatusCode = (error) => {
|
|
162
|
+
if (typeof error?.response?.status === 'number') {
|
|
163
|
+
return error.response.status;
|
|
164
|
+
}
|
|
165
|
+
if (typeof error?.status === 'number') {
|
|
166
|
+
return error.status;
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
};
|
|
170
|
+
const toSubgraphError = (error, url) => {
|
|
171
|
+
const message = getSubgraphErrorMessage(error);
|
|
172
|
+
const statusCode = getSubgraphStatusCode(error);
|
|
173
|
+
if ((0, exports.isIndexerError)(error)) {
|
|
174
|
+
return new error_1.SubgraphBadIndexerError(message, url, statusCode);
|
|
175
|
+
}
|
|
176
|
+
return new error_1.SubgraphRequestError(message, url, statusCode);
|
|
177
|
+
};
|
|
117
178
|
const sleep = (ms) => {
|
|
118
179
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
119
180
|
};
|
|
@@ -143,7 +204,12 @@ const customGqlFetch = async (url, query, variables, options) => {
|
|
|
143
204
|
}
|
|
144
205
|
: undefined;
|
|
145
206
|
if (!options) {
|
|
146
|
-
|
|
207
|
+
try {
|
|
208
|
+
return await (0, graphql_request_1.default)(url, query, variables, headers);
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
throw toSubgraphError(error, url);
|
|
212
|
+
}
|
|
147
213
|
}
|
|
148
214
|
const hasMaxRetries = options.maxRetries !== undefined;
|
|
149
215
|
const hasBaseDelay = options.baseDelay !== undefined;
|
|
@@ -162,9 +228,10 @@ const customGqlFetch = async (url, query, variables, options) => {
|
|
|
162
228
|
return await (0, graphql_request_1.default)(targetUrl, query, variables, headers);
|
|
163
229
|
}
|
|
164
230
|
catch (error) {
|
|
165
|
-
|
|
231
|
+
const wrappedError = toSubgraphError(error, targetUrl);
|
|
232
|
+
lastError = wrappedError;
|
|
166
233
|
if (attempt === maxRetries || !(0, exports.isIndexerError)(error)) {
|
|
167
|
-
throw
|
|
234
|
+
throw wrappedError;
|
|
168
235
|
}
|
|
169
236
|
const delay = baseDelay * attempt;
|
|
170
237
|
await sleep(delay);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/worker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkerUtils = void 0;
|
|
4
|
+
var worker_utils_1 = require("./worker_utils");
|
|
5
|
+
Object.defineProperty(exports, "WorkerUtils", { enumerable: true, get: function () { return worker_utils_1.WorkerUtils; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChainId } from '
|
|
2
|
-
import { IWorker, IWorkersFilter, SubgraphOptions } from '
|
|
1
|
+
import { ChainId } from '../enums';
|
|
2
|
+
import { IWorker, IWorkersFilter, SubgraphOptions } from '../interfaces';
|
|
3
3
|
/**
|
|
4
4
|
* Utility class for worker-related operations.
|
|
5
5
|
*
|
|
@@ -83,4 +83,4 @@ export declare class WorkerUtils {
|
|
|
83
83
|
*/
|
|
84
84
|
static getWorkers(filter: IWorkersFilter, options?: SubgraphOptions): Promise<IWorker[]>;
|
|
85
85
|
}
|
|
86
|
-
//# sourceMappingURL=
|
|
86
|
+
//# sourceMappingURL=worker_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker_utils.d.ts","sourceRoot":"","sources":["../../src/worker/worker_utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AAInD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGzE;;;;;;;;;;;;;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"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkerUtils = void 0;
|
|
4
4
|
const ethers_1 = require("ethers");
|
|
5
|
-
const constants_1 = require("
|
|
6
|
-
const enums_1 = require("
|
|
7
|
-
const error_1 = require("
|
|
8
|
-
const worker_1 = require("
|
|
9
|
-
const utils_1 = require("
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const enums_1 = require("../enums");
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
const worker_1 = require("../graphql/queries/worker");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
10
|
/**
|
|
11
11
|
* Utility class for worker-related operations.
|
|
12
12
|
*
|
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": "7.0.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
7
7
|
"dist"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@human-protocol/core": "
|
|
41
|
+
"@human-protocol/core": "6.0.0",
|
|
42
42
|
"axios": "^1.4.0",
|
|
43
43
|
"ethers": "~6.15.0",
|
|
44
44
|
"graphql": "^16.8.1",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"openpgp": "^6.2.2",
|
|
48
48
|
"secp256k1": "^5.0.1",
|
|
49
49
|
"validator": "^13.12.0",
|
|
50
|
-
"vitest": "^
|
|
50
|
+
"vitest": "^4.0.18"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/validator": "^13.15.4",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"eslint-plugin-jest": "^28.9.0",
|
|
56
56
|
"eslint-plugin-prettier": "^5.5.5",
|
|
57
57
|
"glob": "^13.0.0",
|
|
58
|
-
"prettier": "^3.
|
|
58
|
+
"prettier": "^3.8.1",
|
|
59
59
|
"ts-node": "^10.9.2",
|
|
60
60
|
"typedoc": "^0.28.15",
|
|
61
61
|
"typedoc-plugin-markdown": "^4.9.0",
|