@human-protocol/sdk 3.0.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/constants.d.ts +1 -1
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +2 -2
  4. package/dist/decorators.js +1 -1
  5. package/dist/encryption.d.ts +21 -29
  6. package/dist/encryption.d.ts.map +1 -1
  7. package/dist/encryption.js +17 -29
  8. package/dist/error.d.ts +31 -28
  9. package/dist/error.d.ts.map +1 -1
  10. package/dist/error.js +36 -33
  11. package/dist/escrow.d.ts +102 -59
  12. package/dist/escrow.d.ts.map +1 -1
  13. package/dist/escrow.js +186 -98
  14. package/dist/graphql/queries/operator.d.ts.map +1 -1
  15. package/dist/graphql/queries/operator.js +13 -5
  16. package/dist/interfaces.d.ts +10 -2
  17. package/dist/interfaces.d.ts.map +1 -1
  18. package/dist/kvstore.d.ts +15 -15
  19. package/dist/kvstore.d.ts.map +1 -1
  20. package/dist/kvstore.js +15 -15
  21. package/dist/operator.d.ts +11 -10
  22. package/dist/operator.d.ts.map +1 -1
  23. package/dist/operator.js +23 -11
  24. package/dist/staking.d.ts +38 -21
  25. package/dist/staking.d.ts.map +1 -1
  26. package/dist/staking.js +62 -21
  27. package/dist/statistics.d.ts +10 -29
  28. package/dist/statistics.d.ts.map +1 -1
  29. package/dist/statistics.js +10 -29
  30. package/dist/storage.d.ts +13 -18
  31. package/dist/storage.d.ts.map +1 -1
  32. package/dist/storage.js +13 -18
  33. package/dist/transaction.js +1 -1
  34. package/dist/types.d.ts +6 -2
  35. package/dist/types.d.ts.map +1 -1
  36. package/dist/types.js +1 -1
  37. package/dist/utils.d.ts +0 -1
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/utils.js +0 -1
  40. package/package.json +1 -1
  41. package/src/constants.ts +2 -2
  42. package/src/decorators.ts +1 -1
  43. package/src/encryption.ts +21 -29
  44. package/src/error.ts +39 -37
  45. package/src/escrow.ts +245 -117
  46. package/src/graphql/queries/operator.ts +13 -5
  47. package/src/interfaces.ts +11 -2
  48. package/src/kvstore.ts +16 -16
  49. package/src/operator.ts +26 -12
  50. package/src/staking.ts +71 -22
  51. package/src/statistics.ts +10 -29
  52. package/src/storage.ts +13 -18
  53. package/src/transaction.ts +2 -2
  54. package/src/types.ts +6 -2
  55. package/src/utils.ts +0 -1
package/dist/error.js CHANGED
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = exports.EthereumError = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.ErrorUrlIsEmptyString = exports.ErrorInvalidUrl = exports.ErrorStorageClientDoesNotExist = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = exports.ErrorCannotUseDateAndBlockSimultaneously = exports.ErrorInvalidHahsProvided = exports.ErrorInvalidStakerAddressProvided = exports.ErrorInvalidSlasherAddressProvided = exports.ErrorInvalidStakingValueSign = exports.ErrorInvalidStakingValueType = exports.ErrorStakingValueMustBePositive = exports.ErrorInvalidExchangeOracleAddressProvided = exports.ErrorInvalidReputationOracleAddressProvided = exports.ErrorInvalidRecordingOracleAddressProvided = exports.ErrorInvalidTokenAddress = exports.ErrorInvalidAddress = exports.ErrorKVStoreArrayLength = exports.ErrorKVStoreEmptyKey = exports.ErrorStorageFileNotUploaded = exports.ErrorStorageFileNotFound = exports.ErrorStorageBucketNotFound = exports.ErrorStorageCredentialsMissing = exports.ErrorStorageClientNotExists = exports.ErrorStorageClientNotInitialized = exports.ErrorStakingMissing = void 0;
4
- exports.InvalidKeyError = exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = exports.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = void 0;
3
+ exports.EthereumError = exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = exports.ErrorInvalidHash = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorTooManyRecipients = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.ErrorUrlIsEmptyString = exports.ErrorInvalidUrl = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = exports.ErrorCannotUseDateAndBlockSimultaneously = exports.ErrorInvalidHashProvided = exports.ErrorInvalidStakerAddressProvided = exports.ErrorInvalidSlasherAddressProvided = exports.ErrorInvalidStakingValueSign = exports.ErrorInvalidStakingValueType = exports.ErrorStakingValueMustBePositive = exports.ErrorInvalidExchangeOracleAddressProvided = exports.ErrorInvalidReputationOracleAddressProvided = exports.ErrorInvalidRecordingOracleAddressProvided = exports.ErrorInvalidTokenAddress = exports.ErrorInvalidAddress = exports.ErrorKVStoreArrayLength = exports.ErrorKVStoreEmptyKey = exports.ErrorStorageFileNotUploaded = exports.ErrorStorageFileNotFound = exports.ErrorStorageBucketNotFound = exports.ErrorStorageCredentialsMissing = exports.ErrorStorageClientNotExists = exports.ErrorStorageClientNotInitialized = exports.ErrorStakingMissing = void 0;
4
+ exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = void 0;
5
5
  /**
6
6
  * @constant {Error} - The Staking contract is missing.
7
7
  */
