Skip to content

Commit 06f37d2

Browse files
authored
Merge pull request #2977 from humanprotocol/develop
Release 2025-01-16
2 parents ae84f93 + a894cbd commit 06f37d2

File tree

620 files changed

+10951
-4542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

620 files changed

+10951
-4542
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Dashboard Check
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
paths:
9+
- 'packages/core/**'
10+
- 'packages/sdk/typescript/human-protocol-sdk/**'
11+
- 'packages/apps/dashboard/**'
12+
workflow_dispatch:
13+
14+
jobs:
15+
dashboard-server-test:
16+
name: Dashboard Server Test
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- run: npm install --global yarn && yarn
21+
name: Install dependencies
22+
- run: yarn workspace @human-protocol/dashboard-server test
23+
name: Run dashboard Server test

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
| | | | |
55
| --- | --- | --- | --- |
66
| [![Lint Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-lint.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-lint.yaml) | [![Protocol Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-core.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-core.yaml) | [![Python SDK Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-python-sdk.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-python-sdk.yaml) | [![Node.js SDK Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-node-sdk.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-node-sdk.yaml) |
7-
| [![Subgraph Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-subgraph.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-subgraph.yaml) | [![Dashboard UI Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-dashboard-ui.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-dashboard-ui.yaml) | [![Faucet Server Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-faucet-server.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-faucet-server.yaml) | [![Contract Deploy](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-deploy-contracts.yaml/badge.svg?event=workflow_dispatch)](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-deploy-contracts.yaml) |
7+
| [![Subgraph Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-subgraph.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-subgraph.yaml) | [![Dashboard Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-dashboard.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-dashboard.yaml) | [![Faucet Server Check](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-faucet-server.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/ci-test-faucet-server.yaml) | [![Contract Deploy](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-deploy-contracts.yaml/badge.svg?event=workflow_dispatch)](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-deploy-contracts.yaml) |
88
| [![Core NPM Publish](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-core.yaml/badge.svg?event=release)](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-core.yaml) | [![Python SDK Publish](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-python-sdk.yaml/badge.svg?event=release)](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-python-sdk.yaml) | [![Node.js SDK Publish](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-node-sdk.yaml/badge.svg?event=release)](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-node-sdk.yaml) | [![Subgraph Deploy](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-subgraph.yaml/badge.svg?branch=main)](https://github.com/humanprotocol/human-protocol/actions/workflows/cd-subgraph.yaml) |
99

1010

@@ -92,4 +92,4 @@ git config blame.markUnblamableLines true
9292
## LEGAL NOTICE
9393

9494
The Protocol is an open-source, blockchain-based network that organizes, evaluates, and compensates human labor (the “Protocol”). Your use of the Protocol is entirely at your own risk. The Protocol is available on an “as is” basis without warranties of any kind, either express or implied, including, but not limited to, warranties of merchantability, title, fitness for a particular purpose and non-infringement. You assume all risks associated with using the Protocol, and digital assets and decentralized systems generally, including but not
95-
limited to, that: (a) digital assets are highly volatile; (b) using digital assets is inherently risky due to both features of such assets and the potential unauthorized acts of third parties; (c) you may not have ready access to digital assets; and (d) you may lose some or all of your tokens or other digital assets. You agree that you will have no recourse against anyone else for any losses due to the use of the Protocol. For example, these losses may arise from or relate to: (i) incorrect information; (ii) software or network failures; (iii) corrupted digital wallet files; (iv) unauthorized access; (v) errors, mistakes, or inaccuracies; or (vi) third-party activities. The Protocol does not collect any personal data, and your interaction with the Protocol will solely be through your public digital wallet address. Any personal or other data that you may make available in connection with the Protocol may not be private or secure.
95+
limited to, that: (a) digital assets are highly volatile; (b) using digital assets is inherently risky due to both features of such assets and the potential unauthorized acts of third parties; (c) you may not have ready access to digital assets; and (d) you may lose some or all of your tokens or other digital assets. You agree that you will have no recourse against anyone else for any losses due to the use of the Protocol. For example, these losses may arise from or relate to: (i) incorrect information; (ii) software or network failures; (iii) corrupted digital wallet files; (iv) unauthorized access; (v) errors, mistakes, or inaccuracies; or (vi) third-party activities. The Protocol does not collect any personal data, and your interaction with the Protocol will solely be through your public digital wallet address. Any personal or other data that you may make available in connection with the Protocol may not be private or secure.

docs/sdk/python/human_protocol_sdk.encryption.encryption.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# human_protocol_sdk.encryption.encryption module
22

3-
This class allows to sign, verify, encrypt and
4-
decrypt messages at all levels of escrow processing.
3+
This class allows signing, verifying, encrypting, and
4+
decrypting messages at all levels of escrow processing.
55

66
The algorithm includes the implementation of the
77
[PGP encryption algorithm]([https://github.com/openpgpjs/openpgpjs](https://github.com/openpgpjs/openpgpjs))
8-
multi-public key encryption on python.
8+
multi-public key encryption in Python.
99
Using the vanilla [ed25519]([https://en.wikipedia.org/wiki/EdDSA#Ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519))
1010
implementation Schnorr signatures for signature and
1111
[curve25519]([https://en.wikipedia.org/wiki/Curve25519](https://en.wikipedia.org/wiki/Curve25519)) for encryption.

docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md

Lines changed: 132 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Represents the result of an escrow cancellation transaction.
6464

6565
Bases: `object`
6666

67-
A class used to manage escrow on the HUMAN network.
67+
A client class to interact with the escrow smart contract.
6868

6969
#### \_\_init_\_(web3)
7070

@@ -127,7 +127,7 @@ Pays out the amounts specified to the workers and sets the URL of the final resu
127127
* **escrow_address** (`str`) – Address of the escrow
128128
* **recipients** (`List`[`str`]) – Array of recipient addresses
129129
* **amounts** (`List`[`Decimal`]) – Array of amounts the recipients will receive
130-
* **final_results_url** (`str`) – Final results file url
130+
* **final_results_url** (`str`) – Final results file URL
131131
* **final_results_hash** (`str`) – Final results file hash
132132
* **txId** (`Decimal`) – Serial number of the bulks
133133
* **force_complete** (`Optional`[`bool`]) – (Optional) Indicates if remaining balance should be transferred to the escrow creator
@@ -263,19 +263,22 @@ Sets the status of an escrow to completed.
263263
escrow_client.complete("0x62dD51230A30401C455c8398d06F85e4EaB6309f")
264264
```
265265

266-
#### create_escrow(token_address, trusted_handlers, job_requester_id, tx_options=None)
266+
#### create_bulk_payout_transaction(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, force_complete=False, tx_options=None)
267267

268-
Creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
268+
Creates a prepared transaction for bulk payout without signing or sending it.
269269

270270
* **Parameters:**
271-
* **tokenAddress** – The address of the token to use for payouts
272-
* **trusted_handlers** (`List`[`str`]) – Array of addresses that can perform actions on the contract
273-
* **job_requester_id** (`str`) – The id of the job requester
271+
* **escrow_address** (`str`) – Address of the escrow
272+
* **recipients** (`List`[`str`]) – Array of recipient addresses
273+
* **amounts** (`List`[`Decimal`]) – Array of amounts the recipients will receive
274+
* **final_results_url** (`str`) – Final results file URL
275+
* **final_results_hash** (`str`) – Final results file hash
276+
* **txId** (`Decimal`) – Serial number of the bulks
274277
* **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters
275278
* **Return type:**
276-
`str`
279+
`TxParams`
277280
* **Returns:**
278-
The address of the escrow created
281+
A dictionary containing the prepared transaction
279282
* **Raises:**
280283
[**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters
281284
* **Example:**
@@ -300,10 +303,80 @@ Creates an escrow contract that uses the token passed to pay oracle fees and rew
300303
(w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY')
301304
escrow_client = EscrowClient(w3)
302305

303-
token_address = '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4'
304-
trusted_handlers = [
306+
recipients = [
305307
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
306-
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
308+
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92267'
309+
]
310+
amounts = [
311+
Web3.to_wei(5, 'ether'),
312+
Web3.to_wei(10, 'ether')
313+
]
314+
results_url = 'http://localhost/results.json'
315+
results_hash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079'
316+
317+
transaction = escrow_client.create_bulk_payout_transaction(
318+
"0x62dD51230A30401C455c8398d06F85e4EaB6309f",
319+
recipients,
320+
amounts,
321+
results_url,
322+
results_hash,
323+
1,
324+
false
325+
)
326+
327+
print(f"Transaction: {transaction}")
328+
329+
signed_transaction = w3.eth.account.sign_transaction(
330+
transaction, private_key
331+
)
332+
tx_hash = w3.eth.send_raw_transaction(
333+
signed_transaction.raw_transaction
334+
)
335+
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
336+
print(f"Transaction sent with hash: {tx_hash.hex()}")
337+
print(f"Transaction receipt: {tx_receipt}")
338+
```
339+
340+
#### create_escrow(token_address, trusted_handlers, job_requester_id, tx_options=None)
341+
342+
Creates a new escrow contract.
343+
344+
* **Parameters:**
345+
* **token_address** (`str`) – Address of the token to be used in the escrow
346+
* **trusted_handlers** (`List`[`str`]) – List of trusted handler addresses
347+
* **job_requester_id** (`str`) – ID of the job requester
348+
* **tx_options** (`Optional`[`TxParams`]) – (Optional) Transaction options
349+
* **Return type:**
350+
`str`
351+
* **Returns:**
352+
Address of the created escrow contract
353+
* **Example:**
354+
```python
355+
from eth_typing import URI
356+
from web3 import Web3
357+
from web3.middleware import construct_sign_and_send_raw_middleware
358+
from web3.providers.auto import load_provider_from_uri
359+
360+
from human_protocol_sdk.escrow import EscrowClient
361+
362+
def get_w3_with_priv_key(priv_key: str):
363+
w3 = Web3(load_provider_from_uri(
364+
URI("http://localhost:8545")))
365+
gas_payer = w3.eth.account.from_key(priv_key)
366+
w3.eth.default_account = gas_payer.address
367+
w3.middleware_onion.add(
368+
construct_sign_and_send_raw_middleware(gas_payer),
369+
"construct_sign_and_send_raw_middleware",
370+
)
371+
return (w3, gas_payer)
372+
373+
(w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY')
374+
escrow_client = EscrowClient(w3)
375+
376+
token_address = '0x1234567890abcdef1234567890abcdef12345678'
377+
trusted_handlers = [
378+
'0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef',
379+
'0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef'
307380
]
308381
job_requester_id = 'job-requester'
309382
escrow_address = escrow_client.create_escrow(
@@ -313,12 +386,29 @@ Creates an escrow contract that uses the token passed to pay oracle fees and rew
313386
)
314387
```
315388

389+
#### ensure_correct_bulk_payout_input(escrow_address, recipients, amounts, final_results_url, final_results_hash)
390+
391+
Validates input parameters for bulk payout operations.
392+
393+
* **Parameters:**
394+
* **escrow_address** (`str`) – Address of the escrow
395+
* **recipients** (`List`[`str`]) – Array of recipient addresses
396+
* **amounts** (`List`[`Decimal`]) – Array of amounts the recipients will receive
397+
* **final_results_url** (`str`) – Final results file URL
398+
* **final_results_hash** (`str`) – Final results file hash
399+
* **Return type:**
400+
`None`
401+
* **Returns:**
402+
None
403+
* **Raises:**
404+
[**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If validation fails
405+
316406
#### fund(escrow_address, amount, tx_options=None)
317407

318408
Adds funds to the escrow.
319409

320410
* **Parameters:**
321-
* **escrow_address** (`str`) – Address of the escrow to setup
411+
* **escrow_address** (`str`) – Address of the escrow to fund
322412
* **amount** (`Decimal`) – Amount to be added as funds
323413
* **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters
324414
* **Return type:**
@@ -349,8 +439,10 @@ Adds funds to the escrow.
349439
(w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY')
350440
escrow_client = EscrowClient(w3)
351441

352-
amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI
353-
escrow_client.fund("0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount)
442+
amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI
443+
escrow_client.fund(
444+
"0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount
445+
)
354446
```
355447

356448
#### get_balance(escrow_address)
@@ -694,15 +786,9 @@ Gets the address of the token used to fund the escrow.
694786
Sets up the parameters of the escrow.
695787

696788
* **Parameters:**
697-
* **escrow_address** (`str`) – Address of the escrow to setup
698-
* **escrow_config** ([`EscrowConfig`](#human_protocol_sdk.escrow.escrow_client.EscrowConfig)) – Object containing all the necessary information to setup an escrow
699-
* **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters
700-
* **Return type:**
701-
`None`
702-
* **Returns:**
703-
None
704-
* **Raises:**
705-
[**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters
789+
* **escrow_address** (`str`) – Address of the escrow contract
790+
* **escrow_config** ([`EscrowConfig`](#human_protocol_sdk.escrow.escrow_client.EscrowConfig)) – Configuration parameters for the escrow
791+
* **tx_options** (`Optional`[`TxParams`]) – (Optional) Transaction options
706792
* **Example:**
707793
```python
708794
from eth_typing import URI
@@ -713,7 +799,8 @@ Sets up the parameters of the escrow.
713799
from human_protocol_sdk.escrow import EscrowClient
714800

715801
def get_w3_with_priv_key(priv_key: str):
716-
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
802+
w3 = Web3(load_provider_from_uri(
803+
URI("http://localhost:8545")))
717804
gas_payer = w3.eth.account.from_key(priv_key)
718805
w3.eth.default_account = gas_payer.address
719806
w3.middleware_onion.add(
@@ -725,27 +812,35 @@ Sets up the parameters of the escrow.
725812
(w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY')
726813
escrow_client = EscrowClient(w3)
727814

728-
escrow_address = "0x62dD51230A30401C455c8398d06F85e4EaB6309f"
815+
escrow_address = "0x1234567890abcdef1234567890abcdef12345678"
729816
escrow_config = EscrowConfig(
730-
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
731-
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
732-
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
733-
10,
734-
10,
735-
10,
736-
"htttp://localhost/manifest.json",
737-
"b5dad76bf6772c0f07fd5e048f6e75a5f86ee079",
817+
recording_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef',
818+
reputation_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef',
819+
exchange_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef',
820+
recording_oracle_fee=100,
821+
reputation_oracle_fee=100,
822+
exchange_oracle_fee=100,
823+
recording_oracle_url='https://example.com/recording',
824+
reputation_oracle_url='https://example.com/reputation',
825+
exchange_oracle_url='https://example.com/exchange',
826+
manifest_url='https://example.com/manifest',
827+
manifest_hash='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef'
828+
)
829+
escrow_client.setup(
830+
escrow_address,
831+
escrow_config
738832
)
739-
escrow_client.setup(escrow_address, escrow_config)
740833
```
834+
* **Return type:**
835+
`None`
741836

742837
#### store_results(escrow_address, url, hash, tx_options=None)
743838

744-
Stores the results url.
839+
Stores the results URL.
745840

746841
* **Parameters:**
747842
* **escrow_address** (`str`) – Address of the escrow
748-
* **url** (`str`) – Results file url
843+
* **url** (`str`) – Results file URL
749844
* **hash** (`str`) – Results file hash
750845
* **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters
751846
* **Return type:**

docs/sdk/python/human_protocol_sdk.escrow.escrow_utils.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Utility class for escrow-related operations.
66

77
```python
88
from human_protocol_sdk.constants import ChainId
9-
from human_protocol_sdk.escrow import EscrowUtils, EscorwFilter, Status
9+
from human_protocol_sdk.escrow import EscrowUtils, EscrowFilter, Status
1010

1111
print(
1212
EscrowUtils.get_escrows(
@@ -133,7 +133,7 @@ Retrieve status events for specified networks and statuses within a date range.
133133

134134
print(
135135
EscrowUtils.get_status_events(
136-
networks=[ChainId.POLYGON_AMOY, ChainId.ETHEREUM],
136+
chain_id=ChainId.POLYGON_AMOY,
137137
statuses=[Status.Pending, Status.Paid],
138138
date_from=datetime(2023, 1, 1),
139139
date_to=datetime(2023, 12, 31),

docs/sdk/python/human_protocol_sdk.escrow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ obtain information from both the contracts and subgraph.
1616
* [`EscrowClient.bulk_payout()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.bulk_payout)
1717
* [`EscrowClient.cancel()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.cancel)
1818
* [`EscrowClient.complete()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.complete)
19+
* [`EscrowClient.create_bulk_payout_transaction()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.create_bulk_payout_transaction)
1920
* [`EscrowClient.create_escrow()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.create_escrow)
21+
* [`EscrowClient.ensure_correct_bulk_payout_input()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.ensure_correct_bulk_payout_input)
2022
* [`EscrowClient.fund()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.fund)
2123
* [`EscrowClient.get_balance()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_balance)
2224
* [`EscrowClient.get_exchange_oracle_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_exchange_oracle_address)

0 commit comments

Comments
 (0)