@human-protocol/sdk 1.1.13 → 1.1.15

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.
@@ -1,6 +1,43 @@
1
1
  import { EscrowStatistics, HMTStatistics, PaymentStatistics, WorkerStatistics } from './graphql';
2
2
  import { IStatisticsParams } from './interfaces';
3
3
  import { NetworkData } from './types';
4
+ /**
5
+ * ## Introduction
6
+ *
7
+ * This client enables to obtain statistical information from the subgraph.
8
+ *
9
+ * Unlikely from the other SDK clients, `StatisticsClient` does not require `signer` or `provider` to be provided.
10
+ * We just need to create client object using relevant network data.
11
+ *
12
+ * ```ts
13
+ * constructor(network: NetworkData)
14
+ * ```
15
+ *
16
+ * A `Signer` or a `Provider` should be passed depending on the use case of this module:
17
+ *
18
+ * - **Signer**: when the user wants to use this model in order to send transactions caling the contract functions.
19
+ * - **Provider**: when the user wants to use this model in order to get information from the contracts or subgraph.
20
+ *
21
+ * ## Installation
22
+ *
23
+ * ### npm
24
+ * ```bash
25
+ * npm install @human-protocol/sdk
26
+ * ```
27
+ *
28
+ * ### yarn
29
+ * ```bash
30
+ * yarn install @human-protocol/sdk
31
+ * ```
32
+ *
33
+ * ## Code example
34
+ *
35
+ * ```ts
36
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
37
+ *
38
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
39
+ * ```
40
+ */
4
41
  export declare class StatisticsClient {
5
42
  network: NetworkData;
6
43
  /**
@@ -10,35 +47,248 @@ export declare class StatisticsClient {
10
47
  */
11
48
  constructor(network: NetworkData);
12
49
  /**
13
- * Returns the escrow statistics data for the given date range
50
+ * This function returns the statistical data of escrows.
14
51
  *
15
- * @param {IStatisticsParams} params - Filter parameters.
16
- * @returns {Promise<EscrowStatistics>}
17
- * @throws {Error} - An error object if an error occurred.
52
+ *
53
+ * **Input parameters**
54
+ *
55
+ * ```ts
56
+ * interface IStatisticsParams {
57
+ * from?: Date;
58
+ * to?: Date;
59
+ * limit?: number;
60
+ * }
61
+ * ```
62
+ *
63
+ * ```ts
64
+ * type DailyEscrowsData = {
65
+ * timestamp: Date;
66
+ * escrowsTotal: number;
67
+ * escrowsPending: number;
68
+ * escrowsSolved: number;
69
+ * escrowsPaid: number;
70
+ * escrowsCancelled: number;
71
+ * };
72
+ *
73
+ * type EscrowStatistics = {
74
+ * totalEscrows: number;
75
+ * dailyEscrowsData: DailyEscrowsData[];
76
+ * };
77
+ * ```
78
+ *
79
+ *
80
+ * @param {IStatisticsParams} params Statistics params with duration data
81
+ * @returns {EscrowStatistics} Escrow statistics data.
82
+ *
83
+ *
84
+ * **Code example**
85
+ *
86
+ * ```ts
87
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
88
+ *
89
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
90
+ *
91
+ * const escrowStatistics = await statisticsClient.getEscrowStatistics();
92
+ * const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({
93
+ * from: new Date('2021-04-01'),
94
+ * to: new Date('2021-04-30'),
95
+ * });
96
+ * ```
18
97
  */
19
98
  getEscrowStatistics(params?: IStatisticsParams): Promise<EscrowStatistics>;
20
99
  /**
21
- * Returns the worker statistics data for the given date range
100
+ * This function returns the statistical data of workers.
101
+ *
102
+ *
103
+ * **Input parameters**
22
104
  *
23
- * @param {IStatisticsParams} params - Filter parameters.
24
- * @returns {Promise<WorkerStatistics>}
25
- * @throws {Error} - An error object if an error occurred.
105
+ * ```ts
106
+ * interface IStatisticsParams {
107
+ * from?: Date;
108
+ * to?: Date;
109
+ * limit?: number;
110
+ * }
111
+ * ```
112
+ *
113
+ * ```ts
114
+ * type DailyWorkerData = {
115
+ * timestamp: Date;
116
+ * activeWorkers: number;
117
+ * };
118
+ *
119
+ * type WorkerStatistics = {
120
+ * dailyWorkersData: DailyWorkerData[];
121
+ * };
122
+ * ```
123
+ *
124
+ *
125
+ * @param {IStatisticsParams} params Statistics params with duration data
126
+ * @returns {WorkerStatistics} Worker statistics data.
127
+ *
128
+ *
129
+ * **Code example**
130
+ *
131
+ * ```ts
132
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
133
+ *
134
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
135
+ *
136
+ * const workerStatistics = await statisticsClient.getWorkerStatistics();
137
+ * const workerStatisticsApril = await statisticsClient.getWorkerStatistics({
138
+ * from: new Date('2021-04-01'),
139
+ * to: new Date('2021-04-30'),
140
+ * });
141
+ * ```
26
142
  */
27
143
  getWorkerStatistics(params?: IStatisticsParams): Promise<WorkerStatistics>;
28
144
  /**
29
- * Returns the payment statistics data for the given date range
145
+ * This function returns the statistical data of payments.
146
+ *
147
+ *
148
+ * **Input parameters**
149
+ *
150
+ * ```ts
151
+ * interface IStatisticsParams {
152
+ * from?: Date;
153
+ * to?: Date;
154
+ * limit?: number;
155
+ * }
156
+ * ```
30
157
  *
31
- * @param {IStatisticsParams} params - Filter parameters.
32
- * @returns {Promise<PaymentStatistics>}
33
- * @throws {Error} - An error object if an error occurred.
158
+ * ```ts
159
+ * type DailyPaymentData = {
160
+ * timestamp: Date;
161
+ * totalAmountPaid: BigNumber;
162
+ * totalCount: number;
163
+ * averageAmountPerWorker: BigNumber;
164
+ * };
165
+ *
166
+ * type PaymentStatistics = {
167
+ * dailyPaymentsData: DailyPaymentData[];
168
+ * };
169
+ * ```
170
+ *
171
+ *
172
+ * @param {IStatisticsParams} params Statistics params with duration data
173
+ * @returns {PaymentStatistics} Payment statistics data.
174
+ *
175
+ *
176
+ * **Code example**
177
+ *
178
+ * ```ts
179
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
180
+ *
181
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
182
+ *
183
+ * console.log(
184
+ * 'Payment statistics:',
185
+ * (await statisticsClient.getPaymentStatistics()).dailyPaymentsData.map(
186
+ * (p) => ({
187
+ * ...p,
188
+ * totalAmountPaid: p.totalAmountPaid.toString(),
189
+ * averageAmountPerJob: p.averageAmountPerJob.toString(),
190
+ * averageAmountPerWorker: p.averageAmountPerWorker.toString(),
191
+ * })
192
+ * )
193
+ * );
194
+ *
195
+ * console.log(
196
+ * 'Payment statistics from 5/8 - 6/8:',
197
+ * (
198
+ * await statisticsClient.getPaymentStatistics({
199
+ * from: new Date(2023, 4, 8),
200
+ * to: new Date(2023, 5, 8),
201
+ * })
202
+ * ).dailyPaymentsData.map((p) => ({
203
+ * ...p,
204
+ * totalAmountPaid: p.totalAmountPaid.toString(),
205
+ * averageAmountPerJob: p.averageAmountPerJob.toString(),
206
+ * averageAmountPerWorker: p.averageAmountPerWorker.toString(),
207
+ * }))
208
+ * );
209
+ * ```
34
210
  */
35
211
  getPaymentStatistics(params?: IStatisticsParams): Promise<PaymentStatistics>;
36
212
  /**
37
- * Returns the HMToken statistics data for the given date range
213
+ * This function returns the statistical data of HMToken.
214
+ *
215
+ *
216
+ * **Input parameters**
217
+ *
218
+ * ```ts
219
+ * interface IStatisticsParams {
220
+ * from?: Date;
221
+ * to?: Date;
222
+ * limit?: number;
223
+ * }
224
+ * ```
225
+ *
226
+ * ```ts
227
+ * type HMTHolder = {
228
+ * address: string;
229
+ * balance: BigNumber;
230
+ * }
231
+ *
232
+ * type DailyHMTData = {
233
+ * timestamp: Date;
234
+ * totalTransactionAmount: BigNumber;
235
+ * totalTransactionCount: number;
236
+ * };
237
+ *
238
+ * type HMTStatistics = {
239
+ * totalTransferAmount: BigNumber;
240
+ * totalTransferCount: BigNumber;
241
+ * totalHolders: number;
242
+ * holders: HMTHolder[];
243
+ * dailyHMTData: DailyHMTData[];
244
+ * };
245
+ * ```
246
+ *
247
+ *
248
+ * @param {IStatisticsParams} params Statistics params with duration data
249
+ * @returns {HMTStatistics} HMToken statistics data.
250
+ *
251
+ *
252
+ * **Code example**
253
+ *
254
+ * ```ts
255
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
256
+ *
257
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
258
+ *
259
+ * const hmtStatistics = await statisticsClient.getHMTStatistics();
260
+ *
261
+ * console.log('HMT statistics:', {
262
+ * ...hmtStatistics,
263
+ * totalTransferAmount: hmtStatistics.totalTransferAmount.toString(),
264
+ * holders: hmtStatistics.holders.map((h) => ({
265
+ * ...h,
266
+ * balance: h.balance.toString(),
267
+ * })),
268
+ * dailyHMTData: hmtStatistics.dailyHMTData.map((d) => ({
269
+ * ...d,
270
+ * totalTransactionAmount: d.totalTransactionAmount.toString(),
271
+ * })),
272
+ * });
273
+ *
274
+ * const hmtStatisticsRange = await statisticsClient.getHMTStatistics({
275
+ * from: new Date(2023, 4, 8),
276
+ * to: new Date(2023, 5, 8),
277
+ * });
38
278
  *
39
- * @param {IStatisticsParams} params - Filter parameters.
40
- * @returns {Promise<HMTStatistics>}
41
- * @throws {Error} - An error object if an error occurred.
279
+ * console.log('HMT statistics from 5/8 - 6/8:', {
280
+ * ...hmtStatisticsRange,
281
+ * totalTransferAmount: hmtStatisticsRange.totalTransferAmount.toString(),
282
+ * holders: hmtStatisticsRange.holders.map((h) => ({
283
+ * ...h,
284
+ * balance: h.balance.toString(),
285
+ * })),
286
+ * dailyHMTData: hmtStatisticsRange.dailyHMTData.map((d) => ({
287
+ * ...d,
288
+ * totalTransactionAmount: d.totalTransactionAmount.toString(),
289
+ * })),
290
+ * });
291
+ * ```
42
292
  */
43
293
  getHMTStatistics(params?: IStatisticsParams): Promise<HMTStatistics>;
44
294
  }
