@0xweb/hardhat 0.1.18 → 0.1.20
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/lib/index.js +4 -21
- package/package.json +2 -2
- package/readme.md +6 -6
- package/.vscode/settings.json +0 -5
package/lib/index.js
CHANGED
|
@@ -144,26 +144,8 @@ const taskArgsStore = { compileAll: false };
|
|
|
144
144
|
.addOptionalParam('artifacts', 'Override the artifacts output directory')
|
|
145
145
|
.addOptionalParam('root', 'Overrides root directory. If sources is also overridden must be the sub-folder of the sources dir')
|
|
146
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('
|
|
148
|
-
|
|
149
|
-
validate(argName, argumentValue) { },
|
|
150
|
-
parse(val) {
|
|
151
|
-
if (val === '' || val === '1' || val === true || val === 'true') {
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
.addOptionalParam('tsgen', 'Skip the TypeScript class generation', true, {
|
|
158
|
-
name: 'boolean',
|
|
159
|
-
validate(key, value) { },
|
|
160
|
-
parse(key, value) {
|
|
161
|
-
if (value === '0' || value === 0 || value === false || value === 'false') {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
})
|
|
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')
|
|
167
149
|
.setAction(async (compilationArgs, { run, config, artifacts }, runSuper) => {
|
|
168
150
|
ConfigHelper.resetPaths(config.paths);
|
|
169
151
|
if (compilationArgs.tsgen === false) {
|
|
@@ -175,8 +157,9 @@ const taskArgsStore = { compileAll: false };
|
|
|
175
157
|
compilationArgs.artifacts = _path_1.$path.join(compilationArgs.package, 'artifacts');
|
|
176
158
|
}
|
|
177
159
|
if (compilationArgs.sources == null) {
|
|
178
|
-
compilationArgs.sources = _path_1.$path.join(compilationArgs.
|
|
160
|
+
compilationArgs.sources = _path_1.$path.join(compilationArgs.package, 'contracts');
|
|
179
161
|
}
|
|
162
|
+
config.paths.cache = _path_1.$path.join(compilationArgs.package, 'cache');
|
|
180
163
|
}
|
|
181
164
|
// Re-set Artifacts Path manually, as Hardhat initializes the Artifacts Instance before this task runs.
|
|
182
165
|
// Other paths (sources, cache) will be resolved later by hardhat from config
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xweb/hardhat",
|
|
3
3
|
"description": "0xweb plugin for Hardhat",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.20",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Alex Kit",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"0xweb": "^0.10.
|
|
21
|
+
"0xweb": "^0.10.13",
|
|
22
22
|
"alot": "^0.3.0",
|
|
23
23
|
"atma-io": "^1.2.65",
|
|
24
24
|
"memd": "^0.3.10"
|
package/readme.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# [`
|
|
1
|
+
# [`0xweb`](https://0xweb.org) plugin for [Hardhat](https://hardhat.org/)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
----
|
|
5
|
-
[](https://badge.fury.io/js/0xc%2Fhardhat)
|
|
6
6
|
[](https://circleci.com/gh/0xweb-org/hardhat)
|
|
7
7
|
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ The plugin generates `0xWeb` classes for compiled solidity contracts, making the
|
|
|
21
21
|
# install 0xweb
|
|
22
22
|
$ npm i 0xweb -g
|
|
23
23
|
|
|
24
|
-
#
|
|
24
|
+
# initialize 0xweb and hardhat project
|
|
25
25
|
$ 0xweb init --hardhat
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -41,7 +41,6 @@ contract Foo {
|
|
|
41
41
|
name = _name;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
45
44
|
```
|
|
46
45
|
|
|
47
46
|
> Plugin adds also ability to specify the `sources` folder. As per default this is `/contracts/**.sol`
|
|
@@ -54,7 +53,7 @@ $ npx hardhat compile --sources ./any/directory/
|
|
|
54
53
|
|
|
55
54
|
> `example.ts`
|
|
56
55
|
```ts
|
|
57
|
-
import { Foo } from '
|
|
56
|
+
import { Foo } from '0xc/hardhat/Foo/Foo.ts'
|
|
58
57
|
import { HardhatProvider } from '@dequanto/hardhat/HardhatProvider'
|
|
59
58
|
|
|
60
59
|
// automatically deploys the contract to hardhat chain
|
|
@@ -76,7 +75,7 @@ If the contract is already deployed, initialize the contract with the Address as
|
|
|
76
75
|
|
|
77
76
|
> `example.ts`
|
|
78
77
|
```ts
|
|
79
|
-
import { Foo } from '
|
|
78
|
+
import { Foo } from '0xc/hardhat/Foo/Foo.ts'
|
|
80
79
|
import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client'
|
|
81
80
|
|
|
82
81
|
|
|
@@ -97,5 +96,6 @@ const text = await foo.name();
|
|
|
97
96
|
- `npx hardhat compile --artifacts /dist` - set custom folder for artifacts (ABI JSONs and TS contracts)
|
|
98
97
|
- `npx hardhat compile --watch` - Compile the sources and waits to recompile on changes
|
|
99
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
100
|
|
|
101
101
|
----
|