Skip to content

Commit

Permalink
feat: support ganache on Test Client
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed May 22, 2023
1 parent 1c1350e commit 9df44ce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-ladybugs-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Added `ganache` as another mode for Test Client
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
- Browser native [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt), instead of large BigNumber libraries
- Utilities for working with [ABIs](https://ethereum.org/en/glossary/#abi) (encoding/decoding/inspection)
- TypeScript ready ([infer types](https://viem.sh/docs/typescript) from ABIs and EIP-712 Typed Data)
- First-class support for [Anvil](https://book.getfoundry.sh/) & [Hardhat](https://hardhat.org/)
- First-class support for [Anvil](https://book.getfoundry.sh/), [Hardhat](https://hardhat.org/) & [Ganache](https://trufflesuite.com/ganache/)
- Test suite running against [forked](https://ethereum.org/en/glossary/#fork) Ethereum network

... and a lot lot more.
Expand Down
2 changes: 1 addition & 1 deletion site/docs/clients/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const mine = await client.mine({ blocks: 1 }) // [!code focus:10]

### mode

- **Type:** `"anvil" | "hardhat"`
- **Type:** `"anvil" | "hardhat" | "ganache"`

Mode of the Test Client.

Expand Down
2 changes: 1 addition & 1 deletion site/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ viem supports all these features out-of-the-box:
- Browser native [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt), instead of large BigNumber libraries
- Utilities for working with [ABIs](https://ethereum.org/en/glossary/#abi) (encoding/decoding/inspection)
- TypeScript ready ([infer types](/docs/typescript) from ABIs and EIP-712 Typed Data)
- First-class support for [Anvil](https://book.getfoundry.sh/) & [Hardhat](https://hardhat.org/)
- First-class support for [Anvil](https://book.getfoundry.sh/), [Hardhat](https://hardhat.org/) & [Ganache](https://trufflesuite.com/ganache/)
- Test suite running against [forked](https://ethereum.org/en/glossary/#fork) Ethereum network

<div class="h-8" />
Expand Down
4 changes: 2 additions & 2 deletions src/clients/createTestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type Client, type ClientConfig, createClient } from './createClient.js'
import { type TestActions, testActions } from './decorators/test.js'
import type { Transport } from './transports/createTransport.js'

export type TestClientMode = 'anvil' | 'hardhat'
export type TestClientMode = 'anvil' | 'hardhat' | 'ganache'

export type TestClientConfig<
TMode extends TestClientMode = TestClientMode,
Expand All @@ -15,7 +15,7 @@ export type TestClientConfig<
ClientConfig<TTransport, TChain>,
'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'
> & {
/** Mode of the test client. Available: "anvil" | "hardhat" */
/** Mode of the test client. Available: "anvil" | "hardhat" | "ganache" */
mode: TMode
}

Expand Down

0 comments on commit 9df44ce

Please sign in to comment.