@human-protocol/sdk 1.1.17 → 1.1.19
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/base.d.ts +21 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +22 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +18 -11
- package/dist/encryption.d.ts +31 -0
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +37 -0
- package/dist/error.d.ts +4 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +5 -1
- package/dist/escrow.d.ts +29 -15
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +89 -67
- package/dist/kvstore.d.ts +63 -6
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +121 -10
- package/dist/staking.d.ts +31 -15
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +65 -67
- package/dist/statistics.d.ts +3 -3
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +10 -10
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +1 -0
- package/package.json +2 -1
- package/src/base.ts +25 -0
- package/src/constants.ts +18 -10
- package/src/encryption.ts +40 -0
- package/src/error.ts +4 -0
- package/src/escrow.ts +144 -139
- package/src/kvstore.ts +148 -10
- package/src/staking.ts +101 -70
- package/src/statistics.ts +11 -11
- package/src/storage.ts +1 -0
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
|
+
import { Signer } from 'ethers';
|
|
3
|
+
import { NetworkData } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* ## Introduction
|
|
6
|
+
*
|
|
7
|
+
* This class is used as a base class for other clients making on-chain calls.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class BaseEthersClient {
|
|
11
|
+
protected signerOrProvider: Signer | Provider;
|
|
12
|
+
networkData: NetworkData;
|
|
13
|
+
/**
|
|
14
|
+
* **BaseClient constructor**
|
|
15
|
+
*
|
|
16
|
+
* @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
|
|
17
|
+
* @param {NetworkData} networkData The network information required to connect to the contracts
|
|
18
|
+
*/
|
|
19
|
+
constructor(signerOrProvider: Signer | Provider, networkData: NetworkData);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +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,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,CAAC;IACvC,WAAW,EAAE,WAAW,CAAC;IAEhC;;;;;OAKG;gBACS,gBAAgB,EAAE,MAAM,GAAG,QAAQ,EAAE,WAAW,EAAE,WAAW;CAI1E"}
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseEthersClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ## Introduction
|
|
6
|
+
*
|
|
7
|
+
* This class is used as a base class for other clients making on-chain calls.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
class BaseEthersClient {
|
|
11
|
+
/**
|
|
12
|
+
* **BaseClient constructor**
|
|
13
|
+
*
|
|
14
|
+
* @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
|
|
15
|
+
* @param {NetworkData} networkData The network information required to connect to the contracts
|
|
16
|
+
*/
|
|
17
|
+
constructor(signerOrProvider, networkData) {
|
|
18
|
+
this.networkData = networkData;
|
|
19
|
+
this.signerOrProvider = signerOrProvider;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.BaseEthersClient = BaseEthersClient;
|
package/dist/constants.d.ts
CHANGED
|
@@ -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
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -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;;GAEG;AACH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CAuNnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAC"}
|
|
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;;GAEG;AACH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CAuNnC,CAAC;AAEF,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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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
|
+
};
|
package/dist/encryption.d.ts
CHANGED
|
@@ -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.d.ts.map
|
package/dist/encryption.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../src/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAqB;IAEvC;;;;OAIG;gBACS,UAAU,EAAE,OAAO,CAAC,UAAU;IAI1C;;;;;;OAMG;WACiB,KAAK,CACvB,iBAAiB,EAAE,MAAM,EACzB,UAAU,CAAC,EAAE,MAAM,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AM,EAAE,GACnB,OAAO,CAAC,MAAM,CAAC;IAgBlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CASpD"}
|
package/dist/encryption.js
CHANGED
|
@@ -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
|
@@ -201,4 +201,8 @@ export declare class ContractExecutionError extends EthereumError {
|
|
|
201
201
|
export declare class InvalidEthereumAddressError extends Error {
|
|
202
202
|
constructor(address: string);
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* @constant {Error} - The Hash does not match
|
|
206
|
+
*/
|
|
207
|
+
export declare const ErrorInvalidHash: Error;
|
|
204
208
|
//# sourceMappingURL=error.d.ts.map
|
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,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,OAEvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,OAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,OAAgC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,wBAAwB,OAA8B,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,2BAA2B,OAAiC,CAAC;A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Ac,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,oBAAqB,SAAQ,aAAa;gBACzC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,qBAAsB,SAAQ,aAAa;gBAC1C,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
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.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = void 0;
|
|
4
|
+
exports.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* @constant {Error} - The Staking contract is missing.
|
|
7
7
|
*/
|
|
@@ -235,3 +235,7 @@ class InvalidEthereumAddressError extends Error {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
exports.InvalidEthereumAddressError = InvalidEthereumAddressError;
|
|
238
|
+
/**
|
|
239
|
+
* @constant {Error} - The Hash does not match
|
|
240
|
+
*/
|
|
241
|
+
exports.ErrorInvalidHash = new Error('Invalid hash');
|
package/dist/escrow.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
|
-
import { BigNumber, Signer } from 'ethers';
|
|
2
|
+
import { BigNumber, Overrides, Signer } from 'ethers';
|
|
3
|
+
import { BaseEthersClient } from './base';
|
|
3
4
|
import { ChainId } from './enums';
|
|
4
5
|
import { IEscrowConfig, IEscrowsFilter } from './interfaces';
|
|
5
6
|
import { EscrowCancel, EscrowStatus, NetworkData } from './types';
|
|
@@ -73,33 +74,38 @@ import { EscrowData } from './graphql';
|
|
|
73
74
|
* const escrowClient = await EscrowClient.build(provider);
|
|
74
75
|
* ```
|
|
75
76
|
*/
|
|
76
|
-
export declare class EscrowClient {
|
|
77
|
+
export declare class EscrowClient extends BaseEthersClient {
|
|
77
78
|
private escrowFactoryContract;
|
|
78
|
-
private escrowContract?;
|
|
79
|
-
private signerOrProvider;
|
|
80
|
-
network: NetworkData;
|
|
81
79
|
/**
|
|
82
80
|
* **EscrowClient constructor**
|
|
83
81
|
*
|
|
84
82
|
* @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
|
|
85
83
|
* @param {NetworkData} network The network information required to connect to the Escrow contract
|
|
86
84
|
*/
|
|
87
|
-
constructor(signerOrProvider: Signer | Provider,
|
|
85
|
+
constructor(signerOrProvider: Signer | Provider, networkData: NetworkData);
|
|
88
86
|
/**
|
|
89
87
|
* Creates an instance of EscrowClient from a Signer or Provider.
|
|
90
88
|
*
|
|
91
89
|
* @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
|
|
90
|
+
*
|
|
92
91
|
* @returns {Promise<EscrowClient>} An instance of EscrowClient
|
|
93
92
|
* @throws {ErrorProviderDoesNotExist} Thrown if the provider does not exist for the provided Signer
|
|
94
93
|
* @throws {ErrorUnsupportedChainID} Thrown if the network's chainId is not supported
|
|
95
94
|
*/
|
|
96
95
|
static build(signerOrProvider: Signer | Provider): Promise<EscrowClient>;
|
|
96
|
+
/**
|
|
97
|
+
* Connects to the escrow contract
|
|
98
|
+
*
|
|
99
|
+
* @param escrowAddress Escrow address to connect to
|
|
100
|
+
*/
|
|
101
|
+
private getEscrowContract;
|
|
97
102
|
/**
|
|
98
103
|
* This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
|
|
99
104
|
*
|
|
100
105
|
* @param {string} tokenAddress Token address to use for pay outs.
|
|
101
106
|
* @param {string[]} trustedHandlers Array of addresses that can perform actions on the contract.
|
|
102
107
|
* @param {string} jobRequesterId Job Requester Id
|
|
108
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
103
109
|
* @returns {Promise<string>} Return the address of the escrow created.
|
|
104
110
|
*
|
|
105
111
|
*
|
|
@@ -124,12 +130,13 @@ export declare class EscrowClient {
|
|
|
124
130
|
* const escrowAddress = await escrowClient.createEscrow(tokenAddress, trustedHandlers, jobRequesterId);
|
|
125
131
|
* ```
|
|
126
132
|
*/
|
|
127
|
-
createEscrow(tokenAddress: string, trustedHandlers: string[], jobRequesterId: string): Promise<string>;
|
|
133
|
+
createEscrow(tokenAddress: string, trustedHandlers: string[], jobRequesterId: string, txOptions?: Overrides): Promise<string>;
|
|
128
134
|
/**
|
|
129
135
|
* This function sets up the parameters of the escrow.
|
|
130
136
|
*
|
|
131
137
|
* @param {string} escrowAddress Address of the escrow to set up.
|
|
132
138
|
* @param {IEscrowConfig} escrowConfig Escrow configuration parameters.
|
|
139
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
133
140
|
* @returns Returns void if successful. Throws error if any.
|
|
134
141
|
*
|
|
135
142
|
*
|
|
@@ -162,7 +169,7 @@ export declare class EscrowClient {
|
|
|
162
169
|
* await escrowClient.setup(escrowAddress, escrowConfig);
|
|
163
170
|
* ```
|
|
164
171
|
*/
|
|
165
|
-
setup(escrowAddress: string, escrowConfig: IEscrowConfig): Promise<void>;
|
|
172
|
+
setup(escrowAddress: string, escrowConfig: IEscrowConfig, txOptions?: Overrides): Promise<void>;
|
|
166
173
|
/**
|
|
167
174
|
* This function creates and sets up an escrow.
|
|
168
175
|
*
|
|
@@ -210,6 +217,7 @@ export declare class EscrowClient {
|
|
|
210
217
|
*
|
|
211
218
|
* @param {string} escrowAddress Address of the escrow to fund.
|
|
212
219
|
* @param {BigNumber} amount Amount to be added as funds.
|
|
220
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
213
221
|
* @returns Returns void if successful. Throws error if any.
|
|
214
222
|
*
|
|
215
223
|
*
|
|
@@ -230,13 +238,14 @@ export declare class EscrowClient {
|
|
|
230
238
|
* await escrowClient.fund('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount);
|
|
231
239
|
* ```
|
|
232
240
|
*/
|
|
233
|
-
fund(escrowAddress: string, amount: BigNumber): Promise<void>;
|
|
241
|
+
fund(escrowAddress: string, amount: BigNumber, txOptions?: Overrides): Promise<void>;
|
|
234
242
|
/**
|
|
235
243
|
* This function stores the results url and hash.
|
|
236
244
|
*
|
|
237
245
|
* @param {string} escrowAddress Address of the escrow.
|
|
238
246
|
* @param {string} url Results file url.
|
|
239
247
|
* @param {string} hash Results file hash.
|
|
248
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
240
249
|
* @returns Returns void if successful. Throws error if any.
|
|
241
250
|
*
|
|
242
251
|
*
|
|
@@ -258,11 +267,12 @@ export declare class EscrowClient {
|
|
|
258
267
|
* await storeResults.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'http://localhost/results.json', 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079');
|
|
259
268
|
* ```
|
|
260
269
|
*/
|
|
261
|
-
storeResults(escrowAddress: string, url: string, hash: string): Promise<void>;
|
|
270
|
+
storeResults(escrowAddress: string, url: string, hash: string, txOptions?: Overrides): Promise<void>;
|
|
262
271
|
/**
|
|
263
272
|
* This function sets the status of an escrow to completed.
|
|
264
273
|
*
|
|
265
274
|
* @param {string} escrowAddress Address of the escrow.
|
|
275
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
266
276
|
* @returns Returns void if successful. Throws error if any.
|
|
267
277
|
*
|
|
268
278
|
*
|
|
@@ -284,7 +294,7 @@ export declare class EscrowClient {
|
|
|
284
294
|
* await escrowClient.complete('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
285
295
|
* ```
|
|
286
296
|
*/
|
|
287
|
-
complete(escrowAddress: string): Promise<void>;
|
|
297
|
+
complete(escrowAddress: string, txOptions?: Overrides): Promise<void>;
|
|
288
298
|
/**
|
|
289
299
|
* This function pays out the amounts specified to the workers and sets the URL of the final results file.
|
|
290
300
|
*
|
|
@@ -293,6 +303,7 @@ export declare class EscrowClient {
|
|
|
293
303
|
* @param {BigNumber[]} amounts Array of amounts the recipients will receive.
|
|
294
304
|
* @param {string} finalResultsUrl Final results file url.
|
|
295
305
|
* @param {string} finalResultsHash Final results file hash.
|
|
306
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
296
307
|
* @returns Returns void if successful. Throws error if any.
|
|
297
308
|
*
|
|
298
309
|
*
|
|
@@ -319,11 +330,12 @@ export declare class EscrowClient {
|
|
|
319
330
|
* await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash);
|
|
320
331
|
* ```
|
|
321
332
|
*/
|
|
322
|
-
bulkPayOut(escrowAddress: string, recipients: string[], amounts: BigNumber[], finalResultsUrl: string, finalResultsHash: string): Promise<void>;
|
|
333
|
+
bulkPayOut(escrowAddress: string, recipients: string[], amounts: BigNumber[], finalResultsUrl: string, finalResultsHash: string, txOptions?: Overrides): Promise<void>;
|
|
323
334
|
/**
|
|
324
335
|
* This function cancels the specified escrow and sends the balance to the canceler.
|
|
325
336
|
*
|
|
326
337
|
* @param {string} escrowAddress Address of the escrow to cancel.
|
|
338
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
327
339
|
* @returns {EscrowCancel} Returns the escrow cancellation data including transaction hash and refunded amount. Throws error if any.
|
|
328
340
|
*
|
|
329
341
|
*
|
|
@@ -345,11 +357,12 @@ export declare class EscrowClient {
|
|
|
345
357
|
* await escrowClient.cancel('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
346
358
|
* ```
|
|
347
359
|
*/
|
|
348
|
-
cancel(escrowAddress: string): Promise<EscrowCancel>;
|
|
360
|
+
cancel(escrowAddress: string, txOptions?: Overrides): Promise<EscrowCancel>;
|
|
349
361
|
/**
|
|
350
362
|
* This function cancels the specified escrow, sends the balance to the canceler and selfdestructs the escrow contract.
|
|
351
363
|
*
|
|
352
364
|
* @param {string} escrowAddress Address of the escrow.
|
|
365
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
353
366
|
* @returns Returns void if successful. Throws error if any.
|
|
354
367
|
*
|
|
355
368
|
*
|
|
@@ -371,12 +384,13 @@ export declare class EscrowClient {
|
|
|
371
384
|
* await escrowClient.abort('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
372
385
|
* ```
|
|
373
386
|
*/
|
|
374
|
-
abort(escrowAddress: string): Promise<void>;
|
|
387
|
+
abort(escrowAddress: string, txOptions?: Overrides): Promise<void>;
|
|
375
388
|
/**
|
|
376
389
|
* This function sets the status of an escrow to completed.
|
|
377
390
|
*
|
|
378
391
|
* @param {string} escrowAddress Address of the escrow.
|
|
379
392
|
* @param {string[]} trustedHandlers Array of addresses of trusted handlers to add.
|
|
393
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
380
394
|
* @returns Returns void if successful. Throws error if any.
|
|
381
395
|
*
|
|
382
396
|
*
|
|
@@ -399,7 +413,7 @@ export declare class EscrowClient {
|
|
|
399
413
|
* await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309f', trustedHandlers);
|
|
400
414
|
* ```
|
|
401
415
|
*/
|
|
402
|
-
addTrustedHandlers(escrowAddress: string, trustedHandlers: string[]): Promise<void>;
|
|
416
|
+
addTrustedHandlers(escrowAddress: string, trustedHandlers: string[], txOptions?: Overrides): Promise<void>;
|
|
403
417
|
/**
|
|
404
418
|
* This function returns the balance for a specified escrow address.
|
|
405
419
|
*
|
package/dist/escrow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAU5D,OAAO,EAAE,SAAS,EAAmB,MAAM,EAAU,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAU5D,OAAO,EAAE,SAAS,EAAmB,SAAS,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAyBlC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EACL,UAAU,EAGX,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,OAAO,CAAC,qBAAqB,CAAgB;IAE7C;;;;;OAKG;gBACS,gBAAgB,EAAE,MAAM,GAAG,QAAQ,EAAE,WAAW,EAAE,WAAW;IASzE;;;;;;;;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