@human-protocol/sdk 5.0.0-beta.3 → 5.1.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/base.d.ts +1 -10
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +0 -21
- package/dist/constants.d.ts +0 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -22
- package/dist/enums.d.ts +0 -1
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +0 -1
- 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 +75 -19
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +144 -58
- package/dist/interfaces.d.ts +9 -0
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +9 -5
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +15 -15
- package/dist/operator.d.ts +9 -5
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +16 -16
- package/dist/staking.d.ts +6 -3
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +13 -14
- package/dist/statistics.d.ts +13 -7
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +24 -22
- package/dist/transaction.d.ts +5 -3
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +8 -10
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +51 -1
- package/dist/worker.d.ts +5 -3
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +8 -10
- package/package.json +3 -2
- package/src/base.ts +1 -23
- package/src/constants.ts +6 -24
- package/src/enums.ts +0 -1
- package/src/error.ts +7 -0
- package/src/escrow.ts +232 -97
- package/src/interfaces.ts +10 -0
- package/src/kvstore.ts +26 -24
- package/src/operator.ts +54 -26
- package/src/staking.ts +27 -26
- package/src/statistics.ts +87 -47
- package/src/transaction.ts +39 -25
- package/src/utils.ts +64 -0
- package/src/worker.ts +32 -17
package/dist/escrow.js
CHANGED
|
@@ -8,15 +8,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.EscrowUtils = exports.EscrowClient = void 0;
|
|
16
13
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
17
14
|
const typechain_types_1 = require("@human-protocol/core/typechain-types");
|
|
18
15
|
const ethers_1 = require("ethers");
|
|
19
|
-
const graphql_request_1 = __importDefault(require("graphql-request"));
|
|
20
16
|
const base_1 = require("./base");
|
|
21
17
|
const constants_1 = require("./constants");
|
|
22
18
|
const decorators_1 = require("./decorators");
|
|
@@ -142,8 +138,8 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
142
138
|
/**
|
|
143
139
|
* This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
|
|
144
140
|
*
|
|
145
|
-
* @param {string} tokenAddress
|
|
146
|
-
* @param {string} jobRequesterId
|
|
141
|
+
* @param {string} tokenAddress - The address of the token to use for escrow funding.
|
|
142
|
+
* @param {string} jobRequesterId - Identifier for the job requester.
|
|
147
143
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
148
144
|
* @returns {Promise<string>} Returns the address of the escrow created.
|
|
149
145
|
*
|
|
@@ -173,7 +169,109 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
173
169
|
throw error_1.ErrorInvalidTokenAddress;
|
|
174
170
|
}
|
|
175
171
|
try {
|
|
176
|
-
const result = await (await this.escrowFactoryContract.createEscrow(tokenAddress, jobRequesterId,
|
|
172
|
+
const result = await (await this.escrowFactoryContract.createEscrow(tokenAddress, jobRequesterId, txOptions)).wait();
|
|
173
|
+
const event = result?.logs?.find(({ topics }) => topics.includes(ethers_1.ethers.id('LaunchedV2(address,address,string)')))?.args;
|
|
174
|
+
if (!event) {
|
|
175
|
+
throw error_1.ErrorLaunchedEventIsNotEmitted;
|
|
176
|
+
}
|
|
177
|
+
return event.escrow;
|
|
178
|
+
}
|
|
179
|
+
catch (e) {
|
|
180
|
+
return (0, utils_1.throwError)(e);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
verifySetupParameters(escrowConfig) {
|
|
184
|
+
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee, manifest, manifestHash, } = escrowConfig;
|
|
185
|
+
if (!ethers_1.ethers.isAddress(recordingOracle)) {
|
|
186
|
+
throw error_1.ErrorInvalidRecordingOracleAddressProvided;
|
|
187
|
+
}
|
|
188
|
+
if (!ethers_1.ethers.isAddress(reputationOracle)) {
|
|
189
|
+
throw error_1.ErrorInvalidReputationOracleAddressProvided;
|
|
190
|
+
}
|
|
191
|
+
if (!ethers_1.ethers.isAddress(exchangeOracle)) {
|
|
192
|
+
throw error_1.ErrorInvalidExchangeOracleAddressProvided;
|
|
193
|
+
}
|
|
194
|
+
if (recordingOracleFee <= 0 ||
|
|
195
|
+
reputationOracleFee <= 0 ||
|
|
196
|
+
exchangeOracleFee <= 0) {
|
|
197
|
+
throw error_1.ErrorAmountMustBeGreaterThanZero;
|
|
198
|
+
}
|
|
199
|
+
if (recordingOracleFee + reputationOracleFee + exchangeOracleFee > 100) {
|
|
200
|
+
throw error_1.ErrorTotalFeeMustBeLessThanHundred;
|
|
201
|
+
}
|
|
202
|
+
const isManifestValid = (0, utils_1.isValidUrl)(manifest) || (0, utils_1.isValidJson)(manifest);
|
|
203
|
+
if (!isManifestValid) {
|
|
204
|
+
throw error_1.ErrorInvalidManifest;
|
|
205
|
+
}
|
|
206
|
+
if (!manifestHash) {
|
|
207
|
+
throw error_1.ErrorHashIsEmptyString;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Creates, funds, and sets up a new escrow contract in a single transaction.
|
|
212
|
+
*
|
|
213
|
+
* @param {string} tokenAddress - The ERC-20 token address used to fund the escrow.
|
|
214
|
+
* @param {bigint} amount - The token amount to fund the escrow with.
|
|
215
|
+
* @param {string} jobRequesterId - An off-chain identifier for the job requester.
|
|
216
|
+
* @param {IEscrowConfig} escrowConfig - Configuration parameters for escrow setup:
|
|
217
|
+
* - `recordingOracle`: Address of the recording oracle.
|
|
218
|
+
* - `reputationOracle`: Address of the reputation oracle.
|
|
219
|
+
* - `exchangeOracle`: Address of the exchange oracle.
|
|
220
|
+
* - `recordingOracleFee`: Fee (in basis points or percentage * 100) for the recording oracle.
|
|
221
|
+
* - `reputationOracleFee`: Fee for the reputation oracle.
|
|
222
|
+
* - `exchangeOracleFee`: Fee for the exchange oracle.
|
|
223
|
+
* - `manifest`: URL to the manifest file.
|
|
224
|
+
* - `manifestHash`: Hash of the manifest content.
|
|
225
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
226
|
+
*
|
|
227
|
+
* @returns {Promise<string>} Returns the address of the escrow created.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* import { Wallet, ethers } from 'ethers';
|
|
231
|
+
* import { EscrowClient, IERC20__factory } from '@human-protocol/sdk';
|
|
232
|
+
*
|
|
233
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
234
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
235
|
+
* const provider = new ethers.JsonRpcProvider(rpcUrl);
|
|
236
|
+
* const signer = new Wallet(privateKey, provider);
|
|
237
|
+
*
|
|
238
|
+
* const escrowClient = await EscrowClient.build(signer);
|
|
239
|
+
*
|
|
240
|
+
* const tokenAddress = '0xTokenAddress';
|
|
241
|
+
* const amount = ethers.parseUnits('1000', 18);
|
|
242
|
+
* const jobRequesterId = 'requester-123';
|
|
243
|
+
*
|
|
244
|
+
* const token = IERC20__factory.connect(tokenAddress, signer);
|
|
245
|
+
* await token.approve(escrowClient.escrowFactoryContract.target, amount);
|
|
246
|
+
*
|
|
247
|
+
* const escrowConfig = {
|
|
248
|
+
* recordingOracle: '0xRecordingOracle',
|
|
249
|
+
* reputationOracle: '0xReputationOracle',
|
|
250
|
+
* exchangeOracle: '0xExchangeOracle',
|
|
251
|
+
* recordingOracleFee: 5n,
|
|
252
|
+
* reputationOracleFee: 5n,
|
|
253
|
+
* exchangeOracleFee: 5n,
|
|
254
|
+
* manifest: 'https://example.com/manifest.json',
|
|
255
|
+
* manifestHash: 'manifestHash-123',
|
|
256
|
+
* } satisfies IEscrowConfig;
|
|
257
|
+
*
|
|
258
|
+
* const escrowAddress = await escrowClient.createFundAndSetupEscrow(
|
|
259
|
+
* tokenAddress,
|
|
260
|
+
* amount,
|
|
261
|
+
* jobRequesterId,
|
|
262
|
+
* escrowConfig
|
|
263
|
+
* );
|
|
264
|
+
*
|
|
265
|
+
* console.log('Escrow created at:', escrowAddress);
|
|
266
|
+
*/
|
|
267
|
+
async createFundAndSetupEscrow(tokenAddress, amount, jobRequesterId, escrowConfig, txOptions = {}) {
|
|
268
|
+
if (!ethers_1.ethers.isAddress(tokenAddress)) {
|
|
269
|
+
throw error_1.ErrorInvalidTokenAddress;
|
|
270
|
+
}
|
|
271
|
+
this.verifySetupParameters(escrowConfig);
|
|
272
|
+
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee, manifest, manifestHash, } = escrowConfig;
|
|
273
|
+
try {
|
|
274
|
+
const result = await (await this.escrowFactoryContract.createFundAndSetupEscrow(tokenAddress, amount, jobRequesterId, reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifest, manifestHash, txOptions)).wait();
|
|
177
275
|
const event = result?.logs?.find(({ topics }) => topics.includes(ethers_1.ethers.id('LaunchedV2(address,address,string)')))?.args;
|
|
178
276
|
if (!event) {
|
|
179
277
|
throw error_1.ErrorLaunchedEventIsNotEmitted;
|
|
@@ -224,39 +322,16 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
224
322
|
*/
|
|
225
323
|
async setup(escrowAddress, escrowConfig, txOptions = {}) {
|
|
226
324
|
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee, manifest, manifestHash, } = escrowConfig;
|
|
227
|
-
|
|
228
|
-
throw error_1.ErrorInvalidRecordingOracleAddressProvided;
|
|
229
|
-
}
|
|
230
|
-
if (!ethers_1.ethers.isAddress(reputationOracle)) {
|
|
231
|
-
throw error_1.ErrorInvalidReputationOracleAddressProvided;
|
|
232
|
-
}
|
|
233
|
-
if (!ethers_1.ethers.isAddress(exchangeOracle)) {
|
|
234
|
-
throw error_1.ErrorInvalidExchangeOracleAddressProvided;
|
|
235
|
-
}
|
|
325
|
+
this.verifySetupParameters(escrowConfig);
|
|
236
326
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
237
327
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
238
328
|
}
|
|
239
|
-
if (recordingOracleFee <= 0 ||
|
|
240
|
-
reputationOracleFee <= 0 ||
|
|
241
|
-
exchangeOracleFee <= 0) {
|
|
242
|
-
throw error_1.ErrorAmountMustBeGreaterThanZero;
|
|
243
|
-
}
|
|
244
|
-
if (recordingOracleFee + reputationOracleFee + exchangeOracleFee > 100) {
|
|
245
|
-
throw error_1.ErrorTotalFeeMustBeLessThanHundred;
|
|
246
|
-
}
|
|
247
|
-
const isManifestValid = (0, utils_1.isValidUrl)(manifest) || (0, utils_1.isValidJson)(manifest);
|
|
248
|
-
if (!isManifestValid) {
|
|
249
|
-
throw error_1.ErrorInvalidManifest;
|
|
250
|
-
}
|
|
251
|
-
if (!manifestHash) {
|
|
252
|
-
throw error_1.ErrorHashIsEmptyString;
|
|
253
|
-
}
|
|
254
329
|
if (!(await this.escrowFactoryContract.hasEscrow(escrowAddress))) {
|
|
255
330
|
throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
|
|
256
331
|
}
|
|
257
332
|
try {
|
|
258
333
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
259
|
-
await (await escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifest, manifestHash,
|
|
334
|
+
await (await escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifest, manifestHash, txOptions)).wait();
|
|
260
335
|
return;
|
|
261
336
|
}
|
|
262
337
|
catch (e) {
|
|
@@ -303,7 +378,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
303
378
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
304
379
|
const tokenAddress = await escrowContract.token();
|
|
305
380
|
const tokenContract = typechain_types_1.HMToken__factory.connect(tokenAddress, this.runner);
|
|
306
|
-
await (await tokenContract.transfer(escrowAddress, amount,
|
|
381
|
+
await (await tokenContract.transfer(escrowAddress, amount, txOptions)).wait();
|
|
307
382
|
return;
|
|
308
383
|
}
|
|
309
384
|
catch (e) {
|
|
@@ -332,10 +407,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
332
407
|
}
|
|
333
408
|
try {
|
|
334
409
|
if (fundsToReserve !== null) {
|
|
335
|
-
await (await escrowContract['storeResults(string,string,uint256)'](url, hash, fundsToReserve,
|
|
410
|
+
await (await escrowContract['storeResults(string,string,uint256)'](url, hash, fundsToReserve, txOptions)).wait();
|
|
336
411
|
}
|
|
337
412
|
else {
|
|
338
|
-
await (await escrowContract['storeResults(string,string)'](url, hash,
|
|
413
|
+
await (await escrowContract['storeResults(string,string)'](url, hash, txOptions)).wait();
|
|
339
414
|
}
|
|
340
415
|
}
|
|
341
416
|
catch (e) {
|
|
@@ -382,7 +457,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
382
457
|
}
|
|
383
458
|
try {
|
|
384
459
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
385
|
-
await (await escrowContract.complete(
|
|
460
|
+
await (await escrowContract.complete(txOptions)).wait();
|
|
386
461
|
return;
|
|
387
462
|
}
|
|
388
463
|
catch (e) {
|
|
@@ -395,10 +470,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
395
470
|
const idIsString = typeof id === 'string';
|
|
396
471
|
try {
|
|
397
472
|
if (idIsString) {
|
|
398
|
-
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,string,bool)'](recipients, amounts, finalResultsUrl, finalResultsHash, id, forceComplete,
|
|
473
|
+
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,string,bool)'](recipients, amounts, finalResultsUrl, finalResultsHash, id, forceComplete, txOptions)).wait();
|
|
399
474
|
}
|
|
400
475
|
else {
|
|
401
|
-
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256,bool)'](recipients, amounts, finalResultsUrl, finalResultsHash, id, forceComplete,
|
|
476
|
+
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256,bool)'](recipients, amounts, finalResultsUrl, finalResultsHash, id, forceComplete, txOptions)).wait();
|
|
402
477
|
}
|
|
403
478
|
}
|
|
404
479
|
catch (e) {
|
|
@@ -444,7 +519,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
444
519
|
}
|
|
445
520
|
try {
|
|
446
521
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
447
|
-
await (await escrowContract.cancel(
|
|
522
|
+
await (await escrowContract.cancel(txOptions)).wait();
|
|
448
523
|
}
|
|
449
524
|
catch (e) {
|
|
450
525
|
return (0, utils_1.throwError)(e);
|
|
@@ -484,7 +559,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
484
559
|
}
|
|
485
560
|
try {
|
|
486
561
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
487
|
-
await (await escrowContract.requestCancellation(
|
|
562
|
+
await (await escrowContract.requestCancellation(txOptions)).wait();
|
|
488
563
|
}
|
|
489
564
|
catch (e) {
|
|
490
565
|
return (0, utils_1.throwError)(e);
|
|
@@ -532,7 +607,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
532
607
|
}
|
|
533
608
|
try {
|
|
534
609
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
535
|
-
const transactionReceipt = await (await escrowContract.withdraw(tokenAddress,
|
|
610
|
+
const transactionReceipt = await (await escrowContract.withdraw(tokenAddress, txOptions)).wait();
|
|
536
611
|
let amountTransferred = undefined;
|
|
537
612
|
const tokenContract = typechain_types_1.ERC20__factory.connect(tokenAddress, this.runner);
|
|
538
613
|
if (transactionReceipt)
|
|
@@ -603,7 +678,6 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
603
678
|
* (await signer.sendTransaction(rawTransaction)).wait();
|
|
604
679
|
*/
|
|
605
680
|
async createBulkPayoutTransaction(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash, payoutId, forceComplete = false, txOptions = {}) {
|
|
606
|
-
txOptions = this.applyTxDefaults(txOptions);
|
|
607
681
|
await this.ensureCorrectBulkPayoutInput(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash);
|
|
608
682
|
const signer = this.runner;
|
|
609
683
|
try {
|
|
@@ -1184,6 +1258,12 @@ __decorate([
|
|
|
1184
1258
|
__metadata("design:paramtypes", [String, String, Object]),
|
|
1185
1259
|
__metadata("design:returntype", Promise)
|
|
1186
1260
|
], EscrowClient.prototype, "createEscrow", null);
|
|
1261
|
+
__decorate([
|
|
1262
|
+
decorators_1.requiresSigner,
|
|
1263
|
+
__metadata("design:type", Function),
|
|
1264
|
+
__metadata("design:paramtypes", [String, BigInt, String, Object, Object]),
|
|
1265
|
+
__metadata("design:returntype", Promise)
|
|
1266
|
+
], EscrowClient.prototype, "createFundAndSetupEscrow", null);
|
|
1187
1267
|
__decorate([
|
|
1188
1268
|
decorators_1.requiresSigner,
|
|
1189
1269
|
__metadata("design:type", Function),
|
|
@@ -1356,6 +1436,7 @@ class EscrowUtils {
|
|
|
1356
1436
|
*
|
|
1357
1437
|
*
|
|
1358
1438
|
* @param {IEscrowsFilter} filter Filter parameters.
|
|
1439
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1359
1440
|
* @returns {IEscrow[]} List of escrows that match the filter.
|
|
1360
1441
|
*
|
|
1361
1442
|
* **Code example**
|
|
@@ -1372,7 +1453,7 @@ class EscrowUtils {
|
|
|
1372
1453
|
* const escrows = await EscrowUtils.getEscrows(filters);
|
|
1373
1454
|
* ```
|
|
1374
1455
|
*/
|
|
1375
|
-
static async getEscrows(filter) {
|
|
1456
|
+
static async getEscrows(filter, options) {
|
|
1376
1457
|
if (filter.launcher && !ethers_1.ethers.isAddress(filter.launcher)) {
|
|
1377
1458
|
throw error_1.ErrorInvalidAddress;
|
|
1378
1459
|
}
|
|
@@ -1397,7 +1478,7 @@ class EscrowUtils {
|
|
|
1397
1478
|
statuses = Array.isArray(filter.status) ? filter.status : [filter.status];
|
|
1398
1479
|
statuses = statuses.map((status) => types_1.EscrowStatus[status]);
|
|
1399
1480
|
}
|
|
1400
|
-
const { escrows } = await (0,
|
|
1481
|
+
const { escrows } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_ESCROWS_QUERY)(filter), {
|
|
1401
1482
|
...filter,
|
|
1402
1483
|
launcher: filter.launcher?.toLowerCase(),
|
|
1403
1484
|
reputationOracle: filter.reputationOracle?.toLowerCase(),
|
|
@@ -1409,7 +1490,7 @@ class EscrowUtils {
|
|
|
1409
1490
|
orderDirection: orderDirection,
|
|
1410
1491
|
first: first,
|
|
1411
1492
|
skip: skip,
|
|
1412
|
-
});
|
|
1493
|
+
}, options);
|
|
1413
1494
|
return (escrows || []).map((e) => mapEscrow(e, networkData.chainId));
|
|
1414
1495
|
}
|
|
1415
1496
|
/**
|
|
@@ -1465,6 +1546,7 @@ class EscrowUtils {
|
|
|
1465
1546
|
*
|
|
1466
1547
|
* @param {ChainId} chainId Network in which the escrow has been deployed
|
|
1467
1548
|
* @param {string} escrowAddress Address of the escrow
|
|
1549
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1468
1550
|
* @returns {Promise<IEscrow | null>} - Escrow data or null if not found.
|
|
1469
1551
|
*
|
|
1470
1552
|
* **Code example**
|
|
@@ -1475,7 +1557,7 @@ class EscrowUtils {
|
|
|
1475
1557
|
* const escrow = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1476
1558
|
* ```
|
|
1477
1559
|
*/
|
|
1478
|
-
static async getEscrow(chainId, escrowAddress) {
|
|
1560
|
+
static async getEscrow(chainId, escrowAddress, options) {
|
|
1479
1561
|
const networkData = constants_1.NETWORKS[chainId];
|
|
1480
1562
|
if (!networkData) {
|
|
1481
1563
|
throw error_1.ErrorUnsupportedChainID;
|
|
@@ -1483,7 +1565,7 @@ class EscrowUtils {
|
|
|
1483
1565
|
if (escrowAddress && !ethers_1.ethers.isAddress(escrowAddress)) {
|
|
1484
1566
|
throw error_1.ErrorInvalidAddress;
|
|
1485
1567
|
}
|
|
1486
|
-
const { escrow } = await (0,
|
|
1568
|
+
const { escrow } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_ESCROW_BY_ADDRESS_QUERY)(), { escrowAddress: escrowAddress.toLowerCase() }, options);
|
|
1487
1569
|
if (!escrow)
|
|
1488
1570
|
return null;
|
|
1489
1571
|
return mapEscrow(escrow, networkData.chainId);
|
|
@@ -1524,6 +1606,7 @@ class EscrowUtils {
|
|
|
1524
1606
|
* ```
|
|
1525
1607
|
*
|
|
1526
1608
|
* @param {IStatusEventFilter} filter Filter parameters.
|
|
1609
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1527
1610
|
* @returns {Promise<StatusEvent[]>} - Array of status events with their corresponding statuses.
|
|
1528
1611
|
*
|
|
1529
1612
|
* **Code example**
|
|
@@ -1544,7 +1627,7 @@ class EscrowUtils {
|
|
|
1544
1627
|
* })();
|
|
1545
1628
|
* ```
|
|
1546
1629
|
*/
|
|
1547
|
-
static async getStatusEvents(filter) {
|
|
1630
|
+
static async getStatusEvents(filter, options) {
|
|
1548
1631
|
const { chainId, statuses, from, to, launcher, first = 10, skip = 0, orderDirection = enums_1.OrderDirection.DESC, } = filter;
|
|
1549
1632
|
if (launcher && !ethers_1.ethers.isAddress(launcher)) {
|
|
1550
1633
|
throw error_1.ErrorInvalidAddress;
|
|
@@ -1563,7 +1646,7 @@ class EscrowUtils {
|
|
|
1563
1646
|
types_1.EscrowStatus.Cancelled,
|
|
1564
1647
|
];
|
|
1565
1648
|
const statusNames = effectiveStatuses.map((status) => types_1.EscrowStatus[status]);
|
|
1566
|
-
const data = await (0,
|
|
1649
|
+
const data = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_STATUS_UPDATES_QUERY)(from, to, launcher), {
|
|
1567
1650
|
status: statusNames,
|
|
1568
1651
|
from: from ? (0, utils_1.getUnixTimestamp)(from) : undefined,
|
|
1569
1652
|
to: to ? (0, utils_1.getUnixTimestamp)(to) : undefined,
|
|
@@ -1571,7 +1654,7 @@ class EscrowUtils {
|
|
|
1571
1654
|
orderDirection,
|
|
1572
1655
|
first: Math.min(first, 1000),
|
|
1573
1656
|
skip,
|
|
1574
|
-
});
|
|
1657
|
+
}, options);
|
|
1575
1658
|
if (!data || !data['escrowStatusEvents']) {
|
|
1576
1659
|
return [];
|
|
1577
1660
|
}
|
|
@@ -1591,6 +1674,7 @@ class EscrowUtils {
|
|
|
1591
1674
|
* Fetch payouts from the subgraph.
|
|
1592
1675
|
*
|
|
1593
1676
|
* @param {IPayoutFilter} filter Filter parameters.
|
|
1677
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1594
1678
|
* @returns {Promise<IPayout[]>} List of payouts matching the filters.
|
|
1595
1679
|
*
|
|
1596
1680
|
* **Code example**
|
|
@@ -1608,7 +1692,7 @@ class EscrowUtils {
|
|
|
1608
1692
|
* console.log(payouts);
|
|
1609
1693
|
* ```
|
|
1610
1694
|
*/
|
|
1611
|
-
static async getPayouts(filter) {
|
|
1695
|
+
static async getPayouts(filter, options) {
|
|
1612
1696
|
const networkData = constants_1.NETWORKS[filter.chainId];
|
|
1613
1697
|
if (!networkData) {
|
|
1614
1698
|
throw error_1.ErrorUnsupportedChainID;
|
|
@@ -1622,7 +1706,7 @@ class EscrowUtils {
|
|
|
1622
1706
|
const first = filter.first !== undefined ? Math.min(filter.first, 1000) : 10;
|
|
1623
1707
|
const skip = filter.skip || 0;
|
|
1624
1708
|
const orderDirection = filter.orderDirection || enums_1.OrderDirection.DESC;
|
|
1625
|
-
const { payouts } = await (0,
|
|
1709
|
+
const { payouts } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_PAYOUTS_QUERY)(filter), {
|
|
1626
1710
|
escrowAddress: filter.escrowAddress?.toLowerCase(),
|
|
1627
1711
|
recipient: filter.recipient?.toLowerCase(),
|
|
1628
1712
|
from: filter.from ? (0, utils_1.getUnixTimestamp)(filter.from) : undefined,
|
|
@@ -1630,7 +1714,7 @@ class EscrowUtils {
|
|
|
1630
1714
|
first: Math.min(first, 1000),
|
|
1631
1715
|
skip,
|
|
1632
1716
|
orderDirection,
|
|
1633
|
-
});
|
|
1717
|
+
}, options);
|
|
1634
1718
|
if (!payouts) {
|
|
1635
1719
|
return [];
|
|
1636
1720
|
}
|
|
@@ -1676,6 +1760,7 @@ class EscrowUtils {
|
|
|
1676
1760
|
*
|
|
1677
1761
|
*
|
|
1678
1762
|
* @param {Object} filter Filter parameters.
|
|
1763
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1679
1764
|
* @returns {Promise<ICancellationRefund[]>} List of cancellation refunds matching the filters.
|
|
1680
1765
|
*
|
|
1681
1766
|
* **Code example**
|
|
@@ -1690,7 +1775,7 @@ class EscrowUtils {
|
|
|
1690
1775
|
* console.log(cancellationRefunds);
|
|
1691
1776
|
* ```
|
|
1692
1777
|
*/
|
|
1693
|
-
static async getCancellationRefunds(filter) {
|
|
1778
|
+
static async getCancellationRefunds(filter, options) {
|
|
1694
1779
|
const networkData = constants_1.NETWORKS[filter.chainId];
|
|
1695
1780
|
if (!networkData)
|
|
1696
1781
|
throw error_1.ErrorUnsupportedChainID;
|
|
@@ -1703,7 +1788,7 @@ class EscrowUtils {
|
|
|
1703
1788
|
const first = filter.first !== undefined ? Math.min(filter.first, 1000) : 10;
|
|
1704
1789
|
const skip = filter.skip || 0;
|
|
1705
1790
|
const orderDirection = filter.orderDirection || enums_1.OrderDirection.DESC;
|
|
1706
|
-
const { cancellationRefundEvents } = await (0,
|
|
1791
|
+
const { cancellationRefundEvents } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_CANCELLATION_REFUNDS_QUERY)(filter), {
|
|
1707
1792
|
escrowAddress: filter.escrowAddress?.toLowerCase(),
|
|
1708
1793
|
receiver: filter.receiver?.toLowerCase(),
|
|
1709
1794
|
from: filter.from ? (0, utils_1.getUnixTimestamp)(filter.from) : undefined,
|
|
@@ -1711,7 +1796,7 @@ class EscrowUtils {
|
|
|
1711
1796
|
first,
|
|
1712
1797
|
skip,
|
|
1713
1798
|
orderDirection,
|
|
1714
|
-
});
|
|
1799
|
+
}, options);
|
|
1715
1800
|
if (!cancellationRefundEvents || cancellationRefundEvents.length === 0) {
|
|
1716
1801
|
return [];
|
|
1717
1802
|
}
|
|
@@ -1760,6 +1845,7 @@ class EscrowUtils {
|
|
|
1760
1845
|
*
|
|
1761
1846
|
* @param {ChainId} chainId Network in which the escrow has been deployed
|
|
1762
1847
|
* @param {string} escrowAddress Address of the escrow
|
|
1848
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1763
1849
|
* @returns {Promise<ICancellationRefund>} Cancellation refund data
|
|
1764
1850
|
*
|
|
1765
1851
|
* **Code example**
|
|
@@ -1770,14 +1856,14 @@ class EscrowUtils {
|
|
|
1770
1856
|
* const cancellationRefund = await EscrowUtils.getCancellationRefund(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1771
1857
|
* ```
|
|
1772
1858
|
*/
|
|
1773
|
-
static async getCancellationRefund(chainId, escrowAddress) {
|
|
1859
|
+
static async getCancellationRefund(chainId, escrowAddress, options) {
|
|
1774
1860
|
const networkData = constants_1.NETWORKS[chainId];
|
|
1775
1861
|
if (!networkData)
|
|
1776
1862
|
throw error_1.ErrorUnsupportedChainID;
|
|
1777
1863
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
1778
1864
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
1779
1865
|
}
|
|
1780
|
-
const { cancellationRefundEvents } = await (0,
|
|
1866
|
+
const { cancellationRefundEvents } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_CANCELLATION_REFUND_BY_ADDRESS_QUERY)(), { escrowAddress: escrowAddress.toLowerCase() }, options);
|
|
1781
1867
|
if (!cancellationRefundEvents || cancellationRefundEvents.length === 0) {
|
|
1782
1868
|
return null;
|
|
1783
1869
|
}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -272,4 +272,13 @@ export interface IEscrowWithdraw {
|
|
|
272
272
|
tokenAddress: string;
|
|
273
273
|
withdrawnAmount: bigint;
|
|
274
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Configuration options for subgraph requests with retry logic.
|
|
277
|
+
*/
|
|
278
|
+
export interface SubgraphOptions {
|
|
279
|
+
/** Maximum number of retry attempts */
|
|
280
|
+
maxRetries?: number;
|
|
281
|
+
/** Base delay between retries in milliseconds */
|
|
282
|
+
baseDelay?: number;
|
|
283
|
+
}
|
|
275
284
|
//# sourceMappingURL=interfaces.d.ts.map
|
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,OAAO;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1B,kBAAkB,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IA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MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/kvstore.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ContractRunner, Overrides } from 'ethers';
|
|
|
2
2
|
import { BaseEthersClient } from './base';
|
|
3
3
|
import { ChainId } from './enums';
|
|
4
4
|
import { NetworkData } from './types';
|
|
5
|
-
import { IKVStore } from './interfaces';
|
|
5
|
+
import { IKVStore, SubgraphOptions } from './interfaces';
|
|
6
6
|
/**
|
|
7
7
|
* ## Introduction
|
|
8
8
|
*
|
|
@@ -181,6 +181,7 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
181
181
|
*
|
|
182
182
|
* @param {string} address Address from which to get the key value.
|
|
183
183
|
* @param {string} key Key to obtain the value.
|
|
184
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
184
185
|
* @returns {string} Value of the key.
|
|
185
186
|
*
|
|
186
187
|
*
|
|
@@ -240,6 +241,7 @@ export declare class KVStoreUtils {
|
|
|
240
241
|
*
|
|
241
242
|
* @param {ChainId} chainId Network in which the KVStore is deployed
|
|
242
243
|
* @param {string} address Address of the KVStore
|
|
244
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
243
245
|
* @returns {Promise<IKVStore[]>} KVStore data
|
|
244
246
|
* @throws {ErrorUnsupportedChainID} - Thrown if the network's chainId is not supported
|
|
245
247
|
* @throws {ErrorInvalidAddress} - Thrown if the Address sent is invalid
|
|
@@ -253,13 +255,14 @@ export declare class KVStoreUtils {
|
|
|
253
255
|
* console.log(kvStoreData);
|
|
254
256
|
* ```
|
|
255
257
|
*/
|
|
256
|
-
static getKVStoreData(chainId: ChainId, address: string): Promise<IKVStore[]>;
|
|
258
|
+
static getKVStoreData(chainId: ChainId, address: string, options?: SubgraphOptions): Promise<IKVStore[]>;
|
|
257
259
|
/**
|
|
258
260
|
* Gets the value of a key-value pair in the KVStore using the subgraph.
|
|
259
261
|
*
|
|
260
262
|
* @param {ChainId} chainId Network in which the KVStore is deployed
|
|
261
263
|
* @param {string} address Address from which to get the key value.
|
|
262
264
|
* @param {string} key Key to obtain the value.
|
|
265
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
263
266
|
* @returns {Promise<string>} Value of the key.
|
|
264
267
|
* @throws {ErrorUnsupportedChainID} - Thrown if the network's chainId is not supported
|
|
265
268
|
* @throws {ErrorInvalidAddress} - Thrown if the Address sent is invalid
|
|
@@ -278,13 +281,14 @@ export declare class KVStoreUtils {
|
|
|
278
281
|
* console.log(value);
|
|
279
282
|
* ```
|
|
280
283
|
*/
|
|
281
|
-
static get(chainId: ChainId, address: string, key: string): Promise<string>;
|
|
284
|
+
static get(chainId: ChainId, address: string, key: string, options?: SubgraphOptions): Promise<string>;
|
|
282
285
|
/**
|
|
283
286
|
* Gets the URL value of the given entity, and verifies its hash.
|
|
284
287
|
*
|
|
285
288
|
* @param {ChainId} chainId Network in which the KVStore is deployed
|
|
286
289
|
* @param {string} address Address from which to get the URL value.
|
|
287
290
|
* @param {string} urlKey Configurable URL key. `url` by default.
|
|
291
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
288
292
|
* @returns {Promise<string>} URL value for the given address if it exists, and the content is valid
|
|
289
293
|
*
|
|
290
294
|
* **Code example**
|
|
@@ -299,7 +303,7 @@ export declare class KVStoreUtils {
|
|
|
299
303
|
* console.log(url);
|
|
300
304
|
* ```
|
|
301
305
|
*/
|
|
302
|
-
static getFileUrlAndVerifyHash(chainId: ChainId, address: string, urlKey?: string): Promise<string>;
|
|
306
|
+
static getFileUrlAndVerifyHash(chainId: ChainId, address: string, urlKey?: string, options?: SubgraphOptions): Promise<string>;
|
|
303
307
|
/**
|
|
304
308
|
* Gets the public key of the given entity, and verifies its hash.
|
|
305
309
|
*
|
|
@@ -319,6 +323,6 @@ export declare class KVStoreUtils {
|
|
|
319
323
|
* console.log(publicKey);
|
|
320
324
|
* ```
|
|
321
325
|
*/
|
|
322
|
-
static getPublicKey(chainId: ChainId, address: string): Promise<string>;
|
|
326
|
+
static getPublicKey(chainId: ChainId, address: string, options?: SubgraphOptions): Promise<string>;
|
|
323
327
|
}
|
|
324
328
|
//# sourceMappingURL=kvstore.d.ts.map
|
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,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