Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
88e4c1f
Implement staking utilities and GraphQL queries for staker management
flopez7 Jul 1, 2025
81960a7
Add staker data to operator and rebuild docs
flopez7 Jul 2, 2025
e661059
replace 'reward' with 'lastDepositTimestamp' in DiscoveredOracle mode…
flopez7 Jul 2, 2025
6161bc7
remove lastDepositTimestamp from OperatorData and related tests; upda…
flopez7 Jul 14, 2025
30d18fc
refactor: rename amount fields in DTOs and models for clarity
flopez7 Aug 13, 2025
1734b59
fix: rename amount_withdrawn to withdrawn_amount for clarity in Escro…
flopez7 Aug 13, 2025
76045ce
refactor: update get_operators and get_workers functions to use POLYG…
flopez7 Aug 13, 2025
379201f
rename withdrawnAmount to withdrawableAmount in OperatorDto and relat…
flopez7 Aug 19, 2025
b2e17f8
Merge remote-tracking branch 'origin/develop' into feat/3413
flopez7 Aug 20, 2025
68f77dd
update zod dependency version to ~3.24.4 in package.json and yarn.lock
flopez7 Aug 20, 2025
455becd
update @hookform/resolvers version to ~5.0.1 in package.json and yarn…
flopez7 Aug 20, 2025
72089ec
remove redundant mockResolvedValueOnce calls for withdraw method in s…
flopez7 Aug 21, 2025
55e69a1
Merge branch 'develop' into feat/3413
flopez7 Aug 21, 2025
88ca266
refactor(tests): streamline operator tests by removing redundant mock…
portuu3 Aug 21, 2025
4dad01e
refactor(tests): update jobTypes handling in operator tests to use ar…
portuu3 Aug 21, 2025
7a68714
Merge branch 'contracts-v2' into feat/3413
portuu3 Aug 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,15 +572,15 @@ Initializes a Escrow instance.
* **manifest** (`str`) – Manifest data (can be a URL or JSON string)
* **hash** (`str`) – Manifest file hash

### *class* human_protocol_sdk.escrow.escrow_client.EscrowWithdraw(tx_hash, token_address, amount_withdrawn)
### *class* human_protocol_sdk.escrow.escrow_client.EscrowWithdraw(tx_hash, token_address, withdrawn_amount)

Bases: `object`

#### \_\_init_\_(tx_hash, token_address, amount_withdrawn)
#### \_\_init_\_(tx_hash, token_address, withdrawn_amount)

Represents the result of an escrow cancellation transaction.

