Skip to content

Commit

Permalink
docs: fix hh test
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahschwartz committed Sep 18, 2024
1 parent 9d6efbc commit 4839fcd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
13 changes: 9 additions & 4 deletions content/tutorials/how-to-test-contracts/10.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Select the `Create a TypeScript project` option and install the sample project's

To install the `hardhat-zksync` plugin, execute the following command:

:test-action{actionId="install-hh-zksync"}
:test-action{actionId="wait-for-initialization"}
:test-action{actionId="install-deps"}

::code-group

Expand All @@ -52,6 +53,7 @@ yarn add -D @matterlabs/hardhat-zksync

Once installed, add the plugin at the top of your `hardhat.config.ts` file.

:test-action{actionId="wait-for-deps"}
:test-action{actionId="import-zksync-config"}

```ts [hardhat.config.ts]
Expand Down Expand Up @@ -102,12 +104,15 @@ we can shut it down and continue with the tutorial.
### Integration with Hardhat

To enable the usage of ZKsync Era Test Node in Hardhat,
add the `zksync:true` option to the hardhat network in the `hardhat.config.ts` file
and the `latest` version of `zksolc`:
update the version of Solidity to `0.8.26`
in the `hardhat.config.ts` file,
add the `zksync:true` option to the hardhat network,
and add the `latest` version of `zksolc`:

:test-action{actionId="zksync-hh-network"}

```ts
solidity: "0.8.26",
zksolc: {
version: "latest",
},
Expand Down Expand Up @@ -158,7 +163,7 @@ import "@matterlabs/hardhat-zksync";
import "@nomicfoundation/hardhat-chai-matchers";

const config: HardhatUserConfig = {
solidity: "0.8.24",
solidity: "0.8.26",
zksolc: {
version: "latest",
},
Expand Down
15 changes: 12 additions & 3 deletions tests/configs/how-to-test-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ export const steps: IStepConfig = {
'initialize-hardhat-project': {
action: 'runCommand',
},
'install-hh-zksync': {
'wait-for-initialization': {
action: 'wait',
timeout: 10000,
},
'install-deps': {
action: 'runCommand',
commandFolder: 'tests-output/hardhat-project',
},
'wait-for-deps': {
action: 'wait',
timeout: 10000,
},
'import-zksync-config': {
action: 'modifyFile',
filepath: 'tests-output/hardhat-project/hardhat.config.ts',
Expand All @@ -20,7 +28,7 @@ export const steps: IStepConfig = {
},
'wait-for-hh-node': {
action: 'wait',
timeout: 15000,
timeout: 10000,
},
'test-hh-node': {
action: 'checkIfBalanceIsZero',
Expand All @@ -30,7 +38,8 @@ export const steps: IStepConfig = {
'zksync-hh-network': {
action: 'modifyFile',
filepath: 'tests-output/hardhat-project/hardhat.config.ts',
atLine: 7,
atLine: 6,
removeLines: [6],
},
'install-chai-ethers': {
action: 'runCommand',
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/runCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function createNewHHProject(goToFolder: string, projectFolder: string) {
const destinationFolder = join(goToFolder, projectFolder);
copyFolder(sourceFolder, destinationFolder);
const installCommand = `cd ${destinationFolder} && npm init -y && npm install --save-dev "hardhat@^2.22.6" "@nomicfoundation/hardhat-toolbox@^5.0.0" `;
run(installCommand);
await run(installCommand);
}

function copyFolder(source: string, destination: string) {
Expand Down

0 comments on commit 4839fcd

Please sign in to comment.