Human Protocol SDK
v4.1.0
v4.1.0
  • 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

Last updated 3 days ago


/ / OperatorUtils

Class: OperatorUtils

Defined in:

Constructors

new OperatorUtils()

new OperatorUtils():

Returns

Methods

getOperator()

static getOperator(chainId, address): Promise<>

Defined in:

This function returns the operator data for the given address.

Parameters

chainId

Network in which the operator is deployed

address

string

Operator address.

Returns

Returns the operator details.

Code example

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

const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');

getOperators()

This function returns all the operator details of the protocol.

Parameters

filter

Filter for the operators.

Returns

Returns an array with all the operator details.

Code example

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

const filter: IOperatorsFilter = {
 chainId: ChainId.POLYGON
};
const operators = await OperatorUtils.getOperators(filter);

getReputationNetworkOperators()

Retrieves the reputation network operators of the specified address.

Parameters

chainId

Network in which the reputation network is deployed

address

string

Address of the reputation oracle.

role?

string

(Optional) Role of the operator.

Returns

  • Returns an array of operator details.

Code example

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

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

getRewards()

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

Parameters

chainId

Network in which the rewards are deployed

slasherAddress

string

Slasher address.

Returns

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');

Promise<>

static getOperators(filter): Promise<[]>

Defined in:

Promise<[]>

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

Defined in:

Promise<[]>

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

Defined in:

Promise<[]>

@human-protocol/sdk
@human-protocol/sdk
operator
operator.ts:27
OperatorUtils
OperatorUtils
IOperator
operator.ts:43
ChainId
IOperator
IOperator
operator.ts:109
IOperatorsFilter
IOperator
IOperator
operator.ts:190
ChainId
IOperator
IReward
operator.ts:244
ChainId
IReward