@human-protocol/sdk 4.1.4 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.js +7 -7
- package/dist/error.d.ts +2 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +3 -3
- package/dist/escrow.d.ts +6 -6
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +19 -18
- package/dist/graphql/queries/escrow.js +3 -3
- package/dist/interfaces.d.ts +3 -3
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +17 -1
- package/package.json +1 -1
- package/src/constants.ts +7 -7
- package/src/error.ts +2 -2
- package/src/escrow.ts +21 -23
- package/src/graphql/queries/escrow.ts +3 -3
- package/src/interfaces.ts +3 -3
- package/src/utils.ts +15 -0
package/dist/constants.js
CHANGED
|
@@ -28,7 +28,7 @@ exports.NETWORKS = {
|
|
|
28
28
|
stakingAddress: '0xEf6Da3aB52c33925Be3F84038193a7e1331F51E6',
|
|
29
29
|
kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
|
|
30
30
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
31
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
31
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQwp4Rr2J4UbPFykb9eXg2t7GPcGRS6WT7QzExZtv32jK',
|
|
32
32
|
oldSubgraphUrl: '',
|
|
33
33
|
oldFactoryAddress: '',
|
|
34
34
|
},
|
|
@@ -41,7 +41,7 @@ exports.NETWORKS = {
|
|
|
41
41
|
stakingAddress: '0x2163e3A40032Af1C359ac731deaB48258b317890',
|
|
42
42
|
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
43
43
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
44
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
44
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmURrhnEXimGnRzjeN3B4VMmioUeBHUBg4WJ7KZzJ7em8g',
|
|
45
45
|
oldSubgraphUrl: '',
|
|
46
46
|
oldFactoryAddress: '',
|
|
47
47
|
},
|
|
@@ -54,7 +54,7 @@ exports.NETWORKS = {
|
|
|
54
54
|
stakingAddress: '0xE24e5C08E28331D24758b69A5E9f383D2bDD1c98',
|
|
55
55
|
kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
|
|
56
56
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/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/QmT2VoBLjAfc4pQzDmeCGra6weoLuk2jPRgnRz5iSMUw1t',
|
|
58
58
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
59
59
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
60
60
|
},
|
|
@@ -67,7 +67,7 @@ exports.NETWORKS = {
|
|
|
67
67
|
stakingAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
68
68
|
kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
|
|
69
69
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
70
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
70
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZHqbiyAAwrmqsVJLhTEdejVGYJpXfJAkJXUw7C2VV1TD',
|
|
71
71
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
72
72
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
73
73
|
},
|
|
@@ -80,7 +80,7 @@ exports.NETWORKS = {
|
|
|
80
80
|
stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
|
|
81
81
|
kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
|
|
82
82
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
83
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
83
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT72ecfx6Zaje21kLNi17kDJTpPKFYvzQETDyLpQgDrPu',
|
|
84
84
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
85
85
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
86
86
|
},
|
|
@@ -93,7 +93,7 @@ exports.NETWORKS = {
|
|
|
93
93
|
stakingAddress: '0xffE496683F842a923110415b7278ded3F265f2C5',
|
|
94
94
|
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
95
95
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
96
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
96
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeeE9bVkat1mkbQg1R6SXLuLadXxoNCY5b7CEQkmu6cQi',
|
|
97
97
|
oldSubgraphUrl: '',
|
|
98
98
|
oldFactoryAddress: '',
|
|
99
99
|
},
|
|
@@ -106,7 +106,7 @@ exports.NETWORKS = {
|
|
|
106
106
|
stakingAddress: '0x7457d26a3C70Bd71F7557C773b303c1dB82BBB68',
|
|
107
107
|
kvstoreAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
108
108
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
109
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
109
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQiLaFKusXLzKrpZvQDg7vETLhdfPgzWJN3Uxp3bE9K9W',
|
|
110
110
|
oldSubgraphUrl: '',
|
|
111
111
|
oldFactoryAddress: '',
|
|
112
112
|
},
|
package/dist/error.d.ts
CHANGED
|
@@ -131,9 +131,9 @@ export declare const ErrorManifestFileDoesNotExist: Error;
|
|
|
131
131
|
*/
|
|
132
132
|
export declare const ErrorInvalidUrl: Error;
|
|
133
133
|
/**
|
|
134
|
-
* @constant {Error} -
|
|
134
|
+
* @constant {Error} - Invalid manifest.
|
|
135
135
|
*/
|
|
136
|
-
export declare const
|
|
136
|
+
export declare const ErrorInvalidManifest: Error;
|
|
137
137
|
/**
|
|
138
138
|
* @constant {Error} - List of handlers cannot be empty.
|
|
139
139
|
*/
|
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,mBAA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AAE,MAAM;CAGzC"}
|
package/dist/error.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EthereumError = exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = exports.ErrorInvalidHash = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorTooManyRecipients = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.
|
|
3
|
+
exports.EthereumError = exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = exports.ErrorInvalidHash = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorTooManyRecipients = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.ErrorInvalidManifest = exports.ErrorInvalidUrl = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = exports.ErrorCannotUseDateAndBlockSimultaneously = exports.ErrorInvalidHashProvided = exports.ErrorInvalidStakerAddressProvided = exports.ErrorInvalidSlasherAddressProvided = exports.ErrorInvalidStakingValueSign = exports.ErrorInvalidStakingValueType = exports.ErrorStakingValueMustBePositive = exports.ErrorInvalidExchangeOracleAddressProvided = exports.ErrorInvalidReputationOracleAddressProvided = exports.ErrorInvalidRecordingOracleAddressProvided = exports.ErrorInvalidTokenAddress = exports.ErrorInvalidAddress = exports.ErrorKVStoreArrayLength = exports.ErrorKVStoreEmptyKey = exports.ErrorStorageFileNotUploaded = exports.ErrorStorageFileNotFound = exports.ErrorStorageBucketNotFound = exports.ErrorStorageCredentialsMissing = exports.ErrorStorageClientNotExists = exports.ErrorStorageClientNotInitialized = exports.ErrorStakingMissing = void 0;
|
|
4
4
|
exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* @constant {Error} - The Staking contract is missing.
|
|
@@ -135,9 +135,9 @@ exports.ErrorManifestFileDoesNotExist = new Error('Manifest file does not exist'
|
|
|
135
135
|
*/
|
|
136
136
|
exports.ErrorInvalidUrl = new Error('Invalid URL string');
|
|
137
137
|
/**
|
|
138
|
-
* @constant {Error} -
|
|
138
|
+
* @constant {Error} - Invalid manifest.
|
|
139
139
|
*/
|
|
140
|
-
exports.
|
|
140
|
+
exports.ErrorInvalidManifest = new Error('Invalid manifest');
|
|
141
141
|
/**
|
|
142
142
|
* @constant {Error} - List of handlers cannot be empty.
|
|
143
143
|
*/
|
package/dist/escrow.d.ts
CHANGED
|
@@ -162,7 +162,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
162
162
|
* recordingOracleFee: BigInt('10'),
|
|
163
163
|
* reputationOracleFee: BigInt('10'),
|
|
164
164
|
* exchangeOracleFee: BigInt('10'),
|
|
165
|
-
*
|
|
165
|
+
* manifest: 'http://localhost/manifest.json',
|
|
166
166
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
167
167
|
* };
|
|
168
168
|
* await escrowClient.setup(escrowAddress, escrowConfig);
|
|
@@ -463,7 +463,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
463
463
|
*/
|
|
464
464
|
getManifestHash(escrowAddress: string): Promise<string>;
|
|
465
465
|
/**
|
|
466
|
-
* This function returns the manifest
|
|
466
|
+
* This function returns the manifest. Could be a URL or a JSON string.
|
|
467
467
|
*
|
|
468
468
|
* @param {string} escrowAddress Address of the escrow.
|
|
469
469
|
* @returns {Promise<string>} Url of the manifest.
|
|
@@ -479,10 +479,10 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
479
479
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
480
480
|
* const escrowClient = await EscrowClient.build(provider);
|
|
481
481
|
*
|
|
482
|
-
* const
|
|
482
|
+
* const manifest = await escrowClient.getManifest('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
483
483
|
* ```
|
|
484
484
|
*/
|
|
485
|
-
|
|
485
|
+
getManifest(escrowAddress: string): Promise<string>;
|
|
486
486
|
/**
|
|
487
487
|
* This function returns the results file URL.
|
|
488
488
|
*
|
|
@@ -772,7 +772,7 @@ export declare class EscrowUtils {
|
|
|
772
772
|
* intermediateResultsUrl?: string;
|
|
773
773
|
* launcher: string;
|
|
774
774
|
* manifestHash?: string;
|
|
775
|
-
*
|
|
775
|
+
* manifest?: string;
|
|
776
776
|
* recordingOracle?: string;
|
|
777
777
|
* reputationOracle?: string;
|
|
778
778
|
* exchangeOracle?: string;
|
|
@@ -835,7 +835,7 @@ export declare class EscrowUtils {
|
|
|
835
835
|
* intermediateResultsUrl?: string;
|
|
836
836
|
* launcher: string;
|
|
837
837
|
* manifestHash?: string;
|
|
838
|
-
*
|
|
838
|
+
* manifest?: string;
|
|
839
839
|
* recordingOracle?: string;
|
|
840
840
|
* reputationOracle?: string;
|
|
841
841
|
* exchangeOracle?: string;
|
package/dist/escrow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAkB,MAAM,QAAQ,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AA0BlD,OAAO,EAML,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,wBAAwB,EACxB,MAAM,EACP,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAkB,MAAM,QAAQ,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AA0BlD,OAAO,EAML,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,wBAAwB,EACxB,MAAM,EACP,MAAM,SAAS,CAAC;AASjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,YAAa,SAA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A2D1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,CAAC;IAoBnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;WACiB,eAAe,CACjC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC;IA+DzB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;WACiB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAiCzE"}
|
package/dist/escrow.js
CHANGED
|
@@ -223,14 +223,14 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
223
223
|
* recordingOracleFee: BigInt('10'),
|
|
224
224
|
* reputationOracleFee: BigInt('10'),
|
|
225
225
|
* exchangeOracleFee: BigInt('10'),
|
|
226
|
-
*
|
|
226
|
+
* manifest: 'http://localhost/manifest.json',
|
|
227
227
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
228
228
|
* };
|
|
229
229
|
* await escrowClient.setup(escrowAddress, escrowConfig);
|
|
230
230
|
* ```
|
|
231
231
|
*/
|
|
232
232
|
async setup(escrowAddress, escrowConfig, txOptions = {}) {
|
|
233
|
-
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee,
|
|
233
|
+
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee, manifest, manifestHash, } = escrowConfig;
|
|
234
234
|
if (!ethers_1.ethers.isAddress(recordingOracle)) {
|
|
235
235
|
throw error_1.ErrorInvalidRecordingOracleAddressProvided;
|
|
236
236
|
}
|
|
@@ -251,11 +251,9 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
251
251
|
if (recordingOracleFee + reputationOracleFee + exchangeOracleFee > 100) {
|
|
252
252
|
throw error_1.ErrorTotalFeeMustBeLessThanHundred;
|
|
253
253
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (!(0, utils_1.isValidUrl)(manifestUrl)) {
|
|
258
|
-
throw error_1.ErrorInvalidUrl;
|
|
254
|
+
const isManifestValid = (0, utils_1.isValidUrl)(manifest) || (0, utils_1.isValidJson)(manifest);
|
|
255
|
+
if (!isManifestValid) {
|
|
256
|
+
throw error_1.ErrorInvalidManifest;
|
|
259
257
|
}
|
|
260
258
|
if (!manifestHash) {
|
|
261
259
|
throw error_1.ErrorHashIsEmptyString;
|
|
@@ -265,7 +263,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
265
263
|
}
|
|
266
264
|
try {
|
|
267
265
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
268
|
-
await (await escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee,
|
|
266
|
+
await (await escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifest, manifestHash, txOptions)).wait();
|
|
269
267
|
return;
|
|
270
268
|
}
|
|
271
269
|
catch (e) {
|
|
@@ -352,7 +350,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
352
350
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
353
351
|
}
|
|
354
352
|
if (!url) {
|
|
355
|
-
throw error_1.
|
|
353
|
+
throw error_1.ErrorInvalidUrl;
|
|
356
354
|
}
|
|
357
355
|
if (!(0, utils_1.isValidUrl)(url)) {
|
|
358
356
|
throw error_1.ErrorInvalidUrl;
|
|
@@ -756,7 +754,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
756
754
|
}
|
|
757
755
|
});
|
|
758
756
|
if (!finalResultsUrl) {
|
|
759
|
-
throw error_1.
|
|
757
|
+
throw error_1.ErrorInvalidUrl;
|
|
760
758
|
}
|
|
761
759
|
if (!(0, utils_1.isValidUrl)(finalResultsUrl)) {
|
|
762
760
|
throw error_1.ErrorInvalidUrl;
|
|
@@ -853,7 +851,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
853
851
|
}
|
|
854
852
|
}
|
|
855
853
|
/**
|
|
856
|
-
* This function returns the manifest
|
|
854
|
+
* This function returns the manifest. Could be a URL or a JSON string.
|
|
857
855
|
*
|
|
858
856
|
* @param {string} escrowAddress Address of the escrow.
|
|
859
857
|
* @returns {Promise<string>} Url of the manifest.
|
|
@@ -869,10 +867,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
869
867
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
870
868
|
* const escrowClient = await EscrowClient.build(provider);
|
|
871
869
|
*
|
|
872
|
-
* const
|
|
870
|
+
* const manifest = await escrowClient.getManifest('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
873
871
|
* ```
|
|
874
872
|
*/
|
|
875
|
-
async
|
|
873
|
+
async getManifest(escrowAddress) {
|
|
876
874
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
877
875
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
878
876
|
}
|
|
@@ -1363,7 +1361,7 @@ class EscrowUtils {
|
|
|
1363
1361
|
* intermediateResultsUrl?: string;
|
|
1364
1362
|
* launcher: string;
|
|
1365
1363
|
* manifestHash?: string;
|
|
1366
|
-
*
|
|
1364
|
+
* manifest?: string;
|
|
1367
1365
|
* recordingOracle?: string;
|
|
1368
1366
|
* reputationOracle?: string;
|
|
1369
1367
|
* exchangeOracle?: string;
|
|
@@ -1412,15 +1410,18 @@ class EscrowUtils {
|
|
|
1412
1410
|
if (!networkData) {
|
|
1413
1411
|
throw error_1.ErrorUnsupportedChainID;
|
|
1414
1412
|
}
|
|
1413
|
+
let statuses;
|
|
1414
|
+
if (filter.status !== undefined) {
|
|
1415
|
+
statuses = Array.isArray(filter.status) ? filter.status : [filter.status];
|
|
1416
|
+
statuses = statuses.map((status) => types_1.EscrowStatus[status]);
|
|
1417
|
+
}
|
|
1415
1418
|
const { escrows } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_ESCROWS_QUERY)(filter), {
|
|
1416
1419
|
...filter,
|
|
1417
1420
|
launcher: filter.launcher?.toLowerCase(),
|
|
1418
1421
|
reputationOracle: filter.reputationOracle?.toLowerCase(),
|
|
1419
1422
|
recordingOracle: filter.recordingOracle?.toLowerCase(),
|
|
1420
1423
|
exchangeOracle: filter.exchangeOracle?.toLowerCase(),
|
|
1421
|
-
status:
|
|
1422
|
-
? Object.entries(types_1.EscrowStatus).find(([, value]) => value === filter.status)?.[0]
|
|
1423
|
-
: undefined,
|
|
1424
|
+
status: statuses,
|
|
1424
1425
|
from: filter.from ? (0, utils_1.getUnixTimestamp)(filter.from) : undefined,
|
|
1425
1426
|
to: filter.to ? (0, utils_1.getUnixTimestamp)(filter.to) : undefined,
|
|
1426
1427
|
orderDirection: orderDirection,
|
|
@@ -1466,7 +1467,7 @@ class EscrowUtils {
|
|
|
1466
1467
|
* intermediateResultsUrl?: string;
|
|
1467
1468
|
* launcher: string;
|
|
1468
1469
|
* manifestHash?: string;
|
|
1469
|
-
*
|
|
1470
|
+
* manifest?: string;
|
|
1470
1471
|
* recordingOracle?: string;
|
|
1471
1472
|
* reputationOracle?: string;
|
|
1472
1473
|
* exchangeOracle?: string;
|
|
@@ -18,7 +18,7 @@ const ESCROW_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
18
18
|
jobRequesterId
|
|
19
19
|
launcher
|
|
20
20
|
manifestHash
|
|
21
|
-
|
|
21
|
+
manifest
|
|
22
22
|
recordingOracle
|
|
23
23
|
reputationOracle
|
|
24
24
|
exchangeOracle
|
|
@@ -46,7 +46,7 @@ const GET_ESCROWS_QUERY = (filter) => {
|
|
|
46
46
|
${reputationOracle ? `reputationOracle: $reputationOracle,` : ''}
|
|
47
47
|
${recordingOracle ? `recordingOracle: $recordingOracle,` : ''}
|
|
48
48
|
${exchangeOracle ? `exchangeOracle: $exchangeOracle,` : ''}
|
|
49
|
-
${status !== undefined ? `
|
|
49
|
+
${status !== undefined ? `status_in: $status,` : ''}
|
|
50
50
|
${from ? `createdAt_gte: $from,` : ''}
|
|
51
51
|
${to ? `createdAt_lte: $to,` : ''}
|
|
52
52
|
}
|
|
@@ -58,7 +58,7 @@ const GET_ESCROWS_QUERY = (filter) => {
|
|
|
58
58
|
$reputationOracle: String
|
|
59
59
|
$recordingOracle: String
|
|
60
60
|
$exchangeOracle: String
|
|
61
|
-
$status: String
|
|
61
|
+
$status: [String!]
|
|
62
62
|
$from: Int
|
|
63
63
|
$to: Int
|
|
64
64
|
$orderDirection: String
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface IEscrow {
|
|
|
67
67
|
intermediateResultsUrl?: string;
|
|
68
68
|
launcher: string;
|
|
69
69
|
manifestHash?: string;
|
|
70
|
-
|
|
70
|
+
manifest?: string;
|
|
71
71
|
recordingOracle?: string;
|
|
72
72
|
reputationOracle?: string;
|
|
73
73
|
exchangeOracle?: string;
|
|
@@ -83,7 +83,7 @@ export interface IEscrowsFilter extends IPagination {
|
|
|
83
83
|
recordingOracle?: string;
|
|
84
84
|
exchangeOracle?: string;
|
|
85
85
|
jobRequesterId?: string;
|
|
86
|
-
status?: EscrowStatus;
|
|
86
|
+
status?: EscrowStatus | EscrowStatus[];
|
|
87
87
|
from?: Date;
|
|
88
88
|
to?: Date;
|
|
89
89
|
chainId: ChainId;
|
|
@@ -95,7 +95,7 @@ export interface IEscrowConfig {
|
|
|
95
95
|
recordingOracleFee: bigint;
|
|
96
96
|
reputationOracleFee: bigint;
|
|
97
97
|
exchangeOracleFee: bigint;
|
|
98
|
-
|
|
98
|
+
manifest: string;
|
|
99
99
|
manifestHash: string;
|
|
100
100
|
}
|
|
101
101
|
export interface IKeyPair {
|
package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AI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ export declare const throwError: (e: any) => never;
|
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
export declare const isValidUrl: (url: string) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* **Check if a string is a valid JSON.*
|
|
18
|
+
*
|
|
19
|
+
* @param {string} input
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
export declare const isValidJson: (input: string) => boolean;
|
|
16
23
|
/**
|
|
17
24
|
* **Get the subgraph URL.*
|
|
18
25
|
*
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,GAAG,UAgBhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,YAOrC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,aAAa,WAAW,WAatD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,IAAI,KAAG,MAE7C,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,GAAG,UAgBhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,YAOrC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,OAO3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,aAAa,WAAW,WAatD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,IAAI,KAAG,MAE7C,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUnixTimestamp = exports.getSubgraphUrl = exports.isValidUrl = exports.throwError = void 0;
|
|
3
|
+
exports.getUnixTimestamp = exports.getSubgraphUrl = exports.isValidJson = exports.isValidUrl = exports.throwError = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
const ethers_1 = require("ethers");
|
|
6
6
|
const enums_1 = require("./enums");
|
|
@@ -52,6 +52,22 @@ const isValidUrl = (url) => {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
exports.isValidUrl = isValidUrl;
|
|
55
|
+
/**
|
|
56
|
+
* **Check if a string is a valid JSON.*
|
|
57
|
+
*
|
|
58
|
+
* @param {string} input
|
|
59
|
+
* @returns {boolean}
|
|
60
|
+
*/
|
|
61
|
+
const isValidJson = (input) => {
|
|
62
|
+
try {
|
|
63
|
+
JSON.parse(input);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.isValidJson = isValidJson;
|
|
55
71
|
/**
|
|
56
72
|
* **Get the subgraph URL.*
|
|
57
73
|
*
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -36,7 +36,7 @@ export const NETWORKS: {
|
|
|
36
36
|
subgraphUrl:
|
|
37
37
|
'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
38
38
|
subgraphUrlApiKey:
|
|
39
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
39
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQwp4Rr2J4UbPFykb9eXg2t7GPcGRS6WT7QzExZtv32jK',
|
|
40
40
|
oldSubgraphUrl: '',
|
|
41
41
|
oldFactoryAddress: '',
|
|
42
42
|
},
|
|
@@ -51,7 +51,7 @@ export const NETWORKS: {
|
|
|
51
51
|
subgraphUrl:
|
|
52
52
|
'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
53
53
|
subgraphUrlApiKey:
|
|
54
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
54
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmURrhnEXimGnRzjeN3B4VMmioUeBHUBg4WJ7KZzJ7em8g',
|
|
55
55
|
oldSubgraphUrl: '',
|
|
56
56
|
oldFactoryAddress: '',
|
|
57
57
|
},
|
|
@@ -66,7 +66,7 @@ export const NETWORKS: {
|
|
|
66
66
|
subgraphUrl:
|
|
67
67
|
'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
|
|
68
68
|
subgraphUrlApiKey:
|
|
69
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
69
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT2VoBLjAfc4pQzDmeCGra6weoLuk2jPRgnRz5iSMUw1t',
|
|
70
70
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
71
71
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
72
72
|
},
|
|
@@ -81,7 +81,7 @@ export const NETWORKS: {
|
|
|
81
81
|
subgraphUrl:
|
|
82
82
|
'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
83
83
|
subgraphUrlApiKey:
|
|
84
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
84
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZHqbiyAAwrmqsVJLhTEdejVGYJpXfJAkJXUw7C2VV1TD',
|
|
85
85
|
oldSubgraphUrl:
|
|
86
86
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
87
87
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
@@ -97,7 +97,7 @@ export const NETWORKS: {
|
|
|
97
97
|
subgraphUrl:
|
|
98
98
|
'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
99
99
|
subgraphUrlApiKey:
|
|
100
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
100
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT72ecfx6Zaje21kLNi17kDJTpPKFYvzQETDyLpQgDrPu',
|
|
101
101
|
oldSubgraphUrl:
|
|
102
102
|
'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
103
103
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
@@ -113,7 +113,7 @@ export const NETWORKS: {
|
|
|
113
113
|
subgraphUrl:
|
|
114
114
|
'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
115
115
|
subgraphUrlApiKey:
|
|
116
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
116
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeeE9bVkat1mkbQg1R6SXLuLadXxoNCY5b7CEQkmu6cQi',
|
|
117
117
|
oldSubgraphUrl: '',
|
|
118
118
|
oldFactoryAddress: '',
|
|
119
119
|
},
|
|
@@ -128,7 +128,7 @@ export const NETWORKS: {
|
|
|
128
128
|
subgraphUrl:
|
|
129
129
|
'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
130
130
|
subgraphUrlApiKey:
|
|
131
|
-
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
131
|
+
'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQiLaFKusXLzKrpZvQDg7vETLhdfPgzWJN3Uxp3bE9K9W',
|
|
132
132
|
oldSubgraphUrl: '',
|
|
133
133
|
oldFactoryAddress: '',
|
|
134
134
|
},
|
package/src/error.ts
CHANGED
|
@@ -202,9 +202,9 @@ export const ErrorManifestFileDoesNotExist = new Error(
|
|
|
202
202
|
export const ErrorInvalidUrl = new Error('Invalid URL string');
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
|
-
* @constant {Error} -
|
|
205
|
+
* @constant {Error} - Invalid manifest.
|
|
206
206
|
*/
|
|
207
|
-
export const
|
|
207
|
+
export const ErrorInvalidManifest = new Error('Invalid manifest');
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
210
|
* @constant {Error} - List of handlers cannot be empty.
|
package/src/escrow.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
ErrorInvalidAddress,
|
|
25
25
|
ErrorInvalidEscrowAddressProvided,
|
|
26
26
|
ErrorInvalidExchangeOracleAddressProvided,
|
|
27
|
+
ErrorInvalidManifest,
|
|
27
28
|
ErrorInvalidRecordingOracleAddressProvided,
|
|
28
29
|
ErrorInvalidReputationOracleAddressProvided,
|
|
29
30
|
ErrorInvalidTokenAddress,
|
|
@@ -37,7 +38,6 @@ import {
|
|
|
37
38
|
ErrorTotalFeeMustBeLessThanHundred,
|
|
38
39
|
ErrorTransferEventNotFoundInTransactionLogs,
|
|
39
40
|
ErrorUnsupportedChainID,
|
|
40
|
-
ErrorUrlIsEmptyString,
|
|
41
41
|
InvalidEthereumAddressError,
|
|
42
42
|
} from './error';
|
|
43
43
|
import {
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
import {
|
|
67
67
|
getSubgraphUrl,
|
|
68
68
|
getUnixTimestamp,
|
|
69
|
+
isValidJson,
|
|
69
70
|
isValidUrl,
|
|
70
71
|
throwError,
|
|
71
72
|
} from './utils';
|
|
@@ -302,7 +303,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
302
303
|
* recordingOracleFee: BigInt('10'),
|
|
303
304
|
* reputationOracleFee: BigInt('10'),
|
|
304
305
|
* exchangeOracleFee: BigInt('10'),
|
|
305
|
-
*
|
|
306
|
+
* manifest: 'http://localhost/manifest.json',
|
|
306
307
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
307
308
|
* };
|
|
308
309
|
* await escrowClient.setup(escrowAddress, escrowConfig);
|
|
@@ -321,7 +322,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
321
322
|
recordingOracleFee,
|
|
322
323
|
reputationOracleFee,
|
|
323
324
|
exchangeOracleFee,
|
|
324
|
-
|
|
325
|
+
manifest,
|
|
325
326
|
manifestHash,
|
|
326
327
|
} = escrowConfig;
|
|
327
328
|
|
|
@@ -353,12 +354,9 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
353
354
|
throw ErrorTotalFeeMustBeLessThanHundred;
|
|
354
355
|
}
|
|
355
356
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (!isValidUrl(manifestUrl)) {
|
|
361
|
-
throw ErrorInvalidUrl;
|
|
357
|
+
const isManifestValid = isValidUrl(manifest) || isValidJson(manifest);
|
|
358
|
+
if (!isManifestValid) {
|
|
359
|
+
throw ErrorInvalidManifest;
|
|
362
360
|
}
|
|
363
361
|
|
|
364
362
|
if (!manifestHash) {
|
|
@@ -380,7 +378,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
380
378
|
reputationOracleFee,
|
|
381
379
|
recordingOracleFee,
|
|
382
380
|
exchangeOracleFee,
|
|
383
|
-
|
|
381
|
+
manifest,
|
|
384
382
|
manifestHash,
|
|
385
383
|
txOptions
|
|
386
384
|
)
|
|
@@ -495,7 +493,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
495
493
|
}
|
|
496
494
|
|
|
497
495
|
if (!url) {
|
|
498
|
-
throw
|
|
496
|
+
throw ErrorInvalidUrl;
|
|
499
497
|
}
|
|
500
498
|
|
|
501
499
|
if (!isValidUrl(url)) {
|
|
@@ -1043,7 +1041,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
1043
1041
|
});
|
|
1044
1042
|
|
|
1045
1043
|
if (!finalResultsUrl) {
|
|
1046
|
-
throw
|
|
1044
|
+
throw ErrorInvalidUrl;
|
|
1047
1045
|
}
|
|
1048
1046
|
|
|
1049
1047
|
if (!isValidUrl(finalResultsUrl)) {
|
|
@@ -1153,7 +1151,7 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
1153
1151
|
}
|
|
1154
1152
|
|
|
1155
1153
|
/**
|
|
1156
|
-
* This function returns the manifest
|
|
1154
|
+
* This function returns the manifest. Could be a URL or a JSON string.
|
|
1157
1155
|
*
|
|
1158
1156
|
* @param {string} escrowAddress Address of the escrow.
|
|
1159
1157
|
* @returns {Promise<string>} Url of the manifest.
|
|
@@ -1169,10 +1167,10 @@ export class EscrowClient extends BaseEthersClient {
|
|
|
1169
1167
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
1170
1168
|
* const escrowClient = await EscrowClient.build(provider);
|
|
1171
1169
|
*
|
|
1172
|
-
* const
|
|
1170
|
+
* const manifest = await escrowClient.getManifest('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
1173
1171
|
* ```
|
|
1174
1172
|
*/
|
|
1175
|
-
async
|
|
1173
|
+
async getManifest(escrowAddress: string): Promise<string> {
|
|
1176
1174
|
if (!ethers.isAddress(escrowAddress)) {
|
|
1177
1175
|
throw ErrorInvalidEscrowAddressProvided;
|
|
1178
1176
|
}
|
|
@@ -1631,7 +1629,7 @@ export class EscrowUtils {
|
|
|
1631
1629
|
* intermediateResultsUrl?: string;
|
|
1632
1630
|
* launcher: string;
|
|
1633
1631
|
* manifestHash?: string;
|
|
1634
|
-
*
|
|
1632
|
+
* manifest?: string;
|
|
1635
1633
|
* recordingOracle?: string;
|
|
1636
1634
|
* reputationOracle?: string;
|
|
1637
1635
|
* exchangeOracle?: string;
|
|
@@ -1688,6 +1686,11 @@ export class EscrowUtils {
|
|
|
1688
1686
|
throw ErrorUnsupportedChainID;
|
|
1689
1687
|
}
|
|
1690
1688
|
|
|
1689
|
+
let statuses;
|
|
1690
|
+
if (filter.status !== undefined) {
|
|
1691
|
+
statuses = Array.isArray(filter.status) ? filter.status : [filter.status];
|
|
1692
|
+
statuses = statuses.map((status) => EscrowStatus[status]);
|
|
1693
|
+
}
|
|
1691
1694
|
const { escrows } = await gqlFetch<{ escrows: EscrowData[] }>(
|
|
1692
1695
|
getSubgraphUrl(networkData),
|
|
1693
1696
|
GET_ESCROWS_QUERY(filter),
|
|
@@ -1697,12 +1700,7 @@ export class EscrowUtils {
|
|
|
1697
1700
|
reputationOracle: filter.reputationOracle?.toLowerCase(),
|
|
1698
1701
|
recordingOracle: filter.recordingOracle?.toLowerCase(),
|
|
1699
1702
|
exchangeOracle: filter.exchangeOracle?.toLowerCase(),
|
|
1700
|
-
status:
|
|
1701
|
-
filter.status !== undefined
|
|
1702
|
-
? Object.entries(EscrowStatus).find(
|
|
1703
|
-
([, value]) => value === filter.status
|
|
1704
|
-
)?.[0]
|
|
1705
|
-
: undefined,
|
|
1703
|
+
status: statuses,
|
|
1706
1704
|
from: filter.from ? getUnixTimestamp(filter.from) : undefined,
|
|
1707
1705
|
to: filter.to ? getUnixTimestamp(filter.to) : undefined,
|
|
1708
1706
|
orderDirection: orderDirection,
|
|
@@ -1752,7 +1750,7 @@ export class EscrowUtils {
|
|
|
1752
1750
|
* intermediateResultsUrl?: string;
|
|
1753
1751
|
* launcher: string;
|
|
1754
1752
|
* manifestHash?: string;
|
|
1755
|
-
*
|
|
1753
|
+
* manifest?: string;
|
|
1756
1754
|
* recordingOracle?: string;
|
|
1757
1755
|
* reputationOracle?: string;
|
|
1758
1756
|
* exchangeOracle?: string;
|
|
@@ -14,7 +14,7 @@ const ESCROW_FRAGMENT = gql`
|
|
|
14
14
|
jobRequesterId
|
|
15
15
|
launcher
|
|
16
16
|
manifestHash
|
|
17
|
-
|
|
17
|
+
manifest
|
|
18
18
|
recordingOracle
|
|
19
19
|
reputationOracle
|
|
20
20
|
exchangeOracle
|
|
@@ -53,7 +53,7 @@ export const GET_ESCROWS_QUERY = (filter: IEscrowsFilter) => {
|
|
|
53
53
|
${reputationOracle ? `reputationOracle: $reputationOracle,` : ''}
|
|
54
54
|
${recordingOracle ? `recordingOracle: $recordingOracle,` : ''}
|
|
55
55
|
${exchangeOracle ? `exchangeOracle: $exchangeOracle,` : ''}
|
|
56
|
-
${status !== undefined ? `
|
|
56
|
+
${status !== undefined ? `status_in: $status,` : ''}
|
|
57
57
|
${from ? `createdAt_gte: $from,` : ''}
|
|
58
58
|
${to ? `createdAt_lte: $to,` : ''}
|
|
59
59
|
}
|
|
@@ -66,7 +66,7 @@ export const GET_ESCROWS_QUERY = (filter: IEscrowsFilter) => {
|
|
|
66
66
|
$reputationOracle: String
|
|
67
67
|
$recordingOracle: String
|
|
68
68
|
$exchangeOracle: String
|
|
69
|
-
$status: String
|
|
69
|
+
$status: [String!]
|
|
70
70
|
$from: Int
|
|
71
71
|
$to: Int
|
|
72
72
|
$orderDirection: String
|
package/src/interfaces.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface IEscrow {
|
|
|
75
75
|
intermediateResultsUrl?: string;
|
|
76
76
|
launcher: string;
|
|
77
77
|
manifestHash?: string;
|
|
78
|
-
|
|
78
|
+
manifest?: string;
|
|
79
79
|
recordingOracle?: string;
|
|
80
80
|
reputationOracle?: string;
|
|
81
81
|
exchangeOracle?: string;
|
|
@@ -92,7 +92,7 @@ export interface IEscrowsFilter extends IPagination {
|
|
|
92
92
|
recordingOracle?: string;
|
|
93
93
|
exchangeOracle?: string;
|
|
94
94
|
jobRequesterId?: string;
|
|
95
|
-
status?: EscrowStatus;
|
|
95
|
+
status?: EscrowStatus | EscrowStatus[];
|
|
96
96
|
from?: Date;
|
|
97
97
|
to?: Date;
|
|
98
98
|
chainId: ChainId;
|
|
@@ -105,7 +105,7 @@ export interface IEscrowConfig {
|
|
|
105
105
|
recordingOracleFee: bigint;
|
|
106
106
|
reputationOracleFee: bigint;
|
|
107
107
|
exchangeOracleFee: bigint;
|
|
108
|
-
|
|
108
|
+
manifest: string;
|
|
109
109
|
manifestHash: string;
|
|
110
110
|
}
|
|
111
111
|
|
package/src/utils.ts
CHANGED
|
@@ -54,6 +54,21 @@ export const isValidUrl = (url: string) => {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* **Check if a string is a valid JSON.*
|
|
59
|
+
*
|
|
60
|
+
* @param {string} input
|
|
61
|
+
* @returns {boolean}
|
|
62
|
+
*/
|
|
63
|
+
export const isValidJson = (input: string): boolean => {
|
|
64
|
+
try {
|
|
65
|
+
JSON.parse(input);
|
|
66
|
+
return true;
|
|
67
|
+
} catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
57
72
|
/**
|
|
58
73
|
* **Get the subgraph URL.*
|
|
59
74
|
*
|