Skip to content

Commit 3258706

Browse files
authored
Merge pull request #2331 from humanprotocol/develop
Release 20240813
2 parents d55c909 + d0f1eb2 commit 3258706

File tree

366 files changed

+6517
-3827
lines changed

Some content is hidden

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

366 files changed

+6517
-3827
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,34 @@ Extracts the signed data from an armored signed message.
152152
result = EncryptionUtils.get_signed_data(signed_message)
153153
```
154154

155+
#### *static* is_encrypted(message)
156+
157+
Checks whether a provided message is encrypted or not
158+
159+
* **Parameters:**
160+
**message** (`str`) – Text to check
161+
* **Return type:**
162+
`bool`
163+
* **Returns:**
164+
True if the message is a PGP message, False otherwise
165+
* **Example:**
166+
```python
167+
from human_protocol_sdk.encryption import EncryptionUtils
168+
169+
message_1 = "message"
170+
message_2 = """-----BEGIN PGP MESSAGE-----
171+
172+
wV4Dh8BoKHkyM3YSAQdAMGVFo+Meahw422JdMyDkxPA4LXeN94bOqsS9OhYGliYw
173+
72HgGdhoRHrRBKmRyD+Bb2HUrGptx8YRYqYJXiFVs4ev1USt6pF/5XjH+pM0d44B
174+
0j0BcVevrVhjdBia8kEr74NJKB2qiPAffbFJFRE1asYqQgFTjNC60/egqfzpdRay
175+
Tj8C+e0IXRMECIXnrOaw
176+
=SjJh
177+
-----END PGP MESSAGE-----"""
178+
179+
print("The message_1 is encrypted: ", EncryptionUtils.is_encrypted(message_1))
180+
print("The message_2 is encrypted: ", EncryptionUtils.is_encrypted(message_2))
181+
```
182+
155183
#### *static* verify(message, public_key)
156184

157185
Verifies the signature of a message using the corresponding public key.

docs/sdk/python/human_protocol_sdk.encryption.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ Encryption utility to encrypt/decrypt and sign/verify messages and secure protoc
1818
* [`EncryptionUtils`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils)
1919
* [`EncryptionUtils.encrypt()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.encrypt)
2020
* [`EncryptionUtils.get_signed_data()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.get_signed_data)
21+
* [`EncryptionUtils.is_encrypted()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.is_encrypted)
2122
* [`EncryptionUtils.verify()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.verify)

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ print(
2222

2323
## Module
2424

25-
### *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, recording_oracle_fee=None, reputation_oracle=None, reputation_oracle_fee=None, exchange_oracle=None, exchange_oracle_fee=None)
25+
### *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)
2626

2727
Bases: `object`
2828

29-
#### \_\_init_\_(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, recording_oracle_fee=None, reputation_oracle=None, reputation_oracle_fee=None, exchange_oracle=None, exchange_oracle_fee=None)
29+
#### \_\_init_\_(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)
3030

3131
Initializes an EscrowData instance.
3232

@@ -48,11 +48,8 @@ Initializes an EscrowData instance.
4848
* **manifest_hash** (`Optional`[`str`]) – Manifest hash.
4949
* **manifest_url** (`Optional`[`str`]) – Manifest URL.
5050
* **recording_oracle** (`Optional`[`str`]) – Recording Oracle address.
51-
* **recording_oracle_fee** (`Optional`[`int`]) – Recording Oracle fee.
5251
* **reputation_oracle** (`Optional`[`str`]) – Reputation Oracle address.
53-
* **reputation_oracle_fee** (`Optional`[`int`]) – Reputation Oracle fee.
5452
* **exchange_oracle** (`Optional`[`str`]) – Exchange Oracle address.
55-
* **exchange_oracle_fee** (`Optional`[`int`]) – Exchange Oracle fee.
5653

5754
### *class* human_protocol_sdk.escrow.escrow_utils.EscrowUtils
5855

docs/sdk/python/human_protocol_sdk.filter.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@ Initializes a PayoutFilter instance.
4646
* **date_from** (`Optional`[`datetime`]) – Created from date
4747
* **date_to** (`Optional`[`datetime`]) – Created to date
4848

49+
### *class* human_protocol_sdk.filter.StatisticsFilter(date_from=None, date_to=None, first=10, skip=0, order_direction=OrderDirection.ASC)
50+
51+
Bases: `object`
52+
53+
A class used to filter statistics requests.
54+
55+
#### \_\_init_\_(date_from=None, date_to=None, first=10, skip=0, order_direction=OrderDirection.ASC)
56+
57+
Initializes a StatisticsFilter instance.
58+
59+
* **Parameters:**
60+
* **date_from** (`Optional`[`datetime`]) – Created from date
61+
* **date_to** (`Optional`[`datetime`]) – Created to date
62+
* **first** (`int`) – Number of items per page
63+
* **skip** (`int`) – Page number to retrieve
64+
* **order_direction** ([`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)) – Order of results, “asc” or “desc”
65+
4966
### *class* human_protocol_sdk.filter.TransactionFilter(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, first=10, skip=0, order_direction=OrderDirection.DESC)
5067

