@0xweb/hardhat 0.1.19 → 0.1.23

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.
@@ -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 }}
@@ -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,180 +125,189 @@ 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.sources, 'contracts');
161
- }
162
- }
163
- // Re-set Artifacts Path manually, as Hardhat initializes the Artifacts Instance before this task runs.
164
- // Other paths (sources, cache) will be resolved later by hardhat from config
165
- const artifactsInstance = artifacts;
166
- if (artifactsInstance._artifactsPath == null) {
167
- console.error(`Artifacts Internal interface was changed. Trying to set private _artifactsPath, but it doesn't exist.`);
168
- }
169
- // Clean artifacts from previous compile
170
- artifactsInstance._validArtifacts = [];
171
- artifactsInstance._artifactsPath = config.paths.artifacts;
172
- let { sources: sourcesDir, artifacts: artifactsDir, root: rootDir } = compilationArgs;
173
- if (rootDir != null) {
174
- rootDir = _path_1.$path.resolve(rootDir);
175
- if (sourcesDir == null) {
176
- sourcesDir = `file://${_path_1.$path.join(rootDir, 'contracts')}`;
177
- }
178
- if (artifactsDir == null) {
179
- artifactsDir = `file://${_path_1.$path.join(rootDir, 'artifacts')}`;
180
- }
181
- config.paths.root = rootDir;
182
- config.paths.cache = _path_1.$path.join(rootDir, 'cache');
183
- }
184
- if (sourcesDir) {
185
- sourcesDir = _path_1.$path.resolve(sourcesDir);
186
- config.paths.sources = sourcesDir;
187
- }
188
- if (artifactsDir) {
189
- artifactsDir = _path_1.$path.resolve(artifactsDir);
190
- config.paths.artifacts = artifactsDir;
191
- artifactsInstance._artifactsPath = artifactsDir;
192
- }
193
- if (compilationArgs.watch) {
194
- const directory = `file://${config.paths.sources}/`;
195
- atma_io_1.Directory.watch(directory, async (...args) => {
196
- await runSuper();
197
- });
198
- await runSuper();
199
- // prevent from exit
200
- await new Promise(resolve => { });
201
- return;
202
- }
203
- await runSuper();
204
- });
205
- (0, config_1.subtask)(task_names_1.TASK_COMPILE_SOLIDITY_COMPILE_JOBS, 'Compiles the entire project, building all artifacts and generating 0xweb TS classes')
206
- .setAction(async (taskArgs, { run }, runSuper) => {
207
- const compileSolOutput = await runSuper(taskArgs);
208
- await run(constants_1.TASK_0xWEB_GENERATE, { compileSolOutput });
209
- return compileSolOutput;
210
- });
211
- (0, config_1.subtask)(constants_1.TASK_0xWEB_GENERATE)
212
- .setAction(async (a, b) => {
213
- let { compileSolOutput } = a;
214
- let { config, artifacts } = b;
215
- if (config['0xweb'].tsgen === false) {
216
- return;
217
- }
218
- const contracts = await getCompiledAbis(config, compileSolOutput);
219
- const pkg = config['0xweb'].package;
220
- const app = new _0xweb_1.App();
221
- await (0, alot_1.default)(contracts)
222
- .forEachAsync(async (contract, i) => {
223
- console.log(`Generation ${contract.name}(${contract.path}) ${i}/${contracts.length}`);
224
- const params = [
225
- `install`, `${contract.path}`,
226
- '--name', contract.name,
227
- '--chain', 'hardhat'
228
- ];
229
- if (pkg != null) {
230
- params.push('--output', _path_1.$path.join(pkg, '0xc'));
231
- }
232
- await app.execute(params);
233
- })
234
- .toArrayAsync({ threads: 4 });
235
- });
236
- (0, config_1.task)(constants_1.TASK_0xWEB, 'Generate 0xWeb classes for compiled contracts')
237
- .setAction(async (_, { run }) => {
238
- taskArgsStore.compileAll = true;
239
- await run(task_names_1.TASK_COMPILE, { quiet: true });
240
- });
241
- (0, config_1.task)(task_names_1.TASK_CLEAN, 'Clears the cache and deletes all artifacts')
242
- .setAction(async ({ global }, { config }, runSuper) => {
243
- if (global) {
244
- return;
245
- }
246
- const dir = `/0xc/hardhat/`;
247
- if (await atma_io_1.Directory.existsAsync(dir)) {
248
- await atma_io_1.Directory.removeAsync(dir);
249
- }
250
- await runSuper();
251
- });
252
- async function getCompiledAbis(config, compileSolOutput) {
253
- const emittedArtifacts = (0, alot_1.default)(compileSolOutput.artifactsEmittedPerJob).mapMany((a) => {
254
- return (0, alot_1.default)(a.artifactsEmittedPerFile).mapMany((artifactPerFile) => {
255
- return (0, alot_1.default)(artifactPerFile.artifactsEmitted).map((artifactName) => {
256
- return {
257
- name: artifactName,
258
- sourceFile: 'file://' + artifactPerFile.file.absolutePath
259
- };
260
- })
261
- .filter(x => x.sourceFile.includes('@openzeppelin') === false)
262
- .toArray();
263
- }).toArray();
264
- }).toArray();
265
- let namesHash = (0, alot_1.default)(emittedArtifacts).toDictionary(x => x.name);
266
- let files = await atma_io_1.Directory.readFilesAsync(`file://${config.paths.artifacts}/`, '**.json');
267
- let compileAll = taskArgsStore.compileAll;
268
- let arr = files
269
- .map(file => {
270
- let path = file.uri.toString();
271
- let match = /(?<name>[^\\\/]+)\.sol[\\\/]/.exec(path);
272
- if (match == null) {
273
- return null;
274
- }
275
- let name = match.groups.name;
276
- if (compileAll !== true && name in namesHash === false) {
277
- return null;
278
- }
279
- if (new RegExp(`${name}\\.json$`).test(path) === false) {
280
- return null;
281
- }
282
- return {
283
- name: name,
284
- path: path
285
- };
286
- })
287
- .filter(Boolean);
288
- return arr;
289
- }
290
- var ConfigHelper;
291
- (function (ConfigHelper) {
292
- let $backup;
293
- function resetPaths(paths) {
294
- if ($backup == null) {
295
- $backup = { ...paths };
296
- return;
297
- }
298
- Object.assign(paths, $backup);
299
- }
300
- ConfigHelper.resetPaths = resetPaths;
301
- })(ConfigHelper || (ConfigHelper = {}));
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
+ await runSuper();
198
+ });
199
+ await runSuper();
200
+ // prevent from exit
201
+ await new Promise(resolve => { });
202
+ return;
203
+ }
204
+ await runSuper();
205
+ });
206
+ (0, config_1.subtask)(task_names_1.TASK_COMPILE_SOLIDITY_COMPILE_JOBS, 'Compiles the entire project, building all artifacts and generating 0xweb TS classes')
207
+ .setAction(async (taskArgs, { run }, runSuper) => {
208
+ const compileSolOutput = await runSuper(taskArgs);
209
+ await run(constants_1.TASK_0xWEB_GENERATE, { compileSolOutput });
210
+ return compileSolOutput;
211
+ });
212
+ (0, config_1.subtask)(constants_1.TASK_0xWEB_GENERATE)
213
+ .setAction(async (a, b) => {
214
+ let { compileSolOutput } = a;
215
+ let { config, artifacts } = b;
216
+ if (config['0xweb'].tsgen === false) {
217
+ return;
218
+ }
219
+ const contracts = await getCompiledAbis(config, compileSolOutput);
220
+ const pkg = config['0xweb'].package;
221
+ const app = new _0xweb_1.App();
222
+ await (0, alot_1.default)(contracts)
223
+ .forEachAsync(async (contract, i) => {
224
+ console.log(`Generate ${contract.name}(${contract.path}) ${i}/${contracts.length}`);
225
+ const params = [
226
+ `install`, `${contract.path}`,
227
+ '--name', contract.name,
228
+ '--chain', 'hardhat',
229
+ '--save-sources', false
230
+ ];
231
+ if (pkg != null) {
232
+ params.push('--output', _path_1.$path.join(pkg, '0xc'));
233
+ }
234
+ await app.execute(params);
235
+ })
236
+ .toArrayAsync({ threads: 4 });
237
+ });
238
+ (0, config_1.task)(constants_1.TASK_0xWEB, 'Generate 0xWeb classes for compiled contracts')
239
+ .setAction(async (_, { run }) => {
240
+ taskArgsStore.compileAll = true;
241
+ await run(task_names_1.TASK_COMPILE, { quiet: true });
242
+ });
243
+ (0, config_1.task)(task_names_1.TASK_CLEAN, 'Clears the cache and deletes all artifacts')
244
+ .addOptionalParam('package', 'Optionally clears the 0xc classes for a specific mono-repo package')
245
+ .setAction(async (cliArgs, { config }, runSuper) => {
246
+ if (cliArgs.global) {
247
+ return;
248
+ }
249
+ let dir = `/0xc/hardhat/`;
250
+ if (cliArgs.package != null) {
251
+ config.paths.artifacts = _path_1.$path.join(config.paths.root, cliArgs.package, 'artifacts/');
252
+ config.paths.cache = _path_1.$path.join(config.paths.root, cliArgs.package, 'cache/');
253
+ dir = _path_1.$path.join(cliArgs.package, dir);
254
+ }
255
+ if (await atma_io_1.Directory.existsAsync(dir)) {
256
+ console.log(`Clearing ${dir}`);
257
+ await atma_io_1.Directory.removeAsync(dir);
258
+ }
259
+ await runSuper();
260
+ });
261
+ async function getCompiledAbis(config, compileSolOutput) {
262
+ const emittedArtifacts = (0, alot_1.default)(compileSolOutput.artifactsEmittedPerJob).mapMany((a) => {
263
+ return (0, alot_1.default)(a.artifactsEmittedPerFile).mapMany((artifactPerFile) => {
264
+ return (0, alot_1.default)(artifactPerFile.artifactsEmitted).map((artifactName) => {
265
+ return {
266
+ name: artifactName,
267
+ sourceFile: 'file://' + artifactPerFile.file.absolutePath
268
+ };
269
+ })
270
+ .filter(x => x.sourceFile.includes('@openzeppelin') === false)
271
+ .toArray();
272
+ }).toArray();
273
+ }).toArray();
274
+ let namesHash = (0, alot_1.default)(emittedArtifacts).toDictionary(x => x.name);
275
+ let files = await atma_io_1.Directory.readFilesAsync(`file://${config.paths.artifacts}/`, '**.json');
276
+ let compileAll = taskArgsStore.compileAll;
277
+ let arr = files
278
+ .map(file => {
279
+ let path = file.uri.toString();
280
+ let match = /(?<name>[^\\\/]+)\.sol[\\\/]/.exec(path);
281
+ if (match == null) {
282
+ return null;
283
+ }
284
+ let name = match.groups.name;
285
+ if (compileAll !== true && name in namesHash === false) {
286
+ return null;
287
+ }
288
+ if (new RegExp(`${name}\\.json$`).test(path) === false) {
289
+ return null;
290
+ }
291
+ return {
292
+ name: name,
293
+ path: path
294
+ };
295
+ })
296
+ .filter(Boolean);
297
+ return arr;
298
+ }
299
+ var ConfigHelper;
300
+ (function (ConfigHelper) {
301
+ let $backup;
302
+ function resetPaths(paths) {
303
+ if ($backup == null) {
304
+ $backup = { ...paths };
305
+ return;
306
+ }
307
+ Object.assign(paths, $backup);
308
+ }
309
+ ConfigHelper.resetPaths = resetPaths;
310
+ })(ConfigHelper || (ConfigHelper = {}));
302
311
  //# sourceMappingURL=index.js.map
