Skip to content

Instantly share code, notes, and snippets.

@hbarcelos
Last active October 29, 2019 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hbarcelos/89bfd31bbc453e3103c6f536338b310b to your computer and use it in GitHub Desktop.
Save hbarcelos/89bfd31bbc453e3103c6f536338b310b to your computer and use it in GitHub Desktop.
Buidler + Waffle + Ethers on Node >= 12
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;
{
"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"
}
}
{
"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