eth-connect is a TypeScript-based web3 library alternative which implements the Generic JSON RPC spec as well.
You can follow the JavaScript API documentation until TypeScript docs are released.
- 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
ethusage: Using contract factories, well-split event types (block, transaction and contracts plus topics) async/awaitout of the box
Using NPM:
npm i eth-connectImporting as a browser module:
<script src="https://unpkg.com/eth-connect@latest/eth-connect.js"></script>Below are some simple illustrative examples.
You can also find more complete examples are in the integration /tests folder.
import { RequestManager } from 'eth-connect'
// using the injected MetaMask provider
const requestManager = new RequestManager(web3.currentProvider)
const myBalance = await requestManager.eth_getBalance(myAddress)or
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)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))import { RequestManager } from 'eth-connect'
const requestManager = new RequestManager(web3.currentProvider)
const accounts = await requestManager.eth_accounts()Clone this project and run the following in the terminal:
make buildmake test-localweb3 |
eth-connect |
|
|---|---|---|
| Browser support | β | β |
| Promise API | β | β |
| Strict type checks | β | β |
| TS/JS Docs | β | β |
| Wiki Docs | β | ? |
| Coverage | ||
| Dependents | ||
| Install size |
Follow this link to read the full documentation for eth-connect here.
You may find issues while using this library, as it's still under development. Please report any issues you come accross.