Skip to content

Commit a2c1ff1

Browse files
committed
Use --prose-wrap=never in prettier
1 parent 57c4d17 commit a2c1ff1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+207
-463
lines changed

docs/advanced/building-plugins.md

+8-22
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,20 @@
11
# Building plugins
22

3-
In this section, we will explore the creation of plugins for Hardhat, which are the key component
4-
for integrating other tools and extending the built-in functionality.
3+
In this section, we will explore the creation of plugins for Hardhat, which are the key component for integrating other tools and extending the built-in functionality.
54

65
## What exactly are plugins in Hardhat?
76

8-
Plugins are bits of reusable configuration. Anything that you can do in a plugin, can
9-
also be done in your config file. You can test your ideas in a config file, and move
10-
them into a plugin when ready.
7+
Plugins are bits of reusable configuration. Anything that you can do in a plugin, can also be done in your config file. You can test your ideas in a config file, and move them into a plugin when ready.
118

12-
When developing a plugin the main tools available to integrate new functionality are extending the
13-
[Hardhat Runtime Environment](/advanced/hardhat-runtime-environment.md), extending the Hardhat config, defining new tasks and
14-
overriding existing ones, which are all configuration actions achieved through code.
9+
When developing a plugin the main tools available to integrate new functionality are extending the [Hardhat Runtime Environment](/advanced/hardhat-runtime-environment.md), extending the Hardhat config, defining new tasks and overriding existing ones, which are all configuration actions achieved through code.
1510

16-
Some examples of things you could achieve by creating a plugin are running a linter when
17-
the `check` task runs, using different compiler versions for different files or
18-
generating an UML diagram for your contracts.
11+
Some examples of things you could achieve by creating a plugin are running a linter when the `check` task runs, using different compiler versions for different files or generating an UML diagram for your contracts.
1912

2013
## Extending the Hardhat Runtime Environment
2114

22-
Let’s go through the process of creating a plugin that adds new functionality to the Hardhat Runtime Environment.
23-
By doing this, we make sure our new feature is available everywhere. This means your plugin users can access it from
24-
tasks, tests, scripts, and the Hardhat console.
15+
Let’s go through the process of creating a plugin that adds new functionality to the Hardhat Runtime Environment. By doing this, we make sure our new feature is available everywhere. This means your plugin users can access it from tasks, tests, scripts, and the Hardhat console.
2516

26-
The Hardhat Runtime Environment (HRE) is configured through a queue of extension functions
27-
that you can add to using the `extendEnvironment()` function. It receives one parameter which is a callback which will be executed
28-
after the HRE is initialized. If `extendEnvironment` is called multiple times, its
29-
callbacks will be executed in order.
17+
The Hardhat Runtime Environment (HRE) is configured through a queue of extension functions that you can add to using the `extendEnvironment()` function. It receives one parameter which is a callback which will be executed after the HRE is initialized. If `extendEnvironment` is called multiple times, its callbacks will be executed in order.
3018

3119
For example, adding the following to `hardhat.config.js`:
3220

