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
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 @@ -6,6 +6,8 @@ Bases: `Enum`

Enum for chain IDs.

#### AURORA_TESTNET *= 1313161555*

#### BSC_MAINNET *= 56*

#### BSC_TESTNET *= 97*
Expand Down
9 changes: 9 additions & 0 deletions docs/sdk/python/human_protocol_sdk.decorators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# human_protocol_sdk.decorators module

### *exception* human_protocol_sdk.decorators.RequiresSignerError

Bases: `Exception`

Raised when a signer or required middleware is missing in the Web3 instance.

### human_protocol_sdk.decorators.requires_signer(method)
34 changes: 17 additions & 17 deletions docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,14 @@ Gets the job launcher address of the escrow.
)
```

#### get_manifest_hash(escrow_address)
#### get_manifest(escrow_address)

Gets the manifest file hash.
Gets the manifest data (can be a URL or JSON string).

* **Parameters:**
**escrow_address** (`str`) – Address of the escrow
* **Return type:**
`str`
* **Returns:**
Manifest file hash
* **Return str:**
Manifest data
* **Raises:**
[**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters
* **Example:**
Expand All @@ -341,19 +339,23 @@ Gets the manifest file hash.
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
escrow_client = EscrowClient(w3)

manifest_hash = escrow_client.get_manifest_hash(
manifest = escrow_client.get_manifest(
"0x62dD51230A30401C455c8398d06F85e4EaB6309f"
)
```
* **Return type:**
`str`

#### get_manifest_url(escrow_address)
#### get_manifest_hash(escrow_address)

Gets the manifest file URL.
Gets the manifest file hash.

* **Parameters:**
**escrow_address** (`str`) – Address of the escrow
* **Return str:**
Manifest file url
* **Return type:**
`str`
* **Returns:**
Manifest file hash
* **Raises:**
[**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters
* **Example:**
Expand All @@ -367,12 +369,10 @@ Gets the manifest file URL.
w3 = Web3(load_provider_from_uri(URI("http://localhost:8545")))
escrow_client = EscrowClient(w3)

url = escrow_client.get_manifest_url(
manifest_hash = escrow_client.get_manifest_hash(
"0x62dD51230A30401C455c8398d06F85e4EaB6309f"
)
```
* **Return type:**
`str`

#### get_recording_oracle_address(escrow_address)

Expand Down Expand Up @@ -526,13 +526,13 @@ Bases: `Exception`

Raises when some error happens when interacting with escrow.

### *class* human_protocol_sdk.escrow.escrow_client.EscrowConfig(recording_oracle_address, reputation_oracle_address, exchange_oracle_address, recording_oracle_fee, reputation_oracle_fee, exchange_oracle_fee, manifest_url, hash)
### *class* human_protocol_sdk.escrow.escrow_client.EscrowConfig(recording_oracle_address, reputation_oracle_address, exchange_oracle_address, recording_oracle_fee, reputation_oracle_fee, exchange_oracle_fee, manifest, hash)

Bases: `object`

A class used to manage escrow parameters.

#### \_\_init_\_(recording_oracle_address, reputation_oracle_address, exchange_oracle_address, recording_oracle_fee, reputation_oracle_fee, exchange_oracle_fee, manifest_url, hash)
#### \_\_init_\_(recording_oracle_address, reputation_oracle_address, exchange_oracle_address, recording_oracle_fee, reputation_oracle_fee, exchange_oracle_fee, manifest, hash)

Initializes a Escrow instance.

Expand All @@ -541,7 +541,7 @@ Initializes a Escrow instance.
* **reputation_oracle_address** (`str`) – Address of the Reputation Oracle
* **recording_oracle_fee** (`Decimal`) – Fee percentage of the Recording Oracle
* **reputation_oracle_fee** (`Decimal`) – Fee percentage of the Reputation Oracle
* **manifest_url** (`str`) – Manifest file url
* **manifest** (`str`) – Manifest data (can be a URL or JSON string)
* **hash** (`str`) – Manifest file hash

### *class* human_protocol_sdk.escrow.escrow_client.EscrowWithdraw(tx_hash, token_address, amount_withdrawn)
Expand Down
6 changes: 3 additions & 3 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, reputation_oracle=None, exchange_oracle=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=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, reputation_oracle=None, exchange_oracle=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=None, recording_oracle=None, reputation_oracle=None, exchange_oracle=None)

Initializes an EscrowData instance.

Expand All @@ -46,7 +46,7 @@ Initializes an EscrowData instance.
* **final_results_url** (`Optional`[`str`]) – URL for final results.
* **intermediate_results_url** (`Optional`[`str`]) – URL for intermediate results.
* **manifest_hash** (`Optional`[`str`]) – Manifest hash.
* **manifest_url** (`Optional`[`str`]) – Manifest URL.
* **manifest** (`Optional`[`str`]) – Manifest data (JSON/URL).
* **recording_oracle** (`Optional`[`str`]) – Recording Oracle address.
* **reputation_oracle** (`Optional`[`str`]) – Reputation Oracle address.
* **exchange_oracle** (`Optional`[`str`]) – Exchange Oracle address.
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/python/human_protocol_sdk.escrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ obtain information from both the contracts and subgraph.
* [`EscrowClient.get_factory_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_factory_address)
* [`EscrowClient.get_intermediate_results_url()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_intermediate_results_url)
* [`EscrowClient.get_job_launcher_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_job_launcher_address)
* [`EscrowClient.get_manifest()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_manifest)
* [`EscrowClient.get_manifest_hash()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_manifest_hash)
* [`EscrowClient.get_manifest_url()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_manifest_url)
* [`EscrowClient.get_recording_oracle_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_recording_oracle_address)
* [`EscrowClient.get_reputation_oracle_address()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_reputation_oracle_address)
* [`EscrowClient.get_results_url()`](human_protocol_sdk.escrow.escrow_client.md#human_protocol_sdk.escrow.escrow_client.EscrowClient.get_results_url)
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/python/human_protocol_sdk.filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Initializes a EscrowFilter instance.
* **recording_oracle** (`Optional`[`str`]) – Recording oracle address
* **exchange_oracle** (`Optional`[`str`]) – Exchange oracle address
* **job_requester_id** (`Optional`[`str`]) – Job requester id
* **status** (`Optional`[[`Status`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status)]) – Escrow status
* **status** (`Union`[[`Status`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status), `List`[[`Status`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.Status)], `None`]) – Escrow status
* **date_from** (`Optional`[`datetime`]) – Created from date
* **date_to** (`Optional`[`datetime`]) – Created to date
* **first** (`int`) – Number of items per page
Expand Down
2 changes: 2 additions & 0 deletions docs/sdk/python/human_protocol_sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@

* [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 @@ -202,5 +203,6 @@
* [`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)
* [`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)
8 changes: 8 additions & 0 deletions docs/sdk/python/human_protocol_sdk.utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ Parse a transfer transaction receipt.
* **Returns:**
A tuple indicating if HMT was transferred and the transaction balance

### human_protocol_sdk.utils.validate_json(data)

Validates if the given string is a valid JSON.
:type data: `str`
:param data: String to validate
:rtype: `bool`
:return: True if the string is a valid JSON, False otherwise

### human_protocol_sdk.utils.validate_url(url)

Validates the given URL.
Expand Down
1 change: 1 addition & 0 deletions docs/sdk/python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ pip install human-protocol-sdk[agreement]
* [`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)
* [`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)
8 changes: 4 additions & 4 deletions docs/sdk/typescript/base/classes/BaseEthersClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: `abstract` BaseEthersClient

Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)
Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)

## Introduction

Expand All @@ -24,7 +24,7 @@ This class is used as a base class for other clients making on-chain calls.

> **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient`

Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)
Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)