303
312
  //# sourceMappingURL=index.ts.map
304
313
 
package/package.json CHANGED
@@ -1,117 +1,117 @@
1
- {
2
- "name": "@0xweb/hardhat",
3
- "description": "0xweb plugin for Hardhat",
4
- "version": "0.1.19",
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.12",
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": "echo \"Run atma pub -m \"message\"\""
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.23",
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
- [![npm version](https://badge.fury.io/js/@0xweb%2Fhardhat.svg)](https://badge.fury.io/js/@0xweb%2Fhardhat)
6
- [![CircleCI](https://circleci.com/gh/0xweb-org/hardhat.svg?style=svg)](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
- # initiallize 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
-
47
- > Plugin adds also ability to specify the `sources` folder. As per default this is `/contracts/**.sol`
48
-
49
- ```bash
50
- $ npx hardhat compile --sources ./any/directory/
51
- ```
52
-
53
- # Use in local development
54
-
55
- > `example.ts`
56
- ```ts
57
- import { Foo } from '@0xweb/hardhat/Foo/Foo.ts'
58
- import { HardhatProvider } from '@dequanto/hardhat/HardhatProvider'
59
-
60
- // automatically deploys the contract to hardhat chain
61
- const deployer = new HardhatProvider();
62
- const foo = await deployer.deployClass<Foo>(Foo, { arguments: [ 'Hello' ] });
63
-
64
- // write
65
- const tx = await foo.setName('Hello world')
66
- const receipt = await tx.wait();
67
-
68
- // read
69
- const text = await foo.name();
70
-
71
- ```
72
-
73
- # Use already deployed contracts to any chain
74
-
75
- 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
76
-
77
- > `example.ts`
78
- ```ts
79
- import { Foo } from '@0xweb/hardhat/Foo/Foo.ts'
80
- import { EthWeb3Client } from '@dequanto/clients/EthWeb3Client'
81
-
82
-
83
- const client = new EthWeb3Client();
84
- const foo = new Foo('0x12345...', client);
85
-
86
- // write
87
- const tx = await foo.setName('Hello world');
88
- const receipt = tx.wait();
89
- // read
90
- const text = await foo.name();
91
- ```
92
-
93
-
94
- # Additional parameters
95
-
96
- - `npx hardhat compile --sources /foo/bar/qux` - compiles solidity files which are located outside the `/contracts` folder
97
- - `npx hardhat compile --artifacts /dist` - set custom folder for artifacts (ABI JSONs and TS contracts)
98
- - `npx hardhat compile --watch` - Compile the sources and waits to recompile on changes
99
- - `npx hardhat compile --tsgen false` - Do not generate the TS classes
100
-
101
- ----
1
+ # [`0xweb`](https://0xweb.org) plugin for [Hardhat](https://hardhat.org/)
2
+
3
+
4
+ ----
5
+ [![npm version](https://badge.fury.io/js/0xc%2Fhardhat.svg)](https://badge.fury.io/js/0xc%2Fhardhat)
6
+ [![CircleCI](https://circleci.com/gh/0xweb-org/hardhat.svg?style=svg)](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
+ }
@@ -1,5 +0,0 @@
1
- {
2
- "cSpell.words": [
3
- "tsgen"
4
- ]
5
- }