Skip to content

Commit

Permalink
Merge remote-tracking branch 'human-protocol/develop' into dashboard-…
Browse files Browse the repository at this point in the history
…release
  • Loading branch information
KacperKoza343 committed Aug 29, 2024
2 parents c86f9a4 + cb33295 commit 026ba92
Show file tree
Hide file tree
Showing 577 changed files with 10,667 additions and 7,452 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci-lint-cvat-exchange-oracle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CVAT Exchange Oracle Lint

on:
push:
paths:
- 'packages/examples/cvat/exchange-oracle/**'
- '.github/workflows/ci-lint-cvat-exchange-oracle.yaml'

env:
WORKING_DIR: ./packages/examples/cvat/exchange-oracle

defaults:
run:
working-directory: ./packages/examples/cvat/exchange-oracle

jobs:
cvat-exo-lint:
name: CVAT Exchange Oracle Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: ${{ env.WORKING_DIR }}/poetry.lock
- run: python -m pip install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'
cache-dependency-path: ${{ env.WORKING_DIR }}/poetry.lock
- run: poetry install --no-root --only dev
- run: poetry run pre-commit run --all-files
33 changes: 33 additions & 0 deletions .github/workflows/ci-lint-cvat-recording-oracle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CVAT Recording Oracle Lint

on:
push:
paths:
- 'packages/examples/cvat/recording-oracle/**'
- '.github/workflows/ci-lint-cvat-recording-oracle.yaml'

env:
WORKING_DIR: ./packages/examples/cvat/recording-oracle

defaults:
run:
working-directory: ./packages/examples/cvat/recording-oracle

jobs:
cvat-exo-lint:
name: CVAT Recording Oracle Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: ${{ env.WORKING_DIR }}/poetry.lock
- run: python -m pip install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'poetry'
cache-dependency-path: ${{ env.WORKING_DIR }}/poetry.lock
- run: poetry install --no-root --only lint
- run: poetry run pre-commit run --all-files
2 changes: 2 additions & 0 deletions docs/sdk/python/human_protocol_sdk.constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Enum for KVStore keys

#### public_key *= 'public_key'*

#### registration_needed *= 'registration_needed'*

#### role *= 'role'*

#### url *= 'url'*
Expand Down
28 changes: 28 additions & 0 deletions docs/sdk/python/human_protocol_sdk.encryption.encryption_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,34 @@ Extracts the signed data from an armored signed message.
result = EncryptionUtils.get_signed_data(signed_message)
```

#### *static* is_encrypted(message)

Checks whether a provided message is encrypted or not

* **Parameters:**
**message** (`str`) – Text to check
* **Return type:**
`bool`
* **Returns:**
True if the message is a PGP message, False otherwise
* **Example:**
```python
from human_protocol_sdk.encryption import EncryptionUtils

message_1 = "message"
message_2 = """-----BEGIN PGP MESSAGE-----
wV4Dh8BoKHkyM3YSAQdAMGVFo+Meahw422JdMyDkxPA4LXeN94bOqsS9OhYGliYw
72HgGdhoRHrRBKmRyD+Bb2HUrGptx8YRYqYJXiFVs4ev1USt6pF/5XjH+pM0d44B
0j0BcVevrVhjdBia8kEr74NJKB2qiPAffbFJFRE1asYqQgFTjNC60/egqfzpdRay
Tj8C+e0IXRMECIXnrOaw
=SjJh
-----END PGP MESSAGE-----"""

