Skip to content

Commit e7ac82e

Browse files
committed
add tocancel to python sdk and update docs
1 parent a8bf4b2 commit e7ac82e

File tree

7 files changed

+44
-4
lines changed

7 files changed

+44
-4
lines changed

docs/sdk/python/human_protocol_sdk.constants.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,5 @@ Enum for escrow statuses.
103103
#### Partial *= 2*
104104

105105
#### Pending *= 1*
106+
107+
#### ToCancel *= 6*

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,22 @@ Gets the value of a key-value pair in the contract.
7070
:param address: The Ethereum address associated with the key-value pair
7171
:type key: `str`
7272
:param key: The key of the key-value pair to get
73-
:rtype: `str`
74-
:return: The value of the key-value pair if it exists
75-
:example:
73+
74+
* **Return type:**
75+
`str`
76+
* **Returns:**
77+
The value of the key-value pair if it exists
78+
* **Example:**
79+
```python
80+
from eth_typing import URI
81+
from web3 import Web3
82+
from web3.providers.auto import load_provider_from_uri
83+
from human_protocol_sdk.kvstore import KVStoreClient
84+
85+
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
86+
kvstore_client = KVStoreClient(w3)
87+
role = kvstore_client.get('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'Role')
88+
```
7689

7790
#### set(\*args, \*\*kwargs)
7891

docs/sdk/python/human_protocol_sdk.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
* [`Status.Paid`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status.Paid)
172172
* [`Status.Partial`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status.Partial)
173173
* [`Status.Pending`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status.Pending)
174+
* [`Status.ToCancel`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status.ToCancel)
174175
* [human_protocol_sdk.filter module](human_protocol_sdk.filter.md)
175176
* [`CancellationRefundFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.CancellationRefundFilter)
176177
* [`CancellationRefundFilter.__init__()`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.CancellationRefundFilter.__init__)
@@ -204,6 +205,7 @@
204205
* [`Encryption.is_encrypted()`](human_protocol_sdk.legacy_encryption.md#human_protocol_sdk.legacy_encryption.Encryption.is_encrypted)
205206
* [`InvalidPublicKey`](human_protocol_sdk.legacy_encryption.md#human_protocol_sdk.legacy_encryption.InvalidPublicKey)
206207
* [human_protocol_sdk.utils module](human_protocol_sdk.utils.md)
208+
* [`apply_tx_defaults()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.apply_tx_defaults)
207209
* [`get_contract_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_contract_interface)
208210
* [`get_data_from_subgraph()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_data_from_subgraph)
209211
* [`get_erc20_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_erc20_interface)

docs/sdk/python/human_protocol_sdk.utils.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# human_protocol_sdk.utils module
22

3+
### human_protocol_sdk.utils.apply_tx_defaults(w3, tx_options)
4+
5+
Apply network specific default transaction parameters.
6+
7+
Aurora networks enforce a fixed gas price. We always override any user supplied
8+
gasPrice with DEFAULT_AURORA_GAS_PRICE when on Aurora Testnet.
9+
EIP-1559 fields are removed to avoid conflicts.
10+
11+
* **Parameters:**
12+
* **w3** (`Web3`) – Web3 instance (used to read chain id)
13+
* **tx_options** (`Optional`[`TxParams`]) – Original transaction options (can be None)
14+
* **Return type:**
15+
`TxParams`
16+
* **Returns:**
17+
Mutated tx options with enforced defaults
18+
319
### human_protocol_sdk.utils.get_contract_interface(contract_entrypoint)
420

521
Retrieve the contract interface of a given contract.

docs/sdk/python/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pip install human-protocol-sdk[agreement]
6767
* [`Encryption`](human_protocol_sdk.legacy_encryption.md#human_protocol_sdk.legacy_encryption.Encryption)
6868
* [`InvalidPublicKey`](human_protocol_sdk.legacy_encryption.md#human_protocol_sdk.legacy_encryption.InvalidPublicKey)
6969
* [human_protocol_sdk.utils module](human_protocol_sdk.utils.md)
70+
* [`apply_tx_defaults()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.apply_tx_defaults)
7071
* [`get_contract_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_contract_interface)
7172
* [`get_data_from_subgraph()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_data_from_subgraph)
7273
* [`get_erc20_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_erc20_interface)

packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class Status(Enum):
176176
Paid = 3
177177
Complete = 4
178178
Cancelled = 5
179+
ToCancel = 6
179180

180181

181182
class Role(Enum):

packages/sdk/python/human-protocol-sdk/human_protocol_sdk/kvstore/kvstore_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,21 @@ def get_w3_with_priv_key(priv_key: str):
282282
handle_error(e, KVStoreClientError)
283283

284284
def get(self, address: str, key: str) -> str:
285-
"""Gets the value of a key-value pair in the contract.
285+
"""
286+
Gets the value of a key-value pair in the contract.
286287
:param address: The Ethereum address associated with the key-value pair
287288
:param key: The key of the key-value pair to get
289+
288290
:return: The value of the key-value pair if it exists
291+
289292
:example:
290293
.. code-block:: python
294+
291295
from eth_typing import URI
292296
from web3 import Web3
293297
from web3.providers.auto import load_provider_from_uri
294298
from human_protocol_sdk.kvstore import KVStoreClient
299+
295300
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
296301
kvstore_client = KVStoreClient(w3)
297302
role = kvstore_client.get('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'Role')

0 commit comments

Comments
 (0)