@human-protocol/sdk 3.0.6 → 3.0.8
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.d.ts +1 -24
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +23 -64
- package/dist/encryption.d.ts +6 -4
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +52 -16
- package/dist/escrow.d.ts +20 -57
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +74 -88
- package/dist/graphql/queries/operator.js +2 -2
- package/dist/graphql/queries/statistics.d.ts.map +1 -1
- package/dist/graphql/queries/statistics.js +0 -2
- package/dist/graphql/queries/transaction.d.ts.map +1 -1
- package/dist/graphql/queries/transaction.js +23 -10
- package/dist/graphql/types.d.ts +0 -2
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/interfaces.d.ts +19 -10
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +1 -1
- package/dist/kvstore.js +1 -1
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +13 -0
- package/dist/staking.d.ts +3 -112
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +2 -170
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +3 -1
- package/dist/storage.js +17 -7
- package/dist/types.d.ts +17 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/constants.ts +23 -64
- package/src/encryption.ts +47 -15
- package/src/escrow.ts +119 -103
- package/src/graphql/queries/operator.ts +2 -2
- package/src/graphql/queries/statistics.ts +0 -2
- package/src/graphql/queries/transaction.ts +23 -13
- package/src/graphql/types.ts +0 -2
- package/src/interfaces.ts +19 -11
- package/src/kvstore.ts +1 -1
- package/src/operator.ts +21 -0
- package/src/staking.ts +2 -185
- package/src/statistics.ts +3 -1
- package/src/types.ts +18 -4
package/dist/constants.d.ts
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
import { ChainId } from './enums';
|
|
2
2
|
import { NetworkData } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* @constant Default public bucket name
|
|
5
|
-
*/
|
|
6
3
|
export declare const DEFAULT_PUBLIC_BUCKET = "escrow-public-results";
|
|
7
|
-
/**
|
|
8
|
-
* @constant Default storage endpoint
|
|
9
|
-
*/
|
|
10
4
|
export declare const DEFAULT_ENDPOINT = "localhost";
|
|
11
|
-
/**
|
|
12
|
-
* @constant Default storage region
|
|
13
|
-
*/
|
|
14
5
|
export declare const DEFAULT_REGION = "eu";
|
|
15
|
-
/**
|
|
16
|
-
* @constant Default storage port
|
|
17
|
-
*/
|
|
18
6
|
export declare const DEFAULT_PORT = 9000;
|
|
19
|
-
/**
|
|
20
|
-
* @constant Default storage port
|
|
21
|
-
*/
|
|
22
7
|
export declare const DEFAULT_USE_SSL = false;
|
|
23
|
-
/**
|
|
24
|
-
* @constant Default tx Id
|
|
25
|
-
*/
|
|
26
8
|
export declare const DEFAULT_TX_ID = 1;
|
|
27
|
-
/**
|
|
28
|
-
* @constant Default Enum for escrow statuses.
|
|
29
|
-
*/
|
|
30
9
|
export declare enum HttpStatus {
|
|
31
10
|
OK = 200,
|
|
32
11
|
CREATED = 201,
|
|
@@ -37,9 +16,6 @@ export declare enum HttpStatus {
|
|
|
37
16
|
NOT_FOUND = 404,
|
|
38
17
|
INTERNAL_SERVER_ERROR = 500
|
|
39
18
|
}
|
|
40
|
-
/**
|
|
41
|
-
* @constant Default network parameters
|
|
42
|
-
*/
|
|
43
19
|
export declare const NETWORKS: {
|
|
44
20
|
[chainId in ChainId]?: NetworkData;
|
|
45
21
|
};
|
|
@@ -48,6 +24,7 @@ export declare const KVStoreKeys: {
|
|
|
48
24
|
fee: string;
|
|
49
25
|
publicKey: string;
|
|
50
26
|
webhookUrl: string;
|
|
27
|
+
website: string;
|
|
51
28
|
url: string;
|
|
52
29
|
jobTypes: string;
|
|
53
30
|
registrationNeeded: string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -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
|
|
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,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,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;CAiRnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CAUvB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,4BAA4B,uBAAuB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -2,33 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SUBGRAPH_API_KEY_PLACEHOLDER = exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.DEFAULT_TX_ID = exports.DEFAULT_USE_SSL = exports.DEFAULT_PORT = exports.DEFAULT_REGION = exports.DEFAULT_ENDPOINT = exports.DEFAULT_PUBLIC_BUCKET = void 0;
|
|
4
4
|
const enums_1 = require("./enums");
|
|
5
|
-
/**
|
|
6
|
-
* @constant Default public bucket name
|
|
7
|
-
*/
|
|
8
5
|
exports.DEFAULT_PUBLIC_BUCKET = 'escrow-public-results';
|
|
9
|
-
/**
|
|
10
|
-
* @constant Default storage endpoint
|
|
11
|
-
*/
|
|
12
6
|
exports.DEFAULT_ENDPOINT = 'localhost';
|
|
13
|
-
/**
|
|
14
|
-
* @constant Default storage region
|
|
15
|
-
*/
|
|
16
7
|
exports.DEFAULT_REGION = 'eu';
|
|
17
|
-
/**
|
|
18
|
-
* @constant Default storage port
|
|
19
|
-
*/
|
|
20
8
|
exports.DEFAULT_PORT = 9000;
|
|
21
|
-
/**
|
|
22
|
-
* @constant Default storage port
|
|
23
|
-
*/
|
|
24
9
|
exports.DEFAULT_USE_SSL = false;
|
|
25
|
-
/**
|
|
26
|
-
* @constant Default tx Id
|
|
27
|
-
*/
|
|
28
10
|
exports.DEFAULT_TX_ID = 1;
|
|
29
|
-
/**
|
|
30
|
-
* @constant Default Enum for escrow statuses.
|
|
31
|
-
*/
|
|
32
11
|
var HttpStatus;
|
|
33
12
|
(function (HttpStatus) {
|
|
34
13
|
HttpStatus[HttpStatus["OK"] = 200] = "OK";
|
|
@@ -40,9 +19,6 @@ var HttpStatus;
|
|
|
40
19
|
HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
41
20
|
HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
42
21
|
})(HttpStatus || (exports.HttpStatus = HttpStatus = {}));
|
|
43
|
-
/**
|
|
44
|
-
* @constant Default network parameters
|
|
45
|
-
*/
|
|
46
22
|
exports.NETWORKS = {
|
|
47
23
|
[enums_1.ChainId.MAINNET]: {
|
|
48
24
|
chainId: enums_1.ChainId.MAINNET,
|
|
@@ -50,11 +26,10 @@ exports.NETWORKS = {
|
|
|
50
26
|
scanUrl: 'https://etherscan.io',
|
|
51
27
|
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
52
28
|
hmtAddress: '0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867',
|
|
53
|
-
stakingAddress: '
|
|
54
|
-
rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
|
|
29
|
+
stakingAddress: '0xEf6Da3aB52c33925Be3F84038193a7e1331F51E6',
|
|
55
30
|
kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
|
|
56
31
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
57
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
32
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmNTdYHpQLW4sbrCxihXNdQwhxa2zdyu1yPkCUuTbqESba',
|
|
58
33
|
oldSubgraphUrl: '',
|
|
59
34
|
oldFactoryAddress: '',
|
|
60
35
|
},
|
|
@@ -65,7 +40,6 @@ exports.NETWORKS = {
|
|
|
65
40
|
factoryAddress: '0x925B24444511c86F4d4E63141D8Be0A025E2dca4',
|
|
66
41
|
hmtAddress: '0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23',
|
|
67
42
|
stakingAddress: '',
|
|
68
|
-
rewardPoolAddress: '',
|
|
69
43
|
kvstoreAddress: '',
|
|
70
44
|
subgraphUrl: '',
|
|
71
45
|
subgraphUrlApiKey: '',
|
|
@@ -79,7 +53,6 @@ exports.NETWORKS = {
|
|
|
79
53
|
factoryAddress: '0x87469B4f2Fcf37cBd34E54244c0BD4Fa0603664c',
|
|
80
54
|
hmtAddress: '0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317',
|
|
81
55
|
stakingAddress: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
|
|
82
|
-
rewardPoolAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
|
|
83
56
|
kvstoreAddress: '0x19Fc3e859C1813ac9427a7a78BeB9ae102CE96d3',
|
|
84
57
|
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli-v2',
|
|
85
58
|
subgraphUrlApiKey: '',
|
|
@@ -90,13 +63,12 @@ exports.NETWORKS = {
|
|
|
90
63
|
chainId: enums_1.ChainId.SEPOLIA,
|
|
91
64
|
title: 'Ethereum Sepolia',
|
|
92
65
|
scanUrl: 'https://sepolia.etherscan.io/',
|
|
93
|
-
factoryAddress: '
|
|
66
|
+
factoryAddress: '0x5987A5558d961ee674efe4A8c8eB7B1b5495D3bf',
|
|
94
67
|
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
95
|
-
stakingAddress: '
|
|
96
|
-
rewardPoolAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
68
|
+
stakingAddress: '0x2163e3A40032Af1C359ac731deaB48258b317890',
|
|
97
69
|
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
98
70
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
99
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
71
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmXVFVCLm2XxupxdKgnLRzvmkPJnpRbcoe4RNXoTqSRHsg',
|
|
100
72
|
oldSubgraphUrl: '',
|
|
101
73
|
oldFactoryAddress: '',
|
|
102
74
|
},
|
|
@@ -106,11 +78,10 @@ exports.NETWORKS = {
|
|
|
106
78
|
scanUrl: 'https://bscscan.com',
|
|
107
79
|
factoryAddress: '0x92FD968AcBd521c232f5fB8c33b342923cC72714',
|
|
108
80
|
hmtAddress: '0x711Fd6ab6d65A98904522d4e3586F492B989c527',
|
|
109
|
-
stakingAddress: '
|
|
110
|
-
rewardPoolAddress: '0xf376443BCc6d4d4D63eeC086bc4A9E4a83878e0e',
|
|
81
|
+
stakingAddress: '0xE24e5C08E28331D24758b69A5E9f383D2bDD1c98',
|
|
111
82
|
kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
|
|
112
83
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
|
|
113
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
84
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmPMS6G5evLm5ZpbnmpCfUy8bHJPwzPkZTv9DgfNdFfrCM',
|
|
114
85
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
115
86
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
116
87
|
},
|
|
@@ -120,11 +91,10 @@ exports.NETWORKS = {
|
|
|
120
91
|
scanUrl: 'https://testnet.bscscan.com',
|
|
121
92
|
factoryAddress: '0x2bfA592DBDaF434DDcbb893B1916120d181DAD18',
|
|
122
93
|
hmtAddress: '0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d',
|
|
123
|
-
stakingAddress: '
|
|
124
|
-
rewardPoolAddress: '0xB0A0500103eCEc431b73F6BAd923F0a2774E6e29',
|
|
94
|
+
stakingAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
125
95
|
kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
|
|
126
96
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
127
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
97
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmW6JqXvhDnhRVHU6ixKVSD65U1GKWUf3xwJo8E6mTBsAu',
|
|
128
98
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
129
99
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
130
100
|
},
|
|
@@ -134,11 +104,10 @@ exports.NETWORKS = {
|
|
|
134
104
|
scanUrl: 'https://polygonscan.com',
|
|
135
105
|
factoryAddress: '0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB',
|
|
136
106
|
hmtAddress: '0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF',
|
|
137
|
-
stakingAddress: '
|
|
138
|
-
rewardPoolAddress: '0xa8e32d777a3839440cc7c24D591A64B9481753B3',
|
|
107
|
+
stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
|
|
139
108
|
kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
|
|
140
109
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
141
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
110
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmTyCQMQd5QtogeTEuiqxnGQZa2PtgpUBsWLYwPCCFPbUe',
|
|
142
111
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
143
112
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
144
113
|
},
|
|
@@ -149,7 +118,6 @@ exports.NETWORKS = {
|
|
|
149
118
|
factoryAddress: '0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d',
|
|
150
119
|
hmtAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
|
|
151
120
|
stakingAddress: '0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac',
|
|
152
|
-
rewardPoolAddress: '0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE',
|
|
153
121
|
kvstoreAddress: '0xD96158c7267Ea658a4688F4aEf1c85659851625d',
|
|
154
122
|
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai-v2',
|
|
155
123
|
subgraphUrlApiKey: '',
|
|
@@ -162,11 +130,10 @@ exports.NETWORKS = {
|
|
|
162
130
|
scanUrl: 'https://amoy.polygonscan.com/',
|
|
163
131
|
factoryAddress: '0xAFf5a986A530ff839d49325A5dF69F96627E8D29',
|
|
164
132
|
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
165
|
-
stakingAddress: '
|
|
166
|
-
rewardPoolAddress: '0xd866bCEFf6D0F77E1c3EAE28230AE6C79b03fDa7',
|
|
133
|
+
stakingAddress: '0xffE496683F842a923110415b7278ded3F265f2C5',
|
|
167
134
|
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
168
135
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
169
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
136
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmawobiPUYsGNK9chtb5PvicUtaa8Jsjpwvv8dNyMVXQ9r',
|
|
170
137
|
oldSubgraphUrl: '',
|
|
171
138
|
oldFactoryAddress: '',
|
|
172
139
|
},
|
|
@@ -177,7 +144,6 @@ exports.NETWORKS = {
|
|
|
177
144
|
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
178
145
|
hmtAddress: '0x3b25BC1dC591D24d60560d0135D6750A561D4764',
|
|
179
146
|
stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
|
|
180
|
-
rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
|
|
181
147
|
kvstoreAddress: '0x2B95bEcb6EBC4589f64CB000dFCF716b4aeF8aA6',
|
|
182
148
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/moonbeam/version/latest',
|
|
183
149
|
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYe9hsFYuVgQsH719AsqRNqgVM8YBYfCuhBNYjXtBqQru',
|
|
@@ -190,11 +156,10 @@ exports.NETWORKS = {
|
|
|
190
156
|
scanUrl: 'https://moonbase.moonscan.io/',
|
|
191
157
|
factoryAddress: '0x5e622FF522D81aa426f082bDD95210BC25fCA7Ed',
|
|
192
158
|
hmtAddress: '0x2dd72db2bBA65cE663e476bA8b84A1aAF802A8e3',
|
|
193
|
-
stakingAddress: '
|
|
194
|
-
rewardPoolAddress: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
|
|
159
|
+
stakingAddress: '0xbA537fEF2442cD48f60686FE1Bbbe40F964a7940',
|
|
195
160
|
kvstoreAddress: '0xcC561f4482f4Ff051D2Dcc65c2cE1A0f291bbA46',
|
|
196
161
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/moonbase-alpha/version/latest',
|
|
197
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
162
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmSDPbm5xxMvYVSJzHFVsRiMekvJVYSJ7UfZw17DhPMdaH',
|
|
198
163
|
oldSubgraphUrl: '',
|
|
199
164
|
oldFactoryAddress: '',
|
|
200
165
|
},
|
|
@@ -204,11 +169,10 @@ exports.NETWORKS = {
|
|
|
204
169
|
scanUrl: 'https://testnet.snowtrace.io',
|
|
205
170
|
factoryAddress: '0x56C2ba540726ED4f46E7a134b6b9Ee9C867FcF92',
|
|
206
171
|
hmtAddress: '0x9406d5c635AD22b0d76c75E52De57A2177919ca3',
|
|
207
|
-
stakingAddress: '
|
|
208
|
-
rewardPoolAddress: '0x5517fE916Fe9F8dB15B0DDc76ebDf0BdDCd4ed18',
|
|
172
|
+
stakingAddress: '0xbA537fEF2442cD48f60686FE1Bbbe40F964a7940',
|
|
209
173
|
kvstoreAddress: '0x3aD4B091E054f192a822D1406f4535eAd38580e4',
|
|
210
174
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/fuji/version/latest',
|
|
211
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
175
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYXwNPwC5DcitK1SLVUR6gPANmEn3UsVvGeTbjCv1tTb2',
|
|
212
176
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/fuji',
|
|
213
177
|
oldFactoryAddress: '0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88',
|
|
214
178
|
},
|
|
@@ -219,7 +183,6 @@ exports.NETWORKS = {
|
|
|
219
183
|
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
220
184
|
hmtAddress: '0x12365293cb6477d4fc2686e46BB97E3Fb64f1550',
|
|
221
185
|
stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
|
|
222
|
-
rewardPoolAddress: '0x4A5963Dd6792692e9147EdC7659936b96251917a',
|
|
223
186
|
kvstoreAddress: '0x9Bc7bff35B2Be2413708d48c3B0aEF5c43646728',
|
|
224
187
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/avalanche/version/latest',
|
|
225
188
|
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYR8NUuAQVoGmGSwKanUJLjX9iZxrEyGH39HjUuXLmsum',
|
|
@@ -233,7 +196,6 @@ exports.NETWORKS = {
|
|
|
233
196
|
factoryAddress: '0x86Af9f6Cd34B69Db1B202223C6d6D109f2491569',
|
|
234
197
|
hmtAddress: '0x2736B33455A872dC478E1E004106D04c35472468',
|
|
235
198
|
stakingAddress: '0x003548Df34be8836cF0F9673403a1E40ba449a0F',
|
|
236
|
-
rewardPoolAddress: '0xA9545C2530BD5bdb464d5E274F59ACceAa73eD86',
|
|
237
199
|
kvstoreAddress: '0x938335006ea6F9Eb0e8020969cFF94404425e298',
|
|
238
200
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/celo-alfajores/version/latest',
|
|
239
201
|
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmb2WKCFFhT7REAjTuMd9pZvGw7rRpzeZSPJ3KRztD2pMM',
|
|
@@ -247,7 +209,6 @@ exports.NETWORKS = {
|
|
|
247
209
|
factoryAddress: '0xc90B43a5d576D9d8026c48904dfbaED50C15Fa08',
|
|
248
210
|
hmtAddress: '0x19Ead835951493A763c96910255d5eeF147E914F',
|
|
249
211
|
stakingAddress: '0x34cD3Bd6B16c559f321799b516dE61E12017fFd1',
|
|
250
|
-
rewardPoolAddress: '0xb9344bAD98E3d26a4d83900922baf395a2Ec154c',
|
|
251
212
|
kvstoreAddress: '0x86Af9f6Cd34B69Db1B202223C6d6D109f2491569',
|
|
252
213
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/celo/version/latest',
|
|
253
214
|
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmeeb5zshw1z9Q38NNPun2Pd7P951Mkzz5ywK171tauNRY',
|
|
@@ -261,7 +222,6 @@ exports.NETWORKS = {
|
|
|
261
222
|
factoryAddress: '0x4949C9DFFD83F0D5Ab0AB24C57C4D403D5c20C15',
|
|
262
223
|
hmtAddress: '0x10acbe3b9e6a2ff7f341e5cbf4b6617741ff44aa',
|
|
263
224
|
stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
|
|
264
|
-
rewardPoolAddress: '0x7ABa5F75b2b530cB0c8927C86591c21dF44f06b6',
|
|
265
225
|
kvstoreAddress: '0x6512d894cc3d3FE93Da9d0420430136fA889FaB9',
|
|
266
226
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/xlayer/version/latest',
|
|
267
227
|
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmWTggMrB5sRSs2fePuqQG9WbLMk8HtnfLH3VbRhmVdF8s',
|
|
@@ -274,11 +234,10 @@ exports.NETWORKS = {
|
|
|
274
234
|
scanUrl: 'https://www.okx.com/explorer/xlayer-test',
|
|
275
235
|
factoryAddress: '0x6Cd3ecAD36ee88E9ef3665CF381D9dAE0FE0a32e',
|
|
276
236
|
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
277
|
-
stakingAddress: '
|
|
278
|
-
rewardPoolAddress: '0x6daccd1f3a68945f8a7ac6d20260953f7a97fae4',
|
|
237
|
+
stakingAddress: '0xeF9849a904dF0d494D69ac0B0a6860a3A7936114',
|
|
279
238
|
kvstoreAddress: '0xdE8BE9E3C12E9F546309A429cd88d026a25EaF8C',
|
|
280
239
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/xlayer-testnet/version/latest',
|
|
281
|
-
subgraphUrlApiKey: 'https://gateway-testnet-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
240
|
+
subgraphUrlApiKey: 'https://gateway-testnet-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmNoRyqZtJTRrkbKAmWMZQUHuah7YSs8U9R3nzPu8WEhtY',
|
|
282
241
|
oldSubgraphUrl: '',
|
|
283
242
|
oldFactoryAddress: '',
|
|
284
243
|
},
|
|
@@ -286,11 +245,10 @@ exports.NETWORKS = {
|
|
|
286
245
|
chainId: enums_1.ChainId.LOCALHOST,
|
|
287
246
|
title: 'Localhost',
|
|
288
247
|
scanUrl: '',
|
|
289
|
-
factoryAddress: '
|
|
248
|
+
factoryAddress: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9',
|
|
290
249
|
hmtAddress: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
|
|
291
|
-
stakingAddress: '
|
|
292
|
-
|
|
293
|
-
kvstoreAddress: '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707',
|
|
250
|
+
stakingAddress: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',
|
|
251
|
+
kvstoreAddress: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
|
|
294
252
|
subgraphUrl: 'http://localhost:8000/subgraphs/name/humanprotocol/localhost',
|
|
295
253
|
subgraphUrlApiKey: '',
|
|
296
254
|
oldSubgraphUrl: '',
|
|
@@ -302,6 +260,7 @@ exports.KVStoreKeys = {
|
|
|
302
260
|
fee: 'fee',
|
|
303
261
|
publicKey: 'public_key',
|
|
304
262
|
webhookUrl: 'webhook_url',
|
|
263
|
+
website: 'website',
|
|
305
264
|
url: 'url',
|
|
306
265
|
jobTypes: 'job_types',
|
|
307
266
|
registrationNeeded: 'registration_needed',
|
package/dist/encryption.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as openpgp from 'openpgp';
|
|
2
2
|
import { IKeyPair } from './interfaces';
|
|
3
|
+
type MessageDataType = string | Uint8Array;
|
|
3
4
|
/**
|
|
4
5
|
* ## Introduction
|
|
5
6
|
*
|
|
@@ -100,7 +101,7 @@ export declare class Encryption {
|
|
|
100
101
|
* const resultMessage = await encription.signAndEncrypt('message', publicKeys);
|
|
101
102
|
* ```
|
|
102
103
|
*/
|
|
103
|
-
signAndEncrypt(message:
|
|
104
|
+
signAndEncrypt(message: MessageDataType, publicKeys: string[]): Promise<string>;
|
|
104
105
|
/**
|
|
105
106
|
* This function decrypts messages using the private key. In addition, the public key can be added for signature verification.
|
|
106
107
|
*
|
|
@@ -132,7 +133,7 @@ export declare class Encryption {
|
|
|
132
133
|
* const resultMessage = await encription.decrypt('message');
|
|
133
134
|
* ```
|
|
134
135
|
*/
|
|
135
|
-
decrypt(message: string, publicKey?: string): Promise<
|
|
136
|
+
decrypt(message: string, publicKey?: string): Promise<Uint8Array>;
|
|
136
137
|
/**
|
|
137
138
|
* This function signs a message using the private key used to initialize the client.
|
|
138
139
|
*
|
|
@@ -258,7 +259,7 @@ export declare class EncryptionUtils {
|
|
|
258
259
|
* This function encrypts a message using the specified public keys.
|
|
259
260
|
*
|
|
260
261
|
* @param {string} message Message to encrypt.
|
|
261
|
-
* @param {string}
|
|
262
|
+
* @param {string} publicKeys Array of public keys to use for encryption.
|
|
262
263
|
* @returns {Promise<string>} Message encrypted.
|
|
263
264
|
*
|
|
264
265
|
* **Code example**
|
|
@@ -294,7 +295,7 @@ export declare class EncryptionUtils {
|
|
|
294
295
|
* const result = await EncriptionUtils.encrypt('message', publicKeys);
|
|
295
296
|
* ```
|
|
296
297
|
*/
|
|
297
|
-
static encrypt(message:
|
|
298
|
+
static encrypt(message: MessageDataType, publicKeys: string[]): Promise<string>;
|
|
298
299
|
/**
|
|
299
300
|
* Verifies if a message appears to be encrypted with OpenPGP.
|
|
300
301
|
*
|
|
@@ -327,4 +328,5 @@ export declare class EncryptionUtils {
|
|
|
327
328
|
*/
|
|
328
329
|
static isEncrypted(message: string): boolean;
|
|
329
330
|
}
|
|
331
|
+
export {};
|
|
330
332
|
//# sourceMappingURL=encryption.d.ts.map
|
package/dist/encryption.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../src/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAqB;IAEvC;;;;OAIG;gBACS,UAAU,EAAE,OAAO,CAAC,UAAU;IAI1C;;;;;;OAMG;WACiB,KAAK,CACvB,iBAAiB,EAAE,MAAM,EACzB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC;IAkBtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACU,cAAc,CACzB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../src/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,KAAK,eAAe,GAAG,MAAM,GAAG,UAAU,CAAC;AAU3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAqB;IAEvC;;;;OAIG;gBACS,UAAU,EAAE,OAAO,CAAC,UAAU;IAI1C;;;;;;OAMG;WACiB,KAAK,CACvB,iBAAiB,EAAE,MAAM,EACzB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC;IAkBtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACU,cAAc,CACzB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,MAAM,CAAC;IAkBlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACU,OAAO,CAClB,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,CAAC;IAoCtB;;;;;;;;;;;;;;;;;OAiBG;IACU,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAYpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,eAAe;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;WACiB,MAAM,CACxB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IAgBnB;;;;;;;;;;;;;OAaG;WACiB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;WACiB,eAAe,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,SAAK,GACd,OAAO,CAAC,QAAQ,CAAC;IAkBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;WACiB,OAAO,CACzB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,MAAM,CAAC;IAiBlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CASpD"}
|
package/dist/encryption.js
CHANGED
|
@@ -15,16 +15,32 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.EncryptionUtils = exports.Encryption = void 0;
|
|
27
37
|
const openpgp = __importStar(require("openpgp"));
|
|
38
|
+
function makeMessageDataBinary(message) {
|
|
39
|
+
if (typeof message === 'string') {
|
|
40
|
+
return Buffer.from(message);
|
|
41
|
+
}
|
|
42
|
+
return message;
|
|
43
|
+
}
|
|
28
44
|
/**
|
|
29
45
|
* ## Introduction
|
|
30
46
|
*
|
|
@@ -139,13 +155,15 @@ class Encryption {
|
|
|
139
155
|
* ```
|
|
140
156
|
*/
|
|
141
157
|
async signAndEncrypt(message, publicKeys) {
|
|
142
|
-
const plaintext = message;
|
|
143
158
|
const pgpPublicKeys = await Promise.all(publicKeys.map((armoredKey) => openpgp.readKey({ armoredKey })));
|
|
144
|
-
const pgpMessage = await openpgp.createMessage({
|
|
159
|
+
const pgpMessage = await openpgp.createMessage({
|
|
160
|
+
binary: makeMessageDataBinary(message),
|
|
161
|
+
});
|
|
145
162
|
const encrypted = await openpgp.encrypt({
|
|
146
163
|
message: pgpMessage,
|
|
147
164
|
encryptionKeys: pgpPublicKeys,
|
|
148
165
|
signingKeys: this.privateKey,
|
|
166
|
+
format: 'armored',
|
|
149
167
|
});
|
|
150
168
|
return encrypted;
|
|
151
169
|
}
|
|
@@ -181,17 +199,33 @@ class Encryption {
|
|
|
181
199
|
* ```
|
|
182
200
|
*/
|
|
183
201
|
async decrypt(message, publicKey) {
|
|
184
|
-
const pgpMessage = await openpgp.readMessage({
|
|
202
|
+
const pgpMessage = await openpgp.readMessage({
|
|
203
|
+
armoredMessage: message,
|
|
204
|
+
});
|
|
185
205
|
const decryptionOptions = {
|
|
186
206
|
message: pgpMessage,
|
|
187
207
|
decryptionKeys: this.privateKey,
|
|
188
|
-
|
|
208
|
+
format: 'binary',
|
|
189
209
|
};
|
|
190
|
-
|
|
210
|
+
const shouldVerifySignature = !!publicKey;
|
|
211
|
+
if (shouldVerifySignature) {
|
|
191
212
|
const pgpPublicKey = await openpgp.readKey({ armoredKey: publicKey });
|
|
192
213
|
decryptionOptions.verificationKeys = pgpPublicKey;
|
|
193
214
|
}
|
|
194
|
-
const { data: decrypted } = await openpgp.decrypt(decryptionOptions);
|
|
215
|
+
const { data: decrypted, signatures } = await openpgp.decrypt(decryptionOptions);
|
|
216
|
+
/**
|
|
217
|
+
* There is an option to automatically verify signatures - `expectSigned`,
|
|
218
|
+
* but atm it has a bug - https://github.com/openpgpjs/openpgpjs/issues/1803,
|
|
219
|
+
* so we have to verify it manually till it's fixed.
|
|
220
|
+
*/
|
|
221
|
+
try {
|
|
222
|
+
if (shouldVerifySignature) {
|
|
223
|
+
await signatures[0].verified;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
throw new Error('Signature could not be verified');
|
|
228
|
+
}
|
|
195
229
|
return decrypted;
|
|
196
230
|
}
|
|
197
231
|
/**
|
|
@@ -367,7 +401,7 @@ class EncryptionUtils {
|
|
|
367
401
|
* This function encrypts a message using the specified public keys.
|
|
368
402
|
*
|
|
369
403
|
* @param {string} message Message to encrypt.
|
|
370
|
-
* @param {string}
|
|
404
|
+
* @param {string} publicKeys Array of public keys to use for encryption.
|
|
371
405
|
* @returns {Promise<string>} Message encrypted.
|
|
372
406
|
*
|
|
373
407
|
* **Code example**
|
|
@@ -404,12 +438,14 @@ class EncryptionUtils {
|
|
|
404
438
|
* ```
|
|
405
439
|
*/
|
|
406
440
|
static async encrypt(message, publicKeys) {
|
|
407
|
-
const plaintext = message;
|
|
408
441
|
const pgpPublicKeys = await Promise.all(publicKeys.map((armoredKey) => openpgp.readKey({ armoredKey })));
|
|
409
|
-
const pgpMessage = await openpgp.createMessage({
|
|
442
|
+
const pgpMessage = await openpgp.createMessage({
|
|
443
|
+
binary: makeMessageDataBinary(message),
|
|
444
|
+
});
|
|
410
445
|
const encrypted = await openpgp.encrypt({
|
|
411
446
|
message: pgpMessage,
|
|
412
447
|
encryptionKeys: pgpPublicKeys,
|
|
448
|
+
format: 'armored',
|
|
413
449
|
});
|
|
414
450
|
return encrypted;
|
|
415
451
|
}
|
package/dist/escrow.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaseEthersClient } from './base';
|
|
|
3
3
|
import { ChainId, OrderDirection } from './enums';
|
|
4
4
|
import { EscrowData, StatusEvent } from './graphql';
|
|
5
5
|
import { IEscrowConfig, IEscrowsFilter } from './interfaces';
|
|
6
|
-
import { EscrowCancel, EscrowStatus, NetworkData } from './types';
|
|
6
|
+
import { EscrowCancel, EscrowStatus, EscrowWithdraw, NetworkData } from './types';
|
|
7
7
|
/**
|
|
8
8
|
* ## Introduction
|
|
9
9
|
*
|
|
@@ -79,7 +79,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
79
79
|
* **EscrowClient constructor**
|
|
80
80
|
*
|
|
81
81
|
* @param {ContractRunner} runner The Runner object to interact with the Ethereum network
|
|
82
|
-
* @param {NetworkData}
|
|
82
|
+
* @param {NetworkData} networkData The network information required to connect to the Escrow contract
|
|
83
83
|
*/
|
|
84
84
|
constructor(runner: ContractRunner, networkData: NetworkData);
|
|
85
85
|
/**
|
|
@@ -169,48 +169,6 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
169
169
|
* ```
|
|
170
170
|
*/
|
|
171
171
|
setup(escrowAddress: string, escrowConfig: IEscrowConfig, txOptions?: Overrides): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* This function creates and sets up an escrow.
|
|
174
|
-
*
|
|
175
|
-
* @param {string} tokenAddress Token address to use for pay outs.
|
|
176
|
-
* @param {string[]} trustedHandlers Array of addresses that can perform actions on the contract.
|
|
177
|
-
* @param {string} jobRequesterId Job Requester Id
|
|
178
|
-
* @param {IEscrowConfig} escrowConfig Configuration object with escrow settings.
|
|
179
|
-
* @returns {Promise<string>} Returns the address of the escrow created.
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* **Code example**
|
|
183
|
-
*
|
|
184
|
-
* ```ts
|
|
185
|
-
* import { ethers, Wallet, providers } from 'ethers';
|
|
186
|
-
* import { EscrowClient } from '@human-protocol/sdk';
|
|
187
|
-
*
|
|
188
|
-
* const rpcUrl = 'YOUR_RPC_URL';
|
|
189
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
190
|
-
*
|
|
191
|
-
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
192
|
-
* const signer = new Wallet(privateKey, provider);
|
|
193
|
-
* const escrowClient = await EscrowClient.build(signer);
|
|
194
|
-
*
|
|
195
|
-
* const tokenAddress = '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4';
|
|
196
|
-
* const trustedHandlers = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
|
|
197
|
-
* const jobRequesterId = "job-requester-id";
|
|
198
|
-
*
|
|
199
|
-
* const escrowConfig = {
|
|
200
|
-
* recordingOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
201
|
-
* reputationOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
202
|
-
* exchangeOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
203
|
-
* recordingOracleFee: bigint.from('10'),
|
|
204
|
-
* reputationOracleFee: bigint.from('10'),
|
|
205
|
-
* exchangeOracleFee: bigint.from('10'),
|
|
206
|
-
* manifestUrl: 'htttp://localhost/manifest.json',
|
|
207
|
-
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
208
|
-
* };
|
|
209
|
-
*
|
|
210
|
-
* const escrowAddress = await escrowClient.createAndSetupEscrow(tokenAddress, trustedHandlers, jobRequesterId, escrowConfig);
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
213
|
-
createAndSetupEscrow(tokenAddress: string, trustedHandlers: string[], jobRequesterId: string, escrowConfig: IEscrowConfig): Promise<string>;
|
|
214
172
|
/**
|
|
215
173
|
* This function adds funds of the chosen token to the escrow.
|
|
216
174
|
*
|
|
@@ -302,6 +260,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
302
260
|
* @param {bigint[]} amounts Array of amounts the recipients will receive.
|
|
303
261
|
* @param {string} finalResultsUrl Final results file url.
|
|
304
262
|
* @param {string} finalResultsHash Final results file hash.
|
|
263
|
+
* @param {string} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false).
|
|
305
264
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
306
265
|
* @returns Returns void if successful. Throws error if any.
|
|
307
266
|
*
|
|
@@ -329,7 +288,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
329
288
|
* await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash);
|
|
330
289
|
* ```
|
|
331
290
|
*/
|
|
332
|
-
bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, txOptions?: Overrides): Promise<void>;
|
|
291
|
+
bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, forceComplete?: boolean, txOptions?: Overrides): Promise<void>;
|
|
333
292
|
/**
|
|
334
293
|
* This function cancels the specified escrow and sends the balance to the canceler.
|
|
335
294
|
*
|
|
@@ -358,9 +317,10 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
358
317
|
*/
|
|
359
318
|
cancel(escrowAddress: string, txOptions?: Overrides): Promise<EscrowCancel>;
|
|
360
319
|
/**
|
|
361
|
-
* This function
|
|
320
|
+
* This function adds an array of addresses to the trusted handlers list.
|
|
362
321
|
*
|
|
363
322
|
* @param {string} escrowAddress Address of the escrow.
|
|
323
|
+
* @param {string[]} trustedHandlers Array of addresses of trusted handlers to add.
|
|
364
324
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
365
325
|
* @returns Returns void if successful. Throws error if any.
|
|
366
326
|
*
|
|
@@ -380,25 +340,26 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
380
340
|
* const signer = new Wallet(privateKey, provider);
|
|
381
341
|
* const escrowClient = await EscrowClient.build(signer);
|
|
382
342
|
*
|
|
383
|
-
*
|
|
343
|
+
* const trustedHandlers = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']
|
|
344
|
+
* await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309f', trustedHandlers);
|
|
384
345
|
* ```
|
|
385
346
|
*/
|
|
386
|
-
|
|
347
|
+
addTrustedHandlers(escrowAddress: string, trustedHandlers: string[], txOptions?: Overrides): Promise<void>;
|
|
387
348
|
/**
|
|
388
|
-
* This function
|
|
349
|
+
* This function withdraws additional tokens in the escrow to the canceler.
|
|
389
350
|
*
|
|
390
|
-
* @param {string} escrowAddress Address of the escrow.
|
|
391
|
-
* @param {string
|
|
351
|
+
* @param {string} escrowAddress Address of the escrow to withdraw.
|
|
352
|
+
* @param {string} tokenAddress Address of the token to withdraw.
|
|
392
353
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
393
|
-
* @returns Returns
|
|
354
|
+
* @returns {EscrowWithdraw} Returns the escrow withdrawal data including transaction hash and withdrawal amount. Throws error if any.
|
|
394
355
|
*
|
|
395
356
|
*
|
|
396
357
|
* **Code example**
|
|
397
358
|
*
|
|
398
|
-
* > Only Job Launcher or trusted handler can call it.
|
|
359
|
+
* > Only Job Launcher or a trusted handler can call it.
|
|
399
360
|
*
|
|
400
361
|
* ```ts
|
|
401
|
-
* import { Wallet, providers } from 'ethers';
|
|
362
|
+
* import { ethers, Wallet, providers } from 'ethers';
|
|
402
363
|
* import { EscrowClient } from '@human-protocol/sdk';
|
|
403
364
|
*
|
|
404
365
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
@@ -408,11 +369,13 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
408
369
|
* const signer = new Wallet(privateKey, provider);
|
|
409
370
|
* const escrowClient = await EscrowClient.build(signer);
|
|
410
371
|
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
372
|
+
* await escrowClient.withdraw(
|
|
373
|
+
* '0x62dD51230A30401C455c8398d06F85e4EaB6309f',
|
|
374
|
+
* '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4'
|
|
375
|
+
* );
|
|
413
376
|
* ```
|
|
414
377
|
*/
|
|
415
|
-
|
|
378
|
+
withdraw(escrowAddress: string, tokenAddress: string, txOptions?: Overrides): Promise<EscrowWithdraw>;
|
|
416
379
|
/**
|
|
417
380
|
* This function returns the balance for a specified escrow address.
|
|
418
381
|
*
|