5168
Bases: `object`

docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -61,88 +61,6 @@ Initializes a KVStore instance.
6161
* **Parameters:**
6262
**web3** (`Web3`) – The Web3 object
6363

64-
#### get(address, key)
65-
66-
Gets the value of a key-value pair in the contract.
67-
68-
* **Parameters:**
69-
* **address** (`str`) – The Ethereum address associated with the key-value pair
70-
* **key** (`str`) – The key of the key-value pair to get
71-
* **Return type:**
72-
`str`
73-
* **Returns:**
74-
The value of the key-value pair if it exists
75-
* **Example:**
76-
```python
77-
from eth_typing import URI
78-
from web3 import Web3
79-
from web3.providers.auto import load_provider_from_uri
80-
81-
from human_protocol_sdk.kvstore import KVStoreClient
82-
83-
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
84-
kvstore_client = KVStoreClient(w3)
85-
86-
role = kvstore_client.get('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'Role')
87-
```
88-
89-
#### get_file_url_and_verify_hash(address, key='url')
90-
91-
Gets the URL value of the given entity, and verify its hash.
92-
93-
* **Parameters:**
94-
* **address** (`str`) – Address from which to get the URL value.
95-
* **key** (`Optional`[`str`]) – Configurable URL key. url by default.
96-
* **Return url:**
97-
The URL value of the given address if exists, and the content is valid
98-
* **Example:**
99-
```python
100-
from eth_typing import URI
101-
from web3 import Web3
102-
from web3.providers.auto import load_provider_from_uri
103-
104-
from human_protocol_sdk.kvstore import KVStoreClient
105-
106-
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
107-
kvstore_client = KVStoreClient(w3)
108-
109-
url = kvstore_client.get_file_url_and_verify_hash(
110-
'0x62dD51230A30401C455c8398d06F85e4EaB6309f'
111-
)
112-
linkedin_url = kvstore_client.get_file_url_and_verify_hash(
113-
'0x62dD51230A30401C455c8398d06F85e4EaB6309f',
114-
'linkedin_url'
115-
)
116-
```
117-
* **Return type:**
118-
`str`
119-
120-
#### get_public_key(address)
121-
122-
Gets the public key of the given entity, and verify its hash.
123-
124-
* **Parameters:**
125-
**address** (`str`) – Address from which to get the public key.
126-
* **Return public_key:**
127-
The public key of the given address if exists, and the content is valid
128-
* **Example:**
129-
```python
130-
from eth_typing import URI
131-
from web3 import Web3
132-
from web3.providers.auto import load_provider_from_uri
133-
134-
from human_protocol_sdk.kvstore import KVStoreClient
135-
136-
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
137-
kvstore_client = KVStoreClient(w3)
138-
139-
public_key = kvstore_client.get_public_key(
140-
'0x62dD51230A30401C455c8398d06F85e4EaB6309f'
141-
)
142-
```
143-
* **Return type:**
144-
`str`
145-
14664
#### set(key, value, tx_options=None)
14765

