OperatorUtils
@human-protocol/sdk / operator / OperatorUtils
Class: OperatorUtils
Defined in: operator.ts:27
Constructors
Constructor
new OperatorUtils():
OperatorUtils
Returns
OperatorUtils
Methods
getOperator()
static
getOperator(chainId
,address
):Promise
<IOperator
>
Defined in: operator.ts:43
This function returns the operator data for the given address.
Parameters
chainId
Network in which the operator is deployed
address
string
Operator address.
Returns
Promise
<IOperator
>
Returns the operator details.
Code example
import { OperatorUtils, ChainId } from '@human-protocol/sdk';
const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
getOperators()
static
getOperators(filter
):Promise
<IOperator
[]>
Defined in: operator.ts:109
This function returns all the operator details of the protocol.
Parameters
filter
Filter for the operators.
Returns
Promise
<IOperator
[]>
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()
static
getReputationNetworkOperators(chainId
,address
,role?
):Promise
<IOperator
[]>
Defined in: operator.ts:190
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
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');
getRewards()
static
getRewards(chainId
,slasherAddress
):Promise
<IReward
[]>
Defined in: operator.ts:244
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
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');
Last updated