@human-protocol/sdk 1.1.2 → 1.1.5
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/README.md +1 -1
- package/dist/constants.d.ts +46 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +203 -0
- package/dist/decorators.d.ts +2 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/decorators.js +17 -0
- package/dist/enums.d.ts +17 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +20 -0
- package/dist/error.d.ts +196 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +229 -0
- package/dist/escrow.d.ts +184 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +614 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/init.d.ts +13 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +35 -0
- package/dist/interfaces.d.ts +44 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +2 -0
- package/dist/kvstore.d.ts +40 -0
- package/dist/kvstore.d.ts.map +1 -0
- package/dist/kvstore.js +106 -0
- package/dist/queries.d.ts +4 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +22 -0
- package/dist/staking.d.ts +121 -0
- package/dist/staking.d.ts.map +1 -0
- package/dist/staking.js +381 -0
- package/dist/storage.d.ts +48 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +165 -0
- package/dist/types.d.ts +123 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +35 -0
- package/dist/utils.d.ts +32 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +99 -0
- package/package.json +7 -7
- package/src/constants.ts +221 -4
- package/src/decorators.ts +21 -0
- package/src/enums.ts +16 -0
- package/src/error.ts +295 -18
- package/src/escrow.ts +785 -0
- package/src/index.ts +14 -1
- package/src/init.ts +45 -0
- package/src/interfaces.ts +50 -0
- package/src/kvstore.ts +93 -0
- package/src/queries.ts +18 -0
- package/src/staking.ts +422 -0
- package/src/storage.ts +160 -131
- package/src/types.ts +36 -586
- package/src/utils.ts +80 -143
- package/example/simple-existing-job.ts +0 -86
- package/example/simple-new-job-public.ts +0 -74
- package/example/simple-new-job.ts +0 -72
- package/src/job.ts +0 -1067
- package/src/logger.ts +0 -29
- package/test/job.test.ts +0 -817
- package/test/utils/constants.ts +0 -30
- package/test/utils/manifest.ts +0 -33
package/README.md
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ChainId } from './enums';
|
|
2
|
+
import { NetworkData } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @constant Default public bucket name
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_PUBLIC_BUCKET = "escrow-public-results";
|
|
7
|
+
/**
|
|
8
|
+
* @constant Default storage endpoint
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_ENDPOINT = "localhost";
|
|
11
|
+
/**
|
|
12
|
+
* @constant Default storage region
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_REGION = "eu";
|
|
15
|
+
/**
|
|
16
|
+
* @constant Default storage port
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_PORT = 9000;
|
|
19
|
+
/**
|
|
20
|
+
* @constant Default storage port
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_USE_SSL = false;
|
|
23
|
+
/**
|
|
24
|
+
* @constant Default tx Id
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_TX_ID = 1;
|
|
27
|
+
/**
|
|
28
|
+
* @constant Default Enum for escrow statuses.
|
|
29
|
+
*/
|
|
30
|
+
export declare enum HttpStatus {
|
|
31
|
+
OK = 200,
|
|
32
|
+
CREATED = 201,
|
|
33
|
+
BAD_REQUEST = 400,
|
|
34
|
+
UNAUTHORIZED = 401,
|
|
35
|
+
PAYMENT_REQUIRED = 402,
|
|
36
|
+
FORBIDDEN = 403,
|
|
37
|
+
NOT_FOUND = 404,
|
|
38
|
+
INTERNAL_SERVER_ERROR = 500
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @constant Default network parameters
|
|
42
|
+
*/
|
|
43
|
+
export declare const NETWORKS: {
|
|
44
|
+
[chainId in ChainId]?: NetworkData;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B;;GAEG;AACH,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CA8KnC,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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
|
+
const enums_1 = require("./enums");
|
|
5
|
+
/**
|
|
6
|
+
* @constant Default public bucket name
|
|
7
|
+
*/
|
|
8
|
+
exports.DEFAULT_PUBLIC_BUCKET = 'escrow-public-results';
|
|
9
|
+
/**
|
|
10
|
+
* @constant Default storage endpoint
|
|
11
|
+
*/
|
|
12
|
+
exports.DEFAULT_ENDPOINT = 'localhost';
|
|
13
|
+
/**
|
|
14
|
+
* @constant Default storage region
|
|
15
|
+
*/
|
|
16
|
+
exports.DEFAULT_REGION = 'eu';
|
|
17
|
+
/**
|
|
18
|
+
* @constant Default storage port
|
|
19
|
+
*/
|
|
20
|
+
exports.DEFAULT_PORT = 9000;
|
|
21
|
+
/**
|
|
22
|
+
* @constant Default storage port
|
|
23
|
+
*/
|
|
24
|
+
exports.DEFAULT_USE_SSL = false;
|
|
25
|
+
/**
|
|
26
|
+
* @constant Default tx Id
|
|
27
|
+
*/
|
|
28
|
+
exports.DEFAULT_TX_ID = 1;
|
|
29
|
+
/**
|
|
30
|
+
* @constant Default Enum for escrow statuses.
|
|
31
|
+
*/
|
|
32
|
+
var HttpStatus;
|
|
33
|
+
(function (HttpStatus) {
|
|
34
|
+
HttpStatus[HttpStatus["OK"] = 200] = "OK";
|
|
35
|
+
HttpStatus[HttpStatus["CREATED"] = 201] = "CREATED";
|
|
36
|
+
HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
37
|
+
HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
38
|
+
HttpStatus[HttpStatus["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
39
|
+
HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
40
|
+
HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
41
|
+
HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
42
|
+
})(HttpStatus = exports.HttpStatus || (exports.HttpStatus = {}));
|
|
43
|
+
/**
|
|
44
|
+
* @constant Default network parameters
|
|
45
|
+
*/
|
|
46
|
+
exports.NETWORKS = {
|
|
47
|
+
[enums_1.ChainId.MAINNET]: {
|
|
48
|
+
chainId: enums_1.ChainId.MAINNET,
|
|
49
|
+
title: 'Ethereum',
|
|
50
|
+
scanUrl: 'https://etherscan.io',
|
|
51
|
+
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
52
|
+
hmtAddress: '0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867',
|
|
53
|
+
stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
|
|
54
|
+
kvstoreAddress: '0x70671167176C4934204B1C7e97F5e86695857ef2',
|
|
55
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mainnet-v1',
|
|
56
|
+
oldSubgraphUrl: '',
|
|
57
|
+
oldFactoryAddress: '',
|
|
58
|
+
},
|
|
59
|
+
[enums_1.ChainId.RINKEBY]: {
|
|
60
|
+
chainId: enums_1.ChainId.RINKEBY,
|
|
61
|
+
title: 'Ethereum Rinkeby',
|
|
62
|
+
scanUrl: 'https://rinkeby.etherscan.io',
|
|
63
|
+
factoryAddress: '0x925B24444511c86F4d4E63141D8Be0A025E2dca4',
|
|
64
|
+
hmtAddress: '0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23',
|
|
65
|
+
stakingAddress: '',
|
|
66
|
+
kvstoreAddress: '',
|
|
67
|
+
subgraphUrl: '',
|
|
68
|
+
oldSubgraphUrl: '',
|
|
69
|
+
oldFactoryAddress: '',
|
|
70
|
+
},
|
|
71
|
+
[enums_1.ChainId.GOERLI]: {
|
|
72
|
+
chainId: enums_1.ChainId.GOERLI,
|
|
73
|
+
title: 'Ethereum Goerli',
|
|
74
|
+
scanUrl: 'https://goerli.etherscan.io',
|
|
75
|
+
factoryAddress: '0x87469B4f2Fcf37cBd34E54244c0BD4Fa0603664c',
|
|
76
|
+
hmtAddress: '0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317',
|
|
77
|
+
stakingAddress: '0xf46B45Df3d956369726d8Bd93Ba33963Ab692920',
|
|
78
|
+
kvstoreAddress: '0xc9Fe39c4b6e1d7A2991355Af159956982DADf842',
|
|
79
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli-v1',
|
|
80
|
+
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/goerli',
|
|
81
|
+
oldFactoryAddress: '0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F',
|
|
82
|
+
},
|
|
83
|
+
[enums_1.ChainId.BSC_MAINNET]: {
|
|
84
|
+
chainId: enums_1.ChainId.BSC_MAINNET,
|
|
85
|
+
title: 'Binance Smart Chain',
|
|
86
|
+
scanUrl: 'https://bscscan.com',
|
|
87
|
+
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
88
|
+
hmtAddress: '0x0d501B743F22b641B8C8dfe00F1AAb881D57DDC7',
|
|
89
|
+
stakingAddress: '0xC2163A0928034e020f0d31e1171Ba0D6d9AfFB6c',
|
|
90
|
+
kvstoreAddress: '0x70671167176C4934204B1C7e97F5e86695857ef2',
|
|
91
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc-v1',
|
|
92
|
+
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
93
|
+
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
94
|
+
},
|
|
95
|
+
[enums_1.ChainId.BSC_TESTNET]: {
|
|
96
|
+
chainId: enums_1.ChainId.BSC_TESTNET,
|
|
97
|
+
title: 'Binance Smart Chain (Testnet)',
|
|
98
|
+
scanUrl: 'https://testnet.bscscan.com',
|
|
99
|
+
factoryAddress: '0x2bfA592DBDaF434DDcbb893B1916120d181DAD18',
|
|
100
|
+
hmtAddress: '0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d',
|
|
101
|
+
stakingAddress: '0x5517fE916Fe9F8dB15B0DDc76ebDf0BdDCd4ed18',
|
|
102
|
+
kvstoreAddress: '0x3aD4B091E054f192a822D1406f4535eAd38580e4',
|
|
103
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest-v1',
|
|
104
|
+
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
105
|
+
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
106
|
+
},
|
|
107
|
+
[enums_1.ChainId.POLYGON]: {
|
|
108
|
+
chainId: enums_1.ChainId.POLYGON,
|
|
109
|
+
title: 'Polygon',
|
|
110
|
+
scanUrl: 'https://polygonscan.com',
|
|
111
|
+
factoryAddress: '0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB',
|
|
112
|
+
hmtAddress: '0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF',
|
|
113
|
+
stakingAddress: '0xcbAd56bE3f504E98bd70875823d3CC0242B7bB29',
|
|
114
|
+
kvstoreAddress: '0x35Cf4beBD58F9C8D75B9eA2599479b6C173d406F',
|
|
115
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon-v1',
|
|
116
|
+
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
117
|
+
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
118
|
+
},
|
|
119
|
+
[enums_1.ChainId.POLYGON_MUMBAI]: {
|
|
120
|
+
chainId: enums_1.ChainId.POLYGON_MUMBAI,
|
|
121
|
+
title: 'Polygon Mumbai',
|
|
122
|
+
scanUrl: 'https://mumbai.polygonscan.com',
|
|
123
|
+
factoryAddress: '0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d',
|
|
124
|
+
hmtAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
|
|
125
|
+
stakingAddress: '0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac',
|
|
126
|
+
kvstoreAddress: '0xD7F61E812e139a5a02eDae9Dfec146E1b8eA3807',
|
|
127
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai-v1',
|
|
128
|
+
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai',
|
|
129
|
+
oldFactoryAddress: '0x558cd800f9F0B02f3B149667bDe003284c867E94',
|
|
130
|
+
},
|
|
131
|
+
[enums_1.ChainId.MOONBEAM]: {
|
|
132
|
+
chainId: enums_1.ChainId.MOONBEAM,
|
|
133
|
+
title: 'Moonbeam',
|
|
134
|
+
scanUrl: 'https://moonbeam.moonscan.io',
|
|
135
|
+
factoryAddress: '0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a',
|
|
136
|
+
hmtAddress: '0x3b25BC1dC591D24d60560d0135D6750A561D4764',
|
|
137
|
+
stakingAddress: '0x05398211bA2046E296fBc9a9D3EB49e3F15C3123',
|
|
138
|
+
kvstoreAddress: '0x70671167176C4934204B1C7e97F5e86695857ef2',
|
|
139
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam-v1',
|
|
140
|
+
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam',
|
|
141
|
+
oldFactoryAddress: '0x98108c28B7767a52BE38B4860832dd4e11A7ecad',
|
|
142
|
+
},
|
|
143
|
+
[enums_1.ChainId.MOONBASE_ALPHA]: {
|
|
144
|
+
chainId: enums_1.ChainId.MOONBASE_ALPHA,
|
|
145
|
+
title: 'Moonbase Alpha',
|
|
146
|
+
scanUrl: 'https://moonbase.moonscan.io/',
|
|
147
|
+
factoryAddress: '0x5e622FF522D81aa426f082bDD95210BC25fCA7Ed',
|
|
148
|
+
hmtAddress: '0x2dd72db2bBA65cE663e476bA8b84A1aAF802A8e3',
|
|
149
|
+
stakingAddress: '0xBFC7009F3371F93F3B54DdC8caCd02914a37495c',
|
|
150
|
+
kvstoreAddress: '0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d',
|
|
151
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/moonbase-alpha-v1',
|
|
152
|
+
oldSubgraphUrl: '',
|
|
153
|
+
oldFactoryAddress: '',
|
|
154
|
+
},
|
|
155
|
+
[enums_1.ChainId.AVALANCHE_TESTNET]: {
|
|
156
|
+
chainId: enums_1.ChainId.AVALANCHE_TESTNET,
|
|
157
|
+
title: 'Fuji C-Chain',
|
|
158
|
+
scanUrl: 'https://testnet.snowtrace.io',
|
|
159
|
+
factoryAddress: '0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88',
|
|
160
|
+
hmtAddress: '0x9406d5c635AD22b0d76c75E52De57A2177919ca3',
|
|
161
|
+
stakingAddress: '',
|
|
162
|
+
kvstoreAddress: '0xd232c1426CF0653cE8a71DC98bCfDf10c471c114',
|
|
163
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/fuji',
|
|
164
|
+
oldSubgraphUrl: '',
|
|
165
|
+
oldFactoryAddress: '',
|
|
166
|
+
},
|
|
167
|
+
[enums_1.ChainId.AVALANCHE]: {
|
|
168
|
+
chainId: enums_1.ChainId.AVALANCHE,
|
|
169
|
+
title: 'Avalanche C-Chain Mainnet',
|
|
170
|
+
scanUrl: 'https://snowtrace.io',
|
|
171
|
+
factoryAddress: '0x9767a578ba7a5FA1563c8229943cB01cd8446BB4',
|
|
172
|
+
hmtAddress: '0x12365293cb6477d4fc2686e46BB97E3Fb64f1550',
|
|
173
|
+
stakingAddress: '',
|
|
174
|
+
kvstoreAddress: '0x4B79eaD28F52eD5686bf0e379717e85fc7aD10Df',
|
|
175
|
+
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/avalanche',
|
|
176
|
+
oldSubgraphUrl: '',
|
|
177
|
+
oldFactoryAddress: '',
|
|
178
|
+
},
|
|
179
|
+
[enums_1.ChainId.SKALE]: {
|
|
180
|
+
chainId: enums_1.ChainId.SKALE,
|
|
181
|
+
title: 'SKALE Human Protocol Chain',
|
|
182
|
+
scanUrl: 'https://wan-red-ain.explorer.mainnet.skalenodes.com/',
|
|
183
|
+
factoryAddress: '0x319070b49C8d1cC015915D1E7Eb5fd8e22833885',
|
|
184
|
+
hmtAddress: '0x6E5FF61Ea88270F6142E0E0eC8cbe9d67476CbCd',
|
|
185
|
+
stakingAddress: '0x79F37FB9C210910733c16228AC4D14a8e32C11BD',
|
|
186
|
+
kvstoreAddress: '0xE1055607327b1be2080D31211dCDC4D9338CaF4A',
|
|
187
|
+
subgraphUrl: 'https://graph-skale.humanprotocol.org/subgraphs/name/skale-human',
|
|
188
|
+
oldSubgraphUrl: '',
|
|
189
|
+
oldFactoryAddress: '0x27B423cE73d1dBdB48d2dd351398b5Ce8223117c',
|
|
190
|
+
},
|
|
191
|
+
[enums_1.ChainId.LOCALHOST]: {
|
|
192
|
+
chainId: enums_1.ChainId.LOCALHOST,
|
|
193
|
+
title: 'Localhost',
|
|
194
|
+
scanUrl: '',
|
|
195
|
+
factoryAddress: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
|
|
196
|
+
hmtAddress: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
|
|
197
|
+
stakingAddress: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
|
|
198
|
+
kvstoreAddress: '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707',
|
|
199
|
+
subgraphUrl: '',
|
|
200
|
+
oldSubgraphUrl: '',
|
|
201
|
+
oldFactoryAddress: '',
|
|
202
|
+
},
|
|
203
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,CAC5B,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,sBAa/B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requiresSigner = void 0;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
+
const ethers_1 = require("ethers");
|
|
6
|
+
const error_1 = require("./error");
|
|
7
|
+
function requiresSigner(target, propertyKey, descriptor) {
|
|
8
|
+
const originalMethod = descriptor.value;
|
|
9
|
+
descriptor.value = async function (...args) {
|
|
10
|
+
if (!ethers_1.Signer.isSigner(this.signerOrProvider)) {
|
|
11
|
+
throw error_1.ErrorSigner;
|
|
12
|
+
}
|
|
13
|
+
return originalMethod.apply(this, args);
|
|
14
|
+
};
|
|
15
|
+
return descriptor;
|
|
16
|
+
}
|
|
17
|
+
exports.requiresSigner = requiresSigner;
|
package/dist/enums.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum ChainId {
|
|
2
|
+
ALL = -1,
|
|
3
|
+
MAINNET = 1,
|
|
4
|
+
RINKEBY = 4,
|
|
5
|
+
GOERLI = 5,
|
|
6
|
+
BSC_MAINNET = 56,
|
|
7
|
+
BSC_TESTNET = 97,
|
|
8
|
+
POLYGON = 137,
|
|
9
|
+
POLYGON_MUMBAI = 80001,
|
|
10
|
+
MOONBEAM = 1284,
|
|
11
|
+
MOONBASE_ALPHA = 1287,
|
|
12
|
+
AVALANCHE_TESTNET = 43113,
|
|
13
|
+
AVALANCHE = 43114,
|
|
14
|
+
SKALE = 1273227453,
|
|
15
|
+
LOCALHOST = 1338
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,GAAG,KAAK;IACR,OAAO,IAAI;IACX,OAAO,IAAI;IACX,MAAM,IAAI;IACV,WAAW,KAAK;IAChB,WAAW,KAAK;IAChB,OAAO,MAAM;IACb,cAAc,QAAQ;IACtB,QAAQ,OAAO;IACf,cAAc,OAAO;IACrB,iBAAiB,QAAQ;IACzB,SAAS,QAAQ;IACjB,KAAK,aAAa;IAClB,SAAS,OAAO;CACjB"}
|
package/dist/enums.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChainId = void 0;
|
|
4
|
+
var ChainId;
|
|
5
|
+
(function (ChainId) {
|
|
6
|
+
ChainId[ChainId["ALL"] = -1] = "ALL";
|
|
7
|
+
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
|
|
8
|
+
ChainId[ChainId["RINKEBY"] = 4] = "RINKEBY";
|
|
9
|
+
ChainId[ChainId["GOERLI"] = 5] = "GOERLI";
|
|
10
|
+
ChainId[ChainId["BSC_MAINNET"] = 56] = "BSC_MAINNET";
|
|
11
|
+
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET";
|
|
12
|
+
ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
|
|
13
|
+
ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI";
|
|
14
|
+
ChainId[ChainId["MOONBEAM"] = 1284] = "MOONBEAM";
|
|
15
|
+
ChainId[ChainId["MOONBASE_ALPHA"] = 1287] = "MOONBASE_ALPHA";
|
|
16
|
+
ChainId[ChainId["AVALANCHE_TESTNET"] = 43113] = "AVALANCHE_TESTNET";
|
|
17
|
+
ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE";
|
|
18
|
+
ChainId[ChainId["SKALE"] = 1273227453] = "SKALE";
|
|
19
|
+
ChainId[ChainId["LOCALHOST"] = 1338] = "LOCALHOST";
|
|
20
|
+
})(ChainId = exports.ChainId || (exports.ChainId = {}));
|
package/dist/error.d.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @constant {Error} - The Staking contract is missing.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ErrorStakingMissing: Error;
|
|
5
|
+
/**
|
|
6
|
+
* @constant {Error} - The Storage client not initialised.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ErrorStorageClientNotInitialized: Error;
|
|
9
|
+
/**
|
|
10
|
+
* @constant {Error} - The Storage does not exists.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ErrorStorageClientNotExists: Error;
|
|
13
|
+
/**
|
|
14
|
+
* @constant {Error} - The Storage credentials is missing.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ErrorStorageCredentialsMissing: Error;
|
|
17
|
+
/**
|
|
18
|
+
* @constant {Error} - The Storage bucket not found.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ErrorStorageBucketNotFound: Error;
|
|
21
|
+
/**
|
|
22
|
+
* @constant {Error} - The Storage file not found.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ErrorStorageFileNotFound: Error;
|
|
25
|
+
/**
|
|
26
|
+
* @constant {Error} - The Storage file not uploaded.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ErrorStorageFileNotUploaded: Error;
|
|
29
|
+
/**
|
|
30
|
+
* @constant {Error} - The KVStore key can not be empty.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ErrorKVStoreEmptyKey: Error;
|
|
33
|
+
/**
|
|
34
|
+
* @constant {Error} - The KVStore arrays must have the same length.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ErrorKVStoreArrayLength: Error;
|
|
37
|
+
/**
|
|
38
|
+
* @constant {Error} - The Address sent is invalid.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ErrorInvalidAddress: Error;
|
|
41
|
+
/**
|
|
42
|
+
* @constant {Error} - The token address sent is invalid.
|
|
43
|
+
*/
|
|
44
|
+
export declare const ErrorInvalidTokenAddress: Error;
|
|
45
|
+
/**
|
|
46
|
+
* @constant {Error} - Invalid recording oracle address provided.
|
|
47
|
+
*/
|
|
48
|
+
export declare const ErrorInvalidRecordingOracleAddressProvided: Error;
|
|
49
|
+
/**
|
|
50
|
+
* @constant {Error} - Invalid reputation oracle address provided.
|
|
51
|
+
*/
|
|
52
|
+
export declare const ErrorInvalidReputationOracleAddressProvided: Error;
|
|
53
|
+
/**
|
|
54
|
+
* @constant {Error} - The Staking value must be positive.
|
|
55
|
+
*/
|
|
56
|
+
export declare const ErrorStakingValueMustBePositive: Error;
|
|
57
|
+
/**
|
|
58
|
+
* @constant {Error} - Invalid staking value: amount must be a BigNumber.
|
|
59
|
+
*/
|
|
60
|
+
export declare const ErrorInvalidStakingValueType: Error;
|
|
61
|
+
/**
|
|
62
|
+
* @constant {Error} - Invalid staking value: amount must be positive.
|
|
63
|
+
*/
|
|
64
|
+
export declare const ErrorInvalidStakingValueSign: Error;
|
|
65
|
+
/**
|
|
66
|
+
* @constant {Error} - Invalid slasher address provided.
|
|
67
|
+
*/
|
|
68
|
+
export declare const ErrorInvalidSlasherAddressProvided: Error;
|
|
69
|
+
/**
|
|
70
|
+
* @constant {Error} - Invalid staker address provided.
|
|
71
|
+
*/
|
|
72
|
+
export declare const ErrorInvalidStakerAddressProvided: Error;
|
|
73
|
+
/**
|
|
74
|
+
* @constant {Error} - Invalid escrow address provided.
|
|
75
|
+
*/
|
|
76
|
+
export declare const ErrorInvalidEscrowAddressProvided: Error;
|
|
77
|
+
/**
|
|
78
|
+
* @constant {Error} - Error getting stakers data.
|
|
79
|
+
*/
|
|
80
|
+
export declare const ErrorStakingGetStakers: Error;
|
|
81
|
+
/**
|
|
82
|
+
* @constant {Error} - Failed to approve staking amount: signerOrProvider is not a Signer instance.
|
|
83
|
+
*/
|
|
84
|
+
export declare const ErrorFailedToApproveStakingAmountSignerDoesNotExist: Error;
|
|
85
|
+
export declare const ErrorFailedToCheckAllowance: Error;
|
|
86
|
+
/**
|
|
87
|
+
* @constant {Error} - The HMToken amount not approved.
|
|
88
|
+
*/
|
|
89
|
+
export declare const ErrorHMTokenAmountNotApproved: Error;
|
|
90
|
+
/**
|
|
91
|
+
* @constant {Error} - Init provider does not exists.
|
|
92
|
+
*/
|
|
93
|
+
export declare const ErrorInitProviderDoesNotExist: Error;
|
|
94
|
+
/**
|
|
95
|
+
* @constant {Error} - Init with unsupported chain ID.
|
|
96
|
+
*/
|
|
97
|
+
export declare const ErrorInitUnsupportedChainID: Error;
|
|
98
|
+
/**
|
|
99
|
+
* @constant {Error} - Sending a transaction requires a signer.
|
|
100
|
+
*/
|
|
101
|
+
export declare const ErrorSigner: Error;
|
|
102
|
+
/**
|
|
103
|
+
* @constant {Error} - Escrow address is not provided by the factory.
|
|
104
|
+
*/
|
|
105
|
+
export declare const ErrorEscrowAddressIsNotProvidedByFactory: Error;
|
|
106
|
+
/**
|
|
107
|
+
* @constant {Error} - Manifest file does not exist.
|
|
108
|
+
*/
|
|
109
|
+
export declare const ErrorManifestFileDoesNotExist: Error;
|
|
110
|
+
/**
|
|
111
|
+
* @constant {Error} - Storage client does not exist.
|
|
112
|
+
*/
|
|
113
|
+
export declare const ErrorStorageClientDoesNotExist: Error;
|
|
114
|
+
/**
|
|
115
|
+
* @constant {Error} - Invalid URL string.
|
|
116
|
+
*/
|
|
117
|
+
export declare const ErrorInvalidUrl: Error;
|
|
118
|
+
/**
|
|
119
|
+
* @constant {Error} - URL is an empty string.
|
|
120
|
+
*/
|
|
121
|
+
export declare const ErrorUrlIsEmptyString: Error;
|
|
122
|
+
/**
|
|
123
|
+
* @constant {Error} - List of handlers cannot be empty.
|
|
124
|
+
*/
|
|
125
|
+
export declare const ErrorListOfHandlersCannotBeEmpty: Error;
|
|
126
|
+
/**
|
|
127
|
+
* @constant {Error} - No URL provided.
|
|
128
|
+
*/
|
|
129
|
+
export declare const ErrorNoURLprovided: Error;
|
|
130
|
+
/**
|
|
131
|
+
* @constant {Error} - Fee must be between 0 and 100.
|
|
132
|
+
*/
|
|
133
|
+
export declare const ErrorFeeMustBeBetweenZeroAndHundred: Error;
|
|
134
|
+
/**
|
|
135
|
+
* @constant {Error} - Total fee must be less than 100.
|
|
136
|
+
*/
|
|
137
|
+
export declare const ErrorTotalFeeMustBeLessThanHundred: Error;
|
|
138
|
+
/**
|
|
139
|
+
* @constant {Error} - Recipient cannot be an empty array.
|
|
140
|
+
*/
|
|
141
|
+
export declare const ErrorRecipientCannotBeEmptyArray: Error;
|
|
142
|
+
/**
|
|
143
|
+
* @constant {Error} - Amount must be greater than zero..
|
|
144
|
+
*/
|
|
145
|
+
export declare const ErrorAmountMustBeGreaterThanZero: Error;
|
|
146
|
+
/**
|
|
147
|
+
* @constant {Error} - Escrow does not have enough balance.
|
|
148
|
+
*/
|
|
149
|
+
export declare const ErrorEscrowDoesNotHaveEnoughBalance: Error;
|
|
150
|
+
/**
|
|
151
|
+
* @constant {Error} - Amounts cannot be an empty array.
|
|
152
|
+
*/
|
|
153
|
+
export declare const ErrorAmountsCannotBeEmptyArray: Error;
|
|
154
|
+
/**
|
|
155
|
+
* @constant {Error} - Recipient and amounts must be the same length.
|
|
156
|
+
*/
|
|
157
|
+
export declare const ErrorRecipientAndAmountsMustBeSameLength: Error;
|
|
158
|
+
/**
|
|
159
|
+
* @constant {Error} - Launched event is not emitted.
|
|
160
|
+
*/
|
|
161
|
+
export declare const ErrorLaunchedEventIsNotEmitted: Error;
|
|
162
|
+
/**
|
|
163
|
+
* @constant {Error} - Hash is an empty string.
|
|
164
|
+
*/
|
|
165
|
+
export declare const ErrorHashIsEmptyString: Error;
|
|
166
|
+
export declare class EthereumError extends Error {
|
|
167
|
+
constructor(message: string);
|
|
168
|
+
}
|
|
169
|
+
export declare class InvalidArgumentError extends EthereumError {
|
|
170
|
+
constructor(message: string);
|
|
171
|
+
}
|
|
172
|
+
export declare class OutOfGasError extends EthereumError {
|
|
173
|
+
constructor(message: string);
|
|
174
|
+
}
|
|
175
|
+
export declare class UnpredictableGasLimit extends EthereumError {
|
|
176
|
+
constructor(message: string);
|
|
177
|
+
}
|
|
178
|
+
export declare class ReplacementUnderpriced extends EthereumError {
|
|
179
|
+
constructor(message: string);
|
|
180
|
+
}
|
|
181
|
+
export declare class NumericFault extends EthereumError {
|
|
182
|
+
constructor(message: string);
|
|
183
|
+
}
|
|
184
|
+
export declare class NonceExpired extends EthereumError {
|
|
185
|
+
constructor(message: string);
|
|
186
|
+
}
|
|
187
|
+
export declare class TransactionReplaced extends EthereumError {
|
|
188
|
+
constructor(message: string);
|
|
189
|
+
}
|
|
190
|
+
export declare class ContractExecutionError extends EthereumError {
|
|
191
|
+
constructor(reason: string);
|
|
192
|
+
}
|
|
193
|
+
export declare class InvalidEthereumAddressError extends Error {
|
|
194
|
+
constructor(address: string);
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"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"}
|