# ethereum-universal-forwarder

> Universale Forwarder for Meta Transactions

Latest version **2.0.0-beta** (published 2022-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install ethereum-universal-forwarder
pnpm add ethereum-universal-forwarder
yarn add ethereum-universal-forwarder
bun add ethereum-universal-forwarder
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0-beta |
| Published | 2022-09-28 |
| First published | 2021-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 12.18.0 |
| Dependencies | 1 |
| Unpacked size | 2.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | wighawag |
| Maintainers | wighawag |
| Keywords | ethereum, smart-contracts, template, boilerplate, hardhat, solidity |

## Links

- npm: https://www.npmjs.com/package/ethereum-universal-forwarder
- Repository: https://github.com/wighawag/universal-forwarder
- Homepage: https://github.com/wighawag/universal-forwarder#readme
- Issues: https://github.com/wighawag/universal-forwarder/issues
- npm.io page: https://npm.io/package/ethereum-universal-forwarder

## Dependencies (1)

- [@ethersproject/abstract-signer](https://npm.io/package/@ethersproject/abstract-signer.md) ^5.7.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.0-beta (latest) — 2022-09-28
- 0.1.4 — 2021-06-18
- 0.1.3 — 2021-06-11
- 0.1.2 — 2021-06-11
- 0.1.1 — 2021-06-10
- 0.1.0 — 2021-06-10

## README

# INTRODUCTION

This repository implements a generic EIP-2771 compliant forwarder that is fully future proof and universal.

It actually comes with 2 different implementation, the UniversalForwarder and the ForwarderRegistry.

# UniversalForwarder

The UniversalForwarder is the most simple and generic forwarder possible. It requires zero storage read or write but approval are for eternity.

It does that by requiring the caller / relayer to always provide a signature along the call.

# ForwarderRegistry

The ForwarderRegistry instead keep a record of approved forwarder for each user. It thus comes at a higher gas cost overall.

Its advantages is that user are able to revoke approved forwarder if desired.

# Usage

The reposiroty is also a npm package [ethereum-universal-forwarder](https://www.npmjs.com/package/ethereum-universal-forwarder) and contains abstract contract you can import in your code to get started with these forwarders.

If you use [hardhat-deploy](https://github.com/wighawag/hardhat-deploy), it also come with exported deploy script that you can use to have the contract available in your test or specific networks very easily.

An example repo can be found here : https://github.com/wighawag/test-ethereum-universal-forwarder

# DEVELOPMENT

## INSTALL

```bash
yarn
```

## TEST

```bash
yarn test
```

## SCRIPTS

Here is the list of npm scripts you can execute:

Some of them relies on [./\_scripts.js](./_scripts.js) to allow parameterizing it via command line argument (have a look inside if you need modifications)
<br/><br/>

`yarn prepare`

As a standard lifecycle npm script, it is executed automatically upon install. It generate config file and typechain to get you started with type safe contract interactions
<br/><br/>

`yarn lint`, `yarn lint:fix`, `yarn format` and `yarn format:fix`

These will lint and format check your code. the `:fix` version will modifiy the files to match the requirement specified in `.eslintrc` and `.prettierrc.`
<br/><br/>

`yarn compile`

These will compile your contracts
<br/><br/>

`yarn void:deploy`

This will deploy your contracts on the in-memory hardhat network and exit, leaving no trace. quick way to ensure deployments work as intended without consequences
<br/><br/>

`yarn test [mocha args...]`

These will execute your tests using mocha. you can pass extra arguments to mocha
<br/><br/>

`yarn coverage`

These will produce a coverage report in the `coverage/` folder
<br/><br/>

`yarn gas`

These will produce a gas report for function used in the tests
<br/><br/>

`yarn dev`

These will run a local hardhat network on `localhost:8545` and deploy your contracts on it. Plus it will watch for any changes and redeploy them.
<br/><br/>

`yarn local:dev`

This assumes a local node it running on `localhost:8545`. It will deploy your contracts on it. Plus it will watch for any changes and redeploy them.
<br/><br/>

`yarn execute <network> <file.ts> [args...]`

This will execute the script `<file.ts>` against the specified network
<br/><br/>

`yarn deploy <network> [args...]`

This will deploy the contract on the specified network.

Behind the scene it uses `hardhat deploy` command so you can append any argument for it
<br/><br/>

`yarn export <network> <file.json>`

This will export the abi+address of deployed contract to `<file.json>`
<br/><br/>

`yarn fork:execute <network> [--blockNumber <blockNumber>] [--deploy] <file.ts> [args...]`

This will execute the script `<file.ts>` against a temporary fork of the specified network

if `--deploy` is used, deploy scripts will be executed
<br/><br/>

`yarn fork:deploy <network> [--blockNumber <blockNumber>] [args...]`

This will deploy the contract against a temporary fork of the specified network.

Behind the scene it uses `hardhat deploy` command so you can append any argument for it
<br/><br/>

`yarn fork:test <network> [--blockNumber <blockNumber>] [mocha args...]`

This will test the contract against a temporary fork of the specified network.
<br/><br/>

`yarn fork:dev <network> [--blockNumber <blockNumber>] [args...]`

This will deploy the contract against a fork of the specified network and it will keep running as a node.

Behind the scene it uses `hardhat node` command so you can append any argument for it

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