Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .github/workflows/cd-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- name: ethereum
- name: polygon
- name: sepolia
- name: aurora-testnet
fail-fast: true
max-parallel: 3
steps:
Expand Down
4 changes: 1 addition & 3 deletions docs/sdk/changelog.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Changelog

### Added
- new optional config for querying subgraph with retries when failuers are due to bad indexers errors

### Changed

- Relaxed several SDK return types (EscrowUtils, OperatorUtils, TransactionUtils, WorkerUtils) to allow `null` when a subgraph entity does not exist.
- EscrowUtils.getEscrow now includes `chainId` in the returned object.

### Deprecated

### Removed
Expand Down
2 changes: 0 additions & 2 deletions docs/sdk/python/human_protocol_sdk.constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ Bases: `Enum`

Enum for chain IDs.

#### AURORA_TESTNET *= 1313161555*

#### BSC_MAINNET *= 56*

#### BSC_TESTNET *= 97*
Expand Down
26 changes: 16 additions & 10 deletions docs/sdk/python/human_protocol_sdk.escrow.escrow_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,14 @@ Bases: `object`

A utility class that provides additional escrow-related functionalities.

#### *static* get_cancellation_refund(chain_id, escrow_address)
#### *static* get_cancellation_refund(chain_id, escrow_address, options=None)

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
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
[`CancellationRefund`](#human_protocol_sdk.escrow.escrow_utils.CancellationRefund)
* **Returns:**
Expand All @@ -104,26 +105,28 @@ Returns the cancellation refund for a given escrow address.
)
```

#### *static* get_cancellation_refunds(filter)
#### *static* get_cancellation_refunds(filter, options=None)

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.
* **filter** ([`CancellationRefundFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.CancellationRefundFilter)) – Object containing all the necessary parameters to filter cancellation refunds.
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **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)
#### *static* get_escrow(chain_id, escrow_address, options=None)

