Skip to content

Commit

Permalink
Use toolbox/network-helpers in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Jun 7, 2023
1 parent e584f6a commit 9d900ce
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ await impersonatedSigner.sendTransaction(...);
Alternatively, you can use the [`impersonateAccount`](</hardhat-network-helpers/docs/reference#impersonateaccount(address)>) helper and then obtain the signer for that address:

```js
const helpers = require("@nomicfoundation/hardhat-network-helpers");
const helpers = require("@nomicfoundation/hardhat-toolbox/network-helpers");

const address = "0x1234567890123456789012345678901234567890";
await helpers.impersonateAccount(address);
Expand All @@ -183,7 +183,7 @@ Once you've got a local instance of the mainnet chain state, setting that state
You can reset the network with the [`reset`](</hardhat-network-helpers/docs/reference#reset([url],-[blocknumber])>) network helper:

```js
const helpers = require("@nomicfoundation/hardhat-network-helpers");
const helpers = require("@nomicfoundation/hardhat-toolbox/network-helpers");

await helpers.reset(url, blockNumber);
```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/hardhat-runner/docs/guides/test-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ For our first test we’ll deploy the `Lock` contract and assert that the unlock
```tsx
import { expect } from "chai";
import hre from "hardhat";
import { time } from "@nomicfoundation/hardhat-network-helpers";
import { time } from "@nomicfoundation/hardhat-toolbox/network-helpers";

describe("Lock", function () {
it("Should set the right unlockTime", async function () {
Expand All @@ -54,7 +54,7 @@ describe("Lock", function () {
```js
const { expect } = require("chai");
const hre = require("hardhat");
const { time } = require("@nomicfoundation/hardhat-network-helpers");
const { time } = require("@nomicfoundation/hardhat-toolbox/network-helpers");

describe("Lock", function () {
it("Should set the right unlockTime", async function () {
Expand Down Expand Up @@ -228,7 +228,7 @@ const hre = require("hardhat");
const {
loadFixture,
time,
} = require("@nomicfoundation/hardhat-network-helpers");
} = require("@nomicfoundation/hardhat-toolbox/network-helpers");

describe("Lock", function () {
async function deployOneYearLockFixture() {
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/tutorial/testing-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ The two tests that we wrote begin with their setup, which in this case means dep
You can avoid code duplication and improve the performance of your test suite by using **fixtures**. A fixture is a setup function that is run only the first time it's invoked. On subsequent invocations, instead of re-running it, Hardhat will reset the state of the network to what it was at the point after the fixture was initially executed.

```js
const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers");
const { loadFixture } = require("@nomicfoundation/hardhat-toolbox/network-helpers");
const { expect } = require("chai");

describe("Token contract", function () {
Expand Down Expand Up @@ -171,7 +171,7 @@ const { expect } = require("chai");
// We use `loadFixture` to share common setups (or fixtures) between tests.
// Using this simplifies your tests and makes them run faster, by taking
// advantage of Hardhat Network's snapshot functionality.
const { loadFixture } = require("@nomicfoundation/hardhat-network-helpers");
const { loadFixture } = require("@nomicfoundation/hardhat-toolbox/network-helpers");

// `describe` is a Mocha function that allows you to organize your tests.
// Having your tests organized makes debugging them easier. All Mocha
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { time, loadFixture } from "@nomicfoundation/hardhat-network-helpers";
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs.js";
import { expect } from "chai";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const {
time,
loadFixture,
} = require("@nomicfoundation/hardhat-network-helpers");
} = require("@nomicfoundation/hardhat-toolbox/network-helpers");
const { anyValue } = require("@nomicfoundation/hardhat-chai-matchers/withArgs");
const { expect } = require("chai");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { time, loadFixture } from "@nomicfoundation/hardhat-network-helpers";
import {
time,
loadFixture,
} from "@nomicfoundation/hardhat-toolbox/network-helpers";
import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs";
import { expect } from "chai";
import { ethers } from "hardhat";
Expand Down

0 comments on commit 9d900ce

Please sign in to comment.