Last active
October 29, 2019 20:42
-
-
Save hbarcelos/89bfd31bbc453e3103c6f536338b310b to your computer and use it in GitHub Desktop.
Buidler + Waffle + Ethers on Node >= 12
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
import { ethers } from "@nomiclabs/buidler"; | |
import { task, usePlugin, BuidlerConfig } from "@nomiclabs/buidler/config"; | |
import { getWallets, defaultAccounts } from "ethereum-waffle"; | |
usePlugin("@nomiclabs/buidler-ethers"); | |
task("accounts", "Prints the list of accounts", async (taskArgs, env) => { | |
const accounts = await getWallets(ethers.provider); | |
for (const account of accounts) { | |
console.log(account); | |
} | |
}); | |
const config: BuidlerConfig = { | |
defaultNetwork: "buidlerevm", | |
networks: { | |
buidlerevm: { | |
accounts: defaultAccounts.map(acc => ({ | |
balance: acc.balance, | |
privateKey: acc.secretKey | |
})) | |
} | |
} | |
}; | |
export default config; |
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
{ | |
"name": "buidler-labs", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"devDependencies": { | |
"@nomiclabs/buidler": "^1.0.1", | |
"@nomiclabs/buidler-ethers": "^1.0.1", | |
"@nomiclabs/buidler-truffle5": "^1.0.1", | |
"@nomiclabs/buidler-web3": "^1.0.1", | |
"@types/mocha": "^5.2.7", | |
"@types/node": "^12.11.7", | |
"ethereum-waffle": "^2.1.0", | |
"ethers": "^4.0.38", | |
"ts-node": "^8.4.1", | |
"typescript": "^3.6.4", | |
"web3": "^1.2.2" | |
} | |
} |
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
{ | |
"name": "buidler-labs", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"devDependencies": { | |
"@nomiclabs/buidler": "^1.0.1", | |
"@nomiclabs/buidler-ethers": "^1.0.1", | |
"@types/mocha": "^5.2.7", | |
"@types/node": "^12.11.7", | |
"ethereum-waffle": "^2.1.0", | |
"ethers": "^4.0.38", | |
"ts-node": "^8.4.1", | |
"typescript": "^3.6.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment