@human-protocol/sdk 1.1.16 → 1.1.18

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 ADDED
@@ -0,0 +1,29 @@
1
+ import { Provider } from '@ethersproject/abstract-provider';
2
+ import { Signer, ethers } from 'ethers';
3
+ import { NetworkData } from './types';
4
+ /**
5
+ * ## Introduction
6
+ *
7
+ * This class is used as a base class for other clients making on-chain calls.
8
+ *
9
+ */
10
+ export declare abstract class BaseEthersClient {
11
+ protected signerOrProvider: Signer | Provider;
12
+ protected gasPriceMultiplier?: number;
13
+ networkData: NetworkData;
14
+ /**
15
+ * **BaseClient constructor**
16
+ *
17
+ * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
18
+ * @param {NetworkData} networkData The network information required to connect to the contracts
19
+ * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
20
+ */
21
+ constructor(signerOrProvider: Signer | Provider, networkData: NetworkData, gasPriceMultiplier?: number);
22
+ /**
23
+ * Adjust the gas price, and return as an option to be passed to a transaction
24
+ *
25
+ * @returns {Promise<{ gasPrice: BigNumber }>} Returns the gas price options
26
+ */
27
+ protected gasPriceOptions(): Promise<Partial<ethers.Overrides>>;
28
+ }
29
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;GAKG;AACH,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9C,SAAS,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,EAAE,WAAW,CAAC;IAEhC;;;;;;OAMG;gBAED,gBAAgB,EAAE,MAAM,GAAG,QAAQ,EACnC,WAAW,EAAE,WAAW,EACxB,kBAAkB,CAAC,EAAE,MAAM;IAO7B;;;;OAIG;cACa,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;CAUtE"}
package/dist/base.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseEthersClient = void 0;
4
+ const utils_1 = require("./utils");
5
+ /**
6
+ * ## Introduction
7
+ *
8
+ * This class is used as a base class for other clients making on-chain calls.
9
+ *
10
+ */
11
+ class BaseEthersClient {
12
+ /**
13
+ * **BaseClient constructor**
14
+ *
15
+ * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
16
+ * @param {NetworkData} networkData The network information required to connect to the contracts
17
+ * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
18
+ */
19
+ constructor(signerOrProvider, networkData, gasPriceMultiplier) {
20
+ this.networkData = networkData;
21
+ this.signerOrProvider = signerOrProvider;
22
+ this.gasPriceMultiplier = gasPriceMultiplier;
23
+ }
24
+ /**
25
+ * Adjust the gas price, and return as an option to be passed to a transaction
26
+ *
27
+ * @returns {Promise<{ gasPrice: BigNumber }>} Returns the gas price options
28
+ */
29
+ async gasPriceOptions() {
30
+ return this.gasPriceMultiplier
31
+ ? {
32
+ gasPrice: await (0, utils_1.gasPriceAdjusted)(this.signerOrProvider, this.gasPriceMultiplier),
33
+ }
34
+ : {};
35
+ }
36
+ }
37
+ exports.BaseEthersClient = BaseEthersClient;
@@ -45,8 +45,9 @@ export declare const NETWORKS: {
45
45
  };
46
46
  export declare const KVStoreKeys: {
47
47
  role: string;
48
- webhook_url: string;
49
48
  fee: string;
50
- public_key: string;
49
+ publicKey: string;
50
+ webhookUrl: string;
51
+ url: string;
51
52
  };
52
53
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CA4LnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;CAKvB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CAuNnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;CAMvB,CAAC"}
package/dist/constants.js CHANGED
@@ -187,6 +187,32 @@ exports.NETWORKS = {
187
187
  oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/avalanche',
188
188
  oldFactoryAddress: '0x9767a578ba7a5FA1563c8229943cB01cd8446BB4',
189
189
  },
