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

chore(release): publish v7.9.2 #4563

Merged
merged 6 commits into from
Dec 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: add instructions for using ganache with viem (#4476)
  • Loading branch information
davidmurdoch authored Aug 22, 2023
commit 4b4f92128f5f59cbfa4cf4fc4a127a879b9ba3b1
16 changes: 15 additions & 1 deletion packages/ganache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ You can use Ganache programmatically from Node.js. Install Ganache into your npm
$ npm install ganache
```

Then you can use ganache as an [EIP-1193 provider only](#as-an-eip-1193-provider-only), an [EIP-1193 provider and JSON-RPC web server](#as-an-eip-1193-provider-and-json-rpc-web-server), as a [Web3 provider](#as-a-web3js-provider), or an [ethers provider](#as-an-ethersjs-provider).
Then you can use ganache as an [EIP-1193 provider only](#as-an-eip-1193-provider-only), an [EIP-1193 provider and JSON-RPC web server](#as-an-eip-1193-provider-and-json-rpc-web-server), as a [Web3 provider](#as-a-web3js-provider), an [ethers provider](#as-an-ethersjs-provider), or a [viem transport](#as-a-viem-transport).

#### As an EIP-1193 provider only:

Expand Down Expand Up @@ -203,6 +203,20 @@ const ganache = require("ganache");
const provider = new ethers.providers.Web3Provider(ganache.provider());
```

#### As a [viem](https://www.npmjs.com/package/viem) transport:

To use a ganache provider as a viem transport:

```javascript
import { createWalletClient, custom } from "viem";
import { localhost } from "viem/chains";
import ganache from "ganache";
const client = createWalletClient({
chain: localhost,
transport: custom(ganache.provider())
});
```

### Browser Use

You can also use Ganache in the browser by adding the following script to your HTML:
Expand Down