@human-protocol/sdk 5.0.0 → 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 +1 -16
- 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 +14 -17
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +34 -33
- 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 +2 -1
- package/src/base.ts +1 -23
- package/src/constants.ts +0 -18
- package/src/enums.ts +0 -1
- package/src/error.ts +7 -0
- package/src/escrow.ts +69 -64
- 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/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContractRunner
|
|
1
|
+
import { ContractRunner } from 'ethers';
|
|
2
2
|
import { NetworkData } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* ## Introduction
|
|
@@ -16,14 +16,5 @@ export declare abstract class BaseEthersClient {
|
|
|
16
16
|
* @param {NetworkData} networkData The network information required to connect to the contracts
|
|
17
17
|
*/
|
|
18
18
|
constructor(runner: ContractRunner, networkData: NetworkData);
|
|
19
|
-
/**
|
|
20
|
-
* Internal helper to enrich transaction overrides with network specific defaults.
|
|
21
|
-
*
|
|
22
|
-
* Aurora networks use a fixed gas price. We always override any user provided
|
|
23
|
-
* gasPrice with the canonical DEFAULT_AURORA_GAS_PRICE to avoid mismatches
|
|
24
|
-
* or tx failures due to an unexpected value. For other networks the user
|
|
25
|
-
* supplied fee parameters are left untouched.
|
|
26
|
-
*/
|
|
27
|
-
protected applyTxDefaults(txOptions?: Overrides): Overrides;
|
|
28
19
|
}
|
|
29
20
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;GAKG;AACH,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IAEhC;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;CAI7D"}
|
package/dist/base.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseEthersClient = void 0;
|
|
4
|
-
const enums_1 = require("./enums");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
4
|
/**
|
|
7
5
|
* ## Introduction
|
|
8
6
|
*
|
|
@@ -20,24 +18,5 @@ class BaseEthersClient {
|
|
|
20
18
|
this.networkData = networkData;
|
|
21
19
|
this.runner = runner;
|
|
22
20
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Internal helper to enrich transaction overrides with network specific defaults.
|
|
25
|
-
*
|
|
26
|
-
* Aurora networks use a fixed gas price. We always override any user provided
|
|
27
|
-
* gasPrice with the canonical DEFAULT_AURORA_GAS_PRICE to avoid mismatches
|
|
28
|
-
* or tx failures due to an unexpected value. For other networks the user
|
|
29
|
-
* supplied fee parameters are left untouched.
|
|
30
|
-
*/
|
|
31
|
-
applyTxDefaults(txOptions = {}) {
|
|
32
|
-
if (this.networkData.chainId === enums_1.ChainId.AURORA_TESTNET) {
|
|
33
|
-
return {
|
|
34
|
-
...txOptions,
|
|
35
|
-
gasPrice: constants_1.DEFAULT_AURORA_GAS_PRICE,
|
|
36
|
-
maxFeePerGas: undefined,
|
|
37
|
-
maxPriorityFeePerGas: undefined,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return txOptions;
|
|
41
|
-
}
|
|
42
21
|
}
|
|
43
22
|
exports.BaseEthersClient = BaseEthersClient;
|
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export declare const DEFAULT_ENDPOINT = "localhost";
|
|
|
5
5
|
export declare const DEFAULT_REGION = "eu";
|
|
6
6
|
export declare const DEFAULT_PORT = 9000;
|
|
7
7
|
export declare const DEFAULT_USE_SSL = false;
|
|
8
|
-
export declare const DEFAULT_AURORA_GAS_PRICE: bigint;
|
|
9
8
|
export declare enum HttpStatus {
|
|
10
9
|
OK = 200,
|
|
11
10
|
CREATED = 201,
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
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,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CA2GnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAavB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAEjE,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ESCROW_BULK_PAYOUT_MAX_ITEMS = exports.SUBGRAPH_API_KEY_PLACEHOLDER = exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.
|
|
4
|
-
const ethers_1 = require("ethers");
|
|
3
|
+
exports.ESCROW_BULK_PAYOUT_MAX_ITEMS = exports.SUBGRAPH_API_KEY_PLACEHOLDER = exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.DEFAULT_USE_SSL = exports.DEFAULT_PORT = exports.DEFAULT_REGION = exports.DEFAULT_ENDPOINT = exports.DEFAULT_PUBLIC_BUCKET = void 0;
|
|
5
4
|
const enums_1 = require("./enums");
|
|
6
5
|
exports.DEFAULT_PUBLIC_BUCKET = 'escrow-public-results';
|
|
7
6
|
exports.DEFAULT_ENDPOINT = 'localhost';
|
|
8
7
|
exports.DEFAULT_REGION = 'eu';
|
|
9
8
|
exports.DEFAULT_PORT = 9000;
|
|
10
9
|
exports.DEFAULT_USE_SSL = false;
|
|
11
|
-
exports.DEFAULT_AURORA_GAS_PRICE = ethers_1.ethers.parseUnits('0.07', 'gwei');
|
|
12
10
|
var HttpStatus;
|
|
13
11
|
(function (HttpStatus) {
|
|
14
12
|
HttpStatus[HttpStatus["OK"] = 200] = "OK";
|
|
@@ -99,19 +97,6 @@ exports.NETWORKS = {
|
|
|
99
97
|
oldSubgraphUrl: '',
|
|
100
98
|
oldFactoryAddress: '',
|
|
101
99
|
},
|
|
102
|
-
[enums_1.ChainId.AURORA_TESTNET]: {
|
|
103
|
-
chainId: enums_1.ChainId.AURORA_TESTNET,
|
|
104
|
-
title: 'Aurora Testnet',
|
|
105
|
-
scanUrl: 'https://explorer.testnet.aurora.dev/',
|
|
106
|
-
factoryAddress: '0xbA537fEF2442cD48f60686FE1Bbbe40F964a7940',
|
|
107
|
-
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
108
|
-
stakingAddress: '0x7457d26a3C70Bd71F7557C773b303c1dB82BBB68',
|
|
109
|
-
kvstoreAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
110
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
111
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmVHYvjbsgAroR9EMgqqGTQ7aKPRFMVekY6evU6mFPUU7J',
|
|
112
|
-
oldSubgraphUrl: '',
|
|
113
|
-
oldFactoryAddress: '',
|
|
114
|
-
},
|
|
115
100
|
[enums_1.ChainId.LOCALHOST]: {
|
|
116
101
|
chainId: enums_1.ChainId.LOCALHOST,
|
|
117
102
|
title: 'Localhost',
|
package/dist/enums.d.ts
CHANGED
package/dist/enums.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,KAAK;IACR,OAAO,IAAI;IACX,OAAO,WAAW;IAClB,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,YAAY,QAAQ;IACpB,
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,KAAK;IACR,OAAO,IAAI;IACX,OAAO,WAAW;IAClB,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,YAAY,QAAQ;IACpB,SAAS,OAAO;CACjB;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,oBAAY,gBAAgB;IAC1B,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;CAChC"}
|
package/dist/enums.js
CHANGED
|
@@ -10,7 +10,6 @@ var ChainId;
|
|
|
10
10
|
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET";
|
|
11
11
|
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
|
|
12
12
|
ChainId[ChainId["POLYGON_AMOY"] = 80002] = "POLYGON_AMOY";
|
|
13
|
-
ChainId[ChainId["AURORA_TESTNET"] = 1313161555] = "AURORA_TESTNET";
|
|
14
13
|
ChainId[ChainId["LOCALHOST"] = 1338] = "LOCALHOST";
|
|
15
14
|
})(ChainId || (exports.ChainId = ChainId = {}));
|
|
16
15
|
var OrderDirection;
|
package/dist/error.d.ts
CHANGED
|
@@ -198,6 +198,10 @@ export declare const ErrorStoreResultsVersion: Error;
|
|
|
198
198
|
* @constant {Error} - Invalid bulkPayOut parameters for the escrow version
|
|
199
199
|
*/
|
|
200
200
|
export declare const ErrorBulkPayOutVersion: Error;
|
|
201
|
+
/**
|
|
202
|
+
* @constant {Error} - Retry configuration is missing required parameters.
|
|
203
|
+
*/
|
|
204
|
+
export declare const ErrorRetryParametersMissing: Error;
|
|
201
205
|
/**
|
|
202
206
|
* @constant {Warning} - Possible version mismatch.
|
|
203
207
|
*/
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,OAA2C,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,gCAAgC,OAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,OAEvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,OAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,OAAgC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,wBAAwB,OAA8B,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,2BAA2B,OAAiC,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,oBAAoB,OAAmC,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,uBAAuB,OAEnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,OAA+B,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,wBAAwB,OAAqC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,0CAA0C,OAEtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,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|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ErrorBulkPayOutVersion = exports.ErrorStoreResultsVersion = 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.ErrorInvalidManifest = exports.ErrorInvalidUrl = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorStakerNotFound = 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
|
-
exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = exports.EthereumError = exports.WarnSubgraphApiKeyNotProvided = exports.WarnVersionMismatch = void 0;
|
|
4
|
+
exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = exports.EthereumError = exports.WarnSubgraphApiKeyNotProvided = exports.WarnVersionMismatch = exports.ErrorRetryParametersMissing = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* @constant {Error} - The Staking contract is missing.
|
|
7
7
|
*/
|
|
@@ -202,6 +202,10 @@ exports.ErrorStoreResultsVersion = new Error('Invalid storeResults parameters fo
|
|
|
202
202
|
* @constant {Error} - Invalid bulkPayOut parameters for the escrow version
|
|
203
203
|
*/
|
|
204
204
|
exports.ErrorBulkPayOutVersion = new Error('Invalid bulkPayOut parameters for the contract version of the specified escrow address');
|
|
205
|
+
/**
|
|
206
|
+
* @constant {Error} - Retry configuration is missing required parameters.
|
|
207
|
+
*/
|
|
208
|
+
exports.ErrorRetryParametersMissing = new Error('Retry configuration must include both maxRetries and baseDelay');
|
|
205
209
|
/**
|
|
206
210
|
* @constant {Warning} - Possible version mismatch.
|
|
207
211
|
*/
|
package/dist/escrow.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContractRunner, Overrides } from 'ethers';
|
|
2
2
|
import { BaseEthersClient } from './base';
|
|
3
|
-
import { ChainId
|
|
4
|
-
import { IEscrow, IEscrowConfig, IEscrowsFilter, IPayoutFilter, IStatusEventFilter, IStatusEvent, ICancellationRefund, IPayout, IEscrowWithdraw } from './interfaces';
|
|
3
|
+
import { ChainId } from './enums';
|
|
4
|
+
import { IEscrow, IEscrowConfig, IEscrowsFilter, IPayoutFilter, IStatusEventFilter, IStatusEvent, ICancellationRefund, ICancellationRefundFilter, IPayout, IEscrowWithdraw, SubgraphOptions } from './interfaces';
|
|
5
5
|
import { EscrowStatus, NetworkData, TransactionLikeWithNonce } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* ## Introduction
|
|
@@ -955,6 +955,7 @@ export declare class EscrowUtils {
|
|
|
955
955
|
*
|
|
956
956
|
*
|
|
957
957
|
* @param {IEscrowsFilter} filter Filter parameters.
|
|
958
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
958
959
|
* @returns {IEscrow[]} List of escrows that match the filter.
|
|
959
960
|
*
|
|
960
961
|
* **Code example**
|
|
@@ -971,7 +972,7 @@ export declare class EscrowUtils {
|
|
|
971
972
|
* const escrows = await EscrowUtils.getEscrows(filters);
|
|
972
973
|
* ```
|
|
973
974
|
*/
|
|
974
|
-
static getEscrows(filter: IEscrowsFilter): Promise<IEscrow[]>;
|
|
975
|
+
static getEscrows(filter: IEscrowsFilter, options?: SubgraphOptions): Promise<IEscrow[]>;
|
|
975
976
|
/**
|
|
976
977
|
* This function returns the escrow data for a given address.
|
|
977
978
|
*
|
|
@@ -1025,6 +1026,7 @@ export declare class EscrowUtils {
|
|
|
1025
1026
|
*
|
|
1026
1027
|
* @param {ChainId} chainId Network in which the escrow has been deployed
|
|
1027
1028
|
* @param {string} escrowAddress Address of the escrow
|
|
1029
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1028
1030
|
* @returns {Promise<IEscrow | null>} - Escrow data or null if not found.
|
|
1029
1031
|
*
|
|
1030
1032
|
* **Code example**
|
|
@@ -1035,7 +1037,7 @@ export declare class EscrowUtils {
|
|
|
1035
1037
|
* const escrow = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1036
1038
|
* ```
|
|
1037
1039
|
*/
|
|
1038
|
-
static getEscrow(chainId: ChainId, escrowAddress: string): Promise<IEscrow | null>;
|
|
1040
|
+
static getEscrow(chainId: ChainId, escrowAddress: string, options?: SubgraphOptions): Promise<IEscrow | null>;
|
|
1039
1041
|
/**
|
|
1040
1042
|
* This function returns the status events for a given set of networks within an optional date range.
|
|
1041
1043
|
*
|
|
@@ -1072,6 +1074,7 @@ export declare class EscrowUtils {
|
|
|
1072
1074
|
* ```
|
|
1073
1075
|
*
|
|
1074
1076
|
* @param {IStatusEventFilter} filter Filter parameters.
|
|
1077
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1075
1078
|
* @returns {Promise<StatusEvent[]>} - Array of status events with their corresponding statuses.
|
|
1076
1079
|
*
|
|
1077
1080
|
* **Code example**
|
|
@@ -1092,7 +1095,7 @@ export declare class EscrowUtils {
|
|
|
1092
1095
|
* })();
|
|
1093
1096
|
* ```
|
|
1094
1097
|
*/
|
|
1095
|
-
static getStatusEvents(filter: IStatusEventFilter): Promise<IStatusEvent[]>;
|
|
1098
|
+
static getStatusEvents(filter: IStatusEventFilter, options?: SubgraphOptions): Promise<IStatusEvent[]>;
|
|
1096
1099
|
/**
|
|
1097
1100
|
* This function returns the payouts for a given set of networks.
|
|
1098
1101
|
*
|
|
@@ -1102,6 +1105,7 @@ export declare class EscrowUtils {
|
|
|
1102
1105
|
* Fetch payouts from the subgraph.
|
|
1103
1106
|
*
|
|
1104
1107
|
* @param {IPayoutFilter} filter Filter parameters.
|
|
1108
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1105
1109
|
* @returns {Promise<IPayout[]>} List of payouts matching the filters.
|
|
1106
1110
|
*
|
|
1107
1111
|
* **Code example**
|
|
@@ -1119,7 +1123,7 @@ export declare class EscrowUtils {
|
|
|
1119
1123
|
* console.log(payouts);
|
|
1120
1124
|
* ```
|
|
1121
1125
|
*/
|
|
1122
|
-
static getPayouts(filter: IPayoutFilter): Promise<IPayout[]>;
|
|
1126
|
+
static getPayouts(filter: IPayoutFilter, options?: SubgraphOptions): Promise<IPayout[]>;
|
|
1123
1127
|
/**
|
|
1124
1128
|
* This function returns the cancellation refunds for a given set of networks.
|
|
1125
1129
|
*
|
|
@@ -1154,6 +1158,7 @@ export declare class EscrowUtils {
|
|
|
1154
1158
|
*
|
|
1155
1159
|
*
|
|
1156
1160
|
* @param {Object} filter Filter parameters.
|
|
1161
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1157
1162
|
* @returns {Promise<ICancellationRefund[]>} List of cancellation refunds matching the filters.
|
|
1158
1163
|
*
|
|
1159
1164
|
* **Code example**
|
|
@@ -1168,16 +1173,7 @@ export declare class EscrowUtils {
|
|
|
1168
1173
|
* console.log(cancellationRefunds);
|
|
1169
1174
|
* ```
|
|
1170
1175
|
*/
|
|
1171
|
-
static getCancellationRefunds(filter:
|
|
1172
|
-
chainId: ChainId;
|
|
1173
|
-
escrowAddress?: string;
|
|
1174
|
-
receiver?: string;
|
|
1175
|
-
from?: Date;
|
|
1176
|
-
to?: Date;
|
|
1177
|
-
first?: number;
|
|
1178
|
-
skip?: number;
|
|
1179
|
-
orderDirection?: OrderDirection;
|
|
1180
|
-
}): Promise<ICancellationRefund[]>;
|
|
1176
|
+
static getCancellationRefunds(filter: ICancellationRefundFilter, options?: SubgraphOptions): Promise<ICancellationRefund[]>;
|
|
1181
1177
|
/**
|
|
1182
1178
|
* This function returns the cancellation refund for a given escrow address.
|
|
1183
1179
|
*
|
|
@@ -1213,6 +1209,7 @@ export declare class EscrowUtils {
|
|
|
1213
1209
|
*
|
|
1214
1210
|
* @param {ChainId} chainId Network in which the escrow has been deployed
|
|
1215
1211
|
* @param {string} escrowAddress Address of the escrow
|
|
1212
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1216
1213
|
* @returns {Promise<ICancellationRefund>} Cancellation refund data
|
|
1217
1214
|
*
|
|
1218
1215
|
* **Code example**
|
|
@@ -1223,6 +1220,6 @@ export declare class EscrowUtils {
|
|
|
1223
1220
|
* const cancellationRefund = await EscrowUtils.getCancellationRefund(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1224
1221
|
* ```
|
|
1225
1222
|
*/
|
|
1226
|
-
static getCancellationRefund(chainId: ChainId, escrowAddress: string): Promise<ICancellationRefund | null>;
|
|
1223
|
+
static getCancellationRefund(chainId: ChainId, escrowAddress: string, options?: SubgraphOptions): Promise<ICancellationRefund | null>;
|
|
1227
1224
|
}
|
|
1228
1225
|
//# sourceMappingURL=escrow.d.ts.map
|
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;
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAkB,MAAM,QAAQ,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AAwClD,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,OAAO,EACP,eAAe,EACf,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAU9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,OAAO,CAAC,qBAAqB,CAAgB;IAE7C;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;IAS5D;;;;;;;;OAQG;WACiB,K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AO,CAAC,YAAY,EAAE,CAAC;IA8D1B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;WACiB,UAAU,CAC5B,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,EAAE,CAAC;IA4CrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;WACiB,sBAAsB,CACxC,MAAM,EAAE,yBAAyB,EACjC,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA+CjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;WACiB,qBAAqB,CACvC,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CA+BvC"}
|
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");
|
|
@@ -173,7 +169,7 @@ 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();
|
|
177
173
|
const event = result?.logs?.find(({ topics }) => topics.includes(ethers_1.ethers.id('LaunchedV2(address,address,string)')))?.args;
|
|
178
174
|
if (!event) {
|
|
179
175
|
throw error_1.ErrorLaunchedEventIsNotEmitted;
|
|
@@ -275,7 +271,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
275
271
|
this.verifySetupParameters(escrowConfig);
|
|
276
272
|
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee, manifest, manifestHash, } = escrowConfig;
|
|
277
273
|
try {
|
|
278
|
-
const result = await (await this.escrowFactoryContract.createFundAndSetupEscrow(tokenAddress, amount, jobRequesterId, reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifest, manifestHash,
|
|
274
|
+
const result = await (await this.escrowFactoryContract.createFundAndSetupEscrow(tokenAddress, amount, jobRequesterId, reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifest, manifestHash, txOptions)).wait();
|
|
279
275
|
const event = result?.logs?.find(({ topics }) => topics.includes(ethers_1.ethers.id('LaunchedV2(address,address,string)')))?.args;
|
|
280
276
|
if (!event) {
|
|
281
277
|
throw error_1.ErrorLaunchedEventIsNotEmitted;
|
|
@@ -335,7 +331,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
335
331
|
}
|
|
336
332
|
try {
|
|
337
333
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
338
|
-
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();
|
|
339
335
|
return;
|
|
340
336
|
}
|
|
341
337
|
catch (e) {
|
|
@@ -382,7 +378,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
382
378
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
383
379
|
const tokenAddress = await escrowContract.token();
|
|
384
380
|
const tokenContract = typechain_types_1.HMToken__factory.connect(tokenAddress, this.runner);
|
|
385
|
-
await (await tokenContract.transfer(escrowAddress, amount,
|
|
381
|
+
await (await tokenContract.transfer(escrowAddress, amount, txOptions)).wait();
|
|
386
382
|
return;
|
|
387
383
|
}
|
|
388
384
|
catch (e) {
|
|
@@ -411,10 +407,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
411
407
|
}
|
|
412
408
|
try {
|
|
413
409
|
if (fundsToReserve !== null) {
|
|
414
|
-
await (await escrowContract['storeResults(string,string,uint256)'](url, hash, fundsToReserve,
|
|
410
|
+
await (await escrowContract['storeResults(string,string,uint256)'](url, hash, fundsToReserve, txOptions)).wait();
|
|
415
411
|
}
|
|
416
412
|
else {
|
|
417
|
-
await (await escrowContract['storeResults(string,string)'](url, hash,
|
|
413
|
+
await (await escrowContract['storeResults(string,string)'](url, hash, txOptions)).wait();
|
|
418
414
|
}
|
|
419
415
|
}
|
|
420
416
|
catch (e) {
|
|
@@ -461,7 +457,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
461
457
|
}
|
|
462
458
|
try {
|
|
463
459
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
464
|
-
await (await escrowContract.complete(
|
|
460
|
+
await (await escrowContract.complete(txOptions)).wait();
|
|
465
461
|
return;
|
|
466
462
|
}
|
|
467
463
|
catch (e) {
|
|
@@ -474,10 +470,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
474
470
|
const idIsString = typeof id === 'string';
|
|
475
471
|
try {
|
|
476
472
|
if (idIsString) {
|
|
477
|
-
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();
|
|
478
474
|
}
|
|
479
475
|
else {
|
|
480
|
-
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();
|
|
481
477
|
}
|
|
482
478
|
}
|
|
483
479
|
catch (e) {
|
|
@@ -523,7 +519,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
523
519
|
}
|
|
524
520
|
try {
|
|
525
521
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
526
|
-
await (await escrowContract.cancel(
|
|
522
|
+
await (await escrowContract.cancel(txOptions)).wait();
|
|
527
523
|
}
|
|
528
524
|
catch (e) {
|
|
529
525
|
return (0, utils_1.throwError)(e);
|
|
@@ -563,7 +559,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
563
559
|
}
|
|
564
560
|
try {
|
|
565
561
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
566
|
-
await (await escrowContract.requestCancellation(
|
|
562
|
+
await (await escrowContract.requestCancellation(txOptions)).wait();
|
|
567
563
|
}
|
|
568
564
|
catch (e) {
|
|
569
565
|
return (0, utils_1.throwError)(e);
|
|
@@ -611,7 +607,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
611
607
|
}
|
|
612
608
|
try {
|
|
613
609
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
614
|
-
const transactionReceipt = await (await escrowContract.withdraw(tokenAddress,
|
|
610
|
+
const transactionReceipt = await (await escrowContract.withdraw(tokenAddress, txOptions)).wait();
|
|
615
611
|
let amountTransferred = undefined;
|
|
616
612
|
const tokenContract = typechain_types_1.ERC20__factory.connect(tokenAddress, this.runner);
|
|
617
613
|
if (transactionReceipt)
|
|
@@ -682,7 +678,6 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
682
678
|
* (await signer.sendTransaction(rawTransaction)).wait();
|
|
683
679
|
*/
|
|
684
680
|
async createBulkPayoutTransaction(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash, payoutId, forceComplete = false, txOptions = {}) {
|
|
685
|
-
txOptions = this.applyTxDefaults(txOptions);
|
|
686
681
|
await this.ensureCorrectBulkPayoutInput(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash);
|
|
687
682
|
const signer = this.runner;
|
|
688
683
|
try {
|
|
@@ -1441,6 +1436,7 @@ class EscrowUtils {
|
|
|
1441
1436
|
*
|
|
1442
1437
|
*
|
|
1443
1438
|
* @param {IEscrowsFilter} filter Filter parameters.
|
|
1439
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1444
1440
|
* @returns {IEscrow[]} List of escrows that match the filter.
|
|
1445
1441
|
*
|
|
1446
1442
|
* **Code example**
|
|
@@ -1457,7 +1453,7 @@ class EscrowUtils {
|
|
|
1457
1453
|
* const escrows = await EscrowUtils.getEscrows(filters);
|
|
1458
1454
|
* ```
|
|
1459
1455
|
*/
|
|
1460
|
-
static async getEscrows(filter) {
|
|
1456
|
+
static async getEscrows(filter, options) {
|
|
1461
1457
|
if (filter.launcher && !ethers_1.ethers.isAddress(filter.launcher)) {
|
|
1462
1458
|
throw error_1.ErrorInvalidAddress;
|
|
1463
1459
|
}
|
|
@@ -1482,7 +1478,7 @@ class EscrowUtils {
|
|
|
1482
1478
|
statuses = Array.isArray(filter.status) ? filter.status : [filter.status];
|
|
1483
1479
|
statuses = statuses.map((status) => types_1.EscrowStatus[status]);
|
|
1484
1480
|
}
|
|
1485
|
-
const { escrows } = await (0,
|
|
1481
|
+
const { escrows } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_ESCROWS_QUERY)(filter), {
|
|
1486
1482
|
...filter,
|
|
1487
1483
|
launcher: filter.launcher?.toLowerCase(),
|
|
1488
1484
|
reputationOracle: filter.reputationOracle?.toLowerCase(),
|
|
@@ -1494,7 +1490,7 @@ class EscrowUtils {
|
|
|
1494
1490
|
orderDirection: orderDirection,
|
|
1495
1491
|
first: first,
|
|
1496
1492
|
skip: skip,
|
|
1497
|
-
});
|
|
1493
|
+
}, options);
|
|
1498
1494
|
return (escrows || []).map((e) => mapEscrow(e, networkData.chainId));
|
|
1499
1495
|
}
|
|
1500
1496
|
/**
|
|
@@ -1550,6 +1546,7 @@ class EscrowUtils {
|
|
|
1550
1546
|
*
|
|
1551
1547
|
* @param {ChainId} chainId Network in which the escrow has been deployed
|
|
1552
1548
|
* @param {string} escrowAddress Address of the escrow
|
|
1549
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1553
1550
|
* @returns {Promise<IEscrow | null>} - Escrow data or null if not found.
|
|
1554
1551
|
*
|
|
1555
1552
|
* **Code example**
|
|
@@ -1560,7 +1557,7 @@ class EscrowUtils {
|
|
|
1560
1557
|
* const escrow = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1561
1558
|
* ```
|
|
1562
1559
|
*/
|
|
1563
|
-
static async getEscrow(chainId, escrowAddress) {
|
|
1560
|
+
static async getEscrow(chainId, escrowAddress, options) {
|
|
1564
1561
|
const networkData = constants_1.NETWORKS[chainId];
|
|
1565
1562
|
if (!networkData) {
|
|
1566
1563
|
throw error_1.ErrorUnsupportedChainID;
|
|
@@ -1568,7 +1565,7 @@ class EscrowUtils {
|
|
|
1568
1565
|
if (escrowAddress && !ethers_1.ethers.isAddress(escrowAddress)) {
|
|
1569
1566
|
throw error_1.ErrorInvalidAddress;
|
|
1570
1567
|
}
|
|
1571
|
-
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);
|
|
1572
1569
|
if (!escrow)
|
|
1573
1570
|
return null;
|
|
1574
1571
|
return mapEscrow(escrow, networkData.chainId);
|
|
@@ -1609,6 +1606,7 @@ class EscrowUtils {
|
|
|
1609
1606
|
* ```
|
|
1610
1607
|
*
|
|
1611
1608
|
* @param {IStatusEventFilter} filter Filter parameters.
|
|
1609
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1612
1610
|
* @returns {Promise<StatusEvent[]>} - Array of status events with their corresponding statuses.
|
|
1613
1611
|
*
|
|
1614
1612
|
* **Code example**
|
|
@@ -1629,7 +1627,7 @@ class EscrowUtils {
|
|
|
1629
1627
|
* })();
|
|
1630
1628
|
* ```
|
|
1631
1629
|
*/
|
|
1632
|
-
static async getStatusEvents(filter) {
|
|
1630
|
+
static async getStatusEvents(filter, options) {
|
|
1633
1631
|
const { chainId, statuses, from, to, launcher, first = 10, skip = 0, orderDirection = enums_1.OrderDirection.DESC, } = filter;
|
|
1634
1632
|
if (launcher && !ethers_1.ethers.isAddress(launcher)) {
|
|
1635
1633
|
throw error_1.ErrorInvalidAddress;
|
|
@@ -1648,7 +1646,7 @@ class EscrowUtils {
|
|
|
1648
1646
|
types_1.EscrowStatus.Cancelled,
|
|
1649
1647
|
];
|
|
1650
1648
|
const statusNames = effectiveStatuses.map((status) => types_1.EscrowStatus[status]);
|
|
1651
|
-
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), {
|
|
1652
1650
|
status: statusNames,
|
|
1653
1651
|
from: from ? (0, utils_1.getUnixTimestamp)(from) : undefined,
|
|
1654
1652
|
to: to ? (0, utils_1.getUnixTimestamp)(to) : undefined,
|
|
@@ -1656,7 +1654,7 @@ class EscrowUtils {
|
|
|
1656
1654
|
orderDirection,
|
|
1657
1655
|
first: Math.min(first, 1000),
|
|
1658
1656
|
skip,
|
|
1659
|
-
});
|
|
1657
|
+
}, options);
|
|
1660
1658
|
if (!data || !data['escrowStatusEvents']) {
|
|
1661
1659
|
return [];
|
|
1662
1660
|
}
|
|
@@ -1676,6 +1674,7 @@ class EscrowUtils {
|
|
|
1676
1674
|
* Fetch payouts from the subgraph.
|
|
1677
1675
|
*
|
|
1678
1676
|
* @param {IPayoutFilter} filter Filter parameters.
|
|
1677
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1679
1678
|
* @returns {Promise<IPayout[]>} List of payouts matching the filters.
|
|
1680
1679
|
*
|
|
1681
1680
|
* **Code example**
|
|
@@ -1693,7 +1692,7 @@ class EscrowUtils {
|
|
|
1693
1692
|
* console.log(payouts);
|
|
1694
1693
|
* ```
|
|
1695
1694
|
*/
|
|
1696
|
-
static async getPayouts(filter) {
|
|
1695
|
+
static async getPayouts(filter, options) {
|
|
1697
1696
|
const networkData = constants_1.NETWORKS[filter.chainId];
|
|
1698
1697
|
if (!networkData) {
|
|
1699
1698
|
throw error_1.ErrorUnsupportedChainID;
|
|
@@ -1707,7 +1706,7 @@ class EscrowUtils {
|
|
|
1707
1706
|
const first = filter.first !== undefined ? Math.min(filter.first, 1000) : 10;
|
|
1708
1707
|
const skip = filter.skip || 0;
|
|
1709
1708
|
const orderDirection = filter.orderDirection || enums_1.OrderDirection.DESC;
|
|
1710
|
-
const { payouts } = await (0,
|
|
1709
|
+
const { payouts } = await (0, utils_1.customGqlFetch)((0, utils_1.getSubgraphUrl)(networkData), (0, graphql_1.GET_PAYOUTS_QUERY)(filter), {
|
|
1711
1710
|
escrowAddress: filter.escrowAddress?.toLowerCase(),
|
|
1712
1711
|
recipient: filter.recipient?.toLowerCase(),
|
|
1713
1712
|
from: filter.from ? (0, utils_1.getUnixTimestamp)(filter.from) : undefined,
|
|
@@ -1715,7 +1714,7 @@ class EscrowUtils {
|
|
|
1715
1714
|
first: Math.min(first, 1000),
|
|
1716
1715
|
skip,
|
|
1717
1716
|
orderDirection,
|
|
1718
|
-
});
|
|
1717
|
+
}, options);
|
|
1719
1718
|
if (!payouts) {
|
|
1720
1719
|
return [];
|
|
1721
1720
|
}
|
|
@@ -1761,6 +1760,7 @@ class EscrowUtils {
|
|
|
1761
1760
|
*
|
|
1762
1761
|
*
|
|
1763
1762
|
* @param {Object} filter Filter parameters.
|
|
1763
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1764
1764
|
* @returns {Promise<ICancellationRefund[]>} List of cancellation refunds matching the filters.
|
|
1765
1765
|
*
|
|
1766
1766
|
* **Code example**
|
|
@@ -1775,7 +1775,7 @@ class EscrowUtils {
|
|
|
1775
1775
|
* console.log(cancellationRefunds);
|
|
1776
1776
|
* ```
|
|
1777
1777
|
*/
|
|
1778
|
-
static async getCancellationRefunds(filter) {
|
|
1778
|
+
static async getCancellationRefunds(filter, options) {
|
|
1779
1779
|
const networkData = constants_1.NETWORKS[filter.chainId];
|
|
1780
1780
|
if (!networkData)
|
|
1781
1781
|
throw error_1.ErrorUnsupportedChainID;
|
|
@@ -1788,7 +1788,7 @@ class EscrowUtils {
|
|
|
1788
1788
|
const first = filter.first !== undefined ? Math.min(filter.first, 1000) : 10;
|
|
1789
1789
|
const skip = filter.skip || 0;
|
|
1790
1790
|
const orderDirection = filter.orderDirection || enums_1.OrderDirection.DESC;
|
|
1791
|
-
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), {
|
|
1792
1792
|
escrowAddress: filter.escrowAddress?.toLowerCase(),
|
|
1793
1793
|
receiver: filter.receiver?.toLowerCase(),
|
|
1794
1794
|
from: filter.from ? (0, utils_1.getUnixTimestamp)(filter.from) : undefined,
|
|
@@ -1796,7 +1796,7 @@ class EscrowUtils {
|
|
|
1796
1796
|
first,
|
|
1797
1797
|
skip,
|
|
1798
1798
|
orderDirection,
|
|
1799
|
-
});
|
|
1799
|
+
}, options);
|
|
1800
1800
|
if (!cancellationRefundEvents || cancellationRefundEvents.length === 0) {
|
|
1801
1801
|
return [];
|
|
1802
1802
|
}
|
|
@@ -1845,6 +1845,7 @@ class EscrowUtils {
|
|
|
1845
1845
|
*
|
|
1846
1846
|
* @param {ChainId} chainId Network in which the escrow has been deployed
|
|
1847
1847
|
* @param {string} escrowAddress Address of the escrow
|
|
1848
|
+
* @param {SubgraphOptions} options Optional configuration for subgraph requests.
|
|
1848
1849
|
* @returns {Promise<ICancellationRefund>} Cancellation refund data
|
|
1849
1850
|
*
|
|
1850
1851
|
* **Code example**
|
|
@@ -1855,14 +1856,14 @@ class EscrowUtils {
|
|
|
1855
1856
|
* const cancellationRefund = await EscrowUtils.getCancellationRefund(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1856
1857
|
* ```
|
|
1857
1858
|
*/
|
|
1858
|
-
static async getCancellationRefund(chainId, escrowAddress) {
|
|
1859
|
+
static async getCancellationRefund(chainId, escrowAddress, options) {
|
|
1859
1860
|
const networkData = constants_1.NETWORKS[chainId];
|
|
1860
1861
|
if (!networkData)
|
|
1861
1862
|
throw error_1.ErrorUnsupportedChainID;
|
|
1862
1863
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
1863
1864
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
1864
1865
|
}
|
|
1865
|
-
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);
|
|
1866
1867
|
if (!cancellationRefundEvents || cancellationRefundEvents.length === 0) {
|
|
1867
1868
|
return null;
|
|
1868
1869
|
}
|