8
8
  exports.ErrorStakingMissing = new Error('Staking contract is missing');
9
9
  /**
10
- * @constant {Error} - The Storage client not initialised.
10
+ * @constant {Error} - The Storage client not initialized.
11
11
  */
12
12
  exports.ErrorStorageClientNotInitialized = new Error('Storage client not initialized');
13
13
  /**
14
- * @constant {Error} - The Storage does not exists.
14
+ * @constant {Error} - The Storage client does not exist.
15
15
  */
16
- exports.ErrorStorageClientNotExists = new Error('Storage client does not exists');
16
+ exports.ErrorStorageClientNotExists = new Error('Storage client does not exist');
17
17
  /**
18
- * @constant {Error} - The Storage credentials is missing.
18
+ * @constant {Error} - The Storage credentials are missing.
19
19
  */
20
- exports.ErrorStorageCredentialsMissing = new Error('Storage credentials is missing');
20
+ exports.ErrorStorageCredentialsMissing = new Error('Storage credentials are missing');
21
21
  /**
22
22
  * @constant {Error} - The Storage bucket not found.
23
23
  */
@@ -31,19 +31,19 @@ exports.ErrorStorageFileNotFound = new Error('File not found');
31
31
  */
32
32
  exports.ErrorStorageFileNotUploaded = new Error('File not uploaded');
33
33
  /**
34
- * @constant {Error} - The KVStore key can not be empty.
34
+ * @constant {Error} - The KVStore key cannot be empty.
35
35
  */
36
- exports.ErrorKVStoreEmptyKey = new Error('Key can not be empty');
36
+ exports.ErrorKVStoreEmptyKey = new Error('Key cannot be empty');
37
37
  /**
38
38
  * @constant {Error} - The KVStore arrays must have the same length.
39
39
  */
40
40
  exports.ErrorKVStoreArrayLength = new Error('Arrays must have the same length');
41
41
  /**
42
- * @constant {Error} - The Address sent is invalid.
42
+ * @constant {Error} - The address provided is invalid.
43
43
  */
44
44
  exports.ErrorInvalidAddress = new Error('Invalid address');
45
45
  /**
46
- * @constant {Error} - The token address sent is invalid.
46
+ * @constant {Error} - The token address provided is invalid.
47
47
  */
48
48
  exports.ErrorInvalidTokenAddress = new Error('Invalid token address');
49
49
  /**
@@ -55,11 +55,11 @@ exports.ErrorInvalidRecordingOracleAddressProvided = new Error('Invalid recordin
55
55
  */
56
56
  exports.ErrorInvalidReputationOracleAddressProvided = new Error('Invalid reputation oracle address provided');
57
57
  /**
58
- * @constant {Error} - Invalid reputation oracle address provided.
58
+ * @constant {Error} - Invalid exchange oracle address provided.
59
59
  */
60
60
  exports.ErrorInvalidExchangeOracleAddressProvided = new Error('Invalid exchange oracle address provided');
61
61
  /**
62
- * @constant {Error} - The Staking value must be positive.
62
+ * @constant {Error} - The staking value must be positive.
63
63
  */
64
64
  exports.ErrorStakingValueMustBePositive = new Error('Value must be positive');
65
65
  /**
@@ -81,7 +81,7 @@ exports.ErrorInvalidStakerAddressProvided = new Error('Invalid staker address pr
81
81
  /**
82
82
  * @constant {Error} - Invalid hash provided.
83
83
  */
84
- exports.ErrorInvalidHahsProvided = new Error('Invalid hash provided');
84
+ exports.ErrorInvalidHashProvided = new Error('Invalid hash provided');
85
85
  /**
86
86
  * @constant {Error} - Cannot use both date and block filters simultaneously.
87
87
  */
@@ -98,17 +98,20 @@ exports.ErrorStakingGetStakers = new Error('Error getting stakers data');
98
98
  * @constant {Error} - Failed to approve staking amount: signerOrProvider is not a Signer instance.
99
99
  */
100
100
  exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = new Error('Failed to approve staking amount: signerOrProvider is not a Signer instance');
101
+ /**
102
+ * @constant {Error} - Failed to check allowance.
103
+ */
101
104
  exports.ErrorFailedToCheckAllowance = new Error('Failed to check allowance');
102
105
  /**
103
106
  * @constant {Error} - The HMToken amount not approved.
104
107
  */
105
108
  exports.ErrorHMTokenAmountNotApproved = new Error('Amount not approved');
106
109
  /**
107
- * @constant {Error} - Init provider does not exists.
110
+ * @constant {Error} - Provider does not exist.
108
111
  */
109
112
  exports.ErrorProviderDoesNotExist = new Error('Provider does not exist');
110
113
  /**
111
- * @constant {Error} - Init with unsupported chain ID.
114
+ * @constant {Error} - Unsupported chain ID.
112
115
  */
