Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
99b899a
Escrow cancellation management to Escrow contract
flopez7 May 19, 2025
3f4dce8
Implemented sdk changes for new amount reservation in StoreResults
flopez7 May 19, 2025
a298352
[CVAT] Update cvat api uses (#3348)
zhiltsov-max May 19, 2025
3ac3fbb
[CVAT] Draw roi point along with bbox in skeleton tasks (#3356)
zhiltsov-max May 21, 2025
682132a
Escrow cancellation management to Escrow contract
flopez7 May 19, 2025
941d544
Implemented sdk changes for new amount reservation in StoreResults
flopez7 May 19, 2025
76e79c3
Merge branch 'feat/escrow-cancellation' of https://github.com/humanpr…
flopez7 May 21, 2025
ee21c4d
Fix escrow payouts (#3261)
portuu3 May 21, 2025
6323832
Refactor storeResults function to reserve funds, bulkPayout logic to …
flopez7 May 21, 2025
634a664
Refactor token validation to use PaymentCurrency enum and add support…
flopez7 May 22, 2025
36a82d8
Refactor job creation to move webhook entity creation from fund to se…
flopez7 May 22, 2025
b7ed820
feat: add cancellation refund and requested events handling
flopez7 May 28, 2025
c75a07e
Merge branch 'develop' into feat/escrow-cancellation
flopez7 May 28, 2025
f668924
Add token address retrieval and mock token decimals for fix JobServic…
flopez7 May 28, 2025
71def30
Merge branch 'feat/escrow-cancellation' of https://github.com/humanpr…
flopez7 May 28, 2025
9490cf8
Merge branch 'develop' into feat/escrow-cancellation
flopez7 Jun 9, 2025
ee743ed
add direct cancellation when remaining balance is 0 and fixed some bugs
flopez7 Jun 10, 2025
47f5da5
await escrow cancellation and update condition for funds reservation
flopez7 Jun 16, 2025
890e8aa
Merge branch 'develop' into feat/escrow-cancellation
flopez7 Jun 18, 2025
511f24b
[JobService] Refactor escrow cancellation test to use mocked function…
flopez7 Jun 19, 2025
f549f96
Refactor job cancellation process to fix Abuse flow
flopez7 Jun 23, 2025
4d24f3b
v1 & v2
portuu3 Jul 15, 2025
d5c99b7
escrow v2 tests
portuu3 Jul 17, 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
34 changes: 32 additions & 2 deletions docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,34 @@ Gets the reputation oracle address of the escrow.
)
```

#### get_reserved_funds(escrow_address)

Gets the reserved funds for a specified escrow address.

* **Parameters:**
**escrow_address** (`str`) – Address of the escrow
* **Return type:**
`Decimal`
* **Returns:**
Value of the reserved funds
* **Raises:**
[**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters
* **Example:**
```python
from eth_typing import URI
from web3 import Web3
from web3.providers.auto import load_provider_from_uri

from human_protocol_sdk.escrow import EscrowClient

w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
escrow_client = EscrowClient(w3)

reserved_funds = escrow_client.get_reserved_funds(
"0x62dD51230A30401C455c8398d06F85e4EaB6309f"
)
```

#### get_results_url(escrow_address)

Gets the results file URL.
Expand Down Expand Up @@ -843,14 +871,15 @@ Sets up the parameters of the escrow.
* **Return type:**
`None`

#### store_results(escrow_address, url, hash, tx_options=None)
#### store_results(escrow_address, url, hash, amount, tx_options=None)

Stores the results URL.

* **Parameters:**
* **escrow_address** (`str`) – Address of the escrow
* **url** (`str`) – Results file URL
* **hash** (`str`) – Results file hash
* **amount** (`Decimal`) – Amount to reserve for payouts
* **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters
* **Return type:**
`None`
Expand Down Expand Up @@ -884,7 +913,8 @@ Stores the results URL.
escrow_client.store_results(
"0x62dD51230A30401C455c8398d06F85e4EaB6309f",
"http://localhost/results.json",
"b5dad76bf6772c0f07fd5e048f6e75a5f86ee079"
"b5dad76bf6772c0f07fd5e048f6e75a5f86ee079",
Web3.to_wei(5, 'ether')
)
```

Expand Down
45 changes: 45 additions & 0 deletions docs/sdk/python/human_protocol_sdk.escrow.escrow_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ print(

## Module

### *class* human_protocol_sdk.escrow.escrow_utils.CancellationRefund(id, escrow_address, receiver, amount, block, timestamp, tx_hash)

Bases: `object`

Represents a cancellation refund event.

#### \_\_init_\_(id, escrow_address, receiver, amount, block, timestamp, tx_hash)

### *class* human_protocol_sdk.escrow.escrow_utils.EscrowData(chain_id, id, address, amount_paid, balance, count, factory_address, launcher, status, token, total_funded_amount, created_at, final_results_url=None, intermediate_results_url=None, manifest_hash=None, manifest_url=None, recording_oracle=None, reputation_oracle=None, exchange_oracle=None)

Bases: `object`
Expand Down Expand Up @@ -57,6 +65,43 @@ Bases: `object`

A utility class that provides additional escrow-related functionalities.

#### *static* get_cancellation_refund(chain_id, escrow_address)

Returns the cancellation refund for a given escrow address.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the escrow has been deployed
* **escrow_address** (`str`) – Address of the escrow
* **Return type:**
[`CancellationRefund`](#human_protocol_sdk.escrow.escrow_utils.CancellationRefund)
* **Returns:**
CancellationRefund data or None
* **Raises:**
[**EscrowClientError**](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an unsupported chain ID or invalid address is provided.
* **Example:**
```python
from human_protocol_sdk.constants import ChainId
from human_protocol_sdk.escrow import EscrowUtils

refund = EscrowUtils.get_cancellation_refund(
ChainId.POLYGON_AMOY,
"0x1234567890123456789012345678901234567890"
)
```

#### *static* get_cancellation_refunds(filter)

Fetch cancellation refunds from the subgraph based on the provided filter.

* **Parameters:**
**filter** ([`CancellationRefundFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.CancellationRefundFilter)) – Object containing all the necessary parameters to filter cancellation refunds.
* **Return List[CancellationRefund]:**
List of cancellation refunds matching the query parameters.
* **Raises:**
[**EscrowClientError**](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an unsupported chain ID or invalid addresses are provided.
* **Return type:**
`List`[[`CancellationRefund`](#human_protocol_sdk.escrow.escrow_utils.CancellationRefund)]

#### *static* get_escrow(chain_id, escrow_address)

Returns the escrow for a given address.
Expand Down
5 changes: 5 additions & 0 deletions docs/sdk/python/human_protocol_sdk.escrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ obtain information from both the contracts and subgraph.
* [`EscrowClient.get_manifest_url()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_manifest_url)
* [`EscrowClient.get_recording_oracle_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_recording_oracle_address)
* [`EscrowClient.get_reputation_oracle_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_reputation_oracle_address)
* [`EscrowClient.get_reserved_funds()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_reserved_funds)
* [`EscrowClient.get_results_url()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_results_url)
* [`EscrowClient.get_status()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_status)
* [`EscrowClient.get_token_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_token_address)
Expand All @@ -43,9 +44,13 @@ obtain information from both the contracts and subgraph.
* [human_protocol_sdk.escrow.escrow_utils module](human_protocol_sdk.escrow.escrow_utils.md)
* [Code Example](human_protocol_sdk.escrow.escrow_utils.md#code-example)
* [Module](human_protocol_sdk.escrow.escrow_utils.md#module)
* [`CancellationRefund`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.CancellationRefund)
* [`CancellationRefund.__init__()`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.CancellationRefund.__init__)
* [`EscrowData`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowData)
* [`EscrowData.__init__()`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowData.__init__)
* [`EscrowUtils`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowUtils)
* [`EscrowUtils.get_cancellation_refund()`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowUtils.get_cancellation_refund)
* [`EscrowUtils.get_cancellation_refunds()`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowUtils.get_cancellation_refunds)
* [`EscrowUtils.get_escrow()`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowUtils.get_escrow)
* [`EscrowUtils.get_escrows()`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowUtils.get_escrows)
* [`EscrowUtils.get_payouts()`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowUtils.get_payouts)
Expand Down
26 changes: 26 additions & 0 deletions docs/sdk/python/human_protocol_sdk.filter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# human_protocol_sdk.filter module

### *class* human_protocol_sdk.filter.CancellationRefundFilter(chain_id, escrow_address=None, receiver=None, date_from=None, date_to=None, first=10, skip=0, order_direction=OrderDirection.DESC)

Bases: `object`

A class used to filter cancellation refunds.

#### \_\_init_\_(chain_id, escrow_address=None, receiver=None, date_from=None, date_to=None, first=10, skip=0, order_direction=OrderDirection.DESC)

Initializes a CancellationRefundFilter instance.
:type chain_id: [`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)
:param chain_id: Chain ID to request data
:type escrow_address: `Optional`[`str`]
:param escrow_address: Address of the escrow to filter by
:type receiver: `Optional`[`str`]
:param receiver: Address of the receiver to filter by
:type date_from: `Optional`[`datetime`]
:param date_from: Start date for filtering
:type date_to: `Optional`[`datetime`]
:param date_to: End date for filtering
:type first: `int`
:param first: Number of items per page
:type skip: `int`
:param skip: Number of items to skip (for pagination)
:type order_direction: [`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)
:param order_direction: Order direction of results, “asc” or “desc”

### *class* human_protocol_sdk.filter.EscrowFilter(chain_id, launcher=None, reputation_oracle=None, recording_oracle=None, exchange_oracle=None, job_requester_id=None, status=None, date_from=None, date_to=None, first=10, skip=0, order_direction=OrderDirection.DESC)

Bases: `object`
Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/python/human_protocol_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* [human_protocol_sdk.escrow.escrow_utils module](human_protocol_sdk.escrow.escrow_utils.md)
* [Code Example](human_protocol_sdk.escrow.escrow_utils.md#code-example)
* [Module](human_protocol_sdk.escrow.escrow_utils.md#module)
* [`CancellationRefund`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.CancellationRefund)
* [`EscrowData`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowData)
* [`EscrowUtils`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.EscrowUtils)
* [`Payout`](human_protocol_sdk.escrow.escrow_utils.md#human_protocol_sdk.escrow.escrow_utils.Payout)
Expand Down Expand Up @@ -164,6 +165,8 @@
* [`Status.Partial`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status.Partial)
* [`Status.Pending`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status.Pending)
* [human_protocol_sdk.filter module](human_protocol_sdk.filter.md)
* [`CancellationRefundFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.CancellationRefundFilter)
* [`CancellationRefundFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.CancellationRefundFilter.__init__)
* [`EscrowFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.EscrowFilter)
* [`EscrowFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.EscrowFilter.__init__)
* [`FilterError`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.FilterError)
Expand Down
1 change: 1 addition & 0 deletions docs/sdk/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pip install human-protocol-sdk[agreement]
* [`Role`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Role)
* [`Status`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status)
* [human_protocol_sdk.filter module](human_protocol_sdk.filter.md)
* [`CancellationRefundFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.CancellationRefundFilter)
* [`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)
Expand Down
8 changes: 4 additions & 4 deletions docs/sdk/typescript/base/classes/BaseEthersClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: `abstract` BaseEthersClient

Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)
Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)
Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)
Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/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