190
+ [enums_1.ChainId.CELO_ALFAJORES]: {
191
+ chainId: enums_1.ChainId.CELO_ALFAJORES,
192
+ title: 'Celo Alfajores',
193
+ scanUrl: 'https://alfajores.celoscan.io/',
194
+ factoryAddress: '0x86Af9f6Cd34B69Db1B202223C6d6D109f2491569',
195
+ hmtAddress: '0x2736B33455A872dC478E1E004106D04c35472468',
196
+ stakingAddress: '0x003548Df34be8836cF0F9673403a1E40ba449a0F',
197
+ rewardPoolAddress: '0xA9545C2530BD5bdb464d5E274F59ACceAa73eD86',
198
+ kvstoreAddress: '0x938335006ea6F9Eb0e8020969cFF94404425e298',
199
+ subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/celo-alfajores',
200
+ oldSubgraphUrl: '',
201
+ oldFactoryAddress: '',
202
+ },
203
+ [enums_1.ChainId.CELO]: {
204
+ chainId: enums_1.ChainId.CELO,
205
+ title: 'Celo',
206
+ scanUrl: 'https://celoscan.io/',
207
+ factoryAddress: '0xc90B43a5d576D9d8026c48904dfbaED50C15Fa08',
208
+ hmtAddress: '0x19Ead835951493A763c96910255d5eeF147E914F',
209
+ stakingAddress: '0x34cD3Bd6B16c559f321799b516dE61E12017fFd1',
210
+ rewardPoolAddress: '0xb9344bAD98E3d26a4d83900922baf395a2Ec154c',
211
+ kvstoreAddress: '0x86Af9f6Cd34B69Db1B202223C6d6D109f2491569',
212
+ subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/celo',
213
+ oldSubgraphUrl: '',
214
+ oldFactoryAddress: '',
215
+ },
190
216
  [enums_1.ChainId.SKALE]: {
191
217
  chainId: enums_1.ChainId.SKALE,
192
218
  title: 'SKALE Human Protocol Chain',
@@ -216,7 +242,8 @@ exports.NETWORKS = {
216
242
  };
217
243
  exports.KVStoreKeys = {
218
244
  role: 'role',
219
- webhook_url: 'webhook_url',
220
245
  fee: 'fee',
221
- public_key: 'public_key',
246
+ publicKey: 'publicKey',
247
+ webhookUrl: 'webhookUrl',
248
+ url: 'url',
222
249
  };
package/dist/enums.d.ts CHANGED
@@ -12,6 +12,8 @@ export declare enum ChainId {
12
12
  AVALANCHE_TESTNET = 43113,
13
13
  AVALANCHE = 43114,
14
14
  SKALE = 1273227453,
15
+ CELO = 42220,
16
+ CELO_ALFAJORES = 44787,
15
17
  LOCALHOST = 1338
16
18
  }
17
19
  //# sourceMappingURL=enums.d.ts.map
@@ -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,IAAI;IACX,MAAM,IAAI;IACV,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,cAAc,QAAQ;IACtB,QAAQ,OAAO;IACf,cAAc,OAAO;IACrB,iBAAiB,QAAQ;IACzB,SAAS,QAAQ;IACjB,KAAK,aAAa;IAClB,SAAS,OAAO;CACjB"}
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,IAAI;IACX,MAAM,IAAI;IACV,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,cAAc,QAAQ;IACtB,QAAQ,OAAO;IACf,cAAc,OAAO;IACrB,iBAAiB,QAAQ;IACzB,SAAS,QAAQ;IACjB,KAAK,aAAa;IAClB,IAAI,QAAQ;IACZ,cAAc,QAAQ;IACtB,SAAS,OAAO;CACjB"}
package/dist/enums.js CHANGED
@@ -16,5 +16,7 @@ var ChainId;
16
16
  ChainId[ChainId["AVALANCHE_TESTNET"] = 43113] = "AVALANCHE_TESTNET";
17
17
  ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE";
18
18
  ChainId[ChainId["SKALE"] = 1273227453] = "SKALE";
19
+ ChainId[ChainId["CELO"] = 42220] = "CELO";
20
+ ChainId[ChainId["CELO_ALFAJORES"] = 44787] = "CELO_ALFAJORES";
19
21
  ChainId[ChainId["LOCALHOST"] = 1338] = "LOCALHOST";
20
22
  })(ChainId = exports.ChainId || (exports.ChainId = {}));
