@human-protocol/sdk 1.1.18 → 2.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 (61) hide show
  1. package/dist/base.d.ts +4 -13
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +3 -18
  4. package/dist/constants.d.ts +7 -0
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/constants.js +18 -11
  7. package/dist/decorators.d.ts.map +1 -1
  8. package/dist/decorators.js +4 -2
  9. package/dist/encryption.d.ts +31 -0
  10. package/dist/encryption.d.ts.map +1 -1
  11. package/dist/encryption.js +37 -0
  12. package/dist/error.d.ts +0 -10
  13. package/dist/error.d.ts.map +1 -1
  14. package/dist/error.js +2 -18
  15. package/dist/escrow.d.ts +39 -33
  16. package/dist/escrow.d.ts.map +1 -1
  17. package/dist/escrow.js +121 -137
  18. package/dist/graphql/queries/{staking.d.ts → operator.d.ts} +2 -1
  19. package/dist/graphql/queries/operator.d.ts.map +1 -0
  20. package/dist/graphql/queries/{staking.js → operator.js} +24 -1
  21. package/dist/graphql/types.d.ts +5 -6
  22. package/dist/graphql/types.d.ts.map +1 -1
  23. package/dist/index.d.ts +2 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +3 -1
  26. package/dist/interfaces.d.ts +28 -18
  27. package/dist/interfaces.d.ts.map +1 -1
  28. package/dist/kvstore.d.ts +14 -14
  29. package/dist/kvstore.d.ts.map +1 -1
  30. package/dist/kvstore.js +30 -48
  31. package/dist/operator.d.ts +68 -0
  32. package/dist/operator.d.ts.map +1 -0
  33. package/dist/operator.js +153 -0
  34. package/dist/staking.d.ts +35 -95
  35. package/dist/staking.d.ts.map +1 -1
  36. package/dist/staking.js +73 -201
  37. package/dist/statistics.d.ts.map +1 -1
  38. package/dist/statistics.js +7 -6
  39. package/dist/types.d.ts +1 -2
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/utils.d.ts +0 -15
  42. package/dist/utils.d.ts.map +1 -1
  43. package/dist/utils.js +9 -49
  44. package/package.json +4 -4
  45. package/src/base.ts +5 -30
  46. package/src/constants.ts +18 -10
  47. package/src/decorators.ts +3 -2
  48. package/src/encryption.ts +40 -0
  49. package/src/error.ts +0 -17
  50. package/src/escrow.ts +169 -178
  51. package/src/graphql/queries/{staking.ts → operator.ts} +24 -0
  52. package/src/graphql/types.ts +5 -7
  53. package/src/index.ts +2 -0
  54. package/src/interfaces.ts +30 -18
  55. package/src/kvstore.ts +47 -59
  56. package/src/operator.ts +192 -0
  57. package/src/staking.ts +101 -213
  58. package/src/statistics.ts +8 -9
  59. package/src/types.ts +1 -3
  60. package/src/utils.ts +8 -58
  61. package/dist/graphql/queries/staking.d.ts.map +0 -1
package/dist/base.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { Provider } from '@ethersproject/abstract-provider';
2
- import { Signer, ethers } from 'ethers';
1
+ import { ContractRunner } from 'ethers';
3
2
  import { NetworkData } from './types';
4
3
  /**
5
4
  * ## Introduction
@@ -8,22 +7,14 @@ import { NetworkData } from './types';
8
7
  *
9
8
  */
10
9
  export declare abstract class BaseEthersClient {
11
- protected signerOrProvider: Signer | Provider;
12
- protected gasPriceMultiplier?: number;
10
+ protected runner: ContractRunner;
13
11
  networkData: NetworkData;
14
12
  /**
15
13
  * **BaseClient constructor**
16
14
  *
17
- * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
15
+ * @param {ContractRunner} runner The Signer or Provider object to interact with the Ethereum network
18
16
  * @param {NetworkData} networkData The network information required to connect to the contracts
19
- * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
20
17
  */
21
- constructor(signerOrProvider: Signer | Provider, networkData: NetworkData, gasPriceMultiplier?: number);
22
- /**
23
- * Adjust the gas price, and return as an option to be passed to a transaction
24
- *
25
- * @returns {Promise<{ gasPrice: BigNumber }>} Returns the gas price options
26
- */
27
- protected gasPriceOptions(): Promise<Partial<ethers.Overrides>>;
18
+ constructor(runner: ContractRunner, networkData: NetworkData);
28
19
  }
