JSPM

eth-connect

0.3.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9346
  • Score
    100M100P100Q112625F
  • License LGPL-3.0

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

Package Exports

  • eth-connect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eth-connect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

eth-connect, a TypeScript-based web3 library

Build Status

codecov

Not ready for production!

We are still developing this tool. Watch the project to receive updates.

npm i eth-connect

Examples

The best examples are in the integration tests folder, anyway here are some simple examples:

Initializing with a provider

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

const myBalance = await requestManager.eth_getBalance(myAddress)

Initializing a contract

const abi = [...]
// 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))

Getting the accounts

const requestManager = new RequestManager(web3.currentProvider)

const accounts = await requestManager.eth_accounts()

How to build project

Run: npm run build

or if you are on dev mode

npm run build -- --watch

Take in consideration that this will only build src files, if you also want to run build test files just for fun do:

./node_modules/.bin/tsc --watch

How to run tests

On one terminal run:

./start-local-node.sh It starts a geth node using Docker

On a second terminal run:

npm run test or npm run test -- --watch