* **Parameters:**
* **tx_hash** (`str`) – The hash of the transaction associated with the escrow withdrawal.
* **token_address** (`str`) – The address of the token used for the withdrawal.
* **amount_withdrawn** (`any`) – The amount withdrawn from the escrow.
* **withdrawn_amount** (`any`) – The amount withdrawn from the escrow.
6 changes: 6 additions & 0 deletions docs/sdk/python/human_protocol_sdk.filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ Initializes a filter for payouts.
* **skip** (`int`) – Optional number of payouts to skip. Default is 0.
* **order_direction** ([`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)) – Optional order direction. Default is DESC.

### *class* human_protocol_sdk.filter.StakersFilter(chain_id, min_staked_amount=None, max_staked_amount=None, min_locked_amount=None, max_locked_amount=None, min_withdrawn_amount=None, max_withdrawn_amount=None, min_slashed_amount=None, max_slashed_amount=None, order_by='lastDepositTimestamp', order_direction=OrderDirection.DESC, first=10, skip=0)

Bases: `object`

#### \_\_init_\_(chain_id, min_staked_amount=None, max_staked_amount=None, min_locked_amount=None, max_locked_amount=None, min_withdrawn_amount=None, max_withdrawn_amount=None, min_slashed_amount=None, max_slashed_amount=None, order_by='lastDepositTimestamp', order_direction=OrderDirection.DESC, first=10, skip=0)

### *class* human_protocol_sdk.filter.StatisticsFilter(date_from=None, date_to=None, first=10, skip=0, order_direction=OrderDirection.ASC)

Bases: `object`
Expand Down
8 changes: 8 additions & 0 deletions docs/sdk/python/human_protocol_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
* [Module](human_protocol_sdk.staking.staking_client.md#module)
* [`StakingClient`](human_protocol_sdk.staking.staking_client.md#human_protocol_sdk.staking.staking_client.StakingClient)
* [`StakingClientError`](human_protocol_sdk.staking.staking_client.md#human_protocol_sdk.staking.staking_client.StakingClientError)
* [human_protocol_sdk.staking.staking_utils module](human_protocol_sdk.staking.staking_utils.md)
* [Code Example](human_protocol_sdk.staking.staking_utils.md#code-example)
* [Module](human_protocol_sdk.staking.staking_utils.md#module)
* [`StakerData`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakerData)
* [`StakingUtils`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakingUtils)
* [`StakingUtilsError`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakingUtilsError)
* [human_protocol_sdk.statistics package](human_protocol_sdk.statistics.md)
* [Submodules](human_protocol_sdk.statistics.md#submodules)
* [human_protocol_sdk.statistics.statistics_client module](human_protocol_sdk.statistics.statistics_client.md)
Expand Down Expand Up @@ -173,6 +179,8 @@
* [`FilterError`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.FilterError)
* [`PayoutFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.PayoutFilter)
* [`PayoutFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.PayoutFilter.__init__)
* [`StakersFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StakersFilter)
* [`StakersFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StakersFilter.__init__)
* [`StatisticsFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatisticsFilter)
* [`StatisticsFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatisticsFilter.__init__)
* [`StatusEventFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatusEventFilter)
Expand Down
19 changes: 9 additions & 10 deletions docs/sdk/python/human_protocol_sdk.operator.operator_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,23 @@ print(

## Module

### *class* human_protocol_sdk.operator.operator_utils.OperatorData(chain_id, id, address, amount_staked, amount_locked, locked_until_timestamp, amount_withdrawn, amount_slashed, reward, amount_jobs_processed, role=None, fee=None, public_key=None, webhook_url=None, website=None, url=None, job_types=None, registration_needed=None, registration_instructions=None, reputation_networks=None, name=None, category=None)
### *class* human_protocol_sdk.operator.operator_utils.OperatorData(chain_id, id, address, staked_amount, locked_amount, locked_until_timestamp, withdrawn_amount, slashed_amount, amount_jobs_processed, role=None, fee=None, public_key=None, webhook_url=None, website=None, url=None, job_types=None, registration_needed=None, registration_instructions=None, reputation_networks=None, name=None, category=None)

Bases: `object`

#### \_\_init_\_(chain_id, id, address, amount_staked, amount_locked, locked_until_timestamp, amount_withdrawn, amount_slashed, reward, amount_jobs_processed, role=None, fee=None, public_key=None, webhook_url=None, website=None, url=None, job_types=None, registration_needed=None, registration_instructions=None, reputation_networks=None, name=None, category=None)
#### \_\_init_\_(chain_id, id, address, staked_amount, locked_amount, locked_until_timestamp, withdrawn_amount, slashed_amount, amount_jobs_processed, role=None, fee=None, public_key=None, webhook_url=None, website=None, url=None, job_types=None, registration_needed=None, registration_instructions=None, reputation_networks=None, name=None, category=None)

Initializes a OperatorData instance.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Chain Identifier
* **id** (`str`) – Identifier
* **address** (`str`) – Address
* **amount_staked** (`int`) – Amount staked
* **amount_locked** (`int`) – Amount locked
* **staked_amount** (`int`) – Amount staked
* **locked_amount** (`int`) – Amount locked
* **locked_until_timestamp** (`int`) – Locked until timestamp
* **amount_withdrawn** (`int`) – Amount withdrawn
* **amount_slashed** (`int`) – Amount slashed
* **reward** (`int`) – Reward
* **withdrawn_amount** (`int`) – Amount withdrawn
* **slashed_amount** (`int`) – Amount slashed
* **amount_jobs_processed** (`int`) – Amount of jobs launched
* **role** (`Optional`[`str`]) – Role
* **fee** (`Optional`[`int`]) – Fee
Expand All @@ -49,20 +48,20 @@ Initializes a OperatorData instance.
* **name** (`Optional`[`str`]) – Name
* **category** (`Optional`[`str`]) – Category

### *class* human_protocol_sdk.operator.operator_utils.OperatorFilter(chain_id, roles=[], min_amount_staked=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0)
### *class* human_protocol_sdk.operator.operator_utils.OperatorFilter(chain_id, roles=[], min_staked_amount=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0)

Bases: `object`

A class used to filter operators.

#### \_\_init_\_(chain_id, roles=[], min_amount_staked=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0)
#### \_\_init_\_(chain_id, roles=[], min_staked_amount=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0)

Initializes a OperatorFilter instance.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Chain ID to request data
* **roles** (`Optional`[`str`]) – Roles to filter by
* **min_amount_staked** (`Optional`[`int`]) – Minimum amount staked to filter by
* **min_staked_amount** (`Optional`[`int`]) – Minimum amount staked to filter by
* **order_by** (`Optional`[`str`]) – Property to order by, e.g., “role”
* **order_direction** ([`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)) – Order direction of results, “asc” or “desc”
* **first** (`int`) – Number of items per page
Expand Down
9 changes: 9 additions & 0 deletions docs/sdk/python/human_protocol_sdk.staking.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ obtain staking information from both the contracts and subgraph.
* [`StakingClient.unstake()`](human_protocol_sdk.staking.staking_client.md#human_protocol_sdk.staking.staking_client.StakingClient.unstake)
* [`StakingClient.withdraw()`](human_protocol_sdk.staking.staking_client.md#human_protocol_sdk.staking.staking_client.StakingClient.withdraw)
* [`StakingClientError`](human_protocol_sdk.staking.staking_client.md#human_protocol_sdk.staking.staking_client.StakingClientError)
* [human_protocol_sdk.staking.staking_utils module](human_protocol_sdk.staking.staking_utils.md)
* [Code Example](human_protocol_sdk.staking.staking_utils.md#code-example)
* [Module](human_protocol_sdk.staking.staking_utils.md#module)
* [`StakerData`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakerData)
* [`StakerData.__init__()`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakerData.__init__)
* [`StakingUtils`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakingUtils)
* [`StakingUtils.get_staker()`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakingUtils.get_staker)
* [`StakingUtils.get_stakers()`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakingUtils.get_stakers)
* [`StakingUtilsError`](human_protocol_sdk.staking.staking_utils.md#human_protocol_sdk.staking.staking_utils.StakingUtilsError)
49 changes: 49 additions & 0 deletions docs/sdk/python/human_protocol_sdk.staking.staking_utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# human_protocol_sdk.staking.staking_utils module

Utility class for staking-related operations.

## Code Example

```python
from human_protocol_sdk.constants import ChainId
from human_protocol_sdk.staking.staking_utils import StakingUtils, StakersFilter

stakers = StakingUtils.get_stakers(
StakersFilter(
chain_id=ChainId.POLYGON_AMOY,
min_staked_amount="1000000000000000000",
max_locked_amount="5000000000000000000",
order_by="withdrawnAmount",
order_direction="asc",
first=5,
skip=0,
)
)
print("Filtered stakers:", stakers)
```

## Module

### *class* human_protocol_sdk.staking.staking_utils.StakerData(id, address, staked_amount, locked_amount, withdrawn_amount, slashed_amount, locked_until_timestamp, last_deposit_timestamp)

Bases: `object`

#### \_\_init_\_(id, address, staked_amount, locked_amount, withdrawn_amount, slashed_amount, locked_until_timestamp, last_deposit_timestamp)

### *class* human_protocol_sdk.staking.staking_utils.StakingUtils

Bases: `object`

#### *static* get_staker(chain_id, address)

* **Return type:**
`Optional`[[`StakerData`](#human_protocol_sdk.staking.staking_utils.StakerData)]

#### *static* get_stakers(filter)

* **Return type:**
`List`[[`StakerData`](#human_protocol_sdk.staking.staking_utils.StakerData)]

### *exception* human_protocol_sdk.staking.staking_utils.StakingUtilsError

Bases: `Exception`
1 change: 1 addition & 0 deletions docs/sdk/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ pip install human-protocol-sdk[agreement]
* [`EscrowFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.EscrowFilter)
* [`FilterError`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.FilterError)
* [`PayoutFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.PayoutFilter)
* [`StakersFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StakersFilter)
* [`StatisticsFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatisticsFilter)
* [`StatusEventFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatusEventFilter)
* [`TransactionFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter)
Expand Down
10 changes: 5 additions & 5 deletions docs/sdk/typescript/base/classes/BaseEthersClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

[@human-protocol/sdk](../../modules.md) / [base](../README.md) / BaseEthersClient

# Class: `abstract` BaseEthersClient
# Abstract Class: BaseEthersClient

Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)
Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)

## Introduction

Expand All @@ -24,7 +24,7 @@ This class is used as a base class for other clients making on-chain calls.

> **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient`

Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)
Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)

**BaseClient constructor**

Expand Down Expand Up @@ -52,12 +52,12 @@ The network information required to connect to the contracts

> **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md)

Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)