29
20
  //# sourceMappingURL=base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;GAKG;AACH,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9C,SAAS,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IAEhC;;;;;;OAMG;gBAED,gBAAgB,EAAE,MAAM,GAAG,QAAQ,EACnC,WAAW,EAAE,WAAW,EACxB,kBAAkB,CAAC,EAAE,MAAM;IAO7B;;;;OAIG;cACa,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;CAUtE"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IAEhC;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;CAI7D"}
package/dist/base.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseEthersClient = void 0;
4
- const utils_1 = require("./utils");
5
4
  /**
6
5
  * ## Introduction
7
6
  *
@@ -12,26 +11,12 @@ class BaseEthersClient {
12
11
  /**
13
12
  * **BaseClient constructor**
14
13
  *
15
- * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
14
+ * @param {ContractRunner} runner The Signer or Provider object to interact with the Ethereum network
16
15
  * @param {NetworkData} networkData The network information required to connect to the contracts
17
- * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
18
16
  */
19
- constructor(signerOrProvider, networkData, gasPriceMultiplier) {
17
+ constructor(runner, networkData) {
20
18
  this.networkData = networkData;
21
- this.signerOrProvider = signerOrProvider;
22
- this.gasPriceMultiplier = gasPriceMultiplier;
23
- }
24
- /**
25
- * Adjust the gas price, and return as an option to be passed to a transaction
26
- *
27
- * @returns {Promise<{ gasPrice: BigNumber }>} Returns the gas price options
28
- */
29
- async gasPriceOptions() {
30
- return this.gasPriceMultiplier
31
- ? {
32
- gasPrice: await (0, utils_1.gasPriceAdjusted)(this.signerOrProvider, this.gasPriceMultiplier),
33
- }
34
- : {};
19
+ this.runner = runner;
35
20
  }
36
21
  }
37
22
  exports.BaseEthersClient = BaseEthersClient;
@@ -50,4 +50,11 @@ export declare const KVStoreKeys: {
50
50
  webhookUrl: string;
51
51
  url: string;
52
52
  };
53
+ export declare const Role: {
54
+ Validator: string;
55
+ JobLauncher: string;
56
+ ExchangeOracle: string;
57
+ ReputationOracle: string;
58
+ RecordingOracle: string;
59
+ };
53
60
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GA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,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;;CAMhB,CAAC"}
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.DEFAULT_TX_ID = exports.DEFAULT_USE_SSL = exports.DEFAULT_PORT = exports.DEFAULT_REGION = exports.DEFAULT_ENDPOINT = exports.DEFAULT_PUBLIC_BUCKET = void 0;
3
+ exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.DEFAULT_TX_ID = exports.DEFAULT_USE_SSL = exports.DEFAULT_PORT = exports.DEFAULT_REGION = exports.DEFAULT_ENDPOINT = exports.DEFAULT_PUBLIC_BUCKET = void 0;
4
4
  const enums_1 = require("./enums");
