Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Update README.md (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjpaterno authored and davidmurdoch committed Jul 3, 2019
1 parent fafa7d5 commit 5e8ec8b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ yarn add ganache-core

As a [Web3](https://github.com/ethereum/web3.js/) provider:

```javascript
const ganache = require("ganache-core");
const web3 = new Web3(ganache.provider());
```
If web3 is already initialized:
```javascript
const ganache = require("ganache-core");
web3.setProvider(ganache.provider());
```
NOTE: depending on your web3 version, you may need to set a number of confirmation blocks
```javascript
const web3 = new Web3(provider, null, { transactionConfirmationBlocks: 1 });
```

As an [ethers.js](https://github.com/ethers-io/ethers.js/) provider:

Expand All @@ -52,7 +61,7 @@ As a general HTTP and WebSocket server:
```javascript
const ganache = require("ganache-core");
const server = ganache.server();
server.listen(port, function(err, blockchain) {...});
server.listen(port, function(err, blockchain) { ... });
```

## Options
Expand Down

0 comments on commit 5e8ec8b

Please sign in to comment.