OperatorUtils

@human-protocol/sdk / Modules / operator / OperatorUtils

Class: OperatorUtils

operator.OperatorUtils

Table of contents

Constructors

Methods

Constructors

constructor

new OperatorUtils(): OperatorUtils

Returns

OperatorUtils

Methods

getLeader

getLeader(chainId, address): Promise<ILeader>

This function returns the leader data for the given address.

Parameters

NameTypeDescription

chainId

ChainId

-

address

string

Leader address.

Returns

Promise<ILeader>

Returns the leader details.

Code example

import { OperatorUtils, ChainId } from '@human-protocol/sdk';

const leader = await OperatorUtils.getLeader(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');

Defined in

operator.ts:43


getLeaders

getLeaders(filter?): Promise<ILeader[]>

This function returns all the leader details of the protocol.

Parameters

NameTypeDescription

filter

ILeadersFilter

Filter for the leaders.

Returns

Promise<ILeader[]>

Returns an array with all the leader details.

Code example

import { OperatorUtils } from '@human-protocol/sdk';

const leaders = await OperatorUtils.getLeaders();

Defined in

operator.ts:84


getReputationNetworkOperators

getReputationNetworkOperators(chainId, address, role?): Promise<IOperator[]>

Retrieves the reputation network operators of the specified address.

Parameters

NameTypeDescription

chainId

ChainId

-

address

string

Address of the reputation oracle.

role?

string

(Optional) Role of the operator.

Returns

Promise<IOperator[]>

  • Returns an array of operator details.

Example

import { OperatorUtils, ChainId } from '@human-protocol/sdk';

const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');

Defined in

operator.ts:123


getRewards

getRewards(chainId, slasherAddress): Promise<IReward[]>

This function returns information about the rewards for a given slasher address.

Parameters

NameTypeDescription

chainId

ChainId

-

slasherAddress

string

Slasher address.

Returns

Promise<IReward[]>

Returns an array of Reward objects that contain the rewards earned by the user through slashing other users.

Code example

import { OperatorUtils, ChainId } from '@human-protocol/sdk';

const rewards = await OperatorUtils.getRewards(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');

Defined in

operator.ts:162

Last updated