Last active
February 8, 2019 16:35
-
-
Save fzeoli/cbdc7da7ea5fa80d3442c9f45311b4a0 to your computer and use it in GitHub Desktop.
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
extendEnvironment((env) => { | |
const wrapper = new EthersProviderWrapper(env.ethereum); | |
env.ethers = { | |
provider: wrapper, | |
getContract: async function (name) { | |
const artifact = await readArtifact(env.config.paths.artifacts, name); | |
const bytecode = artifact.bytecode; | |
const signers = await env.ethers.signers(); | |
return new ethers.ContractFactory(artifact.abi, bytecode, signers[0]); | |
}, | |
signers: async function () { | |
const accounts = await env.ethereum.send("eth_accounts"); | |
return accounts.map((account) => wrapper.getSigner(account)); | |
} | |
}; | |
}); | |
module.exports = {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment