# hardhat-deploy-ethers

> Hardhat TypeScript plugin boilerplate

Latest version **0.4.2** (published 2024-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install hardhat-deploy-ethers
pnpm add hardhat-deploy-ethers
yarn add hardhat-deploy-ethers
bun add hardhat-deploy-ethers
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2024-04-28 |
| First published | 2020-10-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 37.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Ronan Sandford |
| Maintainers | wighawag |
| Keywords | ethereum, smart-contracts, hardhat, hardhat-plugin |

## Links

- npm: https://www.npmjs.com/package/hardhat-deploy-ethers
- Repository: https://github.com/wighawag/hardhat-plugin-template
- Homepage: https://github.com/wighawag/hardhat-plugin-template#readme
- Issues: https://github.com/wighawag/hardhat-plugin-template/issues
- npm.io page: https://npm.io/package/hardhat-deploy-ethers

## Recent versions

- 0.4.2 (latest) — 2024-04-28
- 0.4.0-next.1 (next) — 2023-02-16
- 0.4.1 — 2023-06-25
- 0.4.0 — 2023-06-25
- 0.4.0-next.0 — 2023-02-15
- 0.3.0-beta.13 — 2022-01-04
- 0.3.0-beta.12 — 2021-12-25
- 0.3.0-beta.11 — 2021-10-01
- 0.3.0-beta.10 — 2021-06-10
- 0.3.0-beta.9 — 2021-06-10
- 0.3.0-beta.8 — 2021-06-03
- 0.3.0-beta.7 — 2020-11-29
- 0.3.0-beta.6 — 2020-11-16
- 0.3.0-beta.5 — 2020-10-22
- 0.3.0-beta.4 — 2020-10-22
- … 1 more at https://npm.io/package/hardhat-deploy-ethers/versions

## README

[![hardhat](https://hardhat.org/buidler-plugin-badge.svg?1)](https://hardhat.org)

# hardhat-deploy-ethers

[Hardhat](https://hardhat.org) plugin extension for `@nomicfoundation/hardhat-ethers` and its integration with [ethers.js](https://github.com/ethers-io/ethers.js/).

The extension add support for [hardhat-deploy](https://github.com/wighawag/hardhat-deploy).

## What

## Installation

`hardhat-deploy-ethers` require the installation of `hardhat-deploy` and `@nomicfoundation/hardhat-ethers`

Note that you cannot use `@nomicfoundation/hardhat-toolbox` for installing `@nomicfoundation/hardhat-ethers` as this interfere with the typing extensions provided by `hardhat-deploy-ethers`

```bash
npm install --save-dev @nomicfoundation/hardhat-ethers ethers hardhat-deploy hardhat-deploy-ethers
```

Which means you then add the following statement to your `hardhat.config.js`:

```js
require("@nomicfoundation/hardhat-ethers");
require("hardhat-deploy");
require("hardhat-deploy-ethers");
``` 

Or, if you are using TypeScript, add this to your `hardhat.config.ts`:

```ts
import '@nomicfoundation/hardhat-ethers';
import 'hardhat-deploy';
import 'hardhat-deploy-ethers';

```


Note that if you were using `@nomicfoundation/hardhat-toolbox` you can simply add the dependencies it added for you with

```bash
npm install --save-dev @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @typechain/hardhat hardhat-gas-reporter solidity-coverage
```

and add them to your hardhat.config.js

```js
require('@nomicfoundation/hardhat-chai-matchers');
require('@nomicfoundation/hardhat-ethers');
require('@typechain/hardhat');
require('hardhat-gas-reporter');
require('solidity-coverage');
```

or hardhat.config.ts (typescript)

```ts
import '@nomicfoundation/hardhat-chai-matchers';
import '@nomicfoundation/hardhat-ethers';
import '@typechain/hardhat';
import 'hardhat-gas-reporter';
import 'solidity-coverage';
```

## Tasks

This plugin creates no additional tasks.

## Environment extensions

This object has add some extra `hardhat-deploy` specific functionalities to the `hre.ethers` added already by `@nomicfoundation/hardhat-ethers`

### Helpers

These helpers are added to the `ethers` object:

```ts
interface HardhatEthersHelpers {
  getContractAtWithSignerAddress: <ContractType extends ethers.BaseContract = ethers.BaseContract>(nameOrAbi: string | any[], address: string, signer: string) => Promise<ContractType>;
  getSignerOrNull: (address: string) => Promise<SignerWithAddress | null>;
  getNamedSigners: () => Promise<Record<string, SignerWithAddress>>;
  getNamedSigner: (name: string) => Promise<SignerWithAddress>;
  getNamedSignerOrNull: (name: string) => Promise<SignerWithAddress | null>;
  getUnnamedSigners: () => Promise<SignerWithAddress[]>;
  getContract: <ContractType extends ethers.BaseContract = ethers.BaseContract>(name: string, signer?: ethers.Signer | string) => Promise<ContractType>;
  getContractOrNull: <ContractType extends ethers.BaseContract = ethers.BaseContract>(name: string, signer?: ethers.Signer | string) => Promise<ContractType | null>;
}
```


## Usage

There are no additional steps you need to take for this plugin to work.


It automatically integrate with the `hardhat-deploy` plugin if detected and let you do the following:

```js
const contract = await hre.ethers.getContract('<deploymentName>');
```

---
_Source: https://npm.io/package/hardhat-deploy-ethers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