package/dist/error.d.ts CHANGED
@@ -201,4 +201,12 @@ export declare class ContractExecutionError extends EthereumError {
201
201
  export declare class InvalidEthereumAddressError extends Error {
202
202
  constructor(address: string);
203
203
  }
204
+ /**
205
+ * @constant {Error} - The Hash does not match
206
+ */
207
+ export declare const ErrorInvalidHash: Error;
208
+ /**
209
+ * @constant {Error} - The Hash does not match
210
+ */
211
+ export declare const ErrorMissingGasPrice: Error;
204
212
  //# sourceMappingURL=error.d.ts.map
@@ -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;;G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8BAA8B,OAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wCAAwC,OAEpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,OAE1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,OAAuC,CAAC;AAE3E,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,oBAAqB,SAAQ,aAAa;gBACzC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,aAAc,SAAQ,aAAa;gBAClC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,qBAAsB,SAAQ,aAAa;gBAC1C,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,aAAa;gBAC3C,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,aAAa;gBAC3C,MAAM,EAAE,MAAM;CAG3B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAG5B;AACD;;GAEG;AACH,eAAO,MAAM,gBAAgB,OAA4B,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,oBAAoB,OAAiC,CAAC"}
package/dist/error.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NumericFault = exports.ReplacementUnderpriced = exports.UnpredictableGasLimit = exports.OutOfGasError = exports.InvalidArgumentError = exports.EthereumError = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.ErrorUrlIsEmptyString = exports.ErrorInvalidUrl = exports.ErrorStorageClientDoesNotExist = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = exports.ErrorInvalidStakerAddressProvided = exports.ErrorInvalidSlasherAddressProvided = exports.ErrorInvalidStakingValueSign = exports.ErrorInvalidStakingValueType = exports.ErrorStakingValueMustBePositive = exports.ErrorInvalidExchangeOracleAddressProvided = exports.ErrorInvalidReputationOracleAddressProvided = exports.ErrorInvalidRecordingOracleAddressProvided = exports.ErrorInvalidTokenAddress = exports.ErrorInvalidAddress = exports.ErrorKVStoreArrayLength = exports.ErrorKVStoreEmptyKey = exports.ErrorStorageFileNotUploaded = exports.ErrorStorageFileNotFound = exports.ErrorStorageBucketNotFound = exports.ErrorStorageCredentialsMissing = exports.ErrorStorageClientNotExists = exports.ErrorStorageClientNotInitialized = exports.ErrorStakingMissing = void 0;
4
- exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = void 0;
4
+ exports.ErrorMissingGasPrice = exports.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = void 0;
5
5
  /**
6
6
  * @constant {Error} - The Staking contract is missing.
7
7
  */
@@ -235,3 +235,11 @@ class InvalidEthereumAddressError extends Error {
235
235
  }
236
236
  }
237
237
  exports.InvalidEthereumAddressError = InvalidEthereumAddressError;
238
+ /**
239
+ * @constant {Error} - The Hash does not match
240
+ */
241
+ exports.ErrorInvalidHash = new Error('Invalid hash');
242
+ /**
243
+ * @constant {Error} - The Hash does not match
244
+ */
245
+ exports.ErrorMissingGasPrice = new Error('Missing gas price');
package/dist/escrow.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Provider } from '@ethersproject/abstract-provider';
2
2
  import { BigNumber, Signer } from 'ethers';
3
+ import { BaseEthersClient } from './base';
3
4
  import { ChainId } from './enums';
4
5
  import { IEscrowConfig, IEscrowsFilter } from './interfaces';
5
6
  import { EscrowCancel, EscrowStatus, NetworkData } from './types';
@@ -73,27 +74,33 @@ import { EscrowData } from './graphql';
73
74
  * const escrowClient = await EscrowClient.build(provider);
