@human-protocol/sdk 1.0.2 → 1.0.3
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.
- package/README.md +1 -1
- package/dist/constants.d.ts +46 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +203 -0
- package/dist/decorators.d.ts +2 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/decorators.js +17 -0
- package/dist/enums.d.ts +17 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +20 -0
- package/dist/error.d.ts +196 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +229 -0
- package/dist/escrow.d.ts +176 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +590 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/init.d.ts +13 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +35 -0
- package/dist/interfaces.d.ts +44 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +2 -0
- package/dist/kvstore.d.ts +40 -0
- package/dist/kvstore.d.ts.map +1 -0
- package/dist/kvstore.js +106 -0
- package/dist/queries.d.ts +4 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +22 -0
- package/dist/staking.d.ts +121 -0
- package/dist/staking.d.ts.map +1 -0
- package/dist/staking.js +381 -0
- package/dist/storage.d.ts +48 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +164 -0
- package/dist/types.d.ts +123 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +35 -0
- package/dist/utils.d.ts +32 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +99 -0
- package/package.json +4 -7
- package/src/constants.ts +221 -4
- package/src/decorators.ts +21 -0
- package/src/enums.ts +16 -0
- package/src/error.ts +295 -18
- package/src/escrow.ts +754 -0
- package/src/index.ts +14 -1
- package/src/init.ts +45 -0
- package/src/interfaces.ts +50 -0
- package/src/kvstore.ts +93 -0
- package/src/queries.ts +18 -0
- package/src/staking.ts +421 -0
- package/src/storage.ts +159 -131
- package/src/types.ts +36 -586
- package/src/utils.ts +80 -142
- package/test/escrow.test.ts +1339 -0
- package/test/init.test.ts +88 -0
- package/test/kvstore.test.ts +208 -0
- package/test/staking.test.ts +640 -0
- package/test/storage.test.ts +422 -0
- package/test/utils/constants.ts +38 -1
- package/example/simple-existing-job.ts +0 -86
- package/example/simple-new-job-public.ts +0 -74
- package/example/simple-new-job.ts +0 -72
- package/src/job.ts +0 -977
- package/src/logger.ts +0 -29
- package/test/job.test.ts +0 -716
- package/test/utils/manifest.ts +0 -33
package/dist/error.js
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.UnpredictableGasLimit = exports.OutOfGasError = 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.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorInitUnsupportedChainID = exports.ErrorInitProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = exports.ErrorInvalidStakerAddressProvided = exports.ErrorInvalidSlasherAddressProvided = exports.ErrorInvalidStakingValueSign = exports.ErrorInvalidStakingValueType = exports.ErrorStakingValueMustBePositive = 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.InvalidEthereumAddressError = exports.ContractExecutionError = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* @constant {Error} - The Staking contract is missing.
|
|
7
|
+
*/
|
|
8
|
+
exports.ErrorStakingMissing = new Error('Staking contract is missing');
|
|
9
|
+
/**
|
|
10
|
+
* @constant {Error} - The Storage client not initialised.
|
|
11
|
+
*/
|
|
12
|
+
exports.ErrorStorageClientNotInitialized = new Error('Storage client not initialized');
|
|
13
|
+
/**
|
|
14
|
+
* @constant {Error} - The Storage does not exists.
|
|
15
|
+
*/
|
|
16
|
+
exports.ErrorStorageClientNotExists = new Error('Storage client does not exists');
|
|
17
|
+
/**
|
|
18
|
+
* @constant {Error} - The Storage credentials is missing.
|
|
19
|
+
*/
|
|
20
|
+
exports.ErrorStorageCredentialsMissing = new Error('Storage credentials is missing');
|
|
21
|
+
/**
|
|
22
|
+
* @constant {Error} - The Storage bucket not found.
|
|
23
|
+
*/
|
|
24
|
+
exports.ErrorStorageBucketNotFound = new Error('Bucket not found');
|
|
25
|
+
/**
|
|
26
|
+
* @constant {Error} - The Storage file not found.
|
|
27
|
+
*/
|
|
28
|
+
exports.ErrorStorageFileNotFound = new Error('File not found');
|
|
29
|
+
/**
|
|
30
|
+
* @constant {Error} - The Storage file not uploaded.
|
|
31
|
+
*/
|
|
32
|
+
exports.ErrorStorageFileNotUploaded = new Error('File not uploaded');
|
|
33
|
+
/**
|
|
34
|
+
* @constant {Error} - The KVStore key can not be empty.
|
|
35
|
+
*/
|
|
36
|
+
exports.ErrorKVStoreEmptyKey = new Error('Key can not be empty');
|
|
37
|
+
/**
|
|
38
|
+
* @constant {Error} - The KVStore arrays must have the same length.
|
|
39
|
+
*/
|
|
40
|
+
exports.ErrorKVStoreArrayLength = new Error('Arrays must have the same length');
|
|
41
|
+
/**
|
|
42
|
+
* @constant {Error} - The Address sent is invalid.
|
|
43
|
+
*/
|
|
44
|
+
exports.ErrorInvalidAddress = new Error('Invalid address');
|
|
45
|
+
/**
|
|
46
|
+
* @constant {Error} - The token address sent is invalid.
|
|
47
|
+
*/
|
|
48
|
+
exports.ErrorInvalidTokenAddress = new Error('Invalid token address');
|
|
49
|
+
/**
|
|
50
|
+
* @constant {Error} - Invalid recording oracle address provided.
|
|
51
|
+
*/
|
|
52
|
+
exports.ErrorInvalidRecordingOracleAddressProvided = new Error('Invalid recording oracle address provided');
|
|
53
|
+
/**
|
|
54
|
+
* @constant {Error} - Invalid reputation oracle address provided.
|
|
55
|
+
*/
|
|
56
|
+
exports.ErrorInvalidReputationOracleAddressProvided = new Error('Invalid reputation oracle address provided');
|
|
57
|
+
/**
|
|
58
|
+
* @constant {Error} - The Staking value must be positive.
|
|
59
|
+
*/
|
|
60
|
+
exports.ErrorStakingValueMustBePositive = new Error('Value must be positive');
|
|
61
|
+
/**
|
|
62
|
+
* @constant {Error} - Invalid staking value: amount must be a BigNumber.
|
|
63
|
+
*/
|
|
64
|
+
exports.ErrorInvalidStakingValueType = new Error('Invalid staking value: amount must be a BigNumber');
|
|
65
|
+
/**
|
|
66
|
+
* @constant {Error} - Invalid staking value: amount must be positive.
|
|
67
|
+
*/
|
|
68
|
+
exports.ErrorInvalidStakingValueSign = new Error('Invalid staking value: amount must be positive');
|
|
69
|
+
/**
|
|
70
|
+
* @constant {Error} - Invalid slasher address provided.
|
|
71
|
+
*/
|
|
72
|
+
exports.ErrorInvalidSlasherAddressProvided = new Error('Invalid slasher address provided');
|
|
73
|
+
/**
|
|
74
|
+
* @constant {Error} - Invalid staker address provided.
|
|
75
|
+
*/
|
|
76
|
+
exports.ErrorInvalidStakerAddressProvided = new Error('Invalid staker address provided');
|
|
77
|
+
/**
|
|
78
|
+
* @constant {Error} - Invalid escrow address provided.
|
|
79
|
+
*/
|
|
80
|
+
exports.ErrorInvalidEscrowAddressProvided = new Error('Invalid escrow address provided');
|
|
81
|
+
/**
|
|
82
|
+
* @constant {Error} - Error getting stakers data.
|
|
83
|
+
*/
|
|
84
|
+
exports.ErrorStakingGetStakers = new Error('Error getting stakers data');
|
|
85
|
+
/**
|
|
86
|
+
* @constant {Error} - Failed to approve staking amount: signerOrProvider is not a Signer instance.
|
|
87
|
+
*/
|
|
88
|
+
exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = new Error('Failed to approve staking amount: signerOrProvider is not a Signer instance');
|
|
89
|
+
exports.ErrorFailedToCheckAllowance = new Error('Failed to check allowance');
|
|
90
|
+
/**
|
|
91
|
+
* @constant {Error} - The HMToken amount not approved.
|
|
92
|
+
*/
|
|
93
|
+
exports.ErrorHMTokenAmountNotApproved = new Error('Amount not approved');
|
|
94
|
+
/**
|
|
95
|
+
* @constant {Error} - Init provider does not exists.
|
|
96
|
+
*/
|
|
97
|
+
exports.ErrorInitProviderDoesNotExist = new Error('Provider does not exist');
|
|
98
|
+
/**
|
|
99
|
+
* @constant {Error} - Init with unsupported chain ID.
|
|
100
|
+
*/
|
|
101
|
+
exports.ErrorInitUnsupportedChainID = new Error('Unsupported chain ID');
|
|
102
|
+
/**
|
|
103
|
+
* @constant {Error} - Sending a transaction requires a signer.
|
|
104
|
+
*/
|
|
105
|
+
exports.ErrorSigner = new Error('Signer required');
|
|
106
|
+
/**
|
|
107
|
+
* @constant {Error} - Escrow address is not provided by the factory.
|
|
108
|
+
*/
|
|
109
|
+
exports.ErrorEscrowAddressIsNotProvidedByFactory = new Error('Escrow address is not provided by the factory');
|
|
110
|
+
/**
|
|
111
|
+
* @constant {Error} - Manifest file does not exist.
|
|
112
|
+
*/
|
|
113
|
+
exports.ErrorManifestFileDoesNotExist = new Error('Manifest file does not exist');
|
|
114
|
+
/**
|
|
115
|
+
* @constant {Error} - Storage client does not exist.
|
|
116
|
+
*/
|
|
117
|
+
exports.ErrorStorageClientDoesNotExist = new Error('Storage client does not exist');
|
|
118
|
+
/**
|
|
119
|
+
* @constant {Error} - Invalid URL string.
|
|
120
|
+
*/
|
|
121
|
+
exports.ErrorInvalidUrl = new Error('Invalid URL string');
|
|
122
|
+
/**
|
|
123
|
+
* @constant {Error} - URL is an empty string.
|
|
124
|
+
*/
|
|
125
|
+
exports.ErrorUrlIsEmptyString = new Error('URL is an empty string');
|
|
126
|
+
/**
|
|
127
|
+
* @constant {Error} - List of handlers cannot be empty.
|
|
128
|
+
*/
|
|
129
|
+
exports.ErrorListOfHandlersCannotBeEmpty = new Error('List of handlers cannot be empty');
|
|
130
|
+
/**
|
|
131
|
+
* @constant {Error} - No URL provided.
|
|
132
|
+
*/
|
|
133
|
+
exports.ErrorNoURLprovided = new Error('No URL provided');
|
|
134
|
+
/**
|
|
135
|
+
* @constant {Error} - Fee must be between 0 and 100.
|
|
136
|
+
*/
|
|
137
|
+
exports.ErrorFeeMustBeBetweenZeroAndHundred = new Error('Fee must be between 0 and 100');
|
|
138
|
+
/**
|
|
139
|
+
* @constant {Error} - Total fee must be less than 100.
|
|
140
|
+
*/
|
|
141
|
+
exports.ErrorTotalFeeMustBeLessThanHundred = new Error('Total fee must be less than 100');
|
|
142
|
+
/**
|
|
143
|
+
* @constant {Error} - Recipient cannot be an empty array.
|
|
144
|
+
*/
|
|
145
|
+
exports.ErrorRecipientCannotBeEmptyArray = new Error('Recipient cannot be an empty array');
|
|
146
|
+
/**
|
|
147
|
+
* @constant {Error} - Amount must be greater than zero..
|
|
148
|
+
*/
|
|
149
|
+
exports.ErrorAmountMustBeGreaterThanZero = new Error('Amount must be greater than zero');
|
|
150
|
+
/**
|
|
151
|
+
* @constant {Error} - Escrow does not have enough balance.
|
|
152
|
+
*/
|
|
153
|
+
exports.ErrorEscrowDoesNotHaveEnoughBalance = new Error('Escrow does not have enough balance');
|
|
154
|
+
/**
|
|
155
|
+
* @constant {Error} - Amounts cannot be an empty array.
|
|
156
|
+
*/
|
|
157
|
+
exports.ErrorAmountsCannotBeEmptyArray = new Error('Amounts cannot be an empty array');
|
|
158
|
+
/**
|
|
159
|
+
* @constant {Error} - Recipient and amounts must be the same length.
|
|
160
|
+
*/
|
|
161
|
+
exports.ErrorRecipientAndAmountsMustBeSameLength = new Error('Recipient and amounts must be the same length');
|
|
162
|
+
/**
|
|
163
|
+
* @constant {Error} - Launched event is not emitted.
|
|
164
|
+
*/
|
|
165
|
+
exports.ErrorLaunchedEventIsNotEmitted = new Error('Launched event is not emitted');
|
|
166
|
+
/**
|
|
167
|
+
* @constant {Error} - Hash is an empty string.
|
|
168
|
+
*/
|
|
169
|
+
exports.ErrorHashIsEmptyString = new Error('Hash is an empty string');
|
|
170
|
+
class EthereumError extends Error {
|
|
171
|
+
constructor(message) {
|
|
172
|
+
super(`An error occurred while interacting with Ethereum: ${message}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.EthereumError = EthereumError;
|
|
176
|
+
class InvalidArgumentError extends EthereumError {
|
|
177
|
+
constructor(message) {
|
|
178
|
+
super(`Invalid argument: ${message}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.InvalidArgumentError = InvalidArgumentError;
|
|
182
|
+
class OutOfGasError extends EthereumError {
|
|
183
|
+
constructor(message) {
|
|
184
|
+
super(`Out of gas: ${message}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.OutOfGasError = OutOfGasError;
|
|
188
|
+
class UnpredictableGasLimit extends EthereumError {
|
|
189
|
+
constructor(message) {
|
|
190
|
+
super(`Unpredictable gas limit: ${message}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.UnpredictableGasLimit = UnpredictableGasLimit;
|
|
194
|
+
class ReplacementUnderpriced extends EthereumError {
|
|
195
|
+
constructor(message) {
|
|
196
|
+
super(`Replacement underpriced: ${message}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
exports.ReplacementUnderpriced = ReplacementUnderpriced;
|
|
200
|
+
class NumericFault extends EthereumError {
|
|
201
|
+
constructor(message) {
|
|
202
|
+
super(`Numeric fault: ${message}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.NumericFault = NumericFault;
|
|
206
|
+
class NonceExpired extends EthereumError {
|
|
207
|
+
constructor(message) {
|
|
208
|
+
super(`Nonce expired: ${message}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exports.NonceExpired = NonceExpired;
|
|
212
|
+
class TransactionReplaced extends EthereumError {
|
|
213
|
+
constructor(message) {
|
|
214
|
+
super(`Transaction replaced: ${message}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.TransactionReplaced = TransactionReplaced;
|
|
218
|
+
class ContractExecutionError extends EthereumError {
|
|
219
|
+
constructor(reason) {
|
|
220
|
+
super(`Contract execution error: ${reason}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.ContractExecutionError = ContractExecutionError;
|
|
224
|
+
class InvalidEthereumAddressError extends Error {
|
|
225
|
+
constructor(address) {
|
|
226
|
+
super(`Invalid ethereum address error: ${address}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
exports.InvalidEthereumAddressError = InvalidEthereumAddressError;
|
package/dist/escrow.d.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
import { IClientParams, IEscrowConfig, IEscrowsFilter, ILauncherEscrowsResult } from './interfaces';
|
|
3
|
+
import { EscrowStatus, NetworkData } from './types';
|
|
4
|
+
export default class EscrowClient {
|
|
5
|
+
readonly clientParams: IClientParams;
|
|
6
|
+
private escrowFactoryContract;
|
|
7
|
+
private escrowContract?;
|
|
8
|
+
private signerOrProvider;
|
|
9
|
+
network: NetworkData;
|
|
10
|
+
/**
|
|
11
|
+
* **Escrow constructor**
|
|
12
|
+
*
|
|
13
|
+
* * @param {IClientParams} clientParams - Init client parameters
|
|
14
|
+
*/
|
|
15
|
+
constructor(clientParams: IClientParams);
|
|
16
|
+
/**
|
|
17
|
+
* Creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} tokenAddress - Token address to use for pay outs.
|
|
20
|
+
* @param {string[]} trustedHandlers - Array of addresses that can perform actions on the contract.
|
|
21
|
+
* @returns {Promise<string>} - Return the address of the escrow created.
|
|
22
|
+
* @throws {Error} - An error object if an error occurred.
|
|
23
|
+
*/
|
|
24
|
+
createEscrow(tokenAddress: string, trustedHandlers: string[]): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Sets up the parameters of the escrow.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} escrowAddress - Address of the escrow to set up.
|
|
29
|
+
* @param {IEscrowConfig} escrowConfig - Configuration object with escrow settings.
|
|
30
|
+
* @returns {Promise<void>}
|
|
31
|
+
* @throws {Error} - An error object if an error occurred.
|
|
32
|
+
*/
|
|
33
|
+
setup(escrowAddress: string, escrowConfig: IEscrowConfig): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* **Creates an escrow contract that uses the token passed to pay oracle fees and reward workers.*
|
|
36
|
+
* **Sets up the parameters of the escrow.*
|
|
37
|
+
*
|
|
38
|
+
* @param {string} tokenAddress - Token address to use for pay outs.
|
|
39
|
+
* @param {string[]} trustedHandlers - Array of addresses that can perform actions on the contract.
|
|
40
|
+
* @param {IEscrowConfig} escrowConfig - Configuration object with escrow settings.
|
|
41
|
+
* @returns {Promise<string>}
|
|
42
|
+
* @throws {Error} - An error object if an error occurred.
|
|
43
|
+
*/
|
|
44
|
+
createAndSetupEscrow(tokenAddress: string, trustedHandlers: string[], escrowConfig: IEscrowConfig): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* **Adds funds of the chosen token to the escrow.*
|
|
47
|
+
*
|
|
48
|
+
* @param {string} escrowAddress - Address of the escrow to fund.
|
|
49
|
+
* @param {BigNumber} amount - Amount to be added as funds.
|
|
50
|
+
* @returns {Promise<void>}
|
|
51
|
+
* @throws {Error} - An error object if an error occurred.
|
|
52
|
+
*/
|
|
53
|
+
fund(escrowAddress: string, amount: BigNumber): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* **Stores the results.*
|
|
56
|
+
*
|
|
57
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
58
|
+
* @param {string} sender - Address of the sender.
|
|
59
|
+
* @param {string} url - Results file url.
|
|
60
|
+
* @param {string} hash - Results file hash.
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
* @throws {Error} - An error object if an error occurred.
|
|
63
|
+
*/
|
|
64
|
+
storeResults(escrowAddress: string, url: string, hash: string): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* **Sets the status of an escrow to completed.*
|
|
67
|
+
*
|
|
68
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
69
|
+
* @returns {Promise<void>}
|
|
70
|
+
* @throws {Error} - An error object if an error occurred.
|
|
71
|
+
*/
|
|
72
|
+
complete(escrowAddress: string): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Pays out the amounts specified to the workers and sets the URL of the final results file.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
77
|
+
* @param {string[]} recipients - Array of recipient addresses.
|
|
78
|
+
* @param {BigNumber[]} amounts - Array of amounts the recipients will receive.
|
|
79
|
+
* @param {string} finalResultsUrl - Final results file url.
|
|
80
|
+
* @param {string} finalResultsHash - Final results file hash.
|
|
81
|
+
* @returns {Promise<void>}
|
|
82
|
+
* @throws {Error} - An error object if an error occurred.
|
|
83
|
+
*/
|
|
84
|
+
bulkPayOut(escrowAddress: string, recipients: string[], amounts: BigNumber[], finalResultsUrl: string, finalResultsHash: string): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Cancels the specified escrow and sends the balance to the canceler.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
89
|
+
* @returns {Promise<void>}
|
|
90
|
+
* @throws {Error} - An error object if an error occurred.
|
|
91
|
+
*/
|
|
92
|
+
cancel(escrowAddress: string): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Cancels the specified escrow, sends the balance to the canceler and selfdestructs the escrow contract.
|
|
95
|
+
*
|
|
96
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
97
|
+
* @returns {Promise<void>}
|
|
98
|
+
* @throws {Error} - An error object if an error occurred.
|
|
99
|
+
*/
|
|
100
|
+
abort(escrowAddress: string): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Adds an array of addresses to the trusted handlers list.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
105
|
+
* @param {string[]} trustedHandlers - List of trusted handler addresses.
|
|
106
|
+
* @returns {Promise<void>}
|
|
107
|
+
* @throws {Error} - An error object if an error occurred.
|
|
108
|
+
*/
|
|
109
|
+
addTrustedHandlers(escrowAddress: string, trustedHandlers: string[]): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the balance for a specified escrow address.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
114
|
+
* @returns {Promise<BigNumber>}
|
|
115
|
+
* @throws {Error} - An error object if an error occurred.
|
|
116
|
+
*/
|
|
117
|
+
getBalance(escrowAddress: string): Promise<BigNumber>;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the manifest file URL.
|
|
120
|
+
*
|
|
121
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
122
|
+
* @returns {Promise<void>}
|
|
123
|
+
* @throws {Error} - An error object if an error occurred.
|
|
124
|
+
*/
|
|
125
|
+
getManifestUrl(escrowAddress: string): Promise<string>;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the results file URL.
|
|
128
|
+
*
|
|
129
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
130
|
+
* @returns {Promise<void>}
|
|
131
|
+
* @throws {Error} - An error object if an error occurred.
|
|
132
|
+
*/
|
|
133
|
+
getResultsUrl(escrowAddress: string): Promise<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Returns the value for a specified key and address
|
|
136
|
+
*
|
|
137
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
138
|
+
* @returns {Promise<void>}
|
|
139
|
+
* @throws {Error} - An error object if an error occurred.
|
|
140
|
+
*/
|
|
141
|
+
getTokenAddress(escrowAddress: string): Promise<string>;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the current status of the escrow.
|
|
144
|
+
*
|
|
145
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
146
|
+
* @returns {Promise<void>}
|
|
147
|
+
* @throws {Error} - An error object if an error occurred.
|
|
148
|
+
*/
|
|
149
|
+
getStatus(escrowAddress: string): Promise<EscrowStatus>;
|
|
150
|
+
/**
|
|
151
|
+
* Returns the current status of the escrow.
|
|
152
|
+
*
|
|
153
|
+
* @param {IEscrowsFilter} requesterAddress - Address of the requester.
|
|
154
|
+
* @returns {Promise<void>}
|
|
155
|
+
* @throws {Error} - An error object if an error occurred.
|
|
156
|
+
*/
|
|
157
|
+
getLaunchedEscrows(requesterAddress: string): Promise<ILauncherEscrowsResult[]>;
|
|
158
|
+
/**
|
|
159
|
+
* Returns the escrows addresses created by a job requester.
|
|
160
|
+
*
|
|
161
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
162
|
+
* @param {IEscrowsFilter} filer - Filter parameters.
|
|
163
|
+
* @returns {Promise<void>}
|
|
164
|
+
* @throws {Error} - An error object if an error occurred.
|
|
165
|
+
*/
|
|
166
|
+
getEscrowsFiltered(escrowAddress: string, filter: IEscrowsFilter): Promise<ILauncherEscrowsResult[]>;
|
|
167
|
+
/**
|
|
168
|
+
* Returns the recording oracle address of given escrow
|
|
169
|
+
*
|
|
170
|
+
* @param {string} escrowAddress - Address of the escrow.
|
|
171
|
+
* @returns {Promise<string>} - Address of the recording oracle.
|
|
172
|
+
* @throws {Error} - An error object if an error occurred.
|
|
173
|
+
*/
|
|
174
|
+
getRecordingOracleAddress(escrowAddress: string): Promise<string>;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=escrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"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"}
|