operator_utils
Utility class for operator-related operations.
Code Example
Module
class human_protocol_sdk.operator.operator_utils.LeaderData(chain_id, id, address, amount_staked, amount_allocated, amount_locked, locked_until_timestamp, amount_withdrawn, amount_slashed, reputation, reward, amount_jobs_launched, role=None, fee=None, public_key=None, webhook_url=None, url=None, job_types=None)
Bases: object
__init__(chain_id, id, address, amount_staked, amount_allocated, amount_locked, locked_until_timestamp, amount_withdrawn, amount_slashed, reputation, reward, amount_jobs_launched, role=None, fee=None, public_key=None, webhook_url=None, url=None, job_types=None)
Initializes an LeaderData instance.
Parameters:
chain_id (
ChainId
) – Chain Identifierid (
str
) – Identifieraddress (
str
) – Addressamount_staked (
int
) – Amount stakedamount_allocated (
int
) – Amount allocatedamount_locked (
int
) – Amount lockedlocked_until_timestamp (
int
) – Locked until timestampamount_withdrawn (
int
) – Amount withdrawnamount_slashed (
int
) – Amount slashedreputation (
int
) – Reputationreward (
int
) – Rewardamount_jobs_launched (
int
) – Amount of jobs launchedrole (
Optional
[str
]) – Rolefee (
Optional
[int
]) – Feepublic_key (
Optional
[str
]) – Public keywebhook_url (
Optional
[str
]) – Webhook urlurl (
Optional
[str
]) – Urljob_types (
Optional
[List
[str
]]) – Job types
class human_protocol_sdk.operator.operator_utils.LeaderFilter(networks, role=None)
Bases: object
A class used to filter leaders.
__init__(networks, role=None)
Initializes a LeaderFilter instance.
Parameters:
networks (
List
[ChainId
]) – Networks to request datarole (
Optional
[str
]) – Leader role
class human_protocol_sdk.operator.operator_utils.Operator(address, role, url='', job_types=[])
Bases: object
__init__(address, role, url='', job_types=[])
Initializes an Operator instance.
Parameters:
address (
str
) – Operator addressrole (
str
) – Role of the operator
class human_protocol_sdk.operator.operator_utils.OperatorUtils
Bases: object
A utility class that provides additional operator-related functionalities.
static get_leader(chain_id, leader_address)
Get the leader details.
Parameters:
chain_id (
ChainId
) – Network in which the leader existsleader_address (
str
) – Address of the leader
Return type:
Optional
[LeaderData
]Returns: Leader data if exists, otherwise None
Example:
static get_leaders(filter=<human_protocol_sdk.operator.operator_utils.LeaderFilter object>)
Get leaders data of the protocol
Parameters: filter (
LeaderFilter
) – Leader filterReturn type:
List
[LeaderData
]Returns: List of leaders data
Example:
static get_reputation_network_operators(chain_id, address, role=None)
Get the reputation network operators of the specified address.
Parameters:
chain_id (
ChainId
) – Network in which the reputation network existsaddress (
str
) – Address of the reputation oraclerole (
Optional
[str
]) – (Optional) Role of the operator
Parem job_types: (Optional) Job types of the operator
Return type:
List
[Operator
]Returns: Returns an array of operator details
Example:
static get_rewards_info(chain_id, slasher)
Get rewards of the given slasher
Parameters:
chain_id (
ChainId
) – Network in which the slasher existsslasher (
str
) – Address of the slasher
Return type:
List
[RewardData
]Returns: List of rewards info
Example:
exception human_protocol_sdk.operator.operator_utils.OperatorUtilsError
Bases: Exception
Raises when some error happens when interacting with operator.
class human_protocol_sdk.operator.operator_utils.RewardData(escrow_address, amount)
Bases: object
__init__(escrow_address, amount)
Initializes a RewardData instance.
Parameters:
escrow_address (
str
) – Escrow addressamount (
int
) – Amount
Last updated