staking_utils
Utility class for staking-related operations.
Code Example
Module
class human_protocol_sdk.staking.staking_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)
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)
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
]) – Url
class human_protocol_sdk.staking.staking_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.staking.staking_utils.RewardData(escrow_address, amount)
Bases: object
__init__(escrow_address, amount)
Initializes an RewardData instance.
Parameters:
escrow_address (
str
) – Escrow addressamount (
int
) – Amount
class human_protocol_sdk.staking.staking_utils.StakingUtils
Bases: object
A utility class that provides additional staking-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.staking.staking_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_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:
Last updated