@@ -64,7 +64,7 @@ Represents the result of an escrow cancellation transaction.
6464
6565Bases: ` object `
6666
67- A class used to manage escrow on the HUMAN network .
67+ A client class to interact with the escrow smart contract .
6868
6969#### \_\_ init_ \_ (web3)
7070
@@ -127,7 +127,7 @@ Pays out the amounts specified to the workers and sets the URL of the final resu
127127 * ** escrow_address** (` str ` ) – Address of the escrow
128128 * ** recipients** (` List ` [ ` str ` ] ) – Array of recipient addresses
129129 * ** amounts** (` List ` [ ` Decimal ` ] ) – Array of amounts the recipients will receive
130- * ** final_results_url** (` str ` ) – Final results file url
130+ * ** final_results_url** (` str ` ) – Final results file URL
131131 * ** final_results_hash** (` str ` ) – Final results file hash
132132 * ** txId** (` Decimal ` ) – Serial number of the bulks
133133 * ** force_complete** (` Optional ` [ ` bool ` ] ) – (Optional) Indicates if remaining balance should be transferred to the escrow creator
@@ -148,8 +148,7 @@ Pays out the amounts specified to the workers and sets the URL of the final resu
148148 from human_protocol_sdk.escrow import EscrowClient
149149
150150 def get_w3_with_priv_key (priv_key : str ):
151- w3 = Web3(load_provider_from_uri(
152- URI(" http://localhost:8545" )))
151+ w3 = Web3(load_provider_from_uri(URI(" http://localhost:8545" )))
153152 gas_payer = w3.eth.account.from_key(priv_key)
154153 w3.eth.default_account = gas_payer.address
155154 w3.middleware_onion.add(
@@ -249,8 +248,7 @@ Sets the status of an escrow to completed.
249248 from human_protocol_sdk.escrow import EscrowClient
250249
251250 def get_w3_with_priv_key (priv_key : str ):
252- w3 = Web3(load_provider_from_uri(
253- URI(" http://localhost:8545" )))
251+ w3 = Web3(load_provider_from_uri(URI(" http://localhost:8545" )))
254252 gas_payer = w3.eth.account.from_key(priv_key)
255253 w3.eth.default_account = gas_payer.address
256254 w3.middleware_onion.add(
@@ -265,15 +263,15 @@ Sets the status of an escrow to completed.
265263 escrow_client.complete(" 0x62dD51230A30401C455c8398d06F85e4EaB6309f" )
266264 ```
267265
268- #### create_bulk_payout_transaction(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, tx_options=None)
266+ #### create_bulk_payout_transaction(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, force_complete=False, tx_options=None)
269267
270268Creates a prepared transaction for bulk payout without signing or sending it.
271269
272270* ** Parameters:**
273271 * ** escrow_address** (` str ` ) – Address of the escrow
274272 * ** recipients** (` List ` [ ` str ` ] ) – Array of recipient addresses
275273 * ** amounts** (` List ` [ ` Decimal ` ] ) – Array of amounts the recipients will receive
276- * ** final_results_url** (` str ` ) – Final results file url
274+ * ** final_results_url** (` str ` ) – Final results file URL
277275 * ** final_results_hash** (` str ` ) – Final results file hash
278276 * ** txId** (` Decimal ` ) – Serial number of the bulks
279277 * ** tx_options** (` Optional ` [ ` TxParams ` ] ) – (Optional) Additional transaction parameters
@@ -293,8 +291,7 @@ Creates a prepared transaction for bulk payout without signing or sending it.
293291 from human_protocol_sdk.escrow import EscrowClient
294292
295293 def get_w3_with_priv_key (priv_key : str ):
296- w3 = Web3(load_provider_from_uri(
297- URI(" http://localhost:8545" )))
294+ w3 = Web3(load_provider_from_uri(URI(" http://localhost:8545" )))
298295 gas_payer = w3.eth.account.from_key(priv_key)
299296 w3.eth.default_account = gas_payer.address
300297 w3.middleware_onion.add(
@@ -323,35 +320,36 @@ Creates a prepared transaction for bulk payout without signing or sending it.
323320 amounts,
324321 results_url,
325322 results_hash,
326- 1
323+ 1 ,
324+ false
327325 )
328326
329327 print (f " Transaction: { transaction} " )
330328
331329 signed_transaction = w3.eth.account.sign_transaction(
332- transaction, private_key)
330+ transaction, private_key
331+ )
333332 tx_hash = w3.eth.send_raw_transaction(
334- signed_transaction.raw_transaction)
333+ signed_transaction.raw_transaction
334+ )
335335 tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
336336 print (f " Transaction sent with hash: { tx_hash.hex()} " )
337337 print (f " Transaction receipt: { tx_receipt} " )
338338 ```
339339
340340#### create_escrow(token_address, trusted_handlers, job_requester_id, tx_options=None)
341341
342- Creates an escrow contract that uses the token passed to pay oracle fees and reward workers .
342+ Creates a new escrow contract.
343343
344344* ** Parameters:**
345- * ** tokenAddress ** – The address of the token to use for payouts
346- * ** trusted_handlers** (` List ` [ ` str ` ] ) – Array of addresses that can perform actions on the contract
347- * ** job_requester_id** (` str ` ) – The id of the job requester
348- * ** tx_options** (` Optional ` [ ` TxParams ` ] ) – (Optional) Additional transaction parameters
345+ * ** token_address ** ( ` str ` ) – Address of the token to be used in the escrow
346+ * ** trusted_handlers** (` List ` [ ` str ` ] ) – List of trusted handler addresses
347+ * ** job_requester_id** (` str ` ) – ID of the job requester
348+ * ** tx_options** (` Optional ` [ ` TxParams ` ] ) – (Optional) Transaction options
349349* ** Return type:**
350350 ` str `
351351* ** Returns:**
352- The address of the escrow created
353- * ** Raises:**
354- [ ** EscrowClientError** ] ( #human_protocol_sdk.escrow.escrow_client.EscrowClientError ) – If an error occurs while checking the parameters
352+ Address of the created escrow contract
355353* ** Example:**
356354 ``` python
357355 from eth_typing import URI
@@ -375,10 +373,10 @@ Creates an escrow contract that uses the token passed to pay oracle fees and rew
375373 (w3, gas_payer) = get_w3_with_priv_key(' YOUR_PRIVATE_KEY' )
376374 escrow_client = EscrowClient(w3)
377375
378- token_address = ' 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 '
376+ token_address = ' 0x1234567890abcdef1234567890abcdef12345678 '
379377 trusted_handlers = [
380- ' 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 ' ,
381- ' 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 '
378+ ' 0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef ' ,
379+ ' 0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef '
382380 ]
383381 job_requester_id = ' job-requester'
384382 escrow_address = escrow_client.create_escrow(
@@ -396,7 +394,7 @@ Validates input parameters for bulk payout operations.
396394 * ** escrow_address** (` str ` ) – Address of the escrow
397395 * ** recipients** (` List ` [ ` str ` ] ) – Array of recipient addresses
398396 * ** amounts** (` List ` [ ` Decimal ` ] ) – Array of amounts the recipients will receive
399- * ** final_results_url** (` str ` ) – Final results file url
397+ * ** final_results_url** (` str ` ) – Final results file URL
400398 * ** final_results_hash** (` str ` ) – Final results file hash
401399* ** Return type:**
402400 ` None `
@@ -410,7 +408,7 @@ Validates input parameters for bulk payout operations.
410408Adds funds to the escrow.
411409
412410* ** Parameters:**
413- * ** escrow_address** (` str ` ) – Address of the escrow to setup
411+ * ** escrow_address** (` str ` ) – Address of the escrow to fund
414412 * ** amount** (` Decimal ` ) – Amount to be added as funds
415413 * ** tx_options** (` Optional ` [ ` TxParams ` ] ) – (Optional) Additional transaction parameters
416414* ** Return type:**
@@ -429,8 +427,7 @@ Adds funds to the escrow.
429427 from human_protocol_sdk.escrow import EscrowClient
430428
431429 def get_w3_with_priv_key (priv_key : str ):
432- w3 = Web3(load_provider_from_uri(
433- URI(" http://localhost:8545" )))
430+ w3 = Web3(load_provider_from_uri(URI(" http://localhost:8545" )))
434431 gas_payer = w3.eth.account.from_key(priv_key)
435432 w3.eth.default_account = gas_payer.address
436433 w3.middleware_onion.add(
@@ -442,9 +439,10 @@ Adds funds to the escrow.
442439 (w3, gas_payer) = get_w3_with_priv_key(' YOUR_PRIVATE_KEY' )
443440 escrow_client = EscrowClient(w3)
444441
445- amount = Web3.to_wei(5 , ' ether' ) # convert from ETH to WEI
442+ amount = Web3.to_wei(5 , ' ether' ) # convert from ETH to WEI
446443 escrow_client.fund(
447- " 0x62dD51230A30401C455c8398d06F85e4EaB6309f" , amount)
444+ " 0x62dD51230A30401C455c8398d06F85e4EaB6309f" , amount
445+ )
448446 ```
449447
450448#### get_balance(escrow_address)
@@ -788,15 +786,9 @@ Gets the address of the token used to fund the escrow.
788786Sets up the parameters of the escrow.
789787
790788* ** Parameters:**
791- * ** escrow_address** (` str ` ) – Address of the escrow to setup
792- * ** escrow_config** ([ ` EscrowConfig ` ] ( #human_protocol_sdk.escrow.escrow_client.EscrowConfig ) ) – Object containing all the necessary information to setup an escrow
793- * ** tx_options** (` Optional ` [ ` TxParams ` ] ) – (Optional) Additional transaction parameters
794- * ** Return type:**
795- ` None `
796- * ** Returns:**
797- None
798- * ** Raises:**
799- [ ** EscrowClientError** ] ( #human_protocol_sdk.escrow.escrow_client.EscrowClientError ) – If an error occurs while checking the parameters
789+ * ** escrow_address** (` str ` ) – Address of the escrow contract
790+ * ** escrow_config** ([ ` EscrowConfig ` ] ( #human_protocol_sdk.escrow.escrow_client.EscrowConfig ) ) – Configuration parameters for the escrow
791+ * ** tx_options** (` Optional ` [ ` TxParams ` ] ) – (Optional) Transaction options
800792* ** Example:**
801793 ``` python
802794 from eth_typing import URI
@@ -820,27 +812,35 @@ Sets up the parameters of the escrow.
820812 (w3, gas_payer) = get_w3_with_priv_key(' YOUR_PRIVATE_KEY' )
821813 escrow_client = EscrowClient(w3)
822814
823- escrow_address = " 0x62dD51230A30401C455c8398d06F85e4EaB6309f "
815+ escrow_address = " 0x1234567890abcdef1234567890abcdef12345678 "
824816 escrow_config = EscrowConfig(
825- " 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" ,
826- " 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" ,
827- " 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" ,
828- 10 ,
829- 10 ,
830- 10 ,
831- " htttp://localhost/manifest.json" ,
832- " b5dad76bf6772c0f07fd5e048f6e75a5f86ee079" ,
817+ recording_oracle_address = ' 0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef' ,
818+ reputation_oracle_address = ' 0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef' ,
819+ exchange_oracle_address = ' 0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef' ,
820+ recording_oracle_fee = 100 ,
821+ reputation_oracle_fee = 100 ,
822+ exchange_oracle_fee = 100 ,
823+ recording_oracle_url = ' https://example.com/recording' ,
824+ reputation_oracle_url = ' https://example.com/reputation' ,
825+ exchange_oracle_url = ' https://example.com/exchange' ,
826+ manifest_url = ' https://example.com/manifest' ,
827+ manifest_hash = ' 0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef'
828+ )
829+ escrow_client.setup(
830+ escrow_address,
831+ escrow_config
833832 )
834- escrow_client.setup(escrow_address, escrow_config)
835833 ```
834+ * ** Return type:**
835+ ` None `
836836
837837#### store_results(escrow_address, url, hash, tx_options=None)
838838
839- Stores the results url .
839+ Stores the results URL .
840840
841841* ** Parameters:**
842842 * ** escrow_address** (` str ` ) – Address of the escrow
843- * ** url** (` str ` ) – Results file url
843+ * ** url** (` str ` ) – Results file URL
844844 * ** hash** (` str ` ) – Results file hash
845845 * ** tx_options** (` Optional ` [ ` TxParams ` ] ) – (Optional) Additional transaction parameters
846846* ** Return type:**
@@ -859,8 +859,7 @@ Stores the results url.
859859 from human_protocol_sdk.escrow import EscrowClient
860860
861861 def get_w3_with_priv_key (priv_key : str ):
862- w3 = Web3(load_provider_from_uri(
863- URI(" http://localhost:8545" )))
862+ w3 = Web3(load_provider_from_uri(URI(" http://localhost:8545" )))
864863 gas_payer = w3.eth.account.from_key(priv_key)
865864 w3.eth.default_account = gas_payer.address
866865 w3.middleware_onion.add(
0 commit comments