Skip to content

Commit 890e8aa

Browse files
committed
Merge branch 'develop' into feat/escrow-cancellation
2 parents 47f5da5 + 74380fa commit 890e8aa

121 files changed

Lines changed: 1173 additions & 706 deletions

File tree

Some content is hidden

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

.github/workflows/cd-subgraph.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Subgraph deployment
2-
32
on:
43
workflow_dispatch:
54
inputs:
@@ -53,23 +52,21 @@ jobs:
5352
- name: Build core package
5453
if: steps.filter_networks.outputs.continue == 'true'
5554
run: yarn build:core
56-
- name: Install Graph CLI
57-
if: steps.filter_networks.outputs.continue == 'true'
58-
run: yarn global add @graphprotocol/graph-cli@0.71.2
59-
- name: Authenticate Graph CLI
60-
if: steps.filter_networks.outputs.continue == 'true'
61-
run: graph auth --studio ${API_KEY}
62-
env:
63-
API_KEY: ${{ secrets.HP_GRAPH_API_KEY }}
6455
- name: Generate and build Subgraph
6556
if: steps.filter_networks.outputs.continue == 'true'
6657
run: yarn generate && yarn build
6758
working-directory: ./packages/sdk/typescript/subgraph
6859
env:
6960
NETWORK: ${{ matrix.network.name }}
70-
- name: Deploy Subgraph
61+
- name: Authenticate & Deploy
7162
if: steps.filter_networks.outputs.continue == 'true'
72-
run: graph deploy --studio ${NETWORK} -l ${{ github.event.inputs.label }}
73-
working-directory: ./packages/sdk/typescript/subgraph
7463
env:
75-
NETWORK: ${{ matrix.network.name }}
64+
API_KEY: ${{ secrets.HP_GRAPH_API_KEY }}
65+
NETWORK: ${{ matrix.network.name }}
66+
LABEL: ${{ github.event.inputs.label }}
67+
working-directory: ./packages/sdk/typescript/subgraph
68+
run: |
69+
yarn dlx @graphprotocol/graph-cli@0.71.2 \
70+
auth --studio "$API_KEY"
71+
yarn dlx @graphprotocol/graph-cli@0.71.2 \
72+
deploy --studio ${NETWORK} -l ${LABEL}

