@human-protocol/sdk 4.1.5 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.js +7 -7
- package/dist/error.d.ts +18 -6
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +20 -8
- package/dist/escrow.d.ts +244 -34
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +267 -166
- package/dist/graphql/queries/escrow.d.ts +3 -1
- package/dist/graphql/queries/escrow.d.ts.map +1 -1
- package/dist/graphql/queries/escrow.js +50 -2
- package/dist/graphql/queries/operator.d.ts.map +1 -1
- package/dist/graphql/queries/operator.js +11 -9
- package/dist/graphql/queries/staking.d.ts +4 -0
- package/dist/graphql/queries/staking.d.ts.map +1 -0
- package/dist/graphql/queries/staking.js +71 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/interfaces.d.ts +58 -18
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +53 -58
- package/dist/staking.d.ts +21 -1
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +84 -1
- package/dist/types.d.ts +39 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +17 -1
- package/package.json +2 -2
- package/src/constants.ts +7 -7
- package/src/error.ts +27 -9
- package/src/escrow.ts +430 -129
- package/src/graphql/queries/escrow.ts +53 -2
- package/src/graphql/queries/operator.ts +11 -9
- package/src/graphql/queries/staking.ts +80 -0
- package/src/index.ts +2 -1
- package/src/interfaces.ts +65 -20
- package/src/operator.ts +62 -76
- package/src/staking.ts +106 -3
- package/src/types.ts +40 -15
- package/src/utils.ts +15 -0
package/dist/constants.js
CHANGED
|
@@ -28,7 +28,7 @@ exports.NETWORKS = {
|
|
|
28
28
|
stakingAddress: '0xEf6Da3aB52c33925Be3F84038193a7e1331F51E6',
|
|
29
29
|
kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
|
|
30
30
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
31
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
31
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQwp4Rr2J4UbPFykb9eXg2t7GPcGRS6WT7QzExZtv32jK',
|
|
32
32
|
oldSubgraphUrl: '',
|
|
33
33
|
oldFactoryAddress: '',
|
|
34
34
|
},
|
|
@@ -41,7 +41,7 @@ exports.NETWORKS = {
|
|
|
41
41
|
stakingAddress: '0x2163e3A40032Af1C359ac731deaB48258b317890',
|
|
42
42
|
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
43
43
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
44
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
44
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmVYn12ZqBeZf9J9orq9RYV1C9iQ9uyWWF5vsWFJiKR68e',
|
|
45
45
|
oldSubgraphUrl: '',
|
|
46
46
|
oldFactoryAddress: '',
|
|
47
47
|
},
|
|
@@ -54,7 +54,7 @@ exports.NETWORKS = {
|
|
|
54
54
|
stakingAddress: '0xE24e5C08E28331D24758b69A5E9f383D2bDD1c98',
|
|
55
55
|
kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
|
|
56
56
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
|
|
57
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
57
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT2VoBLjAfc4pQzDmeCGra6weoLuk2jPRgnRz5iSMUw1t',
|
|
58
58
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
59
59
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
60
60
|
},
|
|
@@ -67,7 +67,7 @@ exports.NETWORKS = {
|
|
|
67
67
|
stakingAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
68
68
|
kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
|
|
69
69
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
70
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
70
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmfRiMaGaL224Z5ii4JAJjfyT64KysYM9gFFWbkDW9QwK1',
|
|
71
71
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
72
72
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
73
73
|
},
|
|
@@ -80,7 +80,7 @@ exports.NETWORKS = {
|
|
|
80
80
|
stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
|
|
81
81
|
kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
|
|
82
82
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
83
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
83
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT72ecfx6Zaje21kLNi17kDJTpPKFYvzQETDyLpQgDrPu',
|
|
84
84
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
85
85
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
86
86
|
},
|
|
@@ -93,7 +93,7 @@ exports.NETWORKS = {
|
|
|
93
93
|
stakingAddress: '0xffE496683F842a923110415b7278ded3F265f2C5',
|
|
94
94
|
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
95
95
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
96
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
96
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmRHsvZo2wW2Y3fDHz6xsHd6wBQyacbzKmFfNYQ8Zy3KLy',
|
|
97
97
|
oldSubgraphUrl: '',
|
|
98
98
|
oldFactoryAddress: '',
|
|
99
99
|
},
|
|
@@ -106,7 +106,7 @@ exports.NETWORKS = {
|
|
|
106
106
|
stakingAddress: '0x7457d26a3C70Bd71F7557C773b303c1dB82BBB68',
|
|
107
107
|
kvstoreAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
108
108
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
109
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
109
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmVHYvjbsgAroR9EMgqqGTQ7aKPRFMVekY6evU6mFPUU7J',
|
|
110
110
|
oldSubgraphUrl: '',
|
|
111
111
|
oldFactoryAddress: '',
|
|
112
112
|
},
|
package/dist/error.d.ts
CHANGED
|
@@ -110,6 +110,10 @@ export declare const ErrorProviderDoesNotExist: Error;
|
|
|
110
110
|
* @constant {Error} - Unsupported chain ID.
|
|
111
111
|
*/
|
|
112
112
|
export declare const ErrorUnsupportedChainID: Error;
|
|
113
|
+
/**
|
|
114
|
+
* @constant {Error} - Staker not found.
|
|
115
|
+
*/
|
|
116
|
+
export declare const ErrorStakerNotFound: Error;
|
|
113
117
|
/**
|
|
114
118
|
* @constant {Error} - Sending a transaction requires a signer.
|
|
115
119
|
*/
|
|
@@ -131,13 +135,9 @@ export declare const ErrorManifestFileDoesNotExist: Error;
|
|
|
131
135
|
*/
|
|
132
136
|
export declare const ErrorInvalidUrl: Error;
|
|
133
137
|
/**
|
|
134
|
-
* @constant {Error} -
|
|
138
|
+
* @constant {Error} - Invalid manifest.
|
|
135
139
|
*/
|
|
136
|
-
export declare const
|
|
137
|
-
/**
|
|
138
|
-
* @constant {Error} - List of handlers cannot be empty.
|
|
139
|
-
*/
|
|
140
|
-
export declare const ErrorListOfHandlersCannotBeEmpty: Error;
|
|
140
|
+
export declare const ErrorInvalidManifest: Error;
|
|
141
141
|
/**
|
|
142
142
|
* @constant {Error} - No URL provided.
|
|
143
143
|
*/
|
|
@@ -190,6 +190,18 @@ export declare const ErrorInvalidHash: Error;
|
|
|
190
190
|
* @constant {Error} - The status is not supported.
|
|
191
191
|
*/
|
|
192
192
|
export declare const ErrorUnsupportedStatus: Error;
|
|
193
|
+
/**
|
|
194
|
+
* @constant {Error} - Invalid storeResults parameters for the escrow version
|
|
195
|
+
*/
|
|
196
|
+
export declare const ErrorStoreResultsVersion: Error;
|
|
197
|
+
/**
|
|
198
|
+
* @constant {Error} - Invalid bulkPayOut parameters for the escrow version
|
|
199
|
+
*/
|
|
200
|
+
export declare const ErrorBulkPayOutVersion: Error;
|
|
201
|
+
/**
|
|
202
|
+
* @constant {Warning} - Possible version mismatch.
|
|
203
|
+
*/
|
|
204
|
+
export declare const WarnVersionMismatch = "There may be a mismatch between the parameters passed and the expected parameters of the escrow contract version";
|
|
193
205
|
/**
|
|
194
206
|
* @constant {Warning} - The SUBGRAPH_API_KEY is not being provided.
|
|
195
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,2CAA2C,OAEvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yCAAyC,OAErD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,OAE3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,OAExC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,OAExC,CAAC;AAEF;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;AAED,qBAAa,oBAAqB,SAAQ,aAAa;gBACzC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,aAAa;gBAC3C,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,aAAa;gBAC3C,MAAM,EAAE,MAAM;CAG3B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAGzC"}
|
package/dist/error.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = void 0;
|
|
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;
|
|
5
5
|
/**
|
|
6
6
|
* @constant {Error} - The Staking contract is missing.
|
|
7
7
|
*/
|
|
@@ -114,6 +114,10 @@ exports.ErrorProviderDoesNotExist = new Error('Provider does not exist');
|
|
|
114
114
|
* @constant {Error} - Unsupported chain ID.
|
|
115
115
|
*/
|
|
116
116
|
exports.ErrorUnsupportedChainID = new Error('Unsupported chain ID');
|
|
117
|
+
/**
|
|
118
|
+
* @constant {Error} - Staker not found.
|
|
119
|
+
*/
|
|
120
|
+
exports.ErrorStakerNotFound = new Error('Staker not found');
|
|
117
121
|
/**
|
|
118
122
|
* @constant {Error} - Sending a transaction requires a signer.
|
|
119
123
|
*/
|
|
@@ -135,13 +139,9 @@ exports.ErrorManifestFileDoesNotExist = new Error('Manifest file does not exist'
|
|
|
135
139
|
*/
|
|
136
140
|
exports.ErrorInvalidUrl = new Error('Invalid URL string');
|
|
137
141
|
/**
|
|
138
|
-
* @constant {Error} -
|
|
142
|
+
* @constant {Error} - Invalid manifest.
|
|
139
143
|
*/
|
|
140
|
-
exports.
|
|
141
|
-
/**
|
|
142
|
-
* @constant {Error} - List of handlers cannot be empty.
|
|
143
|
-
*/
|
|
144
|
-
exports.ErrorListOfHandlersCannotBeEmpty = new Error('List of handlers cannot be empty');
|
|
144
|
+
exports.ErrorInvalidManifest = new Error('Invalid manifest');
|
|
145
145
|
/**
|
|
146
146
|
* @constant {Error} - No URL provided.
|
|
147
147
|
*/
|
|
@@ -194,6 +194,18 @@ exports.ErrorInvalidHash = new Error('Invalid hash');
|
|
|
194
194
|
* @constant {Error} - The status is not supported.
|
|
195
195
|
*/
|
|
196
196
|
exports.ErrorUnsupportedStatus = new Error('Unsupported status for query');
|
|
197
|
+
/**
|
|
198
|
+
* @constant {Error} - Invalid storeResults parameters for the escrow version
|
|
199
|
+
*/
|
|
200
|
+
exports.ErrorStoreResultsVersion = new Error('Invalid storeResults parameters for the contract version of the specified escrow address');
|
|
201
|
+
/**
|
|
202
|
+
* @constant {Error} - Invalid bulkPayOut parameters for the escrow version
|
|
203
|
+
*/
|
|
204
|
+
exports.ErrorBulkPayOutVersion = new Error('Invalid bulkPayOut parameters for the contract version of the specified escrow address');
|
|
205
|
+
/**
|
|
206
|
+
* @constant {Warning} - Possible version mismatch.
|
|
207
|
+
*/
|
|
208
|
+
exports.WarnVersionMismatch = 'There may be a mismatch between the parameters passed and the expected parameters of the escrow contract version';
|
|
197
209
|
/**
|
|
198
210
|
* @constant {Warning} - The SUBGRAPH_API_KEY is not being provided.
|
|
199
211
|
*/
|
package/dist/escrow.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContractRunner, Overrides } from 'ethers';
|
|
2
2
|
import { BaseEthersClient } from './base';
|
|
3
|
-
import { ChainId } from './enums';
|
|
3
|
+
import { ChainId, OrderDirection } from './enums';
|
|
4
4
|
import { StatusEvent } from './graphql';
|
|
5
5
|
import { IEscrow, IEscrowConfig, IEscrowsFilter, IPayoutFilter, IStatusEventFilter } from './interfaces';
|
|
6
|
-
import {
|
|
6
|
+
import { EscrowStatus, EscrowWithdraw, NetworkData, TransactionLikeWithNonce, Payout, CancellationRefund } from './types';
|
|
7
7
|
/**
|
|
8
8
|
* ## Introduction
|
|
9
9
|
*
|
|
@@ -102,7 +102,6 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
102
102
|
* This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers.
|
|
103
103
|
*
|
|
104
104
|
* @param {string} tokenAddress Token address to use for payouts.
|
|
105
|
-
* @param {string[]} trustedHandlers Array of addresses that can perform actions on the contract.
|
|
106
105
|
* @param {string} jobRequesterId Job Requester Id
|
|
107
106
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
108
107
|
* @returns {Promise<string>} Returns the address of the escrow created.
|
|
@@ -124,12 +123,11 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
124
123
|
* const escrowClient = await EscrowClient.build(signer);
|
|
125
124
|
*
|
|
126
125
|
* const tokenAddress = '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4';
|
|
127
|
-
* const trustedHandlers = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
|
|
128
126
|
* const jobRequesterId = "job-requester-id";
|
|
129
|
-
* const escrowAddress = await escrowClient.createEscrow(tokenAddress,
|
|
127
|
+
* const escrowAddress = await escrowClient.createEscrow(tokenAddress, jobRequesterId);
|
|
130
128
|
* ```
|
|
131
129
|
*/
|
|
132
|
-
createEscrow(tokenAddress: string,
|
|
130
|
+
createEscrow(tokenAddress: string, jobRequesterId: string, txOptions?: Overrides): Promise<string>;
|
|
133
131
|
/**
|
|
134
132
|
* This function sets up the parameters of the escrow.
|
|
135
133
|
*
|
|
@@ -141,7 +139,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
141
139
|
*
|
|
142
140
|
* **Code example**
|
|
143
141
|
*
|
|
144
|
-
* > Only Job Launcher or
|
|
142
|
+
* > Only Job Launcher or admin can call it.
|
|
145
143
|
*
|
|
146
144
|
* ```ts
|
|
147
145
|
* import { Wallet, providers } from 'ethers';
|
|
@@ -162,7 +160,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
162
160
|
* recordingOracleFee: BigInt('10'),
|
|
163
161
|
* reputationOracleFee: BigInt('10'),
|
|
164
162
|
* exchangeOracleFee: BigInt('10'),
|
|
165
|
-
*
|
|
163
|
+
* manifest: 'http://localhost/manifest.json',
|
|
166
164
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
167
165
|
* };
|
|
168
166
|
* await escrowClient.setup(escrowAddress, escrowConfig);
|
|
@@ -202,13 +200,43 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
202
200
|
* @param {string} escrowAddress Address of the escrow.
|
|
203
201
|
* @param {string} url Results file URL.
|
|
204
202
|
* @param {string} hash Results file hash.
|
|
203
|
+
* @param {bigint} fundsToReserve Funds to reserve for payouts
|
|
205
204
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
206
205
|
* @returns Returns void if successful. Throws error if any.
|
|
207
206
|
*
|
|
208
207
|
*
|
|
209
208
|
* **Code example**
|
|
210
209
|
*
|
|
211
|
-
* > Only Recording Oracle or
|
|
210
|
+
* > Only Recording Oracle or admin can call it.
|
|
211
|
+
*
|
|
212
|
+
* ```ts
|
|
213
|
+
* import { ethers, Wallet, providers } from 'ethers';
|
|
214
|
+
* import { EscrowClient } from '@human-protocol/sdk';
|
|
215
|
+
*
|
|
216
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
217
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
218
|
+
*
|
|
219
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
220
|
+
* const signer = new Wallet(privateKey, provider);
|
|
221
|
+
* const escrowClient = await EscrowClient.build(signer);
|
|
222
|
+
*
|
|
223
|
+
* await escrowClient.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'http://localhost/results.json', 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079', ethers.parseEther('10'));
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
storeResults(escrowAddress: string, url: string, hash: string, fundsToReserve: bigint, txOptions?: Overrides): Promise<void>;
|
|
227
|
+
/**
|
|
228
|
+
* This function stores the results URL and hash.
|
|
229
|
+
*
|
|
230
|
+
* @param {string} escrowAddress Address of the escrow.
|
|
231
|
+
* @param {string} url Results file URL.
|
|
232
|
+
* @param {string} hash Results file hash.
|
|
233
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
234
|
+
* @returns Returns void if successful. Throws error if any.
|
|
235
|
+
*
|
|
236
|
+
*
|
|
237
|
+
* **Code example**
|
|
238
|
+
*
|
|
239
|
+
* > Only Recording Oracle or admin can call it.
|
|
212
240
|
*
|
|
213
241
|
* ```ts
|
|
214
242
|
* import { ethers, Wallet, providers } from 'ethers';
|
|
@@ -235,7 +263,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
235
263
|
*
|
|
236
264
|
* **Code example**
|
|
237
265
|
*
|
|
238
|
-
* > Only Recording Oracle or
|
|
266
|
+
* > Only Recording Oracle or admin can call it.
|
|
239
267
|
*
|
|
240
268
|
* ```ts
|
|
241
269
|
* import { Wallet, providers } from 'ethers';
|
|
@@ -268,7 +296,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
268
296
|
*
|
|
269
297
|
* **Code example**
|
|
270
298
|
*
|
|
271
|
-
* > Only Reputation Oracle or
|
|
299
|
+
* > Only Reputation Oracle or admin can call it.
|
|
272
300
|
*
|
|
273
301
|
* ```ts
|
|
274
302
|
* import { ethers, Wallet, providers } from 'ethers';
|
|
@@ -287,21 +315,60 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
287
315
|
* const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
|
|
288
316
|
* const txId = 1;
|
|
289
317
|
*
|
|
290
|
-
* await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash, txId);
|
|
318
|
+
* await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash, txId, true);
|
|
291
319
|
* ```
|
|
292
320
|
*/
|
|
293
|
-
bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, txId: number, forceComplete
|
|
321
|
+
bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, txId: number, forceComplete: boolean, txOptions: Overrides): Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* This function pays out the amounts specified to the workers and sets the URL of the final results file.
|
|
324
|
+
*
|
|
325
|
+
* @param {string} escrowAddress Escrow address to payout.
|
|
326
|
+
* @param {string[]} recipients Array of recipient addresses.
|
|
327
|
+
* @param {bigint[]} amounts Array of amounts the recipients will receive.
|
|
328
|
+
* @param {string} finalResultsUrl Final results file URL.
|
|
329
|
+
* @param {string} finalResultsHash Final results file hash.
|
|
330
|
+
* @param {string} payoutId Payout ID.
|
|
331
|
+
* @param {boolean} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false).
|
|
332
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
333
|
+
* @returns Returns void if successful. Throws error if any.
|
|
334
|
+
*
|
|
335
|
+
*
|
|
336
|
+
* **Code example**
|
|
337
|
+
*
|
|
338
|
+
* > Only Reputation Oracle or admin can call it.
|
|
339
|
+
*
|
|
340
|
+
* ```ts
|
|
341
|
+
* import { ethers, Wallet, providers } from 'ethers';
|
|
342
|
+
* import { EscrowClient } from '@human-protocol/sdk';
|
|
343
|
+
* import { v4 as uuidV4 } from 'uuid';
|
|
344
|
+
*
|
|
345
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
346
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
347
|
+
*
|
|
348
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
349
|
+
* const signer = new Wallet(privateKey, provider);
|
|
350
|
+
* const escrowClient = await EscrowClient.build(signer);
|
|
351
|
+
*
|
|
352
|
+
* const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
|
|
353
|
+
* const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')];
|
|
354
|
+
* const resultsUrl = 'http://localhost/results.json';
|
|
355
|
+
* const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
|
|
356
|
+
* const payoutId = uuidV4();
|
|
357
|
+
*
|
|
358
|
+
* await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash, payoutId, true);
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, payoutId: string, forceComplete: boolean, txOptions: Overrides): Promise<void>;
|
|
294
362
|
/**
|
|
295
363
|
* This function cancels the specified escrow and sends the balance to the canceler.
|
|
296
364
|
*
|
|
297
365
|
* @param {string} escrowAddress Address of the escrow to cancel.
|
|
298
366
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
299
|
-
* @returns {EscrowCancel} Returns the escrow cancellation data including transaction hash and refunded amount. Throws error if any.
|
|
300
367
|
*
|
|
301
368
|
*
|
|
302
369
|
* **Code example**
|
|
303
370
|
*
|
|
304
|
-
* > Only Job Launcher or
|
|
371
|
+
* > Only Job Launcher or admin can call it.
|
|
305
372
|
*
|
|
306
373
|
* ```ts
|
|
307
374
|
* import { ethers, Wallet, providers } from 'ethers';
|
|
@@ -317,19 +384,17 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
317
384
|
* await escrowClient.cancel('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
318
385
|
* ```
|
|
319
386
|
*/
|
|
320
|
-
cancel(escrowAddress: string, txOptions?: Overrides): Promise<
|
|
387
|
+
cancel(escrowAddress: string, txOptions?: Overrides): Promise<void>;
|
|
321
388
|
/**
|
|
322
|
-
* This function
|
|
389
|
+
* This function requests the cancellation of the specified escrow (moves status to ToCancel or finalizes if expired).
|
|
323
390
|
*
|
|
324
|
-
* @param {string} escrowAddress Address of the escrow.
|
|
325
|
-
* @param {string[]} trustedHandlers Array of addresses of trusted handlers to add.
|
|
391
|
+
* @param {string} escrowAddress Address of the escrow to request cancellation.
|
|
326
392
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
327
393
|
* @returns Returns void if successful. Throws error if any.
|
|
328
394
|
*
|
|
329
|
-
*
|
|
330
395
|
* **Code example**
|
|
331
396
|
*
|
|
332
|
-
* > Only Job Launcher or
|
|
397
|
+
* > Only Job Launcher or admin can call it.
|
|
333
398
|
*
|
|
334
399
|
* ```ts
|
|
335
400
|
* import { Wallet, providers } from 'ethers';
|
|
@@ -342,11 +407,10 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
342
407
|
* const signer = new Wallet(privateKey, provider);
|
|
343
408
|
* const escrowClient = await EscrowClient.build(signer);
|
|
344
409
|
*
|
|
345
|
-
*
|
|
346
|
-
* await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309f', trustedHandlers);
|
|
410
|
+
* await escrowClient.requestCancellation('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
347
411
|
* ```
|
|
348
412
|
*/
|
|
349
|
-
|
|
413
|
+
requestCancellation(escrowAddress: string, txOptions?: Overrides): Promise<void>;
|
|
350
414
|
/**
|
|
351
415
|
* This function withdraws additional tokens in the escrow to the canceler.
|
|
352
416
|
*
|
|
@@ -358,7 +422,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
358
422
|
*
|
|
359
423
|
* **Code example**
|
|
360
424
|
*
|
|
361
|
-
* > Only Job Launcher or
|
|
425
|
+
* > Only Job Launcher or admin can call it.
|
|
362
426
|
*
|
|
363
427
|
* ```ts
|
|
364
428
|
* import { ethers, Wallet, providers } from 'ethers';
|
|
@@ -385,14 +449,14 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
385
449
|
* @param {bigint[]} amounts Array of amounts the recipients will receive.
|
|
386
450
|
* @param {string} finalResultsUrl Final results file URL.
|
|
387
451
|
* @param {string} finalResultsHash Final results file hash.
|
|
388
|
-
* @param {
|
|
452
|
+
* @param {string} payoutId Payout ID to identify the payout.
|
|
389
453
|
* @param {boolean} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false).
|
|
390
454
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
391
455
|
* @returns Returns object with raw transaction and signed transaction hash
|
|
392
456
|
*
|
|
393
457
|
* **Code example**
|
|
394
458
|
*
|
|
395
|
-
* > Only Reputation Oracle or
|
|
459
|
+
* > Only Reputation Oracle or admin can call it.
|
|
396
460
|
*
|
|
397
461
|
* ```ts
|
|
398
462
|
* import { ethers, Wallet, providers } from 'ethers';
|
|
@@ -409,7 +473,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
409
473
|
* const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')];
|
|
410
474
|
* const resultsUrl = 'http://localhost/results.json';
|
|
411
475
|
* const resultsHash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
|
|
412
|
-
* const
|
|
476
|
+
* const payoutId = '372f6916-fe34-4711-b6e3-274f682047de';
|
|
413
477
|
*
|
|
414
478
|
* const rawTransaction = await escrowClient.createBulkPayoutTransaction('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash, txId);
|
|
415
479
|
* console.log('Raw transaction:', rawTransaction);
|
|
@@ -418,7 +482,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
418
482
|
* console.log('Tx hash:', ethers.keccak256(signedTransaction));
|
|
419
483
|
* (await signer.sendTransaction(rawTransaction)).wait();
|
|
420
484
|
*/
|
|
421
|
-
createBulkPayoutTransaction(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string,
|
|
485
|
+
createBulkPayoutTransaction(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, payoutId: string, forceComplete?: boolean, txOptions?: Overrides): Promise<TransactionLikeWithNonce>;
|
|
422
486
|
private ensureCorrectBulkPayoutInput;
|
|
423
487
|
/**
|
|
424
488
|
* This function returns the balance for a specified escrow address.
|
|
@@ -441,6 +505,27 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
441
505
|
* ```
|
|
442
506
|
*/
|
|
443
507
|
getBalance(escrowAddress: string): Promise<bigint>;
|
|
508
|
+
/**
|
|
509
|
+
* This function returns the reserved funds for a specified escrow address.
|
|
510
|
+
*
|
|
511
|
+
* @param {string} escrowAddress Address of the escrow.
|
|
512
|
+
* @returns {Promise<bigint>} Reserved funds of the escrow in the token used to fund it.
|
|
513
|
+
*
|
|
514
|
+
* **Code example**
|
|
515
|
+
*
|
|
516
|
+
* ```ts
|
|
517
|
+
* import { providers } from 'ethers';
|
|
518
|
+
* import { EscrowClient } from '@human-protocol/sdk';
|
|
519
|
+
*
|
|
520
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
521
|
+
*
|
|
522
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
523
|
+
* const escrowClient = await EscrowClient.build(provider);
|
|
524
|
+
*
|
|
525
|
+
* const reservedFunds = await escrowClient.getReservedFunds('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
getReservedFunds(escrowAddress: string): Promise<bigint>;
|
|
444
529
|
/**
|
|
445
530
|
* This function returns the manifest file hash.
|
|
446
531
|
*
|
|
@@ -463,7 +548,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
463
548
|
*/
|
|
464
549
|
getManifestHash(escrowAddress: string): Promise<string>;
|
|
465
550
|
/**
|
|
466
|
-
* This function returns the manifest
|
|
551
|
+
* This function returns the manifest. Could be a URL or a JSON string.
|
|
467
552
|
*
|
|
468
553
|
* @param {string} escrowAddress Address of the escrow.
|
|
469
554
|
* @returns {Promise<string>} Url of the manifest.
|
|
@@ -479,10 +564,10 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
479
564
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
480
565
|
* const escrowClient = await EscrowClient.build(provider);
|
|
481
566
|
*
|
|
482
|
-
* const
|
|
567
|
+
* const manifest = await escrowClient.getManifest('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
483
568
|
* ```
|
|
484
569
|
*/
|
|
485
|
-
|
|
570
|
+
getManifest(escrowAddress: string): Promise<string>;
|
|
486
571
|
/**
|
|
487
572
|
* This function returns the results file URL.
|
|
488
573
|
*
|
|
@@ -525,6 +610,27 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
525
610
|
* ```
|
|
526
611
|
*/
|
|
527
612
|
getIntermediateResultsUrl(escrowAddress: string): Promise<string>;
|
|
613
|
+
/**
|
|
614
|
+
* This function returns the intermediate results hash.
|
|
615
|
+
*
|
|
616
|
+
* @param {string} escrowAddress Address of the escrow.
|
|
617
|
+
* @returns {Promise<string>} Hash of the intermediate results file content.
|
|
618
|
+
*
|
|
619
|
+
* **Code example**
|
|
620
|
+
*
|
|
621
|
+
* ```ts
|
|
622
|
+
* import { providers } from 'ethers';
|
|
623
|
+
* import { EscrowClient } from '@human-protocol/sdk';
|
|
624
|
+
*
|
|
625
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
626
|
+
*
|
|
627
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
628
|
+
* const escrowClient = await EscrowClient.build(provider);
|
|
629
|
+
*
|
|
630
|
+
* const intermediateResultsHash = await escrowClient.getIntermediateResultsHash('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
getIntermediateResultsHash(escrowAddress: string): Promise<string>;
|
|
528
634
|
/**
|
|
529
635
|
* This function returns the token address used for funding the escrow.
|
|
530
636
|
*
|
|
@@ -772,7 +878,7 @@ export declare class EscrowUtils {
|
|
|
772
878
|
* intermediateResultsUrl?: string;
|
|
773
879
|
* launcher: string;
|
|
774
880
|
* manifestHash?: string;
|
|
775
|
-
*
|
|
881
|
+
* manifest?: string;
|
|
776
882
|
* recordingOracle?: string;
|
|
777
883
|
* reputationOracle?: string;
|
|
778
884
|
* exchangeOracle?: string;
|
|
@@ -835,7 +941,7 @@ export declare class EscrowUtils {
|
|
|
835
941
|
* intermediateResultsUrl?: string;
|
|
836
942
|
* launcher: string;
|
|
837
943
|
* manifestHash?: string;
|
|
838
|
-
*
|
|
944
|
+
* manifest?: string;
|
|
839
945
|
* recordingOracle?: string;
|
|
840
946
|
* reputationOracle?: string;
|
|
841
947
|
* exchangeOracle?: string;
|
|
@@ -944,5 +1050,109 @@ export declare class EscrowUtils {
|
|
|
944
1050
|
* ```
|
|
945
1051
|
*/
|
|
946
1052
|
static getPayouts(filter: IPayoutFilter): Promise<Payout[]>;
|
|
1053
|
+
/**
|
|
1054
|
+
* This function returns the cancellation refunds for a given set of networks.
|
|
1055
|
+
*
|
|
1056
|
+
* > This uses Subgraph
|
|
1057
|
+
*
|
|
1058
|
+
* **Input parameters**
|
|
1059
|
+
*
|
|
1060
|
+
* ```ts
|
|
1061
|
+
* enum ChainId {
|
|
1062
|
+
* ALL = -1,
|
|
1063
|
+
* MAINNET = 1,
|
|
1064
|
+
* SEPOLIA = 11155111,
|
|
1065
|
+
* BSC_MAINNET = 56,
|
|
1066
|
+
* BSC_TESTNET = 97,
|
|
1067
|
+
* POLYGON = 137,
|
|
1068
|
+
* POLYGON_AMOY = 80002,
|
|
1069
|
+
* LOCALHOST = 1338,
|
|
1070
|
+
* }
|
|
1071
|
+
* ```
|
|
1072
|
+
*
|
|
1073
|
+
* ```ts
|
|
1074
|
+
* type CancellationRefund = {
|
|
1075
|
+
* id: string;
|
|
1076
|
+
* escrowAddress: string;
|
|
1077
|
+
* receiver: string;
|
|
1078
|
+
* amount: bigint;
|
|
1079
|
+
* block: number;
|
|
1080
|
+
* timestamp: number;
|
|
1081
|
+
* txHash: string;
|
|
1082
|
+
* };
|
|
1083
|
+
* ```
|
|
1084
|
+
*
|
|
1085
|
+
*
|
|
1086
|
+
* @param {Object} filter Filter parameters.
|
|
1087
|
+
* @returns {Promise<CancellationRefund[]>} List of cancellation refunds matching the filters.
|
|
1088
|
+
*
|
|
1089
|
+
* **Code example**
|
|
1090
|
+
*
|
|
1091
|
+
* ```ts
|
|
1092
|
+
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
1093
|
+
*
|
|
1094
|
+
* const cancellationRefunds = await EscrowUtils.getCancellationRefunds({
|
|
1095
|
+
* chainId: ChainId.POLYGON_AMOY,
|
|
1096
|
+
* escrowAddress: '0x1234567890123456789012345678901234567890',
|
|
1097
|
+
* });
|
|
1098
|
+
* console.log(cancellationRefunds);
|
|
1099
|
+
* ```
|
|
1100
|
+
*/
|
|
1101
|
+
static getCancellationRefunds(filter: {
|
|
1102
|
+
chainId: ChainId;
|
|
1103
|
+
escrowAddress?: string;
|
|
1104
|
+
receiver?: string;
|
|
1105
|
+
from?: Date;
|
|
1106
|
+
to?: Date;
|
|
1107
|
+
first?: number;
|
|
1108
|
+
skip?: number;
|
|
1109
|
+
orderDirection?: OrderDirection;
|
|
1110
|
+
}): Promise<CancellationRefund[]>;
|
|
1111
|
+
/**
|
|
1112
|
+
* This function returns the cancellation refund for a given escrow address.
|
|
1113
|
+
*
|
|
1114
|
+
* > This uses Subgraph
|
|
1115
|
+
*
|
|
1116
|
+
* **Input parameters**
|
|
1117
|
+
*
|
|
1118
|
+
* ```ts
|
|
1119
|
+
* enum ChainId {
|
|
1120
|
+
* ALL = -1,
|
|
1121
|
+
* MAINNET = 1,
|
|
1122
|
+
* SEPOLIA = 11155111,
|
|
1123
|
+
* BSC_MAINNET = 56,
|
|
1124
|
+
* BSC_TESTNET = 97,
|
|
1125
|
+
* POLYGON = 137,
|
|
1126
|
+
* POLYGON_AMOY = 80002,
|
|
1127
|
+
* LOCALHOST = 1338,
|
|
1128
|
+
* }
|
|
1129
|
+
* ```
|
|
1130
|
+
*
|
|
1131
|
+
* ```ts
|
|
1132
|
+
* type CancellationRefund = {
|
|
1133
|
+
* id: string;
|
|
1134
|
+
* escrowAddress: string;
|
|
1135
|
+
* receiver: string;
|
|
1136
|
+
* amount: bigint;
|
|
1137
|
+
* block: number;
|
|
1138
|
+
* timestamp: number;
|
|
1139
|
+
* txHash: string;
|
|
1140
|
+
* };
|
|
1141
|
+
* ```
|
|
1142
|
+
*
|
|
1143
|
+
*
|
|
1144
|
+
* @param {ChainId} chainId Network in which the escrow has been deployed
|
|
1145
|
+
* @param {string} escrowAddress Address of the escrow
|
|
1146
|
+
* @returns {Promise<CancellationRefund>} Cancellation refund data
|
|
1147
|
+
*
|
|
1148
|
+
* **Code example**
|
|
1149
|
+
*
|
|
1150
|
+
* ```ts
|
|
1151
|
+
* import { ChainId, EscrowUtils } from '@human-protocol/sdk';
|
|
1152
|
+
*
|
|
1153
|
+
* const cancellationRefund = await EscrowUtils.getCancellationRefund(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
|
|
1154
|
+
* ```
|
|
1155
|
+
*/
|
|
1156
|
+
static getCancellationRefund(chainId: ChainId, escrowAddress: string): Promise<CancellationRefund>;
|
|
947
1157
|
}
|
|
948
1158
|
//# sourceMappingURL=escrow.d.ts.map
|