74
75
  * ```
75
76
  */
76
- export declare class EscrowClient {
77
+ export declare class EscrowClient extends BaseEthersClient {
77
78
  private escrowFactoryContract;
78
- private escrowContract?;
79
- private signerOrProvider;
80
- network: NetworkData;
81
79
  /**
82
80
  * **EscrowClient constructor**
83
81
  *
84
82
  * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
85
83
  * @param {NetworkData} network The network information required to connect to the Escrow contract
84
+ * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
86
85
  */
87
- constructor(signerOrProvider: Signer | Provider, network: NetworkData);
86
+ constructor(signerOrProvider: Signer | Provider, networkData: NetworkData, gasPriceMultiplier?: number);
88
87
  /**
89
88
  * Creates an instance of EscrowClient from a Signer or Provider.
90
89
  *
91
90
  * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
91
+ * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
92
+ *
92
93
  * @returns {Promise<EscrowClient>} An instance of EscrowClient
93
94
  * @throws {ErrorProviderDoesNotExist} Thrown if the provider does not exist for the provided Signer
94
95
  * @throws {ErrorUnsupportedChainID} Thrown if the network's chainId is not supported
95
96
  */
96
- static build(signerOrProvider: Signer | Provider): Promise<EscrowClient>;
97
+ static build(signerOrProvider: Signer | Provider, gasPriceMultiplier?: number): Promise<EscrowClient>;
98
+ /**
99
+ * Connects to the escrow contract
100
+ *
101
+ * @param escrowAddress Escrow address to connect to
102
+ */
103
+ private getEscrowContract;
97
104
  /**
98
105
  * This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
99
106
  *
@@ -719,6 +726,8 @@ export declare class EscrowUtils {
719
726
  * MOONBASE_ALPHA = 1287,
720
727
  * AVALANCHE = 43114,
721
728
  * AVALANCHE_TESTNET = 43113,
729
+ * CELO = 42220,
730
+ * CELO_ALFAJORES = 44787,
722
731
  * SKALE = 1273227453,
723
732
  * LOCALHOST = 1338,
724
733
  * }
@@ -802,6 +811,8 @@ export declare class EscrowUtils {
802
811
  * MOONBASE_ALPHA = 1287,
803
812
  * AVALANCHE = 43114,
804
813
  * AVALANCHE_TESTNET = 43113,
814
+ * CELO = 42220,
815
+ * CELO_ALFAJORES = 44787,
805
816
  * SKALE = 1273227453,
806
817
  * LOCALHOST = 1338,
807
818
  * }
@@ -1 +1 @@
1
- {"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAU5D,OAAO,EAAE,SAAS,EAAmB,MAAM,EAAU,MAAM,QAAQ,CAAC;AAIpE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAyBlC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EACL,UAAU,EAGX,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;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WACiB,UAAU,CAC5B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,UAAU,EAAE,CAAC;IAmExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmEG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,UAAU,CAAC;CAuBvB"}
package/dist/escrow.js CHANGED
@@ -16,6 +16,7 @@ exports.EscrowUtils = exports.EscrowClient = void 0;
16
16
  const typechain_types_1 = require("@human-protocol/core/typechain-types");
17
17
  const ethers_1 = require("ethers");
18
18
  const graphql_request_1 = __importDefault(require("graphql-request"));
19
+ const base_1 = require("./base");
19
20
  const constants_1 = require("./constants");
20
21
  const decorators_1 = require("./decorators");
21
22
  const error_1 = require("./error");
@@ -91,27 +92,29 @@ const graphql_1 = require("./graphql");
91
92
  * const escrowClient = await EscrowClient.build(provider);
92
93
  * ```
93
94
  */