Returns the escrow for a given 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
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`Optional`[[`EscrowData`](#human_protocol_sdk.escrow.escrow_utils.EscrowData)]
* **Returns:**
Expand All @@ -141,12 +144,13 @@ Returns the escrow for a given address.
)
```

#### *static* get_escrows(filter)
#### *static* get_escrows(filter, options=None)

Get an array of escrow addresses based on the specified filter parameters.

* **Parameters:**
**filter** ([`EscrowFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.EscrowFilter)) – Object containing all the necessary parameters to filter
* **filter** ([`EscrowFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.EscrowFilter)) – Object containing all the necessary parameters to filter
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`List`[[`EscrowData`](#human_protocol_sdk.escrow.escrow_utils.EscrowData)]
* **Returns:**
Expand All @@ -168,25 +172,27 @@ Get an array of escrow addresses based on the specified filter parameters.
)
```

#### *static* get_payouts(filter)
#### *static* get_payouts(filter, options=None)

Fetch payouts from the subgraph based on the provided filter.

* **Parameters:**
**filter** ([`PayoutFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.PayoutFilter)) – Object containing all the necessary parameters to filter payouts.
* **filter** ([`PayoutFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.PayoutFilter)) – Object containing all the necessary parameters to filter payouts.
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return List[Payout]:**
List of payouts 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`[[`Payout`](#human_protocol_sdk.escrow.escrow_utils.Payout)]

#### *static* get_status_events(filter)
#### *static* get_status_events(filter, options=None)

Retrieve status events for specified networks and statuses within a date range.

* **Parameters:**
**filter** ([`StatusEventFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatusEventFilter)) – Object containing all the necessary parameters to filter status events.
* **filter** ([`StatusEventFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.StatusEventFilter)) – Object containing all the necessary parameters to filter status events.
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return List[StatusEvent]:**
List of status events matching the query parameters.
* **Raises:**
Expand Down
9 changes: 6 additions & 3 deletions docs/sdk/python/human_protocol_sdk.kvstore.kvstore_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ Bases: `object`

A utility class that provides additional KVStore-related functionalities.

#### *static* get(chain_id, address, key)
#### *static* get(chain_id, address, key, options=None)

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
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`str`
* **Returns:**
Expand All @@ -61,14 +62,15 @@ Gets the value of a key-value pair in the contract.
print(result)
```

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

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.
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return url:**
The URL value of the given address if exists, and the content is valid
* **Example:**
Expand All @@ -85,13 +87,14 @@ Gets the URL value of the given entity, and verify its hash.
* **Return type:**
`str`

#### *static* get_kvstore_data(chain_id, address)
#### *static* get_kvstore_data(chain_id, address, options=None)

Returns the KVStore data for a given address.

* **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 of the KVStore
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`Optional`[`List`[[`KVStoreData`](#human_protocol_sdk.kvstore.kvstore_utils.KVStoreData)]]
* **Returns:**
Expand Down
10 changes: 6 additions & 4 deletions docs/sdk/python/human_protocol_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@

* [human_protocol_sdk.constants module](human_protocol_sdk.constants.md)
* [`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)
* [`ChainId.AURORA_TESTNET`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId.AURORA_TESTNET)
* [`ChainId.BSC_MAINNET`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId.BSC_MAINNET)
* [`ChainId.BSC_TESTNET`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId.BSC_TESTNET)
* [`ChainId.LOCALHOST`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId.LOCALHOST)
Expand Down Expand Up @@ -205,17 +204,20 @@
* [`Encryption.is_encrypted()`](human_protocol_sdk.legacy_encryption.md#human_protocol_sdk.legacy_encryption.Encryption.is_encrypted)
* [`InvalidPublicKey`](human_protocol_sdk.legacy_encryption.md#human_protocol_sdk.legacy_encryption.InvalidPublicKey)
* [human_protocol_sdk.utils module](human_protocol_sdk.utils.md)
* [`apply_tx_defaults()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.apply_tx_defaults)
* [`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)
* [`SubgraphOptions.__init__()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions.__init__)
* [`SubgraphOptions.base_delay`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions.base_delay)
* [`SubgraphOptions.max_retries`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions.max_retries)
* [`custom_gql_fetch()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.custom_gql_fetch)
* [`get_contract_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_contract_interface)
* [`get_data_from_subgraph()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_data_from_subgraph)
* [`get_erc20_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_erc20_interface)
* [`get_escrow_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_escrow_interface)
* [`get_factory_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_factory_interface)
* [`get_hmt_balance()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_hmt_balance)
* [`get_kvstore_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_kvstore_interface)
* [`get_staking_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_staking_interface)
* [`handle_error()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_error)
* [`is_indexer_error()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.is_indexer_error)
* [`parse_transfer_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.parse_transfer_transaction)
* [`validate_json()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.validate_json)
* [`validate_url()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.validate_url)
* [`with_retry()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.with_retry)
14 changes: 9 additions & 5 deletions docs/sdk/python/human_protocol_sdk.operator.operator_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ Bases: `object`

A utility class that provides additional operator-related functionalities.

#### *static* get_operator(chain_id, operator_address)
#### *static* get_operator(chain_id, operator_address, options=None)

Gets the operator details.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the operator exists
* **operator_address** (`str`) – Address of the operator
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`Optional`[[`OperatorData`](#human_protocol_sdk.operator.operator_utils.OperatorData)]
* **Returns:**
Expand All @@ -96,12 +97,13 @@ Gets the operator details.
print(operator_data)
```

#### *static* get_operators(filter)
#### *static* get_operators(filter, options=None)

Get operators data of the protocol.

* **Parameters:**
**filter** ([`OperatorFilter`](#human_protocol_sdk.operator.operator_utils.OperatorFilter)) – Operator filter
* **filter** ([`OperatorFilter`](#human_protocol_sdk.operator.operator_utils.OperatorFilter)) – Operator filter
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`List`[[`OperatorData`](#human_protocol_sdk.operator.operator_utils.OperatorData)]
* **Returns:**
Expand All @@ -118,14 +120,15 @@ Get operators data of the protocol.
)
```

#### *static* get_reputation_network_operators(chain_id, address, role=None)
#### *static* get_reputation_network_operators(chain_id, address, role=None, options=None)

Get the reputation network operators of the specified address.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the reputation network exists
* **address** (`str`) – Address of the reputation oracle
* **role** (`Optional`[`str`]) – (Optional) Role of the operator
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`List`[[`OperatorData`](#human_protocol_sdk.operator.operator_utils.OperatorData)]
* **Returns:**
Expand All @@ -142,13 +145,14 @@ Get the reputation network operators of the specified address.
print(operators)
```

#### *static* get_rewards_info(chain_id, slasher)
#### *static* get_rewards_info(chain_id, slasher, options=None)

Get rewards of the given slasher.

* **Parameters:**
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the slasher exists
* **slasher** (`str`) – Address of the slasher
* **options** (`Optional`[[`SubgraphOptions`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.SubgraphOptions)]) – Optional config for subgraph requests
* **Return type:**
`List`[[`RewardData`](#human_protocol_sdk.operator.operator_utils.RewardData)]
* **Returns:**
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/python/human_protocol_sdk.staking.staking_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ Bases: `object`

Bases: `object`

#### *static* get_staker(chain_id, address)
#### *static* get_staker(chain_id, address, options=None)

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

#### *static* get_stakers(filter)
#### *static* get_stakers(filter, options=None)

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