14866
Sets the value of a key-value pair in the contract.

docs/sdk/python/human_protocol_sdk.kvstore.kvstore_utils.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,55 @@ Bases: `object`
3636

3737
A utility class that provides additional KVStore-related functionalities.
3838

39+
#### *static* get(chain_id, address, key)
40+
41+
Gets the value of a key-value pair in the contract.
42+
43+
* **Parameters:**
44+
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the KVStore data has been deployed
45+
* **address** (`str`) – The Ethereum address associated with the key-value pair
46+
* **key** (`str`) – The key of the key-value pair to get
47+
* **Return type:**
48+
`str`
49+
* **Returns:**
50+
The value of the key-value pair if it exists
51+
* **Example:**
52+
```python
53+
from human_protocol_sdk.constants import ChainId
54+
from human_protocol_sdk.kvstore import KVStoreUtils
55+
56+
chain_id = ChainId.POLYGON_AMOY
57+
address = '0x62dD51230A30401C455c8398d06F85e4EaB6309f'
58+
key = 'role'
59+
60+
result = KVStoreUtils.get(chain_id, address, key)
61+
print(result)
62+
```
63+
64+
#### *static* get_file_url_and_verify_hash(chain_id, address, key='url')
65+
66+
Gets the URL value of the given entity, and verify its hash.
67+
68+
* **Parameters:**
69+
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the KVStore data has been deployed
70+
* **address** (`str`) – Address from which to get the URL value.
71+
* **key** (`Optional`[`str`]) – Configurable URL key. url by default.
72+
* **Return url:**
73+
The URL value of the given address if exists, and the content is valid
74+
* **Example:**
75+
```python
76+
from human_protocol_sdk.constants import ChainId
77+
from human_protocol_sdk.kvstore import KVStoreUtils
78+
79+
chain_id = ChainId.POLYGON_AMOY
80+
address = '0x62dD51230A30401C455c8398d06F85e4EaB6309f'
81+
82+
url = KVStoreUtils.get_file_url_and_verify_hash(chain_id, address)
83+
linkedin_url = KVStoreUtils.get_file_url_and_verify_hash(chain_id, address, 'linkedin_url')
84+
```
85+
* **Return type:**
86+
`str`
87+
3988
#### *static* get_kvstore_data(chain_id, address)
4089

4190
Returns the KVStore data for a given address.
@@ -59,3 +108,25 @@ Returns the KVStore data for a given address.
59108
)
60109
)
61110
```
111+
112+
#### *static* get_public_key(chain_id, address)
113+
114+
Gets the public key of the given entity, and verify its hash.
115+
116+
* **Parameters:**
117+
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the KVStore data has been deployed
118+
* **address** (`str`) – Address from which to get the public key.
119+
* **Return public_key:**
120+
The public key of the given address if exists, and the content is valid
121+
* **Example:**
122+
```python
123+
from human_protocol_sdk.constants import ChainId
124+
from human_protocol_sdk.kvstore import KVStoreUtils
125+
126+
chain_id = ChainId.POLYGON_AMOY
127+
address = '0x62dD51230A30401C455c8398d06F85e4EaB6309f'
128+
129+
public_key = KVStoreUtils.get_public_key(chain_id, address)
130+
```
131+
* **Return type:**
132+
`str`

docs/sdk/python/human_protocol_sdk.kvstore.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ This module allows the contract interaction with the key value storage on chain.
99
* [Module](human_protocol_sdk.kvstore.kvstore_client.md#module)
1010
* [`KVStoreClient`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient)
1111
* [`KVStoreClient.__init__()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.__init__)
12-
* [`KVStoreClient.get()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.get)
13-
* [`KVStoreClient.get_file_url_and_verify_hash()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.get_file_url_and_verify_hash)
14-
* [`KVStoreClient.get_public_key()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.get_public_key)
1512
* [`KVStoreClient.set()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.set)
1613
* [`KVStoreClient.set_bulk()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.set_bulk)
1714
* [`KVStoreClient.set_file_url_and_hash()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.set_file_url_and_hash)