**BaseClient constructor**

Expand Down Expand Up @@ -52,12 +52,12 @@ The network information required to connect to the contracts

> **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md)

Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)

***

### runner

> `protected` **runner**: `ContractRunner`

Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
12 changes: 6 additions & 6 deletions docs/sdk/typescript/encryption/classes/Encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: Encryption

Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)
Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)

## Introduction

Expand Down Expand Up @@ -53,7 +53,7 @@ const encryption = await Encryption.build(privateKey, passphrase);

> **new Encryption**(`privateKey`): `Encryption`

Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)

Constructor for the Encryption class.

Expand All @@ -75,7 +75,7 @@ The private key.

> **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>

Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)

This function decrypts messages using the private key. In addition, the public key can be added for signature verification.

Expand Down Expand Up @@ -129,7 +129,7 @@ const resultMessage = await encryption.decrypt('message');

> **sign**(`message`): `Promise`\<`string`\>

Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)

This function signs a message using the private key used to initialize the client.

Expand Down Expand Up @@ -165,7 +165,7 @@ const resultMessage = await encryption.sign('message');

> **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\>

Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)

This function signs and encrypts a message using the private key used to initialize the client and the specified public keys.

Expand Down Expand Up @@ -232,7 +232,7 @@ const resultMessage = await encryption.signAndEncrypt('message', publicKeys);

> `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\>

Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)

Builds an Encryption instance by decrypting the private key from an encrypted private key and passphrase.

Expand Down
12 changes: 6 additions & 6 deletions docs/sdk/typescript/encryption/classes/EncryptionUtils.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: EncryptionUtils

Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)
Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)

## Introduction

Expand Down Expand Up @@ -48,7 +48,7 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', '[email protected]');

> `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\>

Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)

This function encrypts a message using the specified public keys.

Expand Down Expand Up @@ -111,7 +111,7 @@ const result = await EncryptionUtils.encrypt('message', publicKeys);

> `static` **generateKeyPair**(`name`, `email`, `passphrase`): `Promise`\<[`IKeyPair`](../../interfaces/interfaces/IKeyPair.md)\>

Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)
Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)

This function generates a key pair for encryption and decryption.

Expand Down Expand Up @@ -158,7 +158,7 @@ const result = await EncryptionUtils.generateKeyPair(name, email, passphrase);

> `static` **getSignedData**(`message`): `Promise`\<`string`\>

Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)
Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)

This function gets signed data from a signed message.

Expand Down Expand Up @@ -190,7 +190,7 @@ const signedData = await EncryptionUtils.getSignedData('message');

> `static` **isEncrypted**(`message`): `boolean`

Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)
Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)

Verifies if a message appears to be encrypted with OpenPGP.

Expand Down Expand Up @@ -238,7 +238,7 @@ if (isEncrypted) {

> `static` **verify**(`message`, `publicKey`): `Promise`\<`boolean`\>

Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)
Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/5b6e90353814741f056deb2914334a3c4fbc279d/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)

This function verifies the signature of a signed message using the public key.

Expand Down
Loading
Loading