OperatorUtils

@human-protocol/sdk


@human-protocol/sdk / operator / OperatorUtils

Class: OperatorUtils

Defined in: operator.ts:29

Constructors

Constructor

new OperatorUtils(): OperatorUtils

Returns

OperatorUtils

Methods

getOperator()

static getOperator(chainId, address, options?): Promise<IOperator | null>

Defined in: operator.ts:46

This function returns the operator data for the given address.

Parameters

chainId

ChainId

Network in which the operator is deployed

address

string

Operator address.

options?

SubgraphOptions

Optional configuration for subgraph requests.

Returns

Promise<IOperator | null>

  • Returns the operator details or null if not found.

Code example


getOperators()

static getOperators(filter, options?): Promise<IOperator[]>

Defined in: operator.ts:92

This function returns all the operator details of the protocol.

Parameters

filter

IOperatorsFilter

Filter for the operators.

options?

SubgraphOptions

Optional configuration for subgraph requests.

Returns

Promise<IOperator[]>

Returns an array with all the operator details.

Code example


getReputationNetworkOperators()

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

Defined in: operator.ts:159

Retrieves the reputation network operators of the specified address.

Parameters

chainId

ChainId

Network in which the reputation network is deployed

address

string

Address of the reputation oracle.

role?

string

(Optional) Role of the operator.

options?

SubgraphOptions

Optional configuration for subgraph requests.

Returns

Promise<IOperator[]>

  • Returns an array of operator details.

Code example


getRewards()

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

Defined in: operator.ts:205

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

Parameters

chainId

ChainId

Network in which the rewards are deployed

slasherAddress

string

Slasher address.

options?

SubgraphOptions

Optional configuration for subgraph requests.

Returns

Promise<IReward[]>

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

Code example

Last updated