@human-protocol/sdk 3.0.8 → 4.0.1
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 +4 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +11 -151
- package/dist/decorators.js +1 -1
- package/dist/encryption.d.ts +21 -29
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +17 -29
- package/dist/enums.d.ts +5 -12
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +6 -12
- package/dist/error.d.ts +31 -28
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +36 -33
- package/dist/escrow.d.ts +104 -88
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +192 -131
- package/dist/graphql/queries/operator.d.ts.map +1 -1
- package/dist/graphql/queries/operator.js +15 -5
- package/dist/interfaces.d.ts +12 -2
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +15 -15
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +15 -15
- package/dist/operator.d.ts +11 -10
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +23 -11
- package/dist/staking.d.ts +38 -21
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +62 -21
- package/dist/statistics.d.ts +10 -29
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +18 -37
- package/dist/storage.d.ts +13 -18
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +13 -18
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +3 -5
- package/dist/types.d.ts +6 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +7 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +11 -2
- package/package.json +1 -1
- package/src/constants.ts +11 -174
- package/src/decorators.ts +1 -1
- package/src/encryption.ts +21 -29
- package/src/enums.ts +5 -11
- package/src/error.ts +39 -37
- package/src/escrow.ts +257 -151
- package/src/graphql/queries/operator.ts +15 -5
- package/src/interfaces.ts +13 -2
- package/src/kvstore.ts +16 -16
- package/src/operator.ts +26 -12
- package/src/staking.ts +71 -22
- package/src/statistics.ts +19 -38
- package/src/storage.ts +13 -18
- package/src/transaction.ts +5 -7
- package/src/types.ts +6 -2
- package/src/utils.ts +10 -1
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export declare const DEFAULT_ENDPOINT = "localhost";
|
|
|
5
5
|
export declare const DEFAULT_REGION = "eu";
|
|
6
6
|
export declare const DEFAULT_PORT = 9000;
|
|
7
7
|
export declare const DEFAULT_USE_SSL = false;
|
|
8
|
-
export declare const DEFAULT_TX_ID = 1;
|
|
9
8
|
export declare enum HttpStatus {
|
|
10
9
|
OK = 200,
|
|
11
10
|
CREATED = 201,
|
|
@@ -23,12 +22,15 @@ export declare const KVStoreKeys: {
|
|
|
23
22
|
role: string;
|
|
24
23
|
fee: string;
|
|
25
24
|
publicKey: string;
|
|
25
|
+
publicKeyHash: string;
|
|
26
26
|
webhookUrl: string;
|
|
27
27
|
website: string;
|
|
28
28
|
url: string;
|
|
29
29
|
jobTypes: string;
|
|
30
30
|
registrationNeeded: string;
|
|
31
31
|
registrationInstructions: string;
|
|
32
|
+
name: string;
|
|
33
|
+
category: string;
|
|
32
34
|
};
|
|
33
35
|
export declare const Role: {
|
|
34
36
|
JobLauncher: string;
|
|
@@ -37,4 +39,5 @@ export declare const Role: {
|
|
|
37
39
|
RecordingOracle: string;
|
|
38
40
|
};
|
|
39
41
|
export declare const SUBGRAPH_API_KEY_PLACEHOLDER = "[SUBGRAPH_API_KEY]";
|
|
42
|
+
export declare const ESCROW_BULK_PAYOUT_MAX_ITEMS = 99;
|
|
40
43
|
//# sourceMappingURL=constants.d.ts.map
|
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,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,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CA2GnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAavB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAEjE,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUBGRAPH_API_KEY_PLACEHOLDER = exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.
|
|
3
|
+
exports.ESCROW_BULK_PAYOUT_MAX_ITEMS = exports.SUBGRAPH_API_KEY_PLACEHOLDER = exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.DEFAULT_USE_SSL = exports.DEFAULT_PORT = exports.DEFAULT_REGION = exports.DEFAULT_ENDPOINT = exports.DEFAULT_PUBLIC_BUCKET = void 0;
|
|
4
4
|
const enums_1 = require("./enums");
|
|
5
5
|
exports.DEFAULT_PUBLIC_BUCKET = 'escrow-public-results';
|
|
6
6
|
exports.DEFAULT_ENDPOINT = 'localhost';
|
|
7
7
|
exports.DEFAULT_REGION = 'eu';
|
|
8
8
|
exports.DEFAULT_PORT = 9000;
|
|
9
9
|
exports.DEFAULT_USE_SSL = false;
|
|
10
|
-
exports.DEFAULT_TX_ID = 1;
|
|
11
10
|
var HttpStatus;
|
|
12
11
|
(function (HttpStatus) {
|
|
13
12
|
HttpStatus[HttpStatus["OK"] = 200] = "OK";
|
|
@@ -29,36 +28,10 @@ exports.NETWORKS = {
|
|
|
29
28
|
stakingAddress: '0xEf6Da3aB52c33925Be3F84038193a7e1331F51E6',
|
|
30
29
|
kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
|
|
31
30
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
32
|
-
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/Qmc8ikCj9y2uvYGTeELkM9wybPdcD2PgpW4tjJMwnogLrq',
|
|
33
32
|
oldSubgraphUrl: '',
|
|
34
33
|
oldFactoryAddress: '',
|
|
35
34
|
},
|
|
36
|
-
[enums_1.ChainId.RINKEBY]: {
|
|
37
|
-
chainId: enums_1.ChainId.RINKEBY,
|
|
38
|
-
title: 'Ethereum Rinkeby',
|
|
39
|
-
scanUrl: 'https://rinkeby.etherscan.io',
|
|
40
|
-
factoryAddress: '0x925B24444511c86F4d4E63141D8Be0A025E2dca4',
|
|
41
|
-
hmtAddress: '0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23',
|
|
42
|
-
stakingAddress: '',
|
|
43
|
-
kvstoreAddress: '',
|
|
44
|
-
subgraphUrl: '',
|
|
45
|
-
subgraphUrlApiKey: '',
|
|
46
|
-
oldSubgraphUrl: '',
|
|
47
|
-
oldFactoryAddress: '',
|
|
48
|
-
},
|
|
49
|
-
[enums_1.ChainId.GOERLI]: {
|
|
50
|
-
chainId: enums_1.ChainId.GOERLI,
|
|
51
|
-
title: 'Ethereum Goerli',
|
|
52
|
-
scanUrl: 'https://goerli.etherscan.io',
|
|
53
|
-
factoryAddress: '0x87469B4f2Fcf37cBd34E54244c0BD4Fa0603664c',
|
|
54
|
-
hmtAddress: '0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317',
|
|
55
|
-
stakingAddress: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
|
|
56
|
-
kvstoreAddress: '0x19Fc3e859C1813ac9427a7a78BeB9ae102CE96d3',
|
|
57
|
-
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli-v2',
|
|
58
|
-
subgraphUrlApiKey: '',
|
|
59
|
-
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli',
|
|
60
|
-
oldFactoryAddress: '0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F',
|
|
61
|
-
},
|
|
62
35
|
[enums_1.ChainId.SEPOLIA]: {
|
|
63
36
|
chainId: enums_1.ChainId.SEPOLIA,
|
|
64
37
|
title: 'Ethereum Sepolia',
|
|
@@ -68,7 +41,7 @@ exports.NETWORKS = {
|
|
|
68
41
|
stakingAddress: '0x2163e3A40032Af1C359ac731deaB48258b317890',
|
|
69
42
|
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
70
43
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
71
|
-
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/QmfB1oqYCMTKZB2vcYJzQmGGvVS8cMCHohpYbjKFWoFo8z',
|
|
72
45
|
oldSubgraphUrl: '',
|
|
73
46
|
oldFactoryAddress: '',
|
|
74
47
|
},
|
|
@@ -81,7 +54,7 @@ exports.NETWORKS = {
|
|
|
81
54
|
stakingAddress: '0xE24e5C08E28331D24758b69A5E9f383D2bDD1c98',
|
|
82
55
|
kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
|
|
83
56
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
|
|
84
|
-
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/QmPEaCSuzbVHDrGEWTS7T4N8U7kBMMMfkj4b4ZeqheVuMc',
|
|
85
58
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
86
59
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
87
60
|
},
|
|
@@ -94,7 +67,7 @@ exports.NETWORKS = {
|
|
|
94
67
|
stakingAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
95
68
|
kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
|
|
96
69
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
97
|
-
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/Qmbp8jzcYurrKdk1Mg5ycJ8jcxwou3wWsmNcRdAc16aQEt',
|
|
98
71
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
99
72
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
100
73
|
},
|
|
@@ -107,23 +80,10 @@ exports.NETWORKS = {
|
|
|
107
80
|
stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
|
|
108
81
|
kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
|
|
109
82
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
110
|
-
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/QmeSoEuFieiKXtqzDY3WUBz5gKFWwYVPP7iaebpBpJyo7Y',
|
|
111
84
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
112
85
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
113
86
|
},
|
|
114
|
-
[enums_1.ChainId.POLYGON_MUMBAI]: {
|
|
115
|
-
chainId: enums_1.ChainId.POLYGON_MUMBAI,
|
|
116
|
-
title: 'Polygon Mumbai',
|
|
117
|
-
scanUrl: 'https://mumbai.polygonscan.com',
|
|
118
|
-
factoryAddress: '0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d',
|
|
119
|
-
hmtAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
|
|
120
|
-
stakingAddress: '0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac',
|
|
121
|
-
kvstoreAddress: '0xD96158c7267Ea658a4688F4aEf1c85659851625d',
|
|
122
|
-
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai-v2',
|
|
123
|
-
subgraphUrlApiKey: '',
|
|
124
|
-
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai',
|
|
125
|
-
oldFactoryAddress: '0x558cd800f9F0B02f3B149667bDe003284c867E94',
|
|
126
|
-
},
|
|
127
87
|
[enums_1.ChainId.POLYGON_AMOY]: {
|
|
128
88
|
chainId: enums_1.ChainId.POLYGON_AMOY,
|
|
129
89
|
title: 'Polygon Amoy',
|
|
@@ -133,111 +93,7 @@ exports.NETWORKS = {
|
|
|
133
93
|
stakingAddress: '0xffE496683F842a923110415b7278ded3F265f2C5',
|
|
134
94
|
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
135
95
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
136
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
137
|
-
oldSubgraphUrl: '',
|
|
138
|
-
oldFactoryAddress: '',
|
|
139
|
-
},
|
|
140
|
-
[enums_1.ChainId.MOONBEAM]: {
|
|
141
|
-
chainId: enums_1.ChainId.MOONBEAM,
|
|
142
|
-
title: 'Moonbeam',
|
|
143
|
-
scanUrl: 'https://moonbeam.moonscan.io',
|
|
144
|
-
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
145
|
-
hmtAddress: '0x3b25BC1dC591D24d60560d0135D6750A561D4764',
|
|
146
|
-
stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
|
|
147
|
-
kvstoreAddress: '0x2B95bEcb6EBC4589f64CB000dFCF716b4aeF8aA6',
|
|
148
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/moonbeam/version/latest',
|
|
149
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYe9hsFYuVgQsH719AsqRNqgVM8YBYfCuhBNYjXtBqQru',
|
|
150
|
-
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam',
|
|
151
|
-
oldFactoryAddress: '0x98108c28B7767a52BE38B4860832dd4e11A7ecad',
|
|
152
|
-
},
|
|
153
|
-
[enums_1.ChainId.MOONBASE_ALPHA]: {
|
|
154
|
-
chainId: enums_1.ChainId.MOONBASE_ALPHA,
|
|
155
|
-
title: 'Moonbase Alpha',
|
|
156
|
-
scanUrl: 'https://moonbase.moonscan.io/',
|
|
157
|
-
factoryAddress: '0x5e622FF522D81aa426f082bDD95210BC25fCA7Ed',
|
|
158
|
-
hmtAddress: '0x2dd72db2bBA65cE663e476bA8b84A1aAF802A8e3',
|
|
159
|
-
stakingAddress: '0xbA537fEF2442cD48f60686FE1Bbbe40F964a7940',
|
|
160
|
-
kvstoreAddress: '0xcC561f4482f4Ff051D2Dcc65c2cE1A0f291bbA46',
|
|
161
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/moonbase-alpha/version/latest',
|
|
162
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmSDPbm5xxMvYVSJzHFVsRiMekvJVYSJ7UfZw17DhPMdaH',
|
|
163
|
-
oldSubgraphUrl: '',
|
|
164
|
-
oldFactoryAddress: '',
|
|
165
|
-
},
|
|
166
|
-
[enums_1.ChainId.AVALANCHE_TESTNET]: {
|
|
167
|
-
chainId: enums_1.ChainId.AVALANCHE_TESTNET,
|
|
168
|
-
title: 'Fuji C-Chain',
|
|
169
|
-
scanUrl: 'https://testnet.snowtrace.io',
|
|
170
|
-
factoryAddress: '0x56C2ba540726ED4f46E7a134b6b9Ee9C867FcF92',
|
|
171
|
-
hmtAddress: '0x9406d5c635AD22b0d76c75E52De57A2177919ca3',
|
|
172
|
-
stakingAddress: '0xbA537fEF2442cD48f60686FE1Bbbe40F964a7940',
|
|
173
|
-
kvstoreAddress: '0x3aD4B091E054f192a822D1406f4535eAd38580e4',
|
|
174
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/fuji/version/latest',
|
|
175
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYXwNPwC5DcitK1SLVUR6gPANmEn3UsVvGeTbjCv1tTb2',
|
|
176
|
-
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/fuji',
|
|
177
|
-
oldFactoryAddress: '0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88',
|
|
178
|
-
},
|
|
179
|
-
[enums_1.ChainId.AVALANCHE]: {
|
|
180
|
-
chainId: enums_1.ChainId.AVALANCHE,
|
|
181
|
-
title: 'Avalanche C-Chain Mainnet',
|
|
182
|
-
scanUrl: 'https://snowtrace.io',
|
|
183
|
-
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
184
|
-
hmtAddress: '0x12365293cb6477d4fc2686e46BB97E3Fb64f1550',
|
|
185
|
-
stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
|
|
186
|
-
kvstoreAddress: '0x9Bc7bff35B2Be2413708d48c3B0aEF5c43646728',
|
|
187
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/avalanche/version/latest',
|
|
188
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmYR8NUuAQVoGmGSwKanUJLjX9iZxrEyGH39HjUuXLmsum',
|
|
189
|
-
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/avalanche',
|
|
190
|
-
oldFactoryAddress: '0x9767a578ba7a5FA1563c8229943cB01cd8446BB4',
|
|
191
|
-
},
|
|
192
|
-
[enums_1.ChainId.CELO_ALFAJORES]: {
|
|
193
|
-
chainId: enums_1.ChainId.CELO_ALFAJORES,
|
|
194
|
-
title: 'Celo Alfajores',
|
|
195
|
-
scanUrl: 'https://alfajores.celoscan.io/',
|
|
196
|
-
factoryAddress: '0x86Af9f6Cd34B69Db1B202223C6d6D109f2491569',
|
|
197
|
-
hmtAddress: '0x2736B33455A872dC478E1E004106D04c35472468',
|
|
198
|
-
stakingAddress: '0x003548Df34be8836cF0F9673403a1E40ba449a0F',
|
|
199
|
-
kvstoreAddress: '0x938335006ea6F9Eb0e8020969cFF94404425e298',
|
|
200
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/celo-alfajores/version/latest',
|
|
201
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmb2WKCFFhT7REAjTuMd9pZvGw7rRpzeZSPJ3KRztD2pMM',
|
|
202
|
-
oldSubgraphUrl: '',
|
|
203
|
-
oldFactoryAddress: '',
|
|
204
|
-
},
|
|
205
|
-
[enums_1.ChainId.CELO]: {
|
|
206
|
-
chainId: enums_1.ChainId.CELO,
|
|
207
|
-
title: 'Celo',
|
|
208
|
-
scanUrl: 'https://celoscan.io/',
|
|
209
|
-
factoryAddress: '0xc90B43a5d576D9d8026c48904dfbaED50C15Fa08',
|
|
210
|
-
hmtAddress: '0x19Ead835951493A763c96910255d5eeF147E914F',
|
|
211
|
-
stakingAddress: '0x34cD3Bd6B16c559f321799b516dE61E12017fFd1',
|
|
212
|
-
kvstoreAddress: '0x86Af9f6Cd34B69Db1B202223C6d6D109f2491569',
|
|
213
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/celo/version/latest',
|
|
214
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/Qmeeb5zshw1z9Q38NNPun2Pd7P951Mkzz5ywK171tauNRY',
|
|
215
|
-
oldSubgraphUrl: '',
|
|
216
|
-
oldFactoryAddress: '',
|
|
217
|
-
},
|
|
218
|
-
[enums_1.ChainId.XLAYER]: {
|
|
219
|
-
chainId: enums_1.ChainId.XLAYER,
|
|
220
|
-
title: 'XLayer',
|
|
221
|
-
scanUrl: 'https://www.oklink.com/xlayer',
|
|
222
|
-
factoryAddress: '0x4949C9DFFD83F0D5Ab0AB24C57C4D403D5c20C15',
|
|
223
|
-
hmtAddress: '0x10acbe3b9e6a2ff7f341e5cbf4b6617741ff44aa',
|
|
224
|
-
stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
|
|
225
|
-
kvstoreAddress: '0x6512d894cc3d3FE93Da9d0420430136fA889FaB9',
|
|
226
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/xlayer/version/latest',
|
|
227
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmWTggMrB5sRSs2fePuqQG9WbLMk8HtnfLH3VbRhmVdF8s',
|
|
228
|
-
oldSubgraphUrl: '',
|
|
229
|
-
oldFactoryAddress: '',
|
|
230
|
-
},
|
|
231
|
-
[enums_1.ChainId.XLAYER_TESTNET]: {
|
|
232
|
-
chainId: enums_1.ChainId.XLAYER_TESTNET,
|
|
233
|
-
title: 'XLayer Testnet',
|
|
234
|
-
scanUrl: 'https://www.okx.com/explorer/xlayer-test',
|
|
235
|
-
factoryAddress: '0x6Cd3ecAD36ee88E9ef3665CF381D9dAE0FE0a32e',
|
|
236
|
-
hmtAddress: '0x792abbcC99c01dbDec49c9fa9A828a186Da45C33',
|
|
237
|
-
stakingAddress: '0xeF9849a904dF0d494D69ac0B0a6860a3A7936114',
|
|
238
|
-
kvstoreAddress: '0xdE8BE9E3C12E9F546309A429cd88d026a25EaF8C',
|
|
239
|
-
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/xlayer-testnet/version/latest',
|
|
240
|
-
subgraphUrlApiKey: 'https://gateway-testnet-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmNoRyqZtJTRrkbKAmWMZQUHuah7YSs8U9R3nzPu8WEhtY',
|
|
96
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQUUv8SK2skarDrJpB8LXXqMwjzxg3Z42dx12uEL5Pmeq',
|
|
241
97
|
oldSubgraphUrl: '',
|
|
242
98
|
oldFactoryAddress: '',
|
|
243
99
|
},
|
|
@@ -259,12 +115,15 @@ exports.KVStoreKeys = {
|
|
|
259
115
|
role: 'role',
|
|
260
116
|
fee: 'fee',
|
|
261
117
|
publicKey: 'public_key',
|
|
118
|
+
publicKeyHash: 'public_key_hash',
|
|
262
119
|
webhookUrl: 'webhook_url',
|
|
263
120
|
website: 'website',
|
|
264
121
|
url: 'url',
|
|
265
122
|
jobTypes: 'job_types',
|
|
266
123
|
registrationNeeded: 'registration_needed',
|
|
267
124
|
registrationInstructions: 'registration_instructions',
|
|
125
|
+
name: 'name',
|
|
126
|
+
category: 'category',
|
|
268
127
|
};
|
|
269
128
|
exports.Role = {
|
|
270
129
|
JobLauncher: 'Job Launcher',
|
|
@@ -273,3 +132,4 @@ exports.Role = {
|
|
|
273
132
|
RecordingOracle: 'Recording Oracle',
|
|
274
133
|
};
|
|
275
134
|
exports.SUBGRAPH_API_KEY_PLACEHOLDER = '[SUBGRAPH_API_KEY]';
|
|
135
|
+
exports.ESCROW_BULK_PAYOUT_MAX_ITEMS = 99;
|
package/dist/decorators.js
CHANGED
package/dist/encryption.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as openpgp from 'openpgp';
|
|
2
2
|
import { IKeyPair } from './interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Type representing the data type of a message.
|
|
5
|
+
* It can be either a string or a Uint8Array.
|
|
6
|
+
*/
|
|
3
7
|
type MessageDataType = string | Uint8Array;
|
|
4
8
|
/**
|
|
5
9
|
* ## Introduction
|
|
@@ -38,7 +42,7 @@ type MessageDataType = string | Uint8Array;
|
|
|
38
42
|
*
|
|
39
43
|
* const privateKey = 'Armored_priv_key';
|
|
40
44
|
* const passphrase = 'example_passphrase';
|
|
41
|
-
* const
|
|
45
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
42
46
|
* ```
|
|
43
47
|
*/
|
|
44
48
|
export declare class Encryption {
|
|
@@ -60,7 +64,7 @@ export declare class Encryption {
|
|
|
60
64
|
/**
|
|
61
65
|
* This function signs and encrypts a message using the private key used to initialize the client and the specified public keys.
|
|
62
66
|
*
|
|
63
|
-
* @param {
|
|
67
|
+
* @param {MessageDataType} message Message to sign and encrypt.
|
|
64
68
|
* @param {string[]} publicKeys Array of public keys to use for encryption.
|
|
65
69
|
* @returns {Promise<string>} Message signed and encrypted.
|
|
66
70
|
*
|
|
@@ -72,7 +76,7 @@ export declare class Encryption {
|
|
|
72
76
|
*
|
|
73
77
|
* const privateKey = 'Armored_priv_key';
|
|
74
78
|
* const passphrase = 'example_passphrase';
|
|
75
|
-
* const
|
|
79
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
76
80
|
* const publicKey1 = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
77
81
|
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
78
82
|
* WYxJQn3vo1/NFEh1bWFuIDxodW1hbkBobXQuYWk+wowEEBYKAD4FAmSkBDME
|
|
@@ -98,7 +102,7 @@ export declare class Encryption {
|
|
|
98
102
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
99
103
|
*
|
|
100
104
|
* const publicKeys = [publicKey1, publicKey2];
|
|
101
|
-
* const resultMessage = await
|
|
105
|
+
* const resultMessage = await encryption.signAndEncrypt('message', publicKeys);
|
|
102
106
|
* ```
|
|
103
107
|
*/
|
|
104
108
|
signAndEncrypt(message: MessageDataType, publicKeys: string[]): Promise<string>;
|
|
@@ -107,7 +111,7 @@ export declare class Encryption {
|
|
|
107
111
|
*
|
|
108
112
|
* @param {string} message Message to decrypt.
|
|
109
113
|
* @param {string} publicKey Public key used to verify signature if needed. This is optional.
|
|
110
|
-
* @returns {Promise<
|
|
114
|
+
* @returns {Promise<Uint8Array>} Message decrypted.
|
|
111
115
|
*
|
|
112
116
|
* **Code example**
|
|
113
117
|
*
|
|
@@ -116,7 +120,7 @@ export declare class Encryption {
|
|
|
116
120
|
*
|
|
117
121
|
* const privateKey = 'Armored_priv_key';
|
|
118
122
|
* const passphrase = 'example_passphrase';
|
|
119
|
-
* const
|
|
123
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
120
124
|
*
|
|
121
125
|
* const publicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
122
126
|
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
@@ -130,7 +134,7 @@ export declare class Encryption {
|
|
|
130
134
|
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
131
135
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
132
136
|
*
|
|
133
|
-
* const resultMessage = await
|
|
137
|
+
* const resultMessage = await encryption.decrypt('message');
|
|
134
138
|
* ```
|
|
135
139
|
*/
|
|
136
140
|
decrypt(message: string, publicKey?: string): Promise<Uint8Array>;
|
|
@@ -147,9 +151,9 @@ export declare class Encryption {
|
|
|
147
151
|
*
|
|
148
152
|
* const privateKey = 'Armored_priv_key';
|
|
149
153
|
* const passphrase = 'example_passphrase';
|
|
150
|
-
* const
|
|
154
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
151
155
|
*
|
|
152
|
-
* const resultMessage = await
|
|
156
|
+
* const resultMessage = await encryption.sign('message');
|
|
153
157
|
* ```
|
|
154
158
|
*/
|
|
155
159
|
sign(message: string): Promise<string>;
|
|
@@ -184,7 +188,7 @@ export declare class EncryptionUtils {
|
|
|
184
188
|
* This function verifies the signature of a signed message using the public key.
|
|
185
189
|
*
|
|
186
190
|
* @param {string} message Message to verify.
|
|
187
|
-
* @param {string} publicKey Public key to verify that the message was
|
|
191
|
+
* @param {string} publicKey Public key to verify that the message was signed by a specific source.
|
|
188
192
|
* @returns {Promise<boolean>} True if verified. False if not verified.
|
|
189
193
|
*
|
|
190
194
|
* **Code example**
|
|
@@ -204,7 +208,7 @@ export declare class EncryptionUtils {
|
|
|
204
208
|
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
205
209
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
206
210
|
*
|
|
207
|
-
* const result = await
|
|
211
|
+
* const result = await EncryptionUtils.verify('message', publicKey);
|
|
208
212
|
* ```
|
|
209
213
|
*/
|
|
210
214
|
static verify(message: string, publicKey: string): Promise<boolean>;
|
|
@@ -219,7 +223,7 @@ export declare class EncryptionUtils {
|
|
|
219
223
|
* ```ts
|
|
220
224
|
* import { EncryptionUtils } from '@human-protocol/sdk';
|
|
221
225
|
*
|
|
222
|
-
* const signedData = await
|
|
226
|
+
* const signedData = await EncryptionUtils.getSignedData('message');
|
|
223
227
|
* ```
|
|
224
228
|
*/
|
|
225
229
|
static getSignedData(message: string): Promise<string>;
|
|
@@ -236,30 +240,18 @@ export declare class EncryptionUtils {
|
|
|
236
240
|
* ```ts
|
|
237
241
|
* import { EncryptionUtils } from '@human-protocol/sdk';
|
|
238
242
|
*
|
|
239
|
-
* const publicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
240
|
-
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
241
|
-
* WYxJQn3vo1/NFEh1bWFuIDxodW1hbkBobXQuYWk+wowEEBYKAD4FAmSkBDME
|
|
242
|
-
* CwkHCAkQJBFPuuhtQo4DFQgKBBYAAgECGQECGwMCHgEWIQTQ5fbVPB9CWIdf
|
|
243
|
-
* XdYkEU+66G1CjgAAKYYA/jMyDCtJtqu6hj22kq9SW6fuV1FCT2ySJ9vBhumF
|
|
244
|
-
* X8wWAP433zVFl4VECOkgGk8qFr8BgkYxaz16GOFAqYbfO6oMBc44BGSkBDMS
|
|
245
|
-
* CisGAQQBl1UBBQEBB0AKR+A48zVVYZWQvgu7Opn2IGvzI9jePB/J8pzqRhg2
|
|
246
|
-
* YAMBCAfCeAQYFggAKgUCZKQEMwkQJBFPuuhtQo4CGwwWIQTQ5fbVPB9CWIdf
|
|
247
|
-
* XdYkEU+66G1CjgAA0xgBAK4AIahFFnmWR2Mp6A3q021cZXpGklc0Xw1Hfswc
|
|
248
|
-
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
249
|
-
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
250
|
-
*
|
|
251
243
|
* const name = 'YOUR_NAME';
|
|
252
244
|
* const email = 'YOUR_EMAIL';
|
|
253
245
|
* const passphrase = 'YOUR_PASSPHRASE';
|
|
254
|
-
* const result = await
|
|
246
|
+
* const result = await EncryptionUtils.generateKeyPair(name, email, passphrase);
|
|
255
247
|
* ```
|
|
256
248
|
*/
|
|
257
249
|
static generateKeyPair(name: string, email: string, passphrase?: string): Promise<IKeyPair>;
|
|
258
250
|
/**
|
|
259
251
|
* This function encrypts a message using the specified public keys.
|
|
260
252
|
*
|
|
261
|
-
* @param {
|
|
262
|
-
* @param {string} publicKeys Array of public keys to use for encryption.
|
|
253
|
+
* @param {MessageDataType} message Message to encrypt.
|
|
254
|
+
* @param {string[]} publicKeys Array of public keys to use for encryption.
|
|
263
255
|
* @returns {Promise<string>} Message encrypted.
|
|
264
256
|
*
|
|
265
257
|
* **Code example**
|
|
@@ -292,7 +284,7 @@ export declare class EncryptionUtils {
|
|
|
292
284
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
293
285
|
*
|
|
294
286
|
* const publicKeys = [publicKey1, publicKey2]
|
|
295
|
-
* const result = await
|
|
287
|
+
* const result = await EncryptionUtils.encrypt('message', publicKeys);
|
|
296
288
|
* ```
|
|
297
289
|
*/
|
|
298
290
|
static encrypt(message: MessageDataType, publicKeys: string[]): Promise<string>;
|
|
@@ -317,7 +309,7 @@ export declare class EncryptionUtils {
|
|
|
317
309
|
* =tsmI
|
|
318
310
|
* -----END PGP MESSAGE-----`;
|
|
319
311
|
*
|
|
320
|
-
* const isEncrypted = await
|
|
312
|
+
* const isEncrypted = await EncryptionUtils.isEncrypted(message);
|
|
321
313
|
*
|
|
322
314
|
* if (isEncrypted) {
|
|
323
315
|
* console.log('The message is encrypted with OpenPGP.');
|
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,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
|
|
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;;;GAGG;AACH,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;;;;;;;;;;;;;;;;;;OAkBG;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
|
@@ -78,7 +78,7 @@ function makeMessageDataBinary(message) {
|
|
|
78
78
|
*
|
|
79
79
|
* const privateKey = 'Armored_priv_key';
|
|
80
80
|
* const passphrase = 'example_passphrase';
|
|
81
|
-
* const
|
|
81
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
84
84
|
class Encryption {
|
|
@@ -113,7 +113,7 @@ class Encryption {
|
|
|
113
113
|
/**
|
|
114
114
|
* This function signs and encrypts a message using the private key used to initialize the client and the specified public keys.
|
|
115
115
|
*
|
|
116
|
-
* @param {
|
|
116
|
+
* @param {MessageDataType} message Message to sign and encrypt.
|
|
117
117
|
* @param {string[]} publicKeys Array of public keys to use for encryption.
|
|
118
118
|
* @returns {Promise<string>} Message signed and encrypted.
|
|
119
119
|
*
|
|
@@ -125,7 +125,7 @@ class Encryption {
|
|
|
125
125
|
*
|
|
126
126
|
* const privateKey = 'Armored_priv_key';
|
|
127
127
|
* const passphrase = 'example_passphrase';
|
|
128
|
-
* const
|
|
128
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
129
129
|
* const publicKey1 = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
130
130
|
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
131
131
|
* WYxJQn3vo1/NFEh1bWFuIDxodW1hbkBobXQuYWk+wowEEBYKAD4FAmSkBDME
|
|
@@ -151,7 +151,7 @@ class Encryption {
|
|
|
151
151
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
152
152
|
*
|
|
153
153
|
* const publicKeys = [publicKey1, publicKey2];
|
|
154
|
-
* const resultMessage = await
|
|
154
|
+
* const resultMessage = await encryption.signAndEncrypt('message', publicKeys);
|
|
155
155
|
* ```
|
|
156
156
|
*/
|
|
157
157
|
async signAndEncrypt(message, publicKeys) {
|
|
@@ -172,7 +172,7 @@ class Encryption {
|
|
|
172
172
|
*
|
|
173
173
|
* @param {string} message Message to decrypt.
|
|
174
174
|
* @param {string} publicKey Public key used to verify signature if needed. This is optional.
|
|
175
|
-
* @returns {Promise<
|
|
175
|
+
* @returns {Promise<Uint8Array>} Message decrypted.
|
|
176
176
|
*
|
|
177
177
|
* **Code example**
|
|
178
178
|
*
|
|
@@ -181,7 +181,7 @@ class Encryption {
|
|
|
181
181
|
*
|
|
182
182
|
* const privateKey = 'Armored_priv_key';
|
|
183
183
|
* const passphrase = 'example_passphrase';
|
|
184
|
-
* const
|
|
184
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
185
185
|
*
|
|
186
186
|
* const publicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
187
187
|
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
@@ -195,7 +195,7 @@ class Encryption {
|
|
|
195
195
|
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
196
196
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
197
197
|
*
|
|
198
|
-
* const resultMessage = await
|
|
198
|
+
* const resultMessage = await encryption.decrypt('message');
|
|
199
199
|
* ```
|
|
200
200
|
*/
|
|
201
201
|
async decrypt(message, publicKey) {
|
|
@@ -241,9 +241,9 @@ class Encryption {
|
|
|
241
241
|
*
|
|
242
242
|
* const privateKey = 'Armored_priv_key';
|
|
243
243
|
* const passphrase = 'example_passphrase';
|
|
244
|
-
* const
|
|
244
|
+
* const encryption = await Encryption.build(privateKey, passphrase);
|
|
245
245
|
*
|
|
246
|
-
* const resultMessage = await
|
|
246
|
+
* const resultMessage = await encryption.sign('message');
|
|
247
247
|
* ```
|
|
248
248
|
*/
|
|
249
249
|
async sign(message) {
|
|
@@ -289,7 +289,7 @@ class EncryptionUtils {
|
|
|
289
289
|
* This function verifies the signature of a signed message using the public key.
|
|
290
290
|
*
|
|
291
291
|
* @param {string} message Message to verify.
|
|
292
|
-
* @param {string} publicKey Public key to verify that the message was
|
|
292
|
+
* @param {string} publicKey Public key to verify that the message was signed by a specific source.
|
|
293
293
|
* @returns {Promise<boolean>} True if verified. False if not verified.
|
|
294
294
|
*
|
|
295
295
|
* **Code example**
|
|
@@ -309,7 +309,7 @@ class EncryptionUtils {
|
|
|
309
309
|
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
310
310
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
311
311
|
*
|
|
312
|
-
* const result = await
|
|
312
|
+
* const result = await EncryptionUtils.verify('message', publicKey);
|
|
313
313
|
* ```
|
|
314
314
|
*/
|
|
315
315
|
static async verify(message, publicKey) {
|
|
@@ -337,7 +337,7 @@ class EncryptionUtils {
|
|
|
337
337
|
* ```ts
|
|
338
338
|
* import { EncryptionUtils } from '@human-protocol/sdk';
|
|
339
339
|
*
|
|
340
|
-
* const signedData = await
|
|
340
|
+
* const signedData = await EncryptionUtils.getSignedData('message');
|
|
341
341
|
* ```
|
|
342
342
|
*/
|
|
343
343
|
static async getSignedData(message) {
|
|
@@ -364,22 +364,10 @@ class EncryptionUtils {
|
|
|
364
364
|
* ```ts
|
|
365
365
|
* import { EncryptionUtils } from '@human-protocol/sdk';
|
|
366
366
|
*
|
|
367
|
-
* const publicKey = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
368
|
-
* xjMEZKQEMxYJKwYBBAHaRw8BAQdA5oZTq4UPlS0IXn4kEaSqQdAa9+Cq522v
|
|
369
|
-
* WYxJQn3vo1/NFEh1bWFuIDxodW1hbkBobXQuYWk+wowEEBYKAD4FAmSkBDME
|
|
370
|
-
* CwkHCAkQJBFPuuhtQo4DFQgKBBYAAgECGQECGwMCHgEWIQTQ5fbVPB9CWIdf
|
|
371
|
-
* XdYkEU+66G1CjgAAKYYA/jMyDCtJtqu6hj22kq9SW6fuV1FCT2ySJ9vBhumF
|
|
372
|
-
* X8wWAP433zVFl4VECOkgGk8qFr8BgkYxaz16GOFAqYbfO6oMBc44BGSkBDMS
|
|
373
|
-
* CisGAQQBl1UBBQEBB0AKR+A48zVVYZWQvgu7Opn2IGvzI9jePB/J8pzqRhg2
|
|
374
|
-
* YAMBCAfCeAQYFggAKgUCZKQEMwkQJBFPuuhtQo4CGwwWIQTQ5fbVPB9CWIdf
|
|
375
|
-
* XdYkEU+66G1CjgAA0xgBAK4AIahFFnmWR2Mp6A3q021cZXpGklc0Xw1Hfswc
|
|
376
|
-
* UYLqAQDfdym4kiUvKO1+REKASt0Gwykndl7hra9txqlUL5DXBQ===Vwgv
|
|
377
|
-
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
378
|
-
*
|
|
379
367
|
* const name = 'YOUR_NAME';
|
|
380
368
|
* const email = 'YOUR_EMAIL';
|
|
381
369
|
* const passphrase = 'YOUR_PASSPHRASE';
|
|
382
|
-
* const result = await
|
|
370
|
+
* const result = await EncryptionUtils.generateKeyPair(name, email, passphrase);
|
|
383
371
|
* ```
|
|
384
372
|
*/
|
|
385
373
|
static async generateKeyPair(name, email, passphrase = '') {
|
|
@@ -400,8 +388,8 @@ class EncryptionUtils {
|
|
|
400
388
|
/**
|
|
401
389
|
* This function encrypts a message using the specified public keys.
|
|
402
390
|
*
|
|
403
|
-
* @param {
|
|
404
|
-
* @param {string} publicKeys Array of public keys to use for encryption.
|
|
391
|
+
* @param {MessageDataType} message Message to encrypt.
|
|
392
|
+
* @param {string[]} publicKeys Array of public keys to use for encryption.
|
|
405
393
|
* @returns {Promise<string>} Message encrypted.
|
|
406
394
|
*
|
|
407
395
|
* **Code example**
|
|
@@ -434,7 +422,7 @@ class EncryptionUtils {
|
|
|
434
422
|
* -----END PGP PUBLIC KEY BLOCK-----`;
|
|
435
423
|
*
|
|
436
424
|
* const publicKeys = [publicKey1, publicKey2]
|
|
437
|
-
* const result = await
|
|
425
|
+
* const result = await EncryptionUtils.encrypt('message', publicKeys);
|
|
438
426
|
* ```
|
|
439
427
|
*/
|
|
440
428
|
static async encrypt(message, publicKeys) {
|
|
@@ -470,7 +458,7 @@ class EncryptionUtils {
|
|
|
470
458
|
* =tsmI
|
|
471
459
|
* -----END PGP MESSAGE-----`;
|
|
472
460
|
*
|
|
473
|
-
* const isEncrypted = await
|
|
461
|
+
* const isEncrypted = await EncryptionUtils.isEncrypted(message);
|
|
474
462
|
*
|
|
475
463
|
* if (isEncrypted) {
|
|
476
464
|
* console.log('The message is encrypted with OpenPGP.');
|
package/dist/enums.d.ts
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
export declare enum ChainId {
|
|
2
2
|
ALL = -1,
|
|
3
3
|
MAINNET = 1,
|
|
4
|
-
RINKEBY = 4,
|
|
5
|
-
GOERLI = 5,
|
|
6
4
|
SEPOLIA = 11155111,
|
|
7
5
|
BSC_MAINNET = 56,
|
|
8
6
|
BSC_TESTNET = 97,
|
|
9
7
|
POLYGON = 137,
|
|
10
|
-
POLYGON_MUMBAI = 80001,
|
|
11
8
|
POLYGON_AMOY = 80002,
|
|
12
|
-
|
|
13
|
-
MOONBASE_ALPHA = 1287,
|
|
14
|
-
AVALANCHE_TESTNET = 43113,
|
|
15
|
-
AVALANCHE = 43114,
|
|
16
|
-
CELO = 42220,
|
|
17
|
-
CELO_ALFAJORES = 44787,
|
|
18
|
-
XLAYER_TESTNET = 195,
|
|
19
|
-
LOCALHOST = 1338,
|
|
20
|
-
XLAYER = 196
|
|
9
|
+
LOCALHOST = 1338
|
|
21
10
|
}
|
|
22
11
|
export declare enum OrderDirection {
|
|
23
12
|
ASC = "asc",
|
|
24
13
|
DESC = "desc"
|
|
25
14
|
}
|
|
15
|
+
export declare enum LeaderCategory {
|
|
16
|
+
MACHINE_LEARNING = "machine_learning",
|
|
17
|
+
MARKET_MAKING = "market_making"
|
|
18
|
+
}
|
|
26
19
|
//# sourceMappingURL=enums.d.ts.map
|
package/dist/enums.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,KAAK;IACR,OAAO,IAAI;IACX,OAAO,
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,KAAK;IACR,OAAO,IAAI;IACX,OAAO,WAAW;IAClB,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,YAAY,QAAQ;IACpB,SAAS,OAAO;CACjB;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,oBAAY,cAAc;IACxB,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;CAChC"}
|