Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
robotoer authored Aug 1, 2024
1 parent d0ae80c commit a3f37b4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ yarn add --dev @term-finance/viem-mock-contract

## Usage

To use this project, add the following to your `hardhat.config.js`:
To use this project, import the `deployMock` function:

```javascript
require("@term-finance/viem-mock-contract");
import { deployMock } from "@term-finance/viem-mock-contract";
```

Then, you can write tests that deploy a mock contract to the blockchain:
Expand Down Expand Up @@ -56,10 +56,8 @@ describe("MyContract", () => {
// ...
);

const client = await hre.viem.getPublicClient();

// Call the mock contract
const result = await client.readContract(
const result = await reader.readContract(
mockContract.address,
"myFunction1",
[1, 2],
Expand All @@ -70,7 +68,7 @@ describe("MyContract", () => {

// Check for a revert
try {
await client.readContract(mockContract.address, "myFunction2", [1, 2]);
await reader.readContract(mockContract.address, "myFunction2", [1, 2]);
assert.fail("Expected revert");
} catch (error) {
expect(error.message).to.contain("revert reason");
Expand Down

0 comments on commit a3f37b4

Please sign in to comment.