@human-protocol/sdk 3.0.4 → 3.0.6
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 +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +17 -16
- package/dist/decorators.js +1 -2
- package/dist/encryption.d.ts +5 -6
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +5 -6
- package/dist/enums.js +2 -2
- package/dist/error.d.ts +3 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +7 -1
- package/dist/escrow.js +1 -1
- package/dist/graphql/queries/operator.d.ts.map +1 -1
- package/dist/graphql/queries/operator.js +5 -1
- package/dist/graphql/queries/transaction.d.ts.map +1 -1
- package/dist/graphql/queries/transaction.js +19 -9
- package/dist/interfaces.d.ts +4 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +6 -5
- package/dist/staking.js +1 -1
- package/dist/transaction.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +2 -2
- package/src/constants.ts +16 -15
- package/src/encryption.ts +5 -6
- package/src/error.ts +6 -0
- package/src/graphql/queries/operator.ts +5 -1
- package/src/graphql/queries/transaction.ts +23 -9
- package/src/interfaces.ts +4 -0
- package/src/kvstore.ts +7 -5
- package/src/transaction.ts +1 -0
package/dist/constants.d.ts
CHANGED
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,MAA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mSnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;CASvB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,4BAA4B,uBAAuB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -39,7 +39,7 @@ var HttpStatus;
|
|
|
39
39
|
HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
40
40
|
HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
41
41
|
HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
42
|
-
})(HttpStatus
|
|
42
|
+
})(HttpStatus || (exports.HttpStatus = HttpStatus = {}));
|
|
43
43
|
/**
|
|
44
44
|
* @constant Default network parameters
|
|
45
45
|
*/
|
|
@@ -54,7 +54,7 @@ exports.NETWORKS = {
|
|
|
54
54
|
rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
|
|
55
55
|
kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
|
|
56
56
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
57
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
57
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmaTcYR8NCzZuxwY7tBkMJAo1Q64BMqNNSzqjxd7FH9s2p',
|
|
58
58
|
oldSubgraphUrl: '',
|
|
59
59
|
oldFactoryAddress: '',
|
|
60
60
|
},
|
|
@@ -96,7 +96,7 @@ exports.NETWORKS = {
|
|
|
96
96
|
rewardPoolAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
97
97
|
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
98
98
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
99
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
99
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmadNQBBzcfJHTmzLezZGbwvLux7HmnmfByBHubS2cmLUr',
|
|
100
100
|
oldSubgraphUrl: '',
|
|
101
101
|
oldFactoryAddress: '',
|
|
102
102
|
},
|
|
@@ -110,7 +110,7 @@ exports.NETWORKS = {
|
|
|
110
110
|
rewardPoolAddress: '0xf376443BCc6d4d4D63eeC086bc4A9E4a83878e0e',
|
|
111
111
|
kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
|
|
112
112
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
|
|
113
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
113
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmXZ4QJMi8kyfXDEJwtdizyKf5JdJui89iYCLCE79N8Xf5',
|
|
114
114
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
115
115
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
116
116
|
},
|
|
@@ -124,7 +124,7 @@ exports.NETWORKS = {
|
|
|
124
124
|
rewardPoolAddress: '0xB0A0500103eCEc431b73F6BAd923F0a2774E6e29',
|
|
125
125
|
kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
|
|
126
126
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
127
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
127
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmdq449rn4WKDf7NLvRZgt7CedZRrvpDzPqcvSmhvuu16D',
|
|
128
128
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
129
129
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
130
130
|
},
|
|
@@ -138,7 +138,7 @@ exports.NETWORKS = {
|
|
|
138
138
|
rewardPoolAddress: '0xa8e32d777a3839440cc7c24D591A64B9481753B3',
|
|
139
139
|
kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
|
|
140
140
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
141
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
141
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmNdsofT4Cj2KRwr8vgyKgCWpZNmrMN41zUdygRz7eSGC9',
|
|
142
142
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
143
143
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
144
144
|
},
|
|
@@ -159,14 +159,14 @@ exports.NETWORKS = {
|
|
|
159
159
|
[enums_1.ChainId.POLYGON_AMOY]: {
|
|
160
160
|
chainId: enums_1.ChainId.POLYGON_AMOY,
|
|
161
161
|
title: 'Polygon Amoy',
|
|
162
|
-
scanUrl: 'https://
|
|
162
|
+
scanUrl: 'https://amoy.polygonscan.com/',
|
|
163
163
|
factoryAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
164
164
|
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
165
165
|
stakingAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
166
166
|
rewardPoolAddress: '0xd866bCEFf6D0F77E1c3EAE28230AE6C79b03fDa7',
|
|
167
167
|
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
168
168
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
169
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
169
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmbwio5UnvDn5GQRJ5kLJfK27fqHK9nkEh4YXXYKWCc9rH',
|
|
170
170
|
oldSubgraphUrl: '',
|
|
171
171
|
oldFactoryAddress: '',
|
|
172
172
|
},
|
|
@@ -180,7 +180,7 @@ exports.NETWORKS = {
|
|
|
180
180
|
rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
|
|
181
181
|
kvstoreAddress: '0x2B95bEcb6EBC4589f64CB000dFCF716b4aeF8aA6',
|
|
182
182
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/moonbeam/version/latest',
|
|
183
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
183
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYe9hsFYuVgQsH719AsqRNqgVM8YBYfCuhBNYjXtBqQru',
|
|
184
184
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam',
|
|
185
185
|
oldFactoryAddress: '0x98108c28B7767a52BE38B4860832dd4e11A7ecad',
|
|
186
186
|
},
|
|
@@ -194,7 +194,7 @@ exports.NETWORKS = {
|
|
|
194
194
|
rewardPoolAddress: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
|
|
195
195
|
kvstoreAddress: '0xcC561f4482f4Ff051D2Dcc65c2cE1A0f291bbA46',
|
|
196
196
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/moonbase-alpha/version/latest',
|
|
197
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
197
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeC4JrotcrXWJtJU519RX3KkxE5879wveRJJ58EheH3j1',
|
|
198
198
|
oldSubgraphUrl: '',
|
|
199
199
|
oldFactoryAddress: '',
|
|
200
200
|
},
|
|
@@ -208,7 +208,7 @@ exports.NETWORKS = {
|
|
|
208
208
|
rewardPoolAddress: '0x5517fE916Fe9F8dB15B0DDc76ebDf0BdDCd4ed18',
|
|
209
209
|
kvstoreAddress: '0x3aD4B091E054f192a822D1406f4535eAd38580e4',
|
|
210
210
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/fuji/version/latest',
|
|
211
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
211
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmcFhecY6w3AhKGSg8XeidXwwuXCV9DAQ5SYGE1sTzydgR',
|
|
212
212
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/fuji',
|
|
213
213
|
oldFactoryAddress: '0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88',
|
|
214
214
|
},
|
|
@@ -222,7 +222,7 @@ exports.NETWORKS = {
|
|
|
222
222
|
rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
|
|
223
223
|
kvstoreAddress: '0x9Bc7bff35B2Be2413708d48c3B0aEF5c43646728',
|
|
224
224
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/avalanche/version/latest',
|
|
225
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
225
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYR8NUuAQVoGmGSwKanUJLjX9iZxrEyGH39HjUuXLmsum',
|
|
226
226
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/avalanche',
|
|
227
227
|
oldFactoryAddress: '0x9767a578ba7a5FA1563c8229943cB01cd8446BB4',
|
|
228
228
|
},
|
|
@@ -236,7 +236,7 @@ exports.NETWORKS = {
|
|
|
236
236
|
rewardPoolAddress: '0xA9545C2530BD5bdb464d5E274F59ACceAa73eD86',
|
|
237
237
|
kvstoreAddress: '0x938335006ea6F9Eb0e8020969cFF94404425e298',
|
|
238
238
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/celo-alfajores/version/latest',
|
|
239
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
239
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmb2WKCFFhT7REAjTuMd9pZvGw7rRpzeZSPJ3KRztD2pMM',
|
|
240
240
|
oldSubgraphUrl: '',
|
|
241
241
|
oldFactoryAddress: '',
|
|
242
242
|
},
|
|
@@ -250,7 +250,7 @@ exports.NETWORKS = {
|
|
|
250
250
|
rewardPoolAddress: '0xb9344bAD98E3d26a4d83900922baf395a2Ec154c',
|
|
251
251
|
kvstoreAddress: '0x86Af9f6Cd34B69Db1B202223C6d6D109f2491569',
|
|
252
252
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/celo/version/latest',
|
|
253
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
253
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmeeb5zshw1z9Q38NNPun2Pd7P951Mkzz5ywK171tauNRY',
|
|
254
254
|
oldSubgraphUrl: '',
|
|
255
255
|
oldFactoryAddress: '',
|
|
256
256
|
},
|
|
@@ -264,7 +264,7 @@ exports.NETWORKS = {
|
|
|
264
264
|
rewardPoolAddress: '0x7ABa5F75b2b530cB0c8927C86591c21dF44f06b6',
|
|
265
265
|
kvstoreAddress: '0x6512d894cc3d3FE93Da9d0420430136fA889FaB9',
|
|
266
266
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/xlayer/version/latest',
|
|
267
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
267
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmWTggMrB5sRSs2fePuqQG9WbLMk8HtnfLH3VbRhmVdF8s',
|
|
268
268
|
oldSubgraphUrl: '',
|
|
269
269
|
oldFactoryAddress: '',
|
|
270
270
|
},
|
|
@@ -278,7 +278,7 @@ exports.NETWORKS = {
|
|
|
278
278
|
rewardPoolAddress: '0x6daccd1f3a68945f8a7ac6d20260953f7a97fae4',
|
|
279
279
|
kvstoreAddress: '0xdE8BE9E3C12E9F546309A429cd88d026a25EaF8C',
|
|
280
280
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/xlayer-testnet/version/latest',
|
|
281
|
-
subgraphUrlApiKey: 'https://gateway-testnet-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
281
|
+
subgraphUrlApiKey: 'https://gateway-testnet-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQrTmq89ZCdVABsFpLHtQUWuyyVzbcARoan9eztHd21oP',
|
|
282
282
|
oldSubgraphUrl: '',
|
|
283
283
|
oldFactoryAddress: '',
|
|
284
284
|
},
|
|
@@ -305,6 +305,7 @@ exports.KVStoreKeys = {
|
|
|
305
305
|
url: 'url',
|
|
306
306
|
jobTypes: 'job_types',
|
|
307
307
|
registrationNeeded: 'registration_needed',
|
|
308
|
+
registrationInstructions: 'registration_instructions',
|
|
308
309
|
};
|
|
309
310
|
exports.Role = {
|
|
310
311
|
JobLauncher: 'Job Launcher',
|
package/dist/decorators.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requiresSigner =
|
|
3
|
+
exports.requiresSigner = requiresSigner;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
const error_1 = require("./error");
|
|
6
6
|
function requiresSigner(target, propertyKey, descriptor) {
|
|
@@ -16,4 +16,3 @@ function requiresSigner(target, propertyKey, descriptor) {
|
|
|
16
16
|
};
|
|
17
17
|
return descriptor;
|
|
18
18
|
}
|
|
19
|
-
exports.requiresSigner = requiresSigner;
|
package/dist/encryption.d.ts
CHANGED
|
@@ -3,12 +3,11 @@ import { IKeyPair } from './interfaces';
|
|
|
3
3
|
/**
|
|
4
4
|
* ## Introduction
|
|
5
5
|
*
|
|
6
|
-
* Class for
|
|
6
|
+
* Class for signing and decrypting messages.
|
|
7
7
|
*
|
|
8
|
-
* The algorithm includes the implementation of the [PGP encryption algorithm](https://github.com/openpgpjs/openpgpjs) multi-public key encryption on typescript.
|
|
9
|
-
* Using the vanilla [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) implementation Schnorr signatures for signature and [curve25519](https://en.wikipedia.org/wiki/Curve25519) for encryption. [Learn more](https://wiki.polkadot.network/docs/learn-cryptography).
|
|
8
|
+
* The algorithm includes the implementation of the [PGP encryption algorithm](https://github.com/openpgpjs/openpgpjs) multi-public key encryption on typescript, and uses the vanilla [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) implementation Schnorr signature for signatures and [curve25519](https://en.wikipedia.org/wiki/Curve25519) for encryption. [Learn more](https://wiki.polkadot.network/docs/learn-cryptography).
|
|
10
9
|
*
|
|
11
|
-
* To get an instance of this class, is recommended
|
|
10
|
+
* To get an instance of this class, initialization is recommended using the static `build` method.
|
|
12
11
|
*
|
|
13
12
|
* ```ts
|
|
14
13
|
* static async build(privateKeyArmored: string, passphrase?: string): Promise<Encryption>
|
|
@@ -103,10 +102,10 @@ export declare class Encryption {
|
|
|
103
102
|
*/
|
|
104
103
|
signAndEncrypt(message: string, publicKeys: string[]): Promise<string>;
|
|
105
104
|
/**
|
|
106
|
-
* This function
|
|
105
|
+
* This function decrypts messages using the private key. In addition, the public key can be added for signature verification.
|
|
107
106
|
*
|
|
108
107
|
* @param {string} message Message to decrypt.
|
|
109
|
-
* @param {string} publicKey Public key used to verify signature if needed.
|
|
108
|
+
* @param {string} publicKey Public key used to verify signature if needed. This is optional.
|
|
110
109
|
* @returns {Promise<string>} Message decrypted.
|
|
111
110
|
*
|
|
112
111
|
* **Code example**
|
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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAqB;IAEvC;;;;OAIG;gBACS,UAAU,EAAE,OAAO,CAAC,UAAU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"}
|
package/dist/encryption.js
CHANGED
|
@@ -28,12 +28,11 @@ const openpgp = __importStar(require("openpgp"));
|
|
|
28
28
|
/**
|
|
29
29
|
* ## Introduction
|
|
30
30
|
*
|
|
31
|
-
* Class for
|
|
31
|
+
* Class for signing and decrypting messages.
|
|
32
32
|
*
|
|
33
|
-
* The algorithm includes the implementation of the [PGP encryption algorithm](https://github.com/openpgpjs/openpgpjs) multi-public key encryption on typescript.
|
|
34
|
-
* Using the vanilla [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) implementation Schnorr signatures for signature and [curve25519](https://en.wikipedia.org/wiki/Curve25519) for encryption. [Learn more](https://wiki.polkadot.network/docs/learn-cryptography).
|
|
33
|
+
* The algorithm includes the implementation of the [PGP encryption algorithm](https://github.com/openpgpjs/openpgpjs) multi-public key encryption on typescript, and uses the vanilla [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) implementation Schnorr signature for signatures and [curve25519](https://en.wikipedia.org/wiki/Curve25519) for encryption. [Learn more](https://wiki.polkadot.network/docs/learn-cryptography).
|
|
35
34
|
*
|
|
36
|
-
* To get an instance of this class, is recommended
|
|
35
|
+
* To get an instance of this class, initialization is recommended using the static `build` method.
|
|
37
36
|
*
|
|
38
37
|
* ```ts
|
|
39
38
|
* static async build(privateKeyArmored: string, passphrase?: string): Promise<Encryption>
|
|
@@ -151,10 +150,10 @@ class Encryption {
|
|
|
151
150
|
return encrypted;
|
|
152
151
|
}
|
|
153
152
|
/**
|
|
154
|
-
* This function
|
|
153
|
+
* This function decrypts messages using the private key. In addition, the public key can be added for signature verification.
|
|
155
154
|
*
|
|
156
155
|
* @param {string} message Message to decrypt.
|
|
157
|
-
* @param {string} publicKey Public key used to verify signature if needed.
|
|
156
|
+
* @param {string} publicKey Public key used to verify signature if needed. This is optional.
|
|
158
157
|
* @returns {Promise<string>} Message decrypted.
|
|
159
158
|
*
|
|
160
159
|
* **Code example**
|
package/dist/enums.js
CHANGED
|
@@ -22,9 +22,9 @@ var ChainId;
|
|
|
22
22
|
ChainId[ChainId["XLAYER_TESTNET"] = 195] = "XLAYER_TESTNET";
|
|
23
23
|
ChainId[ChainId["LOCALHOST"] = 1338] = "LOCALHOST";
|
|
24
24
|
ChainId[ChainId["XLAYER"] = 196] = "XLAYER";
|
|
25
|
-
})(ChainId
|
|
25
|
+
})(ChainId || (exports.ChainId = ChainId = {}));
|
|
26
26
|
var OrderDirection;
|
|
27
27
|
(function (OrderDirection) {
|
|
28
28
|
OrderDirection["ASC"] = "asc";
|
|
29
29
|
OrderDirection["DESC"] = "desc";
|
|
30
|
-
})(OrderDirection
|
|
30
|
+
})(OrderDirection || (exports.OrderDirection = OrderDirection = {}));
|
package/dist/error.d.ts
CHANGED
|
@@ -215,4 +215,7 @@ export declare const ErrorUnsupportedStatus: Error;
|
|
|
215
215
|
* @constant {Error} - The SUBGRAPH_API_KEY is not being provided
|
|
216
216
|
*/
|
|
217
217
|
export declare const WarnSubgraphApiKeyNotProvided = "\"SUBGRAPH_API_KEY\" is not being provided. It might cause issues with the subgraph.";
|
|
218
|
+
export declare class InvalidKeyError extends Error {
|
|
219
|
+
constructor(key: string, address: string);
|
|
220
|
+
}
|
|
218
221
|
//# 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,2BAA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O,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;AAE1D;;GAEG;AACH,eAAO,MAAM,sBAAsB,OAA4C,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,6BAA6B,yFAC4C,CAAC;AAEvF,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAGzC"}
|
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.InvalidArgumentError = exports.EthereumError = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.ErrorUrlIsEmptyString = exports.ErrorInvalidUrl = exports.ErrorStorageClientDoesNotExist = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = exports.ErrorCannotUseDateAndBlockSimultaneously = exports.ErrorInvalidHahsProvided = exports.ErrorInvalidStakerAddressProvided = exports.ErrorInvalidSlasherAddressProvided = exports.ErrorInvalidStakingValueSign = exports.ErrorInvalidStakingValueType = exports.ErrorStakingValueMustBePositive = exports.ErrorInvalidExchangeOracleAddressProvided = exports.ErrorInvalidReputationOracleAddressProvided = exports.ErrorInvalidRecordingOracleAddressProvided = exports.ErrorInvalidTokenAddress = exports.ErrorInvalidAddress = exports.ErrorKVStoreArrayLength = exports.ErrorKVStoreEmptyKey = exports.ErrorStorageFileNotUploaded = exports.ErrorStorageFileNotFound = exports.ErrorStorageBucketNotFound = exports.ErrorStorageCredentialsMissing = exports.ErrorStorageClientNotExists = exports.ErrorStorageClientNotInitialized = exports.ErrorStakingMissing = void 0;
|
|
4
|
-
exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = exports.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = void 0;
|
|
4
|
+
exports.InvalidKeyError = exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = 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
|
*/
|
|
@@ -243,3 +243,9 @@ exports.ErrorUnsupportedStatus = new Error('Unsupported status for query');
|
|
|
243
243
|
* @constant {Error} - The SUBGRAPH_API_KEY is not being provided
|
|
244
244
|
*/
|
|
245
245
|
exports.WarnSubgraphApiKeyNotProvided = '"SUBGRAPH_API_KEY" is not being provided. It might cause issues with the subgraph.';
|
|
246
|
+
class InvalidKeyError extends Error {
|
|
247
|
+
constructor(key, address) {
|
|
248
|
+
super(`Key "${key}" not found for address ${address}`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
exports.InvalidKeyError = InvalidKeyError;
|
package/dist/escrow.js
CHANGED
|
@@ -1128,6 +1128,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
|
+
exports.EscrowClient = EscrowClient;
|
|
1131
1132
|
__decorate([
|
|
1132
1133
|
decorators_1.requiresSigner,
|
|
1133
1134
|
__metadata("design:type", Function),
|
|
@@ -1188,7 +1189,6 @@ __decorate([
|
|
|
1188
1189
|
__metadata("design:paramtypes", [String, Array, Object]),
|
|
1189
1190
|
__metadata("design:returntype", Promise)
|
|
1190
1191
|
], EscrowClient.prototype, "addTrustedHandlers", null);
|
|
1191
|
-
exports.EscrowClient = EscrowClient;
|
|
1192
1192
|
/**
|
|
1193
1193
|
* ## Introduction
|
|
1194
1194
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA0BhD,eAAO,MAAM,iBAAiB,WAAY,cAAc,mCAuBvD,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAAW,MAAM,mCA0BzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
|
|
@@ -24,6 +24,8 @@ const LEADER_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
24
24
|
webhookUrl
|
|
25
25
|
url
|
|
26
26
|
jobTypes
|
|
27
|
+
registrationNeeded
|
|
28
|
+
registrationInstructions
|
|
27
29
|
}
|
|
28
30
|
`;
|
|
29
31
|
const GET_LEADERS_QUERY = (filter) => {
|
|
@@ -67,7 +69,9 @@ const GET_REPUTATION_NETWORK_QUERY = (role) => {
|
|
|
67
69
|
address,
|
|
68
70
|
role,
|
|
69
71
|
url,
|
|
70
|
-
jobTypes
|
|
72
|
+
jobTypes,
|
|
73
|
+
registrationNeeded,
|
|
74
|
+
registrationInstructions
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAc9D,eAAO,MAAM,sBAAsB,WAAY,mBAAmB,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAc9D,eAAO,MAAM,sBAAsB,WAAY,mBAAmB,mCAqDjE,CAAC;AAEF,eAAO,MAAM,qBAAqB,gCAOjC,CAAC"}
|
|
@@ -18,16 +18,26 @@ const TRANSACTION_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
18
18
|
`;
|
|
19
19
|
const GET_TRANSACTIONS_QUERY = (filter) => {
|
|
20
20
|
const { startDate, endDate, startBlock, endBlock, fromAddress, toAddress } = filter;
|
|
21
|
+
const addressCondition = fromAddress === toAddress
|
|
22
|
+
? `
|
|
23
|
+
${fromAddress ? `{ from: $fromAddress }` : ''}
|
|
24
|
+
${toAddress ? `{ to: $toAddress }` : ''}
|
|
25
|
+
`
|
|
26
|
+
: `
|
|
27
|
+
${fromAddress ? `from: $fromAddress` : ''}
|
|
28
|
+
${toAddress ? `to: $toAddress` : ''}
|
|
29
|
+
`;
|
|
21
30
|
const WHERE_CLAUSE = `
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
where: {
|
|
32
|
+
${fromAddress === toAddress
|
|
33
|
+
? `or: [ ${addressCondition} ],`
|
|
34
|
+
: addressCondition}
|
|
35
|
+
${startDate ? `timestamp_gte: $startDate,` : ''}
|
|
36
|
+
${endDate ? `timestamp_lte: $endDate,` : ''}
|
|
37
|
+
${startBlock ? `block_gte: $startBlock,` : ''}
|
|
38
|
+
${endBlock ? `block_lte: $endBlock,` : ''}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
31
41
|
return (0, graphql_tag_1.default) `
|
|
32
42
|
query getTransactions(
|
|
33
43
|
$fromAddress: String
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export interface ILeader {
|
|
|
30
30
|
webhookUrl?: string;
|
|
31
31
|
url?: string;
|
|
32
32
|
jobTypes?: string[];
|
|
33
|
+
registrationNeeded?: boolean;
|
|
34
|
+
registrationInstructions?: string;
|
|
33
35
|
}
|
|
34
36
|
export interface ILeaderSubgraph extends Omit<ILeader, 'jobTypes'> {
|
|
35
37
|
jobTypes?: string;
|
|
@@ -51,6 +53,8 @@ export interface IOperator {
|
|
|
51
53
|
role?: string;
|
|
52
54
|
url?: string;
|
|
53
55
|
jobTypes?: string[];
|
|
56
|
+
registrationNeeded?: boolean;
|
|
57
|
+
registrationInstructions?: string;
|
|
54
58
|
}
|
|
55
59
|
export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes'> {
|
|
56
60
|
jobTypes?: string;
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,M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QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC"}
|
package/dist/kvstore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kvstore.d.ts","sourceRoot":"","sources":["../src/kvstore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"kvstore.d.ts","sourceRoot":"","sources":["../src/kvstore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAYlC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,qBAAa,aAAc,SAAQ,gBAAgB;IACjD,OAAO,CAAC,QAAQ,CAAU;IAE1B;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;IAS5D;;;;;;;;OAQG;WACiB,KAAK,CAAC,MAAM,EAAE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|
|
247
247
|
}
|
|
248
|
+
exports.KVStoreClient = KVStoreClient;
|
|
248
249
|
__decorate([
|
|
249
250
|
decorators_1.requiresSigner,
|
|
250
251
|
__metadata("design:type", Function),
|
|
@@ -263,7 +264,6 @@ __decorate([
|
|
|
263
264
|
__metadata("design:paramtypes", [String, Object, Object]),
|
|
264
265
|
__metadata("design:returntype", Promise)
|
|
265
266
|
], KVStoreClient.prototype, "setFileUrlAndHash", null);
|
|
266
|
-
exports.KVStoreClient = KVStoreClient;
|
|
267
267
|
/**
|
|
268
268
|
* ## Introduction
|
|
269
269
|
*
|
|
@@ -365,10 +365,9 @@ class KVStoreUtils {
|
|
|
365
365
|
}
|
|
366
366
|
const { kvstores } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, kvstore_1.GET_KVSTORE_BY_ADDRESS_AND_KEY_QUERY)(), { address: address.toLowerCase(), key });
|
|
367
367
|
if (!kvstores || kvstores.length === 0) {
|
|
368
|
-
throw new
|
|
368
|
+
throw new error_1.InvalidKeyError(key, address);
|
|
369
369
|
}
|
|
370
|
-
|
|
371
|
-
return value;
|
|
370
|
+
return kvstores[0].value;
|
|
372
371
|
}
|
|
373
372
|
/**
|
|
374
373
|
* Gets the URL value of the given entity, and verifies its hash.
|
|
@@ -415,7 +414,9 @@ class KVStoreUtils {
|
|
|
415
414
|
}
|
|
416
415
|
const content = await fetch(url).then((res) => res.text());
|
|
417
416
|
const contentHash = ethers_1.ethers.keccak256(ethers_1.ethers.toUtf8Bytes(content));
|
|
418
|
-
|
|
417
|
+
const formattedHash = hash?.replace(/^0x/, '');
|
|
418
|
+
const formattedContentHash = contentHash?.replace(/^0x/, '');
|
|
419
|
+
if (formattedHash !== formattedContentHash) {
|
|
419
420
|
throw error_1.ErrorInvalidHash;
|
|
420
421
|
}
|
|
421
422
|
return url;
|
package/dist/staking.js
CHANGED
|
@@ -493,6 +493,7 @@ class StakingClient extends base_1.BaseEthersClient {
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
+
exports.StakingClient = StakingClient;
|
|
496
497
|
__decorate([
|
|
497
498
|
decorators_1.requiresSigner,
|
|
498
499
|
__metadata("design:type", Function),
|
|
@@ -541,4 +542,3 @@ __decorate([
|
|
|
541
542
|
__metadata("design:paramtypes", [String, Object]),
|
|
542
543
|
__metadata("design:returntype", Promise)
|
|
543
544
|
], StakingClient.prototype, "distributeReward", null);
|
|
544
|
-
exports.StakingClient = StakingClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAUlD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGjE,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;OAcG;WACiB,cAAc,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC;IAmBxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;WACiB,eAAe,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,YAAY,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAUlD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGjE,qBAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;OAcG;WACiB,cAAc,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC;IAmBxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;WACiB,eAAe,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,YAAY,EAAE,CAAC;CA0C3B"}
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@human-protocol/sdk",
|
|
3
3
|
"description": "Human Protocol SDK",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.6",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
7
7
|
"dist"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"graphql-request": "^6.1.0",
|
|
46
46
|
"graphql-tag": "^2.12.6",
|
|
47
47
|
"minio": "7.1.3",
|
|
48
|
-
"openpgp": "^5.11.
|
|
48
|
+
"openpgp": "^5.11.2",
|
|
49
49
|
"secp256k1": "^4.0.3",
|
|
50
50
|
"vitest": "^1.6.0"
|
|
51
51
|
},
|
package/src/constants.ts
CHANGED
|
@@ -63,7 +63,7 @@ export const NETWORKS: {
|
|
|
63
63
|
subgraphUrl:
|
|
64
64
|
'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
65
65
|
subgraphUrlApiKey:
|
|
66
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
66
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmaTcYR8NCzZuxwY7tBkMJAo1Q64BMqNNSzqjxd7FH9s2p',
|
|
67
67
|
oldSubgraphUrl: '',
|
|
68
68
|
oldFactoryAddress: '',
|
|
69
69
|
},
|
|
@@ -109,7 +109,7 @@ export const NETWORKS: {
|
|
|
109
109
|
subgraphUrl:
|
|
110
110
|
'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
111
111
|
subgraphUrlApiKey:
|
|
112
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
112
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmadNQBBzcfJHTmzLezZGbwvLux7HmnmfByBHubS2cmLUr',
|
|
113
113
|
oldSubgraphUrl: '',
|
|
114
114
|
oldFactoryAddress: '',
|
|
115
115
|
},
|
|
@@ -125,7 +125,7 @@ export const NETWORKS: {
|
|
|
125
125
|
subgraphUrl:
|
|
126
126
|
'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
|
|
127
127
|
subgraphUrlApiKey:
|
|
128
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
128
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmXZ4QJMi8kyfXDEJwtdizyKf5JdJui89iYCLCE79N8Xf5',
|
|
129
129
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
130
130
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
131
131
|
},
|
|
@@ -141,7 +141,7 @@ export const NETWORKS: {
|
|
|
141
141
|
subgraphUrl:
|
|
142
142
|
'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
143
143
|
subgraphUrlApiKey:
|
|
144
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
144
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmdq449rn4WKDf7NLvRZgt7CedZRrvpDzPqcvSmhvuu16D',
|
|
145
145
|
oldSubgraphUrl:
|
|
146
146
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
147
147
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
@@ -158,7 +158,7 @@ export const NETWORKS: {
|
|
|
158
158
|
subgraphUrl:
|
|
159
159
|
'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
160
160
|
subgraphUrlApiKey:
|
|
161
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
161
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmNdsofT4Cj2KRwr8vgyKgCWpZNmrMN41zUdygRz7eSGC9',
|
|
162
162
|
oldSubgraphUrl:
|
|
163
163
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
164
164
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
@@ -182,7 +182,7 @@ export const NETWORKS: {
|
|
|
182
182
|
[ChainId.POLYGON_AMOY]: {
|
|
183
183
|
chainId: ChainId.POLYGON_AMOY,
|
|
184
184
|
title: 'Polygon Amoy',
|
|
185
|
-
scanUrl: 'https://
|
|
185
|
+
scanUrl: 'https://amoy.polygonscan.com/',
|
|
186
186
|
factoryAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
187
187
|
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
188
188
|
stakingAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
@@ -191,7 +191,7 @@ export const NETWORKS: {
|
|
|
191
191
|
subgraphUrl:
|
|
192
192
|
'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
193
193
|
subgraphUrlApiKey:
|
|
194
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
194
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmbwio5UnvDn5GQRJ5kLJfK27fqHK9nkEh4YXXYKWCc9rH',
|
|
195
195
|
oldSubgraphUrl: '',
|
|
196
196
|
oldFactoryAddress: '',
|
|
197
197
|
},
|
|
@@ -207,7 +207,7 @@ export const NETWORKS: {
|
|
|
207
207
|
subgraphUrl:
|
|
208
208
|
'https://api.studio.thegraph.com/query/74256/moonbeam/version/latest',
|
|
209
209
|
subgraphUrlApiKey:
|
|
210
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
210
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYe9hsFYuVgQsH719AsqRNqgVM8YBYfCuhBNYjXtBqQru',
|
|
211
211
|
oldSubgraphUrl:
|
|
212
212
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam',
|
|
213
213
|
oldFactoryAddress: '0x98108c28B7767a52BE38B4860832dd4e11A7ecad',
|
|
@@ -224,7 +224,7 @@ export const NETWORKS: {
|
|
|
224
224
|
subgraphUrl:
|
|
225
225
|
'https://api.studio.thegraph.com/query/74256/moonbase-alpha/version/latest',
|
|
226
226
|
subgraphUrlApiKey:
|
|
227
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
227
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeC4JrotcrXWJtJU519RX3KkxE5879wveRJJ58EheH3j1',
|
|
228
228
|
oldSubgraphUrl: '',
|
|
229
229
|
oldFactoryAddress: '',
|
|
230
230
|
},
|
|
@@ -240,7 +240,7 @@ export const NETWORKS: {
|
|
|
240
240
|
subgraphUrl:
|
|
241
241
|
'https://api.studio.thegraph.com/query/74256/fuji/version/latest',
|
|
242
242
|
subgraphUrlApiKey:
|
|
243
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
243
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmcFhecY6w3AhKGSg8XeidXwwuXCV9DAQ5SYGE1sTzydgR',
|
|
244
244
|
oldSubgraphUrl:
|
|
245
245
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/fuji',
|
|
246
246
|
oldFactoryAddress: '0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88',
|
|
@@ -257,7 +257,7 @@ export const NETWORKS: {
|
|
|
257
257
|
subgraphUrl:
|
|
258
258
|
'https://api.studio.thegraph.com/query/74256/avalanche/version/latest',
|
|
259
259
|
subgraphUrlApiKey:
|
|
260
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
260
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYR8NUuAQVoGmGSwKanUJLjX9iZxrEyGH39HjUuXLmsum',
|
|
261
261
|
oldSubgraphUrl:
|
|
262
262
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/avalanche',
|
|
263
263
|
oldFactoryAddress: '0x9767a578ba7a5FA1563c8229943cB01cd8446BB4',
|
|
@@ -274,7 +274,7 @@ export const NETWORKS: {
|
|
|
274
274
|
subgraphUrl:
|
|
275
275
|
'https://api.studio.thegraph.com/query/74256/celo-alfajores/version/latest',
|
|
276
276
|
subgraphUrlApiKey:
|
|
277
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
277
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmb2WKCFFhT7REAjTuMd9pZvGw7rRpzeZSPJ3KRztD2pMM',
|
|
278
278
|
oldSubgraphUrl: '',
|
|
279
279
|
oldFactoryAddress: '',
|
|
280
280
|
},
|
|
@@ -290,7 +290,7 @@ export const NETWORKS: {
|
|
|
290
290
|
subgraphUrl:
|
|
291
291
|
'https://api.studio.thegraph.com/query/74256/celo/version/latest',
|
|
292
292
|
subgraphUrlApiKey:
|
|
293
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
293
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmeeb5zshw1z9Q38NNPun2Pd7P951Mkzz5ywK171tauNRY',
|
|
294
294
|
oldSubgraphUrl: '',
|
|
295
295
|
oldFactoryAddress: '',
|
|
296
296
|
},
|
|
@@ -306,7 +306,7 @@ export const NETWORKS: {
|
|
|
306
306
|
subgraphUrl:
|
|
307
307
|
'https://api.studio.thegraph.com/query/74256/xlayer/version/latest',
|
|
308
308
|
subgraphUrlApiKey:
|
|
309
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
309
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmWTggMrB5sRSs2fePuqQG9WbLMk8HtnfLH3VbRhmVdF8s',
|
|
310
310
|
oldSubgraphUrl: '',
|
|
311
311
|
oldFactoryAddress: '',
|
|
312
312
|
},
|
|
@@ -322,7 +322,7 @@ export const NETWORKS: {
|
|
|
322
322
|
subgraphUrl:
|
|
323
323
|
'https://api.studio.thegraph.com/query/74256/xlayer-testnet/version/latest',
|
|
324
324
|
subgraphUrlApiKey:
|
|
325
|
-
'https://gateway-testnet-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
325
|
+
'https://gateway-testnet-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQrTmq89ZCdVABsFpLHtQUWuyyVzbcARoan9eztHd21oP',
|
|
326
326
|
oldSubgraphUrl: '',
|
|
327
327
|
oldFactoryAddress: '',
|
|
328
328
|
},
|
|
@@ -350,6 +350,7 @@ export const KVStoreKeys = {
|
|
|
350
350
|
url: 'url',
|
|
351
351
|
jobTypes: 'job_types',
|
|
352
352
|
registrationNeeded: 'registration_needed',
|
|
353
|
+
registrationInstructions: 'registration_instructions',
|
|
353
354
|
};
|
|
354
355
|
|
|
355
356
|
export const Role = {
|
package/src/encryption.ts
CHANGED
|
@@ -4,12 +4,11 @@ import { IKeyPair } from './interfaces';
|
|
|
4
4
|
/**
|
|
5
5
|
* ## Introduction
|
|
6
6
|
*
|
|
7
|
-
* Class for
|
|
7
|
+
* Class for signing and decrypting messages.
|
|
8
8
|
*
|
|
9
|
-
* The algorithm includes the implementation of the [PGP encryption algorithm](https://github.com/openpgpjs/openpgpjs) multi-public key encryption on typescript.
|
|
10
|
-
* Using the vanilla [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) implementation Schnorr signatures for signature and [curve25519](https://en.wikipedia.org/wiki/Curve25519) for encryption. [Learn more](https://wiki.polkadot.network/docs/learn-cryptography).
|
|
9
|
+
* The algorithm includes the implementation of the [PGP encryption algorithm](https://github.com/openpgpjs/openpgpjs) multi-public key encryption on typescript, and uses the vanilla [ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) implementation Schnorr signature for signatures and [curve25519](https://en.wikipedia.org/wiki/Curve25519) for encryption. [Learn more](https://wiki.polkadot.network/docs/learn-cryptography).
|
|
11
10
|
*
|
|
12
|
-
* To get an instance of this class, is recommended
|
|
11
|
+
* To get an instance of this class, initialization is recommended using the static `build` method.
|
|
13
12
|
*
|
|
14
13
|
* ```ts
|
|
15
14
|
* static async build(privateKeyArmored: string, passphrase?: string): Promise<Encryption>
|
|
@@ -147,10 +146,10 @@ export class Encryption {
|
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
/**
|
|
150
|
-
* This function
|
|
149
|
+
* This function decrypts messages using the private key. In addition, the public key can be added for signature verification.
|
|
151
150
|
*
|
|
152
151
|
* @param {string} message Message to decrypt.
|
|
153
|
-
* @param {string} publicKey Public key used to verify signature if needed.
|
|
152
|
+
* @param {string} publicKey Public key used to verify signature if needed. This is optional.
|
|
154
153
|
* @returns {Promise<string>} Message decrypted.
|
|
155
154
|
*
|
|
156
155
|
* **Code example**
|
package/src/error.ts
CHANGED
|
@@ -345,3 +345,9 @@ export const ErrorUnsupportedStatus = new Error('Unsupported status for query');
|
|
|
345
345
|
*/
|
|
346
346
|
export const WarnSubgraphApiKeyNotProvided =
|
|
347
347
|
'"SUBGRAPH_API_KEY" is not being provided. It might cause issues with the subgraph.';
|
|
348
|
+
|
|
349
|
+
export class InvalidKeyError extends Error {
|
|
350
|
+
constructor(key: string, address: string) {
|
|
351
|
+
super(`Key "${key}" not found for address ${address}`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -20,6 +20,8 @@ const LEADER_FRAGMENT = gql`
|
|
|
20
20
|
webhookUrl
|
|
21
21
|
url
|
|
22
22
|
jobTypes
|
|
23
|
+
registrationNeeded
|
|
24
|
+
registrationInstructions
|
|
23
25
|
}
|
|
24
26
|
`;
|
|
25
27
|
|
|
@@ -67,7 +69,9 @@ export const GET_REPUTATION_NETWORK_QUERY = (role?: string) => {
|
|
|
67
69
|
address,
|
|
68
70
|
role,
|
|
69
71
|
url,
|
|
70
|
-
jobTypes
|
|
72
|
+
jobTypes,
|
|
73
|
+
registrationNeeded,
|
|
74
|
+
registrationInstructions
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
@@ -17,16 +17,30 @@ export const GET_TRANSACTIONS_QUERY = (filter: ITransactionsFilter) => {
|
|
|
17
17
|
const { startDate, endDate, startBlock, endBlock, fromAddress, toAddress } =
|
|
18
18
|
filter;
|
|
19
19
|
|
|
20
|
+
const addressCondition =
|
|
21
|
+
fromAddress === toAddress
|
|
22
|
+
? `
|
|
23
|
+
${fromAddress ? `{ from: $fromAddress }` : ''}
|
|
24
|
+
${toAddress ? `{ to: $toAddress }` : ''}
|
|
25
|
+
`
|
|
26
|
+
: `
|
|
27
|
+
${fromAddress ? `from: $fromAddress` : ''}
|
|
28
|
+
${toAddress ? `to: $toAddress` : ''}
|
|
29
|
+
`;
|
|
30
|
+
|
|
20
31
|
const WHERE_CLAUSE = `
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
where: {
|
|
33
|
+
${
|
|
34
|
+
fromAddress === toAddress
|
|
35
|
+
? `or: [ ${addressCondition} ],`
|
|
36
|
+
: addressCondition
|
|
37
|
+
}
|
|
38
|
+
${startDate ? `timestamp_gte: $startDate,` : ''}
|
|
39
|
+
${endDate ? `timestamp_lte: $endDate,` : ''}
|
|
40
|
+
${startBlock ? `block_gte: $startBlock,` : ''}
|
|
41
|
+
${endBlock ? `block_lte: $endBlock,` : ''}
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
30
44
|
|
|
31
45
|
return gql`
|
|
32
46
|
query getTransactions(
|
package/src/interfaces.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface ILeader {
|
|
|
33
33
|
webhookUrl?: string;
|
|
34
34
|
url?: string;
|
|
35
35
|
jobTypes?: string[];
|
|
36
|
+
registrationNeeded?: boolean;
|
|
37
|
+
registrationInstructions?: string;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export interface ILeaderSubgraph extends Omit<ILeader, 'jobTypes'> {
|
|
@@ -60,6 +62,8 @@ export interface IOperator {
|
|
|
60
62
|
role?: string;
|
|
61
63
|
url?: string;
|
|
62
64
|
jobTypes?: string[];
|
|
65
|
+
registrationNeeded?: boolean;
|
|
66
|
+
registrationInstructions?: string;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes'> {
|
package/src/kvstore.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
ErrorKVStoreEmptyKey,
|
|
16
16
|
ErrorProviderDoesNotExist,
|
|
17
17
|
ErrorUnsupportedChainID,
|
|
18
|
+
InvalidKeyError,
|
|
18
19
|
} from './error';
|
|
19
20
|
import gqlFetch from 'graphql-request';
|
|
20
21
|
import { NetworkData } from './types';
|
|
@@ -406,12 +407,10 @@ export class KVStoreUtils {
|
|
|
406
407
|
);
|
|
407
408
|
|
|
408
409
|
if (!kvstores || kvstores.length === 0) {
|
|
409
|
-
throw new
|
|
410
|
+
throw new InvalidKeyError(key, address);
|
|
410
411
|
}
|
|
411
412
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
return value;
|
|
413
|
+
return kvstores[0].value;
|
|
415
414
|
}
|
|
416
415
|
|
|
417
416
|
/**
|
|
@@ -465,7 +464,10 @@ export class KVStoreUtils {
|
|
|
465
464
|
const content = await fetch(url).then((res) => res.text());
|
|
466
465
|
const contentHash = ethers.keccak256(ethers.toUtf8Bytes(content));
|
|
467
466
|
|
|
468
|
-
|
|
467
|
+
const formattedHash = hash?.replace(/^0x/, '');
|
|
468
|
+
const formattedContentHash = contentHash?.replace(/^0x/, '');
|
|
469
|
+
|
|
470
|
+
if (formattedHash !== formattedContentHash) {
|
|
469
471
|
throw ErrorInvalidHash;
|
|
470
472
|
}
|
|
471
473
|
|
package/src/transaction.ts
CHANGED