@@ -1 +1 @@
1
- {"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../src/statistics.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,gBAAgB,EAGhB,aAAa,EAEb,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,qBAAa,gBAAgB;IACpB,OAAO,EAAE,WAAW,CAAC;IAE5B;;;;OAIG;gBACS,OAAO,EAAE,WAAW;IAIhC;;;;;;OAMG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IA6B5B;;;;;;OAMG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IAoB5B;;;;;;OAMG;IACG,oBAAoB,CACxB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,iBAAiB,CAAC;IA2B7B;;;;;;OAMG;IACG,gBAAgB,CACpB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,aAAa,CAAC;CAuC1B"}
1
+ {"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../src/statistics.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,gBAAgB,EAGhB,aAAa,EAEb,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,gBAAgB;IACpB,OAAO,EAAE,WAAW,CAAC;IAE5B;;;;OAIG;gBACS,OAAO,EAAE,WAAW;IAIhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IA6B5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IAoB5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkEG;IACG,oBAAoB,CACxB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,iBAAiB,CAAC;IA2B7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgFG;IACG,gBAAgB,CACpB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,aAAa,CAAC;CAuC1B"}
@@ -9,6 +9,43 @@ const ethers_1 = require("ethers");
9
9
  const graphql_request_1 = __importDefault(require("graphql-request"));