5
5
  /**
6
6
  * @constant Default public bucket name
@@ -52,7 +52,7 @@ exports.NETWORKS = {
52
52
  hmtAddress: '0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867',
53
53
  stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
54
54
  rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
55
- kvstoreAddress: '0x70671167176C4934204B1C7e97F5e86695857ef2',
55
+ kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
56
56
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mainnet-v2',
57
57
  oldSubgraphUrl: '',
58
58
  oldFactoryAddress: '',
@@ -78,7 +78,7 @@ exports.NETWORKS = {
78
78
  hmtAddress: '0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317',
79
79
  stakingAddress: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
80
80
  rewardPoolAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
81
- kvstoreAddress: '0xc9Fe39c4b6e1d7A2991355Af159956982DADf842',
81
+ kvstoreAddress: '0x19Fc3e859C1813ac9427a7a78BeB9ae102CE96d3',
82
82
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli-v2',
83
83
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli',
84
84
  oldFactoryAddress: '0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F',
@@ -91,7 +91,7 @@ exports.NETWORKS = {
91
91
  hmtAddress: '0x711Fd6ab6d65A98904522d4e3586F492B989c527',
92
92
  stakingAddress: '0xdFbB79dC35a3A53741be54a2C9b587d6BafAbd1C',
93
93
  rewardPoolAddress: '0xf376443BCc6d4d4D63eeC086bc4A9E4a83878e0e',
94
- kvstoreAddress: '0x2B95bEcb6EBC4589f64CB000dFCF716b4aeF8aA6',
94
+ kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
95
95
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc-v2',
96
96
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
97
97
  oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
@@ -104,7 +104,7 @@ exports.NETWORKS = {
104
104
  hmtAddress: '0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d',
105
105
  stakingAddress: '0x5517fE916Fe9F8dB15B0DDc76ebDf0BdDCd4ed18',
106
106
  rewardPoolAddress: '0xB0A0500103eCEc431b73F6BAd923F0a2774E6e29',
107
- kvstoreAddress: '0x3aD4B091E054f192a822D1406f4535eAd38580e4',
107
+ kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
108
108
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest-v2',
109
109
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
110
110
  oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
@@ -117,7 +117,7 @@ exports.NETWORKS = {
117
117
  hmtAddress: '0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF',
118
118
  stakingAddress: '0xcbAd56bE3f504E98bd70875823d3CC0242B7bB29',
119
119
  rewardPoolAddress: '0xa8e32d777a3839440cc7c24D591A64B9481753B3',
120
- kvstoreAddress: '0x35Cf4beBD58F9C8D75B9eA2599479b6C173d406F',
120
+ kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
121
121
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon-v2',
122
122
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
123
123
  oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
@@ -130,7 +130,7 @@ exports.NETWORKS = {
130
130
  hmtAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
131
131
  stakingAddress: '0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac',
132
132
  rewardPoolAddress: '0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE',
133
- kvstoreAddress: '0xD7F61E812e139a5a02eDae9Dfec146E1b8eA3807',
133
+ kvstoreAddress: '0xD96158c7267Ea658a4688F4aEf1c85659851625d',
134
134
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai-v2',
135
135
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai',
136
136
  oldFactoryAddress: '0x558cd800f9F0B02f3B149667bDe003284c867E94',
@@ -143,7 +143,7 @@ exports.NETWORKS = {
143
143
  hmtAddress: '0x3b25BC1dC591D24d60560d0135D6750A561D4764',
144
144
  stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
145
145
  rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
146
- kvstoreAddress: '0x70671167176C4934204B1C7e97F5e86695857ef2',
146
+ kvstoreAddress: '0x2B95bEcb6EBC4589f64CB000dFCF716b4aeF8aA6',
147
147
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam-v2',
148
148
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam',
149
149
  oldFactoryAddress: '0x98108c28B7767a52BE38B4860832dd4e11A7ecad',
@@ -156,7 +156,7 @@ exports.NETWORKS = {
156
156
  hmtAddress: '0x2dd72db2bBA65cE663e476bA8b84A1aAF802A8e3',
157
157
  stakingAddress: '0xBFC7009F3371F93F3B54DdC8caCd02914a37495c',
158
158
  rewardPoolAddress: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
159
- kvstoreAddress: '0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d',
159
+ kvstoreAddress: '0xcC561f4482f4Ff051D2Dcc65c2cE1A0f291bbA46',
160
160
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbase-alpha-v2',
161
161
  oldSubgraphUrl: '',
162
162
  oldFactoryAddress: '',
@@ -169,7 +169,7 @@ exports.NETWORKS = {
169
169
  hmtAddress: '0x9406d5c635AD22b0d76c75E52De57A2177919ca3',
170
170
  stakingAddress: '0x9890473B0b93E24d6D1a8Dfb739D577C6f25FFd3',
171
171
  rewardPoolAddress: '0x5517fE916Fe9F8dB15B0DDc76ebDf0BdDCd4ed18',
172
- kvstoreAddress: '0x707fb5A5d36BC15275Af3f73262bf9a1D8C470EB',
172
+ kvstoreAddress: '0x3aD4B091E054f192a822D1406f4535eAd38580e4',
173
173
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/fuji-v2',
174
174
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/fuji',
175
175
  oldFactoryAddress: '0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88',
@@ -182,7 +182,7 @@ exports.NETWORKS = {
182
182
  hmtAddress: '0x12365293cb6477d4fc2686e46BB97E3Fb64f1550',
183
183
  stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
184
184
  rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
185
- kvstoreAddress: '0x70671167176C4934204B1C7e97F5e86695857ef2',
185
+ kvstoreAddress: '0x9Bc7bff35B2Be2413708d48c3B0aEF5c43646728',
186
186
  subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/avalanche-v2',
187
187
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/avalanche',
188
188
  oldFactoryAddress: '0x9767a578ba7a5FA1563c8229943cB01cd8446BB4',
@@ -247,3 +247,10 @@ exports.KVStoreKeys = {
247
247
  webhookUrl: 'webhookUrl',
248
248
  url: 'url',
249
249
  };
250
+ exports.Role = {
251
+ Validator: 'Validator',
252
+ JobLauncher: 'Job Launcher',
253
+ ExchangeOracle: 'Exchange Oracle',
254
+ ReputationOracle: 'Reputation Oracle',
255
+ RecordingOracle: 'Recording Oracle',
256
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAC5B,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,sBAa/B"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAC5B,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,sBAe/B"}
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requiresSigner = void 0;
4
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const ethers_1 = require("ethers");
6
5
  const error_1 = require("./error");
7
6
  function requiresSigner(target, propertyKey, descriptor) {
8
7
  const originalMethod = descriptor.value;
9
8
  descriptor.value = async function (...args) {
10
- if (!ethers_1.Signer.isSigner(this.signerOrProvider)) {
9
+ try {
10
+ !this.runner.getAddress();
11
+ }
12
+ catch {
11
13
  throw error_1.ErrorSigner;
12
14
  }
13
15
  return originalMethod.apply(this, args);
@@ -296,5 +296,36 @@ export declare class EncryptionUtils {
296
296
  * ```
297
297
  */