docs/sdk/python/human_protocol_sdk.filter.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ Initializes a filter for status events.
122122
* **skip** (`int`) – Optional number of events to skip. Default is 0.
123123
* **order_direction** ([`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)) – Optional order direction. Default is DESC.
124124

125-
### *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)
125+
### *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, method=None, escrow=None, token=None, first=10, skip=0, order_direction=OrderDirection.DESC)
126126

127127
Bases: `object`
128128

129129
A class used to filter transactions.
130130

131-
#### \_\_init_\_(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)
131+
#### \_\_init_\_(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, method=None, escrow=None, token=None, first=10, skip=0, order_direction=OrderDirection.DESC)
132132

133133
Initializes a TransactionsFilter instance.
134134

@@ -140,6 +140,9 @@ Initializes a TransactionsFilter instance.
140140
* **end_date** (`Optional`[`datetime`]) – End date for filtering transactions
141141
* **start_block** (`Optional`[`int`]) – Start block number for filtering transactions
142142
* **end_block** (`Optional`[`int`]) – End block number for filtering transactions
143+
* **method** (`Optional`[`str`]) – Method name to filter transactions
144+
* **escrow** (`Optional`[`str`]) – Escrow address to filter transactions
145+
* **token** (`Optional`[`str`]) – Token address to filter transactions
143146
* **first** (`int`) – Number of items per page
144147
* **skip** (`int`) – Page number to retrieve
145148
* **order** – Order of results, “asc” or “desc”

docs/sdk/python/human_protocol_sdk.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
* [`TransactionData`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionData)
116116
* [`TransactionUtils`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionUtils)
117117
* [`TransactionUtilsError`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionUtilsError)
118+
* [human_protocol_sdk.worker package](human_protocol_sdk.worker.md)
119+
* [Submodules](human_protocol_sdk.worker.md#submodules)
120+
* [human_protocol_sdk.worker.worker_utils module](human_protocol_sdk.worker.worker_utils.md)
121+
* [`WorkerData`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData)
122+
* [`WorkerUtils`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils)
123+
* [`WorkerUtilsError`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtilsError)
118124

119125
## Submodules
120126

docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Get an array of transactions based on the specified filter parameters.
7171

7272
* **Parameters:**
7373
**filter** ([`TransactionFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter)) – Object containing all the necessary parameters to filter
74+
(chain_id, from_address, to_address, start_date, end_date, start_block, end_block, method, escrow, token, first, skip, order_direction)
7475
* **Return type:**
7576
`List`[[`TransactionData`](#human_protocol_sdk.transaction.transaction_utils.TransactionData)]
7677
* **Returns:**
@@ -86,6 +87,8 @@ Get an array of transactions based on the specified filter parameters.
8687
chain_id=ChainId.POLYGON_AMOY,
8788
from_address="0x1234567890123456789012345678901234567890",
8889
to_address="0x0987654321098765432109876543210987654321",
90+
method="transfer",
91+
escrow="0x0987654321098765432109876543210987654321",
8992
start_date=datetime.datetime(2023, 5, 8),
9093
end_date=datetime.datetime(2023, 6, 8),
9194
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# human_protocol_sdk.worker package
2+
3+
This module enables to obtain worker information from subgraph.
4+
5+
## Submodules
6+
7+
* [human_protocol_sdk.worker.worker_utils module](human_protocol_sdk.worker.worker_utils.md)
8+
* [`WorkerData`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData)
9+
* [`WorkerData.__init__()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData.__init__)
10+
* [`WorkerUtils`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils)
11+
* [`WorkerUtils.get_worker()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils.get_worker)
12+
* [`WorkerUtils.get_workers()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils.get_workers)
13+
* [`WorkerUtilsError`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtilsError)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# human_protocol_sdk.worker.worker_utils module
2+
3+
### *class* human_protocol_sdk.worker.worker_utils.WorkerData(id, address, total_amount_received, payout_count)
4+
5+
Bases: `object`
6+
7+
#### \_\_init_\_(id, address, total_amount_received, payout_count)
8+
9+
Initializes a WorkerData instance.
10+
11+
* **Parameters:**
12+
* **id** (`str`) – Worker ID
13+
* **address** (`str`) – Worker address
14+
* **total_amount_received** (`int`) – Total amount received by the worker
15+
* **payout_count** (`int`) – Number of payouts received by the worker
16+
17+
### *class* human_protocol_sdk.worker.worker_utils.WorkerUtils
18+
19+
Bases: `object`
20+
21+
A utility class that provides additional worker-related functionalities.
22+
23+
#### *static* get_worker(chain_id, worker_address)
24+
25+
Gets the worker details.
26+
27+
* **Parameters:**
28+
* **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the worker exists
29+
* **worker_address** (`str`) – Address of the worker
30+
* **Return type:**
31+
`Optional`[[`WorkerData`](#human_protocol_sdk.worker.worker_utils.WorkerData)]
32+
* **Returns:**
33+
Worker data if exists, otherwise None
34+
35+
#### *static* get_workers(filter)
36+
37+
Get workers data of the protocol.
38+
39+
* **Parameters:**
40+
**filter** ([`WorkerFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.WorkerFilter)) – Worker filter
41+
* **Return type:**
42+
`List`[[`WorkerData`](#human_protocol_sdk.worker.worker_utils.WorkerData)]
43+
* **Returns:**
44+
List of workers data
45+
46+
### *exception* human_protocol_sdk.worker.worker_utils.WorkerUtilsError
47+
48+
Bases: `Exception`
49+
50+
Raised when an error occurs when getting data from subgraph.

docs/sdk/python/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ pip install human-protocol-sdk[agreement]
4242
* [Submodules](human_protocol_sdk.storage.md#submodules)
4343
* [human_protocol_sdk.transaction package](human_protocol_sdk.transaction.md)
4444
* [Submodules](human_protocol_sdk.transaction.md#submodules)
45+
* [human_protocol_sdk.worker package](human_protocol_sdk.worker.md)
46+
* [Submodules](human_protocol_sdk.worker.md#submodules)
4547
* [Submodules](human_protocol_sdk.md#submodules)
4648
* [human_protocol_sdk.constants module](human_protocol_sdk.constants.md)
4749
* [`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)

docs/sdk/typescript/base/classes/BaseEthersClient.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: `abstract` BaseEthersClient
88

9-
Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)
9+
Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)
1010

1111
## Introduction
1212

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

2525
> **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient`
2626
27-
Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)
27+
Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)
2828

2929
**BaseClient constructor**
3030

@@ -52,12 +52,12 @@ The network information required to connect to the contracts
5252

5353
> **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md)
5454
55-
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
55+
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
5656

5757
***
5858

5959
### runner
6060

6161
> `protected` **runner**: `ContractRunner`
6262
63-
Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
63+
Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)

docs/sdk/typescript/encryption/classes/Encryption.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: Encryption
88

9-
Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)
9+
Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)
1010

1111
## Introduction
1212

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

5454
> **new Encryption**(`privateKey`): `Encryption`
5555
56-
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
56+
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
5757

5858
Constructor for the Encryption class.
5959

@@ -75,7 +75,7 @@ The private key.
7575

7676
> **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
7777
78-
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
78+
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
7979

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

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

130130
> **sign**(`message`): `Promise`\<`string`\>
131131
132-
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
132+
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
133133

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

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

166166
> **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\>
167167
168-
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
168+
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
169169

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

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

233233
> `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\>
234234
235-
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
235+
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
236236

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

docs/sdk/typescript/encryption/classes/EncryptionUtils.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: EncryptionUtils
88

9-
Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)
9+
Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)
1010

1111
## Introduction
1212

@@ -48,7 +48,7 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', 'human@hmt.ai');
4848

4949
> `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\>
5050
51-
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)
51+
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)
5252

5353
This function encrypts a message using the specified public keys.
5454

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

112112
> `static` **generateKeyPair**(`name`, `email`, `passphrase`): `Promise`\<[`IKeyPair`](../../interfaces/interfaces/IKeyPair.md)\>
113113
114-
Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)
114+
Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)
115115

116116
This function generates a key pair for encryption and decryption.
117117

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

159159
> `static` **getSignedData**(`message`): `Promise`\<`string`\>
160160
161-
Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)
161+
Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)
162162

163163
This function gets signed data from a signed message.
164164

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

191191
> `static` **isEncrypted**(`message`): `boolean`
192192
193-
Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)
193+
Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)
194194

195195
Verifies if a message appears to be encrypted with OpenPGP.
196196

@@ -238,7 +238,7 @@ if (isEncrypted) {
238238

239239
> `static` **verify**(`message`, `publicKey`): `Promise`\<`boolean`\>
240240
241-
Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/36a82d86df8ff0c729bd9c2ab3a0bb0641086da4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)
241+
Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/47f5da5838a126d0f0ff22cdaa7719befd2657b4/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)
242242

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

0 commit comments

Comments
 (0)