94
- class EscrowClient {
95
+ class EscrowClient extends base_1.BaseEthersClient {
95
96
  /**
96
97
  * **EscrowClient constructor**
97
98
  *
98
99
  * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
99
100
  * @param {NetworkData} network The network information required to connect to the Escrow contract
101
+ * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
100
102
  */
101
- constructor(signerOrProvider, network) {
102
- this.escrowFactoryContract = typechain_types_1.EscrowFactory__factory.connect(network.factoryAddress, signerOrProvider);
103
- this.network = network;
104
- this.signerOrProvider = signerOrProvider;
103
+ constructor(signerOrProvider, networkData, gasPriceMultiplier) {
104
+ super(signerOrProvider, networkData, gasPriceMultiplier);
105
+ this.escrowFactoryContract = typechain_types_1.EscrowFactory__factory.connect(networkData.factoryAddress, signerOrProvider);
105
106
  }
106
107
  /**
107
108
  * Creates an instance of EscrowClient from a Signer or Provider.
108
109
  *
109
110
  * @param {Signer | Provider} signerOrProvider The Signer or Provider object to interact with the Ethereum network
111
+ * @param {number | undefined} gasPriceMultiplier The multiplier to apply to the gas price
112
+ *
110
113
  * @returns {Promise<EscrowClient>} An instance of EscrowClient
111
114
  * @throws {ErrorProviderDoesNotExist} Thrown if the provider does not exist for the provided Signer
112
115
  * @throws {ErrorUnsupportedChainID} Thrown if the network's chainId is not supported
113
116
  */
114
- static async build(signerOrProvider) {
117
+ static async build(signerOrProvider, gasPriceMultiplier) {
115
118
  let network;
116
119
  if (ethers_1.Signer.isSigner(signerOrProvider)) {
117
120
  if (!signerOrProvider.provider) {
@@ -127,7 +130,20 @@ class EscrowClient {
127
130
  if (!networkData) {
128
131
  throw error_1.ErrorUnsupportedChainID;
129
132
  }
130
- return new EscrowClient(signerOrProvider, networkData);
133
+ return new EscrowClient(signerOrProvider, networkData, gasPriceMultiplier);
134
+ }
135
+ /**
136
+ * Connects to the escrow contract
137
+ *
138
+ * @param escrowAddress Escrow address to connect to
139
+ */
140
+ getEscrowContract(escrowAddress) {
141
+ try {
142
+ return typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
143
+ }
144
+ catch (e) {
145
+ return (0, utils_1.throwError)(e);
146
+ }
131
147
  }
132
148
  /**
133
149
  * This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
@@ -169,7 +185,9 @@ class EscrowClient {
169
185
  }
170
186
  });
171
187
  try {
172
- const result = await (await this.escrowFactoryContract.createEscrow(tokenAddress, trustedHandlers, jobRequesterId)).wait();
188
+ const result = await (await this.escrowFactoryContract.createEscrow(tokenAddress, trustedHandlers, jobRequesterId, {
189
+ ...(await this.gasPriceOptions()),
190
+ })).wait();
173
191
  const event = result.events?.find(({ topics }) => topics.includes(ethers_1.ethers.utils.id('LaunchedV2(address,address,string)')))?.args;
174
192
  if (!event) {
175
193
  throw error_1.ErrorLaunchedEventIsNotEmitted;
@@ -252,8 +270,10 @@ class EscrowClient {
252
270
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
253
271
  }
254
272
  try {
255
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
256
- await this.escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifestUrl, manifestHash);
273
+ const escrowContract = this.getEscrowContract(escrowAddress);
274
+ await escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifestUrl, manifestHash, {
275
+ ...(await this.gasPriceOptions()),
276
+ });
257
277
  return;
258
278
  }
259
279
  catch (e) {
@@ -347,10 +367,12 @@ class EscrowClient {
347
367
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
348
368
  }
349
369
  try {
350
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
351
- const tokenAddress = await this.escrowContract.token();
370
+ const escrowContract = this.getEscrowContract(escrowAddress);
371
+ const tokenAddress = await escrowContract.token();
352
372
  const tokenContract = typechain_types_1.HMToken__factory.connect(tokenAddress, this.signerOrProvider);
353
- await tokenContract.transfer(escrowAddress, amount);
373
+ await tokenContract.transfer(escrowAddress, amount, {
374
+ ...(await this.gasPriceOptions()),
375
+ });
354
376
  return;
355
377
  }
356
378
  catch (e) {
@@ -401,8 +423,10 @@ class EscrowClient {
401
423
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
402
424
  }
403
425
  try {
404
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
405
- await this.escrowContract.storeResults(url, hash);
426
+ const escrowContract = this.getEscrowContract(escrowAddress);
427
+ await escrowContract.storeResults(url, hash, {
428
+ ...(await this.gasPriceOptions()),
429
+ });
406
430
  return;
407
431
  }
408
432
  catch (e) {
@@ -442,8 +466,10 @@ class EscrowClient {
442
466
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
443
467
  }
444
468
  try {
445
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
446
- await this.escrowContract.complete();
469
+ const escrowContract = this.getEscrowContract(escrowAddress);
470
+ await escrowContract.complete({
471
+ ...(await this.gasPriceOptions()),
472
+ });
447
473
  return;
448
474
  }
449
475
  catch (e) {
@@ -523,8 +549,10 @@ class EscrowClient {
523
549
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
524
550
  }
525
551
  try {
526
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
527
- await this.escrowContract.bulkPayOut(recipients, amounts, finalResultsUrl, finalResultsHash, constants_1.DEFAULT_TX_ID);
552
+ const escrowContract = this.getEscrowContract(escrowAddress);
553
+ await escrowContract.bulkPayOut(recipients, amounts, finalResultsUrl, finalResultsHash, constants_1.DEFAULT_TX_ID, {
554
+ ...(await this.gasPriceOptions()),
555
+ });
528
556
  return;
529
557
  }
530
558
  catch (e) {
@@ -564,11 +592,13 @@ class EscrowClient {
564
592
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
565
593
  }
566
594
  try {
567
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
568
- const tx = await this.escrowContract.cancel();
595
+ const escrowContract = this.getEscrowContract(escrowAddress);
596
+ const tx = await escrowContract.cancel({
597
+ ...(await this.gasPriceOptions()),
598
+ });
569
599
  const transactionReceipt = await tx.wait();
570
600
  let amountTransferred = undefined;
571
- const tokenAddress = await this.escrowContract.token();
601
+ const tokenAddress = await escrowContract.token();
572
602
  const tokenContract = typechain_types_1.HMToken__factory.connect(tokenAddress, this.signerOrProvider);
573
603
  for (const log of transactionReceipt.logs) {
574
604
  if (log.address === tokenAddress) {
@@ -626,8 +656,10 @@ class EscrowClient {
626
656
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
627
657
  }
628
658
  try {
629
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
630
- await this.escrowContract.abort();
659
+ const escrowContract = this.getEscrowContract(escrowAddress);
660
+ await escrowContract.abort({
661
+ ...(await this.gasPriceOptions()),
662
+ });
631
663
  return;
632
664
  }
633
665
  catch (e) {
@@ -677,8 +709,10 @@ class EscrowClient {
677
709
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
678
710
  }
679
711
  try {
680
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
681
- await this.escrowContract.addTrustedHandlers(trustedHandlers);
712
+ const escrowContract = this.getEscrowContract(escrowAddress);
713
+ await escrowContract.addTrustedHandlers(trustedHandlers, {
714
+ ...(await this.gasPriceOptions()),
715
+ });
682
716
  return;
683
717
  }
684
718
  catch (e) {
@@ -713,8 +747,8 @@ class EscrowClient {
713
747
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
714
748
  }
715
749
  try {
716
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
717
- return this.escrowContract.getBalance();
750
+ const escrowContract = this.getEscrowContract(escrowAddress);
751
+ return escrowContract.getBalance();
718
752
  }
719
753
  catch (e) {
720
754
  return (0, utils_1.throwError)(e);
@@ -748,8 +782,8 @@ class EscrowClient {
748
782
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
749
783
  }
750
784
  try {
751
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
752
- return this.escrowContract.manifestHash();
785
+ const escrowContract = this.getEscrowContract(escrowAddress);
786
+ return escrowContract.manifestHash();
753
787
  }
754
788
  catch (e) {
755
789
  return (0, utils_1.throwError)(e);
@@ -783,8 +817,8 @@ class EscrowClient {
783
817
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
784
818
  }
785
819
  try {
786
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
787
- return this.escrowContract.manifestUrl();
820
+ const escrowContract = this.getEscrowContract(escrowAddress);
821
+ return escrowContract.manifestUrl();
788
822
  }
789
823
  catch (e) {
790
824
  return (0, utils_1.throwError)(e);
@@ -818,8 +852,8 @@ class EscrowClient {
818
852
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
819
853
  }
820
854
  try {
821
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
822
- return this.escrowContract.finalResultsUrl();
855
+ const escrowContract = this.getEscrowContract(escrowAddress);
856
+ return escrowContract.finalResultsUrl();
823
857
  }
824
858
  catch (e) {
825
859
  return (0, utils_1.throwError)(e);
@@ -853,8 +887,8 @@ class EscrowClient {
853
887
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
854
888
  }
855
889
  try {
856
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
857
- return this.escrowContract.intermediateResultsUrl();
890
+ const escrowContract = this.getEscrowContract(escrowAddress);
891
+ return escrowContract.intermediateResultsUrl();
858
892
  }
859
893
  catch (e) {
860
894
  return (0, utils_1.throwError)(e);
@@ -888,8 +922,8 @@ class EscrowClient {
888
922
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
889
923
  }
890
924
  try {
891
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
892
- return this.escrowContract.token();
925
+ const escrowContract = this.getEscrowContract(escrowAddress);
926
+ return escrowContract.token();
893
927
  }
894
928
  catch (e) {
895
929
  return (0, utils_1.throwError)(e);
@@ -923,8 +957,8 @@ class EscrowClient {
923
957
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
924
958
  }
925
959
  try {
926
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
927
- return this.escrowContract.status();
960
+ const escrowContract = this.getEscrowContract(escrowAddress);
961
+ return escrowContract.status();
928
962
  }
929
963
  catch (e) {
930
964
  return (0, utils_1.throwError)(e);
@@ -958,8 +992,8 @@ class EscrowClient {
958
992
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
959
993
  }
960
994
  try {
961
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
962
- return this.escrowContract.recordingOracle();
995
+ const escrowContract = this.getEscrowContract(escrowAddress);
996
+ return escrowContract.recordingOracle();
963
997
  }
964
998
  catch (e) {
965
999
  return (0, utils_1.throwError)(e);
@@ -993,8 +1027,8 @@ class EscrowClient {
993
1027
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
994
1028
  }
995
1029
  try {
996
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
997
- return this.escrowContract.launcher();
1030
+ const escrowContract = this.getEscrowContract(escrowAddress);
1031
+ return escrowContract.launcher();
998
1032
  }
999
1033
  catch (e) {
1000
1034
  return (0, utils_1.throwError)(e);
@@ -1028,8 +1062,8 @@ class EscrowClient {
1028
1062
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
1029
1063
  }
1030
1064
  try {
1031
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
1032
- return this.escrowContract.reputationOracle();
1065
+ const escrowContract = this.getEscrowContract(escrowAddress);
1066
+ return escrowContract.reputationOracle();
1033
1067
  }
1034
1068
  catch (e) {
1035
1069
  return (0, utils_1.throwError)(e);
@@ -1063,8 +1097,8 @@ class EscrowClient {
1063
1097
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
1064
1098
  }
1065
1099
  try {
1066
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
1067
- return this.escrowContract.exchangeOracle();
1100
+ const escrowContract = this.getEscrowContract(escrowAddress);
1101
+ return escrowContract.exchangeOracle();
1068
1102
  }
1069
1103
  catch (e) {
1070
1104
  return (0, utils_1.throwError)(e);
@@ -1098,8 +1132,8 @@ class EscrowClient {
1098
1132
  throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
1099
1133
  }
1100
1134
  try {
1101
- this.escrowContract = typechain_types_1.Escrow__factory.connect(escrowAddress, this.signerOrProvider);
1102
- return this.escrowContract.escrowFactory();
1135
+ const escrowContract = this.getEscrowContract(escrowAddress);
1136
+ return escrowContract.escrowFactory();
1103
1137
  }
1104
1138
  catch (e) {
1105
1139
  return (0, utils_1.throwError)(e);
@@ -1233,6 +1267,8 @@ class EscrowUtils {
1233
1267
  * MOONBASE_ALPHA = 1287,
1234
1268
  * AVALANCHE = 43114,
1235
1269
  * AVALANCHE_TESTNET = 43113,
1270
+ * CELO = 42220,
1271
+ * CELO_ALFAJORES = 44787,
1236
1272
  * SKALE = 1273227453,
1237
1273
  * LOCALHOST = 1338,
1238
1274
  * }
@@ -1326,7 +1362,7 @@ class EscrowUtils {
1326
1362
  reputationOracle: filter.reputationOracle?.toLowerCase(),
1327
1363
  recordingOracle: filter.recordingOracle?.toLowerCase(),
1328
1364
  exchangeOracle: filter.exchangeOracle?.toLowerCase(),
1329
- status: filter.status
1365
+ status: filter.status !== undefined
1330
1366
  ? Object.entries(types_1.EscrowStatus).find(([, value]) => value === filter.status)?.[0]
1331
1367
  : undefined,
1332
1368
  from: filter.from ? +filter.from.getTime() / 1000 : undefined,
@@ -1363,6 +1399,8 @@ class EscrowUtils {
1363
1399
  * MOONBASE_ALPHA = 1287,
1364
1400
  * AVALANCHE = 43114,
1365
1401
  * AVALANCHE_TESTNET = 43113,
1402
+ * CELO = 42220,
1403
+ * CELO_ALFAJORES = 44787,
1366
1404
  * SKALE = 1273227453,
1367
1405
  * LOCALHOST = 1338,
1368
1406
  * }
@@ -49,7 +49,7 @@ const GET_ESCROWS_QUERY = (filter) => {
49
49
  ${reputationOracle ? `reputationOracle: $reputationOracle` : ''}
50
50
  ${recordingOracle ? `recordingOracle: $recordingOracle` : ''}
51
51
  ${exchangeOracle ? `exchangeOracle: $exchangeOracle` : ''}
52
- ${status ? `status: $status` : ''}
52
+ ${status !== undefined ? `status: $status` : ''}
53
53
  ${from ? `createdAt_gte: $from` : ''}
54
54
  ${to ? `createdAt_lte: $to` : ''}
55
55
  }