***

### runner

> `protected` **runner**: `ContractRunner`

Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
12 changes: 6 additions & 6 deletions docs/sdk/typescript/encryption/classes/Encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: Encryption

Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)
Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)

## Introduction

Expand Down Expand Up @@ -53,7 +53,7 @@ const encryption = await Encryption.build(privateKey, passphrase);

> **new Encryption**(`privateKey`): `Encryption`

Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)

Constructor for the Encryption class.

Expand All @@ -75,7 +75,7 @@ The private key.

> **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>

Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)

This function decrypts messages using the private key. In addition, the public key can be added for signature verification.

Expand Down Expand Up @@ -129,7 +129,7 @@ const resultMessage = await encryption.decrypt('message');

> **sign**(`message`): `Promise`\<`string`\>

Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)

This function signs a message using the private key used to initialize the client.

Expand Down Expand Up @@ -165,7 +165,7 @@ const resultMessage = await encryption.sign('message');

> **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\>

Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)

This function signs and encrypts a message using the private key used to initialize the client and the specified public keys.

Expand Down Expand Up @@ -232,7 +232,7 @@ const resultMessage = await encryption.signAndEncrypt('message', publicKeys);

> `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\>

Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/4856a3f52f40cebc5467b639c48c93c09d17622b/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/4dad01e5a92c46a45d83aec7fcaea2d2e541271c/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)

Builds an Encryption instance by decrypting the private key from an encrypted private key and passphrase.

Expand Down
Loading
Loading