298
298
  static encrypt(message: string, publicKeys: string[]): Promise<string>;
299
+ /**
300
+ * Verifies if a message appears to be encrypted with OpenPGP.
301
+ *
302
+ * @param {string} message Message to verify.
303
+ * @returns {Promise<boolean>} `true` if the message appears to be encrypted, `false` if not.
304
+ *
305
+ * **Code example:**
306
+ *
307
+ * ```ts
308
+ * const message = `-----BEGIN PGP MESSAGE-----
309
+ *
310
+ * wV4DqdeRpqH+jaISAQdAsvBFxikvjxRqC7ZlDe98cLd7/aeCEI/AcL8PpVKK
311
+ * mC0wKlwxNg/ADi55z9jcYFuMC4kKE+C/teM+JqiI8DO9AwassQUvKFtULnpx
312
+ * h2jaOjC/0sAQASjUsIFK8zbuDgk/P8T9Npn6px+GlJPg9K90iwtPWiIp0eyW
313
+ * 4zXamJZT51k2DyaUX/Rsc6P4PYhQRKjt0yxtH0jHPmKkLC/9eBeFf4GP0zlZ
314
+ * 18xMZ8uCpQCma708Gz0sJYxEz3u/eZdHD7Mc7tWQKyJG8MsTwM1P+fdK1X75
315
+ * L9UryJG2AY+6kKZhG4dqjNxiO4fWluiB2u7iMF+iLEyE3SQCEYorWMC+NDWi
316
+ * QIJZ7oQ2w7BaPo1a991gvTOSNm5v2x44KfqPI1uj859BjsQTCA==
317
+ * =tsmI
318
+ * -----END PGP MESSAGE-----`;
319
+ *
320
+ * const isEncrypted = await EncriptionUtils.isEncrypted(message);
321
+ *
322
+ * if (isEncrypted) {
323
+ * console.log('The message is encrypted with OpenPGP.');
324
+ * } else {
325
+ * console.log('The message is not encrypted with OpenPGP.');
326
+ * }
327
+ * ```
328
+ */
329
+ static isEncrypted(message: string): boolean;
299
330
  }
300
331
  //# sourceMappingURL=encryption.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EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IAgBnB;;;;;;;;;;;;;OAaG;WACiB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;WACiB,eAAe,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,SAAK,GACd,OAAO,CAAC,QAAQ,CAAC;IAkBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;WACiB,OAAO,CACzB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,MAAM,CAAC;IAgBlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CASpD"}
@@ -414,5 +414,42 @@ class EncryptionUtils {
414
414
  });
415
415
  return encrypted;
416
416
  }
