forked from NomicFoundation/hardhat
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NomicFoundation#382 from nomiclabs/buidler-ganache
Buidler ganache
- Loading branch information
Showing
23 changed files
with
889 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TS_NODE_FILES=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Node modules | ||
/node_modules | ||
|
||
# Compilation output | ||
/build-test/ | ||
/dist | ||
|
||
# Code coverage artifacts | ||
/coverage | ||
/.nyc_output | ||
|
||
# Below is Github's node gitignore template, except for dotenv's entries as it's used by mocha to pass flags to ts-node, | ||
# and ignoring the node_modules part, as it'd ignore every node_modules, and we have some for testing | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
#node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
#.env | ||
#.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Nomic Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[![npm](https://img.shields.io/npm/v/@nomiclabs/buidler-ethers.svg)](https://www.npmjs.com/package/@nomiclabs/buidler-ethers) | ||
|
||
# buidler-ganache | ||
|
||
This Buidler plugin automatically starts and stop [Ganache](https://github.com/trufflesuite/ganache-core) when running | ||
tests or scripts. | ||
|
||
## What | ||
|
||
This plugin creates an especial network named `ganache`. When this network is used, a Ganache server will be | ||
automatically started before running tests and scripts, and stopped when finished. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @nomiclabs/buidler-ganache | ||
``` | ||
|
||
And add the following statement to your `buidler.config.js`: | ||
|
||
```js | ||
usePlugin("@nomiclabs/buidler-ganache"); | ||
``` | ||
|
||
## Tasks | ||
|
||
This plugin creates no additional tasks. | ||
|
||
## Environment extensions | ||
|
||
This plugin doesn't extend the Buidler Runtime Environment. | ||
|
||
## Usage | ||
|
||
There are no additional steps you need to take for this plugin to work. | ||
|
||
## Configuration | ||
|
||
You can set any of the [Ganache's options](https://github.com/trufflesuite/ganache-core#options) through the `ganache` | ||
network config. All of them are supported, with the exception of `accounts`. | ||
|
||
This example sets a larger block gas limit and the default balance of Ganache's accounts. | ||
|
||
```js | ||
module.exports = { | ||
defaultNetwork: "ganache", | ||
networks: { | ||
ganache: { | ||
gasLimit: 6000000000, | ||
defaultBalanceEther: 10 | ||
} | ||
} | ||
}; | ||
``` | ||
|
||
Note: The `accounts` option it's not currently supported. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "@nomiclabs/buidler-ganache", | ||
"version": "1.0.0-beta.13", | ||
"description": "Buidler plugin for managing Ganache", | ||
"homepage": "https://github.com/nomiclabs/buidler/tree/master/packages/buidler-ganache", | ||
"repository": "github:nomiclabs/buidler", | ||
"author": "Nomic Labs SRL", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"keywords": [ | ||
"ethereum", | ||
"smart-contracts", | ||
"buidler", | ||
"buidler-plugin", | ||
"Ganache", | ||
"testing-network" | ||
], | ||
"scripts": { | ||
"lint:fix": "../../node_modules/.bin/prettier --write 'src/**/*.{js,ts}' 'test/**/*.{js,ts}' && npm run lint-src -- --fix && npm run lint-tests -- --fix", | ||
"lint": "npm run lint-src && npm run lint-tests", | ||
"lint-tests": "../../node_modules/.bin/tslint --config tslint.json --project ./tsconfig.json", | ||
"lint-src": "../../node_modules/.bin/tslint --config tslint.json --project src/tsconfig.json", | ||
"test": "./scripts/run-tests.sh", | ||
"build": "../../node_modules/.bin/tsc --build src", | ||
"build-test": "../../node_modules/.bin/tsc --build .", | ||
"clean": "rm -rf dist build-test" | ||
}, | ||
"files": [ | ||
"dist/", | ||
"src/", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"dependencies": { | ||
"debug": "^4.1.1", | ||
"ganache-core": "^2.7.0", | ||
"ts-essentials": "^2.0.7", | ||
"ts-interface-checker": "^0.1.9" | ||
}, | ||
"devDependencies": { | ||
"@nomiclabs/buidler": "^1.0.0-beta.13", | ||
"@types/debug": "^4.1.4", | ||
"@types/fs-extra": "^5.1.0", | ||
"chai": "^4.2.0", | ||
"ts-interface-builder": "^0.2.0" | ||
}, | ||
"peerDependencies": { | ||
"@nomiclabs/buidler": "^1.0.0-beta.13" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
../../node_modules/.bin/mocha --timeout 20000 --exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* This module was automatically generated by `ts-interface-builder` | ||
*/ | ||
import * as t from "ts-interface-checker"; | ||
|
||
export const GanacheOptionsTi = t.iface([], { | ||
url: "string", | ||
keepAliveTimeout: t.opt("number"), | ||
accountKeysPath: t.opt("string"), | ||
accounts: t.opt(t.array("object")), | ||
allowUnlimitedContractSize: t.opt("boolean"), | ||
blockTime: t.opt("number"), | ||
dbPath: t.opt("string"), | ||
debug: t.opt("boolean"), | ||
defaultBalanceEther: t.opt("number"), | ||
fork: t.opt(t.union("string", "object")), | ||
forkBlockNumber: t.opt(t.union("string", "number")), | ||
gasLimit: t.opt("number"), | ||
gasPrice: t.opt(t.union("string", "number")), | ||
hardfork: t.opt( | ||
t.union(t.lit("byzantium"), t.lit("constantinople"), t.lit("petersburg")) | ||
), | ||
hdPath: t.opt("string"), | ||
hostname: t.opt("string"), | ||
locked: t.opt("boolean"), | ||
logger: t.opt( | ||
t.iface([], { | ||
log: t.func("void", t.param("msg", "string")) | ||
}) | ||
), | ||
mnemonic: t.opt("string"), | ||
network_id: t.opt("number"), | ||
networkId: t.opt("number"), | ||
port: t.opt("number"), | ||
seed: t.opt("any"), | ||
time: t.opt("any"), | ||
totalAccounts: t.opt("number"), | ||
unlockedAccounts: t.opt(t.array("string")), | ||
verbose: t.opt("boolean"), | ||
vmErrorsOnRPCResponse: t.opt("boolean"), | ||
ws: t.opt("boolean") | ||
}); | ||
|
||
const exportedTypeSuite: t.ITypeSuite = { | ||
GanacheOptionsTi | ||
}; | ||
export default exportedTypeSuite; |
Oops, something went wrong.