Human Protocol SDK
v4.0.1
v4.0.1
  • Typescript SDK
    • Encryption
      • Encryption
      • EncryptionUtils
    • Escrow
      • EscrowClient
      • EscrowUtils
    • KVStore
      • KVStoreClient
      • KVStoreUtils
    • Staking
      • StakingClient
    • Operator
      • OperatorUtils
    • Storage
      • StorageClient
    • Statistics
      • StatisticsClient
    • Transaction
      • TransactionUtils
  • Python SDK
    • agreement
      • bootstrap
      • measures
      • utils
    • encryption
      • encryption
      • legacy_encryption
      • encryption_utils
    • escrow
      • escrow_client
      • escrow_utils
    • kvstore
      • kvstore_client
      • kvstore_utils
    • staking
      • staking_client
      • staking_utils
    • operator
      • operator_utils
    • statistics
      • statistics_client
    • storage
      • storage_client
      • storage_utils
    • transaction
      • transaction_utils
    • constants
    • filter
    • utils
  • CHANGELOG
Powered by GitBook
On this page
  • Class: OperatorUtils
  • Constructors
  • Methods
  1. Typescript SDK
  2. Operator

OperatorUtils

@human-protocol/sdk


@human-protocol/sdk / operator / OperatorUtils

Class: OperatorUtils

Constructors

new OperatorUtils()

new OperatorUtils(): OperatorUtils

Returns

OperatorUtils

Methods

getLeader()

static getLeader(chainId, address): Promise<ILeader>

This function returns the leader data for the given address.

Parameters

chainId

ChainId

Network in which the leader is deployed

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:44


getLeaders()

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

This function returns all the leader details of the protocol.

Parameters

filter

ILeadersFilter

Filter for the leaders.

Returns

Promise<ILeader[]>

Returns an array with all the leader details.

Code example

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

const filter: ILeadersFilter = {
 chainId: ChainId.POLYGON
};
const leaders = await OperatorUtils.getLeaders(filter);

Defined in

operator.ts:107


getReputationNetworkOperators()

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

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.

Returns

Promise<IOperator[]>

  • Returns an array of operator details.

Code example

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

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

Defined in

operator.ts:186


getRewards()

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

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.

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:236

Last updated 4 months ago