417
+ /**
418
+ * Verifies if a message appears to be encrypted with OpenPGP.
419
+ *
420
+ * @param {string} message Message to verify.
421
+ * @returns {Promise<boolean>} `true` if the message appears to be encrypted, `false` if not.
422
+ *
423
+ * **Code example:**
424
+ *
425
+ * ```ts
426
+ * const message = `-----BEGIN PGP MESSAGE-----
427
+ *
428
+ * wV4DqdeRpqH+jaISAQdAsvBFxikvjxRqC7ZlDe98cLd7/aeCEI/AcL8PpVKK
429
+ * mC0wKlwxNg/ADi55z9jcYFuMC4kKE+C/teM+JqiI8DO9AwassQUvKFtULnpx
430
+ * h2jaOjC/0sAQASjUsIFK8zbuDgk/P8T9Npn6px+GlJPg9K90iwtPWiIp0eyW
431
+ * 4zXamJZT51k2DyaUX/Rsc6P4PYhQRKjt0yxtH0jHPmKkLC/9eBeFf4GP0zlZ
432
+ * 18xMZ8uCpQCma708Gz0sJYxEz3u/eZdHD7Mc7tWQKyJG8MsTwM1P+fdK1X75
433
+ * L9UryJG2AY+6kKZhG4dqjNxiO4fWluiB2u7iMF+iLEyE3SQCEYorWMC+NDWi
434
+ * QIJZ7oQ2w7BaPo1a991gvTOSNm5v2x44KfqPI1uj859BjsQTCA==
435
+ * =tsmI
436
+ * -----END PGP MESSAGE-----`;
437
+ *
438
+ * const isEncrypted = await EncriptionUtils.isEncrypted(message);
439
+ *
440
+ * if (isEncrypted) {
441
+ * console.log('The message is encrypted with OpenPGP.');
442
+ * } else {
443
+ * console.log('The message is not encrypted with OpenPGP.');
444
+ * }
445
+ * ```
446
+ */
447
+ static isEncrypted(message) {
448
+ const startMarker = '-----BEGIN PGP MESSAGE-----';
449
+ const endMarker = '-----END PGP MESSAGE-----';
450
+ const hasStartMarker = message.includes(startMarker);
451
+ const hasEndMarker = message.includes(endMarker);
452
+ return hasStartMarker && hasEndMarker;
453
+ }
417
454
  }
418
455
  exports.EncryptionUtils = EncryptionUtils;