print("The message_1 is encrypted: ", EncryptionUtils.is_encrypted(message_1))
print("The message_2 is encrypted: ", EncryptionUtils.is_encrypted(message_2))
```

#### *static* verify(message, public_key)

Verifies the signature of a message using the corresponding public key.
Expand Down
1 change: 1 addition & 0 deletions docs/sdk/python/human_protocol_sdk.encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ Encryption utility to encrypt/decrypt and sign/verify messages and secure protoc
* [`EncryptionUtils`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils)
* [`EncryptionUtils.encrypt()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.encrypt)
* [`EncryptionUtils.get_signed_data()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.get_signed_data)
* [`EncryptionUtils.is_encrypted()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.is_encrypted)
* [`EncryptionUtils.verify()`](human_protocol_sdk.encryption.encryption_utils.md#human_protocol_sdk.encryption.encryption_utils.EncryptionUtils.verify)
7 changes: 2 additions & 5 deletions docs/sdk/python/human_protocol_sdk.escrow.escrow_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ print(

## Module

### *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)
### *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`

#### \_\_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)
#### \_\_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)

Initializes an EscrowData instance.

Expand All @@ -48,11 +48,8 @@ Initializes an EscrowData instance.
* **manifest_hash** (`Optional`[`str`]) – Manifest hash.
* **manifest_url** (`Optional`[`str`]) – Manifest URL.
* **recording_oracle** (`Optional`[`str`]) – Recording Oracle address.
* **recording_oracle_fee** (`Optional`[`int`]) – Recording Oracle fee.
* **reputation_oracle** (`Optional`[`str`]) – Reputation Oracle address.
* **reputation_oracle_fee** (`Optional`[`int`]) – Reputation Oracle fee.
* **exchange_oracle** (`Optional`[`str`]) – Exchange Oracle address.
* **exchange_oracle_fee** (`Optional`[`int`]) – Exchange Oracle fee.

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

Expand Down
17 changes: 17 additions & 0 deletions docs/sdk/python/human_protocol_sdk.filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ Initializes a PayoutFilter instance.
* **date_from** (`Optional`[`datetime`]) – Created from date
* **date_to** (`Optional`[`datetime`]) – Created to date

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

Bases: `object`

A class used to filter statistics requests.

#### \_\_init_\_(date_from=None, date_to=None, first=10, skip=0, order_direction=OrderDirection.ASC)

Initializes a StatisticsFilter instance.

* **Parameters:**
* **date_from** (`Optional`[`datetime`]) – Created from date
* **date_to** (`Optional`[`datetime`]) – Created to date
* **first** (`int`) – Number of items per page
* **skip** (`int`) – Page number to retrieve
* **order_direction** ([`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)) – Order of results, “asc” or “desc”

### *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)

Bases: `object`
Expand Down
82 changes: 0 additions & 82 deletions docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,88 +61,6 @@ Initializes a KVStore instance.
* **Parameters:**
**web3** (`Web3`) – The Web3 object

#### get(address, key)

Gets the value of a key-value pair in the contract.

* **Parameters:**
* **address** (`str`) – The Ethereum address associated with the key-value pair
* **key** (`str`) – The key of the key-value pair to get
* **Return type:**
`str`
* **Returns:**
The value of the key-value pair if it exists
* **Example:**
```python
from eth_typing import URI
from web3 import Web3
from web3.providers.auto import load_provider_from_uri

from human_protocol_sdk.kvstore import KVStoreClient

w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
kvstore_client = KVStoreClient(w3)

role = kvstore_client.get('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'Role')
```

#### get_file_url_and_verify_hash(address, key='url')

Gets the URL value of the given entity, and verify its hash.

* **Parameters:**
* **address** (`str`) – Address from which to get the URL value.
* **key** (`Optional`[`str`]) – Configurable URL key. url by default.
* **Return url:**
The URL value of the given address if exists, and the content is valid
* **Example:**
```python
from eth_typing import URI
from web3 import Web3
from web3.providers.auto import load_provider_from_uri

from human_protocol_sdk.kvstore import KVStoreClient

w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
kvstore_client = KVStoreClient(w3)

url = kvstore_client.get_file_url_and_verify_hash(
'0x62dD51230A30401C455c8398d06F85e4EaB6309f'
)
linkedin_url = kvstore_client.get_file_url_and_verify_hash(
'0x62dD51230A30401C455c8398d06F85e4EaB6309f',
'linkedin_url'
)
```
* **Return type:**
`str`

#### get_public_key(address)

Gets the public key of the given entity, and verify its hash.

* **Parameters:**
**address** (`str`) – Address from which to get the public key.
* **Return public_key:**
The public key of the given address if exists, and the content is valid
* **Example:**
```python
from eth_typing import URI
from web3 import Web3
from web3.providers.auto import load_provider_from_uri

from human_protocol_sdk.kvstore import KVStoreClient

w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
kvstore_client = KVStoreClient(w3)

public_key = kvstore_client.get_public_key(
'0x62dD51230A30401C455c8398d06F85e4EaB6309f'
)
```
* **Return type:**
`str`

#### set(key, value, tx_options=None)

Sets the value of a key-value pair in the contract.
Expand Down
71 changes: 71 additions & 0 deletions docs/sdk/python/human_protocol_sdk.kvstore.kvstore_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,55 @@ Bases: `object`

A utility class that provides additional KVStore-related functionalities.

#### *static* get(chain_id, address, key)

Gets the value of a key-value pair in the contract.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the KVStore data has been deployed
* **address** (`str`) – The Ethereum address associated with the key-value pair
* **key** (`str`) – The key of the key-value pair to get
* **Return type:**
`str`
* **Returns:**
The value of the key-value pair if it exists
* **Example:**
```python
from human_protocol_sdk.constants import ChainId
from human_protocol_sdk.kvstore import KVStoreUtils

chain_id = ChainId.POLYGON_AMOY
address = '0x62dD51230A30401C455c8398d06F85e4EaB6309f'
key = 'role'

result = KVStoreUtils.get(chain_id, address, key)
print(result)
```

#### *static* get_file_url_and_verify_hash(chain_id, address, key='url')

Gets the URL value of the given entity, and verify its hash.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the KVStore data has been deployed
* **address** (`str`) – Address from which to get the URL value.
* **key** (`Optional`[`str`]) – Configurable URL key. url by default.
* **Return url:**
The URL value of the given address if exists, and the content is valid
* **Example:**
```python
from human_protocol_sdk.constants import ChainId
from human_protocol_sdk.kvstore import KVStoreUtils

chain_id = ChainId.POLYGON_AMOY
address = '0x62dD51230A30401C455c8398d06F85e4EaB6309f'

url = KVStoreUtils.get_file_url_and_verify_hash(chain_id, address)
linkedin_url = KVStoreUtils.get_file_url_and_verify_hash(chain_id, address, 'linkedin_url')
```
* **Return type:**
`str`

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

Returns the KVStore data for a given address.
Expand All @@ -59,3 +108,25 @@ Returns the KVStore data for a given address.
)
)
```

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

Gets the public key of the given entity, and verify its hash.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the KVStore data has been deployed
* **address** (`str`) – Address from which to get the public key.
* **Return public_key:**
The public key of the given address if exists, and the content is valid
* **Example:**
```python
from human_protocol_sdk.constants import ChainId
from human_protocol_sdk.kvstore import KVStoreUtils

chain_id = ChainId.POLYGON_AMOY
address = '0x62dD51230A30401C455c8398d06F85e4EaB6309f'

public_key = KVStoreUtils.get_public_key(chain_id, address)
```
* **Return type:**
`str`
3 changes: 0 additions & 3 deletions docs/sdk/python/human_protocol_sdk.kvstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ This module allows the contract interaction with the key value storage on chain.
* [Module](human_protocol_sdk.kvstore.kvstore_client.md#module)
* [`KVStoreClient`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient)
* [`KVStoreClient.__init__()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.__init__)
* [`KVStoreClient.get()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.get)
* [`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)
* [`KVStoreClient.get_public_key()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.get_public_key)
* [`KVStoreClient.set()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.set)
* [`KVStoreClient.set_bulk()`](human_protocol_sdk.kvstore.kvstore_client.md#human_protocol_sdk.kvstore.kvstore_client.KVStoreClient.set_bulk)
* [`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)
Expand Down
4 changes: 3 additions & 1 deletion docs/sdk/python/human_protocol_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
* [`PaymentStatistics`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.PaymentStatistics)
* [`StatisticsClient`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClient)
* [`StatisticsClientError`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsClientError)
* [`StatisticsParam`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.StatisticsParam)
* [`WorkerStatistics`](human_protocol_sdk.statistics.statistics_client.md#human_protocol_sdk.statistics.statistics_client.WorkerStatistics)
* [human_protocol_sdk.storage package](human_protocol_sdk.storage.md)
* [Submodules](human_protocol_sdk.storage.md#submodules)
Expand Down Expand Up @@ -128,6 +127,7 @@
* [`KVStoreKeys.fee`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.KVStoreKeys.fee)
* [`KVStoreKeys.job_types`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.KVStoreKeys.job_types)
* [`KVStoreKeys.public_key`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.KVStoreKeys.public_key)
* [`KVStoreKeys.registration_needed`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.KVStoreKeys.registration_needed)
* [`KVStoreKeys.role`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.KVStoreKeys.role)
* [`KVStoreKeys.url`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.KVStoreKeys.url)
* [`KVStoreKeys.webhook_url`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.KVStoreKeys.webhook_url)
Expand All @@ -153,6 +153,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__)
* [`StatisticsFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatisticsFilter)
* [`StatisticsFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatisticsFilter.__init__)
* [`TransactionFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter)
* [`TransactionFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter.__init__)
* [human_protocol_sdk.legacy_encryption module](human_protocol_sdk.legacy_encryption.md)
Expand Down
6 changes: 3 additions & 3 deletions docs/sdk/python/human_protocol_sdk.operator.operator_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ print(

## Module

### *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)
### *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)

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, job_types=None)
#### \_\_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)

Initializes an LeaderData instance.

Expand All @@ -37,7 +37,7 @@ Initializes an LeaderData instance.
* **amount_slashed** (`int`) – Amount slashed
* **reputation** (`int`) – Reputation
* **reward** (`int`) – Reward
* **amount_jobs_launched** (`int`) – Amount of jobs launched
* **amount_jobs_processed** (`int`) – Amount of jobs launched
* **role** (`Optional`[`str`]) – Role
* **fee** (`Optional`[`int`]) – Fee
* **public_key** (`Optional`[`str`]) – Public key
Expand Down
Loading

0 comments on commit 026ba92

Please sign in to comment.