docs/sdk/python/human_protocol_sdk.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
* [`PaymentStatistics`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.PaymentStatistics)
8989
* [`StatisticsClient`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient)
9090
* [`StatisticsClientError`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClientError)
91-
* [`StatisticsParam`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsParam)
9291
* [`WorkerStatistics`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.WorkerStatistics)
9392
* [human_protocol_sdk.storage package](human_protocol_sdk.storage.md)
9493
* [Submodules](human_protocol_sdk.storage.md#submodules)
@@ -153,6 +152,8 @@
153152
* [`FilterError`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.FilterError)
154153
* [`PayoutFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.PayoutFilter)
155154
* [`PayoutFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.PayoutFilter.__init__)
155+
* [`StatisticsFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatisticsFilter)
156+
* [`StatisticsFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatisticsFilter.__init__)
156157
* [`TransactionFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter)
157158
* [`TransactionFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter.__init__)
158159
* [human_protocol_sdk.legacy_encryption module](human_protocol_sdk.legacy_encryption.md)

docs/sdk/python/human_protocol_sdk.operator.operator_utils.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ print(
1717

1818
## Module
1919

20-
### *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)
20+
### *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_processed, role=None, fee=None, public_key=None, webhook_url=None, url=None, job_types=None)
2121

2222
Bases: `object`
2323

24-
#### \_\_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)
24+
#### \_\_init_\_(chain_id, id, address, amount_staked, amount_allocated, amount_locked, locked_until_timestamp, amount_withdrawn, amount_slashed, reputation, reward, amount_jobs_processed, role=None, fee=None, public_key=None, webhook_url=None, url=None, job_types=None)
2525

2626
Initializes an LeaderData instance.
2727

@@ -37,7 +37,7 @@ Initializes an LeaderData instance.
3737
* **amount_slashed** (`int`) – Amount slashed
3838
* **reputation** (`int`) – Reputation
3939
* **reward** (`int`) – Reward
40-
* **amount_jobs_launched** (`int`) – Amount of jobs launched
40+
* **amount_jobs_processed** (`int`) – Amount of jobs launched
4141
* **role** (`Optional`[`str`]) – Role
4242
* **fee** (`Optional`[`int`]) – Fee
4343
* **public_key** (`Optional`[`str`]) – Public key

docs/sdk/python/human_protocol_sdk.statistics.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ This module allows to read statistical data from the subgraph.
2828
* [`StatisticsClient`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient)
2929
* [`StatisticsClient.__init__()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient.__init__)
3030
* [`StatisticsClient.get_escrow_statistics()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient.get_escrow_statistics)
31+
* [`StatisticsClient.get_hmt_daily_data()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient.get_hmt_daily_data)
3132
* [`StatisticsClient.get_hmt_holders()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient.get_hmt_holders)
3233
* [`StatisticsClient.get_hmt_statistics()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient.get_hmt_statistics)
3334
* [`StatisticsClient.get_payment_statistics()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient.get_payment_statistics)
3435
* [`StatisticsClient.get_worker_statistics()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient.get_worker_statistics)
3536
* [`StatisticsClientError`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClientError)
36-
* [`StatisticsParam`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsParam)
37-
* [`StatisticsParam.__init__()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsParam.__init__)
3837
* [`WorkerStatistics`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.WorkerStatistics)
3938
* [`WorkerStatistics.__init__()`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.WorkerStatistics.__init__)

0 commit comments

Comments
 (0)