https://github.com/dmihal/hardhat-change-network
https://github.com/dmihal/hardhat-change-network
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dmihal/hardhat-change-network
- Owner: dmihal
- License: mit
- Created: 2021-06-22T12:08:35.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-09T07:30:32.000Z (over 1 year ago)
- Last Synced: 2025-03-28T13:44:31.499Z (3 months ago)
- Language: TypeScript
- Size: 341 KB
- Stars: 33
- Watchers: 3
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hardhat-change-network
Allows changing the current network in Hardhat.
Useful for multi-chain projects, where switching between two networks in a script may be desirable.
_Warning: This is a bit of a hack, some modules may break._
## Installation
```bash
yarn add hardhat-change-network
```Import the plugin in your `hardhat.config.js`:
```js
require("hardhat-change-network");
```Or if you are using TypeScript, in your `hardhat.config.ts`:
```ts
import "hardhat-change-network";
```## Usage
Change the network to any network defined in hardhat.config.js with this simple call:
```javascript
hre.changeNetwork('goerli');
```You can also use this library to retrieve a standard web3 provider object for a given network:
```javascript
const provider = hre.getProvider('goerli');
```