package/dist/error.d.ts CHANGED
@@ -177,12 +177,6 @@ export declare class EthereumError extends Error {
177
177
  export declare class InvalidArgumentError extends EthereumError {
178
178
  constructor(message: string);
179
179
  }
180
- export declare class OutOfGasError extends EthereumError {
181
- constructor(message: string);
182
- }
183
- export declare class UnpredictableGasLimit extends EthereumError {
184
- constructor(message: string);
185
- }
186
180
  export declare class ReplacementUnderpriced extends EthereumError {
187
181
  constructor(message: string);
188
182
  }
@@ -205,8 +199,4 @@ export declare class InvalidEthereumAddressError extends Error {
205
199
  * @constant {Error} - The Hash does not match
206
200
  */
207
201
  export declare const ErrorInvalidHash: Error;
208
- /**
209
- * @constant {Error} - The Hash does not match
210
- */
211
- export declare const ErrorMissingGasPrice: Error;
212
202
  //# sourceMappingURL=error.d.ts.map
@@ -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,C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,eAAO,MAAM,gCAAgC,OAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,OAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mCAAmC,OAE/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,OAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wCAAwC,OAEpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,OAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,OAAuC,CAAC;AAE3E,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,oBAAqB,SAAQ,aAAa;gBACzC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,aAAa;gBAC3C,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,aAAa;gBAC3C,MAAM,EAAE,MAAM;CAG3B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAG5B;AACD;;GAEG;AACH,eAAO,MAAM,gBAAgB,OAA4B,CAAC"}
package/dist/error.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = 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.ErrorMissingGasPrice = exports.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = void 0;
3
+ exports.TransactionReplaced = exports.NonceExpired = 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.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.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError = void 0;
5
5
  /**
6
6
  * @constant {Error} - The Staking contract is missing.
7
7
  */
@@ -187,18 +187,6 @@ class InvalidArgumentError extends EthereumError {
187
187
  }
188
188
  }
189
189
  exports.InvalidArgumentError = InvalidArgumentError;
190
- class OutOfGasError extends EthereumError {
191
- constructor(message) {
192
- super(`Out of gas: ${message}`);
193
- }
194
- }
195
- exports.OutOfGasError = OutOfGasError;
196
- class UnpredictableGasLimit extends EthereumError {
197
- constructor(message) {
198
- super(`Unpredictable gas limit: ${message}`);
199
- }
200
- }
201
- exports.UnpredictableGasLimit = UnpredictableGasLimit;
202
190
  class ReplacementUnderpriced extends EthereumError {
203
191
  constructor(message) {
204
192
  super(`Replacement underpriced: ${message}`);
@@ -239,7 +227,3 @@ exports.InvalidEthereumAddressError = InvalidEthereumAddressError;
239
227
  * @constant {Error} - The Hash does not match
240
228
  */
241
229
  exports.ErrorInvalidHash = new Error('Invalid hash');
242
- /**
243
- * @constant {Error} - The Hash does not match
244
- */
245
- exports.ErrorMissingGasPrice = new Error('Missing gas price');
package/dist/escrow.d.ts CHANGED
@@ -1,20 +1,19 @@
1
- import { Provider } from '@ethersproject/abstract-provider';
2
- import { BigNumber, Signer } from 'ethers';
1
+ import { ContractRunner, Overrides } from 'ethers';
3
2
  import { BaseEthersClient } from './base';
4
3
  import { ChainId } from './enums';
4
+ import { EscrowData } from './graphql';
5
5
  import { IEscrowConfig, IEscrowsFilter } from './interfaces';
6
6
  import { EscrowCancel, EscrowStatus, NetworkData } from './types';
7
- import { EscrowData } from './graphql';
8
7
  /**
9
8
  * ## Introduction
10
9
  *
11
10
  * This client enables to perform actions on Escrow contracts and obtain information from both the contracts and subgraph.
12
11
  *
13
- * Internally, the SDK will use one network or another according to the network ID of the `signerOrProvider`.
12
+ * Internally, the SDK will use one network or another according to the network ID of the `runner`.
14
13
  * To use this client, it is recommended to initialize it using the static `build` method.
15
14
  *
16
15
  * ```ts
17
- * static async build(signerOrProvider: Signer | Provider);
16
+ * static async build(runner: ContractRunner);
18
17
  * ```
19
18
  *
20
19
  * A `Signer` or a `Provider` should be passed depending on the use case of this module:
@@ -79,22 +78,20 @@ export declare class EscrowClient extends BaseEthersClient {
79
78
  /**
80
79
  * **EscrowClient constructor**
81
80
  *
82
- * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
81
+ * @param {ContractRunner} runner The Runner object to interact with the Ethereum network
83
82
  * @param {NetworkData} network The network information required to connect to the Escrow contract
84
- * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
85
83
  */
86
- constructor(signerOrProvider: Signer | Provider, networkData: NetworkData, gasPriceMultiplier?: number);
84
+ constructor(runner: ContractRunner, networkData: NetworkData);
87
85
  /**
88
- * Creates an instance of EscrowClient from a Signer or Provider.
86
+ * Creates an instance of EscrowClient from a Runner.
89
87
  *
90
- * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
91
- * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
88
+ * @param {ContractRunner} runner The Runner object to interact with the Ethereum network
92
89
  *
93
90
  * @returns {Promise<EscrowClient>} An instance of EscrowClient
94
91
  * @throws {ErrorProviderDoesNotExist} Thrown if the provider does not exist for the provided Signer
95
92
  * @throws {ErrorUnsupportedChainID} Thrown if the network's chainId is not supported
96
93
  */
97
- static build(signerOrProvider: Signer | Provider, gasPriceMultiplier?: number): Promise<EscrowClient>;
94
+ static build(runner: ContractRunner): Promise<EscrowClient>;
98
95
  /**
99
96
  * Connects to the escrow contract
100
97
  *
@@ -107,6 +104,7 @@ export declare class EscrowClient extends BaseEthersClient {
107
104
  * @param {string} tokenAddress Token address to use for pay outs.
108
105
  * @param {string[]} trustedHandlers Array of addresses that can perform actions on the contract.
109
106
  * @param {string} jobRequesterId Job Requester Id
107
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
110
108
  * @returns {Promise<string>} Return the address of the escrow created.
111
109
  *
112
110
  *
@@ -131,12 +129,13 @@ export declare class EscrowClient extends BaseEthersClient {
131
129
  * const escrowAddress = await escrowClient.createEscrow(tokenAddress, trustedHandlers, jobRequesterId);
132
130
  * ```
133
131
  */
134
- createEscrow(tokenAddress: string, trustedHandlers: string[], jobRequesterId: string): Promise<string>;
132
+ createEscrow(tokenAddress: string, trustedHandlers: string[], jobRequesterId: string, txOptions?: Overrides): Promise<string>;
135
133
  /**
136
134
  * This function sets up the parameters of the escrow.
137
135
  *
138
136
  * @param {string} escrowAddress Address of the escrow to set up.
139
137
  * @param {IEscrowConfig} escrowConfig Escrow configuration parameters.
138
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
140
139
  * @returns Returns void if successful. Throws error if any.
141
140
  *
142
141
  *
@@ -160,16 +159,16 @@ export declare class EscrowClient extends BaseEthersClient {
160
159
  * recordingOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
161
160
  * reputationOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
162
161
  * exchangeOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
163
- * recordingOracleFee: BigNumber.from('10'),
164
- * reputationOracleFee: BigNumber.from('10'),
165
- * exchangeOracleFee: BigNumber.from('10'),
162
+ * recordingOracleFee: bigint.from('10'),
163
+ * reputationOracleFee: bigint.from('10'),
164
+ * exchangeOracleFee: bigint.from('10'),
166
165
  * manifestUrl: 'htttp://localhost/manifest.json',
167
166
  * manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
168
167
  * };
169
168
  * await escrowClient.setup(escrowAddress, escrowConfig);
170
169
  * ```
171
170
  */
172
- setup(escrowAddress: string, escrowConfig: IEscrowConfig): Promise<void>;
171
+ setup(escrowAddress: string, escrowConfig: IEscrowConfig, txOptions?: Overrides): Promise<void>;
173
172
  /**
174
173
  * This function creates and sets up an escrow.
175
174
  *
@@ -201,9 +200,9 @@ export declare class EscrowClient extends BaseEthersClient {
201
200
  * recordingOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
202
201
  * reputationOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
203
202
  * exchangeOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
204
- * recordingOracleFee: BigNumber.from('10'),
205
- * reputationOracleFee: BigNumber.from('10'),
206
- * exchangeOracleFee: BigNumber.from('10'),
203
+ * recordingOracleFee: bigint.from('10'),
204
+ * reputationOracleFee: bigint.from('10'),
205
+ * exchangeOracleFee: bigint.from('10'),
207
206
  * manifestUrl: 'htttp://localhost/manifest.json',
208
207
  * manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
209
208
  * };
@@ -216,7 +215,8 @@ export declare class EscrowClient extends BaseEthersClient {
216
215
  * This function adds funds of the chosen token to the escrow.
217
216
  *
218
217
  * @param {string} escrowAddress Address of the escrow to fund.
219
- * @param {BigNumber} amount Amount to be added as funds.
218
+ * @param {bigint} amount Amount to be added as funds.
219
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
220
220
  * @returns Returns void if successful. Throws error if any.
221
221
  *
222
222
  *
@@ -233,17 +233,18 @@ export declare class EscrowClient extends BaseEthersClient {
233
233
  * const signer = new Wallet(privateKey, provider);
234
234
  * const escrowClient = await EscrowClient.build(signer);
235
235
  *
236
- * const amount = ethers.utils.parseUnits(5, 'ether'); //convert from ETH to WEI
236
+ * const amount = ethers.parseUnits(5, 'ether'); //convert from ETH to WEI
237
237
  * await escrowClient.fund('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount);
238
238
  * ```
239
239
  */
240
- fund(escrowAddress: string, amount: BigNumber): Promise<void>;
240
+ fund(escrowAddress: string, amount: bigint, txOptions?: Overrides): Promise<void>;
241
241
  /**
242
242
  * This function stores the results url and hash.
243
243
  *
244
244
  * @param {string} escrowAddress Address of the escrow.
245
245
  * @param {string} url Results file url.
246
246
  * @param {string} hash Results file hash.
247
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
247
248
  * @returns Returns void if successful. Throws error if any.
248
249
  *
249
250
  *
@@ -265,11 +266,12 @@ export declare class EscrowClient extends BaseEthersClient {
265
266
  * await storeResults.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'http://localhost/results.json', 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079');
266
267
  * ```
267
268
  */
268
- storeResults(escrowAddress: string, url: string, hash: string): Promise<void>;
269
+ storeResults(escrowAddress: string, url: string, hash: string, txOptions?: Overrides): Promise<void>;
269
270
  /**
270
271
  * This function sets the status of an escrow to completed.
271
272
  *
272
273
  * @param {string} escrowAddress Address of the escrow.
274
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
273
275
  * @returns Returns void if successful. Throws error if any.
274
276
  *
275
277
  *
@@ -291,15 +293,16 @@ export declare class EscrowClient extends BaseEthersClient {
291
293
  * await escrowClient.complete('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
292
294
  * ```
293
295
  */
294
- complete(escrowAddress: string): Promise<void>;
296
+ complete(escrowAddress: string, txOptions?: Overrides): Promise<void>;
295
297
  /**
296
298
  * This function pays out the amounts specified to the workers and sets the URL of the final results file.
297
299
  *
298
300
  * @param {string} escrowAddress Escrow address to payout.
299
301
  * @param {string[]} recipients Array of recipient addresses.
300
- * @param {BigNumber[]} amounts Array of amounts the recipients will receive.
302
+ * @param {bigint[]} amounts Array of amounts the recipients will receive.
301
303
  * @param {string} finalResultsUrl Final results file url.
302
304
  * @param {string} finalResultsHash Final results file hash.
305
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
303
306
  * @returns Returns void if successful. Throws error if any.
304
307
  *
305
308
  *
@@ -319,18 +322,19 @@ export declare class EscrowClient extends BaseEthersClient {
319
322
  * const escrowClient = await EscrowClient.build(signer);
320
323
  *
321
324
  * const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
322
- * const amounts = [ethers.utils.parseUnits(5, 'ether'), ethers.utils.parseUnits(10, 'ether')];
325
+ * const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')];
323
326
  * const resultsUrl = 'http://localhost/results.json';
324
327
  * const resultsHash'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
325
328
  *
326
329
  * await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash);
327
330
  * ```
328
331
  */
329
- bulkPayOut(escrowAddress: string, recipients: string[], amounts: BigNumber[], finalResultsUrl: string, finalResultsHash: string): Promise<void>;
332
+ bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, txOptions?: Overrides): Promise<void>;
330
333
  /**
331
334
  * This function cancels the specified escrow and sends the balance to the canceler.
332
335
  *
333
336
  * @param {string} escrowAddress Address of the escrow to cancel.
337
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
334
338
  * @returns {EscrowCancel} Returns the escrow cancellation data including transaction hash and refunded amount. Throws error if any.
335
339
  *
336
340
  *
@@ -352,11 +356,12 @@ export declare class EscrowClient extends BaseEthersClient {
352
356
  * await escrowClient.cancel('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
353
357
  * ```
354
358
  */
355
- cancel(escrowAddress: string): Promise<EscrowCancel>;
359
+ cancel(escrowAddress: string, txOptions?: Overrides): Promise<EscrowCancel>;
356
360
  /**
357
361
  * This function cancels the specified escrow, sends the balance to the canceler and selfdestructs the escrow contract.
358
362
  *
359
363
  * @param {string} escrowAddress Address of the escrow.
364
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
360
365
  * @returns Returns void if successful. Throws error if any.
361
366
  *
362
367
  *
@@ -378,12 +383,13 @@ export declare class EscrowClient extends BaseEthersClient {
378
383
  * await escrowClient.abort('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
379
384
  * ```
380
385
  */
381
- abort(escrowAddress: string): Promise<void>;
386
+ abort(escrowAddress: string, txOptions?: Overrides): Promise<void>;
382
387
  /**
383
388
  * This function sets the status of an escrow to completed.
384
389
  *
385
390
  * @param {string} escrowAddress Address of the escrow.
386
391
  * @param {string[]} trustedHandlers Array of addresses of trusted handlers to add.
392
+ * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
387
393
  * @returns Returns void if successful. Throws error if any.
388
394
  *
389
395
  *
@@ -406,12 +412,12 @@ export declare class EscrowClient extends BaseEthersClient {
406
412
  * await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309f', trustedHandlers);
407
413
  * ```
408
414
  */
409
- addTrustedHandlers(escrowAddress: string, trustedHandlers: string[]): Promise<void>;
415
+ addTrustedHandlers(escrowAddress: string, trustedHandlers: string[], txOptions?: Overrides): Promise<void>;
410
416
  /**
411
417
  * This function returns the balance for a specified escrow address.
412
418
  *
413
419
  * @param {string} escrowAddress Address of the escrow.
414
- * @returns {BigNumber} Balance of the escrow in the token used to fund it.
420
+ * @returns {bigint} Balance of the escrow in the token used to fund it.
415
421
  *
416
422
  * **Code example**
417
423
  *
@@ -427,7 +433,7 @@ export declare class EscrowClient extends BaseEthersClient {
427
433
  * const balance = await escrowClient.getBalance('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
428
434
  * ```
429
435
  */
430
- getBalance(escrowAddress: string): Promise<BigNumber>;
436
+ getBalance(escrowAddress: string): Promise<bigint>;
431
437
  /**
432
438
  * This function returns the manifest file hash.
433
439
  *