You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop/smart-contracts/dev-environments/hardhat.md
+22-4Lines changed: 22 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Before getting started, ensure you have:
51
51
3. To interact with Polkadot, Hardhat requires the following plugin to compile contracts to PolkaVM bytecode and to spawn a local node compatible with PolkaVM:
@@ -66,11 +66,9 @@ Before getting started, ensure you have:
66
66
- **`test`** - contains your test files that validate contract functionality
67
67
- **`ignition`** - deployment modules for safely deploying your contracts to various networks
68
68
69
-
5. Add the following folders to the `.gitignore` file ifthey are not already there:
69
+
5. Add the following folder to the `.gitignore` file ifit is not already there:
70
70
71
71
```bash
72
-
echo'/artifacts-pvm'>> .gitignore
73
-
echo'/cache-pvm'>> .gitignore
74
72
echo'/ignition/deployments/'>> .gitignore
75
73
```
76
74
@@ -163,6 +161,9 @@ Configure a local node setup by adding the node binary path along with the ETH-R
163
161
164
162
Replace `INSERT_PATH_TO_SUBSTRATE_NODE` and `INSERT_PATH_TO_ETH_RPC_ADAPTER` with the actual paths to your compiled binaries. The `dev: true` flag configures both the node and adapter for development mode. To obtain these binaries, check the [Installation](/develop/smart-contracts/local-development-node#install-the-substrate-node-and-eth-rpc-adapter){target=\_blank} section on the Local Development Node page.
165
163
164
+
!!! warning
165
+
If you're using the default `hardhat.config.js` created by the `hardhat-polkadot` plugin, it includes a `forking` section pointing to the Polkadot Hub TestNet. When you run `npx hardhat node`, Hardhat will start a fork of that network. To use your local node instead, comment out the `forking` section; otherwise, `npx hardhat node` will continue to use the forked network even if a local node is defined in the configuration.
166
+
166
167
Once configured, start your chosen testing environment with:
167
168
168
169
```bash
@@ -283,6 +284,23 @@ Run your interaction script:
283
284
npx hardhat run scripts/interact.js --network polkadotHubTestnet
284
285
```
285
286
287
+
## Upgrading the Plugin
288
+
289
+
If you already have a Hardhat Polkadot project and want to upgrade to a newer version of the plugin, to avoid errors (for example, `Cannot find module 'run-container'`), you can clean your dependencies by running the following commands:
290
+
291
+
```bash
292
+
rm -rf node_modules package-lock.json
293
+
```
294
+
295
+
After that, you can upgrade the plugin to the latest version by running the following commands:
Consider using [Node.js](https://nodejs.org/){target=\_blank} 22.18+ and [npm](https://www.npmjs.com/){target=\_blank} version 10.9.0+ to avoid issues with the plugin.
303
+
286
304
## Where to Go Next
287
305
288
306
Hardhat provides a powerful environment for developing, testing, and deploying smart contracts on Polkadot Hub. Its plugin architecture allows seamless integration with PolkaVM through the `hardhat-resolc` and `hardhat-revive-node` plugins.
Copy file name to clipboardExpand all lines: llms.txt
+24-7Lines changed: 24 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -8450,7 +8450,7 @@ Before getting started, ensure you have:
8450
8450
3. To interact with Polkadot, Hardhat requires the following plugin to compile contracts to PolkaVM bytecode and to spawn a local node compatible with PolkaVM:
@@ -8465,11 +8465,9 @@ Before getting started, ensure you have:
8465
8465
- **`test`** - contains your test files that validate contract functionality
8466
8466
- **`ignition`** - deployment modules for safely deploying your contracts to various networks
8467
8467
8468
-
5. Add the following folders to the `.gitignore` file if they are not already there:
8468
+
5. Add the following folder to the `.gitignore` file if it is not already there:
8469
8469
8470
8470
```bash
8471
-
echo '/artifacts-pvm' >> .gitignore
8472
-
echo '/cache-pvm' >> .gitignore
8473
8471
echo '/ignition/deployments/' >> .gitignore
8474
8472
```
8475
8473
@@ -8604,6 +8602,9 @@ module.exports = {
8604
8602
8605
8603
Replace `INSERT_PATH_TO_SUBSTRATE_NODE` and `INSERT_PATH_TO_ETH_RPC_ADAPTER` with the actual paths to your compiled binaries. The `dev: true` flag configures both the node and adapter for development mode. To obtain these binaries, check the [Installation](/develop/smart-contracts/local-development-node#install-the-substrate-node-and-eth-rpc-adapter){target=\_blank} section on the Local Development Node page.
8606
8604
8605
+
!!! warning
8606
+
If you're using the default `hardhat.config.js` created by the `hardhat-polkadot` plugin, it includes a `forking` section pointing to the Polkadot Hub TestNet. When you run `npx hardhat node`, Hardhat will start a fork of that network. To use your local node instead, comment out the `forking` section; otherwise, `npx hardhat node` will continue to use the forked network even if a local node is defined in the configuration.
8607
+
8607
8608
Once configured, start your chosen testing environment with:
8608
8609
8609
8610
```bash
@@ -8789,6 +8790,23 @@ Run your interaction script:
8789
8790
npx hardhat run scripts/interact.js --network polkadotHubTestnet
8790
8791
```
8791
8792
8793
+
## Upgrading the Plugin
8794
+
8795
+
If you already have a Hardhat Polkadot project and want to upgrade to a newer version of the plugin, to avoid errors (for example, `Cannot find module 'run-container'`), you can clean your dependencies by running the following commands:
8796
+
8797
+
```bash
8798
+
rm -rf node_modules package-lock.json
8799
+
```
8800
+
8801
+
After that, you can upgrade the plugin to the latest version by running the following commands:
Consider using [Node.js](https://nodejs.org/){target=\_blank} 22.18+ and [npm](https://www.npmjs.com/){target=\_blank} version 10.9.0+ to avoid issues with the plugin.
8809
+
8792
8810
## Where to Go Next
8793
8811
8794
8812
Hardhat provides a powerful environment for developing, testing, and deploying smart contracts on Polkadot Hub. Its plugin architecture allows seamless integration with PolkaVM through the `hardhat-resolc` and `hardhat-revive-node` plugins.
@@ -41205,7 +41223,7 @@ Let's start by setting up Hardhat for your Storage contract project:
41205
41223
3. Install `hardhat-polkadot` and all required plugins:
The `beforeEach` hook ensures stateless contract execution by redeploying a fresh instance of the Storage contract before each test case. This approach guarantees that each test starts with a clean and independent contract state by using `ethers.getSigners()` to obtain test accounts and `ethers.getContractFactory('Storage').deploy()` to create a new contract instance.
@@ -125,7 +125,7 @@ Testing is a critical part of smart contract development. Hardhat makes it easy
125
125
a. **Initial state verification** - ensures that the contract starts with a default value of zero, which is a fundamental expectation for the `Storage.sol` contract
0 commit comments