113
116
  exports.ErrorUnsupportedChainID = new Error('Unsupported chain ID');
114
117
  /**
@@ -127,10 +130,6 @@ exports.ErrorTransferEventNotFoundInTransactionLogs = new Error('Transfer event
127
130
  * @constant {Error} - Manifest file does not exist.
128
131
  */
129
132
  exports.ErrorManifestFileDoesNotExist = new Error('Manifest file does not exist');
130
- /**
131
- * @constant {Error} - Storage client does not exist.
132
- */
133
- exports.ErrorStorageClientDoesNotExist = new Error('Storage client does not exist');
134
133
  /**
135
134
  * @constant {Error} - Invalid URL string.
136
135
  */
@@ -160,7 +159,11 @@ exports.ErrorTotalFeeMustBeLessThanHundred = new Error('Total fee must be less t
160
159
  */
161
160
  exports.ErrorRecipientCannotBeEmptyArray = new Error('Recipient cannot be an empty array');
162
161
  /**
163
- * @constant {Error} - Amount must be greater than zero..
162
+ * @constant {Error} - Too many recipients.
163
+ */
164
+ exports.ErrorTooManyRecipients = new Error('Too many recipients');
165
+ /**
166
+ * @constant {Error} - Amount must be greater than zero.
164
167
  */
165
168
  exports.ErrorAmountMustBeGreaterThanZero = new Error('Amount must be greater than zero');
166
169
  /**
@@ -183,6 +186,18 @@ exports.ErrorLaunchedEventIsNotEmitted = new Error('Launched event is not emitte
183
186
  * @constant {Error} - Hash is an empty string.
184
187
  */
185
188
  exports.ErrorHashIsEmptyString = new Error('Hash is an empty string');
189
+ /**
190
+ * @constant {Error} - The hash does not match.
191
+ */
192
+ exports.ErrorInvalidHash = new Error('Invalid hash');
193
+ /**
194
+ * @constant {Error} - The status is not supported.
195
+ */
196
+ exports.ErrorUnsupportedStatus = new Error('Unsupported status for query');
197
+ /**
198
+ * @constant {Warning} - The SUBGRAPH_API_KEY is not being provided.
199
+ */
200
+ exports.WarnSubgraphApiKeyNotProvided = '"SUBGRAPH_API_KEY" is not being provided. It might cause issues with the subgraph.';
186
201
  class EthereumError extends Error {
187
202
  constructor(message) {
188
203
  super(`An error occurred while interacting with Ethereum: ${message}`);
@@ -231,18 +246,6 @@ class InvalidEthereumAddressError extends Error {
231
246
  }
232
247
  }
233
248
  exports.InvalidEthereumAddressError = InvalidEthereumAddressError;
234
- /**
235
- * @constant {Error} - The Hash does not match
236
- */
237
- exports.ErrorInvalidHash = new Error('Invalid hash');
238
- /**
239
- * @constant {Error} - The Status is not supported
240
- */
241
- exports.ErrorUnsupportedStatus = new Error('Unsupported status for query');
242
- /**
243
- * @constant {Error} - The SUBGRAPH_API_KEY is not being provided
244
- */
245
- exports.WarnSubgraphApiKeyNotProvided = '"SUBGRAPH_API_KEY" is not being provided. It might cause issues with the subgraph.';
246
249
  class InvalidKeyError extends Error {
247
250
  constructor(key, address) {
248
251
  super(`Key "${key}" not found for address ${address}`);
package/dist/escrow.d.ts CHANGED
@@ -3,23 +3,23 @@ import { BaseEthersClient } from './base';
3
3
  import { ChainId, OrderDirection } from './enums';
4
4
  import { EscrowData, StatusEvent } from './graphql';
5
5
  import { IEscrowConfig, IEscrowsFilter } from './interfaces';
6
- import { EscrowCancel, EscrowStatus, EscrowWithdraw, NetworkData } from './types';
6
+ import { EscrowCancel, EscrowStatus, EscrowWithdraw, NetworkData, TransactionLikeWithNonce } from './types';
7
7
  /**
8
8
  * ## Introduction
9
9
  *
10
- * This client enables to perform actions on Escrow contracts and obtain information from both the contracts and subgraph.
10
+ * This client enables performing actions on Escrow contracts and obtaining information from both the contracts and subgraph.
11
11
  *
12
12
  * Internally, the SDK will use one network or another according to the network ID of the `runner`.
13
13
  * To use this client, it is recommended to initialize it using the static `build` method.
14
14
  *
15
15
  * ```ts
16
- * static async build(runner: ContractRunner);
16
+ * static async build(runner: ContractRunner): Promise<EscrowClient>;
17
17
  * ```
18
18
  *
19
19
  * A `Signer` or a `Provider` should be passed depending on the use case of this module:
20
20
  *
21
- * - **Signer**: when the user wants to use this model in order to send transactions caling the contract functions.
22
- * - **Provider**: when the user wants to use this model in order to get information from the contracts or subgraph.
21
+ * - **Signer**: when the user wants to use this model to send transactions calling the contract functions.
22
+ * - **Provider**: when the user wants to use this model to get information from the contracts or subgraph.
23
23
  *
24
24
  * ## Installation
25
25
  *
@@ -37,21 +37,21 @@ import { EscrowCancel, EscrowStatus, EscrowWithdraw, NetworkData } from './types
37
37
  *
38
38
  * ### Signer
39
39
  *
40
- * **Using private key(backend)**
40
+ * **Using private key (backend)**
41
41
  *
42
42
  * ```ts
43
43
  * import { EscrowClient } from '@human-protocol/sdk';
44
44
  * import { Wallet, providers } from 'ethers';
45
45
  *
46
46
  * const rpcUrl = 'YOUR_RPC_URL';
47
- * const privateKey = 'YOUR_PRIVATE_KEY'
47
+ * const privateKey = 'YOUR_PRIVATE_KEY';
48
48
  *
49
49
  * const provider = new providers.JsonRpcProvider(rpcUrl);
50
50
  * const signer = new Wallet(privateKey, provider);
51
51
  * const escrowClient = await EscrowClient.build(signer);
52
52
  * ```
53
53
  *
54
- * **Using Wagmi(frontend)**
54
+ * **Using Wagmi (frontend)**
55
55
  *
56
56
  * ```ts
57
57
  * import { useSigner, useChainId } from 'wagmi';
@@ -101,11 +101,11 @@ export declare class EscrowClient extends BaseEthersClient {
101
101
  /**
102
102
  * This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
103
103
  *
104
- * @param {string} tokenAddress Token address to use for pay outs.
104
+ * @param {string} tokenAddress Token address to use for payouts.
105
105
  * @param {string[]} trustedHandlers Array of addresses that can perform actions on the contract.
106
106
  * @param {string} jobRequesterId Job Requester Id
107
107
  * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
108
- * @returns {Promise<string>} Return the address of the escrow created.
108
+ * @returns {Promise<string>} Returns the address of the escrow created.
109
109
  *
110
110
  *
111
111
  * **Code example**
@@ -117,7 +117,7 @@ export declare class EscrowClient extends BaseEthersClient {
117
117
  * import { EscrowClient } from '@human-protocol/sdk';
118
118
  *
119
119
  * const rpcUrl = 'YOUR_RPC_URL';
120
- * const privateKey = 'YOUR_PRIVATE_KEY'
120
+ * const privateKey = 'YOUR_PRIVATE_KEY';
121
121
  *
122
122
  * const provider = new providers.JsonRpcProvider(rpcUrl);
123
123
  * const signer = new Wallet(privateKey, provider);
@@ -148,7 +148,7 @@ export declare class EscrowClient extends BaseEthersClient {
148
148
  * import { EscrowClient } from '@human-protocol/sdk';
149
149
  *
150
150
  * const rpcUrl = 'YOUR_RPC_URL';
151
- * const privateKey = 'YOUR_PRIVATE_KEY'
151
+ * const privateKey = 'YOUR_PRIVATE_KEY';
152
152
  *
153
153
  * const provider = new providers.JsonRpcProvider(rpcUrl);
154
154
  * const signer = new Wallet(privateKey, provider);
@@ -159,10 +159,10 @@ export declare class EscrowClient extends BaseEthersClient {
159
159
  * recordingOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
160
160
  * reputationOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
161
161
  * exchangeOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
162
- * recordingOracleFee: bigint.from('10'),
163
- * reputationOracleFee: bigint.from('10'),
164
- * exchangeOracleFee: bigint.from('10'),
165
- * manifestUrl: 'htttp://localhost/manifest.json',
162
+ * recordingOracleFee: BigInt('10'),
163
+ * reputationOracleFee: BigInt('10'),
164
+ * exchangeOracleFee: BigInt('10'),
165
+ * manifestUrl: 'http://localhost/manifest.json',
166
166
  * manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
167
167
  * };
168
168
  * await escrowClient.setup(escrowAddress, escrowConfig);
@@ -185,7 +185,7 @@ export declare class EscrowClient extends BaseEthersClient {
185
185
  * import { EscrowClient } from '@human-protocol/sdk';
186
186
  *
187
187
  * const rpcUrl = 'YOUR_RPC_URL';
188
- * const privateKey = 'YOUR_PRIVATE_KEY'
188
+ * const privateKey = 'YOUR_PRIVATE_KEY';
189
189
  *
190
190
  * const provider = new providers.JsonRpcProvider(rpcUrl);
191
191
  * const signer = new Wallet(privateKey, provider);
@@ -197,10 +197,10 @@ export declare class EscrowClient extends BaseEthersClient {
197
197
  */
198
198
  fund(escrowAddress: string, amount: bigint, txOptions?: Overrides): Promise<void>;
199
199
  /**
200
- * This function stores the results url and hash.
200
+ * This function stores the results URL and hash.
201
201
  *
202
202
  * @param {string} escrowAddress Address of the escrow.
203
- * @param {string} url Results file url.
203
+ * @param {string} url Results file URL.
204
204
  * @param {string} hash Results file hash.
205
205
  * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
206
206
  * @returns Returns void if successful. Throws error if any.
@@ -215,13 +215,13 @@ export declare class EscrowClient extends BaseEthersClient {
215
215
  * import { EscrowClient } from '@human-protocol/sdk';
216
216
  *
217
217
  * const rpcUrl = 'YOUR_RPC_URL';
218
- * const privateKey = 'YOUR_PRIVATE_KEY'
218
+ * const privateKey = 'YOUR_PRIVATE_KEY';
219
219
  *
220
220
  * const provider = new providers.JsonRpcProvider(rpcUrl);
221
221
  * const signer = new Wallet(privateKey, provider);
222
222
  * const escrowClient = await EscrowClient.build(signer);
223
223
  *
224
- * await storeResults.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'http://localhost/results.json', 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079');
224
+ * await escrowClient.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'http://localhost/results.json', 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079');
225
225
  * ```
226
226
  */
227
227
  storeResults(escrowAddress: string, url: string, hash: string, txOptions?: Overrides): Promise<void>;
@@ -242,7 +242,7 @@ export declare class EscrowClient extends BaseEthersClient {
242
242
  * import { EscrowClient } from '@human-protocol/sdk';
243
243
  *
244
244
  * const rpcUrl = 'YOUR_RPC_URL';
245
- * const privateKey = 'YOUR_PRIVATE_KEY'
245
+ * const privateKey = 'YOUR_PRIVATE_KEY';
246
246
  *
247
247
  * const provider = new providers.JsonRpcProvider(rpcUrl);
248
248
  * const signer = new Wallet(privateKey, provider);
@@ -258,9 +258,10 @@ export declare class EscrowClient extends BaseEthersClient {
258
258
  * @param {string} escrowAddress Escrow address to payout.
259
259
  * @param {string[]} recipients Array of recipient addresses.
260
260
  * @param {bigint[]} amounts Array of amounts the recipients will receive.
261
- * @param {string} finalResultsUrl Final results file url.
261
+ * @param {string} finalResultsUrl Final results file URL.
262
262
  * @param {string} finalResultsHash Final results file hash.
263
- * @param {string} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false).
263
+ * @param {number} txId Transaction ID.
264
+ * @param {boolean} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false).
264
265
  * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
265
266
  * @returns Returns void if successful. Throws error if any.
266
267
  *
@@ -274,7 +275,7 @@ export declare class EscrowClient extends BaseEthersClient {
274
275
  * import { EscrowClient } from '@human-protocol/sdk';
275
276
  *
276
277
  * const rpcUrl = 'YOUR_RPC_URL';
277
- * const privateKey = 'YOUR_PRIVATE_KEY'
278
+ * const privateKey = 'YOUR_PRIVATE_KEY';
278
279
  *
279
280
  * const provider = new providers.JsonRpcProvider(rpcUrl);
280
281
  * const signer = new Wallet(privateKey, provider);
@@ -283,12 +284,13 @@ export declare class EscrowClient extends BaseEthersClient {
283
284
  * const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
284
285
  * const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')];
285
286
  * const resultsUrl = 'http://localhost/results.json';
286
- * const resultsHash'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
287
+ * const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
288
+ * const txId = 1;
287
289
  *
288
- * await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash);
290
+ * await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash, txId);
289
291
  * ```
290
292
  */
291
- bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, forceComplete?: boolean, txOptions?: Overrides): Promise<void>;
293
+ bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, txId: number, forceComplete?: boolean, txOptions?: Overrides): Promise<void>;
292
294
  /**
293
295
  * This function cancels the specified escrow and sends the balance to the canceler.
294
296
  *
@@ -306,7 +308,7 @@ export declare class EscrowClient extends BaseEthersClient {
306
308
  * import { EscrowClient } from '@human-protocol/sdk';
307
309
  *
308
310
  * const rpcUrl = 'YOUR_RPC_URL';
309
- * const privateKey = 'YOUR_PRIVATE_KEY'
311
+ * const privateKey = 'YOUR_PRIVATE_KEY';
310
312
  *
311
313
  * const provider = new providers.JsonRpcProvider(rpcUrl);
312
314
  * const signer = new Wallet(privateKey, provider);
@@ -334,13 +336,13 @@ export declare class EscrowClient extends BaseEthersClient {
334
336
  * import { EscrowClient } from '@human-protocol/sdk';
335
337
  *
336
338
  * const rpcUrl = 'YOUR_RPC_URL';
337
- * const privateKey = 'YOUR_PRIVATE_KEY'
339
+ * const privateKey = 'YOUR_PRIVATE_KEY';
338
340
  *
339
341
  * const provider = new providers.JsonRpcProvider(rpcUrl);
340
342
  * const signer = new Wallet(privateKey, provider);
341
343
  * const escrowClient = await EscrowClient.build(signer);
342
344
  *
343
- * const trustedHandlers = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']
345
+ * const trustedHandlers = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
344
346
  * await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309f', trustedHandlers);
345
347
  * ```
346
348
  */
@@ -363,7 +365,7 @@ export declare class EscrowClient extends BaseEthersClient {
363
365
  * import { EscrowClient } from '@human-protocol/sdk';
364
366
  *
365
367
  * const rpcUrl = 'YOUR_RPC_URL';
366
- * const privateKey = 'YOUR_PRIVATE_KEY'
368
+ * const privateKey = 'YOUR_PRIVATE_KEY';
367
369
  *
368
370
  * const provider = new providers.JsonRpcProvider(rpcUrl);
369
371
  * const signer = new Wallet(privateKey, provider);
@@ -376,11 +378,53 @@ export declare class EscrowClient extends BaseEthersClient {
376
378
  * ```
377
379
  */
378
380
  withdraw(escrowAddress: string, tokenAddress: string, txOptions?: Overrides): Promise<EscrowWithdraw>;
381
+ /**
382
+ * Creates a prepared transaction for bulk payout without immediately sending it.
383
+ * @param {string} escrowAddress Escrow address to payout.
384
+ * @param {string[]} recipients Array of recipient addresses.
385
+ * @param {bigint[]} amounts Array of amounts the recipients will receive.
386
+ * @param {string} finalResultsUrl Final results file URL.
387
+ * @param {string} finalResultsHash Final results file hash.
388
+ * @param {number} txId Transaction ID.
389
+ * @param {boolean} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false).
390
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
391
+ * @returns Returns object with raw transaction and signed transaction hash
392
+ *
393
+ * **Code example**
394
+ *
395
+ * > Only Reputation Oracle or a trusted handler can call it.
396
+ *
397
+ * ```ts
398
+ * import { ethers, Wallet, providers } from 'ethers';
399
+ * import { EscrowClient } from '@human-protocol/sdk';
400
+ *
401
+ * const rpcUrl = 'YOUR_RPC_URL';
402
+ * const privateKey = 'YOUR_PRIVATE_KEY'
403
+ *
404
+ * const provider = new providers.JsonRpcProvider(rpcUrl);
405
+ * const signer = new Wallet(privateKey, provider);
406
+ * const escrowClient = await EscrowClient.build(signer);
407
+ *
408
+ * const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
409
+ * const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')];
410
+ * const resultsUrl = 'http://localhost/results.json';
411
+ * const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
412
+ * const txId = 1;
413
+ *
414
+ * const rawTransaction = await escrowClient.createBulkPayoutTransaction('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash, txId);
415
+ * console.log('Raw transaction:', rawTransaction);
416
+ *
417
+ * const signedTransaction = await signer.signTransaction(rawTransaction);
418
+ * console.log('Tx hash:', ethers.keccak256(signedTransaction));
419
+ * (await signer.sendTransaction(rawTransaction)).wait();
420
+ */
421
+ createBulkPayoutTransaction(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, txId: number, forceComplete?: boolean, txOptions?: Overrides): Promise<TransactionLikeWithNonce>;
422
+ private ensureCorrectBulkPayoutInput;
379
423
  /**
380
424
  * This function returns the balance for a specified escrow address.
381
425
  *
382
426
  * @param {string} escrowAddress Address of the escrow.
383
- * @returns {bigint} Balance of the escrow in the token used to fund it.
427
+ * @returns {Promise<bigint>} Balance of the escrow in the token used to fund it.
384
428
  *
385
429
  * **Code example**
386
430
  *
@@ -391,7 +435,7 @@ export declare class EscrowClient extends BaseEthersClient {
391
435
  * const rpcUrl = 'YOUR_RPC_URL';
392
436
  *
393
437
  * const provider = new providers.JsonRpcProvider(rpcUrl);
394
- * const escrowClient = await EscrowClient.build(signer);
438
+ * const escrowClient = await EscrowClient.build(provider);
395
439
  *
396
440
  * const balance = await escrowClient.getBalance('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
397
441
  * ```
@@ -401,7 +445,7 @@ export declare class EscrowClient extends BaseEthersClient {
401
445
  * This function returns the manifest file hash.
402
446
  *
403
447
  * @param {string} escrowAddress Address of the escrow.
404
- * @returns {string} Hash of the manifest file content.
448
+ * @returns {Promise<string>} Hash of the manifest file content.
405
449
  *
406
450
  * **Code example**
407
451
  *
@@ -412,7 +456,7 @@ export declare class EscrowClient extends BaseEthersClient {
412
456
  * const rpcUrl = 'YOUR_RPC_URL';
413
457
  *
414
458
  * const provider = new providers.JsonRpcProvider(rpcUrl);
415
- * const escrowClient = await EscrowClient.build(signer);
459
+ * const escrowClient = await EscrowClient.build(provider);
416
460
  *
417
461
  * const manifestHash = await escrowClient.getManifestHash('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
418
462
  * ```
@@ -422,7 +466,7 @@ export declare class EscrowClient extends BaseEthersClient {
422
466
  * This function returns the manifest file URL.
423
467
  *
424
468
  * @param {string} escrowAddress Address of the escrow.
425
- * @returns {string} Url of the manifest.
469
+ * @returns {Promise<string>} Url of the manifest.
426
470
  *
427
471
  * **Code example**
428
472
  *
@@ -433,7 +477,7 @@ export declare class EscrowClient extends BaseEthersClient {
433
477
  * const rpcUrl = 'YOUR_RPC_URL';
434
478
  *
435
479
  * const provider = new providers.JsonRpcProvider(rpcUrl);
436
- * const escrowClient = await EscrowClient.build(signer);
480
+ * const escrowClient = await EscrowClient.build(provider);
437
481
  *
438
482
  * const manifestUrl = await escrowClient.getManifestUrl('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
439
483
  * ```
@@ -443,7 +487,7 @@ export declare class EscrowClient extends BaseEthersClient {
443
487
  * This function returns the results file URL.
444
488
  *
445
489
  * @param {string} escrowAddress Address of the escrow.
446
- * @returns {string} Results file url.
490
+ * @returns {Promise<string>} Results file url.
447
491
  *
448
492
  * **Code example**
449
493
  *
@@ -454,7 +498,7 @@ export declare class EscrowClient extends BaseEthersClient {
454
498
  * const rpcUrl = 'YOUR_RPC_URL';
455
499
  *
456
500
  * const provider = new providers.JsonRpcProvider(rpcUrl);
457
- * const escrowClient = await EscrowClient.build(signer);
501
+ * const escrowClient = await EscrowClient.build(provider);
458
502
  *
459
503
  * const resultsUrl = await escrowClient.getResultsUrl('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
460
504
  * ```
@@ -464,7 +508,7 @@ export declare class EscrowClient extends BaseEthersClient {
464
508
  * This function returns the intermediate results file URL.
465
509
  *
466
510
  * @param {string} escrowAddress Address of the escrow.
467
- * @returns {string} Url of the file that store results from Recording Oracle.
511
+ * @returns {Promise<string>} Url of the file that store results from Recording Oracle.
468
512
  *
469
513
  * **Code example**
470
514
  *
@@ -475,9 +519,9 @@ export declare class EscrowClient extends BaseEthersClient {
475
519
  * const rpcUrl = 'YOUR_RPC_URL';
476
520
  *
477
521
  * const provider = new providers.JsonRpcProvider(rpcUrl);
478
- * const escrowClient = await EscrowClient.build(signer);
522
+ * const escrowClient = await EscrowClient.build(provider);
479
523
  *
480
- * const intemediateResultsUrl = await escrowClient.getIntermediateResultsUrl('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
524
+ * const intermediateResultsUrl = await escrowClient.getIntermediateResultsUrl('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
481
525
  * ```
482
526
  */
483
527
  getIntermediateResultsUrl(escrowAddress: string): Promise<string>;
@@ -485,7 +529,7 @@ export declare class EscrowClient extends BaseEthersClient {
485
529
  * This function returns the token address used for funding the escrow.
486
530
  *
487
531
  * @param {string} escrowAddress Address of the escrow.
488
- * @returns {string} Address of the token used to fund the escrow.
532
+ * @returns {Promise<string>} Address of the token used to fund the escrow.
489
533
  *
490
534
  * **Code example**
491
535
  *
@@ -496,7 +540,7 @@ export declare class EscrowClient extends BaseEthersClient {
496
540
  * const rpcUrl = 'YOUR_RPC_URL';
497
541
  *
498
542
  * const provider = new providers.JsonRpcProvider(rpcUrl);
499
- * const escrowClient = await EscrowClient.build(signer);
543
+ * const escrowClient = await EscrowClient.build(provider);
500
544
  *
501
545
  * const tokenAddress = await escrowClient.getTokenAddress('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
502
546
  * ```
@@ -506,7 +550,7 @@ export declare class EscrowClient extends BaseEthersClient {
506
550
  * This function returns the current status of the escrow.
507
551
  *
508
552
  * @param {string} escrowAddress Address of the escrow.
509
- * @returns {EscrowStatus} Current status of the escrow.
553
+ * @returns {Promise<EscrowStatus>} Current status of the escrow.
510
554
  *
511
555
  * **Code example**
512
556
  *
@@ -517,7 +561,7 @@ export declare class EscrowClient extends BaseEthersClient {
517
561
  * const rpcUrl = 'YOUR_RPC_URL';
518
562
  *
519
563
  * const provider = new providers.JsonRpcProvider(rpcUrl);
520
- * const escrowClient = await EscrowClient.build(signer);
564
+ * const escrowClient = await EscrowClient.build(provider);
521
565
  *
522
566
  * const status = await escrowClient.getStatus('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
523
567
  * ```
@@ -527,7 +571,7 @@ export declare class EscrowClient extends BaseEthersClient {
527
571
  * This function returns the recording oracle address for a given escrow.
528
572
  *
529
573
  * @param {string} escrowAddress Address of the escrow.
530
- * @returns {string} Address of the Recording Oracle.
574
+ * @returns {Promise<string>} Address of the Recording Oracle.
531
575
  *
532
576
  * **Code example**
533
577
  *
@@ -538,7 +582,7 @@ export declare class EscrowClient extends BaseEthersClient {
538
582
  * const rpcUrl = 'YOUR_RPC_URL';
539
583
  *
540
584
  * const provider = new providers.JsonRpcProvider(rpcUrl);
541
- * const escrowClient = await EscrowClient.build(signer);
585
+ * const escrowClient = await EscrowClient.build(provider);
542
586
  *
543
587
  * const oracleAddress = await escrowClient.getRecordingOracleAddress('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
544
588
  * ```
@@ -548,7 +592,7 @@ export declare class EscrowClient extends BaseEthersClient {
548
592
  * This function returns the job launcher address for a given escrow.
549
593
  *
550
594
  * @param {string} escrowAddress Address of the escrow.
551
- * @returns {string} Address of the Job Launcher.
595
+ * @returns {Promise<string>} Address of the Job Launcher.
552
596
  *
553
597
  * **Code example**
554
598
  *
@@ -559,7 +603,7 @@ export declare class EscrowClient extends BaseEthersClient {
559
603
  * const rpcUrl = 'YOUR_RPC_URL';
560
604
  *
561
605
  * const provider = new providers.JsonRpcProvider(rpcUrl);
562
- * const escrowClient = await EscrowClient.build(signer);
606
+ * const escrowClient = await EscrowClient.build(provider);
563
607
  *
564
608
  * const jobLauncherAddress = await escrowClient.getJobLauncherAddress('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
565
609
  * ```
@@ -569,7 +613,7 @@ export declare class EscrowClient extends BaseEthersClient {
569
613
  * This function returns the reputation oracle address for a given escrow.
570
614
  *
571
615
  * @param {string} escrowAddress Address of the escrow.
572
- * @returns {EscrowStatus} Address of the Reputation Oracle.
616
+ * @returns {Promise<string>} Address of the Reputation Oracle.
573
617
  *
574
618
  * **Code example**
575
619
  *
@@ -580,7 +624,7 @@ export declare class EscrowClient extends BaseEthersClient {
580
624
  * const rpcUrl = 'YOUR_RPC_URL';
581
625
  *
582
626
  * const provider = new providers.JsonRpcProvider(rpcUrl);
583
- * const escrowClient = await EscrowClient.build(signer);
627
+ * const escrowClient = await EscrowClient.build(provider);
584
628
  *
585
629
  * const oracleAddress = await escrowClient.getReputationOracleAddress('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
586
630
  * ```
@@ -590,7 +634,7 @@ export declare class EscrowClient extends BaseEthersClient {
590
634
  * This function returns the exchange oracle address for a given escrow.
591
635
  *
592
636
  * @param {string} escrowAddress Address of the escrow.
593
- * @returns {EscrowStatus} Address of the Exchange Oracle.
637
+ * @returns {Promise<string>} Address of the Exchange Oracle.
594
638
  *
595
639
  * **Code example**
596
640
  *
@@ -601,7 +645,7 @@ export declare class EscrowClient extends BaseEthersClient {
601
645
  * const rpcUrl = 'YOUR_RPC_URL';
602
646
  *
603
647
  * const provider = new providers.JsonRpcProvider(rpcUrl);
604
- * const escrowClient = await EscrowClient.build(signer);
648
+ * const escrowClient = await EscrowClient.build(provider);
605
649
  *
606
650
  * const oracleAddress = await escrowClient.getExchangeOracleAddress('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
607
651
  * ```
@@ -611,7 +655,7 @@ export declare class EscrowClient extends BaseEthersClient {
611
655
  * This function returns the escrow factory address for a given escrow.
612
656
  *
613
657
  * @param {string} escrowAddress Address of the escrow.
614
- * @returns {EscrowStatus} Address of the escrow factory.
658
+ * @returns {Promise<string>} Address of the escrow factory.
615
659
  *
616
660
  * **Code example**
617
661
  *
@@ -622,7 +666,7 @@ export declare class EscrowClient extends BaseEthersClient {
622
666
  * const rpcUrl = 'YOUR_RPC_URL';
623
667
  *
624
668
  * const provider = new providers.JsonRpcProvider(rpcUrl);
625
- * const escrowClient = await EscrowClient.build(signer);
669
+ * const escrowClient = await EscrowClient.build(provider);
626
670
  *
627
671
  * const factoryAddress = await escrowClient.getFactoryAddress('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
628
672
  * ```
@@ -656,7 +700,7 @@ export declare class EscrowClient extends BaseEthersClient {
656
700
  * import { ChainId, EscrowUtils } from '@human-protocol/sdk';
657
701
  *
658
702
  * const escrowAddresses = new EscrowUtils.getEscrows({
659
- * network: ChainId.POLYGON_AMOY
703
+ * chainId: ChainId.POLYGON_AMOY
660
704
  * });
661
705
  * ```
662
706
  */
@@ -701,7 +745,6 @@ export declare class EscrowUtils {
701
745
  * AVALANCHE_TESTNET = 43113,
702
746
  * CELO = 42220,
703
747
  * CELO_ALFAJORES = 44787,
704
- * = 1273227453,
705
748
  * LOCALHOST = 1338,
706
749
  * }
707
750
  * ```