@human-protocol/sdk 3.0.7 → 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.
- package/dist/constants.d.ts +2 -25
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +25 -66
- package/dist/decorators.js +1 -1
- package/dist/encryption.d.ts +21 -29
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +34 -36
- package/dist/error.d.ts +31 -28
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +36 -33
- package/dist/escrow.d.ts +118 -112
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +254 -180
- package/dist/graphql/queries/operator.d.ts.map +1 -1
- package/dist/graphql/queries/operator.js +15 -7
- package/dist/graphql/queries/statistics.d.ts.map +1 -1
- package/dist/graphql/queries/statistics.js +0 -2
- package/dist/graphql/queries/transaction.d.ts.map +1 -1
- package/dist/graphql/queries/transaction.js +23 -10
- package/dist/graphql/types.d.ts +0 -2
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/interfaces.d.ts +29 -12
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +16 -16
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +16 -16
- package/dist/operator.d.ts +11 -10
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +36 -11
- package/dist/staking.d.ts +26 -118
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +46 -173
- package/dist/statistics.d.ts +10 -29
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +13 -30
- package/dist/storage.d.ts +13 -18
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +30 -25
- package/dist/transaction.js +1 -1
- package/dist/types.d.ts +23 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -1
- package/package.json +8 -4
- package/src/constants.ts +25 -66
- package/src/decorators.ts +1 -1
- package/src/encryption.ts +21 -29
- package/src/error.ts +39 -37
- package/src/escrow.ts +360 -216
- package/src/graphql/queries/operator.ts +15 -7
- package/src/graphql/queries/statistics.ts +0 -2
- package/src/graphql/queries/transaction.ts +23 -13
- package/src/graphql/types.ts +0 -2
- package/src/interfaces.ts +30 -13
- package/src/kvstore.ts +17 -17
- package/src/operator.ts +47 -12
- package/src/staking.ts +53 -187
- package/src/statistics.ts +13 -30
- package/src/storage.ts +13 -18
- package/src/transaction.ts +2 -2
- package/src/types.ts +24 -6
- package/src/utils.ts +0 -1
package/dist/encryption.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.EncryptionUtils = exports.Encryption = void 0;
|
|
27
37
|
const openpgp = __importStar(require("openpgp"));
|
|
@@ -68,7 +78,7 @@ function makeMessageDataBinary(message) {
|
|
|
68
78
|
*
|
|
69
79
|
* const privateKey = 'Armored_priv_key';
|
|
70
80
|
* const passphrase = 'example_passphrase';
|
|
71
|
-
* const
|
|
81
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
72
82
|
* ```
|
|
73
83
|
*/
|
|
74
84
|
class Encryption {
|
|
@@ -103,7 +113,7 @@ class Encryption {
|
|
|
103
113
|
/**
|
|
104
114
|
* This function signs and encrypts a message using the private key used to initialize the client and the specified public keys.
|
|
105
115
|
*
|
|
106
|
-
* @param {
|
|
116
|
+
* @param {MessageDataType} message Message to sign and encrypt.
|
|
107
117
|
* @param {string[]} publicKeys Array of public keys to use for encryption.
|
|
108
118
|
* @returns {Promise<string>} Message signed and encrypted.
|
|
109
119
|
*
|
|
@@ -115,7 +125,7 @@ class Encryption {
|
|
|
115
125
|
*
|
|
116
126
|
* const privateKey = 'Armored_priv_key';
|
|
117
127
|
* const passphrase = 'example_passphrase';
|
|
118
|
-
* const
|
|
128
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
119
129
|
* const publicKey1 = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
120
130
|
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
121
131
|
* WYxJQn3vo1/NFEh1bWFuIDxodW1hbkBobXQuYWk+wowEEBYKAD4FAmSkBDME
|
|
@@ -141,7 +151,7 @@ class Encryption {
|
|
|
141
151
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
142
152
|
*
|
|
143
153
|
* const publicKeys = [publicKey1, publicKey2];
|
|
144
|
-
* const resultMessage = await
|
|
154
|
+
* const resultMessage = await encryption.signAndEncrypt('message', publicKeys);
|
|
145
155
|
* ```
|
|
146
156
|
*/
|
|
147
157
|
async signAndEncrypt(message, publicKeys) {
|
|
@@ -162,7 +172,7 @@ class Encryption {
|
|
|
162
172
|
*
|
|
163
173
|
* @param {string} message Message to decrypt.
|
|
164
174
|
* @param {string} publicKey Public key used to verify signature if needed. This is optional.
|
|
165
|
-
* @returns {Promise<
|
|
175
|
+
* @returns {Promise<Uint8Array>} Message decrypted.
|
|
166
176
|
*
|
|
167
177
|
* **Code example**
|
|
168
178
|
*
|
|
@@ -171,7 +181,7 @@ class Encryption {
|
|
|
171
181
|
*
|
|
172
182
|
* const privateKey = 'Armored_priv_key';
|
|
173
183
|
* const passphrase = 'example_passphrase';
|
|
174
|
-
* const
|
|
184
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
175
185
|
*
|
|
176
186
|
* const publicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
177
187
|
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
@@ -185,7 +195,7 @@ class Encryption {
|
|
|
185
195
|
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
186
196
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
187
197
|
*
|
|
188
|
-
* const resultMessage = await
|
|
198
|
+
* const resultMessage = await encryption.decrypt('message');
|
|
189
199
|
* ```
|
|
190
200
|
*/
|
|
191
201
|
async decrypt(message, publicKey) {
|
|
@@ -231,9 +241,9 @@ class Encryption {
|
|
|
231
241
|
*
|
|
232
242
|
* const privateKey = 'Armored_priv_key';
|
|
233
243
|
* const passphrase = 'example_passphrase';
|
|
234
|
-
* const
|
|
244
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
235
245
|
*
|
|
236
|
-
* const resultMessage = await
|
|
246
|
+
* const resultMessage = await encryption.sign('message');
|
|
237
247
|
* ```
|
|
238
248
|
*/
|
|
239
249
|
async sign(message) {
|
|
@@ -279,7 +289,7 @@ class EncryptionUtils {
|
|
|
279
289
|
* This function verifies the signature of a signed message using the public key.
|
|
280
290
|
*
|
|
281
291
|
* @param {string} message Message to verify.
|
|
282
|
-
* @param {string} publicKey Public key to verify that the message was
|
|
292
|
+
* @param {string} publicKey Public key to verify that the message was signed by a specific source.
|
|
283
293
|
* @returns {Promise<boolean>} True if verified. False if not verified.
|
|
284
294
|
*
|
|
285
295
|
* **Code example**
|
|
@@ -299,7 +309,7 @@ class EncryptionUtils {
|
|
|
299
309
|
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
300
310
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
301
311
|
*
|
|
302
|
-
* const result = await
|
|
312
|
+
* const result = await EncryptionUtils.verify('message', publicKey);
|
|
303
313
|
* ```
|
|
304
314
|
*/
|
|
305
315
|
static async verify(message, publicKey) {
|
|
@@ -327,7 +337,7 @@ class EncryptionUtils {
|
|
|
327
337
|
* ```ts
|
|
328
338
|
* import { EncryptionUtils } from '@human-protocol/sdk';
|
|
329
339
|
*
|
|
330
|
-
* const signedData = await
|
|
340
|
+
* const signedData = await EncryptionUtils.getSignedData('message');
|
|
331
341
|
* ```
|
|
332
342
|
*/
|
|
333
343
|
static async getSignedData(message) {
|
|
@@ -354,22 +364,10 @@ class EncryptionUtils {
|
|
|
354
364
|
* ```ts
|
|
355
365
|
* import { EncryptionUtils } from '@human-protocol/sdk';
|
|
356
366
|
*
|
|
357
|
-
* const publicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
358
|
-
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
359
|
-
* WYxJQn3vo1/NFEh1bWFuIDxodW1hbkBobXQuYWk+wowEEBYKAD4FAmSkBDME
|
|
360
|
-
* CwkHCAkQJBFPuuhtQo4DFQgKBBYAAgECGQECGwMCHgEWIQTQ5fbVPB9CWIdf
|
|
361
|
-
* XdYkEU+66G1CjgAAKYYA/jMyDCtJtqu6hj22kq9SW6fuV1FCT2ySJ9vBhumF
|
|
362
|
-
* X8wWAP433zVFl4VECOkgGk8qFr8BgkYxaz16GOFAqYbfO6oMBc44BGSkBDMS
|
|
363
|
-
* CisGAQQBl1UBBQEBB0AKR+A48zVVYZWQvgu7Opn2IGvzI9jePB/J8pzqRhg2
|
|
364
|
-
* YAMBCAfCeAQYFggAKgUCZKQEMwkQJBFPuuhtQo4CGwwWIQTQ5fbVPB9CWIdf
|
|
365
|
-
* XdYkEU+66G1CjgAA0xgBAK4AIahFFnmWR2Mp6A3q021cZXpGklc0Xw1Hfswc
|
|
366
|
-
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
367
|
-
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
368
|
-
*
|
|
369
367
|
* const name = 'YOUR_NAME';
|
|
370
368
|
* const email = 'YOUR_EMAIL';
|
|
371
369
|
* const passphrase = 'YOUR_PASSPHRASE';
|
|
372
|
-
* const result = await
|
|
370
|
+
* const result = await EncryptionUtils.generateKeyPair(name, email, passphrase);
|
|
373
371
|
* ```
|
|
374
372
|
*/
|
|
375
373
|
static async generateKeyPair(name, email, passphrase = '') {
|
|
@@ -390,8 +388,8 @@ class EncryptionUtils {
|
|
|
390
388
|
/**
|
|
391
389
|
* This function encrypts a message using the specified public keys.
|
|
392
390
|
*
|
|
393
|
-
* @param {
|
|
394
|
-
* @param {string}
|
|
391
|
+
* @param {MessageDataType} message Message to encrypt.
|
|
392
|
+
* @param {string[]} publicKeys Array of public keys to use for encryption.
|
|
395
393
|
* @returns {Promise<string>} Message encrypted.
|
|
396
394
|
*
|
|
397
395
|
* **Code example**
|
|
@@ -424,7 +422,7 @@ class EncryptionUtils {
|
|
|
424
422
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
425
423
|
*
|
|
426
424
|
* const publicKeys = [publicKey1, publicKey2]
|
|
427
|
-
* const result = await
|
|
425
|
+
* const result = await EncryptionUtils.encrypt('message', publicKeys);
|
|
428
426
|
* ```
|
|
429
427
|
*/
|
|
430
428
|
static async encrypt(message, publicKeys) {
|
|
@@ -460,7 +458,7 @@ class EncryptionUtils {
|
|
|
460
458
|
* =tsmI
|
|
461
459
|
* -----END PGP MESSAGE-----`;
|
|
462
460
|
*
|
|
463
|
-
* const isEncrypted = await
|
|
461
|
+
* const isEncrypted = await EncryptionUtils.isEncrypted(message);
|
|
464
462
|
*
|
|
465
463
|
* if (isEncrypted) {
|
|
466
464
|
* console.log('The message is encrypted with OpenPGP.');
|
package/dist/error.d.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare const ErrorStakingMissing: Error;
|
|
5
5
|
/**
|
|
6
|
-
* @constant {Error} - The Storage client not
|
|
6
|
+
* @constant {Error} - The Storage client not initialized.
|
|
7
7
|
*/
|
|
8
8
|
export declare const ErrorStorageClientNotInitialized: Error;
|
|
9
9
|
/**
|
|
10
|
-
* @constant {Error} - The Storage does not
|
|
10
|
+
* @constant {Error} - The Storage client does not exist.
|
|
11
11
|
*/
|
|
12
12
|
export declare const ErrorStorageClientNotExists: Error;
|
|
13
13
|
/**
|
|
14
|
-
* @constant {Error} - The Storage credentials
|
|
14
|
+
* @constant {Error} - The Storage credentials are missing.
|
|
15
15
|
*/
|
|
16
16
|
export declare const ErrorStorageCredentialsMissing: Error;
|
|
17
17
|
/**
|
|
@@ -27,7 +27,7 @@ export declare const ErrorStorageFileNotFound: Error;
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const ErrorStorageFileNotUploaded: Error;
|
|
29
29
|
/**
|
|
30
|
-
* @constant {Error} - The KVStore key
|
|
30
|
+
* @constant {Error} - The KVStore key cannot be empty.
|
|
31
31
|
*/
|
|
32
32
|
export declare const ErrorKVStoreEmptyKey: Error;
|
|
33
33
|
/**
|
|
@@ -35,11 +35,11 @@ export declare const ErrorKVStoreEmptyKey: Error;
|
|
|
35
35
|
*/
|
|
36
36
|
export declare const ErrorKVStoreArrayLength: Error;
|
|
37
37
|
/**
|
|
38
|
-
* @constant {Error} - The
|
|
38
|
+
* @constant {Error} - The address provided is invalid.
|
|
39
39
|
*/
|
|
40
40
|
export declare const ErrorInvalidAddress: Error;
|
|
41
41
|
/**
|
|
42
|
-
* @constant {Error} - The token address
|
|
42
|
+
* @constant {Error} - The token address provided is invalid.
|
|
43
43
|
*/
|
|
44
44
|
export declare const ErrorInvalidTokenAddress: Error;
|
|
45
45
|
/**
|
|
@@ -51,11 +51,11 @@ export declare const ErrorInvalidRecordingOracleAddressProvided: Error;
|
|
|
51
51
|
*/
|
|
52
52
|
export declare const ErrorInvalidReputationOracleAddressProvided: Error;
|
|
53
53
|
/**
|
|
54
|
-
* @constant {Error} - Invalid
|
|
54
|
+
* @constant {Error} - Invalid exchange oracle address provided.
|
|
55
55
|
*/
|
|
56
56
|
export declare const ErrorInvalidExchangeOracleAddressProvided: Error;
|
|
57
57
|
/**
|
|
58
|
-
* @constant {Error} - The
|
|
58
|
+
* @constant {Error} - The staking value must be positive.
|
|
59
59
|
*/
|
|
60
60
|
export declare const ErrorStakingValueMustBePositive: Error;
|
|
61
61
|
/**
|
|
@@ -77,7 +77,7 @@ export declare const ErrorInvalidStakerAddressProvided: Error;
|
|
|
77
77
|
/**
|
|
78
78
|
* @constant {Error} - Invalid hash provided.
|
|
79
79
|
*/
|
|
80
|
-
export declare const
|
|
80
|
+
export declare const ErrorInvalidHashProvided: Error;
|
|
81
81
|
/**
|
|
82
82
|
* @constant {Error} - Cannot use both date and block filters simultaneously.
|
|
83
83
|
*/
|
|
@@ -94,17 +94,20 @@ export declare const ErrorStakingGetStakers: Error;
|
|
|
94
94
|
* @constant {Error} - Failed to approve staking amount: signerOrProvider is not a Signer instance.
|
|
95
95
|
*/
|
|
96
96
|
export declare const ErrorFailedToApproveStakingAmountSignerDoesNotExist: Error;
|
|
97
|
+
/**
|
|
98
|
+
* @constant {Error} - Failed to check allowance.
|
|
99
|
+
*/
|
|
97
100
|
export declare const ErrorFailedToCheckAllowance: Error;
|
|
98
101
|
/**
|
|
99
102
|
* @constant {Error} - The HMToken amount not approved.
|
|
100
103
|
*/
|
|
101
104
|
export declare const ErrorHMTokenAmountNotApproved: Error;
|
|
102
105
|
/**
|
|
103
|
-
* @constant {Error} -
|
|
106
|
+
* @constant {Error} - Provider does not exist.
|
|
104
107
|
*/
|
|
105
108
|
export declare const ErrorProviderDoesNotExist: Error;
|
|
106
109
|
/**
|
|
107
|
-
* @constant {Error} -
|
|
110
|
+
* @constant {Error} - Unsupported chain ID.
|
|
108
111
|
*/
|
|
109
112
|
export declare const ErrorUnsupportedChainID: Error;
|
|
110
113
|
/**
|
|
@@ -123,10 +126,6 @@ export declare const ErrorTransferEventNotFoundInTransactionLogs: Error;
|
|
|
123
126
|
* @constant {Error} - Manifest file does not exist.
|
|
124
127
|
*/
|
|
125
128
|
export declare const ErrorManifestFileDoesNotExist: Error;
|
|
126
|
-
/**
|
|
127
|
-
* @constant {Error} - Storage client does not exist.
|
|
128
|
-
*/
|
|
129
|
-
export declare const ErrorStorageClientDoesNotExist: Error;
|
|
130
129
|
/**
|
|
131
130
|
* @constant {Error} - Invalid URL string.
|
|
132
131
|
*/
|
|
@@ -156,7 +155,11 @@ export declare const ErrorTotalFeeMustBeLessThanHundred: Error;
|
|
|
156
155
|
*/
|
|
157
156
|
export declare const ErrorRecipientCannotBeEmptyArray: Error;
|
|
158
157
|
/**
|
|
159
|
-
* @constant {Error} -
|
|
158
|
+
* @constant {Error} - Too many recipients.
|
|
159
|
+
*/
|
|
160
|
+
export declare const ErrorTooManyRecipients: Error;
|
|
161
|
+
/**
|
|
162
|
+
* @constant {Error} - Amount must be greater than zero.
|
|
160
163
|
*/
|
|
161
164
|
export declare const ErrorAmountMustBeGreaterThanZero: Error;
|
|
162
165
|
/**
|
|
@@ -179,6 +182,18 @@ export declare const ErrorLaunchedEventIsNotEmitted: Error;
|
|
|
179
182
|
* @constant {Error} - Hash is an empty string.
|
|
180
183
|
*/
|
|
181
184
|
export declare const ErrorHashIsEmptyString: Error;
|
|
185
|
+
/**
|
|
186
|
+
* @constant {Error} - The hash does not match.
|
|
187
|
+
*/
|
|
188
|
+
export declare const ErrorInvalidHash: Error;
|
|
189
|
+
/**
|
|
190
|
+
* @constant {Error} - The status is not supported.
|
|
191
|
+
*/
|
|
192
|
+
export declare const ErrorUnsupportedStatus: Error;
|
|
193
|
+
/**
|
|
194
|
+
* @constant {Warning} - The SUBGRAPH_API_KEY is not being provided.
|
|
195
|
+
*/
|
|
196
|
+
export declare const WarnSubgraphApiKeyNotProvided = "\"SUBGRAPH_API_KEY\" is not being provided. It might cause issues with the subgraph.";
|
|
182
197
|
export declare class EthereumError extends Error {
|
|
183
198
|
constructor(message: string);
|
|
184
199
|
}
|
|
@@ -203,18 +218,6 @@ export declare class ContractExecutionError extends EthereumError {
|
|
|
203
218
|
export declare class InvalidEthereumAddressError extends Error {
|
|
204
219
|
constructor(address: string);
|
|
205
220
|
}
|
|
206
|
-
/**
|
|
207
|
-
* @constant {Error} - The Hash does not match
|
|
208
|
-
*/
|
|
209
|
-
export declare const ErrorInvalidHash: Error;
|
|
210
|
-
/**
|
|
211
|
-
* @constant {Error} - The Status is not supported
|
|
212
|
-
*/
|
|
213
|
-
export declare const ErrorUnsupportedStatus: Error;
|
|
214
|
-
/**
|
|
215
|
-
* @constant {Error} - The SUBGRAPH_API_KEY is not being provided
|
|
216
|
-
*/
|
|
217
|
-
export declare const WarnSubgraphApiKeyNotProvided = "\"SUBGRAPH_API_KEY\" is not being provided. It might cause issues with the subgraph.";
|
|
218
221
|
export declare class InvalidKeyError extends Error {
|
|
219
222
|
constructor(key: string, address: string);
|
|
220
223
|
}
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,OAA2C,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,gCAAgC,OAE5C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= exports.
|
|
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
|
|
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
|
|
14
|
+
* @constant {Error} - The Storage client does not exist.
|
|
15
15
|
*/
|
|
16
|
-
exports.ErrorStorageClientNotExists = new Error('Storage client does not
|
|
16
|
+
exports.ErrorStorageClientNotExists = new Error('Storage client does not exist');
|
|
17
17
|
/**
|
|
18
|
-
* @constant {Error} - The Storage credentials
|
|
18
|
+
* @constant {Error} - The Storage credentials are missing.
|
|
19
19
|
*/
|
|
20
|
-
exports.ErrorStorageCredentialsMissing = new Error('Storage credentials
|
|
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
|
|
34
|
+
* @constant {Error} - The KVStore key cannot be empty.
|
|
35
35
|
*/
|
|
36
|
-
exports.ErrorKVStoreEmptyKey = new Error('Key
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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} -
|
|
110
|
+
* @constant {Error} - Provider does not exist.
|
|
108
111
|
*/
|
|
109
112
|
exports.ErrorProviderDoesNotExist = new Error('Provider does not exist');
|
|
110
113
|
/**
|
|
111
|
-
* @constant {Error} -
|
|
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} -
|
|
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}`);
|