@0xweb/hardhat 0.1.20 → 0.1.24
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/.github/workflows/npm-publish.yml +30 -0
- package/hardhat.config.sample.js +32 -32
- package/lib/index.js +231 -211
- package/package.json +117 -117
- package/readme.md +101 -101
- package/tsconfig.json +19 -19
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- 'release'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-test-publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
id-token: write
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v3
|
|
19
|
+
- uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: 20
|
|
22
|
+
registry-url: 'https://registry.npmjs.org'
|
|
23
|
+
cache: npm
|
|
24
|
+
|
|
25
|
+
- run: npm ci
|
|
26
|
+
- run: npm run build
|
|
27
|
+
- run: npm test
|
|
28
|
+
- run: npm publish --provenance --access public
|
|
29
|
+
env:
|
|
30
|
+
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
package/hardhat.config.sample.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
require("@nomiclabs/hardhat-web3");
|
|
2
|
-
require("@nomiclabs/hardhat-waffle");
|
|
3
|
-
require("@nomiclabs/hardhat-etherscan");
|
|
4
|
-
require("@0xweb/hardhat");
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
solidity: {
|
|
8
|
-
version: "0.8.2",
|
|
9
|
-
settings: {
|
|
10
|
-
optimizer: {
|
|
11
|
-
enabled: true,
|
|
12
|
-
runs: 200
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
networks: {
|
|
17
|
-
hardhat: {
|
|
18
|
-
chainId: 1337
|
|
19
|
-
},
|
|
20
|
-
localhost: {
|
|
21
|
-
chainId: 1337
|
|
22
|
-
},
|
|
23
|
-
mainnet: {
|
|
24
|
-
url: ``,
|
|
25
|
-
accounts: [``]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
etherscan: {
|
|
29
|
-
// One at https://etherscan.io/
|
|
30
|
-
apiKey: ""
|
|
31
|
-
}
|
|
32
|
-
};
|
|
1
|
+
require("@nomiclabs/hardhat-web3");
|
|
2
|
+
require("@nomiclabs/hardhat-waffle");
|
|
3
|
+
require("@nomiclabs/hardhat-etherscan");
|
|
4
|
+
require("@0xweb/hardhat");
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
solidity: {
|
|
8
|
+
version: "0.8.2",
|
|
9
|
+
settings: {
|
|
10
|
+
optimizer: {
|
|
11
|
+
enabled: true,
|
|
12
|
+
runs: 200
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
networks: {
|
|
17
|
+
hardhat: {
|
|
18
|
+
chainId: 1337
|
|
19
|
+
},
|
|
20
|
+
localhost: {
|
|
21
|
+
chainId: 1337
|
|
22
|
+
},
|
|
23
|
+
mainnet: {
|
|
24
|
+
url: ``,
|
|
25
|
+
accounts: [``]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
etherscan: {
|
|
29
|
+
// One at https://etherscan.io/
|
|
30
|
+
apiKey: ""
|
|
31
|
+
}
|
|
32
|
+
};
|
package/lib/index.js
CHANGED
|
@@ -14,18 +14,18 @@ var _src_config;
|
|
|
14
14
|
var exports = _src_config != null ? _src_config : {};
|
|
15
15
|
var module = { exports: exports };
|
|
16
16
|
|
|
17
|
-
"use strict";
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.resolveConfig = void 0;
|
|
20
|
-
function resolveConfig(config) {
|
|
21
|
-
var _a;
|
|
22
|
-
const defaultConfig = {};
|
|
23
|
-
return {
|
|
24
|
-
...defaultConfig,
|
|
25
|
-
...((_a = config['0xweb']) !== null && _a !== void 0 ? _a : {}),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
exports.resolveConfig = resolveConfig;
|
|
17
|
+
"use strict";
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.resolveConfig = void 0;
|
|
20
|
+
function resolveConfig(config) {
|
|
21
|
+
var _a;
|
|
22
|
+
const defaultConfig = {};
|
|
23
|
+
return {
|
|
24
|
+
...defaultConfig,
|
|
25
|
+
...((_a = config['0xweb']) !== null && _a !== void 0 ? _a : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.resolveConfig = resolveConfig;
|
|
29
29
|
//# sourceMappingURL=config.js.map
|
|
30
30
|
//# sourceMappingURL=config.ts.map;
|
|
31
31
|
|
|
@@ -54,11 +54,11 @@ var _src_constants;
|
|
|
54
54
|
var exports = _src_constants != null ? _src_constants : {};
|
|
55
55
|
var module = { exports: exports };
|
|
56
56
|
|
|
57
|
-
"use strict";
|
|
58
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.TASK_0xWEB_GENERATE = exports.TASK_0xWEB = void 0;
|
|
60
|
-
exports.TASK_0xWEB = '0xweb';
|
|
61
|
-
exports.TASK_0xWEB_GENERATE = '0xweb:generate';
|
|
57
|
+
"use strict";
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.TASK_0xWEB_GENERATE = exports.TASK_0xWEB = void 0;
|
|
60
|
+
exports.TASK_0xWEB = '0xweb';
|
|
61
|
+
exports.TASK_0xWEB_GENERATE = '0xweb:generate';
|
|
62
62
|
//# sourceMappingURL=constants.js.map
|
|
63
63
|
//# sourceMappingURL=constants.ts.map;
|
|
64
64
|
|
|
@@ -87,25 +87,25 @@ var _src_utils__path;
|
|
|
87
87
|
var exports = _src_utils__path != null ? _src_utils__path : {};
|
|
88
88
|
var module = { exports: exports };
|
|
89
89
|
|
|
90
|
-
"use strict";
|
|
91
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
92
|
-
exports.$path = void 0;
|
|
93
|
-
const pathUtil = require("path");
|
|
94
|
-
var $path;
|
|
95
|
-
(function ($path) {
|
|
96
|
-
function resolve(path) {
|
|
97
|
-
if (path.startsWith('file:')) {
|
|
98
|
-
path = path.replace(/^file:\/\//g, '');
|
|
99
|
-
return path;
|
|
100
|
-
}
|
|
101
|
-
return pathUtil.join(process.cwd(), path);
|
|
102
|
-
}
|
|
103
|
-
$path.resolve = resolve;
|
|
104
|
-
function join(...paths) {
|
|
105
|
-
return pathUtil.join(...paths);
|
|
106
|
-
}
|
|
107
|
-
$path.join = join;
|
|
108
|
-
})($path = exports.$path || (exports.$path = {}));
|
|
90
|
+
"use strict";
|
|
91
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
92
|
+
exports.$path = void 0;
|
|
93
|
+
const pathUtil = require("path");
|
|
94
|
+
var $path;
|
|
95
|
+
(function ($path) {
|
|
96
|
+
function resolve(path) {
|
|
97
|
+
if (path.startsWith('file:')) {
|
|
98
|
+
path = path.replace(/^file:\/\//g, '');
|
|
99
|
+
return path;
|
|
100
|
+
}
|
|
101
|
+
return pathUtil.join(process.cwd(), path);
|
|
102
|
+
}
|
|
103
|
+
$path.resolve = resolve;
|
|
104
|
+
function join(...paths) {
|
|
105
|
+
return pathUtil.join(...paths).replace(/\\/g, '/');
|
|
106
|
+
}
|
|
107
|
+
$path.join = join;
|
|
108
|
+
})($path = exports.$path || (exports.$path = {}));
|
|
109
109
|
//# sourceMappingURL=$path.js.map
|
|
110
110
|
//# sourceMappingURL=$path.ts.map;
|
|
111
111
|
|
|
@@ -125,181 +125,201 @@ var $path;
|
|
|
125
125
|
|
|
126
126
|
// end:source ./ModuleSimplified.js
|
|
127
127
|
|
|
128
|
-
"use strict";
|
|
129
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
130
|
-
const alot_1 = require("alot");
|
|
131
|
-
const atma_io_1 = require("atma-io");
|
|
132
|
-
const _0xweb_1 = require("0xweb");
|
|
133
|
-
const task_names_1 = require("hardhat/builtin-tasks/task-names");
|
|
134
|
-
const config_1 = require("hardhat/config");
|
|
135
|
-
const config_2 = _src_config;
|
|
136
|
-
const constants_1 = _src_constants;
|
|
137
|
-
const _path_1 = _src_utils__path;
|
|
138
|
-
const taskArgsStore = { compileAll: false };
|
|
139
|
-
(0, config_1.extendConfig)((config) => {
|
|
140
|
-
config['0xweb'] = (0, config_2.resolveConfig)(config);
|
|
141
|
-
});
|
|
142
|
-
(0, config_1.task)(task_names_1.TASK_COMPILE, 'Compiles the entire project, building all artifacts')
|
|
143
|
-
.addOptionalParam('sources', 'Override the sources directory')
|
|
144
|
-
.addOptionalParam('artifacts', 'Override the artifacts output directory')
|
|
145
|
-
.addOptionalParam('root', 'Overrides root directory. If sources is also overridden must be the sub-folder of the sources dir')
|
|
146
|
-
.addOptionalParam('package', 'Compile the contracts within a specific mono-repo package. Artifacts and 0xc classes will be placed in the package directory')
|
|
147
|
-
.addOptionalParam('tsgen', 'Skip the TypeScript class generation', true, config_1.types.boolean)
|
|
148
|
-
.addFlag('watch', 'Watch sources directory and reruns compilation task on changes')
|
|
149
|
-
.setAction(async (compilationArgs, { run, config, artifacts }, runSuper) => {
|
|
150
|
-
ConfigHelper.resetPaths(config.paths);
|
|
151
|
-
if (compilationArgs.tsgen === false) {
|
|
152
|
-
config['0xweb'].tsgen = false;
|
|
153
|
-
}
|
|
154
|
-
if (compilationArgs.package != null) {
|
|
155
|
-
config['0xweb'].package = compilationArgs.package;
|
|
156
|
-
if (compilationArgs.artifacts == null) {
|
|
157
|
-
compilationArgs.artifacts = _path_1.$path.join(compilationArgs.package, 'artifacts');
|
|
158
|
-
}
|
|
159
|
-
if (compilationArgs.sources == null) {
|
|
160
|
-
compilationArgs.sources = _path_1.$path.join(compilationArgs.package, 'contracts');
|
|
161
|
-
}
|
|
162
|
-
config.paths.cache = _path_1.$path.join(compilationArgs.package, 'cache');
|
|
163
|
-
}
|
|
164
|
-
// Re-set Artifacts Path manually, as Hardhat initializes the Artifacts Instance before this task runs.
|
|
165
|
-
// Other paths (sources, cache) will be resolved later by hardhat from config
|
|
166
|
-
const artifactsInstance = artifacts;
|
|
167
|
-
if (artifactsInstance._artifactsPath == null) {
|
|
168
|
-
console.error(`Artifacts Internal interface was changed. Trying to set private _artifactsPath, but it doesn't exist.`);
|
|
169
|
-
}
|
|
170
|
-
// Clean artifacts from previous compile
|
|
171
|
-
artifactsInstance._validArtifacts = [];
|
|
172
|
-
artifactsInstance._artifactsPath = config.paths.artifacts;
|
|
173
|
-
let { sources: sourcesDir, artifacts: artifactsDir, root: rootDir } = compilationArgs;
|
|
174
|
-
if (rootDir != null) {
|
|
175
|
-
rootDir = _path_1.$path.resolve(rootDir);
|
|
176
|
-
if (sourcesDir == null) {
|
|
177
|
-
sourcesDir = `file://${_path_1.$path.join(rootDir, 'contracts')}`;
|
|
178
|
-
}
|
|
179
|
-
if (artifactsDir == null) {
|
|
180
|
-
artifactsDir = `file://${_path_1.$path.join(rootDir, 'artifacts')}`;
|
|
181
|
-
}
|
|
182
|
-
config.paths.root = rootDir;
|
|
183
|
-
config.paths.cache = _path_1.$path.join(rootDir, 'cache');
|
|
184
|
-
}
|
|
185
|
-
if (sourcesDir) {
|
|
186
|
-
sourcesDir = _path_1.$path.resolve(sourcesDir);
|
|
187
|
-
config.paths.sources = sourcesDir;
|
|
188
|
-
}
|
|
189
|
-
if (artifactsDir) {
|
|
190
|
-
artifactsDir = _path_1.$path.resolve(artifactsDir);
|
|
191
|
-
config.paths.artifacts = artifactsDir;
|
|
192
|
-
artifactsInstance._artifactsPath = artifactsDir;
|
|
193
|
-
}
|
|
194
|
-
if (compilationArgs.watch) {
|
|
195
|
-
const directory = `file://${config.paths.sources}/`;
|
|
196
|
-
atma_io_1.Directory.watch(directory, async (...args) => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
.
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
128
|
+
"use strict";
|
|
129
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
130
|
+
const alot_1 = require("alot");
|
|
131
|
+
const atma_io_1 = require("atma-io");
|
|
132
|
+
const _0xweb_1 = require("0xweb");
|
|
133
|
+
const task_names_1 = require("hardhat/builtin-tasks/task-names");
|
|
134
|
+
const config_1 = require("hardhat/config");
|
|
135
|
+
const config_2 = _src_config;
|
|
136
|
+
const constants_1 = _src_constants;
|
|
137
|
+
const _path_1 = _src_utils__path;
|
|
138
|
+
const taskArgsStore = { compileAll: false };
|
|
139
|
+
(0, config_1.extendConfig)((config) => {
|
|
140
|
+
config['0xweb'] = (0, config_2.resolveConfig)(config);
|
|
141
|
+
});
|
|
142
|
+
(0, config_1.task)(task_names_1.TASK_COMPILE, 'Compiles the entire project, building all artifacts')
|
|
143
|
+
.addOptionalParam('sources', 'Override the sources directory')
|
|
144
|
+
.addOptionalParam('artifacts', 'Override the artifacts output directory')
|
|
145
|
+
.addOptionalParam('root', 'Overrides root directory. If sources is also overridden must be the sub-folder of the sources dir')
|
|
146
|
+
.addOptionalParam('package', 'Compile the contracts within a specific mono-repo package. Artifacts and 0xc classes will be placed in the package directory')
|
|
147
|
+
.addOptionalParam('tsgen', 'Skip the TypeScript class generation', true, config_1.types.boolean)
|
|
148
|
+
.addFlag('watch', 'Watch sources directory and reruns compilation task on changes')
|
|
149
|
+
.setAction(async (compilationArgs, { run, config, artifacts }, runSuper) => {
|
|
150
|
+
ConfigHelper.resetPaths(config.paths);
|
|
151
|
+
if (compilationArgs.tsgen === false) {
|
|
152
|
+
config['0xweb'].tsgen = false;
|
|
153
|
+
}
|
|
154
|
+
if (compilationArgs.package != null) {
|
|
155
|
+
config['0xweb'].package = compilationArgs.package;
|
|
156
|
+
if (compilationArgs.artifacts == null) {
|
|
157
|
+
compilationArgs.artifacts = _path_1.$path.join(compilationArgs.package, 'artifacts');
|
|
158
|
+
}
|
|
159
|
+
if (compilationArgs.sources == null) {
|
|
160
|
+
compilationArgs.sources = _path_1.$path.join(compilationArgs.package, 'contracts');
|
|
161
|
+
}
|
|
162
|
+
config.paths.cache = _path_1.$path.join(compilationArgs.package, 'cache');
|
|
163
|
+
}
|
|
164
|
+
// Re-set Artifacts Path manually, as Hardhat initializes the Artifacts Instance before this task runs.
|
|
165
|
+
// Other paths (sources, cache) will be resolved later by hardhat from config
|
|
166
|
+
const artifactsInstance = artifacts;
|
|
167
|
+
if (artifactsInstance._artifactsPath == null) {
|
|
168
|
+
console.error(`Artifacts Internal interface was changed. Trying to set private _artifactsPath, but it doesn't exist.`);
|
|
169
|
+
}
|
|
170
|
+
// Clean artifacts from previous compile
|
|
171
|
+
artifactsInstance._validArtifacts = [];
|
|
172
|
+
artifactsInstance._artifactsPath = config.paths.artifacts;
|
|
173
|
+
let { sources: sourcesDir, artifacts: artifactsDir, root: rootDir } = compilationArgs;
|
|
174
|
+
if (rootDir != null) {
|
|
175
|
+
rootDir = _path_1.$path.resolve(rootDir);
|
|
176
|
+
if (sourcesDir == null) {
|
|
177
|
+
sourcesDir = `file://${_path_1.$path.join(rootDir, 'contracts')}`;
|
|
178
|
+
}
|
|
179
|
+
if (artifactsDir == null) {
|
|
180
|
+
artifactsDir = `file://${_path_1.$path.join(rootDir, 'artifacts')}`;
|
|
181
|
+
}
|
|
182
|
+
config.paths.root = rootDir;
|
|
183
|
+
config.paths.cache = _path_1.$path.join(rootDir, 'cache');
|
|
184
|
+
}
|
|
185
|
+
if (sourcesDir) {
|
|
186
|
+
sourcesDir = _path_1.$path.resolve(sourcesDir);
|
|
187
|
+
config.paths.sources = sourcesDir;
|
|
188
|
+
}
|
|
189
|
+
if (artifactsDir) {
|
|
190
|
+
artifactsDir = _path_1.$path.resolve(artifactsDir);
|
|
191
|
+
config.paths.artifacts = artifactsDir;
|
|
192
|
+
artifactsInstance._artifactsPath = artifactsDir;
|
|
193
|
+
}
|
|
194
|
+
if (compilationArgs.watch) {
|
|
195
|
+
const directory = `file://${config.paths.sources}/`;
|
|
196
|
+
atma_io_1.Directory.watch(directory, async (...args) => {
|
|
197
|
+
try {
|
|
198
|
+
await runSuper();
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
console.log(`Compilation failed`, error);
|
|
202
|
+
console.log(`Watching...`);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
try {
|
|
206
|
+
await runSuper();
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
console.log(`Compilation failed`, error);
|
|
210
|
+
console.log(`Watching...`);
|
|
211
|
+
}
|
|
212
|
+
// prevent from exit
|
|
213
|
+
await new Promise(resolve => { });
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
await runSuper();
|
|
217
|
+
});
|
|
218
|
+
(0, config_1.subtask)(task_names_1.TASK_COMPILE_SOLIDITY_COMPILE_JOBS, 'Compiles the entire project, building all artifacts and generating 0xweb TS classes')
|
|
219
|
+
.setAction(async (taskArgs, { run }, runSuper) => {
|
|
220
|
+
const compileSolOutput = await runSuper(taskArgs);
|
|
221
|
+
await run(constants_1.TASK_0xWEB_GENERATE, { compileSolOutput });
|
|
222
|
+
return compileSolOutput;
|
|
223
|
+
});
|
|
224
|
+
(0, config_1.subtask)(constants_1.TASK_0xWEB_GENERATE)
|
|
225
|
+
.setAction(async (a, b) => {
|
|
226
|
+
let { compileSolOutput } = a;
|
|
227
|
+
let { config, artifacts } = b;
|
|
228
|
+
if (config['0xweb'].tsgen === false) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const contracts = await getCompiledAbis(config, compileSolOutput);
|
|
232
|
+
const pkg = config['0xweb'].package;
|
|
233
|
+
const app = new _0xweb_1.App();
|
|
234
|
+
await (0, alot_1.default)(contracts)
|
|
235
|
+
.forEachAsync(async (contract, i) => {
|
|
236
|
+
console.log(`Generate ${contract.name}(${contract.path}) ${i}/${contracts.length}`);
|
|
237
|
+
const params = [
|
|
238
|
+
`install`, `${contract.path}`,
|
|
239
|
+
'--name', contract.name,
|
|
240
|
+
'--chain', 'hardhat',
|
|
241
|
+
'--save-sources', false
|
|
242
|
+
];
|
|
243
|
+
if (pkg != null) {
|
|
244
|
+
params.push('--output', _path_1.$path.join(pkg, '0xc'));
|
|
245
|
+
}
|
|
246
|
+
await app.execute(params);
|
|
247
|
+
})
|
|
248
|
+
.toArrayAsync({ threads: 4 });
|
|
249
|
+
});
|
|
250
|
+
(0, config_1.task)(constants_1.TASK_0xWEB, 'Generate 0xWeb classes for compiled contracts')
|
|
251
|
+
.setAction(async (_, { run }) => {
|
|
252
|
+
taskArgsStore.compileAll = true;
|
|
253
|
+
await run(task_names_1.TASK_COMPILE, { quiet: true });
|
|
254
|
+
});
|
|
255
|
+
(0, config_1.task)(task_names_1.TASK_CLEAN, 'Clears the cache and deletes all artifacts')
|
|
256
|
+
.addOptionalParam('package', 'Optionally clears the 0xc classes for a specific mono-repo package')
|
|
257
|
+
.setAction(async (cliArgs, { config }, runSuper) => {
|
|
258
|
+
if (cliArgs.global) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
let dir = `/0xc/hardhat/`;
|
|
262
|
+
if (cliArgs.package != null) {
|
|
263
|
+
config.paths.artifacts = _path_1.$path.join(config.paths.root, cliArgs.package, 'artifacts/');
|
|
264
|
+
config.paths.cache = _path_1.$path.join(config.paths.root, cliArgs.package, 'cache/');
|
|
265
|
+
dir = _path_1.$path.join(cliArgs.package, dir);
|
|
266
|
+
}
|
|
267
|
+
if (await atma_io_1.Directory.existsAsync(dir)) {
|
|
268
|
+
console.log(`Clearing ${dir}`);
|
|
269
|
+
await atma_io_1.Directory.removeAsync(dir);
|
|
270
|
+
}
|
|
271
|
+
await runSuper();
|
|
272
|
+
});
|
|
273
|
+
async function getCompiledAbis(config, compileSolOutput) {
|
|
274
|
+
const emittedArtifacts = (0, alot_1.default)(compileSolOutput.artifactsEmittedPerJob).mapMany((a) => {
|
|
275
|
+
return (0, alot_1.default)(a.artifactsEmittedPerFile).mapMany((artifactPerFile) => {
|
|
276
|
+
return (0, alot_1.default)(artifactPerFile.artifactsEmitted).map((artifactName) => {
|
|
277
|
+
return {
|
|
278
|
+
name: artifactName,
|
|
279
|
+
sourceFile: 'file://' + artifactPerFile.file.absolutePath
|
|
280
|
+
};
|
|
281
|
+
})
|
|
282
|
+
.filter(x => x.sourceFile.includes('@openzeppelin') === false)
|
|
283
|
+
.toArray();
|
|
284
|
+
}).toArray();
|
|
285
|
+
}).toArray();
|
|
286
|
+
let namesHash = (0, alot_1.default)(emittedArtifacts).toDictionary(x => x.name);
|
|
287
|
+
let files = await atma_io_1.Directory.readFilesAsync(`file://${config.paths.artifacts}/`, '**.json');
|
|
288
|
+
let compileAll = taskArgsStore.compileAll;
|
|
289
|
+
let arr = files
|
|
290
|
+
.map(file => {
|
|
291
|
+
let path = file.uri.toString();
|
|
292
|
+
let match = /(?<name>[^\\\/]+)\.sol[\\\/]/.exec(path);
|
|
293
|
+
if (match == null) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
let name = match.groups.name;
|
|
297
|
+
if (compileAll !== true && name in namesHash === false) {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
if (new RegExp(`${name}\\.json$`).test(path) === false) {
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
name: name,
|
|
305
|
+
path: path
|
|
306
|
+
};
|
|
307
|
+
})
|
|
308
|
+
.filter(Boolean);
|
|
309
|
+
return arr;
|
|
310
|
+
}
|
|
311
|
+
var ConfigHelper;
|
|
312
|
+
(function (ConfigHelper) {
|
|
313
|
+
let $backup;
|
|
314
|
+
function resetPaths(paths) {
|
|
315
|
+
if ($backup == null) {
|
|
316
|
+
$backup = { ...paths };
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
Object.assign(paths, $backup);
|
|
320
|
+
}
|
|
321
|
+
ConfigHelper.resetPaths = resetPaths;
|
|
322
|
+
})(ConfigHelper || (ConfigHelper = {}));
|
|
303
323
|
//# sourceMappingURL=index.js.map
|
|
304
324
|
//# sourceMappingURL=index.ts.map
|
|
305
325
|
|
package/package.json
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@0xweb/hardhat",
|
|
3
|
-
"description": "0xweb plugin for Hardhat",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"author": {
|
|
7
|
-
"name": "Alex Kit",
|
|
8
|
-
"email": "alex.kit@atmajs.com"
|
|
9
|
-
},
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/0xweb-org/hardhat"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"web3",
|
|
16
|
-
"contracts",
|
|
17
|
-
"evm"
|
|
18
|
-
],
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"0xweb": "^0.10.
|
|
22
|
-
"alot": "^0.3.0",
|
|
23
|
-
"atma-io": "^1.2.65",
|
|
24
|
-
"memd": "^0.3.10"
|
|
25
|
-
},
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"hardhat": ">=2.9.3"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "app-bundler",
|
|
31
|
-
"watch": "app-bundler --watch",
|
|
32
|
-
"test": "atma --openssl-legacy-provider test",
|
|
33
|
-
"release": "
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"app-bundler": "^0.1.7",
|
|
37
|
-
"atma": "^0.15.17",
|
|
38
|
-
"shellbee": "^0.5.22"
|
|
39
|
-
},
|
|
40
|
-
"app-bundler": {
|
|
41
|
-
"file": "src/index.ts",
|
|
42
|
-
"outputMain": "lib/index.js",
|
|
43
|
-
"package": {
|
|
44
|
-
"module": "commonjs",
|
|
45
|
-
"commonjs": {
|
|
46
|
-
"output": "simplified"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"extensions": {
|
|
50
|
-
"io": {
|
|
51
|
-
"type": "js"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"defaultExtensions": {
|
|
55
|
-
"js": "ts"
|
|
56
|
-
},
|
|
57
|
-
"dynamicDependencies": [
|
|
58
|
-
"alot",
|
|
59
|
-
"atma-io",
|
|
60
|
-
"0xweb",
|
|
61
|
-
"^hardhat",
|
|
62
|
-
"^path$"
|
|
63
|
-
],
|
|
64
|
-
"middlewares": {
|
|
65
|
-
"ts": [
|
|
66
|
-
"atma-loader-ts:read"
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
"settings": {
|
|
70
|
-
"atma-loader-ts": {
|
|
71
|
-
"typescript": {
|
|
72
|
-
"compilerOptions": {
|
|
73
|
-
"module": "CommonJS",
|
|
74
|
-
"lib": [
|
|
75
|
-
"ES2019"
|
|
76
|
-
],
|
|
77
|
-
"target": "ES2019"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"atma": {
|
|
84
|
-
"plugins": [
|
|
85
|
-
"atma-loader-ts"
|
|
86
|
-
],
|
|
87
|
-
"settings": {
|
|
88
|
-
"atma-utest": {
|
|
89
|
-
"include": {
|
|
90
|
-
"amd": true,
|
|
91
|
-
"extentionDefault": {
|
|
92
|
-
"js": "ts"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"include": {
|
|
97
|
-
"amd": true,
|
|
98
|
-
"extentionDefault": {
|
|
99
|
-
"js": "ts"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
"atma-loader-ts": {
|
|
103
|
-
"typescript": {
|
|
104
|
-
"compilerOptions": {
|
|
105
|
-
"#if (TEST)": {
|
|
106
|
-
"module": "AMD"
|
|
107
|
-
},
|
|
108
|
-
"#if (!TEST)": {
|
|
109
|
-
"module": "commonjs"
|
|
110
|
-
},
|
|
111
|
-
"sourceMap": false
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@0xweb/hardhat",
|
|
3
|
+
"description": "0xweb plugin for Hardhat",
|
|
4
|
+
"version": "0.1.24",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Alex Kit",
|
|
8
|
+
"email": "alex.kit@atmajs.com"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/0xweb-org/hardhat"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"web3",
|
|
16
|
+
"contracts",
|
|
17
|
+
"evm"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"0xweb": "^0.10.40",
|
|
22
|
+
"alot": "^0.3.0",
|
|
23
|
+
"atma-io": "^1.2.65",
|
|
24
|
+
"memd": "^0.3.10"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"hardhat": ">=2.9.3"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "app-bundler",
|
|
31
|
+
"watch": "app-bundler --watch",
|
|
32
|
+
"test": "atma --openssl-legacy-provider test",
|
|
33
|
+
"release": "atma bump && npm run build && git add -A && git commit -am 'bump' && git push && git push origin master:release"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"app-bundler": "^0.1.7",
|
|
37
|
+
"atma": "^0.15.17",
|
|
38
|
+
"shellbee": "^0.5.22"
|
|
39
|
+
},
|
|
40
|
+
"app-bundler": {
|
|
41
|
+
"file": "src/index.ts",
|
|
42
|
+
"outputMain": "lib/index.js",
|
|
43
|
+
"package": {
|
|
44
|
+
"module": "commonjs",
|
|
45
|
+
"commonjs": {
|
|
46
|
+
"output": "simplified"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"extensions": {
|
|
50
|
+
"io": {
|
|
51
|
+
"type": "js"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"defaultExtensions": {
|
|
55
|
+
"js": "ts"
|
|
56
|
+
},
|
|
57
|
+
"dynamicDependencies": [
|
|
58
|
+
"alot",
|
|
59
|
+
"atma-io",
|
|
60
|
+
"0xweb",
|
|
61
|
+
"^hardhat",
|
|
62
|
+
"^path$"
|
|
63
|
+
],
|
|
64
|
+
"middlewares": {
|
|
65
|
+
"ts": [
|
|
66
|
+
"atma-loader-ts:read"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"settings": {
|
|
70
|
+
"atma-loader-ts": {
|
|
71
|
+
"typescript": {
|
|
72
|
+
"compilerOptions": {
|
|
73
|
+
"module": "CommonJS",
|
|
74
|
+
"lib": [
|
|
75
|
+
"ES2019"
|
|
76
|
+
],
|
|
77
|
+
"target": "ES2019"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"atma": {
|
|
84
|
+
"plugins": [
|
|
85
|
+
"atma-loader-ts"
|
|
86
|
+
],
|
|
87
|
+
"settings": {
|
|
88
|
+
"atma-utest": {
|
|
89
|
+
"include": {
|
|
90
|
+
"amd": true,
|
|
91
|
+
"extentionDefault": {
|
|
92
|
+
"js": "ts"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"include": {
|
|
97
|
+
"amd": true,
|
|
98
|
+
"extentionDefault": {
|
|
99
|
+
"js": "ts"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"atma-loader-ts": {
|
|
103
|
+
"typescript": {
|
|
104
|
+
"compilerOptions": {
|
|
105
|
+
"#if (TEST)": {
|
|
106
|
+
"module": "AMD"
|
|
107
|
+
},
|
|
108
|
+
"#if (!TEST)": {
|
|
109
|
+
"module": "commonjs"
|
|
110
|
+
},
|
|
111
|
+
"sourceMap": false
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
# [`0xweb`](https://0xweb.org) plugin for [Hardhat](https://hardhat.org/)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
----
|
|
5
|
-
[](https://badge.fury.io/js/0xc%2Fhardhat)
|
|
6
|
-
[](https://circleci.com/gh/0xweb-org/hardhat)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
The plugin generates `0xWeb` classes for compiled solidity contracts, making the blockchain development transparent.
|
|
10
|
-
|
|
11
|
-
> We use [📦 dequanto library](https://github.com/0xweb-org/dequanto) for the classes
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
[Documentation 📜](https://docs.0xweb.org/hardhat/info)
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Install
|
|
18
|
-
|
|
19
|
-
### Install automatically the dependencies and configurations
|
|
20
|
-
```bash
|
|
21
|
-
# install 0xweb
|
|
22
|
-
$ npm i 0xweb -g
|
|
23
|
-
|
|
24
|
-
# initialize 0xweb and hardhat project
|
|
25
|
-
$ 0xweb init --hardhat
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# Compile
|
|
31
|
-
|
|
32
|
-
> `any/directory/Foo.sol`
|
|
33
|
-
|
|
34
|
-
```solidity
|
|
35
|
-
pragma solidity ^0.8.2;
|
|
36
|
-
|
|
37
|
-
contract Foo {
|
|
38
|
-
string public name;
|
|
39
|
-
|
|
40
|
-
function setName(string memory _name) public {
|
|
41
|
-
name = _name;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
> Plugin adds also ability to specify the `sources` folder. As per default this is `/contracts/**.sol`
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
$ npx hardhat compile --sources ./any/directory/
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
# Use in local development
|
|
53
|
-
|
|
54
|
-
> `example.ts`
|
|
55
|
-
```ts
|
|
56
|
-
import { Foo } from '0xc/hardhat/Foo/Foo.ts'
|
|
57
|
-
import { HardhatProvider } from '@dequanto/hardhat/HardhatProvider'
|
|
58
|
-
|
|
59
|
-
// automatically deploys the contract to hardhat chain
|
|
60
|
-
const deployer = new HardhatProvider();
|
|
61
|
-
const foo = await deployer.deployClass<Foo>(Foo, { arguments: [ 'Hello' ] });
|
|
62
|
-
|
|
63
|
-
// write
|
|
64
|
-
const tx = await foo.setName('Hello world')
|
|
65
|
-
const receipt = await tx.wait();
|
|
66
|
-
|
|
67
|
-
// read
|
|
68
|
-
const text = await foo.name();
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
# Use already deployed contracts to any chain
|
|
73
|
-
|
|
74
|
-
If the contract is already deployed, initialize the contract with the Address as normal class. If the contract is deployed to any other chain - set also the client in constructor
|
|
75
|
-
|
|
76
|
-
> `example.ts`
|
|
77
|
-
```ts
|
|
78
|
-
import { Foo } from '0xc/hardhat/Foo/Foo.ts'
|
|
79
|
-
import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client'
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const client = new EthWeb3Client();
|
|
83
|
-
const foo = new Foo('0x12345...', client);
|
|
84
|
-
|
|
85
|
-
// write
|
|
86
|
-
const tx = await foo.setName('Hello world');
|
|
87
|
-
const receipt = tx.wait();
|
|
88
|
-
// read
|
|
89
|
-
const text = await foo.name();
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
# Additional parameters
|
|
94
|
-
|
|
95
|
-
- `npx hardhat compile --sources /foo/bar/qux` - compiles solidity files which are located outside the `/contracts` folder
|
|
96
|
-
- `npx hardhat compile --artifacts /dist` - set custom folder for artifacts (ABI JSONs and TS contracts)
|
|
97
|
-
- `npx hardhat compile --watch` - Compile the sources and waits to recompile on changes
|
|
98
|
-
- `npx hardhat compile --tsgen false` - Do not generate the TS classes
|
|
99
|
-
- `npx hardhat compile --package path/to/package/folder` - You can split your project into packages, and with the command compile the contracts in a package, the sources will be searched in that directory, and the artifacts output will be written to that directory
|
|
100
|
-
|
|
101
|
-
----
|
|
1
|
+
# [`0xweb`](https://0xweb.org) plugin for [Hardhat](https://hardhat.org/)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
----
|
|
5
|
+
[](https://badge.fury.io/js/0xc%2Fhardhat)
|
|
6
|
+
[](https://circleci.com/gh/0xweb-org/hardhat)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
The plugin generates `0xWeb` classes for compiled solidity contracts, making the blockchain development transparent.
|
|
10
|
+
|
|
11
|
+
> We use [📦 dequanto library](https://github.com/0xweb-org/dequanto) for the classes
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
[Documentation 📜](https://docs.0xweb.org/hardhat/info)
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Install
|
|
18
|
+
|
|
19
|
+
### Install automatically the dependencies and configurations
|
|
20
|
+
```bash
|
|
21
|
+
# install 0xweb
|
|
22
|
+
$ npm i 0xweb -g
|
|
23
|
+
|
|
24
|
+
# initialize 0xweb and hardhat project
|
|
25
|
+
$ 0xweb init --hardhat
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# Compile
|
|
31
|
+
|
|
32
|
+
> `any/directory/Foo.sol`
|
|
33
|
+
|
|
34
|
+
```solidity
|
|
35
|
+
pragma solidity ^0.8.2;
|
|
36
|
+
|
|
37
|
+
contract Foo {
|
|
38
|
+
string public name;
|
|
39
|
+
|
|
40
|
+
function setName(string memory _name) public {
|
|
41
|
+
name = _name;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
> Plugin adds also ability to specify the `sources` folder. As per default this is `/contracts/**.sol`
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
$ npx hardhat compile --sources ./any/directory/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
# Use in local development
|
|
53
|
+
|
|
54
|
+
> `example.ts`
|
|
55
|
+
```ts
|
|
56
|
+
import { Foo } from '0xc/hardhat/Foo/Foo.ts'
|
|
57
|
+
import { HardhatProvider } from '@dequanto/hardhat/HardhatProvider'
|
|
58
|
+
|
|
59
|
+
// automatically deploys the contract to hardhat chain
|
|
60
|
+
const deployer = new HardhatProvider();
|
|
61
|
+
const foo = await deployer.deployClass<Foo>(Foo, { arguments: [ 'Hello' ] });
|
|
62
|
+
|
|
63
|
+
// write
|
|
64
|
+
const tx = await foo.setName('Hello world')
|
|
65
|
+
const receipt = await tx.wait();
|
|
66
|
+
|
|
67
|
+
// read
|
|
68
|
+
const text = await foo.name();
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
# Use already deployed contracts to any chain
|
|
73
|
+
|
|
74
|
+
If the contract is already deployed, initialize the contract with the Address as normal class. If the contract is deployed to any other chain - set also the client in constructor
|
|
75
|
+
|
|
76
|
+
> `example.ts`
|
|
77
|
+
```ts
|
|
78
|
+
import { Foo } from '0xc/hardhat/Foo/Foo.ts'
|
|
79
|
+
import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client'
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
const client = new EthWeb3Client();
|
|
83
|
+
const foo = new Foo('0x12345...', client);
|
|
84
|
+
|
|
85
|
+
// write
|
|
86
|
+
const tx = await foo.setName('Hello world');
|
|
87
|
+
const receipt = tx.wait();
|
|
88
|
+
// read
|
|
89
|
+
const text = await foo.name();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# Additional parameters
|
|
94
|
+
|
|
95
|
+
- `npx hardhat compile --sources /foo/bar/qux` - compiles solidity files which are located outside the `/contracts` folder
|
|
96
|
+
- `npx hardhat compile --artifacts /dist` - set custom folder for artifacts (ABI JSONs and TS contracts)
|
|
97
|
+
- `npx hardhat compile --watch` - Compile the sources and waits to recompile on changes
|
|
98
|
+
- `npx hardhat compile --tsgen false` - Do not generate the TS classes
|
|
99
|
+
- `npx hardhat compile --package path/to/package/folder` - You can split your project into packages, and with the command compile the contracts in a package, the sources will be searched in that directory, and the artifacts output will be written to that directory
|
|
100
|
+
|
|
101
|
+
----
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"exclude": ["node_modules"],
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "ts-temp",
|
|
5
|
-
"lib": ["es2020"],
|
|
6
|
-
"typeRoots": [
|
|
7
|
-
"node_modules/@types",
|
|
8
|
-
"typings",
|
|
9
|
-
"typings/globals",
|
|
10
|
-
"typings-other"
|
|
11
|
-
],
|
|
12
|
-
"types": ["node", "assertion", "atma-utest"],
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"target": "es2020",
|
|
15
|
-
"module": "commonjs",
|
|
16
|
-
"sourceMap": false,
|
|
17
|
-
"experimentalDecorators": true
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"exclude": ["node_modules"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "ts-temp",
|
|
5
|
+
"lib": ["es2020"],
|
|
6
|
+
"typeRoots": [
|
|
7
|
+
"node_modules/@types",
|
|
8
|
+
"typings",
|
|
9
|
+
"typings/globals",
|
|
10
|
+
"typings-other"
|
|
11
|
+
],
|
|
12
|
+
"types": ["node", "assertion", "atma-utest"],
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"target": "es2020",
|
|
15
|
+
"module": "commonjs",
|
|
16
|
+
"sourceMap": false,
|
|
17
|
+
"experimentalDecorators": true
|
|
18
|
+
}
|
|
19
|
+
}
|