StatisticsClient

@human-protocol/sdk • Docs


@human-protocol/sdk / statistics / StatisticsClient

Class: StatisticsClient

Introduction

This client enables to obtain statistical information from the subgraph.

Unlikely from the other SDK clients, StatisticsClient does not require signer or provider to be provided. We just need to create client object using relevant network data.

constructor(network: NetworkData)

A Signer or a Provider should be passed depending on the use case of this module:

  • Signer: when the user wants to use this model in order to send transactions caling the contract functions.

  • Provider: when the user wants to use this model in order to get information from the contracts or subgraph.

Installation

npm

npm install @human-protocol/sdk

yarn

Code example

Constructors

new StatisticsClient()

new StatisticsClient(networkData): StatisticsClient

StatisticsClient constructor

Parameters

• networkData: NetworkData

The network information required to connect to the Statistics contract

Returns

StatisticsClient

Defined in

statistics.ts:72

Properties

networkData

networkData: NetworkData

Defined in

statistics.ts:64


subgraphUrl

subgraphUrl: string

Defined in

statistics.ts:65

Methods

getEscrowStatistics()

getEscrowStatistics(filter): Promise<EscrowStatistics>

This function returns the statistical data of escrows.

Input parameters

Parameters

• filter: IStatisticsFilter = {}

Statistics params with duration data

Returns

Promise<EscrowStatistics>

Escrow statistics data.

Code example

Defined in

statistics.ts:128


getHMTDailyData()

getHMTDailyData(filter): Promise<DailyHMTData[]>

This function returns the statistical data of HMToken day by day.

Input parameters

Parameters

• filter: IStatisticsFilter = {}

Statistics params with duration data

Returns

Promise<DailyHMTData[]>

Daily HMToken statistics data.

Code example

Defined in

statistics.ts:495


getHMTHolders()

getHMTHolders(params): Promise<HMTHolder[]>

This function returns the holders of the HMToken with optional filters and ordering.

Input parameters

Parameters

• params: IHMTHoldersParams = {}

HMT Holders params with filters and ordering

Returns

Promise<HMTHolder[]>

List of HMToken holders.

Code example

Defined in

statistics.ts:421


getHMTStatistics()

getHMTStatistics(): Promise<HMTStatistics>

This function returns the statistical data of HMToken.

type HMTStatistics = { totalTransferAmount: BigNumber; totalTransferCount: BigNumber; totalHolders: number; };

Returns

Promise<HMTStatistics>

Defined in

statistics.ts:378


getPaymentStatistics()

getPaymentStatistics(filter): Promise<PaymentStatistics>

This function returns the statistical data of payments.

Input parameters

Parameters

• filter: IStatisticsFilter = {}

Statistics params with duration data

Returns

Promise<PaymentStatistics>

Payment statistics data.

Code example

Defined in

statistics.ts:312


getWorkerStatistics()

getWorkerStatistics(filter): Promise<WorkerStatistics>

This function returns the statistical data of workers.

Input parameters

Parameters

• filter: IStatisticsFilter = {}

Statistics params with duration data

Returns

Promise<WorkerStatistics>

Worker statistics data.

Code example

Defined in

statistics.ts:213

Last updated