Skip to content

Commit

Permalink
chore(deps): use ganache instead of ganache-cli
Browse files Browse the repository at this point in the history
This speeds up testing a lot
  • Loading branch information
mirceanis committed Jun 9, 2022
1 parent 92bd244 commit 9095161
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 229 deletions.
7 changes: 4 additions & 3 deletions __tests__/utils/ganache-provider.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers'
import { JsonRpcProvider, Web3Provider, ExternalProvider } from '@ethersproject/providers'
import { Contract, ContractFactory } from '@ethersproject/contracts'
// @ts-ignore
import DidRegistryContract from 'ethr-did-registry'
import ganache from 'ganache-cli'
import ganache from 'ganache'

/**
* Creates a Web3Provider that connects to a local ganache instance with a bunch of known keys and an ERC1056 contract.
Expand All @@ -12,6 +12,7 @@ import ganache from 'ganache-cli'
export async function createGanacheProvider(): Promise<{ provider: JsonRpcProvider; registry: string }> {
const provider = new Web3Provider(
ganache.provider({
logging: { quiet: true },
accounts: [
{
secretKey: '0x278a5de700e29faae8e40e366ec5012b5ec63d36ec77e8a2417154cc1d25383f',
Expand Down Expand Up @@ -54,7 +55,7 @@ export async function createGanacheProvider(): Promise<{ provider: JsonRpcProvid
balance: `0x1000000000000000000000`,
},
],
}),
}) as any
)
await provider.ready
const factory = ContractFactory.fromSolidity(DidRegistryContract).connect(provider.getSigner(0))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"codecov": "3.8.3",
"cross-fetch": "3.1.5",
"ethr-did-registry": "0.0.3",
"ganache-cli": "6.12.2",
"ganache": "7.2.0",
"jest": "27.5.1",
"jest-fetch-mock": "3.0.3",
"json-schema": "0.4.0",
Expand Down
Loading

0 comments on commit 9095161

Please sign in to comment.