@@ -57,15 +45,13 @@ $ npx hardhat envtest
5745
Hello, Hardhat!
5846
```
5947

60-
This is literally all it takes to put together a plugin for Hardhat. Now `hi` is available to be used in
61-
the Hardhat console, your tasks, tests and other plugins.
48+
This is literally all it takes to put together a plugin for Hardhat. Now `hi` is available to be used in the Hardhat console, your tasks, tests and other plugins.
6249

6350
## Using the Hardhat TypeScript plugin boilerplate
6451

6552
For a complete example of a plugin you can take a look at the [Hardhat TypeScript plugin boilerplate project](https://github.com/nomiclabs/hardhat-ts-plugin-boilerplate/).
6653

67-
Plugins don't need to be written in TypeScript, but we recommend doing it, as many of our users use it. Creating a plugin in
68-
JavaScript can lead to a subpar experience for them.
54+
Plugins don't need to be written in TypeScript, but we recommend doing it, as many of our users use it. Creating a plugin in JavaScript can lead to a subpar experience for them.
6955

7056
### Extending the HRE
7157

docs/advanced/migrating-buidler-plugin.md

+7-22
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import { extendEnvironment } from "hardhat/config";
1818

1919
### Plugins
2020

21-
Similarly, references to Buidler plugins should be replaced with their corresponding Hardhat plugins.
22-
For example, `@nomiclabs/buidler-ethers` would be `@nomiclabs/hardhat-ethers`.
21+
Similarly, references to Buidler plugins should be replaced with their corresponding Hardhat plugins. For example, `@nomiclabs/buidler-ethers` would be `@nomiclabs/hardhat-ethers`.
2322

2423
## Adapting your plugin's source code
2524

@@ -87,17 +86,15 @@ Then, you need to add an `import "./type-extensions";` in your `src/index.ts` fi
8786

8887
### Extending Hardhat types
8988

90-
Hardhat types are meant to be imported from `hardhat/types`, but when extending them,
91-
you should import them from the module that declares them.
89+
Hardhat types are meant to be imported from `hardhat/types`, but when extending them, you should import them from the module that declares them.
9290

9391
For example, if you want you use the `HardhatRuntimeEnvironment` type, you should import it with:
9492

9593
```typescript
9694
import { HardhatRuntimeEnvironment } from "hardhat/types";
9795
```
9896

99-
But if you want to extend it, you should import the module that declares it
100-
instead, which is `hardhat/types/runtime`.
97+
But if you want to extend it, you should import the module that declares it instead, which is `hardhat/types/runtime`.
10198

10299
```typescript
103100
import "hardhat/types/runtime";
@@ -113,29 +110,17 @@ declare module "hardhat/types/runtime" {
113110

114111
Config types are handled slightly differently in Hardhat.
115112

116-
For each config element/type, there's two Typescript types defined. One
117-
that ends with `UserConfig`, that represents the user's input, and another
118-
one that ends with just `Config`, which represents the configuration values
119-
after any resolution and default values have been applied. The first kind of
120-
types is used by users when writing their config. The second one is used
121-
during the execution of tasks, tests and scripts, and is present in the
122-
Hardhat Runtime Environment.
113+
For each config element/type, there's two Typescript types defined. One that ends with `UserConfig`, that represents the user's input, and another one that ends with just `Config`, which represents the configuration values after any resolution and default values have been applied. The first kind of types is used by users when writing their config. The second one is used during the execution of tasks, tests and scripts, and is present in the Hardhat Runtime Environment.
123114

124-
For example, `HardhatUserConfig` represents the entire config written by the
125-
user, and all of its fields are optional. `HardhatConfig`, is the result
126-
of resolving/normalizing it, and applying default values. None of its fields
127-
are optional.
115+
For example, `HardhatUserConfig` represents the entire config written by the user, and all of its fields are optional. `HardhatConfig`, is the result of resolving/normalizing it, and applying default values. None of its fields are optional.
128116

129117
Some types have been renamed to match this new pattern:
130118

131119
- `ProjectPaths` is now `ProjectPathsUserConfig`
132120
- `Networks` is now `NetworksUserConfig`
133-
- Both have their resolved versions: `ProjectPathsConfig` and
134-
`NetworksConfig`, respectively.
121+
- Both have their resolved versions: `ProjectPathsConfig` and `NetworksConfig`, respectively.
135122

136-
You can find an example of how to properly extend these types,
137-
resolve/normalize the users's config, and apply default values in the
138-
`src/type-extensions.ts` and `src/index.ts` files.
123+
You can find an example of how to properly extend these types, resolve/normalize the users's config, and apply default values in the `src/type-extensions.ts` and `src/index.ts` files.
139124

140125
### How type extensions are loaded in Hardhat
141126

docs/config/README.md

+8-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Configuration
22

3-
When Hardhat is run, it searches for the closest `hardhat.config.js` file starting
4-
from the Current Working Directory. This file normally lives in the root of your project. An empty `hardhat.config.js` is enough for Hardhat to work.
3+
When Hardhat is run, it searches for the closest `hardhat.config.js` file starting from the Current Working Directory. This file normally lives in the root of your project. An empty `hardhat.config.js` is enough for Hardhat to work.
54

65
The entirety of your Hardhat setup (i.e. your config, plugins and custom tasks) is contained in this file.
76

@@ -47,19 +46,15 @@ module.exports = {
4746

4847
The `networks` config field is an optional object where network names map to their configuration.
4948

50-
There are two kinds of networks in Hardhat: [JSON-RPC](https://eth.wiki/json-rpc/API) based networks,
51-
and the built-in Hardhat Network.
49+
There are two kinds of networks in Hardhat: [JSON-RPC](https://eth.wiki/json-rpc/API) based networks, and the built-in Hardhat Network.
5250

5351
You can customize which network is used by default when running Hardhat by setting the config's `defaultNetwork` field. If you omit this config, its default value is `"hardhat"`.
5452

5553
### Hardhat Network
5654

57-
Hardhat comes built-in with a special network called `hardhat`. When using this network,
58-
an instance of the [Hardhat Network](../hardhat-network/README.md) will be automatically created when you run a task, script or test your smart contracts
55+
Hardhat comes built-in with a special network called `hardhat`. When using this network, an instance of the [Hardhat Network](../hardhat-network/README.md) will be automatically created when you run a task, script or test your smart contracts
5956

60-
Hardhat Network has first-class support of Solidity. It always knows which
61-
smart contracts are being run and knows exactly what they do and why
62-
they fail. Learn more about it [here](../hardhat-network/README.md).
57+
Hardhat Network has first-class support of Solidity. It always knows which smart contracts are being run and knows exactly what they do and why they fail. Learn more about it [here](../hardhat-network/README.md).
6358

6459
You can set the following fields on the `hardhat` config:
6560

@@ -89,17 +84,10 @@ You can set the following fields on the `hardhat` config:
8984

9085
- `hardfork`: This setting changes how Hardhat Network works, to mimic Ethereum's mainnet at a given hardfork. It must be one of `"byzantium"`, `"constantinople"`, `"petersburg"`, `"istanbul"`, `"muirGlacier"`, and `"berlin"`. Default value: `"berlin"`
9186

92-
- `throwOnTransactionFailures`: A boolean that controls if Hardhat Network throws on transaction failures.
93-
If this value is `true`, Hardhat Network will throw [combined JavaScript and Solidity stack traces](../hardhat-network/README.md#solidity-stack-traces)
94-
on transaction failures. If it is `false`, it will return the failing transaction hash. In both cases
95-
the transactions are added into the blockchain. Default value: `true`
96-
- `throwOnCallFailures`: A boolean that controls if Hardhat Network throws on call failures.
97-
If this value is `true`, Hardhat Network will throw [combined JavaScript and Solidity stack traces](../hardhat-network/README.md#solidity-stack-traces)
98-
when a call fails. If it is `false`, it will return the call's `return data`, which can contain
99-
a revert reason. Default value: `true`
87+
- `throwOnTransactionFailures`: A boolean that controls if Hardhat Network throws on transaction failures. If this value is `true`, Hardhat Network will throw [combined JavaScript and Solidity stack traces](../hardhat-network/README.md#solidity-stack-traces) on transaction failures. If it is `false`, it will return the failing transaction hash. In both cases the transactions are added into the blockchain. Default value: `true`
88+
- `throwOnCallFailures`: A boolean that controls if Hardhat Network throws on call failures. If this value is `true`, Hardhat Network will throw [combined JavaScript and Solidity stack traces](../hardhat-network/README.md#solidity-stack-traces) when a call fails. If it is `false`, it will return the call's `return data`, which can contain a revert reason. Default value: `true`
10089

101-
- `loggingEnabled`: A boolean that controls if Hardhat Network logs every request or not. Default value: `false` for the
102-
in-process Hardhat Network provider, `true` for the Hardhat Network backed JSON-RPC server (i.e. the `node` task).
90+
- `loggingEnabled`: A boolean that controls if Hardhat Network logs every request or not. Default value: `false` for the in-process Hardhat Network provider, `true` for the Hardhat Network backed JSON-RPC server (i.e. the `node` task).
10391

10492
- `initialDate`: An optional string setting the date of the blockchain. Valid values are [Javascript's date time strings](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#Date_Time_String_Format). Default: The current date and time.
10593

@@ -112,8 +100,7 @@ You can set the following fields on the `hardhat` config:
112100

113101
### JSON-RPC based networks
114102

115-
These are networks that connect to an external node. Nodes can be running in your computer, like Ganache, or remotely,
116-
like Alchemy or Infura.
103+
These are networks that connect to an external node. Nodes can be running in your computer, like Ganache, or remotely, like Alchemy or Infura.
117104

118105
This kind of networks are configured with objects with the following fields:
119106

docs/errors/buidler-errors.md

+8-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Buidler errors
22

3-
This section contains a list of all the possible errors you may encounter when
4-
using Buidler and an explanation of each of them.
3+
This section contains a list of all the possible errors you may encounter when using Buidler and an explanation of each of them.
54

65
## General errors
76

@@ -105,15 +104,13 @@ Please check that you are sending a `data` parameter.
105104

106105
### BDLR104: Unrecognized account
107106

108-
You are trying to send a transaction or sign some data with an
109-
account not managed by your Ethereum node nor Buidler.
107+
You are trying to send a transaction or sign some data with an account not managed by your Ethereum node nor Buidler.
110108

111109
Please double check your accounts and the `from` parameter in your RPC calls.
112110

113111
### BDLR105: Missing transaction parameter
114112

115-
You are trying to send a transaction with a locally managed
116-
account, and some parameters are missing.
113+
You are trying to send a transaction with a locally managed account, and some parameters are missing.
117114

118115
Please double check your transactions' parameters.
119116

@@ -163,9 +160,7 @@ Try using another mnemonic or deriving less keys.
163160

164161
### BDLR200: Could not add positional param
165162

166-
Could add a positional param to your task because
167-
there is already a variadic positional param and it has to be the last
168-
positional one.
163+
Could add a positional param to your task because there is already a variadic positional param and it has to be the last positional one.
169164

170165
Please double check your task definitions.
171166

@@ -195,25 +190,19 @@ Please, double check your task definitions.
195190

196191
### BDLR210: Attempted to add mandatory params to an overridden task
197192

198-
You can't add mandatory (non optional) param definitions in an overridden task.
199-
The only supported param additions for overridden tasks are flags,
200-
and optional params.
193+
You can't add mandatory (non optional) param definitions in an overridden task. The only supported param additions for overridden tasks are flags, and optional params.
201194

202195
Please, double check your task definitions.
203196

204197
### BDLR211: Attempted to add positional params to an overridden task
205198

206-
You can't add positional param definitions in an overridden task.
207-
The only supported param additions for overridden tasks are flags,
208-
and optional params.
199+
You can't add positional param definitions in an overridden task. The only supported param additions for overridden tasks are flags, and optional params.
209200

210201
Please, double check your task definitions.
211202

212203
### BDLR212: Attempted to add variadic params to an overridden task
213204

214-
You can't add variadic param definitions in an overridden task.
215-
The only supported param additions for overridden tasks are flags,
216-
and optional params.
205+
You can't add variadic param definitions in an overridden task. The only supported param additions for overridden tasks are flags, and optional params.
217206

218207
Please, double check your task definitions.
219208

@@ -263,8 +252,7 @@ Please double check your arguments.
263252

264253
### BDLR302: Invalid file argument
265254

266-
One of your tasks expected a file as an argument, but you provided a
267-
non-existent or non-readable file.
255+
One of your tasks expected a file as an argument, but you provided a non-existent or non-readable file.
268256

269257
Please double check your arguments.
270258

docs/getting-started/README.md

+6-13
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ A lot of Hardhat's functionality comes from plugins, and, as a developer, you're
1212

1313
Hardhat is used through a local installation in your project. This way your environment will be reproducible, and you will avoid future version conflicts.
1414

15-
To install it, you need to create an npm project by going to an empty folder, running `npm init`,
16-
and following its instructions. Once your project is ready, you should run
15+
To install it, you need to create an npm project by going to an empty folder, running `npm init`, and following its instructions. Once your project is ready, you should run
1716

1817
```
1918
npm install --save-dev hardhat
@@ -25,8 +24,7 @@ To use your local installation of Hardhat, you need to use `npx` to run it (i.e.
2524

2625
This guide will explore the basics of creating a Hardhat project.
2726

28-
A barebones installation with no plugins allows you to create your own tasks, compile your Solidity code,
29-
run your tests and run Hardhat Network, a local development network you can deploy your contracts to.
27+
A barebones installation with no plugins allows you to create your own tasks, compile your Solidity code, run your tests and run Hardhat Network, a local development network you can deploy your contracts to.
3028

3129
To create your Hardhat project run `npx hardhat` in your project folder:
3230

@@ -49,14 +47,11 @@ Welcome to Hardhat v2.0.8
4947
Quit
5048
```
5149

52-
Let’s create the sample project and go through these steps to try out the sample task and compile, test
53-
and deploy the sample contract.
50+
Let’s create the sample project and go through these steps to try out the sample task and compile, test and deploy the sample contract.
5451

5552
The sample project will ask you to install `hardhat-waffle` and `hardhat-ethers`, which makes Hardhat compatible with tests built with Waffle. You can learn more about it [in this guide](../guides/waffle-testing.md).
5653

57-
::: tip
58-
Hardhat will let you know how, but, in case you missed it, you can install them with `npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers`
59-
:::
54+
::: tip Hardhat will let you know how, but, in case you missed it, you can install them with `npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers` :::
6055

6156
### Running tasks
6257

@@ -168,8 +163,7 @@ Changing greeting from 'Hello, world!' to 'Hola, mundo!'
168163

169164
### Deploying your contracts
170165

171-
Next, to deploy the contract we will use a Hardhat script.
172-
Inside `scripts/` you will find `sample-script.js` with the following code:
166+
Next, to deploy the contract we will use a Hardhat script. Inside `scripts/` you will find `sample-script.js` with the following code:
173167

174168
<<< @/../packages/hardhat-core/sample-project/scripts/sample-script.js
175169

@@ -206,5 +200,4 @@ npx hardhat run scripts/sample-script.js --network localhost
206200

207201
Congrats! You have created a project, ran a Hardhat task, compiled a smart contract, installed a Waffle integration plugin, wrote and ran a test using the Waffle and ethers.js plugins, and deployed a contract.
208202

209-
For any questions or feedback you may have, you can find us in the [Hardhat Discord
210-
server](https://hardhat.org/discord).
203+
For any questions or feedback you may have, you can find us in the [Hardhat Discord server](https://hardhat.org/discord).

0 commit comments

Comments
 (0)