10
10
  const graphql_1 = require("./graphql");
11
11
  const utils_1 = require("./utils");
12
+ /**
13
+ * ## Introduction
14
+ *
15
+ * This client enables to obtain statistical information from the subgraph.
16
+ *
17
+ * Unlikely from the other SDK clients, `StatisticsClient` does not require `signer` or `provider` to be provided.
18
+ * We just need to create client object using relevant network data.
19
+ *
20
+ * ```ts
21
+ * constructor(network: NetworkData)
22
+ * ```
23
+ *
24
+ * A `Signer` or a `Provider` should be passed depending on the use case of this module:
25
+ *
26
+ * - **Signer**: when the user wants to use this model in order to send transactions caling the contract functions.
27
+ * - **Provider**: when the user wants to use this model in order to get information from the contracts or subgraph.
28
+ *
29
+ * ## Installation
30
+ *
31
+ * ### npm
32
+ * ```bash
33
+ * npm install @human-protocol/sdk
34
+ * ```
35
+ *
36
+ * ### yarn
37
+ * ```bash
38
+ * yarn install @human-protocol/sdk
39
+ * ```
40
+ *
41
+ * ## Code example
42
+ *
43
+ * ```ts
44
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
45
+ *
46
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
47
+ * ```
48
+ */
12
49
  class StatisticsClient {
13
50
  /**
14
51
  * **StatisticsClient constructor**
@@ -19,11 +56,53 @@ class StatisticsClient {
19
56
  this.network = network;
20
57
  }
21
58
  /**
22
- * Returns the escrow statistics data for the given date range
59
+ * This function returns the statistical data of escrows.
23
60
  *
24
- * @param {IStatisticsParams} params - Filter parameters.
25
- * @returns {Promise<EscrowStatistics>}
26
- * @throws {Error} - An error object if an error occurred.
61
+ *
62
+ * **Input parameters**
63
+ *
64
+ * ```ts
65
+ * interface IStatisticsParams {
66
+ * from?: Date;
67
+ * to?: Date;
68
+ * limit?: number;
69
+ * }
70
+ * ```
71
+ *
72
+ * ```ts
73
+ * type DailyEscrowsData = {
74
+ * timestamp: Date;
75
+ * escrowsTotal: number;
76
+ * escrowsPending: number;
77
+ * escrowsSolved: number;
78
+ * escrowsPaid: number;
79
+ * escrowsCancelled: number;
80
+ * };
81
+ *
82
+ * type EscrowStatistics = {
83
+ * totalEscrows: number;
84
+ * dailyEscrowsData: DailyEscrowsData[];
85
+ * };
86
+ * ```
87
+ *
88
+ *
89
+ * @param {IStatisticsParams} params Statistics params with duration data
90
+ * @returns {EscrowStatistics} Escrow statistics data.
91
+ *
92
+ *
93
+ * **Code example**
94
+ *
95
+ * ```ts
96
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
97
+ *
98
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
99
+ *
100
+ * const escrowStatistics = await statisticsClient.getEscrowStatistics();
101
+ * const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({
102
+ * from: new Date('2021-04-01'),
103
+ * to: new Date('2021-04-30'),
104
+ * });
105
+ * ```
27
106
  */
28
107
  async getEscrowStatistics(params = {}) {
29
108
  try {
@@ -49,11 +128,48 @@ class StatisticsClient {
49
128
  }
50
129
  }
51
130
  /**
52
- * Returns the worker statistics data for the given date range
131
+ * This function returns the statistical data of workers.
132
+ *
133
+ *
134
+ * **Input parameters**
53
135
  *
54
- * @param {IStatisticsParams} params - Filter parameters.
55
- * @returns {Promise<WorkerStatistics>}
56
- * @throws {Error} - An error object if an error occurred.
136
+ * ```ts
137
+ * interface IStatisticsParams {
138
+ * from?: Date;
139
+ * to?: Date;
140
+ * limit?: number;
141
+ * }
142
+ * ```
143
+ *
144
+ * ```ts
145
+ * type DailyWorkerData = {
146
+ * timestamp: Date;
147
+ * activeWorkers: number;
148
+ * };
149
+ *
150
+ * type WorkerStatistics = {
151
+ * dailyWorkersData: DailyWorkerData[];
152
+ * };
153
+ * ```
154
+ *
155
+ *
156
+ * @param {IStatisticsParams} params Statistics params with duration data
157
+ * @returns {WorkerStatistics} Worker statistics data.
158
+ *
159
+ *
160
+ * **Code example**
161
+ *
162
+ * ```ts
163
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
164
+ *
165
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
166
+ *
167
+ * const workerStatistics = await statisticsClient.getWorkerStatistics();
168
+ * const workerStatisticsApril = await statisticsClient.getWorkerStatistics({
169
+ * from: new Date('2021-04-01'),
170
+ * to: new Date('2021-04-30'),
171
+ * });
172
+ * ```
57
173
  */
58
174
  async getWorkerStatistics(params = {}) {
59
175
  try {
@@ -73,11 +189,71 @@ class StatisticsClient {
73
189
  }
74
190
  }
75
191
  /**
76
- * Returns the payment statistics data for the given date range
192
+ * This function returns the statistical data of payments.
193
+ *
194
+ *
195
+ * **Input parameters**
196
+ *
197
+ * ```ts
198
+ * interface IStatisticsParams {
199
+ * from?: Date;
200
+ * to?: Date;
201
+ * limit?: number;
202
+ * }
203
+ * ```
77
204
  *
78
- * @param {IStatisticsParams} params - Filter parameters.
79
- * @returns {Promise<PaymentStatistics>}
80
- * @throws {Error} - An error object if an error occurred.
205
+ * ```ts
206
+ * type DailyPaymentData = {
207
+ * timestamp: Date;
208
+ * totalAmountPaid: BigNumber;
209
+ * totalCount: number;
210
+ * averageAmountPerWorker: BigNumber;
211
+ * };
212
+ *
213
+ * type PaymentStatistics = {
214
+ * dailyPaymentsData: DailyPaymentData[];
215
+ * };
216
+ * ```
217
+ *
218
+ *
219
+ * @param {IStatisticsParams} params Statistics params with duration data
220
+ * @returns {PaymentStatistics} Payment statistics data.
221
+ *
222
+ *
223
+ * **Code example**
224
+ *
225
+ * ```ts
226
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
227
+ *
228
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
229
+ *
230
+ * console.log(
231
+ * 'Payment statistics:',
232
+ * (await statisticsClient.getPaymentStatistics()).dailyPaymentsData.map(
233
+ * (p) => ({
234
+ * ...p,
235
+ * totalAmountPaid: p.totalAmountPaid.toString(),
236
+ * averageAmountPerJob: p.averageAmountPerJob.toString(),
237
+ * averageAmountPerWorker: p.averageAmountPerWorker.toString(),
238
+ * })
239
+ * )
240
+ * );
241
+ *
242
+ * console.log(
243
+ * 'Payment statistics from 5/8 - 6/8:',
244
+ * (
245
+ * await statisticsClient.getPaymentStatistics({
246
+ * from: new Date(2023, 4, 8),
247
+ * to: new Date(2023, 5, 8),
248
+ * })
249
+ * ).dailyPaymentsData.map((p) => ({
250
+ * ...p,
251
+ * totalAmountPaid: p.totalAmountPaid.toString(),
252
+ * averageAmountPerJob: p.averageAmountPerJob.toString(),
253
+ * averageAmountPerWorker: p.averageAmountPerWorker.toString(),
254
+ * }))
255
+ * );
256
+ * ```
81
257
  */
82
258
  async getPaymentStatistics(params = {}) {
83
259
  try {
@@ -101,11 +277,85 @@ class StatisticsClient {
101
277
  }
102
278
  }
103
279
  /**
104
- * Returns the HMToken statistics data for the given date range
280
+ * This function returns the statistical data of HMToken.
281
+ *
282
+ *
283
+ * **Input parameters**
284
+ *
285
+ * ```ts
286
+ * interface IStatisticsParams {
287
+ * from?: Date;
288
+ * to?: Date;
289
+ * limit?: number;
290
+ * }
291
+ * ```
292
+ *
293
+ * ```ts
294
+ * type HMTHolder = {
295
+ * address: string;
296
+ * balance: BigNumber;
297
+ * }
298
+ *
299
+ * type DailyHMTData = {
300
+ * timestamp: Date;
301
+ * totalTransactionAmount: BigNumber;
302
+ * totalTransactionCount: number;
303
+ * };
304
+ *
305
+ * type HMTStatistics = {
306
+ * totalTransferAmount: BigNumber;
307
+ * totalTransferCount: BigNumber;
308
+ * totalHolders: number;
309
+ * holders: HMTHolder[];
310
+ * dailyHMTData: DailyHMTData[];
311
+ * };
312
+ * ```
313
+ *
314
+ *
315
+ * @param {IStatisticsParams} params Statistics params with duration data
316
+ * @returns {HMTStatistics} HMToken statistics data.
317
+ *
318
+ *
319
+ * **Code example**
320
+ *
321
+ * ```ts
322
+ * import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
323
+ *
324
+ * const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_MUMBAI]);
325
+ *
326
+ * const hmtStatistics = await statisticsClient.getHMTStatistics();
327
+ *
328
+ * console.log('HMT statistics:', {
329
+ * ...hmtStatistics,
330
+ * totalTransferAmount: hmtStatistics.totalTransferAmount.toString(),
331
+ * holders: hmtStatistics.holders.map((h) => ({
332
+ * ...h,
333
+ * balance: h.balance.toString(),
334
+ * })),
335
+ * dailyHMTData: hmtStatistics.dailyHMTData.map((d) => ({
336
+ * ...d,
337
+ * totalTransactionAmount: d.totalTransactionAmount.toString(),
338
+ * })),
339
+ * });
340
+ *
341
+ * const hmtStatisticsRange = await statisticsClient.getHMTStatistics({
342
+ * from: new Date(2023, 4, 8),
343
+ * to: new Date(2023, 5, 8),
344
+ * });
105
345
  *
106
- * @param {IStatisticsParams} params - Filter parameters.
107
- * @returns {Promise<HMTStatistics>}
108
- * @throws {Error} - An error object if an error occurred.
346
+ * console.log('HMT statistics from 5/8 - 6/8:', {
347
+ * ...hmtStatisticsRange,
348
+ * totalTransferAmount: hmtStatisticsRange.totalTransferAmount.toString(),
349
+ * holders: hmtStatisticsRange.holders.map((h) => ({
350
+ * ...h,
351
+ * balance: h.balance.toString(),
352
+ * })),
353
+ * dailyHMTData: hmtStatisticsRange.dailyHMTData.map((d) => ({
354
+ * ...d,
355
+ * totalTransactionAmount: d.totalTransactionAmount.toString(),
356
+ * })),
357
+ * });
358
+ * ```
109
359
  */
110
360
  async getHMTStatistics(params = {}) {
111
361
  try {