# eth-connect

> Ethereum TypeScript API, middleware to talk to a ethereum node using an async provider

Latest version **6.4.0** (published 2026-06-24) · LGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install eth-connect
pnpm add eth-connect
yarn add eth-connect
bun add eth-connect
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; has provenance.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 6.4.0 |
| Published | 2026-06-24 |
| First published | 2018-05-30 |
| Weekly downloads | 0 |
| License | LGPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 49 |
| Maintainers | cazala, menduz, decentralandbot |
| Keywords | ethereum, typescript, web3, json-rpc, eth, API |

## Links

- npm: https://www.npmjs.com/package/eth-connect
- Repository: https://github.com/decentraland/eth-connect
- Issues: https://github.com/decentraland/eth-connect/issues
- npm.io page: https://npm.io/package/eth-connect

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 6.4.0 (latest) — 2026-06-24
- 6.3.2-20260624174951.commit-ce27c1e (next) — 2026-06-24
- 5.0.0-20210111202910.commit-7f570aa (tag-v5.0.0) — 2021-01-11
- 6.3.1 — 2026-06-24
- 6.2.5-20260624165954.commit-5ab5390 — 2026-06-24
- 6.2.5-20260624144334.commit-458c75e — 2026-06-24
- 6.2.5-20260604201538.commit-ef067bd — 2026-06-04
- 6.2.5-20260604200658.commit-ef067bd — 2026-06-04
- 6.2.5-20240104144037.commit-6006c46 — 2024-01-04
- 6.2.4 — 2024-01-01
- 6.2.3-20231229180638.commit-b2fa644 — 2023-12-29
- 6.2.2 — 2023-12-05
- 6.2.2-20231205134322.commit-7d6cff2 — 2023-12-05
- 6.2.2-20231128142247.commit-fc02b6e — 2023-11-28
- 6.2.2-20231113201810.commit-ed02536 — 2023-11-13
- … 99 more at https://npm.io/package/eth-connect/versions

## README

# eth-connect

[![NPM version](https://badge.fury.io/js/eth-connect.svg)](https://npmjs.org/package/eth-connect)
[![codecov](https://codecov.io/gh/decentraland/eth-connect/branch/master/graph/badge.svg)](https://codecov.io/gh/decentraland/eth-connect)
[![Install Size](https://packagephobia.now.sh/badge?p=eth-connect)](https://packagephobia.now.sh/result?p=eth-connect)

_eth-connect_ is a TypeScript-based [web3](https://github.com/ethereum/web3.js) library alternative which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) spec as well.

You can follow the [JavaScript API documentation](https://github.com/ethereum/wiki/wiki/JavaScript-API) until TypeScript docs are released.


## Design goals

- A Typed web3.js alternative
- Have as few convention-invented functions as possible (by following the RPC specs as much as possible)
- Leverage WS and HTTP providers
- Portable (support and work equally in both browser and node)
- Painless `eth` usage: Using contract factories, well-split event types (block, transaction and contracts plus topics)
- `async/await` out of the box

## Installation

Using NPM:

```bash
npm i eth-connect
```

Importing as a browser module:

```html
<script src="https://unpkg.com/eth-connect@latest/eth-connect.js"></script>
```

## Examples

Below are some simple illustrative examples.
You can also find more complete examples are in the integration `/tests` folder.

### Initialize with a provider

```ts
import { RequestManager } from 'eth-connect'

// using the injected MetaMask provider
const requestManager = new RequestManager(web3.currentProvider)

const myBalance = await requestManager.eth_getBalance(myAddress)
```

or

```ts
import { RequestManager, HTTPProvider } from 'eth-connect'

const provider = 'my-own-RPC-url'
const providerInstance = new HTTPProvider(provider)
const requestManager = new RequestManager(providerInstance)

const someBalance = await requestManager.eth_getBalance(someAddress)
```

### Initialize a contract

```ts
import { RequestManager, ContractFactory } from 'eth-connect'

const abi = require('./some-contract-abi.json')
// using the injected MetaMask provider
const requestManager = new RequestManager(web3.currentProvider)

const factory = new ContractFactory(requestManager, abi)
const instance = await factory.at(address)

console.log('Calling a method', await instance.mint(myAddress))
```

### Get the accounts

```ts
import { RequestManager } from 'eth-connect'

const requestManager = new RequestManager(web3.currentProvider)

const accounts = await requestManager.eth_accounts()
```

## Build the project

Clone this project and run the following in the terminal:

```bash
make build
```

## Run tests

```bash
make test-local
```

## Comparison

|                    |  `web3`  | `eth-connect` |
| ------------------ | :------: | :-----------: |
| Browser support    |    ✔     |       ✔       |
| Promise API        |    ✖     |       ✔       |
| Strict type checks |    ✖     |       ✔       |
| TS/JS Docs         |    ✖     |       ✔       |
| Wiki Docs          |    ✔     |       ?       |
| Coverage           | ![][wc]  |    ![][ec]    |
| Dependents         | ![][wdp] |   ![][edp]    |
| Install size       | ![][wis] |   ![][eis]    |

<!-- DOWNLOADS -->

[wd]: https://img.shields.io/npm/dm/web3.svg
[ed]: https://img.shields.io/npm/dm/eth-connect.svg

<!-- COVERAGE -->

[wc]: https://coveralls.io/repos/ethereum/web3.js/badge.svg?branch=master
[ec]: https://codecov.io/gh/decentraland/eth-connect/branch/master/graph/badge.svg

<!-- BUILD -->

[wb]: https://travis-ci.org/ethereum/web3.js.svg
[eb]: https://travis-ci.org/decentraland/eth-connect.svg?branch=master

<!-- DEPENDENTS -->

[wdp]: https://badgen.net/npm/dependents/web3
[edp]: https://badgen.net/npm/dependents/eth-connect

<!-- INSTALL SIZE -->

[wis]: https://packagephobia.now.sh/badge?p=web3
[eis]: https://packagephobia.now.sh/badge?p=eth-connect

## Full documentation

Follow this link to read the full documentation for eth-connect [here](docs/index.md).

## Project Status

You may find issues while using this library, as it's still under development. Please report any issues you come accross.

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